Browse Source

Move init.h to gpxe/init.h.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
352bf1bda2

+ 1
- 1
src/arch/i386/core/cpu.c View File

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

+ 1
- 1
src/arch/i386/core/i386_timer.c View File

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

+ 1
- 1
src/arch/i386/core/pci_io.c View File

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

+ 1
- 1
src/arch/i386/core/relocate.c View File

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

+ 1
- 1
src/arch/i386/core/video_subr.c View File

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

+ 1
- 1
src/arch/i386/firmware/pcbios/memsizes.c View File

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

+ 1
- 1
src/arch/i386/transitions/librm_mgmt.c View File

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

+ 1
- 1
src/core/btext.c View File

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

+ 1
- 1
src/core/heap.c View File

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

+ 1
- 1
src/core/init.c View File

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

+ 1
- 1
src/core/main.c View File

23
 #include "timer.h"
23
 #include "timer.h"
24
 #include "cpu.h"
24
 #include "cpu.h"
25
 #include "console.h"
25
 #include "console.h"
26
-#include "init.h"
26
+#include <gpxe/init.h>
27
 #include "image.h"
27
 #include "image.h"
28
 #include <stdarg.h>
28
 #include <stdarg.h>
29
 
29
 

+ 1
- 1
src/core/pcmcia.c View File

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

+ 1
- 1
src/core/serial.c View File

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

+ 66
- 0
src/include/gpxe/init.h View File

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 View File

24
 #include <gpxe/pkbuff.h>
24
 #include <gpxe/pkbuff.h>
25
 #include <gpxe/tables.h>
25
 #include <gpxe/tables.h>
26
 #include <gpxe/process.h>
26
 #include <gpxe/process.h>
27
+#include <gpxe/init.h>
27
 #include <gpxe/netdevice.h>
28
 #include <gpxe/netdevice.h>
28
 
29
 
29
 /** @file
30
 /** @file
287
 	return 0;
288
 	return 0;
288
 }
289
 }
289
 
290
 
290
-
291
-
292
 /**
291
 /**
293
  * Single-step the network stack
292
  * Single-step the network stack
294
  *
293
  *
318
 	.step = net_step,
317
 	.step = net_step,
319
 };
318
 };
320
 
319
 
320
+/** Initialise the networking stack process */
321
 static void init_net ( void ) {
321
 static void init_net ( void ) {
322
 	schedule ( &net_process );
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 View File

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

Loading…
Cancel
Save