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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _GPXE_INIT_H
  2. #define _GPXE_INIT_H
  3. FILE_LICENCE ( GPL2_OR_LATER );
  4. #include <gpxe/tables.h>
  5. /**
  6. * An initialisation function
  7. *
  8. * Initialisation functions are called exactly once, as part of the
  9. * call to initialise().
  10. */
  11. struct init_fn {
  12. void ( * initialise ) ( void );
  13. };
  14. /** Initialisation function table */
  15. #define INIT_FNS __table ( struct init_fn, "init_fns" )
  16. /** Declare an initialisation functon */
  17. #define __init_fn( init_order ) __table_entry ( 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 __table ( struct startup_fn, "startup_fns" )
  47. /** Declare a startup/shutdown function */
  48. #define __startup_fn( startup_order ) \
  49. __table_entry ( 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 */