#include <gpxe/tables.h>Go to the source code of this file.
Data Structures | |
| struct | init_fn |
| An initialisation function. More... | |
| struct | startup_fn |
| A startup/shutdown function. More... | |
Defines | |
| #define | INIT_FNS __table ( struct init_fn, "init_fns" ) |
| Initialisation function table. | |
| #define | __init_fn(init_order) __table_entry ( INIT_FNS, init_order ) |
| Declare an initialisation functon. | |
| #define | INIT_EARLY 01 |
| Early initialisation. | |
| #define | INIT_SERIAL 02 |
| Serial driver initialisation. | |
| #define | INIT_CONSOLE 03 |
| Console initialisation. | |
| #define | INIT_NORMAL 04 |
| Normal initialisation. | |
| #define | STARTUP_FNS __table ( struct startup_fn, "startup_fns" ) |
| Startup/shutdown function table. | |
| #define | __startup_fn(startup_order) __table_entry ( STARTUP_FNS, startup_order ) |
| Declare a startup/shutdown function. | |
| #define | STARTUP_EARLY 01 |
| Early startup. | |
| #define | STARTUP_NORMAL 02 |
| Normal startup. | |
| #define | STARTUP_LATE 03 |
| Late startup. | |
Enumerations | |
| enum | shutdown_flags { SHUTDOWN_EXIT = 0x0001, SHUTDOWN_BOOT = 0x0002, SHUTDOWN_KEEP_DEVICES = 0x0004 } |
| Shutdown flags. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| void | initialise (void) |
| Initialise gPXE. | |
| void | startup (void) |
| Start up gPXE. | |
| void | shutdown (int flags) |
| Shut down gPXE. | |
| #define INIT_FNS __table ( struct init_fn, "init_fns" ) |
| #define __init_fn | ( | init_order | ) | __table_entry ( INIT_FNS, init_order ) |
| #define STARTUP_FNS __table ( struct startup_fn, "startup_fns" ) |
Startup/shutdown function table.
Definition at line 57 of file init.h.
Referenced by shutdown(), and startup().
| #define __startup_fn | ( | startup_order | ) | __table_entry ( STARTUP_FNS, startup_order ) |
| enum shutdown_flags |
Shutdown flags.
| SHUTDOWN_EXIT | Shutdown is in order to exit (return to gPXE's caller). |
| SHUTDOWN_BOOT | Shutdown is in order to boot an OS. |
| SHUTDOWN_KEEP_DEVICES | Do not remove devices. |
Definition at line 36 of file init.h.
00036 { 00037 /** Shutdown is in order to exit (return to gPXE's caller) */ 00038 SHUTDOWN_EXIT = 0x0001, 00039 /** Shutdown is in order to boot an OS */ 00040 SHUTDOWN_BOOT = 0x0002, 00041 /** Do not remove devices */ 00042 SHUTDOWN_KEEP_DEVICES = 0x0004, 00043 };
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| void initialise | ( | void | ) |
Initialise gPXE.
This function performs the one-time-only and irreversible initialisation steps, such as initialising the heap. It must be called before (almost) any other function.
There is, by definition, no counterpart to this function on the shutdown path.
Definition at line 43 of file init.c.
References for_each_table_entry, INIT_FNS, and init_fn::initialise.
Referenced by _start(), main(), and undi_loader().
00043 { 00044 struct init_fn *init_fn; 00045 00046 /* Call registered initialisation functions */ 00047 for_each_table_entry ( init_fn, INIT_FNS ) 00048 init_fn->initialise (); 00049 }
| void startup | ( | void | ) |
Start up gPXE.
This function performs the repeatable initialisation steps, such as probing devices. You may call startup() and shutdown() multiple times (as is done via the PXE API when PXENV_START_UNDI is used).
Definition at line 58 of file init.c.
References for_each_table_entry, started, startup_fn::startup, and STARTUP_FNS.
Referenced by _start(), main(), and pxenv_start_undi().
00058 { 00059 struct startup_fn *startup_fn; 00060 00061 if ( started ) 00062 return; 00063 00064 /* Call registered startup functions */ 00065 for_each_table_entry ( startup_fn, STARTUP_FNS ) { 00066 if ( startup_fn->startup ) 00067 startup_fn->startup(); 00068 } 00069 00070 started = 1; 00071 }
| void shutdown | ( | int | flags | ) |
Shut down gPXE.
| flags | Shutdown behaviour flags |
Call this function only once, before either exiting main() or starting up a non-returnable image.
Definition at line 85 of file init.c.
References for_each_table_entry_reverse, startup_fn::shutdown, started, and STARTUP_FNS.
Referenced by bzimage_exec(), elfboot_exec(), ib_cmrc_shutdown(), int22(), main(), multiboot_exec(), nbi_exec(), and pxenv_stop_undi().
00085 { 00086 struct startup_fn *startup_fn; 00087 00088 if ( ! started ) 00089 return; 00090 00091 /* Call registered shutdown functions (in reverse order) */ 00092 for_each_table_entry_reverse ( startup_fn, STARTUP_FNS ) { 00093 if ( startup_fn->shutdown ) 00094 startup_fn->shutdown ( flags ); 00095 } 00096 00097 started = 0; 00098 }
1.5.7.1