MOS Source Code
Loading...
Searching...
No Matches
setup.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include <mos/types.h>
6
7typedef enum
8{
9 INIT_TARGET_POST_MM, // Post memory management
10 INIT_TARGET_SLAB_AUTOINIT, // Slab allocator
11 INIT_TARGET_POWER, // Power management subsystem
12 INIT_TARGET_PRE_VFS, // Pre-virtual file system
13 INIT_TARGET_VFS, // Virtual file system
14 INIT_TARGET_SYSFS, // sysfs filesystem
15 INIT_TARGET_KTHREAD, // Kernel threads
17
18typedef struct
19{
20 const char *param;
21 bool (*hook)(const char *arg);
23
24typedef struct
25{
27 void (*init_fn)(void);
29
30#define MOS_EARLY_SETUP(_param, _fn) \
31 static bool _fn(const char *arg); \
32 MOS_PUT_IN_SECTION(".mos.early_setup", mos_cmdline_hook_t, __setup_##_fn, { .param = _param, .hook = _fn }); \
33 static bool _fn(const char *arg)
34
35#define MOS_SETUP(_param, _fn) \
36 static bool _fn(const char *arg); \
37 MOS_PUT_IN_SECTION(".mos.setup", mos_cmdline_hook_t, __setup_##_fn, { .param = _param, .hook = _fn }); \
38 static bool _fn(const char *arg)
39
40#define MOS_INIT(_comp, _fn) \
41 static void _fn(void); \
42 MOS_PUT_IN_SECTION(".mos.init", mos_init_t, __init_##_fn, { .target = INIT_TARGET_##_comp, .init_fn = _fn }); \
43 static void _fn(void)
44
46
50
MOSAPI void(1, 2) fatal_abort(const char *fmt
#define __END_DECLS
Definition mos_global.h:23
#define __BEGIN_DECLS
Definition mos_global.h:22
int bool
Definition pb_syshdr.h:57
init_target_t
Definition setup.h:8
@ INIT_TARGET_POST_MM
Definition setup.h:9
@ INIT_TARGET_PRE_VFS
Definition setup.h:12
@ INIT_TARGET_KTHREAD
Definition setup.h:15
@ INIT_TARGET_POWER
Definition setup.h:11
@ INIT_TARGET_SLAB_AUTOINIT
Definition setup.h:10
@ INIT_TARGET_VFS
Definition setup.h:13
@ INIT_TARGET_SYSFS
Definition setup.h:14
void startup_invoke_early_cmdline_hooks(void)
Definition setup.c:56
__BEGIN_DECLS void startup_invoke_cmdline_hooks(void)
Definition setup.c:49
void startup_invoke_autoinit(init_target_t target)
Definition setup.c:8
const char * param
Definition setup.h:20
init_target_t target
Definition setup.h:26