Adding upstream version 3.62+dfsg.
[syslinux-debian/hramrach.git] / com32 / include / syslinux / pxe.h
blob7550817fe16dc51173afea0c956537fed8aa34d8
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following
12 * conditions:
14 * The above copyright notice and this permission notice shall
15 * be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
26 * ----------------------------------------------------------------------- */
29 * syslinux/pxe.h
31 * PXE definitions and function prototypes for SYSLINUX
34 #ifndef _SYSLINUX_PXE_H
35 #define _SYSLINUX_PXE_H
37 #include <stdint.h>
38 #include <netinet/in.h>
39 #include <klibc/compiler.h>
41 /* PXE spec structures and definitions. These mostly follow the PXE
42 spec, except when the PXE spec is unnecessarily stupid. Of course,
43 that is most of the time. */
45 /* Basic types; use Unix-like _t convention instead of SCREAMING; also
46 re-use types we already have, like in_addr_t. */
48 typedef uint16_t pxenv_status_t;
50 #define MAC_ADDR_LEN 16
51 typedef uint8_t mac_addr_t[MAC_ADDR_LEN];
53 /* "Protected mode segment descriptor" according to PXE... */
54 typedef struct {
55 uint16_t segaddr;
56 uint32_t physaddr;
57 uint16_t segsize;
58 } __packed pxe_segdesc_t;
60 typedef struct {
61 uint16_t offs;
62 uint16_t seg;
63 } segoff16_t;
65 /* Function calling structures and constants */
67 typedef struct s_PXENV_GET_CACHED_INFO
69 pxenv_status_t Status;
70 uint16_t PacketType;
71 #define PXENV_PACKET_TYPE_DHCP_DISCOVER 1
72 #define PXENV_PACKET_TYPE_DHCP_ACK 2
73 #define PXENV_PACKET_TYPE_CACHED_REPLY 3
74 uint16_t BufferSize;
75 segoff16_t Buffer;
76 uint16_t BufferLimit;
77 } __packed t_PXENV_GET_CACHED_INFO;
79 typedef struct s_PXENV_START_UNDI {
80 pxenv_status_t Status;
81 uint16_t AX;
82 uint16_t BX;
83 uint16_t DX;
84 uint16_t DI;
85 uint16_t ES;
86 } __packed t_PXENV_START_UNDI;
88 typedef struct s_PXENV_STOP_UNDI
90 pxenv_status_t Status;
91 } __packed t_PXENV_STOP_UNDI;
93 typedef struct s_PXENV_START_BASE
95 pxenv_status_t Status;
96 } __packed t_PXENV_START_BASE;
98 typedef struct s_PXENV_STOP_BASE
100 pxenv_status_t Status;
101 } __packed t_PXENV_STOP_BASE;
103 typedef struct s_PXENV_TFTP_OPEN
105 pxenv_status_t Status;
106 in_addr_t ServerIPAddress;
107 in_addr_t GatewayIPAddress;
108 uint8_t FileName[128];
109 in_port_t TFTPPort;
110 uint16_t PacketSize;
111 } __packed t_PXENV_TFTP_OPEN;
113 typedef struct s_PXENV_TFTP_CLOSE
115 pxenv_status_t Status;
116 } __packed t_PXENV_TFTP_CLOSE;
118 typedef struct s_PXENV_TFTP_READ
120 pxenv_status_t Status;
121 uint16_t PacketNumber;
122 uint16_t BufferSize;
123 segoff16_t Buffer;
124 } __packed t_PXENV_TFTP_READ;
126 typedef struct s_PXENV_TFTP_READ_FILE
128 pxenv_status_t Status;
129 uint8_t FileName[128];
130 uint32_t BufferSize;
131 void * Buffer;
132 in_addr_t ServerIPAddress;
133 in_addr_t GatewayIPAddress;
134 in_addr_t McastIPAddress;
135 in_port_t TFTPClntPort;
136 in_port_t TFTPSrvPort;
137 uint16_t TFTPOpenTimeOut;
138 uint16_t TFTPReopenDelay;
139 } __packed t_PXENV_TFTP_READ_FILE;
141 typedef struct s_PXENV_TFTP_GET_FSIZE
143 pxenv_status_t Status;
144 in_addr_t ServerIPAddress;
145 in_addr_t GatewayIPAddress;
146 uint8_t FileName[128];
147 uint32_t FileSize;
148 } __packed t_PXENV_TFTP_GET_FSIZE;
150 typedef struct s_PXENV_UDP_OPEN
152 pxenv_status_t status;
153 in_addr_t src_ip;
154 } __packed t_PXENV_UDP_OPEN;
156 typedef struct s_PXENV_UDP_CLOSE
158 pxenv_status_t status;
159 } __packed t_PXENV_UDP_CLOSE;
161 typedef struct s_PXENV_UDP_WRITE
163 pxenv_status_t status;
164 in_addr_t ip;
165 in_addr_t gw;
166 in_port_t src_port;
167 in_port_t dst_port;
168 uint16_t buffer_size;
169 segoff16_t buffer;
170 } __packed t_PXENV_UDP_WRITE;
172 typedef struct s_PXENV_UDP_READ
174 pxenv_status_t status;
175 in_addr_t src_ip;
176 in_addr_t dest_ip;
177 in_port_t s_port;
178 in_port_t d_port;
179 uint16_t buffer_size;
180 segoff16_t buffer;
181 } __packed t_PXENV_UDP_READ;
183 typedef struct s_PXENV_UNDI_STARTUP
185 pxenv_status_t Status;
186 } __packed t_PXENV_UNDI_STARTUP;
188 typedef struct s_PXENV_UNDI_CLEANUP {
189 pxenv_status_t Status;
190 } __packed t_PXENV_UNDI_CLEANUP;
192 typedef struct s_PXENV_UNDI_INITIALIZE {
193 pxenv_status_t Status;
194 void * ProtocolIni;
195 uint8_t reserved[8];
196 } __packed t_PXENV_UNDI_INITIALIZE;
198 #define MAXNUM_MCADDR 8
199 typedef struct s_PXENV_UNDI_MCAST_ADDRESS
201 uint16_t MCastAddrCount;
202 mac_addr_t McastAddr[MAXNUM_MCADDR];
203 } __packed t_PXENV_UNDI_MCAST_ADDRESS;
205 typedef struct s_PXENV_UNDI_RESET
207 pxenv_status_t Status;
208 t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
209 } __packed t_PXENV_UNDI_RESET;
211 typedef struct s_PXENV_UNDI_SHUTDOWN
213 pxenv_status_t Status;
214 } __packed t_PXENV_UNDI_SHUTDOWN;
216 typedef struct s_PXENV_UNDI_OPEN
218 pxenv_status_t Status;
219 uint16_t OpenFlag;
220 uint16_t PktFilter;
221 #define FLTR_DIRECTED 0x0001
222 #define FLTR_BRDCST 0x0002
223 #define FLTR_PRMSCS 0x0004
224 #define FLTR_SRC_RTG 0x0008
225 t_PXENV_UNDI_MCAST_ADDRESS
226 R_Mcast_Buf;
227 } __packed t_PXENV_UNDI_OPEN;
229 typedef struct s_PXENV_UNDI_CLOSE
231 pxenv_status_t Status;
232 } __packed t_PXENV_UNDI_CLOSE;
234 typedef struct s_PXENV_UNDI_TRANSMIT
236 pxenv_status_t Status;
237 uint8_t Protocol;
238 #define P_UNKNOWN 0
239 #define P_IP 1
240 #define P_ARP 2
241 #define P_RARP 3
242 uint8_t XmitFlag;
243 #define XMT_DESTADDR 0x0000
244 #define XMT_BROADCAST 0x0001
245 segoff16_t DestAddr;
246 segoff16_t TBD;
247 uint32_t Reserved[2];
248 } __packed t_PXENV_UNDI_TRANSMIT;
249 #define MAX_DATA_BLKS 8
250 typedef struct s_PXENV_UNDI_TBD
252 uint16_t ImmedLength;
253 segoff16_t Xmit;
254 uint16_t DataBlkCount;
255 struct DataBlk
257 uint8_t TDPtrType;
258 uint8_t TDRsvdByte;
259 uint16_t TDDataLen;
260 segoff16_t TDDataPtr;
261 } DataBlock[MAX_DATA_BLKS];
262 } __packed t_PXENV_UNDI_TBD;
264 typedef struct s_PXENV_UNDI_SET_MCAST_ADDRESS
266 pxenv_status_t Status;
267 t_PXENV_UNDI_MCAST_ADDRESS
268 R_Mcast_Buf;
269 } __packed t_PXENV_UNDI_SET_MCAST_ADDR;
271 typedef struct s_PXENV_UNDI_SET_STATION_ADDRESS
273 pxenv_status_t Status;
274 mac_addr_t StationAddress;
275 } __packed t_PXENV_UNDI_SET_STATION_ADDR;
277 typedef struct s_PXENV_UNDI_SET_PACKET_FILTER
279 pxenv_status_t Status;
280 uint8_t filter;
281 } __packed t_PXENV_UNDI_SET_PACKET_FILTER;
283 typedef struct s_PXENV_UNDI_GET_INFORMATION
285 pxenv_status_t Status;
286 uint16_t BaseIo;
287 uint16_t IntNumber;
288 uint16_t MaxTranUnit;
289 uint16_t HwType;
290 #define ETHER_TYPE 1
291 #define EXP_ETHER_TYPE 2
292 #define IEEE_TYPE 6
293 #define ARCNET_TYPE 7
294 uint16_t HwAddrLen;
295 mac_addr_t CurrentNodeAddress;
296 mac_addr_t PermNodeAddress;
297 uint16_t ROMAddress;
298 uint16_t RxBufCt;
299 uint16_t TxBufCt;
300 } __packed t_PXENV_UNDI_GET_INFORMATION;
302 typedef struct s_PXENV_UNDI_GET_STATISTICS
304 pxenv_status_t Status;
305 uint32_t XmtGoodFrames;
306 uint32_t RcvGoodFrames;
307 uint32_t RcvCRCErrors;
308 uint32_t RcvResourceErrors;
309 } __packed t_PXENV_UNDI_GET_STATISTICS;
311 typedef struct s_PXENV_UNDI_CLEAR_STATISTICS
313 pxenv_status_t Status;
314 } __packed t_PXENV_UNDI_CLEAR_STATISTICS;
316 typedef struct s_PXENV_UNDI_INITIATE_DIAGS
318 pxenv_status_t Status;
319 } __packed t_PXENV_UNDI_INITIATE_DIAGS;
321 typedef struct s_PXENV_UNDI_FORCE_INTERRUPT
323 pxenv_status_t Status;
324 } __packed t_PXENV_UNDI_FORCE_INTERRUPT;
326 typedef struct s_PXENV_UNDI_GET_MCAST_ADDRESS
328 pxenv_status_t Status;
329 in_addr_t InetAddr;
330 mac_addr_t MediaAddr;
331 } __packed t_PXENV_UNDI_GET_MCAST_ADDR;
333 typedef struct s_PXENV_UNDI_GET_NIC_TYPE
335 pxenv_status_t Status;
336 uint8_t NicType;
337 #define PCI_NIC 2
338 #define PnP_NIC 3
339 #define CardBus_NIC 4
340 union {
341 struct {
342 uint16_t Vendor_ID;
343 uint16_t Dev_ID;
344 uint8_t Base_Class;
345 uint8_t Sub_Class;
346 uint8_t Prog_Intf;
347 uint8_t Rev;
348 uint16_t BusDevFunc;
349 uint16_t SubVendor_ID;
350 uint16_t SubDevice_ID;
351 } pci, cardbus;
352 struct {
353 uint32_t EISA_Dev_ID;
354 uint8_t Base_Class;
355 uint8_t Sub_Class;
356 uint8_t Prog_Intf;
357 uint16_t CardSelNum;
358 } __packed pnp;
359 } __packed info;
360 } __packed t_PXENV_UNDI_GET_NIC_TYPE;
362 typedef struct s_PXENV_UNDI_GET_IFACE_INFO
364 pxenv_status_t Status;
365 uint8_t IfaceType[16];
366 uint32_t LinkSpeed;
367 uint32_t ServiceFlags;
368 uint32_t Reserved[4];
369 } __packed t_PXENV_UNDI_GET_NDIS_INFO;
371 typedef struct s_PXENV_UNDI_GET_STATE
373 #define PXE_UNDI_GET_STATE_STARTED 1
374 #define PXE_UNDI_GET_STATE_INITIALIZED 2
375 #define PXE_UNDI_GET_STATE_OPENED 3
376 pxenv_status_t Status;
377 uint8_t UNDIstate;
378 } __packed t_PXENV_UNDI_GET_STATE;
380 typedef struct s_PXENV_UNDI_ISR
382 pxenv_status_t Status;
383 uint16_t FuncFlag;
384 uint16_t BufferLength;
385 uint16_t FrameLength;
386 uint16_t FrameHeaderLength;
387 segoff16_t Frame;
388 uint8_t ProtType;
389 uint8_t PktType;
390 } __packed t_PXENV_UNDI_ISR;
391 #define PXENV_UNDI_ISR_IN_START 1
392 #define PXENV_UNDI_ISR_IN_PROCESS 2
393 #define PXENV_UNDI_ISR_IN_GET_NEXT 3
394 /* One of these will be returned for
395 PXENV_UNDI_ISR_IN_START */
396 #define PXENV_UNDI_ISR_OUT_OURS 0
397 #define PXENV_UNDI_USR_OUT_NOT_OURS 1
398 /* One of these will be returned for
399 PXENV_UNDI_ISR_IN_PROCESS and
400 PXENV_UNDI_ISR_IN_GET_NEXT */
401 #define PXENV_UNDI_ISR_OUT_DONE 0
402 #define PXENV_UNDI_ISR_OUT_TRANSMIT 2
403 #define PXENV_UNDI_ISR_OUT_RECEIVE 3
404 #define PXENV_UNDI_ISR_OUT_BUSY 4
406 /* Function numbers and error codes */
408 #define PXENV_TFTP_OPEN 0x0020
409 #define PXENV_TFTP_CLOSE 0x0021
410 #define PXENV_TFTP_READ 0x0022
411 #define PXENV_TFTP_READ_FILE 0x0023
412 #define PXENV_TFTP_READ_FILE_PMODE 0x0024
413 #define PXENV_TFTP_GET_FSIZE 0x0025
415 #define PXENV_UDP_OPEN 0x0030
416 #define PXENV_UDP_CLOSE 0x0031
417 #define PXENV_UDP_READ 0x0032
418 #define PXENV_UDP_WRITE 0x0033
420 #define PXENV_START_UNDI 0x0000
421 #define PXENV_UNDI_STARTUP 0x0001
422 #define PXENV_UNDI_CLEANUP 0x0002
423 #define PXENV_UNDI_INITIALIZE 0x0003
424 #define PXENV_UNDI_RESET_NIC 0x0004
425 #define PXENV_UNDI_SHUTDOWN 0x0005
426 #define PXENV_UNDI_OPEN 0x0006
427 #define PXENV_UNDI_CLOSE 0x0007
428 #define PXENV_UNDI_TRANSMIT 0x0008
429 #define PXENV_UNDI_SET_MCAST_ADDR 0x0009
430 #define PXENV_UNDI_SET_STATION_ADDR 0x000A
431 #define PXENV_UNDI_SET_PACKET_FILTER 0x000B
432 #define PXENV_UNDI_GET_INFORMATION 0x000C
433 #define PXENV_UNDI_GET_STATISTICS 0x000D
434 #define PXENV_UNDI_CLEAR_STATISTICS 0x000E
435 #define PXENV_UNDI_INITIATE_DIAGS 0x000F
436 #define PXENV_UNDI_FORCE_INTERRUPT 0x0010
437 #define PXENV_UNDI_GET_MCAST_ADDR 0x0011
438 #define PXENV_UNDI_GET_NIC_TYPE 0x0012
439 #define PXENV_UNDI_GET_IFACE_INFO 0x0013
440 #define PXENV_UNDI_ISR 0x0014
441 #define PXENV_STOP_UNDI 0x0015 /* Overlap...? */
442 #define PXENV_UNDI_GET_STATE 0x0015 /* Overlap...? */
444 #define PXENV_UNLOAD_STACK 0x0070
445 #define PXENV_GET_CACHED_INFO 0x0071
446 #define PXENV_RESTART_DHCP 0x0072
447 #define PXENV_RESTART_TFTP 0x0073
448 #define PXENV_MODE_SWITCH 0x0074
449 #define PXENV_START_BASE 0x0075
450 #define PXENV_STOP_BASE 0x0076
452 #define PXENV_EXIT_SUCCESS 0x0000
453 #define PXENV_EXIT_FAILURE 0x0001
455 #define PXENV_STATUS_SUCCESS 0x00
456 #define PXENV_STATUS_FAILURE 0x01
457 #define PXENV_STATUS_BAD_FUNC 0x02
458 #define PXENV_STATUS_UNSUPPORTED 0x03
459 #define PXENV_STATUS_KEEP_UNDI 0x04
460 #define PXENV_STATUS_KEEP_ALL 0x05
461 #define PXENV_STATUS_OUT_OF_RESOURCES 0x06
462 #define PXENV_STATUS_ARP_TIMEOUT 0x11
463 #define PXENV_STATUS_UDP_CLOSED 0x18
464 #define PXENV_STATUS_UDP_OPEN 0x19
465 #define PXENV_STATUS_TFTP_CLOSED 0x1A
466 #define PXENV_STATUS_TFTP_OPEN 0x1B
467 #define PXENV_STATUS_MCOPY_PROBLEM 0x20
468 #define PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x21
469 #define PXENV_STATUS_BIS_VALIDATE_FAILURE 0x22
470 #define PXENV_STATUS_BIS_INIT_FAILURE 0x23
471 #define PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x24
472 #define PXENV_STATUS_BIS_GBOA_FAILURE 0x25
473 #define PXENV_STATUS_BIS_FREE_FAILURE 0x26
474 #define PXENV_STATUS_BIS_GSI_FAILURE 0x27
475 #define PXENV_STATUS_BIS_BAD_CKSUM 0x28
476 #define PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x30
477 #define PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x32
479 #define PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x33
480 #define PXENV_STATUS_TFTP_READ_TIMEOUT 0x35
481 #define PXENV_STATUS_TFTP_ERROR_OPCODE 0x36
482 #define PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x38
483 #define PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x39
484 #define PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x3A
485 #define PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x3B
486 #define PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x3C
487 #define PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x3D
488 #define PXENV_STATUS_TFTP_NO_FILESIZE 0x3E
489 #define PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x3F
490 #define PXENV_STATUS_DHCP_TIMEOUT 0x51
491 #define PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x52
492 #define PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x53
493 #define PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x54
494 #define PXENV_STATUS_UNDI_INVALID_FUNCTION 0x60
495 #define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x61
496 #define PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x62
497 #define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x63
498 #define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x64
499 #define PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x65
500 #define PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x66
501 #define PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x67
502 #define PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x68
503 #define PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x69
504 #define PXENV_STATUS_UNDI_INVALID_STATE 0x6A
505 #define PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x6B
506 #define PXENV_STATUS_UNDI_INVALID_PARAMETER 0x6C
507 #define PXENV_STATUS_BSTRAP_PROMPT_MENU 0x74
508 #define PXENV_STATUS_BSTRAP_MCAST_ADDR 0x76
509 #define PXENV_STATUS_BSTRAP_MISSING_LIST 0x77
510 #define PXENV_STATUS_BSTRAP_NO_RESPONSE 0x78
511 #define PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x79
512 #define PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0xA0
513 #define PXENV_STATUS_BINL_NO_PXE_SERVER 0xA1
514 #define PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0xA2
515 #define PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0xA3
516 #define PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0xB0
517 #define PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0xC0
518 #define PXENV_STATUS_LOADER_NO_BC_ROMID 0xC1
519 #define PXENV_STATUS_LOADER_BAD_BC_ROMID 0xC2
520 #define PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0xC3
521 #define PXENV_STATUS_LOADER_NO_UNDI_ROMID 0xC4
522 #define PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0xC5
523 #define PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0xC6
524 #define PXENV_STATUS_LOADER_NO_PXE_STRUCT 0xC8
525 #define PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0xC9
526 #define PXENV_STATUS_LOADER_UNDI_START 0xCA
527 #define PXENV_STATUS_LOADER_BC_START 0xCB
529 /* SYSLINUX-defined PXE utility functions */
530 int pxe_get_cached_info(int level, void **buf, size_t *len);
532 #endif /* _SYSLINUX_PXE_H */