1 1.9 andvar /* $NetBSD: pxe.h,v 1.9 2025/07/09 21:25:35 andvar Exp $ */ 2 1.1 thorpej 3 1.1 thorpej /* 4 1.1 thorpej * Copyright (c) 2000 Alfred Perlstein <alfred (at) freebsd.org> 5 1.1 thorpej * All rights reserved. 6 1.1 thorpej * Copyright (c) 2000 Paul Saab <ps (at) freebsd.org> 7 1.1 thorpej * All rights reserved. 8 1.1 thorpej * Copyright (c) 2000 John Baldwin <jhb (at) freebsd.org> 9 1.1 thorpej * All rights reserved. 10 1.1 thorpej * 11 1.1 thorpej * Redistribution and use in source and binary forms, with or without 12 1.1 thorpej * modification, are permitted provided that the following conditions 13 1.1 thorpej * are met: 14 1.1 thorpej * 1. Redistributions of source code must retain the above copyright 15 1.1 thorpej * notice, this list of conditions and the following disclaimer. 16 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright 17 1.1 thorpej * notice, this list of conditions and the following disclaimer in the 18 1.1 thorpej * documentation and/or other materials provided with the distribution. 19 1.1 thorpej * 20 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 21 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 1.1 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 1.1 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 24 1.1 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 1.1 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 1.1 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 1.1 thorpej * SUCH DAMAGE. 31 1.1 thorpej */ 32 1.1 thorpej 33 1.1 thorpej /* 34 1.1 thorpej * Note that these structures and types are named according to 35 1.1 thorpej * the Intel PXE documentation. 36 1.1 thorpej */ 37 1.1 thorpej 38 1.3 tron #define MEMSTRCMP(p, s) memcmp((p), (s), sizeof(s) - 1) 39 1.1 thorpej 40 1.1 thorpej #define IP_STR "%d.%d.%d.%d" 41 1.1 thorpej #define IP_ARGS(ip) \ 42 1.1 thorpej (int)(ip >> 24) & 0xff, (int)(ip >> 16) & 0xff, \ 43 1.1 thorpej (int)(ip >> 8) & 0xff, (int)ip & 0xff 44 1.1 thorpej 45 1.1 thorpej #define MAC_STR "%02x:%02x:%02x:%02x:%02x:%02x" 46 1.1 thorpej #define MAC_ARGS(mac) \ 47 1.1 thorpej mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] 48 1.1 thorpej 49 1.1 thorpej typedef struct { 50 1.1 thorpej uint16_t offset; 51 1.1 thorpej uint16_t segment; 52 1.6 jakllsch } __packed SEGOFF16_t; 53 1.1 thorpej 54 1.1 thorpej typedef struct { 55 1.1 thorpej uint16_t Seg_Addr; 56 1.1 thorpej uint32_t Phy_Addr; 57 1.1 thorpej uint16_t Seg_Size; 58 1.6 jakllsch } __packed SEGDESC_t; 59 1.1 thorpej 60 1.1 thorpej typedef uint16_t SEGSEL_t; 61 1.1 thorpej typedef uint16_t PXENV_STATUS_t; 62 1.1 thorpej typedef uint32_t IP4_t; 63 1.1 thorpej typedef uint32_t ADDR32_t; 64 1.1 thorpej typedef uint16_t UDP_PORT_t; 65 1.1 thorpej 66 1.1 thorpej #define MAC_ADDR_LEN 16 67 1.1 thorpej typedef uint8_t MAC_ADDR[MAC_ADDR_LEN]; 68 1.1 thorpej 69 1.1 thorpej /* PXENV+ */ 70 1.1 thorpej typedef struct { 71 1.1 thorpej uint8_t Signature[6]; /* 'PXENV+' */ 72 1.1 thorpej uint16_t Version; /* MSB = major, LSB = minor */ 73 1.1 thorpej uint8_t Length; /* structure length */ 74 1.1 thorpej uint8_t Checksum; /* checksum pad */ 75 1.1 thorpej SEGOFF16_t RMEntry; /* SEG:OFF to PXE entry point */ 76 1.1 thorpej /* don't use PMOffset and PMSelector (from the 2.1 PXE manual) */ 77 1.1 thorpej uint32_t PMOffset; /* Protected mode entry */ 78 1.1 thorpej SEGSEL_t PMSelector; /* Protected mode selector */ 79 1.1 thorpej SEGSEL_t StackSeg; /* Stack segment address */ 80 1.1 thorpej uint16_t StackSize; /* Stack segment size (bytes) */ 81 1.1 thorpej SEGSEL_t BC_CodeSeg; /* BC Code segment address */ 82 1.1 thorpej uint16_t BC_CodeSize; /* BC Code segment size (bytes) */ 83 1.1 thorpej SEGSEL_t BC_DataSeg; /* BC Data segment address */ 84 1.1 thorpej uint16_t BC_DataSize; /* BC Data segment size (bytes) */ 85 1.1 thorpej SEGSEL_t UNDIDataSeg; /* UNDI Data segment address */ 86 1.1 thorpej uint16_t UNDIDataSize; /* UNDI Data segment size (bytes) */ 87 1.1 thorpej SEGSEL_t UNDICodeSeg; /* UNDI Code segment address */ 88 1.1 thorpej uint16_t UNDICodeSize; /* UNDI Code segment size (bytes) */ 89 1.1 thorpej SEGOFF16_t PXEPtr; /* SEG:OFF to !PXE struct, 90 1.1 thorpej only present when Version > 2.1 */ 91 1.5 perry } __packed pxenv_t; 92 1.1 thorpej 93 1.1 thorpej /* !PXE */ 94 1.1 thorpej typedef struct { 95 1.1 thorpej uint8_t Signature[4]; 96 1.1 thorpej uint8_t StructLength; 97 1.1 thorpej uint8_t StructCksum; 98 1.1 thorpej uint8_t StructRev; 99 1.1 thorpej uint8_t reserved_1; 100 1.1 thorpej SEGOFF16_t UNDIROMID; 101 1.1 thorpej SEGOFF16_t BaseROMID; 102 1.1 thorpej SEGOFF16_t EntryPointSP; 103 1.1 thorpej SEGOFF16_t EntryPointESP; 104 1.1 thorpej SEGOFF16_t StatusCallout; 105 1.1 thorpej uint8_t reserved_2; 106 1.1 thorpej uint8_t SegDescCn; 107 1.1 thorpej SEGSEL_t FirstSelector; 108 1.1 thorpej SEGDESC_t Stack; 109 1.1 thorpej SEGDESC_t UNDIData; 110 1.1 thorpej SEGDESC_t UNDICode; 111 1.1 thorpej SEGDESC_t UNDICodeWrite; 112 1.1 thorpej SEGDESC_t BC_Data; 113 1.1 thorpej SEGDESC_t BC_Code; 114 1.1 thorpej SEGDESC_t BC_CodeWrite; 115 1.5 perry } __packed pxe_t; 116 1.1 thorpej 117 1.1 thorpej #define PXENV_START_UNDI 0x0000 118 1.1 thorpej typedef struct { 119 1.1 thorpej PXENV_STATUS_t Status; 120 1.1 thorpej uint16_t ax; 121 1.1 thorpej uint16_t bx; 122 1.1 thorpej uint16_t dx; 123 1.1 thorpej uint16_t di; 124 1.1 thorpej uint16_t es; 125 1.5 perry } __packed t_PXENV_START_UNDI; 126 1.1 thorpej 127 1.1 thorpej #define PXENV_UNDI_STARTUP 0x0001 128 1.1 thorpej typedef struct { 129 1.1 thorpej PXENV_STATUS_t Status; 130 1.5 perry } __packed t_PXENV_UNDI_STARTUP; 131 1.1 thorpej 132 1.1 thorpej #define PXENV_UNDI_CLEANUP 0x0002 133 1.1 thorpej typedef struct { 134 1.1 thorpej PXENV_STATUS_t Status; 135 1.5 perry } __packed t_PXENV_UNDI_CLEANUP; 136 1.1 thorpej 137 1.1 thorpej #define PXENV_UNDI_INITIALIZE 0x0003 138 1.1 thorpej typedef struct { 139 1.1 thorpej PXENV_STATUS_t Status; 140 1.1 thorpej ADDR32_t ProtocolIni; /* Phys addr of a copy of the 141 1.1 thorpej driver module */ 142 1.1 thorpej uint8_t reserved[8]; 143 1.8 msaitoh } __packed t_PXENV_UNDI_INITIALIZE; 144 1.1 thorpej 145 1.1 thorpej 146 1.1 thorpej #define MAXNUM_MCADDR 8 147 1.1 thorpej typedef struct { 148 1.1 thorpej PXENV_STATUS_t Status; 149 1.1 thorpej uint16_t MCastAddrCount; 150 1.1 thorpej MAC_ADDR McastAddr[MAXNUM_MCADDR]; 151 1.5 perry } __packed t_PXENV_UNDI_MCAST_ADDRESS; 152 1.1 thorpej 153 1.1 thorpej #define PXENV_UNDI_RESET_ADAPTER 0x0004 154 1.1 thorpej typedef struct { 155 1.1 thorpej PXENV_STATUS_t Status; 156 1.1 thorpej t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; 157 1.5 perry } __packed t_PXENV_UNDI_RESET; 158 1.1 thorpej 159 1.1 thorpej #define PXENV_UNDI_SHUTDOWN 0x0005 160 1.1 thorpej typedef struct { 161 1.1 thorpej PXENV_STATUS_t Status; 162 1.5 perry } __packed t_PXENV_UNDI_SHUTDOWN; 163 1.1 thorpej 164 1.1 thorpej #define PXENV_UNDI_OPEN 0x0006 165 1.1 thorpej typedef struct { 166 1.1 thorpej PXENV_STATUS_t Status; 167 1.1 thorpej uint16_t OpenFlag; 168 1.1 thorpej uint16_t PktFilter; 169 1.1 thorpej # define FLTR_DIRECTED 0x0001 170 1.1 thorpej # define FLTR_BRDCST 0x0002 171 1.1 thorpej # define FLTR_PRMSCS 0x0003 172 1.1 thorpej # define FLTR_SRC_RTG 0x0004 173 1.1 thorpej 174 1.1 thorpej t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; 175 1.5 perry } __packed t_PXENV_UNDI_OPEN; 176 1.1 thorpej 177 1.1 thorpej #define PXENV_UNDI_CLOSE 0x0007 178 1.1 thorpej typedef struct { 179 1.1 thorpej PXENV_STATUS_t Status; 180 1.5 perry } __packed t_PXENV_UNDI_CLOSE; 181 1.1 thorpej 182 1.1 thorpej #define PXENV_UNDI_TRANSMIT 0x0008 183 1.1 thorpej typedef struct { 184 1.1 thorpej PXENV_STATUS_t Status; 185 1.1 thorpej uint8_t Protocol; 186 1.1 thorpej # define P_UNKNOWN 0 187 1.1 thorpej # define P_IP 1 188 1.1 thorpej # define P_ARP 2 189 1.1 thorpej # define P_RARP 3 190 1.1 thorpej 191 1.1 thorpej uint8_t XmitFlag; 192 1.1 thorpej # define XMT_DESTADDR 0x0000 193 1.1 thorpej # define XMT_BROADCAST 0x0001 194 1.1 thorpej 195 1.1 thorpej SEGOFF16_t DestAddr; 196 1.1 thorpej SEGOFF16_t TBD; 197 1.1 thorpej uint32_t Reserved[2]; 198 1.5 perry } __packed t_PXENV_UNDI_TRANSMIT; 199 1.1 thorpej 200 1.1 thorpej #define MAX_DATA_BLKS 8 201 1.1 thorpej typedef struct { 202 1.1 thorpej uint16_t ImmedLength; 203 1.1 thorpej SEGOFF16_t Xmit; 204 1.1 thorpej uint16_t DataBlkCount; 205 1.1 thorpej struct DataBlk { 206 1.1 thorpej uint8_t TDPtrType; 207 1.1 thorpej uint8_t TDRsvdByte; 208 1.1 thorpej uint16_t TDDataLen; 209 1.1 thorpej SEGOFF16_t TDDataPtr; 210 1.1 thorpej } DataBlock[MAX_DATA_BLKS]; 211 1.5 perry } __packed t_PXENV_UNDI_TBD; 212 1.1 thorpej 213 1.1 thorpej #define PXENV_UNDI_SET_MCAST_ADDRESS 0x0009 214 1.1 thorpej typedef struct { 215 1.1 thorpej PXENV_STATUS_t Status; 216 1.1 thorpej t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf; 217 1.5 perry } __packed t_PXENV_UNDI_SET_MCAST_ADDR; 218 1.1 thorpej 219 1.1 thorpej #define PXENV_UNDI_SET_STATION_ADDRESS 0x000A 220 1.1 thorpej typedef struct { 221 1.1 thorpej PXENV_STATUS_t Status; 222 1.8 msaitoh MAC_ADDR StationAddress; /* Temp MAC address to use */ 223 1.5 perry } __packed t_PXENV_UNDI_SET_STATION_ADDR; 224 1.1 thorpej 225 1.1 thorpej #define PXENV_UNDI_SET_PACKET_FILTER 0x000B 226 1.1 thorpej typedef struct { 227 1.1 thorpej PXENV_STATUS_t Status; 228 1.1 thorpej uint8_t filter; /* see UNDI_OPEN (0x0006) */ 229 1.5 perry } __packed t_PXENV_UNDI_SET_PACKET_FILTER; 230 1.1 thorpej 231 1.1 thorpej #define PXENV_UNDI_GET_INFORMATION 0x000C 232 1.1 thorpej typedef struct { 233 1.1 thorpej PXENV_STATUS_t Status; 234 1.1 thorpej uint16_t BaseIo; /* Adapter base I/O address */ 235 1.1 thorpej uint16_t IntNumber; /* Adapter IRQ number */ 236 1.1 thorpej uint16_t MaxTranUnit; /* Adapter maximum transmit 237 1.1 thorpej unit */ 238 1.1 thorpej uint16_t HwType; /* Type of protocol at the 239 1.1 thorpej hardware addr */ 240 1.1 thorpej # define ETHER_TYPE 1 241 1.1 thorpej # define EXP_ETHER_TYPE 2 242 1.1 thorpej # define IEEE_TYPE 6 243 1.1 thorpej # define ARCNET_TYPE 7 244 1.1 thorpej 245 1.1 thorpej uint16_t HwAddrLen; /* Length of hardware address */ 246 1.1 thorpej MAC_ADDR CurrentNodeAddress; /* Current hardware address */ 247 1.1 thorpej MAC_ADDR PermNodeAddress; /* Permanent hardware address */ 248 1.1 thorpej SEGSEL_t ROMAddress; /* Real mode ROM segment 249 1.1 thorpej address */ 250 1.1 thorpej uint16_t RxBufCt; /* Receive queue length */ 251 1.1 thorpej uint16_t TxBufCt; /* Transmit queue length */ 252 1.5 perry } __packed t_PXENV_UNDI_GET_INFORMATION; 253 1.1 thorpej 254 1.1 thorpej #define PXENV_UNDI_GET_STATISTICS 0x000D 255 1.1 thorpej typedef struct { 256 1.1 thorpej PXENV_STATUS_t Status; 257 1.1 thorpej uint32_t XmitGoodFrames; /* Number of successful 258 1.1 thorpej transmissions */ 259 1.1 thorpej uint32_t RcvGoodFrames; /* Number of good frames 260 1.1 thorpej received */ 261 1.1 thorpej uint32_t RcvCRCErrors; /* Number of frames with 262 1.1 thorpej CRC errors */ 263 1.1 thorpej uint32_t RcvResourceErrors; /* Number of frames dropped */ 264 1.5 perry } __packed t_PXENV_UNDI_GET_STATISTICS; 265 1.1 thorpej 266 1.1 thorpej #define PXENV_UNDI_CLEAR_STATISTICS 0x000E 267 1.1 thorpej typedef struct { 268 1.1 thorpej PXENV_STATUS_t Status; 269 1.5 perry } __packed t_PXENV_UNDI_CLEAR_STATISTICS; 270 1.1 thorpej 271 1.1 thorpej #define PXENV_UNDI_INITIATE_DIAGS 0x000F 272 1.1 thorpej typedef struct { 273 1.1 thorpej PXENV_STATUS_t Status; 274 1.5 perry } __packed t_PXENV_UNDI_INITIATE_DIAGS; 275 1.1 thorpej 276 1.1 thorpej #define PXENV_UNDI_FORCE_INTERRUPT 0x0010 277 1.1 thorpej typedef struct { 278 1.1 thorpej PXENV_STATUS_t Status; 279 1.5 perry } __packed t_PXENV_UNDI_FORCE_INTERRUPT; 280 1.1 thorpej 281 1.1 thorpej #define PXENV_UNDI_GET_MCAST_ADDRESS 0x0011 282 1.1 thorpej typedef struct { 283 1.1 thorpej PXENV_STATUS_t Status; 284 1.9 andvar IP4_t InetAddr; /* IP multicast address */ 285 1.1 thorpej MAC_ADDR MediaAddr; /* MAC multicast address */ 286 1.5 perry } __packed t_PXENV_UNDI_GET_MCAST_ADDR; 287 1.1 thorpej 288 1.1 thorpej #define PXENV_UNDI_GET_NIC_TYPE 0x0012 289 1.1 thorpej typedef struct { 290 1.1 thorpej PXENV_STATUS_t Status; 291 1.1 thorpej uint8_t NicType; /* Type of NIC */ 292 1.1 thorpej # define PCI_NIC 2 293 1.1 thorpej # define PnP_NIC 3 294 1.1 thorpej # define CardBus_NIC 4 295 1.1 thorpej 296 1.1 thorpej union { 297 1.1 thorpej struct { 298 1.1 thorpej uint16_t Vendor_ID; 299 1.1 thorpej uint16_t Dev_ID; 300 1.1 thorpej uint8_t Base_Class; 301 1.1 thorpej uint8_t Sub_Class; 302 1.1 thorpej uint8_t Prog_Intf; 303 1.1 thorpej uint8_t Rev; 304 1.1 thorpej uint16_t BusDevFunc; 305 1.1 thorpej uint16_t SubVendor_ID; 306 1.1 thorpej uint16_t SubDevice_ID; 307 1.1 thorpej } pci, cardbus; 308 1.1 thorpej struct { 309 1.1 thorpej uint32_t EISA_Dev_ID; 310 1.1 thorpej uint8_t Base_Class; 311 1.1 thorpej uint8_t Sub_Class; 312 1.1 thorpej uint8_t Prog_Intf; 313 1.1 thorpej uint16_t CardSelNum; 314 1.1 thorpej } pnp; 315 1.1 thorpej } info; 316 1.5 perry } __packed t_PXENV_UNDI_GET_NIC_TYPE; 317 1.1 thorpej 318 1.1 thorpej #define PXENV_UNDI_GET_IFACE_INFO 0x0013 319 1.1 thorpej typedef struct { 320 1.1 thorpej PXENV_STATUS_t Status; 321 1.1 thorpej uint8_t IfaceType[16]; /* Name of MAC type in ASCII. */ 322 1.1 thorpej uint32_t LinkSpeed; /* Defined in NDIS 2.0 spec */ 323 1.1 thorpej uint32_t ServiceFlags; /* Defined in NDIS 2.0 spec */ 324 1.1 thorpej uint32_t Reserved[4]; /* must be 0 */ 325 1.5 perry } __packed t_PXENV_UNDI_GET_NDIS_INFO; 326 1.1 thorpej 327 1.1 thorpej #define PXENV_UNDI_ISR 0x0014 328 1.1 thorpej typedef struct { 329 1.1 thorpej PXENV_STATUS_t Status; 330 1.1 thorpej uint16_t FuncFlag; /* PXENV_UNDI_ISR_OUT_xxx */ 331 1.1 thorpej uint16_t BufferLength; /* Length of Frame */ 332 1.7 msaitoh uint16_t FrameLength; /* Total length of receiver 333 1.1 thorpej frame */ 334 1.1 thorpej uint16_t FrameHeaderLength; /* Length of the media header 335 1.1 thorpej in Frame */ 336 1.1 thorpej SEGOFF16_t Frame; /* receive buffer */ 337 1.1 thorpej uint8_t ProtType; /* Protocol type */ 338 1.1 thorpej uint8_t PktType; /* Packet Type */ 339 1.1 thorpej # define PXENV_UNDI_ISR_IN_START 1 340 1.1 thorpej # define PXENV_UNDI_ISR_IN_PROCESS 2 341 1.1 thorpej # define PXENV_UNDI_ISR_IN_GET_NEXT 3 342 1.1 thorpej 343 1.1 thorpej /* one of these will be returned for PXENV_UNDI_ISR_IN_START */ 344 1.1 thorpej # define PXENV_UNDI_ISR_OUT_OURS 0 345 1.1 thorpej # define PXENV_UNDI_ISR_OUT_NOT_OUTS 1 346 1.1 thorpej 347 1.1 thorpej /* 348 1.8 msaitoh * one of these will be returned for PXEND_UNDI_ISR_IN_PROCESS 349 1.1 thorpej * and PXENV_UNDI_ISR_IN_GET_NEXT 350 1.1 thorpej */ 351 1.1 thorpej # define PXENV_UNDI_ISR_OUT_DONE 0 352 1.1 thorpej # define PXENV_UNDI_ISR_OUT_TRANSMIT 2 353 1.7 msaitoh # define PXENV_UNDI_ISR_OUT_RECEIVE 3 354 1.1 thorpej # define PXENV_UNDI_ISR_OUT_BUSY 4 355 1.5 perry } __packed t_PXENV_UNDI_ISR; 356 1.1 thorpej 357 1.1 thorpej #define PXENV_STOP_UNDI 0x0015 358 1.1 thorpej typedef struct { 359 1.1 thorpej PXENV_STATUS_t Status; 360 1.5 perry } __packed t_PXENV_STOP_UNDI; 361 1.1 thorpej 362 1.1 thorpej #define PXENV_TFTP_OPEN 0x0020 363 1.1 thorpej typedef struct { 364 1.1 thorpej PXENV_STATUS_t Status; 365 1.1 thorpej IP4_t ServerIPAddress; 366 1.1 thorpej IP4_t GatewayIPAddress; 367 1.1 thorpej uint8_t FileName[128]; 368 1.1 thorpej UDP_PORT_t TFTPPort; 369 1.1 thorpej uint16_t PacketSize; 370 1.5 perry } __packed t_PXENV_TFTP_OPEN; 371 1.1 thorpej 372 1.1 thorpej #define PXENV_TFTP_CLOSE 0x0021 373 1.1 thorpej typedef struct { 374 1.1 thorpej PXENV_STATUS_t Status; 375 1.5 perry } __packed t_PXENV_TFTP_CLOSE; 376 1.1 thorpej 377 1.1 thorpej #define PXENV_TFTP_READ 0x0022 378 1.1 thorpej typedef struct { 379 1.1 thorpej PXENV_STATUS_t Status; 380 1.1 thorpej uint16_t PacketNumber; 381 1.1 thorpej uint16_t BufferSize; 382 1.1 thorpej SEGOFF16_t Buffer; 383 1.5 perry } __packed t_PXENV_TFTP_READ; 384 1.1 thorpej 385 1.1 thorpej #define PXENV_TFTP_READ_FILE 0x0023 386 1.1 thorpej typedef struct { 387 1.1 thorpej PXENV_STATUS_t Status; 388 1.1 thorpej uint8_t FileName[128]; 389 1.1 thorpej uint32_t BufferSize; 390 1.1 thorpej ADDR32_t Buffer; 391 1.1 thorpej IP4_t ServerIPAddress; 392 1.2 wiz IP4_t GatewayIPAddress; 393 1.2 wiz IP4_t McastIPAddress; 394 1.1 thorpej UDP_PORT_t TFTPClntPort; 395 1.1 thorpej UDP_PORT_t TFTPSrvPort; 396 1.1 thorpej uint16_t TFTPOpenTimeOut; 397 1.1 thorpej uint16_t TFTPReopenDelay; 398 1.5 perry } __packed t_PXENV_TFTP_READ_FILE; 399 1.1 thorpej 400 1.1 thorpej #define PXENV_TFTP_GET_FSIZE 0x0025 401 1.1 thorpej typedef struct { 402 1.1 thorpej PXENV_STATUS_t Status; 403 1.1 thorpej IP4_t ServerIPAddress; 404 1.2 wiz IP4_t GatewayIPAddress; 405 1.1 thorpej uint8_t FileName[128]; 406 1.1 thorpej uint32_t FileSize; 407 1.5 perry } __packed t_PXENV_TFTP_GET_FSIZE; 408 1.1 thorpej 409 1.1 thorpej #define PXENV_UDP_OPEN 0x0030 410 1.1 thorpej typedef struct { 411 1.1 thorpej PXENV_STATUS_t status; 412 1.1 thorpej IP4_t src_ip; /* IP address of this station */ 413 1.5 perry } __packed t_PXENV_UDP_OPEN; 414 1.1 thorpej 415 1.1 thorpej #define PXENV_UDP_CLOSE 0x0031 416 1.1 thorpej typedef struct { 417 1.1 thorpej PXENV_STATUS_t status; 418 1.5 perry } __packed t_PXENV_UDP_CLOSE; 419 1.1 thorpej 420 1.1 thorpej #define PXENV_UDP_READ 0x0032 421 1.1 thorpej typedef struct { 422 1.1 thorpej PXENV_STATUS_t status; 423 1.1 thorpej IP4_t src_ip; /* IP of sender */ 424 1.1 thorpej IP4_t dest_ip; /* Only accept packets sent to 425 1.1 thorpej this IP */ 426 1.1 thorpej UDP_PORT_t s_port; /* UDP source port of sender */ 427 1.1 thorpej UDP_PORT_t d_port; /* Only accept packets sent to 428 1.1 thorpej this port */ 429 1.1 thorpej uint16_t buffer_size; /* Size of the packet buffer */ 430 1.1 thorpej SEGOFF16_t buffer; /* SEG:OFF to the packet buffer */ 431 1.5 perry } __packed t_PXENV_UDP_READ; 432 1.1 thorpej 433 1.1 thorpej #define PXENV_UDP_WRITE 0x0033 434 1.1 thorpej typedef struct { 435 1.1 thorpej PXENV_STATUS_t status; 436 1.1 thorpej IP4_t ip; /* dest ip addr */ 437 1.1 thorpej IP4_t gw; /* ip gateway */ 438 1.1 thorpej UDP_PORT_t src_port; /* source udp port */ 439 1.1 thorpej UDP_PORT_t dst_port; /* destination udp port */ 440 1.1 thorpej uint16_t buffer_size; /* Size of the packet buffer */ 441 1.1 thorpej SEGOFF16_t buffer; /* SEG:OFF to the packet buffer */ 442 1.5 perry } __packed t_PXENV_UDP_WRITE; 443 1.1 thorpej 444 1.1 thorpej #define PXENV_UNLOAD_STACK 0x0070 445 1.1 thorpej typedef struct { 446 1.1 thorpej PXENV_STATUS_t Status; 447 1.1 thorpej uint8_t reserved[10]; 448 1.5 perry } __packed t_PXENV_UNLOAD_STACK; 449 1.1 thorpej 450 1.1 thorpej 451 1.1 thorpej #define PXENV_GET_CACHED_INFO 0x0071 452 1.1 thorpej typedef struct { 453 1.1 thorpej PXENV_STATUS_t Status; 454 1.1 thorpej uint16_t PacketType; /* type (defined right here) */ 455 1.1 thorpej # define PXENV_PACKET_TYPE_DHCP_DISCOVER 1 456 1.1 thorpej # define PXENV_PACKET_TYPE_DHCP_ACK 2 457 1.1 thorpej # define PXENV_PACKET_TYPE_BINL_REPLY 3 458 1.1 thorpej uint16_t BufferSize; /* max to copy, leave at 0 for 459 1.1 thorpej pointer */ 460 1.1 thorpej SEGOFF16_t Buffer; /* copy to, leave at 0 for pointer */ 461 1.1 thorpej uint16_t BufferLimit; /* max size of buffer in BC dataseg ? */ 462 1.5 perry } __packed t_PXENV_GET_CACHED_INFO; 463 1.1 thorpej 464 1.1 thorpej 465 1.1 thorpej /* structure filled in by PXENV_GET_CACHED_INFO 466 1.1 thorpej * (how we determine which IP we downloaded the initial bootstrap from) 467 1.1 thorpej * words can't describe... 468 1.1 thorpej */ 469 1.1 thorpej typedef struct { 470 1.1 thorpej uint8_t opcode; 471 1.1 thorpej # define BOOTP_REQ 1 472 1.1 thorpej # define BOOTP_REP 2 473 1.1 thorpej uint8_t Hardware; /* hardware type */ 474 1.1 thorpej uint8_t Hardlen; /* hardware addr len */ 475 1.1 thorpej uint8_t Gatehops; /* zero it */ 476 1.1 thorpej uint32_t ident; /* random number chosen by client */ 477 1.1 thorpej uint16_t seconds; /* seconds since did initial 478 1.1 thorpej bootstrap */ 479 1.1 thorpej uint16_t Flags; /* seconds since did initial 480 1.1 thorpej bootstrap */ 481 1.1 thorpej # define BOOTP_BCAST 0x8000 /* ? */ 482 1.1 thorpej IP4_t cip; /* Client IP */ 483 1.1 thorpej IP4_t yip; /* Your IP */ 484 1.1 thorpej IP4_t sip; /* IP to use for next boot stage */ 485 1.1 thorpej IP4_t gip; /* Relay IP ? */ 486 1.1 thorpej MAC_ADDR CAddr; /* Client hardware address */ 487 1.1 thorpej uint8_t Sname[64]; /* Server's hostname (Optional) */ 488 1.1 thorpej uint8_t bootfile[128]; /* boot filename */ 489 1.1 thorpej union { 490 1.1 thorpej # if 1 491 1.1 thorpej # define BOOTP_DHCPVEND 1024 /* DHCP extended vendor 492 1.1 thorpej field size */ 493 1.1 thorpej # else 494 1.1 thorpej # define BOOTP_DHCPVEND 312 /* DHCP standard vendor 495 1.1 thorpej field size */ 496 1.1 thorpej # endif 497 1.1 thorpej uint8_t d[BOOTP_DHCPVEND]; /* raw array of 498 1.1 thorpej vendor/dhcp options */ 499 1.1 thorpej struct { 500 1.1 thorpej uint8_t magic[4]; /* DHCP magic cookie */ 501 1.1 thorpej # ifndef VM_RFC1048 502 1.1 thorpej # define VM_RFC1048 0x63825363L /* ? */ 503 1.1 thorpej # endif 504 1.1 thorpej uint32_t flags; /* bootp flags/opcodes */ 505 1.1 thorpej uint8_t pad[56]; /* I don't think intel 506 1.1 thorpej knows what a union 507 1.1 thorpej does... */ 508 1.1 thorpej } v; 509 1.1 thorpej } vendor; 510 1.5 perry } __packed BOOTPLAYER; 511 1.1 thorpej 512 1.1 thorpej #define PXENV_RESTART_TFTP 0x0073 513 1.1 thorpej #define t_PXENV_RESTART_TFTP t_PXENV_TFTP_READ_FILE 514 1.1 thorpej 515 1.1 thorpej #define PXENV_START_BASE 0x0075 516 1.1 thorpej typedef struct { 517 1.1 thorpej PXENV_STATUS_t Status; 518 1.5 perry } __packed t_PXENV_START_BASE; 519 1.1 thorpej 520 1.1 thorpej #define PXENV_STOP_BASE 0x0076 521 1.1 thorpej typedef struct { 522 1.1 thorpej PXENV_STATUS_t Status; 523 1.5 perry } __packed t_PXENV_STOP_BASE; 524 1.1 thorpej 525 1.1 thorpej #define PXENV_STATUS_SUCCESS 0 526 1.1 thorpej #define PXENV_STATUS_FAILURE 1 527 1.1 thorpej /* ...there are tons more, but we don't really care about them right now... */ 528