4 #include <gpxe/tables.h>
7 * In order to avoid having objects dragged in just because main()
8 * calls their initialisation function, we allow each object to
9 * specify that it has a function that must be called to initialise
10 * that object. The function call_init_fns() will call all the
11 * included objects' initialisation functions.
13 * Objects that require initialisation should include init.h and
14 * register the initialisation function using INIT_FN().
16 * Objects may register up to three functions: init, reset and exit.
17 * init gets called only once, at the point that Etherboot is
18 * initialised (before the call to main()). reset gets called between
19 * each boot attempt. exit gets called only once, just before the
20 * loaded OS starts up (or just before Etherboot exits, if it exits,
21 * or when the PXE NBP calls UNDI_SHUTDOWN, if it's a PXE NBP).
24 * INIT_FN ( init_order, init_function, reset_function, exit_function );
25 * where init_order is an ordering taken from the list below. Any
26 * function may be left as NULL.
29 /* An entry in the initialisation function table */
32 void ( *init ) ( void );
33 void ( *reset ) ( void );
34 void ( *exit ) ( void );
37 /* Use double digits to avoid problems with "10" < "9" on alphabetic sort */
38 #define INIT_CONSOLE 02
40 #define INIT_TIMERS 04
41 #define INIT_LOADBUF 08
42 #define INIT_PCMCIA 09
44 #define INIT_PROCESS 12
46 /* Macro for creating an initialisation function table entry */
47 #define INIT_FN( init_order, init_func, reset_func, exit_func ) \
48 struct init_fn PREFIX_OBJECT(init_fn__) \
49 __table ( init_fn, init_order ) = { \
51 .reset = reset_func, \
55 /* Function prototypes */
57 void call_init_fns ( void );
58 void call_reset_fns ( void );
59 void call_exit_fns ( void );
61 #endif /* _GPXE_INIT_H */