Browse Source

Rearranging PXE header files

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
8becf0f65f
4 changed files with 52 additions and 835 deletions
  1. 3
    3
      src/arch/i386/include/pxe_addr.h
  2. 47
    742
      src/include/pxe.h
  3. 0
    88
      src/include/pxe_internal.h
  4. 2
    2
      src/include/pxe_types.h

src/arch/i386/include/pxe_types.h → src/arch/i386/include/pxe_addr.h View File

@@ -5,8 +5,8 @@
5 5
  * SEGSEL_t for use in other PXE structures.  See pxe.h for details.
6 6
  */
7 7
 
8
-#ifndef PXE_TYPES_H
9
-#define PXE_TYPES_H
8
+#ifndef PXE_ADDR_H
9
+#define PXE_ADDR_H
10 10
 
11 11
 /* SEGOFF16_t defined in separate header
12 12
  */
@@ -32,4 +32,4 @@ typedef struct {
32 32
 typedef	uint16_t I386_SEGSEL_t;
33 33
 #define SEGSEL_t I386_SEGSEL_t
34 34
 
35
-#endif /* PXE_TYPES_H */
35
+#endif /* PXE_ADDR_H */

+ 47
- 742
src/include/pxe.h View File

@@ -1,754 +1,57 @@
1
-/*
2
- * pxe.h for Etherboot.
3
- * 
4
- * PXE is technically specified only for i386, but there's no reason
5
- * why we shouldn't make the API available for other architectures,
6
- * provided that someone wants to write the shim that allows an
7
- * external program to call pxe_api_call().
8
- * 
9
- * We stick with Intel's data structure definitions as far as possible
10
- * on other architectures.  Generally the only i386-specific stuff is
11
- * related to addressing: real-mode segment:offset addresses, segment
12
- * selectors, segment descriptors etc.  We allow an architecture-
13
- * specific header to define these types, then build the PXE
14
- * structures.  Note that we retain the names from the PXE
15
- * specification document (e.g. SEGOFF16_t) even if the architecture
16
- * in question doesn't represent a SEGOFF16_t as anything resembling a
17
- * 16-bit segment:offset address.  This is done in order to keep the
18
- * structure definitions as close as possible to those in the spec, to
19
- * minimise confusion.
20
- *
21
- * This file derives from several originals.  One is pxe.h from
22
- * FreeBSD.  Another is general.h86 from netboot.  The original
23
- * copyright notices are reproduced below.  This entire file is
24
- * licensed under the GPL; the netboot code is GPL anyway and the
25
- * FreeBSD code allows us to relicense under the GPL provided that we
26
- * retain the FreeBSD copyright notice.  This is my understanding,
27
- * anyway.  Other portions are my own and therefore Copyright (C) 2004
28
- * Michael Brown <mbrown@fensystems.co.uk>.
29
- *
30
- * This program is free software; you can redistribute it and/or
31
- * modify it under the terms of the GNU General Public License as
32
- * published by the Free Software Foundation; either version 2 of the
33
- * License, or any later version.
34
- *
35
- * This program is distributed in the hope that it will be useful, but
36
- * WITHOUT ANY WARRANTY; without even the implied warranty of
37
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
38
- * General Public License for more details.
39
- *
40
- * You should have received a copy of the GNU General Public License
41
- * along with this program; if not, write to the Free Software
42
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
43
- */
44
-
45 1
 #ifndef PXE_H
46 2
 #define PXE_H
47 3
 
48
-/* Include architecture-specific PXE data types 
49
- *
50
- * May define SEGOFF16_t, SEGDESC_t and SEGSEL_t.  These should be
51
- * #defines to underlying * types.  May also define
52
- * IS_NULL_SEGOFF16(segoff16), SEGOFF16_TO_PTR(segoff16) and
53
- * PTR_TO_SEGOFF16(ptr,segoff16)
54
- */
55
-#ifndef PXE_TYPES_H
56
-#include <pxe_types.h>
57
-#endif
58
-
59
-#include "errno.h"
60
-
61
-/* Defaults in case pxe_types.h did not define a type.  These are
62
- * placeholder structures just to make the code compile.
63
- */
64
-#ifndef SEGOFF16_t
65
-#define SEGOFF16_t void*
66
-#endif
67
-
68
-#ifndef IS_NULL_SEGOFF16
69
-#define IS_NULL_SEGOFF16(segoff16) ( (segoff16) == NULL )
70
-#endif
71
-
72
-#ifndef SEGOFF16_TO_PTR
73
-#define SEGOFF16_TO_PTR(segoff16) (segoff16)
74
-#endif
75
-
76
-#ifndef PTR_TO_SEGOFF16
77
-#define PTR_TO_SEGOFF16(ptr,segoff16) (segoff16) = (ptr);
78
-#endif
79
-
80
-#ifndef SEGDESC_t
81
-#define SEGDESC_t void
82
-#endif
83
-
84
-#ifndef SEGSEL_t
85
-#define SEGSEL_t void
86
-#endif
87
-
88
-/*****************************************************************************
89
- * The following portion of this file is derived from FreeBSD's pxe.h.
90
- * Do not remove the copyright notice below.
91
- *****************************************************************************
92
- */
93
-
94
-/*
95
- * Copyright (c) 2000 Alfred Perlstein <alfred@freebsd.org>
96
- * All rights reserved.
97
- * Copyright (c) 2000 Paul Saab <ps@freebsd.org>
98
- * All rights reserved.
99
- * Copyright (c) 2000 John Baldwin <jhb@freebsd.org>
100
- * All rights reserved.
101
- *
102
- * Redistribution and use in source and binary forms, with or without
103
- * modification, are permitted provided that the following conditions
104
- * are met:
105
- * 1. Redistributions of source code must retain the above copyright
106
- *    notice, this list of conditions and the following disclaimer.
107
- * 2. Redistributions in binary form must reproduce the above copyright
108
- *    notice, this list of conditions and the following disclaimer in the
109
- *    documentation and/or other materials provided with the distribution.
110
- *
111
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
112
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
113
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
114
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
115
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
116
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
117
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
118
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
119
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
120
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
121
- * SUCH DAMAGE.
122
- *
123
- * $FreeBSD: src/sys/boot/i386/libi386/pxe.h,v 1.4.2.2 2000/09/10 02:52:18 ps Exp $
124
- */
125
-
126
-/*
127
- * The typedefs and structures declared in this file
128
- * clearly violate style(9), the reason for this is to conform to the
129
- * typedefs/structure-names used in the Intel literature to avoid confusion.
130
- *
131
- * It's for your own good. :)
132
- */
133
-
134
-/* It seems that intel didn't think about ABI,
135
- * either that or 16bit ABI != 32bit ABI (which seems reasonable)
136
- * I have to thank Intel for the hair loss I incurred trying to figure
137
- * out why PXE was mis-reading structures I was passing it (at least
138
- * from my point of view)
139
- *
140
- * Solution: use gcc's '__attribute__ ((packed))' to correctly align
141
- * structures passed into PXE
142
- * Question: does this really work for PXE's expected ABI?
143
- */
144
-#ifndef PACKED
145
-#define	PACKED		__attribute__ ((packed))
146
-#endif
147
-
148
-#define	S_SIZE(s)	s, sizeof(s) - 1
149
-
150
-#define	IP_STR		"%d.%d.%d.%d"
151
-#define	IP_ARGS(ip)					\
152
-	(int)(ip >> 24) & 0xff, (int)(ip >> 16) & 0xff, \
153
-	(int)(ip >> 8) & 0xff, (int)ip & 0xff
154
-
155
-#define	MAC_STR		"%02x:%02x:%02x:%02x:%02x:%02x"
156
-#define	MAC_ARGS(mac)					\
157
-	mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] 
158
-
159
-typedef uint16_t		PXENV_EXIT_t;
160
-typedef	uint16_t		PXENV_STATUS_t;
161
-typedef	uint32_t		IP4_t;
162
-typedef	uint32_t		ADDR32_t;
163
-/* It seems as though UDP_PORT_t is in network order, although I can't
164
- * find anything in the spec to back this up.  (Michael Brown)
165
- */
166
-typedef	uint16_t		UDP_PORT_t;
167
-
168
-#define	MAC_ADDR_LEN		16
169
-typedef	uint8_t			MAC_ADDR[MAC_ADDR_LEN];
170
-
171
-/* PXENV+ */
172
-typedef struct {
173
-	uint8_t		Signature[6];	/* 'PXENV+' */
174
-	uint16_t	Version;	/* MSB = major, LSB = minor */
175
-	uint8_t		Length;		/* structure length */
176
-	uint8_t		Checksum;	/* checksum pad */
177
-	SEGOFF16_t	RMEntry;	/* SEG:OFF to PXE entry point */
178
-	/* don't use PMOffset and PMSelector (from the 2.1 PXE manual) */
179
-	uint32_t	PMOffset;	/* Protected mode entry */
180
-	SEGSEL_t	PMSelector;	/* Protected mode selector */
181
-	SEGSEL_t	StackSeg;	/* Stack segment address */
182
-	uint16_t	StackSize;	/* Stack segment size (bytes) */
183
-	SEGSEL_t	BC_CodeSeg;	/* BC Code segment address */
184
-	uint16_t	BC_CodeSize;	/* BC Code segment size (bytes) */
185
-	SEGSEL_t	BC_DataSeg;	/* BC Data segment address */
186
-	uint16_t	BC_DataSize;	/* BC Data segment size (bytes) */
187
-	SEGSEL_t	UNDIDataSeg;	/* UNDI Data segment address */
188
-	uint16_t	UNDIDataSize;	/* UNDI Data segment size (bytes) */
189
-	SEGSEL_t	UNDICodeSeg;	/* UNDI Code segment address */
190
-	uint16_t	UNDICodeSize;	/* UNDI Code segment size (bytes) */
191
-	SEGOFF16_t	PXEPtr;		/* SEG:OFF to !PXE struct, 
192
-					   only present when Version > 2.1 */
193
-} PACKED pxenv_t;
194
-
195
-/* !PXE */
196
-typedef struct {
197
-	uint8_t		Signature[4];
198
-	uint8_t		StructLength;
199
-	uint8_t		StructCksum;
200
-	uint8_t		StructRev;
201
-	uint8_t		reserved_1;
202
-	SEGOFF16_t	UNDIROMID;
203
-	SEGOFF16_t	BaseROMID;
204
-	SEGOFF16_t	EntryPointSP;
205
-	SEGOFF16_t	EntryPointESP;
206
-	SEGOFF16_t	StatusCallout;
207
-	uint8_t		reserved_2;
208
-	uint8_t		SegDescCn;
209
-	SEGSEL_t	FirstSelector;
210
-	SEGDESC_t	Stack;
211
-	SEGDESC_t	UNDIData;
212
-	SEGDESC_t	UNDICode;
213
-	SEGDESC_t	UNDICodeWrite;
214
-	SEGDESC_t	BC_Data;
215
-	SEGDESC_t	BC_Code;
216
-	SEGDESC_t	BC_CodeWrite;
217
-} PACKED pxe_t;
218
-
219
-#define	PXENV_START_UNDI		0x0000
220
-typedef struct {
221
-	PXENV_STATUS_t	Status;
222
-	uint16_t	ax;
223
-	uint16_t	bx;
224
-	uint16_t	dx;
225
-	uint16_t	di;
226
-	uint16_t	es;
227
-} PACKED t_PXENV_START_UNDI;
228
-
229
-#define	PXENV_UNDI_STARTUP		0x0001
230
-typedef struct {
231
-	PXENV_STATUS_t	Status;
232
-} PACKED t_PXENV_UNDI_STARTUP;
233
-
234
-#define	PXENV_UNDI_CLEANUP		0x0002
235
-typedef struct {
236
-	PXENV_STATUS_t	Status;
237
-} PACKED t_PXENV_UNDI_CLEANUP;
238
-
239
-#define	PXENV_UNDI_INITIALIZE		0x0003
240
-typedef struct {
241
-	PXENV_STATUS_t	Status;
242
-	ADDR32_t	ProtocolIni;	/* Phys addr of a copy of the driver module */
243
-	uint8_t		reserved[8];
244
-} PACKED t_PXENV_UNDI_INITIALIZE;
245
-
246
-
247
-#define	MAXNUM_MCADDR		8
248
-typedef struct {
249
-	uint16_t	MCastAddrCount;
250
-	MAC_ADDR	McastAddr[MAXNUM_MCADDR];
251
-} PACKED t_PXENV_UNDI_MCAST_ADDRESS;
252
-
253
-#define	PXENV_UNDI_RESET_ADAPTER	0x0004		
254
-typedef struct {
255
-	PXENV_STATUS_t	Status;
256
-	t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
257
-} PACKED t_PXENV_UNDI_RESET_ADAPTER;
258
-
259
-#define	PXENV_UNDI_SHUTDOWN		0x0005
260
-typedef struct {
261
-	PXENV_STATUS_t	Status;
262
-} PACKED t_PXENV_UNDI_SHUTDOWN;
263
-
264
-#define	PXENV_UNDI_OPEN			0x0006
265
-typedef struct {
266
-	PXENV_STATUS_t	Status;
267
-	uint16_t	OpenFlag;
268
-	uint16_t	PktFilter;
269
-#	define FLTR_DIRECTED	0x0001
270
-#	define FLTR_BRDCST	0x0002
271
-#	define FLTR_PRMSCS	0x0003
272
-#	define FLTR_SRC_RTG	0x0004
273
-
274
-	t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
275
-} PACKED t_PXENV_UNDI_OPEN;
276
-
277
-#define	PXENV_UNDI_CLOSE		0x0007
278
-typedef struct {
279
-	PXENV_STATUS_t	Status;
280
-} PACKED t_PXENV_UNDI_CLOSE;
281
-
282
-#define	PXENV_UNDI_TRANSMIT		0x0008
283
-typedef struct {
284
-	PXENV_STATUS_t	Status;
285
-	uint8_t		Protocol;
286
-#	define P_UNKNOWN	0
287
-#	define P_IP		1
288
-#	define P_ARP		2
289
-#	define P_RARP		3
290
-
291
-	uint8_t		XmitFlag;
292
-#	define XMT_DESTADDR	0x0000
293
-#	define XMT_BROADCAST	0x0001
294
-
295
-	SEGOFF16_t	DestAddr;
296
-	SEGOFF16_t	TBD;
297
-	uint32_t	Reserved[2];
298
-} PACKED t_PXENV_UNDI_TRANSMIT;
299
-
300
-#define	MAX_DATA_BLKS		8
301
-typedef struct {
302
-	uint16_t	ImmedLength;
303
-	SEGOFF16_t	Xmit;
304
-	uint16_t	DataBlkCount;
305
-	struct	DataBlk {
306
-		uint8_t		TDPtrType;
307
-		uint8_t		TDRsvdByte;
308
-		uint16_t	TDDataLen;
309
-		SEGOFF16_t	TDDataPtr;
310
-	} DataBlock[MAX_DATA_BLKS];
311
-} PACKED t_PXENV_UNDI_TBD;
312
-
313
-#define	PXENV_UNDI_SET_MCAST_ADDRESS	0x0009
314
-typedef struct {
315
-	PXENV_STATUS_t	Status;
316
-	t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
317
-} PACKED t_PXENV_UNDI_SET_MCAST_ADDRESS;
318
-
319
-#define	PXENV_UNDI_SET_STATION_ADDRESS	0x000A
320
-typedef struct {
321
-	PXENV_STATUS_t	Status;
322
-	MAC_ADDR	StationAddress;		/* Temp MAC addres to use */
323
-} PACKED t_PXENV_UNDI_SET_STATION_ADDRESS;
324
-
325
-#define	PXENV_UNDI_SET_PACKET_FILTER	0x000B
326
-typedef struct {
327
-	PXENV_STATUS_t	Status;
328
-	uint8_t		filter;			/* see UNDI_OPEN (0x0006) */
329
-} PACKED t_PXENV_UNDI_SET_PACKET_FILTER;
330
-
331
-#define	PXENV_UNDI_GET_INFORMATION	0x000C
332
-typedef struct {
333
-	PXENV_STATUS_t	Status;
334
-	uint16_t	BaseIo;			/* Adapter base I/O address */
335
-	uint16_t	IntNumber;		/* Adapter IRQ number */
336
-	uint16_t	MaxTranUnit;		/* Adapter maximum transmit unit */
337
-	uint16_t	HwType;			/* Type of protocol at the hardware addr */
338
-#	define ETHER_TYPE	1
339
-#	define EXP_ETHER_TYPE	2
340
-#	define IEEE_TYPE	6
341
-#	define ARCNET_TYPE	7
342
-
343
-	uint16_t	HwAddrLen;		/* Length of hardware address */
344
-	MAC_ADDR	CurrentNodeAddress;	/* Current hardware address */
345
-	MAC_ADDR	PermNodeAddress;	/* Permanent hardware address */
346
-	SEGSEL_t	ROMAddress;		/* Real mode ROM segment address */
347
-	uint16_t	RxBufCt;		/* Receive queue length */
348
-	uint16_t	TxBufCt;		/* Transmit queue length */
349
-} PACKED t_PXENV_UNDI_GET_INFORMATION;
350
-
351
-#define	PXENV_UNDI_GET_STATISTICS	0x000D
352
-typedef struct {
353
-	PXENV_STATUS_t	Status;
354
-	uint32_t	XmitGoodFrames;		/* Number of successful transmissions */
355
-	uint32_t	RcvGoodFrames;		/* Number of good frames received */
356
-	uint32_t	RcvCRCErrors;		/* Number of frames with CRC errors */
357
-	uint32_t	RcvResourceErrors;	/* Number of frames dropped */
358
-} PACKED t_PXENV_UNDI_GET_STATISTICS;
359
-
360
-#define	PXENV_UNDI_CLEAR_STATISTICS	0x000E
361
-typedef struct {
362
-	PXENV_STATUS_t	Status;
363
-} PACKED t_PXENV_UNDI_CLEAR_STATISTICS;
364
-
365
-#define	PXENV_UNDI_INITIATE_DIAGS	0x000F
366
-typedef struct {
367
-	PXENV_STATUS_t	Status;
368
-} PACKED t_PXENV_UNDI_INITIATE_DIAGS;
369
-
370
-#define	PXENV_UNDI_FORCE_INTERRUPT	0x0010
371
-typedef struct {
372
-	PXENV_STATUS_t	Status;
373
-} PACKED t_PXENV_UNDI_FORCE_INTERRUPT;
374
-
375
-#define	PXENV_UNDI_GET_MCAST_ADDRESS	0x0011
376
-typedef struct {
377
-	PXENV_STATUS_t	Status;
378
-	IP4_t		InetAddr;		/* IP mulicast address */
379
-	MAC_ADDR	MediaAddr;		/* MAC multicast address */
380
-} PACKED t_PXENV_UNDI_GET_MCAST_ADDRESS;
381
-
382
-#define	PXENV_UNDI_GET_NIC_TYPE		0x0012
383
-typedef struct {
384
-	PXENV_STATUS_t	Status;
385
-	uint8_t		NicType;		/* Type of NIC */
386
-#	define PCI_NIC		2
387
-#	define PnP_NIC		3
388
-#	define CardBus_NIC	4
389
-
390
-	union {
391
-		struct {
392
-			uint16_t	Vendor_ID;
393
-			uint16_t	Dev_ID;
394
-			uint8_t		Base_Class;
395
-			uint8_t		Sub_Class;
396
-			uint8_t		Prog_Intf;
397
-			uint8_t		Rev;
398
-			uint16_t	BusDevFunc;
399
-			uint16_t	SubVendor_ID;
400
-			uint16_t	SubDevice_ID;
401
-		} pci, cardbus;
402
-		struct {
403
-			uint32_t	EISA_Dev_ID;
404
-			uint8_t		Base_Class;
405
-			uint8_t		Sub_Class;
406
-			uint8_t		Prog_Intf;
407
-			uint16_t	CardSelNum;
408
-		} pnp;
409
-	} info;
410
-} PACKED t_PXENV_UNDI_GET_NIC_TYPE;
411
-
412
-#define	PXENV_UNDI_GET_IFACE_INFO	0x0013
413
-typedef struct {
414
-	PXENV_STATUS_t	Status;
415
-	uint8_t		IfaceType[16];		/* Name of MAC type in ASCII. */
416
-	uint32_t	LinkSpeed;		/* Defined in NDIS 2.0 spec */
417
-	uint32_t	ServiceFlags;		/* Defined in NDIS 2.0 spec */
418
-	uint32_t	Reserved[4];		/* must be 0 */
419
-} PACKED t_PXENV_UNDI_GET_IFACE_INFO;
420
-
421
-#define	PXENV_UNDI_ISR			0x0014
422
-typedef struct {
423
-	PXENV_STATUS_t	Status;
424
-	uint16_t	FuncFlag;		/* PXENV_UNDI_ISR_OUT_xxx */
425
-	uint16_t	BufferLength;		/* Length of Frame */
426
-	uint16_t	FrameLength;		/* Total length of reciever frame */
427
-	uint16_t	FrameHeaderLength;	/* Length of the media header in Frame */
428
-	SEGOFF16_t	Frame;			/* receive buffer */
429
-	uint8_t		ProtType;		/* Protocol type */
430
-	uint8_t		PktType;		/* Packet Type */
431
-#	define PXENV_UNDI_ISR_IN_START		1
432
-#	define PXENV_UNDI_ISR_IN_PROCESS	2
433
-#	define PXENV_UNDI_ISR_IN_GET_NEXT	3
434
-
435
-	/* one of these will be returned for PXENV_UNDI_ISR_IN_START */
436
-#	define PXENV_UNDI_ISR_OUT_OURS		0
437
-#	define PXENV_UNDI_ISR_OUT_NOT_OURS	1
438
-
439
-	/*
440
-	 * one of these will bre returnd for PXEND_UNDI_ISR_IN_PROCESS
441
-	 * and PXENV_UNDI_ISR_IN_GET_NEXT
442
-	 */
443
-#	define PXENV_UNDI_ISR_OUT_DONE		0
444
-#	define PXENV_UNDI_ISR_OUT_TRANSMIT	2
445
-#	define PXENV_UNDI_ISR_OUT_RECEIVE	3
446
-#	define PXENV_UNDI_ISR_OUT_BUSY		4
447
-} PACKED t_PXENV_UNDI_ISR;
448
-
449
-#define	PXENV_STOP_UNDI			0x0015
450
-typedef struct {
451
-	PXENV_STATUS_t	Status;
452
-} PACKED t_PXENV_STOP_UNDI;
453
-
454
-#define	PXENV_TFTP_OPEN			0x0020
455
-typedef struct {
456
-	PXENV_STATUS_t	Status;
457
-	IP4_t		ServerIPAddress;
458
-	IP4_t		GatewayIPAddress;
459
-	uint8_t		FileName[128];
460
-	UDP_PORT_t	TFTPPort;
461
-	uint16_t	PacketSize;
462
-} PACKED t_PXENV_TFTP_OPEN;
463
-
464
-#define	PXENV_TFTP_CLOSE		0x0021
465
-typedef struct {
466
-	PXENV_STATUS_t	Status;
467
-} PACKED t_PXENV_TFTP_CLOSE;
468
-
469
-#define	PXENV_TFTP_READ			0x0022
470
-typedef struct {
471
-	PXENV_STATUS_t	Status;
472
-	uint16_t	PacketNumber;
473
-	uint16_t	BufferSize;
474
-	SEGOFF16_t	Buffer;
475
-} PACKED t_PXENV_TFTP_READ;
476
-
477
-#define	PXENV_TFTP_READ_FILE		0x0023
478
-typedef struct {
479
-	PXENV_STATUS_t	Status;
480
-	uint8_t		FileName[128];
481
-	uint32_t	BufferSize;
482
-	ADDR32_t	Buffer;
483
-	IP4_t		ServerIPAddress;
484
-	IP4_t		GatewayIPAdress;
485
-	IP4_t		McastIPAdress;
486
-	UDP_PORT_t	TFTPClntPort;
487
-	UDP_PORT_t	TFTPSrvPort;
488
-	uint16_t	TFTPOpenTimeOut;
489
-	uint16_t	TFTPReopenDelay;
490
-} PACKED t_PXENV_TFTP_READ_FILE;
491
-
492
-#define	PXENV_TFTP_GET_FSIZE		0x0025
493
-typedef struct {
494
-	PXENV_STATUS_t	Status;
495
-	IP4_t		ServerIPAddress;
496
-	IP4_t		GatewayIPAdress;
497
-	uint8_t		FileName[128];
498
-	uint32_t	FileSize;
499
-} PACKED t_PXENV_TFTP_GET_FSIZE;
500
-
501
-#define	PXENV_UDP_OPEN			0x0030
502
-typedef struct {
503
-	PXENV_STATUS_t	Status;
504
-	IP4_t		src_ip;		/* IP address of this station */
505
-} PACKED t_PXENV_UDP_OPEN;
506
-
507
-#define	PXENV_UDP_CLOSE			0x0031
508
-typedef struct {
509
-	PXENV_STATUS_t	Status;
510
-} PACKED t_PXENV_UDP_CLOSE;
511
-
512
-#define	PXENV_UDP_READ			0x0032
513
-typedef struct {
514
-	PXENV_STATUS_t	Status;
515
-	IP4_t		src_ip;		/* IP of sender */
516
-	IP4_t		dest_ip;	/* Only accept packets sent to this IP */
517
-	UDP_PORT_t	s_port;		/* UDP source port of sender */
518
-	UDP_PORT_t	d_port;		/* Only accept packets sent to this port */
519
-	uint16_t	buffer_size;	/* Size of the packet buffer */
520
-	SEGOFF16_t	buffer;		/* SEG:OFF to the packet buffer */
521
-} PACKED t_PXENV_UDP_READ;
522
-
523
-#define	PXENV_UDP_WRITE			0x0033
524
-typedef struct {
525
-	PXENV_STATUS_t	Status;
526
-	IP4_t		ip;		/* dest ip addr */
527
-	IP4_t		gw;		/* ip gateway */
528
-	UDP_PORT_t	src_port;	/* source udp port */
529
-	UDP_PORT_t	dst_port;	/* destination udp port */
530
-	uint16_t	buffer_size;	/* Size of the packet buffer */
531
-	SEGOFF16_t	buffer;		/* SEG:OFF to the packet buffer */
532
-} PACKED t_PXENV_UDP_WRITE;
533
-
534
-#define	PXENV_UNLOAD_STACK		0x0070
535
-typedef struct {
536
-	PXENV_STATUS_t	Status;
537
-	uint8_t		reserved[10];
538
-} PACKED t_PXENV_UNLOAD_STACK;
539
-
540
-
541
-#define	PXENV_GET_CACHED_INFO		0x0071
542
-typedef struct {
543
-	PXENV_STATUS_t	Status;
544
-	uint16_t	PacketType;	/* type (defined right here) */
545
-#	define PXENV_PACKET_TYPE_DHCP_DISCOVER  1
546
-#	define PXENV_PACKET_TYPE_DHCP_ACK       2
547
-#	define PXENV_PACKET_TYPE_BINL_REPLY     3
548
-	uint16_t	BufferSize;	/* max to copy, leave at 0 for pointer */
549
-	SEGOFF16_t	Buffer;		/* copy to, leave at 0 for pointer */
550
-	uint16_t	BufferLimit;	/* max size of buffer in BC dataseg ? */
551
-} PACKED t_PXENV_GET_CACHED_INFO;
552
-
553
-
554
-/* structure filled in by PXENV_GET_CACHED_INFO 
555
- * (how we determine which IP we downloaded the initial bootstrap from)
556
- * words can't describe...
557
- */
558
-typedef struct {
559
-	uint8_t		opcode;
560
-#	define BOOTP_REQ	1
561
-#	define BOOTP_REP	2
562
-	uint8_t		Hardware;	/* hardware type */
563
-	uint8_t		Hardlen;	/* hardware addr len */
564
-	uint8_t		Gatehops;	/* zero it */
565
-	uint32_t	ident;		/* random number chosen by client */
566
-	uint16_t	seconds;	/* seconds since did initial bootstrap */
567
-	uint16_t	Flags;		/* seconds since did initial bootstrap */
568
-#	define BOOTP_BCAST	0x8000		/* ? */
569
-	IP4_t		cip;		/* Client IP */
570
-	IP4_t		yip;		/* Your IP */
571
-	IP4_t		sip;		/* IP to use for next boot stage */
572
-	IP4_t		gip;		/* Relay IP ? */
573
-	MAC_ADDR	CAddr;		/* Client hardware address */
574
-	uint8_t		Sname[64];	/* Server's hostname (Optional) */
575
-	uint8_t		bootfile[128];	/* boot filename */
576
-	union {
577
-#		if 1
578
-#		define BOOTP_DHCPVEND  1024    /* DHCP extended vendor field size */
579
-#		else
580
-#		define BOOTP_DHCPVEND  312	/* DHCP standard vendor field size */
581
-#		endif
582
-		uint8_t		d[BOOTP_DHCPVEND];	/* raw array of vendor/dhcp options */
583
-		struct {
584
-			uint8_t		magic[4];	/* DHCP magic cookie */
585
-#			ifndef		VM_RFC1048
586
-#			define		VM_RFC1048	0x63825363L	/* ? */
587
-#			endif
588
-			uint32_t	flags;		/* bootp flags/opcodes */
589
-			uint8_t		pad[56];	/* I don't think intel knows what a
590
-							   union does... */
591
-		} v;
592
-	} vendor;
593
-} PACKED BOOTPLAYER;
594
-
595
-#define	PXENV_RESTART_TFTP		0x0073
596
-#define	t_PXENV_RESTART_TFTP		t_PXENV_TFTP_READ_FILE
597
-
598
-#define	PXENV_START_BASE		0x0075
599
-typedef struct {
600
-	PXENV_STATUS_t	Status;
601
-} PACKED t_PXENV_START_BASE;
602
-
603
-#define	PXENV_STOP_BASE			0x0076
604
-typedef struct {
605
-	PXENV_STATUS_t	Status;
606
-} PACKED t_PXENV_STOP_BASE;
607
-
608
-/*****************************************************************************
609
- * The following portion of this file is derived from netboot's
610
- * general.h86.  Do not remove the copyright notice below.
611
- *****************************************************************************
612
- */
613
-
614
-/*
615
- * general.h86  -  Common PXE definitions
616
- *
617
- * Copyright (C) 2003 Gero Kuhlmann <gero@gkminix.han.de>
618
- *
619
- *  This program is free software; you can redistribute it and/or modify
620
- *  it under the terms of the GNU General Public License as published by
621
- *  the Free Software Foundation; either version 2 of the License, or
622
- *  any later version.
623
- *
624
- *  This program is distributed in the hope that it will be useful,
625
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
626
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
627
- *  GNU General Public License for more details.
628
- *
629
- *  You should have received a copy of the GNU General Public License
630
- *  along with this program; if not, write to the Free Software
631
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
632
- *
633
- * $Id$
634
- */
635
-
636
-/*
637
- **************************************************************************
638
- *
639
- * This file contains the Preboot API common definitions as
640
- * per Intels PXE specification version 2.0.
641
- *
642
- * Updated to comply with PXE specification version 2.1 by Michael Brown.
643
- *
644
- **************************************************************************
645
- *
646
- * Result codes returned in AX by a PXENV API service:
647
- */
648
-#define PXENV_EXIT_SUCCESS	0x0000
649
-#define PXENV_EXIT_FAILURE	0x0001
650
-
651
-
652
-
653
-/*
654
- **************************************************************************
655
- *
656
- * CPU types (defined in WfM 1.1):
657
- */
658
-#define PXENV_CPU_X86		0
659
-#define PXENV_CPU_ALPHA		1
660
-#define PXENV_CPU_PPC		2
661
-
662
-
663
-
664
-/*
665
- **************************************************************************
666
- *
667
- * Bus types (defined in WfM 1.1):
668
- */
669
-#define PXENV_BUS_ISA		0
670
-#define PXENV_BUS_EISA		1
671
-#define PXENV_BUS_MCA		2
672
-#define PXENV_BUS_PCI		3
673
-#define PXENV_BUS_VESA		4
674
-#define PXENV_BUS_PCMCIA	5
675
-
676
-
677
-
678
-/*****************************************************************************
679
- * The remainder of this file is original to Etherboot.
680
- *****************************************************************************
681
- */
682
-
683
-/* Dummy PXE opcode for the loader routine.  We do this to make the
684
- * API simpler
685
- */
686
-#define PXENV_UNDI_LOADER		0x104d	/* 'load' */
687
-
688
-typedef struct undi_loader {
689
-	union {
690
-		struct {
691
-			PXENV_STATUS_t	Status;
692
-			uint16_t	ax;
693
-			uint16_t	bx;
694
-			uint16_t	dx;
695
-			uint16_t	di;
696
-			uint16_t	es;
697
-		};
698
-		t_PXENV_START_UNDI start_undi;
699
-	};
700
-	uint16_t	undi_ds;
701
-	uint16_t	undi_cs;
702
-	SEGOFF16_t	pxe_ptr;
703
-	SEGOFF16_t	pxenv_ptr;
704
-} PACKED undi_loader_t;
4
+#include "pxe_types.h"
5
+#include "pxe_api.h"
705 6
 
706 7
 /* Union used for PXE API calls; we don't know the type of the
707 8
  * structure until we interpret the opcode.  Also, Status is available
708 9
  * in the same location for any opcode, and it's convenient to have
709 10
  * non-specific access to it.
710 11
  */
711
-typedef union {
712
-	PXENV_STATUS_t			Status; /* Make it easy to read status
713
-						   for any operation */
714
-	t_PXENV_START_UNDI		start_undi;
715
-	t_PXENV_UNDI_STARTUP		undi_startup;
716
-	t_PXENV_UNDI_CLEANUP		undi_cleanup;
717
-	t_PXENV_UNDI_INITIALIZE		undi_initialize;
718
-	t_PXENV_UNDI_RESET_ADAPTER	undi_reset_adapter;
719
-	t_PXENV_UNDI_SHUTDOWN		undi_shutdown;
720
-	t_PXENV_UNDI_OPEN		undi_open;
721
-	t_PXENV_UNDI_CLOSE		undi_close;
722
-	t_PXENV_UNDI_TRANSMIT		undi_transmit;
723
-	t_PXENV_UNDI_SET_MCAST_ADDRESS	undi_set_mcast_address;
724
-	t_PXENV_UNDI_SET_STATION_ADDRESS undi_set_station_address;
725
-	t_PXENV_UNDI_SET_PACKET_FILTER	undi_set_packet_filter;
726
-	t_PXENV_UNDI_GET_INFORMATION	undi_get_information;
727
-	t_PXENV_UNDI_GET_STATISTICS	undi_get_statistics;
728
-	t_PXENV_UNDI_CLEAR_STATISTICS	undi_clear_statistics;
729
-	t_PXENV_UNDI_INITIATE_DIAGS	undi_initiate_diags;
730
-	t_PXENV_UNDI_FORCE_INTERRUPT	undi_force_interrupt;
731
-	t_PXENV_UNDI_GET_MCAST_ADDRESS	undi_get_mcast_address;
732
-	t_PXENV_UNDI_GET_NIC_TYPE	undi_get_nic_type;
733
-	t_PXENV_UNDI_GET_IFACE_INFO	undi_get_iface_info;
734
-	t_PXENV_UNDI_ISR		undi_isr;
735
-	t_PXENV_STOP_UNDI		stop_undi;
736
-	t_PXENV_TFTP_OPEN		tftp_open;
737
-	t_PXENV_TFTP_CLOSE		tftp_close;
738
-	t_PXENV_TFTP_READ		tftp_read;
739
-	t_PXENV_TFTP_READ_FILE		tftp_read_file;
740
-	t_PXENV_TFTP_GET_FSIZE		tftp_get_fsize;
741
-	t_PXENV_UDP_OPEN		udp_open;
742
-	t_PXENV_UDP_CLOSE		udp_close;
743
-	t_PXENV_UDP_READ		udp_read;
744
-	t_PXENV_UDP_WRITE		udp_write;
745
-	t_PXENV_UNLOAD_STACK		unload_stack;
746
-	t_PXENV_GET_CACHED_INFO		get_cached_info;
747
-	t_PXENV_RESTART_TFTP		restart_tftp;
748
-	t_PXENV_START_BASE		start_base;
749
-	t_PXENV_STOP_BASE		stop_base;
750
-	undi_loader_t			loader;
751
-} t_PXENV_ANY;
12
+union u_PXENV_ANY {
13
+	/* Make it easy to read status for any operation */
14
+	PXENV_STATUS_t				Status;
15
+	struct s_PXENV_UNLOAD_STACK		unload_stack;
16
+	struct s_PXENV_GET_CACHED_INFO		get_cached_info;
17
+	struct s_PXENV_RESTART_TFTP		restart_tftp;
18
+	struct s_PXENV_START_UNDI		start_undi;
19
+	struct s_PXENV_STOP_UNDI		stop_undi;
20
+	struct s_PXENV_START_BASE		start_base;
21
+	struct s_PXENV_STOP_BASE		stop_base;
22
+	struct s_PXENV_TFTP_OPEN		tftp_open;
23
+	struct s_PXENV_TFTP_CLOSE		tftp_close;
24
+	struct s_PXENV_TFTP_READ		tftp_read;
25
+	struct s_PXENV_TFTP_READ_FILE		tftp_read_file;
26
+	struct s_PXENV_TFTP_GET_FSIZE		tftp_get_fsize;
27
+	struct s_PXENV_UDP_OPEN			udp_open;
28
+	struct s_PXENV_UDP_CLOSE		udp_close;
29
+	struct s_PXENV_UDP_WRITE		udp_write;
30
+	struct s_PXENV_UDP_READ			udp_read;
31
+	struct s_PXENV_UNDI_STARTUP		undi_startup;
32
+	struct s_PXENV_UNDI_CLEANUP		undi_cleanup;
33
+	struct s_PXENV_UNDI_INITIALIZE		undi_initialize;
34
+	struct s_PXENV_UNDI_RESET_ADAPTER	undi_reset_adapter;
35
+	struct s_PXENV_UNDI_SHUTDOWN		undi_shutdown;
36
+	struct s_PXENV_UNDI_OPEN		undi_open;
37
+	struct s_PXENV_UNDI_CLOSE		undi_close;
38
+	struct s_PXENV_UNDI_TRANSMIT		undi_transmit;
39
+	struct s_PXENV_UNDI_SET_MCAST_ADDRESS	undi_set_mcast_address;
40
+	struct s_PXENV_UNDI_SET_STATION_ADDRESS undi_set_station_address;
41
+	struct s_PXENV_UNDI_SET_PACKET_FILTER	undi_set_packet_filter;
42
+	struct s_PXENV_UNDI_GET_INFORMATION	undi_get_information;
43
+	struct s_PXENV_UNDI_GET_STATISTICS	undi_get_statistics;
44
+	struct s_PXENV_UNDI_CLEAR_STATISTICS	undi_clear_statistics;
45
+	struct s_PXENV_UNDI_INITIATE_DIAGS	undi_initiate_diags;
46
+	struct s_PXENV_UNDI_FORCE_INTERRUPT	undi_force_interrupt;
47
+	struct s_PXENV_UNDI_GET_MCAST_ADDRESS	undi_get_mcast_address;
48
+	struct s_PXENV_UNDI_GET_NIC_TYPE	undi_get_nic_type;
49
+	struct s_PXENV_UNDI_GET_IFACE_INFO	undi_get_iface_info;
50
+	struct s_PXENV_UNDI_GET_STATE		undi_get_state;
51
+	struct s_PXENV_UNDI_ISR			undi_isr;
52
+};
53
+
54
+typedef union u_PXENV_ANY PXENV_ANY_t;
752 55
 
753 56
 /* PXE stack status indicator.  See pxe_export.c for further
754 57
  * explanation.
@@ -785,4 +88,6 @@ typedef struct {
785 88
 	struct {}	arch_data __attribute__ ((aligned(16)));
786 89
 } pxe_stack_t;
787 90
 
91
+extern PXENV_EXIT_t pxe_api_call ( int opcode, union u_PXENV_ANY *any );
92
+
788 93
 #endif /* PXE_H */

+ 0
- 88
src/include/pxe_internal.h View File

@@ -1,88 +0,0 @@
1
-#ifndef PXE_INTERNAL_H
2
-#define PXE_INTERNAL_H
3
-
4
-/* Union used for PXE API calls; we don't know the type of the
5
- * structure until we interpret the opcode.  Also, Status is available
6
- * in the same location for any opcode, and it's convenient to have
7
- * non-specific access to it.
8
- */
9
-union u_PXENV_ANY {
10
-	/* Make it easy to read status for any operation */
11
-	PXENV_STATUS_t				Status;
12
-	struct s_PXENV_UNLOAD_STACK		unload_stack;
13
-	struct s_PXENV_GET_CACHED_INFO		get_cached_info;
14
-	struct s_PXENV_RESTART_TFTP		restart_tftp;
15
-	struct s_PXENV_START_UNDI		start_undi;
16
-	struct s_PXENV_STOP_UNDI		stop_undi;
17
-	struct s_PXENV_START_BASE		start_base;
18
-	struct s_PXENV_STOP_BASE		stop_base;
19
-	struct s_PXENV_TFTP_OPEN		tftp_open;
20
-	struct s_PXENV_TFTP_CLOSE		tftp_close;
21
-	struct s_PXENV_TFTP_READ		tftp_read;
22
-	struct s_PXENV_TFTP_READ_FILE		tftp_read_file;
23
-	struct s_PXENV_TFTP_GET_FSIZE		tftp_get_fsize;
24
-	struct s_PXENV_UDP_OPEN			udp_open;
25
-	struct s_PXENV_UDP_CLOSE		udp_close;
26
-	struct s_PXENV_UDP_WRITE		udp_write;
27
-	struct s_PXENV_UDP_READ			udp_read;
28
-	struct s_PXENV_UNDI_STARTUP		undi_startup;
29
-	struct s_PXENV_UNDI_CLEANUP		undi_cleanup;
30
-	struct s_PXENV_UNDI_INITIALIZE		undi_initialize;
31
-	struct s_PXENV_UNDI_RESET_ADAPTER	undi_reset_adapter;
32
-	struct s_PXENV_UNDI_SHUTDOWN		undi_shutdown;
33
-	struct s_PXENV_UNDI_OPEN		undi_open;
34
-	struct s_PXENV_UNDI_CLOSE		undi_close;
35
-	struct s_PXENV_UNDI_TRANSMIT		undi_transmit;
36
-	struct s_PXENV_UNDI_SET_MCAST_ADDRESS	undi_set_mcast_address;
37
-	struct s_PXENV_UNDI_SET_STATION_ADDRESS undi_set_station_address;
38
-	struct s_PXENV_UNDI_SET_PACKET_FILTER	undi_set_packet_filter;
39
-	struct s_PXENV_UNDI_GET_INFORMATION	undi_get_information;
40
-	struct s_PXENV_UNDI_GET_STATISTICS	undi_get_statistics;
41
-	struct s_PXENV_UNDI_CLEAR_STATISTICS	undi_clear_statistics;
42
-	struct s_PXENV_UNDI_INITIATE_DIAGS	undi_initiate_diags;
43
-	struct s_PXENV_UNDI_FORCE_INTERRUPT	undi_force_interrupt;
44
-	struct s_PXENV_UNDI_GET_MCAST_ADDRESS	undi_get_mcast_address;
45
-	struct s_PXENV_UNDI_GET_NIC_TYPE	undi_get_nic_type;
46
-	struct s_PXENV_UNDI_GET_IFACE_INFO	undi_get_iface_info;
47
-	struct s_PXENV_UNDI_GET_STATE		undi_get_state;
48
-	struct s_PXENV_UNDI_ISR			undi_isr;
49
-};
50
-
51
-typedef union u_PXENV_ANY PXENV_ANY_t;
52
-
53
-/* PXE stack status indicator.  See pxe_export.c for further
54
- * explanation.
55
- */
56
-typedef enum {
57
-	CAN_UNLOAD = 0,
58
-	MIDWAY,
59
-	READY
60
-} pxe_stack_state_t;
61
-
62
-/* Data structures installed as part of a PXE stack.  Architectures
63
- * will have extra information to append to the end of this.
64
- */
65
-#define PXE_TFTP_MAGIC_COOKIE ( ( 'P'<<24 ) | ( 'x'<<16 ) | ( 'T'<<8 ) | 'f' )
66
-typedef struct {
67
-	pxe_t		pxe	__attribute__ ((aligned(16)));
68
-	pxenv_t		pxenv	__attribute__ ((aligned(16)));
69
-	pxe_stack_state_t state;
70
-	union {
71
-		BOOTPLAYER	cached_info;
72
-		char		packet[ETH_FRAME_LEN];
73
-		struct {
74
-			uint32_t magic_cookie;
75
-			unsigned int len;
76
-			int eof;
77
-			char data[TFTP_MAX_PACKET];
78
-		} tftpdata;
79
-		struct {
80
-			char *buffer;
81
-			uint32_t offset;
82
-			uint32_t bufferlen;
83
-		} readfile;
84
-	};
85
-	struct {}	arch_data __attribute__ ((aligned(16)));
86
-} pxe_stack_t;
87
-
88
-#endif /* PXE_INTERNAL_H */

+ 2
- 2
src/include/pxe_types.h View File

@@ -51,9 +51,9 @@ typedef UINT16_t PXENV_EXIT_t;
51 51
  */
52 52
 typedef UINT16_t PXENV_STATUS_t;
53 53
 
54
-/** An IP address.
54
+/** An IPv4 address.
55 55
  *
56
- * This is an IPv4 address in host byte order.
56
+ * @note This data type is in network (big-endian) byte order.
57 57
  *
58 58
  */
59 59
 typedef UINT32_t IP4_t;

Loading…
Cancel
Save