iPXE
init.h
Go to the documentation of this file.
1#ifndef _IPXE_INIT_H
2#define _IPXE_INIT_H
3
4FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5FILE_SECBOOT ( PERMITTED );
6
7#include <ipxe/tables.h>
8
9/**
10 * An initialisation function
11 *
12 * Initialisation functions are called exactly once, as part of the
13 * call to initialise().
14 */
15struct init_fn {
16 const char *name;
17 void ( * initialise ) ( void );
18};
19
20/** Initialisation function table */
21#define INIT_FNS __table ( struct init_fn, "init_fns" )
22
23/** Declare an initialisation functon */
24#define __init_fn( init_order ) __table_entry ( INIT_FNS, init_order )
25
26/** @defgroup initfn_order Initialisation function ordering
27 * @{
28 */
29
30#define INIT_EARLY 01 /**< Early initialisation */
31#define INIT_CONSOLE 02 /**< Console initialisation */
32#define INIT_NORMAL 03 /**< Normal initialisation */
33#define INIT_LATE 04 /**< Late initialisation */
34
35/** @} */
36
37/**
38 * A startup/shutdown function
39 *
40 * Startup and shutdown functions may be called multiple times, as
41 * part of the calls to startup() and shutdown().
42 */
43struct startup_fn {
44 const char *name;
45 void ( * startup ) ( void );
46 void ( * shutdown ) ( int booting );
47};
48
49/** Startup/shutdown function table */
50#define STARTUP_FNS __table ( struct startup_fn, "startup_fns" )
51
52/** Declare a startup/shutdown function */
53#define __startup_fn( startup_order ) \
54 __table_entry ( STARTUP_FNS, startup_order )
55
56/** @defgroup startfn_order Startup/shutdown function ordering
57 *
58 * Shutdown functions are called in the reverse order to startup
59 * functions.
60 *
61 * @{
62 */
63
64#define STARTUP_EARLY 01 /**< Early startup */
65#define STARTUP_NORMAL 02 /**< Normal startup */
66#define STARTUP_LATE 03 /**< Late startup */
67
68/** @} */
69
70extern void initialise ( void );
71extern void startup ( void );
72extern void shutdown ( int booting );
73
74/**
75 * Shut down system for OS boot
76 *
77 */
78static inline void shutdown_boot ( void ) {
79 shutdown ( 1 );
80}
81
82/**
83 * Shut down system for exit back to firmware
84 *
85 */
86static inline void shutdown_exit ( void ) {
87 shutdown ( 0 );
88}
89
90#endif /* _IPXE_INIT_H */
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
static void shutdown_exit(void)
Shut down system for exit back to firmware.
Definition init.h:86
void shutdown(int booting)
Shut down iPXE.
Definition init.c:101
void startup(void)
Start up iPXE.
Definition init.c:70
void initialise(void)
Initialise iPXE.
Definition init.c:53
static void shutdown_boot(void)
Shut down system for OS boot.
Definition init.h:78
An initialisation function.
Definition init.h:15
const char * name
Definition init.h:16
void(* initialise)(void)
Definition init.h:17
A startup/shutdown function.
Definition init.h:43
void(* startup)(void)
Definition init.h:45
const char * name
Definition init.h:44
void(* shutdown)(int booting)
Definition init.h:46
Linker tables.