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