david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Move init.h to gpxe/init.h.

This commit is contained in:
Michael Brown 2006-04-30 01:08:52 +00:00
parent bac97eb979
commit 352bf1bda2
16 changed files with 83 additions and 19 deletions

View File

@ -2,7 +2,7 @@
#include "stdint.h"
#include "string.h"
#include "bits/cpu.h"
#include "init.h"
#include <gpxe/init.h>
/* Standard macro to see if a specific flag is changeable */

View File

@ -10,7 +10,7 @@
#include "etherboot.h"
#include "timer.h"
#include "latch.h"
#include "init.h"
#include <gpxe/init.h>
void __load_timer2(unsigned int ticks)
{

View File

@ -11,7 +11,7 @@
** /usr/src/linux/drivers/net/ne.c
*/
#include "etherboot.h"
#include "init.h"
#include <gpxe/init.h>
#include <gpxe/pci.h>
#include "pci_io.h"
#ifdef KEEP_IT_REAL

View File

@ -2,7 +2,7 @@
#include "memsizes.h"
#include "osdep.h"
#include "etherboot.h"
#include "init.h"
#include <gpxe/init.h>
#include "relocate.h"
#ifndef KEEP_IT_REAL

View File

@ -9,7 +9,7 @@
#include "string.h"
#include "io.h"
#include "console.h"
#include "init.h"
#include <gpxe/init.h>
#include "vga.h"
struct console_driver vga_console;

View File

@ -1,7 +1,7 @@
#include "stdint.h"
#include "stddef.h"
#include "realmode.h"
#include "init.h"
#include <gpxe/init.h>
#include "etherboot.h"
#include "memsizes.h"

View File

@ -14,7 +14,7 @@
#include "string.h"
#include "basemem.h"
#include "relocate.h"
#include "init.h"
#include <gpxe/init.h>
#include "librm.h"
/*

View File

@ -9,7 +9,7 @@
#include "etherboot.h"
#include "console.h"
#include "init.h"
#include <gpxe/init.h>
#include <gpxe/pci.h>
#ifdef CONFIG_FILO

View File

@ -1,5 +1,5 @@
#include "etherboot.h"
#include "init.h"
#include <gpxe/init.h>
#include "memsizes.h"
#include <assert.h>
#include "heap.h"

View File

@ -7,7 +7,7 @@
**************************************************************************
*/
#include "init.h"
#include <gpxe/init.h>
static struct init_fn init_fns[0] __table_start(init_fn);
static struct init_fn init_fns_end[0] __table_end(init_fn);

View File

@ -23,7 +23,7 @@ Literature dealing with the network protocols:
#include "timer.h"
#include "cpu.h"
#include "console.h"
#include "init.h"
#include <gpxe/init.h>
#include "image.h"
#include <stdarg.h>

View File

@ -29,7 +29,7 @@
#define CODE_VERSION "0.1.3"
#include "pcmcia-opts.h"
#include "console.h"
#include "init.h"
#include <gpxe/init.h>
int sockets; /* AHTODO: Phase this out! */
u_int pccsocks;

View File

@ -13,7 +13,7 @@
#include "stddef.h"
#include "console.h"
#include "init.h"
#include <gpxe/init.h>
#include "io.h"
#include "timer.h"
#include "config/serial.h"

66
src/include/gpxe/init.h Normal file
View File

@ -0,0 +1,66 @@
#ifndef INIT_H
#define INIT_H
#include <gpxe/tables.h>
/*
* In order to avoid having objects dragged in just because main()
* calls their initialisation function, we allow each object to
* specify that it has a function that must be called to initialise
* that object. The function call_init_fns() will call all the
* included objects' initialisation functions.
*
* Objects that require initialisation should include init.h and
* register the initialisation function using INIT_FN().
*
* Objects may register up to three functions: init, reset and exit.
* init gets called only once, at the point that Etherboot is
* initialised (before the call to main()). reset gets called between
* each boot attempt. exit gets called only once, just before the
* loaded OS starts up (or just before Etherboot exits, if it exits,
* or when the PXE NBP calls UNDI_SHUTDOWN, if it's a PXE NBP).
*
* The syntax is:
* INIT_FN ( init_order, init_function, reset_function, exit_function );
* where init_order is an ordering taken from the list below. Any
* function may be left as NULL.
*/
/* An entry in the initialisation function table */
struct init_fn {
void ( *init ) ( void );
void ( *reset ) ( void );
void ( *exit ) ( void );
};
/* Use double digits to avoid problems with "10" < "9" on alphabetic sort */
#define INIT_LIBRM 01
#define INIT_CONSOLE 02
#define INIT_CPU 03
#define INIT_TIMERS 04
#define INIT_PCIBIOS 05
#define INIT_MEMSIZES 06
#define INIT_RELOCATE 07
#define INIT_LOADBUF 08
#define INIT_PCMCIA 09
#define INIT_HEAP 10
#define INIT_RPC 11
#define INIT_PROCESS 12
/* Macro for creating an initialisation function table entry */
#define INIT_FN( init_order, init_func, reset_func, exit_func ) \
struct init_fn PREFIX_OBJECT(init_fn__) \
__table ( init_fn, init_order ) = { \
.init = init_func, \
.reset = reset_func, \
.exit = exit_func, \
};
/* Function prototypes */
void call_init_fns ( void );
void call_reset_fns ( void );
void call_exit_fns ( void );
#endif /* INIT_H */

View File

@ -24,6 +24,7 @@
#include <gpxe/pkbuff.h>
#include <gpxe/tables.h>
#include <gpxe/process.h>
#include <gpxe/init.h>
#include <gpxe/netdevice.h>
/** @file
@ -287,8 +288,6 @@ int net_rx_process ( struct pk_buff *pkb ) {
return 0;
}
/**
* Single-step the network stack
*
@ -318,10 +317,9 @@ static struct process net_process = {
.step = net_step,
};
/** Initialise the networking stack process */
static void init_net ( void ) {
schedule ( &net_process );
}
#include <init.h>
INIT_FN ( INIT_RPC, init_net, NULL, NULL );
INIT_FN ( INIT_PROCESS, init_net, NULL, NULL );

View File

@ -1,5 +1,5 @@
#include "etherboot.h"
#include "init.h"
#include <gpxe/init.h>
#include "proto.h"
#include <gpxe/in.h>
#include "nic.h"