]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
Move init.h to gpxe/init.h.
authorMichael Brown <mcb30@etherboot.org>
Sun, 30 Apr 2006 01:08:52 +0000 (01:08 +0000)
committerMichael Brown <mcb30@etherboot.org>
Sun, 30 Apr 2006 01:08:52 +0000 (01:08 +0000)
16 files changed:
src/arch/i386/core/cpu.c
src/arch/i386/core/i386_timer.c
src/arch/i386/core/pci_io.c
src/arch/i386/core/relocate.c
src/arch/i386/core/video_subr.c
src/arch/i386/firmware/pcbios/memsizes.c
src/arch/i386/transitions/librm_mgmt.c
src/core/btext.c
src/core/heap.c
src/core/init.c
src/core/main.c
src/core/pcmcia.c
src/core/serial.c
src/include/gpxe/init.h [new file with mode: 0644]
src/net/netdevice.c
src/proto/nfs.c

index 7b2533f46c09cc4e14215dde09963aad37923617..2d2e1888ee3e84fdc9840f1429681f114bafbb4a 100644 (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 */
index c9aa406f9482d17715ab365d6826a4613469ace0..3608d8a69c5160bade57a89dc77f122c37212e08 100644 (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)
 {
index cfb31ad90a8fea0b2018df236567dd908efb958b..a272b447476006b1cf85a2e9d906480651fa394a 100644 (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
index a24b4fd105478910ccfca0dd011db97f6b0a3fc2..7d5ba322069b72a46920194d98e4640346fd2c78 100644 (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
index 66aee1141e85357ffe0c901e9493da9a80dbc8d3..7f3b96bf69ea4d69dc9d051054614af78759216d 100644 (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;
index 25e9fb192147c6f6c23f5a7052deef80902bf67c..4cce53d7fa5a3a72df875a6f56ef346dd09d3392 100644 (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"
 
index 956408f54cfd71476bda1f27daa4ee2d27ad3868..6780fdc30d39b33601c4c36a4e14b1fa23add164 100644 (file)
@@ -14,7 +14,7 @@
 #include "string.h"
 #include "basemem.h"
 #include "relocate.h"
-#include "init.h"
+#include <gpxe/init.h>
 #include "librm.h"
 
 /*
index 43accc4776f5b3ce3eaee3e968af11749a69b087..2a2972e97f499e2c74c0e2e2e68c465387a40e0c 100644 (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
index d70aa2d978f2e717b91fee49d589dc7a2d1e2013..b04b4b8215aec80c297477b931e14bc8a32b5d09 100644 (file)
@@ -1,5 +1,5 @@
 #include "etherboot.h"
-#include "init.h"
+#include <gpxe/init.h>
 #include "memsizes.h"
 #include <assert.h>
 #include "heap.h"
index ed652379c849561ee04922437e3bfc46af6b4e4f..3f41ddd1eb311b7a24e94288ae42f8499551fb3e 100644 (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);
index 35c7bb2c200b455488f482237df4062e2024b904..f6448e805e49f272d6e78ed6f1433217b962f5a8 100644 (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>
 
index 03a96de8e6b675b0759918a7ca6a2f5c655c48b8..b4faceaf5ba686f9d7b67929722ec3f81b0ba910 100644 (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;
index 802b32a74b5fb4491d29f13a66dc9ecf94eecc4f..52cf0e44bd1e3bf13992487ddb880d1b3feef7d8 100644 (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"
diff --git a/src/include/gpxe/init.h b/src/include/gpxe/init.h
new file mode 100644 (file)
index 0000000..7a4b726
--- /dev/null
@@ -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 */
index 19db792e665a461fde69f13642e7f4337b3fe09c..47b37cf73dd3e2a2ce5f6ed77bd883a23156ff29 100644 (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 );
index ebcca73747022b4cc3341d161013f6db81b400c4..c700ed67bac596fbdfabdeb5c9d090f5cde01525 100644 (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"