[contrib] Allow Network Protocol header to display in rom-o-matic
[gpxe.git] / src / include / gpxe / init.h
bloba72cba7a7325bcf631cb5ea80caab99e33932e10
1 #ifndef _GPXE_INIT_H
2 #define _GPXE_INIT_H
4 FILE_LICENCE ( GPL2_OR_LATER );
6 #include <gpxe/tables.h>
8 /**
9 * An initialisation function
11 * Initialisation functions are called exactly once, as part of the
12 * call to initialise().
14 struct init_fn {
15 void ( * initialise ) ( void );
18 /** Initialisation function table */
19 #define INIT_FNS __table ( struct init_fn, "init_fns" )
21 /** Declare an initialisation functon */
22 #define __init_fn( init_order ) __table_entry ( INIT_FNS, init_order )
24 /** @defgroup initfn_order Initialisation function ordering
25 * @{
28 #define INIT_EARLY 01 /**< Early initialisation */
29 #define INIT_SERIAL 02 /**< Serial driver initialisation */
30 #define INIT_CONSOLE 03 /**< Console initialisation */
31 #define INIT_NORMAL 04 /**< Normal initialisation */
33 /** @} */
35 /** Shutdown flags */
36 enum shutdown_flags {
37 /** Shutdown is in order to exit (return to gPXE's caller) */
38 SHUTDOWN_EXIT = 0x0001,
39 /** Shutdown is in order to boot an OS */
40 SHUTDOWN_BOOT = 0x0002,
41 /** Do not remove devices */
42 SHUTDOWN_KEEP_DEVICES = 0x0004,
45 /**
46 * A startup/shutdown function
48 * Startup and shutdown functions may be called multiple times, as
49 * part of the calls to startup() and shutdown().
51 struct startup_fn {
52 void ( * startup ) ( void );
53 void ( * shutdown ) ( int flags );
56 /** Startup/shutdown function table */
57 #define STARTUP_FNS __table ( struct startup_fn, "startup_fns" )
59 /** Declare a startup/shutdown function */
60 #define __startup_fn( startup_order ) \
61 __table_entry ( STARTUP_FNS, startup_order )
63 /** @defgroup startfn_order Startup/shutdown function ordering
65 * Shutdown functions are called in the reverse order to startup
66 * functions.
68 * @{
71 #define STARTUP_EARLY 01 /**< Early startup */
72 #define STARTUP_NORMAL 02 /**< Normal startup */
73 #define STARTUP_LATE 03 /**< Late startup */
75 /** @} */
77 extern void initialise ( void );
78 extern void startup ( void );
79 extern void shutdown ( int flags );
81 #endif /* _GPXE_INIT_H */