Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / init.h
1 #ifndef _IPXE_INIT_H
2 #define _IPXE_INIT_H
3
4 FILE_LICENCE ( GPL2_OR_LATER );
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_SERIAL     02      /**< Serial driver initialisation */
30 #define INIT_CONSOLE    03      /**< Console initialisation */
31 #define INIT_NORMAL     04      /**< Normal initialisation */
32 #define INIT_LATE       05      /**< Late initialisation */
33
34 /** @} */
35
36 /**
37  * A startup/shutdown function
38  *
39  * Startup and shutdown functions may be called multiple times, as
40  * part of the calls to startup() and shutdown().
41  */
42 struct startup_fn {
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 */