init.c File Reference

Initialisation, startup and shutdown routines. More...

#include <gpxe/device.h>
#include <gpxe/init.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
void initialise (void)
 Initialise gPXE.
void startup (void)
 Start up gPXE.
void shutdown (int flags)
 Shut down gPXE.

Variables

static int started = 0
 "startup() has been called" flag


Detailed Description

Initialisation, startup and shutdown routines.

Definition in file init.c.


Function Documentation

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.

Parameters:
flags Shutdown behaviour flags
This function reverses the actions of startup(), and leaves gPXE in a state ready to be removed from memory. You may call startup() again after calling shutdown().

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 }


Variable Documentation

int started = 0 [static]

"startup() has been called" flag

Definition at line 31 of file init.c.

Referenced by shutdown(), and startup().


Generated on Tue Apr 6 20:01:14 2010 for gPXE by  doxygen 1.5.7.1