Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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