You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init.h 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef _GPXE_INIT_H
  2. #define _GPXE_INIT_H
  3. #include <gpxe/tables.h>
  4. /**
  5. * An initialisation function
  6. *
  7. * Initialisation functions are called exactly once, as part of the
  8. * call to initialise().
  9. */
  10. struct init_fn {
  11. void ( * initialise ) ( void );
  12. };
  13. /** Initialisation function table */
  14. #define INIT_FNS "init_fns"
  15. /** Declare an initialisation functon */
  16. #define __init_fn( init_order ) \
  17. __table ( struct init_fn, INIT_FNS, init_order )
  18. /** @defgroup initfn_order Initialisation function ordering
  19. * @{
  20. */
  21. #define INIT_EARLY 01 /**< Early initialisation */
  22. #define INIT_SERIAL 02 /**< Serial driver initialisation */
  23. #define INIT_CONSOLE 03 /**< Console initialisation */
  24. #define INIT_NORMAL 04 /**< Normal initialisation */
  25. /** @} */
  26. /** Shutdown flags */
  27. enum shutdown_flags {
  28. /** Shutdown is in order to exit (return to gPXE's caller) */
  29. SHUTDOWN_EXIT = 0x0001,
  30. /** Shutdown is in order to boot an OS */
  31. SHUTDOWN_BOOT = 0x0002,
  32. /** Do not remove devices */
  33. SHUTDOWN_KEEP_DEVICES = 0x0004,
  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 flags );
  44. };
  45. /** Startup/shutdown function table */
  46. #define STARTUP_FNS "startup_fns"
  47. /** Declare a startup/shutdown function */
  48. #define __startup_fn( startup_order ) \
  49. __table ( struct startup_fn, STARTUP_FNS, startup_order )
  50. /** @defgroup startfn_order Startup/shutdown function ordering
  51. *
  52. * Shutdown functions are called in the reverse order to startup
  53. * functions.
  54. *
  55. * @{
  56. */
  57. #define STARTUP_EARLY 01 /**< Early startup */
  58. #define STARTUP_NORMAL 02 /**< Normal startup */
  59. #define STARTUP_LATE 03 /**< Late startup */
  60. /** @} */
  61. extern void initialise ( void );
  62. extern void startup ( void );
  63. extern void shutdown ( int flags );
  64. #endif /* _GPXE_INIT_H */