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.

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