Parcourir la source

Reduced etherboot.h dependencies to avoid unnecessary rebuilds.

etherboot.h is only now used by drivers that have not been updated to
the new API.
tags/v0.9.3
Michael Brown il y a 17 ans
Parent
révision
25fd42ca87
2 fichiers modifiés avec 10 ajouts et 312 suppressions
  1. 10
    280
      src/include/etherboot.h
  2. 0
    32
      src/include/osdep.h

+ 10
- 280
src/include/etherboot.h Voir le fichier

@@ -6,11 +6,18 @@
6 6
  *
7 7
  */
8 8
 
9
-#include "compiler.h"
10
-#include "stddef.h"
11
-#include "stdint.h"
9
+#include <stddef.h>
10
+#include <stdint.h>
11
+#include <stdlib.h>
12
+#include <stdio.h>
12 13
 #include <unistd.h>
14
+#include <strings.h>
15
+#include <latch.h>
16
+#include <console.h>
17
+#include <gpxe/if_arp.h>
18
+#include <gpxe/if_ether.h>
13 19
 
20
+typedef unsigned long Address;
14 21
 
15 22
 /*
16 23
  * IMPORTANT!!!!!!!!!!!!!!
@@ -21,288 +28,11 @@
21 28
  *
22 29
  */
23 30
 
24
-
25
-#include <stdarg.h>
26
-#include "osdep.h"
27
-
28
-#ifndef BOOT_FIRST
29
-#define BOOT_FIRST	BOOT_NIC
30
-#endif
31
-#ifndef BOOT_SECOND
32
-#define BOOT_SECOND	BOOT_NOTHING
33
-#endif
34
-#ifndef BOOT_THIRD
35
-#define BOOT_THIRD	BOOT_NOTHING
36
-#endif
37
-
38
-#define DEFAULT_BOOT_ORDER ( \
39
-	(BOOT_FIRST   << (0*BOOT_BITS)) | \
40
-	(BOOT_SECOND  << (1*BOOT_BITS)) | \
41
-	(BOOT_THIRD   << (2*BOOT_BITS)) | \
42
-	(BOOT_NOTHING << (3*BOOT_BITS)) | \
43
-	0)
44
-
45
-#ifdef BOOT_INDEX
46
-#define DEFAULT_BOOT_INDEX BOOT_INDEX
47
-#else
48
-#define DEFAULT_BOOT_INDEX 0
49
-#endif
50
-
51
-#if	!defined(TAGGED_IMAGE) && !defined(AOUT_IMAGE) && !defined(ELF_IMAGE) && !defined(ELF64_IMAGE) && !defined(COFF_IMAGE) && !defined(RAW_IMAGE)
52
-#define	TAGGED_IMAGE		/* choose at least one */
53
-#endif
54
-
55
-#define K_ESC		'\033'
56
-#define K_EOF		'\04'  /* Ctrl-D */
57
-#define K_INTR		'\03'  /* Ctrl-C */
58
-
59
-/*  Edit this to change the path to hostspecific kernel image
60
-    kernel.<client_ip_address> in RARP boot */
61
-#ifndef	DEFAULT_KERNELPATH
62
-#define	DEFAULT_KERNELPATH	"/tftpboot/kernel.%@"
63
-#endif
64
-
65
-#ifdef FREEBSD_PXEEMU
66
-#undef DEFAULT_BOOTFILE
67
-#ifndef PXENFSROOTPATH
68
-#define PXENFSROOTPATH ""
69
-#endif
70
-#define DEFAULT_BOOTFILE	PXENFSROOTPATH "/boot/pxeboot"
71
-#endif
72
-
73
-#ifndef	MAX_TFTP_RETRIES
74
-#define MAX_TFTP_RETRIES	20
75
-#endif
76
-
77
-#ifndef	MAX_BOOTP_RETRIES
78
-#define MAX_BOOTP_RETRIES	20
79
-#endif
80
-
81
-#define MAX_BOOTP_EXTLEN	(ETH_MAX_MTU-sizeof(struct bootpip_t))
82
-
83
-#ifndef	MAX_ARP_RETRIES
84
-#define MAX_ARP_RETRIES		20
85
-#endif
86
-
87
-#ifndef	MAX_RPC_RETRIES
88
-#define MAX_RPC_RETRIES		20
89
-#endif
90
-
91 31
 /* Link configuration time in tenths of a second */
92 32
 #ifndef VALID_LINK_TIMEOUT
93 33
 #define VALID_LINK_TIMEOUT	100 /* 10.0 seconds */
94 34
 #endif
95 35
 
96
-/* Inter-packet retry in ticks */
97
-#ifndef TIMEOUT
98
-#define TIMEOUT			(10*TICKS_PER_SEC)
99
-#endif
100
-
101
-#ifndef BOOTP_TIMEOUT
102
-#define BOOTP_TIMEOUT		(2*TICKS_PER_SEC)
103
-#endif
104
-
105
-/* Max interval between IGMP packets */
106
-#define IGMP_INTERVAL			(10*TICKS_PER_SEC)
107
-#define IGMPv1_ROUTER_PRESENT_TIMEOUT	(400*TICKS_PER_SEC)
108
-
109
-/* These settings have sense only if compiled with -DCONGESTED */
110
-/* total retransmission timeout in ticks */
111
-#define TFTP_TIMEOUT		(30*TICKS_PER_SEC)
112
-/* packet retransmission timeout in ticks */
113
-#ifdef CONGESTED
114
-#define TFTP_REXMT		(3*TICKS_PER_SEC)
115
-#else
116
-#define TFTP_REXMT		TIMEOUT
117
-#endif
118
-
119
-#ifndef	NULL
120
-#define NULL	((void *)0)
121
-#endif
122
-
123
-#include	<gpxe/if_ether.h>
124
-
125
-enum {
126
-	ARP_CLIENT, ARP_SERVER, ARP_GATEWAY,
127
-	ARP_NAMESERVER,
128
-#ifdef PXE_EXPORT
129
-	ARP_PROXYDHCP,
130
-#endif
131
-	MAX_ARP
132
-};
133
-
134
-#define	RARP_REQUEST	3
135
-#define	RARP_REPLY	4
136
-
137
-#include <gpxe/in.h>
138
-
139
-
140
-/* Helper macros used to identify when DHCP options are valid/invalid in/outside of encapsulation */
141
-#define NON_ENCAP_OPT in_encapsulated_options == 0 &&
142
-#ifdef ALLOW_ONLY_ENCAPSULATED
143
-#define ENCAP_OPT in_encapsulated_options == 1 &&
144
-#else
145
-#define ENCAP_OPT
146
-#endif
147
-
148
-#include	<gpxe/if_arp.h>
149
-#include	"ip.h"
150
-#include	"udp.h"
151
-#include	"old_tcp.h"
152
-#include	"bootp.h"
153
-#include	"igmp.h"
154
-#include	"nfs.h"
155
-#include	"console.h"
156
-#include	"stdlib.h"
157
-
158
-struct arptable_t {
159
-	struct in_addr ipaddr;
160
-	uint8_t node[6];
161
-} PACKED;
162
-
163
-#define	KERNEL_BUF	(bootp_data.bootp_reply.bp_file)
164
-
165
-#define	FLOPPY_BOOT_LOCATION	0x7c00
166
-
167
-struct rom_info {
168
-	unsigned short	rom_segment;
169
-	unsigned short	rom_length;
170
-};
171
-
172
-extern inline int rom_address_ok(struct rom_info *rom, int assigned_rom_segment)
173
-{
174
-	return (assigned_rom_segment < 0xC000
175
-		|| assigned_rom_segment == rom->rom_segment);
176
-}
177
-
178
-/* Define a type for passing info to a loaded program */
179
-struct ebinfo {
180
-	uint8_t  major, minor;	/* Version */
181
-	uint16_t flags;		/* Bit flags */
182
-};
183
-
184
-/***************************************************************************
185
-External prototypes
186
-***************************************************************************/
187
-/* main.c */
188
-struct Elf_Bhdr;
189
-extern int main();
190
-extern char as_main_program;
191
-/* nic.c */
192
-extern void rx_qdrain P((void));
193
-extern int ip_transmit P((int len, const void *buf));
194
-extern void build_ip_hdr P((unsigned long destip, int ttl, int protocol, 
195
-	int option_len, int len, const void *buf));
196
-extern void build_udp_hdr P((unsigned long destip, 
197
-	unsigned int srcsock, unsigned int destsock, int ttl,
198
-	int len, const void *buf));
199
-extern int udp_transmit P((unsigned long destip, unsigned int srcsock,
200
-	unsigned int destsock, int len, const void *buf));
201
-extern int tcp_transmit(unsigned long destip, unsigned int srcsock,
202
-                       unsigned int destsock, long send_seq, long recv_seq,
203
-                       int window, int flags, int len, const void *buf);
204
-int tcp_reset(struct iphdr *ip);
205
-typedef int (*reply_t)(int ival, void *ptr, unsigned short ptype, struct iphdr *ip, struct udphdr *udp, struct tcphdr *tcp);
206
-extern int await_reply P((reply_t reply,	int ival, void *ptr, long timeout));
207
-extern int decode_rfc1533 P((unsigned char *, unsigned int, unsigned int, int));
208
-#define RAND_MAX 2147483647L
209
-extern uint16_t ipchksum P((const void *ip, unsigned long len));
210
-extern uint16_t add_ipchksums P((unsigned long offset, uint16_t sum, uint16_t new));
211
-extern long rfc2131_sleep_interval P((long base, int exp));
212
-extern void cleanup P((void));
213
-
214
-/* osloader.c */
215
-/* Be careful with sector_t it is an unsigned long long on x86 */
216
-typedef uint64_t sector_t;
217
-typedef sector_t (*os_download_t)(unsigned char *data, unsigned int len, int eof);
218
-extern os_download_t probe_image(unsigned char *data, unsigned int len);
219
-extern int load_block P((unsigned char *, unsigned int, unsigned int, int ));
220
-
221
-/* misc.c */
222
-extern void twiddle P((void));
223
-extern void interruptible_sleep P((int secs));
224
-extern int strcasecmp P((const char *a, const char *b));
225
-extern char *substr P((const char *a, const char *b));
226
-
227
-extern unsigned long get_boot_order(unsigned long order, unsigned *index);
228
-extern void disk_init P((void));
229
-extern unsigned int pcbios_disk_read P((int drv,int c,int h,int s,char *buf));
230
-
231
-/* start32.S */
232
-struct os_entry_regs {
233
-	/* Be careful changing this structure
234
-	 * as it is used by assembly language code.
235
-	 */
236
-	uint32_t  edi; /*  0 */
237
-	uint32_t  esi; /*  4 */
238
-	uint32_t  ebp; /*  8 */
239
-	uint32_t  esp; /* 12 */
240
-	uint32_t  ebx; /* 16 */
241
-	uint32_t  edx; /* 20 */
242
-	uint32_t  ecx; /* 24 */
243
-	uint32_t  eax; /* 28 */
244
-	
245
-	uint32_t saved_ebp; /* 32 */
246
-	uint32_t saved_esi; /* 36 */
247
-	uint32_t saved_edi; /* 40 */
248
-	uint32_t saved_ebx; /* 44 */
249
-	uint32_t saved_eip; /* 48 */
250
-	uint32_t saved_esp; /* 52 */
251
-};
252
-struct regs {
253
-	/* Be careful changing this structure
254
-	 * as it is used by assembly language code.
255
-	 */
256
-	uint32_t  edi; /*  0 */
257
-	uint32_t  esi; /*  4 */
258
-	uint32_t  ebp; /*  8 */
259
-	uint32_t  esp; /* 12 */
260
-	uint32_t  ebx; /* 16 */
261
-	uint32_t  edx; /* 20 */
262
-	uint32_t  ecx; /* 24 */
263
-	uint32_t  eax; /* 28 */
264
-};
265
-extern struct os_entry_regs os_regs;
266
-extern struct regs initial_regs;
267
-extern int xstart32(unsigned long entry_point, ...);
268
-extern int xstart_lm(unsigned long entry_point, unsigned long params);
269
-extern void xend32 P((void));
270
-struct Elf_Bhdr *prepare_boot_params(void *header);
271
-extern int elf_start(unsigned long machine, unsigned long entry, unsigned long params);
272
-extern unsigned long currticks P((void));
273
-extern void exit P((int status));
274
-
275
-
276
-/***************************************************************************
277
-External variables
278
-***************************************************************************/
279
-/* main.c */
280
-extern struct rom_info rom;
281
-extern char *hostname;
282
-extern int hostnamelen;
283
-extern unsigned char *addparam;
284
-extern int addparamlen;
285
-extern jmp_buf restart_etherboot;
286
-extern int url_port;
287
-extern struct arptable_t arptable[MAX_ARP];
288
-#ifdef	IMAGE_MENU
289
-extern int menutmo,menudefault;
290
-extern unsigned char *defparams;
291
-extern int defparams_max;
292
-#endif
293
-#ifdef	MOTD
294
-extern unsigned char *motd[RFC1533_VENDOR_NUMOFMOTD];
295
-#endif
296
-extern struct bootpd_t bootp_data;
297
-#define	BOOTP_DATA_ADDR	(&bootp_data)
298
-extern unsigned char *end_of_rfc1533;
299
-#ifdef	IMAGE_FREEBSD
300
-extern int freebsd_howto;
301
-#define FREEBSD_KERNEL_ENV_SIZE 256
302
-extern char freebsd_kernel_env[FREEBSD_KERNEL_ENV_SIZE];
303
-#endif
304
-
305
-
306 36
 /*
307 37
  * Local variables:
308 38
  *  c-basic-offset: 8

+ 0
- 32
src/include/osdep.h Voir le fichier

@@ -1,32 +0,0 @@
1
-#ifndef	ETHERBOOT_OSDEP_H
2
-#define ETHERBOOT_OSDEP_H
3
-
4
-/* Optimization barrier */
5
-/* The "volatile" is due to gcc bugs */
6
-#define barrier() __asm__ __volatile__("": : :"memory")
7
-
8
-#include "stdint.h"
9
-#include "limits.h"
10
-#include "string.h"
11
-#include "io.h"
12
-#include "endian.h"
13
-#include "byteswap.h"
14
-#include "setjmp.h"
15
-#include "latch.h"
16
-
17
-typedef	unsigned long Address;
18
-
19
-/* ANSI prototyping macro */
20
-#ifdef	__STDC__
21
-#define	P(x)	x
22
-#else
23
-#define	P(x)	()
24
-#endif
25
-
26
-#endif
27
-
28
-/*
29
- * Local variables:
30
- *  c-basic-offset: 8
31
- * End:
32
- */

Chargement…
Annuler
Enregistrer