Bläddra i källkod

Move init.h to gpxe/init.h.

tags/v0.9.3
Michael Brown 18 år sedan
förälder
incheckning
352bf1bda2

+ 1
- 1
src/arch/i386/core/cpu.c Visa fil

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

+ 1
- 1
src/arch/i386/core/i386_timer.c Visa fil

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

+ 1
- 1
src/arch/i386/core/pci_io.c Visa fil

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

+ 1
- 1
src/arch/i386/core/relocate.c Visa fil

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

+ 1
- 1
src/arch/i386/core/video_subr.c Visa fil

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

+ 1
- 1
src/arch/i386/firmware/pcbios/memsizes.c Visa fil

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

+ 1
- 1
src/arch/i386/transitions/librm_mgmt.c Visa fil

@@ -14,7 +14,7 @@
14 14
 #include "string.h"
15 15
 #include "basemem.h"
16 16
 #include "relocate.h"
17
-#include "init.h"
17
+#include <gpxe/init.h>
18 18
 #include "librm.h"
19 19
 
20 20
 /*

+ 1
- 1
src/core/btext.c Visa fil

@@ -9,7 +9,7 @@
9 9
 
10 10
 #include "etherboot.h"
11 11
 #include "console.h"
12
-#include "init.h"
12
+#include <gpxe/init.h>
13 13
 #include <gpxe/pci.h>
14 14
 
15 15
 #ifdef CONFIG_FILO

+ 1
- 1
src/core/heap.c Visa fil

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

+ 1
- 1
src/core/init.c Visa fil

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

+ 1
- 1
src/core/main.c Visa fil

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

+ 1
- 1
src/core/pcmcia.c Visa fil

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

+ 1
- 1
src/core/serial.c Visa fil

@@ -13,7 +13,7 @@
13 13
 
14 14
 #include "stddef.h"
15 15
 #include "console.h"
16
-#include "init.h"
16
+#include <gpxe/init.h>
17 17
 #include "io.h"
18 18
 #include "timer.h"
19 19
 #include "config/serial.h"

+ 66
- 0
src/include/gpxe/init.h Visa fil

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

+ 3
- 5
src/net/netdevice.c Visa fil

@@ -24,6 +24,7 @@
24 24
 #include <gpxe/pkbuff.h>
25 25
 #include <gpxe/tables.h>
26 26
 #include <gpxe/process.h>
27
+#include <gpxe/init.h>
27 28
 #include <gpxe/netdevice.h>
28 29
 
29 30
 /** @file
@@ -287,8 +288,6 @@ int net_rx_process ( struct pk_buff *pkb ) {
287 288
 	return 0;
288 289
 }
289 290
 
290
-
291
-
292 291
 /**
293 292
  * Single-step the network stack
294 293
  *
@@ -318,10 +317,9 @@ static struct process net_process = {
318 317
 	.step = net_step,
319 318
 };
320 319
 
320
+/** Initialise the networking stack process */
321 321
 static void init_net ( void ) {
322 322
 	schedule ( &net_process );
323 323
 }
324 324
 
325
-#include <init.h>
326
-
327
-INIT_FN ( INIT_RPC, init_net, NULL, NULL );
325
+INIT_FN ( INIT_PROCESS, init_net, NULL, NULL );

+ 1
- 1
src/proto/nfs.c Visa fil

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

Laddar…
Avbryt
Spara