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
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 * ----------------------------------------------------------------------- */
31 * PXE type and constant definitions for SYSLINUX
34 #ifndef _SYSLINUX_PXE_API_H
35 #define _SYSLINUX_PXE_API_H
38 #include <netinet/in.h>
39 #include <klibc/compiler.h>
42 /* PXE spec structures and definitions. These mostly follow the PXE
43 spec, except when the PXE spec is unnecessarily stupid. Of course,
44 that is most of the time. */
46 /* Basic types; use Unix-like _t convention instead of SCREAMING; also
47 re-use types we already have, like in_addr_t. */
49 typedef uint16_t pxenv_status_t
;
51 #define MAC_ADDR_LEN 16
52 typedef uint8_t mac_addr_t
[MAC_ADDR_LEN
];
54 /* "Protected mode segment descriptor" according to PXE... */
59 } __packed pxe_segdesc_t
;
61 typedef far_ptr_t segoff16_t
;
73 #define BOOTP_BCAST 0x8000
74 in_addr_t cip
; /* Client IP address */
75 in_addr_t yip
; /* You IP address */
76 in_addr_t sip
; /* next server IP address */
77 in_addr_t gip
; /*relay agent IP address */
80 uint8_t bootfile
[128];
82 #define BOOTP_DHCPVEND 1024
83 uint8_t d
[BOOTP_DHCPVEND
];
86 #define VM_RFC1048 0x63825363L
91 } __packed pxe_bootp_t
;
93 /* Function calling structures and constants */
95 typedef struct s_PXENV_GET_CACHED_INFO
{
96 pxenv_status_t Status
;
98 #define PXENV_PACKET_TYPE_DHCP_DISCOVER 1
99 #define PXENV_PACKET_TYPE_DHCP_ACK 2
100 #define PXENV_PACKET_TYPE_CACHED_REPLY 3
103 uint16_t BufferLimit
;
104 } __packed t_PXENV_GET_CACHED_INFO
;
106 typedef struct s_PXENV_START_UNDI
{
107 pxenv_status_t Status
;
113 } __packed t_PXENV_START_UNDI
;
115 typedef struct s_PXENV_STOP_UNDI
{
116 pxenv_status_t Status
;
117 } __packed t_PXENV_STOP_UNDI
;
119 typedef struct s_PXENV_START_BASE
{
120 pxenv_status_t Status
;
121 } __packed t_PXENV_START_BASE
;
123 typedef struct s_PXENV_STOP_BASE
{
124 pxenv_status_t Status
;
125 } __packed t_PXENV_STOP_BASE
;
127 typedef struct s_PXENV_TFTP_OPEN
{
128 pxenv_status_t Status
;
129 in_addr_t ServerIPAddress
;
130 in_addr_t GatewayIPAddress
;
131 uint8_t FileName
[128];
134 } __packed t_PXENV_TFTP_OPEN
;
136 typedef struct s_PXENV_TFTP_CLOSE
{
137 pxenv_status_t Status
;
138 } __packed t_PXENV_TFTP_CLOSE
;
140 typedef struct s_PXENV_TFTP_READ
{
141 pxenv_status_t Status
;
142 uint16_t PacketNumber
;
145 } __packed t_PXENV_TFTP_READ
;
147 typedef struct s_PXENV_TFTP_READ_FILE
{
148 pxenv_status_t Status
;
149 uint8_t FileName
[128];
152 in_addr_t ServerIPAddress
;
153 in_addr_t GatewayIPAddress
;
154 in_addr_t McastIPAddress
;
155 in_port_t TFTPClntPort
;
156 in_port_t TFTPSrvPort
;
157 uint16_t TFTPOpenTimeOut
;
158 uint16_t TFTPReopenDelay
;
159 } __packed t_PXENV_TFTP_READ_FILE
;
161 typedef struct s_PXENV_TFTP_GET_FSIZE
{
162 pxenv_status_t Status
;
163 in_addr_t ServerIPAddress
;
164 in_addr_t GatewayIPAddress
;
165 uint8_t FileName
[128];
167 } __packed t_PXENV_TFTP_GET_FSIZE
;
169 typedef struct s_PXENV_UDP_OPEN
{
170 pxenv_status_t status
;
172 } __packed t_PXENV_UDP_OPEN
;
174 typedef struct s_PXENV_UDP_CLOSE
{
175 pxenv_status_t status
;
176 } __packed t_PXENV_UDP_CLOSE
;
178 typedef struct s_PXENV_UDP_WRITE
{
179 pxenv_status_t status
;
184 uint16_t buffer_size
;
186 } __packed t_PXENV_UDP_WRITE
;
188 typedef struct s_PXENV_UDP_READ
{
189 pxenv_status_t status
;
194 uint16_t buffer_size
;
196 } __packed t_PXENV_UDP_READ
;
198 typedef struct s_PXENV_UNDI_STARTUP
{
199 pxenv_status_t Status
;
200 } __packed t_PXENV_UNDI_STARTUP
;
202 typedef struct s_PXENV_UNDI_CLEANUP
{
203 pxenv_status_t Status
;
204 } __packed t_PXENV_UNDI_CLEANUP
;
206 typedef struct s_PXENV_UNDI_INITIALIZE
{
207 pxenv_status_t Status
;
210 } __packed t_PXENV_UNDI_INITIALIZE
;
212 #define MAXNUM_MCADDR 8
213 typedef struct s_PXENV_UNDI_MCAST_ADDRESS
{
214 uint16_t MCastAddrCount
;
215 mac_addr_t McastAddr
[MAXNUM_MCADDR
];
216 } __packed t_PXENV_UNDI_MCAST_ADDRESS
;
218 typedef struct s_PXENV_UNDI_RESET
{
219 pxenv_status_t Status
;
220 t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf
;
221 } __packed t_PXENV_UNDI_RESET
;
223 typedef struct s_PXENV_UNDI_SHUTDOWN
{
224 pxenv_status_t Status
;
225 } __packed t_PXENV_UNDI_SHUTDOWN
;
227 typedef struct s_PXENV_UNDI_OPEN
{
228 pxenv_status_t Status
;
231 #define FLTR_DIRECTED 0x0001
232 #define FLTR_BRDCST 0x0002
233 #define FLTR_PRMSCS 0x0004
234 #define FLTR_SRC_RTG 0x0008
235 t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf
;
236 } __packed t_PXENV_UNDI_OPEN
;
238 typedef struct s_PXENV_UNDI_CLOSE
{
239 pxenv_status_t Status
;
240 } __packed t_PXENV_UNDI_CLOSE
;
242 typedef struct s_PXENV_UNDI_TRANSMIT
{
243 pxenv_status_t Status
;
250 #define XMT_DESTADDR 0x0000
251 #define XMT_BROADCAST 0x0001
254 uint32_t Reserved
[2];
255 } __packed t_PXENV_UNDI_TRANSMIT
;
256 #define MAX_DATA_BLKS 8
257 typedef struct s_PXENV_UNDI_TBD
{
258 uint16_t ImmedLength
;
260 uint16_t DataBlkCount
;
265 segoff16_t TDDataPtr
;
266 } DataBlock
[MAX_DATA_BLKS
];
267 } __packed t_PXENV_UNDI_TBD
;
269 typedef struct s_PXENV_UNDI_SET_MCAST_ADDRESS
{
270 pxenv_status_t Status
;
271 t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf
;
272 } __packed t_PXENV_UNDI_SET_MCAST_ADDR
;
274 typedef struct s_PXENV_UNDI_SET_STATION_ADDRESS
{
275 pxenv_status_t Status
;
276 mac_addr_t StationAddress
;
277 } __packed t_PXENV_UNDI_SET_STATION_ADDR
;
279 typedef struct s_PXENV_UNDI_SET_PACKET_FILTER
{
280 pxenv_status_t Status
;
282 } __packed t_PXENV_UNDI_SET_PACKET_FILTER
;
284 typedef struct s_PXENV_UNDI_GET_INFORMATION
{
285 pxenv_status_t Status
;
288 uint16_t MaxTranUnit
;
291 #define EXP_ETHER_TYPE 2
293 #define ARCNET_TYPE 7
295 mac_addr_t CurrentNodeAddress
;
296 mac_addr_t PermNodeAddress
;
300 } __packed t_PXENV_UNDI_GET_INFORMATION
;
302 typedef struct s_PXENV_UNDI_GET_STATISTICS
{
303 pxenv_status_t Status
;
304 uint32_t XmtGoodFrames
;
305 uint32_t RcvGoodFrames
;
306 uint32_t RcvCRCErrors
;
307 uint32_t RcvResourceErrors
;
308 } __packed t_PXENV_UNDI_GET_STATISTICS
;
310 typedef struct s_PXENV_UNDI_CLEAR_STATISTICS
{
311 pxenv_status_t Status
;
312 } __packed t_PXENV_UNDI_CLEAR_STATISTICS
;
314 typedef struct s_PXENV_UNDI_INITIATE_DIAGS
{
315 pxenv_status_t Status
;
316 } __packed t_PXENV_UNDI_INITIATE_DIAGS
;
318 typedef struct s_PXENV_UNDI_FORCE_INTERRUPT
{
319 pxenv_status_t Status
;
320 } __packed t_PXENV_UNDI_FORCE_INTERRUPT
;
322 typedef struct s_PXENV_UNDI_GET_MCAST_ADDRESS
{
323 pxenv_status_t Status
;
325 mac_addr_t MediaAddr
;
326 } __packed t_PXENV_UNDI_GET_MCAST_ADDR
;
328 typedef struct s_PXENV_UNDI_GET_NIC_TYPE
{
329 pxenv_status_t Status
;
333 #define CardBus_NIC 4
343 uint16_t SubVendor_ID
;
344 uint16_t SubDevice_ID
;
347 uint32_t EISA_Dev_ID
;
354 } __packed t_PXENV_UNDI_GET_NIC_TYPE
;
356 typedef struct s_PXENV_UNDI_GET_IFACE_INFO
{
357 pxenv_status_t Status
;
358 uint8_t IfaceType
[16];
360 uint32_t ServiceFlags
;
361 uint32_t Reserved
[4];
362 } __packed t_PXENV_UNDI_GET_NDIS_INFO
;
364 typedef struct s_PXENV_UNDI_GET_STATE
{
365 #define PXE_UNDI_GET_STATE_STARTED 1
366 #define PXE_UNDI_GET_STATE_INITIALIZED 2
367 #define PXE_UNDI_GET_STATE_OPENED 3
368 pxenv_status_t Status
;
370 } __packed t_PXENV_UNDI_GET_STATE
;
372 typedef struct s_PXENV_UNDI_ISR
{
373 pxenv_status_t Status
;
375 uint16_t BufferLength
;
376 uint16_t FrameLength
;
377 uint16_t FrameHeaderLength
;
381 } __packed t_PXENV_UNDI_ISR
;
383 typedef struct s_PXENV_FILE_API_CHECK
{
384 pxenv_status_t Status
;
390 } __packed t_PXENV_FILE_API_CHECK
;
392 typedef struct s_PXENV_FILE_READ
{
393 pxenv_status_t Status
;
397 } __packed t_PXENV_FILE_READ
;
399 typedef struct s_PXENV_FILE_OPEN
{
400 pxenv_status_t Status
;
404 } __packed t_PXENV_FILE_OPEN
;
406 typedef struct s_PXENV_FILE_CLOSE
{
407 pxenv_status_t Status
;
409 } __packed t_PXENV_FILE_CLOSE
;
411 typedef struct s_PXENV_GET_FILE_SIZE
{
412 pxenv_status_t Status
;
415 } __packed t_PXENV_GET_FILE_SIZE
;
417 typedef struct s_PXENV_UNLOAD_STACK
{
418 pxenv_status_t Status
;
419 uint8_t reserved
[10];
420 } __packed t_PXENV_UNLOAD_STACK
;
422 #define PXENV_UNDI_ISR_IN_START 1
423 #define PXENV_UNDI_ISR_IN_PROCESS 2
424 #define PXENV_UNDI_ISR_IN_GET_NEXT 3
425 /* One of these will be returned for
426 PXENV_UNDI_ISR_IN_START */
427 #define PXENV_UNDI_ISR_OUT_OURS 0
428 #define PXENV_UNDI_USR_OUT_NOT_OURS 1
429 /* One of these will be returned for
430 PXENV_UNDI_ISR_IN_PROCESS and
431 PXENV_UNDI_ISR_IN_GET_NEXT */
432 #define PXENV_UNDI_ISR_OUT_DONE 0
433 #define PXENV_UNDI_ISR_OUT_TRANSMIT 2
434 #define PXENV_UNDI_ISR_OUT_RECEIVE 3
435 #define PXENV_UNDI_ISR_OUT_BUSY 4
437 /* Function numbers and error codes */
439 #define PXENV_TFTP_OPEN 0x0020
440 #define PXENV_TFTP_CLOSE 0x0021
441 #define PXENV_TFTP_READ 0x0022
442 #define PXENV_TFTP_READ_FILE 0x0023
443 #define PXENV_TFTP_READ_FILE_PMODE 0x0024
444 #define PXENV_TFTP_GET_FSIZE 0x0025
446 #define PXENV_UDP_OPEN 0x0030
447 #define PXENV_UDP_CLOSE 0x0031
448 #define PXENV_UDP_READ 0x0032
449 #define PXENV_UDP_WRITE 0x0033
451 #define PXENV_START_UNDI 0x0000
452 #define PXENV_UNDI_STARTUP 0x0001
453 #define PXENV_UNDI_CLEANUP 0x0002
454 #define PXENV_UNDI_INITIALIZE 0x0003
455 #define PXENV_UNDI_RESET_NIC 0x0004
456 #define PXENV_UNDI_SHUTDOWN 0x0005
457 #define PXENV_UNDI_OPEN 0x0006
458 #define PXENV_UNDI_CLOSE 0x0007
459 #define PXENV_UNDI_TRANSMIT 0x0008
460 #define PXENV_UNDI_SET_MCAST_ADDR 0x0009
461 #define PXENV_UNDI_SET_STATION_ADDR 0x000A
462 #define PXENV_UNDI_SET_PACKET_FILTER 0x000B
463 #define PXENV_UNDI_GET_INFORMATION 0x000C
464 #define PXENV_UNDI_GET_STATISTICS 0x000D
465 #define PXENV_UNDI_CLEAR_STATISTICS 0x000E
466 #define PXENV_UNDI_INITIATE_DIAGS 0x000F
467 #define PXENV_UNDI_FORCE_INTERRUPT 0x0010
468 #define PXENV_UNDI_GET_MCAST_ADDR 0x0011
469 #define PXENV_UNDI_GET_NIC_TYPE 0x0012
470 #define PXENV_UNDI_GET_IFACE_INFO 0x0013
471 #define PXENV_UNDI_ISR 0x0014
472 #define PXENV_STOP_UNDI 0x0015 /* Overlap...? */
473 #define PXENV_UNDI_GET_STATE 0x0015 /* Overlap...? */
475 #define PXENV_UNLOAD_STACK 0x0070
476 #define PXENV_GET_CACHED_INFO 0x0071
477 #define PXENV_RESTART_DHCP 0x0072
478 #define PXENV_RESTART_TFTP 0x0073
479 #define PXENV_MODE_SWITCH 0x0074
480 #define PXENV_START_BASE 0x0075
481 #define PXENV_STOP_BASE 0x0076
483 /* gPXE extensions... */
484 #define PXENV_FILE_OPEN 0x00e0
485 #define PXENV_FILE_CLOSE 0x00e1
486 #define PXENV_FILE_SELECT 0x00e2
487 #define PXENV_FILE_READ 0x00e3
488 #define PXENV_GET_FILE_SIZE 0x00e4
489 #define PXENV_FILE_EXEC 0x00e5
490 #define PXENV_FILE_API_CHECK 0x00e6
493 #define PXENV_EXIT_SUCCESS 0x0000
494 #define PXENV_EXIT_FAILURE 0x0001
497 #define PXENV_STATUS_SUCCESS 0x00
498 #define PXENV_STATUS_FAILURE 0x01
499 #define PXENV_STATUS_BAD_FUNC 0x02
500 #define PXENV_STATUS_UNSUPPORTED 0x03
501 #define PXENV_STATUS_KEEP_UNDI 0x04
502 #define PXENV_STATUS_KEEP_ALL 0x05
503 #define PXENV_STATUS_OUT_OF_RESOURCES 0x06
504 #define PXENV_STATUS_ARP_TIMEOUT 0x11
505 #define PXENV_STATUS_UDP_CLOSED 0x18
506 #define PXENV_STATUS_UDP_OPEN 0x19
507 #define PXENV_STATUS_TFTP_CLOSED 0x1a
508 #define PXENV_STATUS_TFTP_OPEN 0x1b
509 #define PXENV_STATUS_MCOPY_PROBLEM 0x20
510 #define PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x21
511 #define PXENV_STATUS_BIS_VALIDATE_FAILURE 0x22
512 #define PXENV_STATUS_BIS_INIT_FAILURE 0x23
513 #define PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x24
514 #define PXENV_STATUS_BIS_GBOA_FAILURE 0x25
515 #define PXENV_STATUS_BIS_FREE_FAILURE 0x26
516 #define PXENV_STATUS_BIS_GSI_FAILURE 0x27
517 #define PXENV_STATUS_BIS_BAD_CKSUM 0x28
518 #define PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x30
519 #define PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x32
521 #define PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x33
522 #define PXENV_STATUS_TFTP_READ_TIMEOUT 0x35
523 #define PXENV_STATUS_TFTP_ERROR_OPCODE 0x36
524 #define PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x38
525 #define PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x39
526 #define PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x3a
527 #define PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x3b
528 #define PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x3c
529 #define PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x3d
530 #define PXENV_STATUS_TFTP_NO_FILESIZE 0x3e
531 #define PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x3f
532 #define PXENV_STATUS_DHCP_TIMEOUT 0x51
533 #define PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x52
534 #define PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x53
535 #define PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x54
536 #define PXENV_STATUS_UNDI_INVALID_FUNCTION 0x60
537 #define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x61
538 #define PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x62
539 #define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x63
540 #define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x64
541 #define PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x65
542 #define PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x66
543 #define PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x67
544 #define PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x68
545 #define PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x69
546 #define PXENV_STATUS_UNDI_INVALID_STATE 0x6a
547 #define PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x6b
548 #define PXENV_STATUS_UNDI_INVALID_PARAMETER 0x6c
549 #define PXENV_STATUS_BSTRAP_PROMPT_MENU 0x74
550 #define PXENV_STATUS_BSTRAP_MCAST_ADDR 0x76
551 #define PXENV_STATUS_BSTRAP_MISSING_LIST 0x77
552 #define PXENV_STATUS_BSTRAP_NO_RESPONSE 0x78
553 #define PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x79
554 #define PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0xa0
555 #define PXENV_STATUS_BINL_NO_PXE_SERVER 0xa1
556 #define PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0xa2
557 #define PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0xa3
558 #define PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0xb0
559 #define PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0xc0
560 #define PXENV_STATUS_LOADER_NO_BC_ROMID 0xc1
561 #define PXENV_STATUS_LOADER_BAD_BC_ROMID 0xc2
562 #define PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0xc3
563 #define PXENV_STATUS_LOADER_NO_UNDI_ROMID 0xc4
564 #define PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0xc5
565 #define PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0xc6
566 #define PXENV_STATUS_LOADER_NO_PXE_STRUCT 0xc8
567 #define PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0xc9
568 #define PXENV_STATUS_LOADER_UNDI_START 0xca
569 #define PXENV_STATUS_LOADER_BC_START 0xcb
571 #endif /* _SYSLINUX_PXE_API_H */