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
7
typedef
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
16
}
init_target_t
;
17
18
typedef
struct
19
{
20
const
char
*
param
;
21
bool
(*hook)(
const
char
*arg);
22
}
mos_cmdline_hook_t
;
23
24
typedef
struct
25
{
26
init_target_t
target
;
27
void
(*init_fn)(
void
);
28
}
mos_init_t
;
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
45
__BEGIN_DECLS
46
47
void
startup_invoke_cmdline_hooks
(
void
);
48
void
startup_invoke_early_cmdline_hooks
(
void
);
49
void
startup_invoke_autoinit
(
init_target_t
target);
50
51
__END_DECLS
void
MOSAPI void(1, 2) fatal_abort(const char *fmt
__END_DECLS
#define __END_DECLS
Definition
mos_global.h:23
__BEGIN_DECLS
#define __BEGIN_DECLS
Definition
mos_global.h:22
bool
int bool
Definition
pb_syshdr.h:57
init_target_t
init_target_t
Definition
setup.h:8
INIT_TARGET_POST_MM
@ INIT_TARGET_POST_MM
Definition
setup.h:9
INIT_TARGET_PRE_VFS
@ INIT_TARGET_PRE_VFS
Definition
setup.h:12
INIT_TARGET_KTHREAD
@ INIT_TARGET_KTHREAD
Definition
setup.h:15
INIT_TARGET_POWER
@ INIT_TARGET_POWER
Definition
setup.h:11
INIT_TARGET_SLAB_AUTOINIT
@ INIT_TARGET_SLAB_AUTOINIT
Definition
setup.h:10
INIT_TARGET_VFS
@ INIT_TARGET_VFS
Definition
setup.h:13
INIT_TARGET_SYSFS
@ INIT_TARGET_SYSFS
Definition
setup.h:14
startup_invoke_early_cmdline_hooks
void startup_invoke_early_cmdline_hooks(void)
Definition
setup.c:56
startup_invoke_cmdline_hooks
__BEGIN_DECLS void startup_invoke_cmdline_hooks(void)
Definition
setup.c:49
startup_invoke_autoinit
void startup_invoke_autoinit(init_target_t target)
Definition
setup.c:8
mos_cmdline_hook_t
Definition
setup.h:19
mos_cmdline_hook_t::param
const char * param
Definition
setup.h:20
mos_init_t
Definition
setup.h:25
mos_init_t::target
init_target_t target
Definition
setup.h:26
types.h
kernel
include
private
mos
misc
setup.h
Generated on Sun Sep 1 2024 18:22:52 for MOS Source Code by
1.12.0