These changes are the raw update to qemu-2.6.
[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_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         void ( * startup ) ( void );
43         void ( * shutdown ) ( int booting );
44 };
45
46 /** Startup/shutdown function table */
47 #define STARTUP_FNS __table ( struct startup_fn, "startup_fns" )
48
49 /** Declare a startup/shutdown function */
50 #define __startup_fn( startup_order ) \
51         __table_entry ( STARTUP_FNS, startup_order )
52
53 /** @defgroup startfn_order Startup/shutdown function ordering
54  *
55  * Shutdown functions are called in the reverse order to startup
56  * functions.
57  *
58  * @{
59  */
60
61 #define STARTUP_EARLY   01      /**< Early startup */
62 #define STARTUP_NORMAL  02      /**< Normal startup */
63 #define STARTUP_LATE    03      /**< Late startup */
64
65 /** @} */
66
67 extern void initialise ( void );
68 extern void startup ( void );
69 extern void shutdown ( int booting );
70
71 /**
72  * Shut down system for OS boot
73  *
74  */
75 static inline void shutdown_boot ( void ) {
76         shutdown ( 1 );
77 }
78
79 /**
80  * Shut down system for exit back to firmware
81  *
82  */
83 static inline void shutdown_exit ( void ) {
84         shutdown ( 0 );
85 }
86
87 #endif /* _IPXE_INIT_H */