]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Uefi/UefiPxe.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiPxe.h
CommitLineData
959ccb23 1/** @file\r
2 This header file contains all of the PXE type definitions,\r
3 structure prototypes, global variables and constants that\r
4 are needed for porting PXE to EFI.\r
4ccd9566 5\r
9095d37b 6Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 7SPDX-License-Identifier: BSD-2-Clause-Patent\r
4ccd9566 8\r
959ccb23 9 @par Revision Reference:\r
10 32/64-bit PXE specification:\r
af2dc6a7 11 alpha-4, 99-Dec-17.\r
993702aa 12\r
959ccb23 13**/\r
14\r
15#ifndef __EFI_PXE_H__\r
16#define __EFI_PXE_H__\r
17\r
18#pragma pack(1)\r
19\r
959ccb23 20#define PXE_BUSTYPE(a, b, c, d) \\r
21 ( \\r
22 (((PXE_UINT32) (d) & 0xFF) << 24) | (((PXE_UINT32) (c) & 0xFF) << 16) | (((PXE_UINT32) (b) & 0xFF) << 8) | \\r
23 ((PXE_UINT32) (a) & 0xFF) \\r
24 )\r
25\r
8b13229b 26///\r
af2dc6a7 27/// UNDI ROM ID and devive ID signature.\r
8b13229b 28///\r
2f88bd3a 29#define PXE_BUSTYPE_PXE PXE_BUSTYPE ('!', 'P', 'X', 'E')\r
959ccb23 30\r
8b13229b 31///\r
af2dc6a7 32/// BUS ROM ID signatures.\r
8b13229b 33///\r
2f88bd3a
MK
34#define PXE_BUSTYPE_PCI PXE_BUSTYPE ('P', 'C', 'I', 'R')\r
35#define PXE_BUSTYPE_PC_CARD PXE_BUSTYPE ('P', 'C', 'C', 'R')\r
36#define PXE_BUSTYPE_USB PXE_BUSTYPE ('U', 'S', 'B', 'R')\r
37#define PXE_BUSTYPE_1394 PXE_BUSTYPE ('1', '3', '9', '4')\r
959ccb23 38\r
39#define PXE_SWAP_UINT16(n) ((((PXE_UINT16) (n) & 0x00FF) << 8) | (((PXE_UINT16) (n) & 0xFF00) >> 8))\r
40\r
41#define PXE_SWAP_UINT32(n) \\r
42 ((((PXE_UINT32)(n) & 0x000000FF) << 24) | \\r
43 (((PXE_UINT32)(n) & 0x0000FF00) << 8) | \\r
44 (((PXE_UINT32)(n) & 0x00FF0000) >> 8) | \\r
45 (((PXE_UINT32)(n) & 0xFF000000) >> 24))\r
46\r
47#define PXE_SWAP_UINT64(n) \\r
48 ((((PXE_UINT64)(n) & 0x00000000000000FFULL) << 56) | \\r
49 (((PXE_UINT64)(n) & 0x000000000000FF00ULL) << 40) | \\r
50 (((PXE_UINT64)(n) & 0x0000000000FF0000ULL) << 24) | \\r
51 (((PXE_UINT64)(n) & 0x00000000FF000000ULL) << 8) | \\r
52 (((PXE_UINT64)(n) & 0x000000FF00000000ULL) >> 8) | \\r
53 (((PXE_UINT64)(n) & 0x0000FF0000000000ULL) >> 24) | \\r
54 (((PXE_UINT64)(n) & 0x00FF000000000000ULL) >> 40) | \\r
55 (((PXE_UINT64)(n) & 0xFF00000000000000ULL) >> 56))\r
56\r
3ed785e9 57#define PXE_CPBSIZE_NOT_USED 0 ///< zero\r
58#define PXE_DBSIZE_NOT_USED 0 ///< zero\r
59#define PXE_CPBADDR_NOT_USED (PXE_UINT64) 0 ///< zero\r
60#define PXE_DBADDR_NOT_USED (PXE_UINT64) 0 ///< zero\r
61#define PXE_CONST CONST\r
959ccb23 62\r
2f88bd3a 63#define PXE_VOLATILE volatile\r
959ccb23 64\r
2f88bd3a
MK
65typedef VOID PXE_VOID;\r
66typedef UINT8 PXE_UINT8;\r
67typedef UINT16 PXE_UINT16;\r
68typedef UINT32 PXE_UINT32;\r
69typedef UINTN PXE_UINTN;\r
4ccd9566 70\r
8b13229b 71///\r
af2dc6a7 72/// Typedef unsigned long PXE_UINT64.\r
8b13229b 73///\r
2f88bd3a 74typedef UINT64 PXE_UINT64;\r
959ccb23 75\r
76typedef PXE_UINT8 PXE_BOOL;\r
2f88bd3a
MK
77#define PXE_FALSE 0 ///< zero\r
78#define PXE_TRUE (!PXE_FALSE)\r
959ccb23 79\r
2f88bd3a 80typedef PXE_UINT16 PXE_OPCODE;\r
959ccb23 81\r
8b13229b 82///\r
83/// Return UNDI operational state.\r
84///\r
959ccb23 85#define PXE_OPCODE_GET_STATE 0x0000\r
86\r
8b13229b 87///\r
88/// Change UNDI operational state from Stopped to Started.\r
89///\r
959ccb23 90#define PXE_OPCODE_START 0x0001\r
91\r
8b13229b 92///\r
93/// Change UNDI operational state from Started to Stopped.\r
94///\r
2f88bd3a 95#define PXE_OPCODE_STOP 0x0002\r
959ccb23 96\r
8b13229b 97///\r
98/// Get UNDI initialization information.\r
99///\r
959ccb23 100#define PXE_OPCODE_GET_INIT_INFO 0x0003\r
101\r
8b13229b 102///\r
103/// Get NIC configuration information.\r
104///\r
959ccb23 105#define PXE_OPCODE_GET_CONFIG_INFO 0x0004\r
106\r
8b13229b 107///\r
108/// Changed UNDI operational state from Started to Initialized.\r
109///\r
2f88bd3a 110#define PXE_OPCODE_INITIALIZE 0x0005\r
959ccb23 111\r
8b13229b 112///\r
113/// Re-initialize the NIC H/W.\r
114///\r
959ccb23 115#define PXE_OPCODE_RESET 0x0006\r
116\r
8b13229b 117///\r
118/// Change the UNDI operational state from Initialized to Started.\r
119///\r
2f88bd3a 120#define PXE_OPCODE_SHUTDOWN 0x0007\r
959ccb23 121\r
8b13229b 122///\r
123/// Read & change state of external interrupt enables.\r
124///\r
959ccb23 125#define PXE_OPCODE_INTERRUPT_ENABLES 0x0008\r
126\r
8b13229b 127///\r
128/// Read & change state of packet receive filters.\r
129///\r
959ccb23 130#define PXE_OPCODE_RECEIVE_FILTERS 0x0009\r
131\r
8b13229b 132///\r
133/// Read & change station MAC address.\r
134///\r
959ccb23 135#define PXE_OPCODE_STATION_ADDRESS 0x000A\r
136\r
8b13229b 137///\r
138/// Read traffic statistics.\r
139///\r
2f88bd3a 140#define PXE_OPCODE_STATISTICS 0x000B\r
959ccb23 141\r
8b13229b 142///\r
143/// Convert multicast IP address to multicast MAC address.\r
144///\r
959ccb23 145#define PXE_OPCODE_MCAST_IP_TO_MAC 0x000C\r
146\r
8b13229b 147///\r
148/// Read or change non-volatile storage on the NIC.\r
149///\r
2f88bd3a 150#define PXE_OPCODE_NVDATA 0x000D\r
959ccb23 151\r
8b13229b 152///\r
153/// Get & clear interrupt status.\r
154///\r
2f88bd3a 155#define PXE_OPCODE_GET_STATUS 0x000E\r
959ccb23 156\r
8b13229b 157///\r
158/// Fill media header in packet for transmit.\r
159///\r
959ccb23 160#define PXE_OPCODE_FILL_HEADER 0x000F\r
161\r
8b13229b 162///\r
163/// Transmit packet(s).\r
164///\r
2f88bd3a 165#define PXE_OPCODE_TRANSMIT 0x0010\r
959ccb23 166\r
8b13229b 167///\r
168/// Receive packet.\r
169///\r
959ccb23 170#define PXE_OPCODE_RECEIVE 0x0011\r
171\r
8b13229b 172///\r
173/// Last valid PXE UNDI OpCode number.\r
174///\r
2f88bd3a 175#define PXE_OPCODE_LAST_VALID 0x0011\r
959ccb23 176\r
2f88bd3a 177typedef PXE_UINT16 PXE_OPFLAGS;\r
959ccb23 178\r
179#define PXE_OPFLAGS_NOT_USED 0x0000\r
180\r
181//\r
182// //////////////////////////////////////\r
183// UNDI Get State\r
184//\r
185// No OpFlags\r
186\r
187////////////////////////////////////////\r
188// UNDI Start\r
189//\r
190// No OpFlags\r
191\r
192////////////////////////////////////////\r
193// UNDI Stop\r
194//\r
195// No OpFlags\r
196\r
197////////////////////////////////////////\r
198// UNDI Get Init Info\r
199//\r
200// No Opflags\r
201\r
202////////////////////////////////////////\r
203// UNDI Get Config Info\r
204//\r
205// No Opflags\r
206\r
3ed785e9 207///\r
208/// UNDI Initialize\r
209///\r
959ccb23 210#define PXE_OPFLAGS_INITIALIZE_CABLE_DETECT_MASK 0x0001\r
211#define PXE_OPFLAGS_INITIALIZE_DETECT_CABLE 0x0000\r
212#define PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE 0x0001\r
213\r
3ed785e9 214///\r
215///\r
216/// UNDI Reset\r
217///\r
959ccb23 218#define PXE_OPFLAGS_RESET_DISABLE_INTERRUPTS 0x0001\r
219#define PXE_OPFLAGS_RESET_DISABLE_FILTERS 0x0002\r
220\r
3ed785e9 221///\r
af2dc6a7 222/// UNDI Shutdown.\r
3ed785e9 223///\r
af2dc6a7 224/// No OpFlags.\r
959ccb23 225\r
3ed785e9 226///\r
af2dc6a7 227/// UNDI Interrupt Enables.\r
3ed785e9 228///\r
229///\r
230/// Select whether to enable or disable external interrupt signals.\r
231/// Setting both enable and disable will return PXE_STATCODE_INVALID_OPFLAGS.\r
232///\r
2f88bd3a
MK
233#define PXE_OPFLAGS_INTERRUPT_OPMASK 0xC000\r
234#define PXE_OPFLAGS_INTERRUPT_ENABLE 0x8000\r
235#define PXE_OPFLAGS_INTERRUPT_DISABLE 0x4000\r
236#define PXE_OPFLAGS_INTERRUPT_READ 0x0000\r
959ccb23 237\r
8b13229b 238///\r
239/// Enable receive interrupts. An external interrupt will be generated\r
240/// after a complete non-error packet has been received.\r
241///\r
2f88bd3a 242#define PXE_OPFLAGS_INTERRUPT_RECEIVE 0x0001\r
959ccb23 243\r
8b13229b 244///\r
245/// Enable transmit interrupts. An external interrupt will be generated\r
246/// after a complete non-error packet has been transmitted.\r
247///\r
959ccb23 248#define PXE_OPFLAGS_INTERRUPT_TRANSMIT 0x0002\r
249\r
8b13229b 250///\r
251/// Enable command interrupts. An external interrupt will be generated\r
252/// when command execution stops.\r
253///\r
2f88bd3a 254#define PXE_OPFLAGS_INTERRUPT_COMMAND 0x0004\r
959ccb23 255\r
8b13229b 256///\r
257/// Generate software interrupt. Setting this bit generates an external\r
258/// interrupt, if it is supported by the hardware.\r
259///\r
959ccb23 260#define PXE_OPFLAGS_INTERRUPT_SOFTWARE 0x0008\r
261\r
4ccd9566 262///\r
af2dc6a7 263/// UNDI Receive Filters.\r
3ed785e9 264///\r
265///\r
266/// Select whether to enable or disable receive filters.\r
267/// Setting both enable and disable will return PXE_STATCODE_INVALID_OPCODE.\r
268///\r
959ccb23 269#define PXE_OPFLAGS_RECEIVE_FILTER_OPMASK 0xC000\r
270#define PXE_OPFLAGS_RECEIVE_FILTER_ENABLE 0x8000\r
271#define PXE_OPFLAGS_RECEIVE_FILTER_DISABLE 0x4000\r
272#define PXE_OPFLAGS_RECEIVE_FILTER_READ 0x0000\r
273\r
8b13229b 274///\r
275/// To reset the contents of the multicast MAC address filter list,\r
276/// set this OpFlag:\r
277///\r
2f88bd3a 278#define PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST 0x2000\r
959ccb23 279\r
8b13229b 280///\r
281/// Enable unicast packet receiving. Packets sent to the current station\r
282/// MAC address will be received.\r
283///\r
959ccb23 284#define PXE_OPFLAGS_RECEIVE_FILTER_UNICAST 0x0001\r
285\r
8b13229b 286///\r
287/// Enable broadcast packet receiving. Packets sent to the broadcast\r
288/// MAC address will be received.\r
289///\r
959ccb23 290#define PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST 0x0002\r
291\r
8b13229b 292///\r
293/// Enable filtered multicast packet receiving. Packets sent to any\r
294/// of the multicast MAC addresses in the multicast MAC address filter\r
295/// list will be received. If the filter list is empty, no multicast\r
296///\r
2f88bd3a 297#define PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST 0x0004\r
959ccb23 298\r
8b13229b 299///\r
300/// Enable promiscuous packet receiving. All packets will be received.\r
301///\r
959ccb23 302#define PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS 0x0008\r
303\r
8b13229b 304///\r
305/// Enable promiscuous multicast packet receiving. All multicast\r
306/// packets will be received.\r
307///\r
959ccb23 308#define PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010\r
309\r
4ccd9566 310///\r
af2dc6a7 311/// UNDI Station Address.\r
3ed785e9 312///\r
959ccb23 313#define PXE_OPFLAGS_STATION_ADDRESS_READ 0x0000\r
314#define PXE_OPFLAGS_STATION_ADDRESS_WRITE 0x0000\r
315#define PXE_OPFLAGS_STATION_ADDRESS_RESET 0x0001\r
316\r
3ed785e9 317///\r
af2dc6a7 318/// UNDI Statistics.\r
3ed785e9 319///\r
959ccb23 320#define PXE_OPFLAGS_STATISTICS_READ 0x0000\r
321#define PXE_OPFLAGS_STATISTICS_RESET 0x0001\r
322\r
3ed785e9 323///\r
af2dc6a7 324/// UNDI MCast IP to MAC.\r
3ed785e9 325///\r
326///\r
327/// Identify the type of IP address in the CPB.\r
328///\r
959ccb23 329#define PXE_OPFLAGS_MCAST_IP_TO_MAC_OPMASK 0x0003\r
330#define PXE_OPFLAGS_MCAST_IPV4_TO_MAC 0x0000\r
331#define PXE_OPFLAGS_MCAST_IPV6_TO_MAC 0x0001\r
332\r
3ed785e9 333///\r
af2dc6a7 334/// UNDI NvData.\r
3ed785e9 335///\r
336///\r
337/// Select the type of non-volatile data operation.\r
338///\r
2f88bd3a
MK
339#define PXE_OPFLAGS_NVDATA_OPMASK 0x0001\r
340#define PXE_OPFLAGS_NVDATA_READ 0x0000\r
341#define PXE_OPFLAGS_NVDATA_WRITE 0x0001\r
959ccb23 342\r
3ed785e9 343///\r
af2dc6a7 344/// UNDI Get Status.\r
3ed785e9 345///\r
346///\r
347/// Return current interrupt status. This will also clear any interrupts\r
348/// that are currently set. This can be used in a polling routine. The\r
349/// interrupt flags are still set and cleared even when the interrupts\r
350/// are disabled.\r
351///\r
959ccb23 352#define PXE_OPFLAGS_GET_INTERRUPT_STATUS 0x0001\r
353\r
3ed785e9 354///\r
355/// Return list of transmitted buffers for recycling. Transmit buffers\r
356/// must not be changed or unallocated until they have recycled. After\r
357/// issuing a transmit command, wait for a transmit complete interrupt.\r
358/// When a transmit complete interrupt is received, read the transmitted\r
359/// buffers. Do not plan on getting one buffer per interrupt. Some\r
360/// NICs and UNDIs may transmit multiple buffers per interrupt.\r
361///\r
2f88bd3a 362#define PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS 0x0002\r
959ccb23 363\r
993702aa 364///\r
365/// Return current media status.\r
366///\r
2f88bd3a 367#define PXE_OPFLAGS_GET_MEDIA_STATUS 0x0004\r
993702aa 368\r
3ed785e9 369///\r
af2dc6a7 370/// UNDI Fill Header.\r
3ed785e9 371///\r
959ccb23 372#define PXE_OPFLAGS_FILL_HEADER_OPMASK 0x0001\r
373#define PXE_OPFLAGS_FILL_HEADER_FRAGMENTED 0x0001\r
374#define PXE_OPFLAGS_FILL_HEADER_WHOLE 0x0000\r
375\r
3ed785e9 376///\r
af2dc6a7 377/// UNDI Transmit.\r
3ed785e9 378///\r
379///\r
380/// S/W UNDI only. Return after the packet has been transmitted. A\r
381/// transmit complete interrupt will still be generated and the transmit\r
382/// buffer will have to be recycled.\r
383///\r
959ccb23 384#define PXE_OPFLAGS_SWUNDI_TRANSMIT_OPMASK 0x0001\r
385#define PXE_OPFLAGS_TRANSMIT_BLOCK 0x0001\r
386#define PXE_OPFLAGS_TRANSMIT_DONT_BLOCK 0x0000\r
387\r
2f88bd3a
MK
388#define PXE_OPFLAGS_TRANSMIT_OPMASK 0x0002\r
389#define PXE_OPFLAGS_TRANSMIT_FRAGMENTED 0x0002\r
390#define PXE_OPFLAGS_TRANSMIT_WHOLE 0x0000\r
959ccb23 391\r
4ccd9566 392///\r
af2dc6a7 393/// UNDI Receive.\r
3ed785e9 394///\r
af2dc6a7 395/// No OpFlags.\r
3ed785e9 396///\r
397\r
398///\r
af2dc6a7 399/// PXE STATFLAGS.\r
3ed785e9 400///\r
2f88bd3a 401typedef PXE_UINT16 PXE_STATFLAGS;\r
959ccb23 402\r
403#define PXE_STATFLAGS_INITIALIZE 0x0000\r
404\r
3ed785e9 405///\r
406/// Common StatFlags that can be returned by all commands.\r
407///\r
408///\r
409/// The COMMAND_COMPLETE and COMMAND_FAILED status flags must be\r
410/// implemented by all UNDIs. COMMAND_QUEUED is only needed by UNDIs\r
411/// that support command queuing.\r
412///\r
959ccb23 413#define PXE_STATFLAGS_STATUS_MASK 0xC000\r
414#define PXE_STATFLAGS_COMMAND_COMPLETE 0xC000\r
415#define PXE_STATFLAGS_COMMAND_FAILED 0x8000\r
416#define PXE_STATFLAGS_COMMAND_QUEUED 0x4000\r
417\r
3ed785e9 418///\r
af2dc6a7 419/// UNDI Get State.\r
3ed785e9 420///\r
2f88bd3a
MK
421#define PXE_STATFLAGS_GET_STATE_MASK 0x0003\r
422#define PXE_STATFLAGS_GET_STATE_INITIALIZED 0x0002\r
423#define PXE_STATFLAGS_GET_STATE_STARTED 0x0001\r
424#define PXE_STATFLAGS_GET_STATE_STOPPED 0x0000\r
959ccb23 425\r
3ed785e9 426///\r
af2dc6a7 427/// UNDI Start.\r
3ed785e9 428///\r
af2dc6a7 429/// No additional StatFlags.\r
3ed785e9 430///\r
959ccb23 431\r
3ed785e9 432///\r
af2dc6a7 433/// UNDI Get Init Info.\r
3ed785e9 434///\r
959ccb23 435#define PXE_STATFLAGS_CABLE_DETECT_MASK 0x0001\r
436#define PXE_STATFLAGS_CABLE_DETECT_NOT_SUPPORTED 0x0000\r
437#define PXE_STATFLAGS_CABLE_DETECT_SUPPORTED 0x0001\r
438\r
993702aa 439#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA_MASK 0x0002\r
440#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA_NOT_SUPPORTED 0x0000\r
441#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED 0x0002\r
442\r
3ed785e9 443///\r
af2dc6a7 444/// UNDI Initialize.\r
3ed785e9 445///\r
959ccb23 446#define PXE_STATFLAGS_INITIALIZED_NO_MEDIA 0x0001\r
447\r
3ed785e9 448///\r
af2dc6a7 449/// UNDI Reset.\r
3ed785e9 450///\r
959ccb23 451#define PXE_STATFLAGS_RESET_NO_MEDIA 0x0001\r
452\r
3ed785e9 453///\r
af2dc6a7 454/// UNDI Shutdown.\r
3ed785e9 455///\r
af2dc6a7 456/// No additional StatFlags.\r
959ccb23 457\r
3ed785e9 458///\r
af2dc6a7 459/// UNDI Interrupt Enables.\r
3ed785e9 460///\r
461///\r
462/// If set, receive interrupts are enabled.\r
463///\r
2f88bd3a 464#define PXE_STATFLAGS_INTERRUPT_RECEIVE 0x0001\r
959ccb23 465\r
3ed785e9 466///\r
467/// If set, transmit interrupts are enabled.\r
468///\r
959ccb23 469#define PXE_STATFLAGS_INTERRUPT_TRANSMIT 0x0002\r
470\r
3ed785e9 471///\r
472/// If set, command interrupts are enabled.\r
473///\r
2f88bd3a 474#define PXE_STATFLAGS_INTERRUPT_COMMAND 0x0004\r
959ccb23 475\r
3ed785e9 476///\r
af2dc6a7 477/// UNDI Receive Filters.\r
3ed785e9 478///\r
479\r
480///\r
481/// If set, unicast packets will be received.\r
482///\r
959ccb23 483#define PXE_STATFLAGS_RECEIVE_FILTER_UNICAST 0x0001\r
484\r
3ed785e9 485///\r
486/// If set, broadcast packets will be received.\r
487///\r
959ccb23 488#define PXE_STATFLAGS_RECEIVE_FILTER_BROADCAST 0x0002\r
489\r
3ed785e9 490///\r
491/// If set, multicast packets that match up with the multicast address\r
492/// filter list will be received.\r
493///\r
2f88bd3a 494#define PXE_STATFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST 0x0004\r
959ccb23 495\r
3ed785e9 496///\r
497/// If set, all packets will be received.\r
498///\r
959ccb23 499#define PXE_STATFLAGS_RECEIVE_FILTER_PROMISCUOUS 0x0008\r
500\r
3ed785e9 501///\r
502/// If set, all multicast packets will be received.\r
503///\r
959ccb23 504#define PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010\r
505\r
3ed785e9 506///\r
af2dc6a7 507/// UNDI Station Address.\r
3ed785e9 508///\r
af2dc6a7 509/// No additional StatFlags.\r
3ed785e9 510///\r
959ccb23 511\r
3ed785e9 512///\r
af2dc6a7 513/// UNDI Statistics.\r
3ed785e9 514///\r
af2dc6a7 515/// No additional StatFlags.\r
3ed785e9 516///\r
959ccb23 517\r
3ed785e9 518///\r
af2dc6a7 519//// UNDI MCast IP to MAC.\r
3ed785e9 520////\r
af2dc6a7 521//// No additional StatFlags.\r
959ccb23 522\r
3ed785e9 523///\r
af2dc6a7 524/// UNDI NvData.\r
3ed785e9 525///\r
af2dc6a7 526/// No additional StatFlags.\r
3ed785e9 527///\r
959ccb23 528\r
3ed785e9 529///\r
af2dc6a7 530/// UNDI Get Status.\r
3ed785e9 531///\r
959ccb23 532\r
3ed785e9 533///\r
534/// Use to determine if an interrupt has occurred.\r
535///\r
2f88bd3a
MK
536#define PXE_STATFLAGS_GET_STATUS_INTERRUPT_MASK 0x000F\r
537#define PXE_STATFLAGS_GET_STATUS_NO_INTERRUPTS 0x0000\r
959ccb23 538\r
3ed785e9 539///\r
540/// If set, at least one receive interrupt occurred.\r
541///\r
959ccb23 542#define PXE_STATFLAGS_GET_STATUS_RECEIVE 0x0001\r
543\r
3ed785e9 544///\r
545/// If set, at least one transmit interrupt occurred.\r
546///\r
2f88bd3a 547#define PXE_STATFLAGS_GET_STATUS_TRANSMIT 0x0002\r
959ccb23 548\r
3ed785e9 549///\r
550/// If set, at least one command interrupt occurred.\r
551///\r
959ccb23 552#define PXE_STATFLAGS_GET_STATUS_COMMAND 0x0004\r
553\r
3ed785e9 554///\r
555/// If set, at least one software interrupt occurred.\r
556///\r
2f88bd3a 557#define PXE_STATFLAGS_GET_STATUS_SOFTWARE 0x0008\r
959ccb23 558\r
3ed785e9 559///\r
560/// This flag is set if the transmitted buffer queue is empty. This flag\r
561/// will be set if all transmitted buffer addresses get written into the DB.\r
562///\r
959ccb23 563#define PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY 0x0010\r
564\r
3ed785e9 565///\r
566/// This flag is set if no transmitted buffer addresses were written\r
567/// into the DB. (This could be because DBsize was too small.)\r
568///\r
959ccb23 569#define PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN 0x0020\r
570\r
993702aa 571///\r
572/// This flag is set if there is no media detected.\r
573///\r
574#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA 0x0040\r
575\r
3ed785e9 576///\r
af2dc6a7 577/// UNDI Fill Header.\r
3ed785e9 578///\r
af2dc6a7 579/// No additional StatFlags.\r
3ed785e9 580///\r
959ccb23 581\r
3ed785e9 582///\r
af2dc6a7 583/// UNDI Transmit.\r
3ed785e9 584///\r
585/// No additional StatFlags.\r
959ccb23 586\r
3ed785e9 587///\r
588/// UNDI Receive\r
2f88bd3a 589/// .\r
3ed785e9 590\r
591///\r
592/// No additional StatFlags.\r
593///\r
2f88bd3a 594typedef PXE_UINT16 PXE_STATCODE;\r
959ccb23 595\r
2f88bd3a 596#define PXE_STATCODE_INITIALIZE 0x0000\r
959ccb23 597\r
3ed785e9 598///\r
599/// Common StatCodes returned by all UNDI commands, UNDI protocol functions\r
600/// and BC protocol functions.\r
601///\r
2f88bd3a 602#define PXE_STATCODE_SUCCESS 0x0000\r
959ccb23 603\r
604#define PXE_STATCODE_INVALID_CDB 0x0001\r
605#define PXE_STATCODE_INVALID_CPB 0x0002\r
606#define PXE_STATCODE_BUSY 0x0003\r
607#define PXE_STATCODE_QUEUE_FULL 0x0004\r
608#define PXE_STATCODE_ALREADY_STARTED 0x0005\r
609#define PXE_STATCODE_NOT_STARTED 0x0006\r
610#define PXE_STATCODE_NOT_SHUTDOWN 0x0007\r
611#define PXE_STATCODE_ALREADY_INITIALIZED 0x0008\r
612#define PXE_STATCODE_NOT_INITIALIZED 0x0009\r
613#define PXE_STATCODE_DEVICE_FAILURE 0x000A\r
614#define PXE_STATCODE_NVDATA_FAILURE 0x000B\r
615#define PXE_STATCODE_UNSUPPORTED 0x000C\r
616#define PXE_STATCODE_BUFFER_FULL 0x000D\r
617#define PXE_STATCODE_INVALID_PARAMETER 0x000E\r
618#define PXE_STATCODE_INVALID_UNDI 0x000F\r
619#define PXE_STATCODE_IPV4_NOT_SUPPORTED 0x0010\r
620#define PXE_STATCODE_IPV6_NOT_SUPPORTED 0x0011\r
621#define PXE_STATCODE_NOT_ENOUGH_MEMORY 0x0012\r
622#define PXE_STATCODE_NO_DATA 0x0013\r
623\r
2f88bd3a 624typedef PXE_UINT16 PXE_IFNUM;\r
959ccb23 625\r
3ed785e9 626///\r
627/// This interface number must be passed to the S/W UNDI Start command.\r
628///\r
2f88bd3a 629#define PXE_IFNUM_START 0x0000\r
959ccb23 630\r
3ed785e9 631///\r
632/// This interface number is returned by the S/W UNDI Get State and\r
633/// Start commands if information in the CDB, CPB or DB is invalid.\r
634///\r
2f88bd3a 635#define PXE_IFNUM_INVALID 0x0000\r
959ccb23 636\r
2f88bd3a 637typedef PXE_UINT16 PXE_CONTROL;\r
959ccb23 638\r
3ed785e9 639///\r
640/// Setting this flag directs the UNDI to queue this command for later\r
641/// execution if the UNDI is busy and it supports command queuing.\r
642/// If queuing is not supported, a PXE_STATCODE_INVALID_CONTROL error\r
643/// is returned. If the queue is full, a PXE_STATCODE_CDB_QUEUE_FULL\r
644/// error is returned.\r
645///\r
2f88bd3a 646#define PXE_CONTROL_QUEUE_IF_BUSY 0x0002\r
959ccb23 647\r
3ed785e9 648///\r
649/// These two bit values are used to determine if there are more UNDI\r
650/// CDB structures following this one. If the link bit is set, there\r
651/// must be a CDB structure following this one. Execution will start\r
652/// on the next CDB structure as soon as this one completes successfully.\r
653/// If an error is generated by this command, execution will stop.\r
654///\r
959ccb23 655#define PXE_CONTROL_LINK 0x0001\r
656#define PXE_CONTROL_LAST_CDB_IN_LIST 0x0000\r
657\r
2f88bd3a 658typedef PXE_UINT8 PXE_FRAME_TYPE;\r
959ccb23 659\r
2f88bd3a
MK
660#define PXE_FRAME_TYPE_NONE 0x00\r
661#define PXE_FRAME_TYPE_UNICAST 0x01\r
662#define PXE_FRAME_TYPE_BROADCAST 0x02\r
663#define PXE_FRAME_TYPE_FILTERED_MULTICAST 0x03\r
664#define PXE_FRAME_TYPE_PROMISCUOUS 0x04\r
665#define PXE_FRAME_TYPE_PROMISCUOUS_MULTICAST 0x05\r
959ccb23 666\r
2f88bd3a 667#define PXE_FRAME_TYPE_MULTICAST PXE_FRAME_TYPE_FILTERED_MULTICAST\r
959ccb23 668\r
2f88bd3a 669typedef PXE_UINT32 PXE_IPV4;\r
959ccb23 670\r
2f88bd3a 671typedef PXE_UINT32 PXE_IPV6[4];\r
959ccb23 672#define PXE_MAC_LENGTH 32\r
673\r
2f88bd3a 674typedef PXE_UINT8 PXE_MAC_ADDR[PXE_MAC_LENGTH];\r
959ccb23 675\r
2f88bd3a
MK
676typedef PXE_UINT8 PXE_IFTYPE;\r
677typedef UINT16 PXE_MEDIA_PROTOCOL;\r
959ccb23 678\r
3ed785e9 679///\r
680/// This information is from the ARP section of RFC 1700.\r
681///\r
682/// 1 Ethernet (10Mb) [JBP]\r
683/// 2 Experimental Ethernet (3Mb) [JBP]\r
684/// 3 Amateur Radio AX.25 [PXK]\r
685/// 4 Proteon ProNET Token Ring [JBP]\r
686/// 5 Chaos [GXP]\r
687/// 6 IEEE 802 Networks [JBP]\r
688/// 7 ARCNET [JBP]\r
689/// 8 Hyperchannel [JBP]\r
690/// 9 Lanstar [TU]\r
691/// 10 Autonet Short Address [MXB1]\r
692/// 11 LocalTalk [JKR1]\r
693/// 12 LocalNet (IBM* PCNet or SYTEK* LocalNET) [JXM]\r
694/// 13 Ultra link [RXD2]\r
695/// 14 SMDS [GXC1]\r
696/// 15 Frame Relay [AGM]\r
697/// 16 Asynchronous Transmission Mode (ATM) [JXB2]\r
698/// 17 HDLC [JBP]\r
699/// 18 Fibre Channel [Yakov Rekhter]\r
700/// 19 Asynchronous Transmission Mode (ATM) [Mark Laubach]\r
701/// 20 Serial Line [JBP]\r
702/// 21 Asynchronous Transmission Mode (ATM) [MXB1]\r
703///\r
704/// * Other names and brands may be claimed as the property of others.\r
705///\r
959ccb23 706#define PXE_IFTYPE_ETHERNET 0x01\r
707#define PXE_IFTYPE_TOKENRING 0x04\r
708#define PXE_IFTYPE_FIBRE_CHANNEL 0x12\r
709\r
710typedef struct s_pxe_hw_undi {\r
2f88bd3a
MK
711 PXE_UINT32 Signature; ///< PXE_ROMID_SIGNATURE.\r
712 PXE_UINT8 Len; ///< sizeof(PXE_HW_UNDI).\r
713 PXE_UINT8 Fudge; ///< makes 8-bit cksum equal zero.\r
714 PXE_UINT8 Rev; ///< PXE_ROMID_REV.\r
715 PXE_UINT8 IFcnt; ///< physical connector count lower byte.\r
716 PXE_UINT8 MajorVer; ///< PXE_ROMID_MAJORVER.\r
717 PXE_UINT8 MinorVer; ///< PXE_ROMID_MINORVER.\r
718 PXE_UINT8 IFcntExt; ///< physical connector count upper byte.\r
719 PXE_UINT8 reserved; ///< zero, not used.\r
720 PXE_UINT32 Implementation; ///< implementation flags.\r
af2dc6a7 721 ///< reserved ///< vendor use.\r
722 ///< UINT32 Status; ///< status port.\r
723 ///< UINT32 Command; ///< command port.\r
724 ///< UINT64 CDBaddr; ///< CDB address port.\r
3ed785e9 725 ///<\r
959ccb23 726} PXE_HW_UNDI;\r
727\r
3ed785e9 728///\r
af2dc6a7 729/// Status port bit definitions.\r
3ed785e9 730///\r
731\r
732///\r
af2dc6a7 733/// UNDI operation state.\r
3ed785e9 734///\r
959ccb23 735#define PXE_HWSTAT_STATE_MASK 0xC0000000\r
736#define PXE_HWSTAT_BUSY 0xC0000000\r
737#define PXE_HWSTAT_INITIALIZED 0x80000000\r
738#define PXE_HWSTAT_STARTED 0x40000000\r
739#define PXE_HWSTAT_STOPPED 0x00000000\r
740\r
3ed785e9 741///\r
af2dc6a7 742/// If set, last command failed.\r
3ed785e9 743///\r
2f88bd3a 744#define PXE_HWSTAT_COMMAND_FAILED 0x20000000\r
959ccb23 745\r
3ed785e9 746///\r
af2dc6a7 747/// If set, identifies enabled receive filters.\r
3ed785e9 748///\r
2f88bd3a
MK
749#define PXE_HWSTAT_PROMISCUOUS_MULTICAST_RX_ENABLED 0x00001000\r
750#define PXE_HWSTAT_PROMISCUOUS_RX_ENABLED 0x00000800\r
751#define PXE_HWSTAT_BROADCAST_RX_ENABLED 0x00000400\r
752#define PXE_HWSTAT_MULTICAST_RX_ENABLED 0x00000200\r
753#define PXE_HWSTAT_UNICAST_RX_ENABLED 0x00000100\r
959ccb23 754\r
3ed785e9 755///\r
af2dc6a7 756/// If set, identifies enabled external interrupts.\r
3ed785e9 757///\r
2f88bd3a
MK
758#define PXE_HWSTAT_SOFTWARE_INT_ENABLED 0x00000080\r
759#define PXE_HWSTAT_TX_COMPLETE_INT_ENABLED 0x00000040\r
760#define PXE_HWSTAT_PACKET_RX_INT_ENABLED 0x00000020\r
761#define PXE_HWSTAT_CMD_COMPLETE_INT_ENABLED 0x00000010\r
959ccb23 762\r
3ed785e9 763///\r
af2dc6a7 764/// If set, identifies pending interrupts.\r
3ed785e9 765///\r
2f88bd3a
MK
766#define PXE_HWSTAT_SOFTWARE_INT_PENDING 0x00000008\r
767#define PXE_HWSTAT_TX_COMPLETE_INT_PENDING 0x00000004\r
768#define PXE_HWSTAT_PACKET_RX_INT_PENDING 0x00000002\r
769#define PXE_HWSTAT_CMD_COMPLETE_INT_PENDING 0x00000001\r
959ccb23 770\r
3ed785e9 771///\r
af2dc6a7 772/// Command port definitions.\r
3ed785e9 773///\r
774\r
775///\r
776/// If set, CDB identified in CDBaddr port is given to UNDI.\r
777/// If not set, other bits in this word will be processed.\r
778///\r
959ccb23 779#define PXE_HWCMD_ISSUE_COMMAND 0x80000000\r
780#define PXE_HWCMD_INTS_AND_FILTS 0x00000000\r
781\r
3ed785e9 782///\r
783/// Use these to enable/disable receive filters.\r
784///\r
2f88bd3a
MK
785#define PXE_HWCMD_PROMISCUOUS_MULTICAST_RX_ENABLE 0x00001000\r
786#define PXE_HWCMD_PROMISCUOUS_RX_ENABLE 0x00000800\r
787#define PXE_HWCMD_BROADCAST_RX_ENABLE 0x00000400\r
788#define PXE_HWCMD_MULTICAST_RX_ENABLE 0x00000200\r
789#define PXE_HWCMD_UNICAST_RX_ENABLE 0x00000100\r
959ccb23 790\r
3ed785e9 791///\r
af2dc6a7 792/// Use these to enable/disable external interrupts.\r
3ed785e9 793///\r
2f88bd3a
MK
794#define PXE_HWCMD_SOFTWARE_INT_ENABLE 0x00000080\r
795#define PXE_HWCMD_TX_COMPLETE_INT_ENABLE 0x00000040\r
796#define PXE_HWCMD_PACKET_RX_INT_ENABLE 0x00000020\r
797#define PXE_HWCMD_CMD_COMPLETE_INT_ENABLE 0x00000010\r
959ccb23 798\r
3ed785e9 799///\r
af2dc6a7 800/// Use these to clear pending external interrupts.\r
3ed785e9 801///\r
959ccb23 802#define PXE_HWCMD_CLEAR_SOFTWARE_INT 0x00000008\r
803#define PXE_HWCMD_CLEAR_TX_COMPLETE_INT 0x00000004\r
804#define PXE_HWCMD_CLEAR_PACKET_RX_INT 0x00000002\r
805#define PXE_HWCMD_CLEAR_CMD_COMPLETE_INT 0x00000001\r
806\r
807typedef struct s_pxe_sw_undi {\r
2f88bd3a
MK
808 PXE_UINT32 Signature; ///< PXE_ROMID_SIGNATURE.\r
809 PXE_UINT8 Len; ///< sizeof(PXE_SW_UNDI).\r
810 PXE_UINT8 Fudge; ///< makes 8-bit cksum zero.\r
811 PXE_UINT8 Rev; ///< PXE_ROMID_REV.\r
812 PXE_UINT8 IFcnt; ///< physical connector count lower byte.\r
813 PXE_UINT8 MajorVer; ///< PXE_ROMID_MAJORVER.\r
814 PXE_UINT8 MinorVer; ///< PXE_ROMID_MINORVER.\r
815 PXE_UINT8 IFcntExt; ///< physical connector count upper byte.\r
816 PXE_UINT8 reserved1; ///< zero, not used.\r
817 PXE_UINT32 Implementation; ///< Implementation flags.\r
818 PXE_UINT64 EntryPoint; ///< API entry point.\r
819 PXE_UINT8 reserved2[3]; ///< zero, not used.\r
820 PXE_UINT8 BusCnt; ///< number of bustypes supported.\r
821 PXE_UINT32 BusType[1]; ///< list of supported bustypes.\r
959ccb23 822} PXE_SW_UNDI;\r
823\r
824typedef union u_pxe_undi {\r
2f88bd3a
MK
825 PXE_HW_UNDI hw;\r
826 PXE_SW_UNDI sw;\r
959ccb23 827} PXE_UNDI;\r
828\r
3ed785e9 829///\r
af2dc6a7 830/// Signature of !PXE structure.\r
3ed785e9 831///\r
2f88bd3a 832#define PXE_ROMID_SIGNATURE PXE_BUSTYPE ('!', 'P', 'X', 'E')\r
959ccb23 833\r
3ed785e9 834///\r
835/// !PXE structure format revision\r
2f88bd3a
MK
836/// .\r
837#define PXE_ROMID_REV 0x02\r
959ccb23 838\r
3ed785e9 839///\r
840/// UNDI command interface revision. These are the values that get sent\r
841/// in option 94 (Client Network Interface Identifier) in the DHCP Discover\r
842/// and PXE Boot Server Request packets.\r
843///\r
2f88bd3a
MK
844#define PXE_ROMID_MAJORVER 0x03\r
845#define PXE_ROMID_MINORVER 0x01\r
959ccb23 846\r
3ed785e9 847///\r
af2dc6a7 848/// Implementation flags.\r
3ed785e9 849///\r
959ccb23 850#define PXE_ROMID_IMP_HW_UNDI 0x80000000\r
851#define PXE_ROMID_IMP_SW_VIRT_ADDR 0x40000000\r
852#define PXE_ROMID_IMP_64BIT_DEVICE 0x00010000\r
853#define PXE_ROMID_IMP_FRAG_SUPPORTED 0x00008000\r
854#define PXE_ROMID_IMP_CMD_LINK_SUPPORTED 0x00004000\r
855#define PXE_ROMID_IMP_CMD_QUEUE_SUPPORTED 0x00002000\r
856#define PXE_ROMID_IMP_MULTI_FRAME_SUPPORTED 0x00001000\r
857#define PXE_ROMID_IMP_NVDATA_SUPPORT_MASK 0x00000C00\r
858#define PXE_ROMID_IMP_NVDATA_BULK_WRITABLE 0x00000C00\r
859#define PXE_ROMID_IMP_NVDATA_SPARSE_WRITABLE 0x00000800\r
860#define PXE_ROMID_IMP_NVDATA_READ_ONLY 0x00000400\r
861#define PXE_ROMID_IMP_NVDATA_NOT_AVAILABLE 0x00000000\r
862#define PXE_ROMID_IMP_STATISTICS_SUPPORTED 0x00000200\r
863#define PXE_ROMID_IMP_STATION_ADDR_SETTABLE 0x00000100\r
864#define PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED 0x00000080\r
865#define PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED 0x00000040\r
866#define PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED 0x00000020\r
867#define PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED 0x00000010\r
868#define PXE_ROMID_IMP_SOFTWARE_INT_SUPPORTED 0x00000008\r
869#define PXE_ROMID_IMP_TX_COMPLETE_INT_SUPPORTED 0x00000004\r
870#define PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED 0x00000002\r
871#define PXE_ROMID_IMP_CMD_COMPLETE_INT_SUPPORTED 0x00000001\r
872\r
873typedef struct s_pxe_cdb {\r
2f88bd3a
MK
874 PXE_OPCODE OpCode;\r
875 PXE_OPFLAGS OpFlags;\r
876 PXE_UINT16 CPBsize;\r
877 PXE_UINT16 DBsize;\r
878 PXE_UINT64 CPBaddr;\r
879 PXE_UINT64 DBaddr;\r
880 PXE_STATCODE StatCode;\r
881 PXE_STATFLAGS StatFlags;\r
882 PXE_UINT16 IFnum;\r
883 PXE_CONTROL Control;\r
959ccb23 884} PXE_CDB;\r
885\r
886typedef union u_pxe_ip_addr {\r
2f88bd3a
MK
887 PXE_IPV6 IPv6;\r
888 PXE_IPV4 IPv4;\r
959ccb23 889} PXE_IP_ADDR;\r
890\r
891typedef union pxe_device {\r
3ed785e9 892 ///\r
893 /// PCI and PC Card NICs are both identified using bus, device\r
894 /// and function numbers. For PC Card, this may require PC\r
895 /// Card services to be loaded in the BIOS or preboot\r
896 /// environment.\r
897 ///\r
959ccb23 898 struct {\r
3ed785e9 899 ///\r
900 /// See S/W UNDI ROMID structure definition for PCI and\r
901 /// PCC BusType definitions.\r
902 ///\r
2f88bd3a 903 PXE_UINT32 BusType;\r
959ccb23 904\r
3ed785e9 905 ///\r
906 /// Bus, device & function numbers that locate this device.\r
907 ///\r
2f88bd3a
MK
908 PXE_UINT16 Bus;\r
909 PXE_UINT8 Device;\r
910 PXE_UINT8 Function;\r
911 } PCI, PCC;\r
959ccb23 912} PXE_DEVICE;\r
913\r
3ed785e9 914///\r
915/// cpb and db definitions\r
916///\r
2f88bd3a
MK
917#define MAX_PCI_CONFIG_LEN 64 ///< # of dwords.\r
918#define MAX_EEPROM_LEN 128 ///< # of dwords.\r
919#define MAX_XMIT_BUFFERS 32 ///< recycling Q length for xmit_done.\r
920#define MAX_MCAST_ADDRESS_CNT 8\r
959ccb23 921\r
922typedef struct s_pxe_cpb_start_30 {\r
3ed785e9 923 ///\r
924 /// PXE_VOID Delay(UINTN microseconds);\r
925 ///\r
926 /// UNDI will never request a delay smaller than 10 microseconds\r
927 /// and will always request delays in increments of 10 microseconds.\r
928 /// The Delay() CallBack routine must delay between n and n + 10\r
929 /// microseconds before returning control to the UNDI.\r
930 ///\r
931 /// This field cannot be set to zero.\r
932 ///\r
2f88bd3a 933 UINT64 Delay;\r
959ccb23 934\r
3ed785e9 935 ///\r
936 /// PXE_VOID Block(UINT32 enable);\r
937 ///\r
938 /// UNDI may need to block multi-threaded/multi-processor access to\r
939 /// critical code sections when programming or accessing the network\r
940 /// device. To this end, a blocking service is needed by the UNDI.\r
941 /// When UNDI needs a block, it will call Block() passing a non-zero\r
942 /// value. When UNDI no longer needs a block, it will call Block()\r
943 /// with a zero value. When called, if the Block() is already enabled,\r
944 /// do not return control to the UNDI until the previous Block() is\r
945 /// disabled.\r
946 ///\r
947 /// This field cannot be set to zero.\r
948 ///\r
2f88bd3a 949 UINT64 Block;\r
959ccb23 950\r
3ed785e9 951 ///\r
952 /// PXE_VOID Virt2Phys(UINT64 virtual, UINT64 physical_ptr);\r
953 ///\r
954 /// UNDI will pass the virtual address of a buffer and the virtual\r
955 /// address of a 64-bit physical buffer. Convert the virtual address\r
956 /// to a physical address and write the result to the physical address\r
957 /// buffer. If virtual and physical addresses are the same, just\r
958 /// copy the virtual address to the physical address buffer.\r
959 ///\r
960 /// This field can be set to zero if virtual and physical addresses\r
961 /// are equal.\r
962 ///\r
2f88bd3a 963 UINT64 Virt2Phys;\r
3ed785e9 964 ///\r
965 /// PXE_VOID Mem_IO(UINT8 read_write, UINT8 len, UINT64 port,\r
966 /// UINT64 buf_addr);\r
967 ///\r
968 /// UNDI will read or write the device io space using this call back\r
969 /// function. It passes the number of bytes as the len parameter and it\r
970 /// will be either 1,2,4 or 8.\r
971 ///\r
972 /// This field can not be set to zero.\r
973 ///\r
2f88bd3a 974 UINT64 Mem_IO;\r
959ccb23 975} PXE_CPB_START_30;\r
976\r
977typedef struct s_pxe_cpb_start_31 {\r
3ed785e9 978 ///\r
979 /// PXE_VOID Delay(UINT64 UnqId, UINTN microseconds);\r
980 ///\r
981 /// UNDI will never request a delay smaller than 10 microseconds\r
982 /// and will always request delays in increments of 10 microseconds.\r
983 /// The Delay() CallBack routine must delay between n and n + 10\r
984 /// microseconds before returning control to the UNDI.\r
985 ///\r
986 /// This field cannot be set to zero.\r
987 ///\r
2f88bd3a 988 UINT64 Delay;\r
959ccb23 989\r
3ed785e9 990 ///\r
991 /// PXE_VOID Block(UINT64 unq_id, UINT32 enable);\r
992 ///\r
993 /// UNDI may need to block multi-threaded/multi-processor access to\r
994 /// critical code sections when programming or accessing the network\r
995 /// device. To this end, a blocking service is needed by the UNDI.\r
996 /// When UNDI needs a block, it will call Block() passing a non-zero\r
997 /// value. When UNDI no longer needs a block, it will call Block()\r
998 /// with a zero value. When called, if the Block() is already enabled,\r
999 /// do not return control to the UNDI until the previous Block() is\r
1000 /// disabled.\r
1001 ///\r
1002 /// This field cannot be set to zero.\r
1003 ///\r
2f88bd3a 1004 UINT64 Block;\r
959ccb23 1005\r
3ed785e9 1006 ///\r
1007 /// PXE_VOID Virt2Phys(UINT64 UnqId, UINT64 virtual, UINT64 physical_ptr);\r
1008 ///\r
1009 /// UNDI will pass the virtual address of a buffer and the virtual\r
1010 /// address of a 64-bit physical buffer. Convert the virtual address\r
1011 /// to a physical address and write the result to the physical address\r
1012 /// buffer. If virtual and physical addresses are the same, just\r
1013 /// copy the virtual address to the physical address buffer.\r
1014 ///\r
1015 /// This field can be set to zero if virtual and physical addresses\r
1016 /// are equal.\r
1017 ///\r
2f88bd3a 1018 UINT64 Virt2Phys;\r
3ed785e9 1019 ///\r
1020 /// PXE_VOID Mem_IO(UINT64 UnqId, UINT8 read_write, UINT8 len, UINT64 port,\r
1021 /// UINT64 buf_addr);\r
1022 ///\r
1023 /// UNDI will read or write the device io space using this call back\r
1024 /// function. It passes the number of bytes as the len parameter and it\r
1025 /// will be either 1,2,4 or 8.\r
1026 ///\r
1027 /// This field can not be set to zero.\r
1028 ///\r
2f88bd3a 1029 UINT64 Mem_IO;\r
3ed785e9 1030 ///\r
1031 /// PXE_VOID Map_Mem(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,\r
1032 /// UINT32 Direction, UINT64 mapped_addr);\r
1033 ///\r
1034 /// UNDI will pass the virtual address of a buffer, direction of the data\r
1035 /// flow from/to the mapped buffer (the constants are defined below)\r
1036 /// and a place holder (pointer) for the mapped address.\r
1037 /// This call will Map the given address to a physical DMA address and write\r
1038 /// the result to the mapped_addr pointer. If there is no need to\r
1039 /// map the given address to a lower address (i.e. the given address is\r
1040 /// associated with a physical address that is already compatible to be\r
1041 /// used with the DMA, it converts the given virtual address to it's\r
1042 /// physical address and write that in the mapped address pointer.\r
1043 ///\r
af2dc6a7 1044 /// This field can be set to zero if there is no mapping service available.\r
3ed785e9 1045 ///\r
2f88bd3a 1046 UINT64 Map_Mem;\r
959ccb23 1047\r
3ed785e9 1048 ///\r
1049 /// PXE_VOID UnMap_Mem(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,\r
1050 /// UINT32 Direction, UINT64 mapped_addr);\r
1051 ///\r
af2dc6a7 1052 /// UNDI will pass the virtual and mapped addresses of a buffer.\r
1053 /// This call will un map the given address.\r
3ed785e9 1054 ///\r
af2dc6a7 1055 /// This field can be set to zero if there is no unmapping service available.\r
3ed785e9 1056 ///\r
2f88bd3a 1057 UINT64 UnMap_Mem;\r
959ccb23 1058\r
3ed785e9 1059 ///\r
1060 /// PXE_VOID Sync_Mem(UINT64 unq_id, UINT64 virtual,\r
1061 /// UINT32 size, UINT32 Direction, UINT64 mapped_addr);\r
1062 ///\r
af2dc6a7 1063 /// UNDI will pass the virtual and mapped addresses of a buffer.\r
1064 /// This call will synchronize the contents of both the virtual and mapped.\r
3ed785e9 1065 /// buffers for the given Direction.\r
1066 ///\r
af2dc6a7 1067 /// This field can be set to zero if there is no service available.\r
3ed785e9 1068 ///\r
2f88bd3a 1069 UINT64 Sync_Mem;\r
959ccb23 1070\r
3ed785e9 1071 ///\r
1072 /// protocol driver can provide anything for this Unique_ID, UNDI remembers\r
00b7cc0f 1073 /// that as just a 64bit value associated to the interface specified by\r
3ed785e9 1074 /// the ifnum and gives it back as a parameter to all the call-back routines\r
1075 /// when calling for that interface!\r
1076 ///\r
2f88bd3a 1077 UINT64 Unique_ID;\r
959ccb23 1078} PXE_CPB_START_31;\r
1079\r
2f88bd3a
MK
1080#define TO_AND_FROM_DEVICE 0\r
1081#define FROM_DEVICE 1\r
1082#define TO_DEVICE 2\r
959ccb23 1083\r
2f88bd3a
MK
1084#define PXE_DELAY_MILLISECOND 1000\r
1085#define PXE_DELAY_SECOND 1000000\r
1086#define PXE_IO_READ 0\r
1087#define PXE_IO_WRITE 1\r
1088#define PXE_MEM_READ 2\r
1089#define PXE_MEM_WRITE 4\r
959ccb23 1090\r
1091typedef struct s_pxe_db_get_init_info {\r
3ed785e9 1092 ///\r
1093 /// Minimum length of locked memory buffer that must be given to\r
1094 /// the Initialize command. Giving UNDI more memory will generally\r
1095 /// give better performance.\r
1096 ///\r
1097 /// If MemoryRequired is zero, the UNDI does not need and will not\r
1098 /// use system memory to receive and transmit packets.\r
1099 ///\r
2f88bd3a 1100 PXE_UINT32 MemoryRequired;\r
959ccb23 1101\r
3ed785e9 1102 ///\r
1103 /// Maximum frame data length for Tx/Rx excluding the media header.\r
1104 ///\r
2f88bd3a 1105 PXE_UINT32 FrameDataLen;\r
959ccb23 1106\r
3ed785e9 1107 ///\r
1108 /// Supported link speeds are in units of mega bits. Common ethernet\r
1109 /// values are 10, 100 and 1000. Unused LinkSpeeds[] entries are zero\r
1110 /// filled.\r
1111 ///\r
2f88bd3a 1112 PXE_UINT32 LinkSpeeds[4];\r
959ccb23 1113\r
3ed785e9 1114 ///\r
1115 /// Number of non-volatile storage items.\r
1116 ///\r
2f88bd3a 1117 PXE_UINT32 NvCount;\r
959ccb23 1118\r
3ed785e9 1119 ///\r
1120 /// Width of non-volatile storage item in bytes. 0, 1, 2 or 4\r
1121 ///\r
2f88bd3a 1122 PXE_UINT16 NvWidth;\r
959ccb23 1123\r
3ed785e9 1124 ///\r
1125 /// Media header length. This is the typical media header length for\r
1126 /// this UNDI. This information is needed when allocating receive\r
1127 /// and transmit buffers.\r
1128 ///\r
2f88bd3a 1129 PXE_UINT16 MediaHeaderLen;\r
959ccb23 1130\r
3ed785e9 1131 ///\r
1132 /// Number of bytes in the NIC hardware (MAC) address.\r
1133 ///\r
2f88bd3a 1134 PXE_UINT16 HWaddrLen;\r
959ccb23 1135\r
3ed785e9 1136 ///\r
1137 /// Maximum number of multicast MAC addresses in the multicast\r
1138 /// MAC address filter list.\r
1139 ///\r
2f88bd3a 1140 PXE_UINT16 MCastFilterCnt;\r
959ccb23 1141\r
3ed785e9 1142 ///\r
1143 /// Default number and size of transmit and receive buffers that will\r
1144 /// be allocated by the UNDI. If MemoryRequired is non-zero, this\r
1145 /// allocation will come out of the memory buffer given to the Initialize\r
1146 /// command. If MemoryRequired is zero, this allocation will come out of\r
1147 /// memory on the NIC.\r
1148 ///\r
2f88bd3a
MK
1149 PXE_UINT16 TxBufCnt;\r
1150 PXE_UINT16 TxBufSize;\r
1151 PXE_UINT16 RxBufCnt;\r
1152 PXE_UINT16 RxBufSize;\r
959ccb23 1153\r
3ed785e9 1154 ///\r
1155 /// Hardware interface types defined in the Assigned Numbers RFC\r
1156 /// and used in DHCP and ARP packets.\r
1157 /// See the PXE_IFTYPE typedef and PXE_IFTYPE_xxx macros.\r
1158 ///\r
2f88bd3a 1159 PXE_UINT8 IFtype;\r
959ccb23 1160\r
3ed785e9 1161 ///\r
1162 /// Supported duplex. See PXE_DUPLEX_xxxxx #defines below.\r
1163 ///\r
2f88bd3a 1164 PXE_UINT8 SupportedDuplexModes;\r
959ccb23 1165\r
3ed785e9 1166 ///\r
1167 /// Supported loopback options. See PXE_LOOPBACK_xxxxx #defines below.\r
1168 ///\r
2f88bd3a 1169 PXE_UINT8 SupportedLoopBackModes;\r
959ccb23 1170} PXE_DB_GET_INIT_INFO;\r
1171\r
2f88bd3a 1172#define PXE_MAX_TXRX_UNIT_ETHER 1500\r
959ccb23 1173\r
2f88bd3a
MK
1174#define PXE_HWADDR_LEN_ETHER 0x0006\r
1175#define PXE_MAC_HEADER_LEN_ETHER 0x000E\r
959ccb23 1176\r
1177#define PXE_DUPLEX_ENABLE_FULL_SUPPORTED 1\r
1178#define PXE_DUPLEX_FORCE_FULL_SUPPORTED 2\r
1179\r
2f88bd3a
MK
1180#define PXE_LOOPBACK_INTERNAL_SUPPORTED 1\r
1181#define PXE_LOOPBACK_EXTERNAL_SUPPORTED 2\r
959ccb23 1182\r
1183typedef struct s_pxe_pci_config_info {\r
3ed785e9 1184 ///\r
1185 /// This is the flag field for the PXE_DB_GET_CONFIG_INFO union.\r
1186 /// For PCI bus devices, this field is set to PXE_BUSTYPE_PCI.\r
1187 ///\r
2f88bd3a 1188 UINT32 BusType;\r
959ccb23 1189\r
3ed785e9 1190 ///\r
af2dc6a7 1191 /// This identifies the PCI network device that this UNDI interface.\r
3ed785e9 1192 /// is bound to.\r
1193 ///\r
2f88bd3a
MK
1194 UINT16 Bus;\r
1195 UINT8 Device;\r
1196 UINT8 Function;\r
959ccb23 1197\r
3ed785e9 1198 ///\r
1199 /// This is a copy of the PCI configuration space for this\r
1200 /// network device.\r
1201 ///\r
959ccb23 1202 union {\r
2f88bd3a
MK
1203 UINT8 Byte[256];\r
1204 UINT16 Word[128];\r
1205 UINT32 Dword[64];\r
959ccb23 1206 } Config;\r
1207} PXE_PCI_CONFIG_INFO;\r
1208\r
1209typedef struct s_pxe_pcc_config_info {\r
3ed785e9 1210 ///\r
1211 /// This is the flag field for the PXE_DB_GET_CONFIG_INFO union.\r
1212 /// For PCC bus devices, this field is set to PXE_BUSTYPE_PCC.\r
1213 ///\r
2f88bd3a 1214 PXE_UINT32 BusType;\r
959ccb23 1215\r
3ed785e9 1216 ///\r
1217 /// This identifies the PCC network device that this UNDI interface\r
1218 /// is bound to.\r
1219 ///\r
2f88bd3a
MK
1220 PXE_UINT16 Bus;\r
1221 PXE_UINT8 Device;\r
1222 PXE_UINT8 Function;\r
959ccb23 1223\r
3ed785e9 1224 ///\r
1225 /// This is a copy of the PCC configuration space for this\r
1226 /// network device.\r
1227 ///\r
959ccb23 1228 union {\r
2f88bd3a
MK
1229 PXE_UINT8 Byte[256];\r
1230 PXE_UINT16 Word[128];\r
1231 PXE_UINT32 Dword[64];\r
959ccb23 1232 } Config;\r
1233} PXE_PCC_CONFIG_INFO;\r
1234\r
1235typedef union u_pxe_db_get_config_info {\r
2f88bd3a
MK
1236 PXE_PCI_CONFIG_INFO pci;\r
1237 PXE_PCC_CONFIG_INFO pcc;\r
959ccb23 1238} PXE_DB_GET_CONFIG_INFO;\r
1239\r
1240typedef struct s_pxe_cpb_initialize {\r
3ed785e9 1241 ///\r
1242 /// Address of first (lowest) byte of the memory buffer. This buffer must\r
1243 /// be in contiguous physical memory and cannot be swapped out. The UNDI\r
1244 /// will be using this for transmit and receive buffering.\r
1245 ///\r
2f88bd3a 1246 PXE_UINT64 MemoryAddr;\r
959ccb23 1247\r
3ed785e9 1248 ///\r
1249 /// MemoryLength must be greater than or equal to MemoryRequired\r
1250 /// returned by the Get Init Info command.\r
1251 ///\r
2f88bd3a 1252 PXE_UINT32 MemoryLength;\r
959ccb23 1253\r
3ed785e9 1254 ///\r
1255 /// Desired link speed in Mbit/sec. Common ethernet values are 10, 100\r
1256 /// and 1000. Setting a value of zero will auto-detect and/or use the\r
1257 /// default link speed (operation depends on UNDI/NIC functionality).\r
1258 ///\r
2f88bd3a 1259 PXE_UINT32 LinkSpeed;\r
959ccb23 1260\r
3ed785e9 1261 ///\r
1262 /// Suggested number and size of receive and transmit buffers to\r
1263 /// allocate. If MemoryAddr and MemoryLength are non-zero, this\r
1264 /// allocation comes out of the supplied memory buffer. If MemoryAddr\r
1265 /// and MemoryLength are zero, this allocation comes out of memory\r
1266 /// on the NIC.\r
1267 ///\r
1268 /// If these fields are set to zero, the UNDI will allocate buffer\r
1269 /// counts and sizes as it sees fit.\r
1270 ///\r
2f88bd3a
MK
1271 PXE_UINT16 TxBufCnt;\r
1272 PXE_UINT16 TxBufSize;\r
1273 PXE_UINT16 RxBufCnt;\r
1274 PXE_UINT16 RxBufSize;\r
959ccb23 1275\r
3ed785e9 1276 ///\r
1277 /// The following configuration parameters are optional and must be zero\r
1278 /// to use the default values.\r
1279 ///\r
2f88bd3a 1280 PXE_UINT8 DuplexMode;\r
959ccb23 1281\r
2f88bd3a 1282 PXE_UINT8 LoopBackMode;\r
959ccb23 1283} PXE_CPB_INITIALIZE;\r
1284\r
2f88bd3a
MK
1285#define PXE_DUPLEX_DEFAULT 0x00\r
1286#define PXE_FORCE_FULL_DUPLEX 0x01\r
1287#define PXE_ENABLE_FULL_DUPLEX 0x02\r
1288#define PXE_FORCE_HALF_DUPLEX 0x04\r
1289#define PXE_DISABLE_FULL_DUPLEX 0x08\r
959ccb23 1290\r
2f88bd3a
MK
1291#define LOOPBACK_NORMAL 0\r
1292#define LOOPBACK_INTERNAL 1\r
1293#define LOOPBACK_EXTERNAL 2\r
959ccb23 1294\r
1295typedef struct s_pxe_db_initialize {\r
3ed785e9 1296 ///\r
1297 /// Actual amount of memory used from the supplied memory buffer. This\r
1298 /// may be less that the amount of memory suppllied and may be zero if\r
1299 /// the UNDI and network device do not use external memory buffers.\r
1300 ///\r
1301 /// Memory used by the UNDI and network device is allocated from the\r
1302 /// lowest memory buffer address.\r
1303 ///\r
2f88bd3a 1304 PXE_UINT32 MemoryUsed;\r
959ccb23 1305\r
3ed785e9 1306 ///\r
1307 /// Actual number and size of receive and transmit buffers that were\r
1308 /// allocated.\r
1309 ///\r
2f88bd3a
MK
1310 PXE_UINT16 TxBufCnt;\r
1311 PXE_UINT16 TxBufSize;\r
1312 PXE_UINT16 RxBufCnt;\r
1313 PXE_UINT16 RxBufSize;\r
959ccb23 1314} PXE_DB_INITIALIZE;\r
1315\r
1316typedef struct s_pxe_cpb_receive_filters {\r
3ed785e9 1317 ///\r
1318 /// List of multicast MAC addresses. This list, if present, will\r
1319 /// replace the existing multicast MAC address filter list.\r
1320 ///\r
2f88bd3a 1321 PXE_MAC_ADDR MCastList[MAX_MCAST_ADDRESS_CNT];\r
959ccb23 1322} PXE_CPB_RECEIVE_FILTERS;\r
1323\r
1324typedef struct s_pxe_db_receive_filters {\r
3ed785e9 1325 ///\r
1326 /// Filtered multicast MAC address list.\r
1327 ///\r
2f88bd3a 1328 PXE_MAC_ADDR MCastList[MAX_MCAST_ADDRESS_CNT];\r
959ccb23 1329} PXE_DB_RECEIVE_FILTERS;\r
1330\r
1331typedef struct s_pxe_cpb_station_address {\r
3ed785e9 1332 ///\r
1333 /// If supplied and supported, the current station MAC address\r
1334 /// will be changed.\r
1335 ///\r
2f88bd3a 1336 PXE_MAC_ADDR StationAddr;\r
959ccb23 1337} PXE_CPB_STATION_ADDRESS;\r
1338\r
1339typedef struct s_pxe_dpb_station_address {\r
3ed785e9 1340 ///\r
1341 /// Current station MAC address.\r
1342 ///\r
2f88bd3a 1343 PXE_MAC_ADDR StationAddr;\r
959ccb23 1344\r
3ed785e9 1345 ///\r
1346 /// Station broadcast MAC address.\r
1347 ///\r
2f88bd3a 1348 PXE_MAC_ADDR BroadcastAddr;\r
959ccb23 1349\r
3ed785e9 1350 ///\r
1351 /// Permanent station MAC address.\r
1352 ///\r
2f88bd3a 1353 PXE_MAC_ADDR PermanentAddr;\r
959ccb23 1354} PXE_DB_STATION_ADDRESS;\r
1355\r
1356typedef struct s_pxe_db_statistics {\r
3ed785e9 1357 ///\r
1358 /// Bit field identifying what statistic data is collected by the\r
1359 /// UNDI/NIC.\r
1360 /// If bit 0x00 is set, Data[0x00] is collected.\r
1361 /// If bit 0x01 is set, Data[0x01] is collected.\r
1362 /// If bit 0x20 is set, Data[0x20] is collected.\r
1363 /// If bit 0x21 is set, Data[0x21] is collected.\r
1364 /// Etc.\r
1365 ///\r
2f88bd3a 1366 PXE_UINT64 Supported;\r
959ccb23 1367\r
3ed785e9 1368 ///\r
1369 /// Statistic data.\r
1370 ///\r
2f88bd3a 1371 PXE_UINT64 Data[64];\r
959ccb23 1372} PXE_DB_STATISTICS;\r
1373\r
3ed785e9 1374///\r
1375/// Total number of frames received. Includes frames with errors and\r
1376/// dropped frames.\r
1377///\r
959ccb23 1378#define PXE_STATISTICS_RX_TOTAL_FRAMES 0x00\r
1379\r
3ed785e9 1380///\r
1381/// Number of valid frames received and copied into receive buffers.\r
1382///\r
2f88bd3a 1383#define PXE_STATISTICS_RX_GOOD_FRAMES 0x01\r
959ccb23 1384\r
3ed785e9 1385///\r
1386/// Number of frames below the minimum length for the media.\r
1387/// This would be <64 for ethernet.\r
1388///\r
959ccb23 1389#define PXE_STATISTICS_RX_UNDERSIZE_FRAMES 0x02\r
1390\r
3ed785e9 1391///\r
1392/// Number of frames longer than the maxminum length for the\r
1393/// media. This would be >1500 for ethernet.\r
1394///\r
2f88bd3a 1395#define PXE_STATISTICS_RX_OVERSIZE_FRAMES 0x03\r
959ccb23 1396\r
3ed785e9 1397///\r
1398/// Valid frames that were dropped because receive buffers were full.\r
1399///\r
959ccb23 1400#define PXE_STATISTICS_RX_DROPPED_FRAMES 0x04\r
1401\r
3ed785e9 1402///\r
1403/// Number of valid unicast frames received and not dropped.\r
1404///\r
959ccb23 1405#define PXE_STATISTICS_RX_UNICAST_FRAMES 0x05\r
1406\r
3ed785e9 1407///\r
1408/// Number of valid broadcast frames received and not dropped.\r
1409///\r
959ccb23 1410#define PXE_STATISTICS_RX_BROADCAST_FRAMES 0x06\r
1411\r
3ed785e9 1412///\r
1413/// Number of valid mutlicast frames received and not dropped.\r
1414///\r
959ccb23 1415#define PXE_STATISTICS_RX_MULTICAST_FRAMES 0x07\r
1416\r
3ed785e9 1417///\r
1418/// Number of frames w/ CRC or alignment errors.\r
1419///\r
959ccb23 1420#define PXE_STATISTICS_RX_CRC_ERROR_FRAMES 0x08\r
1421\r
3ed785e9 1422///\r
1423/// Total number of bytes received. Includes frames with errors\r
1424/// and dropped frames.\r
1425///\r
2f88bd3a 1426#define PXE_STATISTICS_RX_TOTAL_BYTES 0x09\r
959ccb23 1427\r
3ed785e9 1428///\r
1429/// Transmit statistics.\r
1430///\r
959ccb23 1431#define PXE_STATISTICS_TX_TOTAL_FRAMES 0x0A\r
1432#define PXE_STATISTICS_TX_GOOD_FRAMES 0x0B\r
1433#define PXE_STATISTICS_TX_UNDERSIZE_FRAMES 0x0C\r
1434#define PXE_STATISTICS_TX_OVERSIZE_FRAMES 0x0D\r
1435#define PXE_STATISTICS_TX_DROPPED_FRAMES 0x0E\r
1436#define PXE_STATISTICS_TX_UNICAST_FRAMES 0x0F\r
1437#define PXE_STATISTICS_TX_BROADCAST_FRAMES 0x10\r
1438#define PXE_STATISTICS_TX_MULTICAST_FRAMES 0x11\r
1439#define PXE_STATISTICS_TX_CRC_ERROR_FRAMES 0x12\r
1440#define PXE_STATISTICS_TX_TOTAL_BYTES 0x13\r
1441\r
3ed785e9 1442///\r
1443/// Number of collisions detection on this subnet.\r
1444///\r
2f88bd3a 1445#define PXE_STATISTICS_COLLISIONS 0x14\r
959ccb23 1446\r
3ed785e9 1447///\r
1448/// Number of frames destined for unsupported protocol.\r
1449///\r
2f88bd3a 1450#define PXE_STATISTICS_UNSUPPORTED_PROTOCOL 0x15\r
959ccb23 1451\r
b4bddb6e
ZL
1452///\r
1453/// Number of valid frames received that were duplicated.\r
1454///\r
2f88bd3a 1455#define PXE_STATISTICS_RX_DUPLICATED_FRAMES 0x16\r
b4bddb6e
ZL
1456\r
1457///\r
1458/// Number of encrypted frames received that failed to decrypt.\r
1459///\r
2f88bd3a 1460#define PXE_STATISTICS_RX_DECRYPT_ERROR_FRAMES 0x17\r
b4bddb6e
ZL
1461\r
1462///\r
1463/// Number of frames that failed to transmit after exceeding the retry limit.\r
1464///\r
2f88bd3a 1465#define PXE_STATISTICS_TX_ERROR_FRAMES 0x18\r
b4bddb6e
ZL
1466\r
1467///\r
1468/// Number of frames transmitted successfully after more than one attempt.\r
1469///\r
2f88bd3a 1470#define PXE_STATISTICS_TX_RETRY_FRAMES 0x19\r
b4bddb6e 1471\r
959ccb23 1472typedef struct s_pxe_cpb_mcast_ip_to_mac {\r
3ed785e9 1473 ///\r
1474 /// Multicast IP address to be converted to multicast MAC address.\r
1475 ///\r
2f88bd3a 1476 PXE_IP_ADDR IP;\r
959ccb23 1477} PXE_CPB_MCAST_IP_TO_MAC;\r
1478\r
1479typedef struct s_pxe_db_mcast_ip_to_mac {\r
3ed785e9 1480 ///\r
1481 /// Multicast MAC address.\r
1482 ///\r
2f88bd3a 1483 PXE_MAC_ADDR MAC;\r
959ccb23 1484} PXE_DB_MCAST_IP_TO_MAC;\r
1485\r
1486typedef struct s_pxe_cpb_nvdata_sparse {\r
3ed785e9 1487 ///\r
1488 /// NvData item list. Only items in this list will be updated.\r
1489 ///\r
959ccb23 1490 struct {\r
3ed785e9 1491 ///\r
1492 /// Non-volatile storage address to be changed.\r
1493 ///\r
2f88bd3a 1494 PXE_UINT32 Addr;\r
959ccb23 1495\r
3ed785e9 1496 ///\r
1497 /// Data item to write into above storage address.\r
1498 ///\r
959ccb23 1499 union {\r
2f88bd3a
MK
1500 PXE_UINT8 Byte;\r
1501 PXE_UINT16 Word;\r
1502 PXE_UINT32 Dword;\r
959ccb23 1503 } Data;\r
1504 } Item[MAX_EEPROM_LEN];\r
3ed785e9 1505} PXE_CPB_NVDATA_SPARSE;\r
959ccb23 1506\r
3ed785e9 1507///\r
1508/// When using bulk update, the size of the CPB structure must be\r
1509/// the same size as the non-volatile NIC storage.\r
1510///\r
959ccb23 1511typedef union u_pxe_cpb_nvdata_bulk {\r
3ed785e9 1512 ///\r
1513 /// Array of byte-wide data items.\r
1514 ///\r
2f88bd3a 1515 PXE_UINT8 Byte[MAX_EEPROM_LEN << 2];\r
959ccb23 1516\r
3ed785e9 1517 ///\r
1518 /// Array of word-wide data items.\r
1519 ///\r
2f88bd3a 1520 PXE_UINT16 Word[MAX_EEPROM_LEN << 1];\r
959ccb23 1521\r
3ed785e9 1522 ///\r
1523 /// Array of dword-wide data items.\r
1524 ///\r
2f88bd3a 1525 PXE_UINT32 Dword[MAX_EEPROM_LEN];\r
959ccb23 1526} PXE_CPB_NVDATA_BULK;\r
1527\r
1528typedef struct s_pxe_db_nvdata {\r
3ed785e9 1529 ///\r
1530 /// Arrays of data items from non-volatile storage.\r
1531 ///\r
959ccb23 1532 union {\r
3ed785e9 1533 ///\r
1534 /// Array of byte-wide data items.\r
1535 ///\r
2f88bd3a 1536 PXE_UINT8 Byte[MAX_EEPROM_LEN << 2];\r
959ccb23 1537\r
3ed785e9 1538 ///\r
1539 /// Array of word-wide data items.\r
1540 ///\r
2f88bd3a 1541 PXE_UINT16 Word[MAX_EEPROM_LEN << 1];\r
959ccb23 1542\r
3ed785e9 1543 ///\r
1544 /// Array of dword-wide data items.\r
1545 ///\r
2f88bd3a 1546 PXE_UINT32 Dword[MAX_EEPROM_LEN];\r
959ccb23 1547 } Data;\r
1548} PXE_DB_NVDATA;\r
1549\r
1550typedef struct s_pxe_db_get_status {\r
3ed785e9 1551 ///\r
1552 /// Length of next receive frame (header + data). If this is zero,\r
1553 /// there is no next receive frame available.\r
1554 ///\r
2f88bd3a 1555 PXE_UINT32 RxFrameLen;\r
959ccb23 1556\r
3ed785e9 1557 ///\r
1558 /// Reserved, set to zero.\r
1559 ///\r
2f88bd3a 1560 PXE_UINT32 reserved;\r
959ccb23 1561\r
3ed785e9 1562 ///\r
1563 /// Addresses of transmitted buffers that need to be recycled.\r
1564 ///\r
2f88bd3a 1565 PXE_UINT64 TxBuffer[MAX_XMIT_BUFFERS];\r
959ccb23 1566} PXE_DB_GET_STATUS;\r
1567\r
1568typedef struct s_pxe_cpb_fill_header {\r
3ed785e9 1569 ///\r
1570 /// Source and destination MAC addresses. These will be copied into\r
1571 /// the media header without doing byte swapping.\r
1572 ///\r
2f88bd3a
MK
1573 PXE_MAC_ADDR SrcAddr;\r
1574 PXE_MAC_ADDR DestAddr;\r
959ccb23 1575\r
3ed785e9 1576 ///\r
1577 /// Address of first byte of media header. The first byte of packet data\r
1578 /// follows the last byte of the media header.\r
1579 ///\r
2f88bd3a 1580 PXE_UINT64 MediaHeader;\r
959ccb23 1581\r
3ed785e9 1582 ///\r
1583 /// Length of packet data in bytes (not including the media header).\r
1584 ///\r
2f88bd3a 1585 PXE_UINT32 PacketLen;\r
959ccb23 1586\r
3ed785e9 1587 ///\r
1588 /// Protocol type. This will be copied into the media header without\r
1589 /// doing byte swapping. Protocol type numbers can be obtained from\r
1590 /// the Assigned Numbers RFC 1700.\r
1591 ///\r
2f88bd3a 1592 PXE_UINT16 Protocol;\r
959ccb23 1593\r
3ed785e9 1594 ///\r
1595 /// Length of the media header in bytes.\r
1596 ///\r
2f88bd3a 1597 PXE_UINT16 MediaHeaderLen;\r
959ccb23 1598} PXE_CPB_FILL_HEADER;\r
1599\r
2f88bd3a
MK
1600#define PXE_PROTOCOL_ETHERNET_IP 0x0800\r
1601#define PXE_PROTOCOL_ETHERNET_ARP 0x0806\r
1602#define MAX_XMIT_FRAGMENTS 16\r
959ccb23 1603\r
1604typedef struct s_pxe_cpb_fill_header_fragmented {\r
3ed785e9 1605 ///\r
1606 /// Source and destination MAC addresses. These will be copied into\r
1607 /// the media header without doing byte swapping.\r
1608 ///\r
2f88bd3a
MK
1609 PXE_MAC_ADDR SrcAddr;\r
1610 PXE_MAC_ADDR DestAddr;\r
959ccb23 1611\r
3ed785e9 1612 ///\r
1613 /// Length of packet data in bytes (not including the media header).\r
1614 ///\r
2f88bd3a 1615 PXE_UINT32 PacketLen;\r
959ccb23 1616\r
3ed785e9 1617 ///\r
1618 /// Protocol type. This will be copied into the media header without\r
1619 /// doing byte swapping. Protocol type numbers can be obtained from\r
1620 /// the Assigned Numbers RFC 1700.\r
1621 ///\r
2f88bd3a 1622 PXE_MEDIA_PROTOCOL Protocol;\r
959ccb23 1623\r
3ed785e9 1624 ///\r
1625 /// Length of the media header in bytes.\r
1626 ///\r
2f88bd3a 1627 PXE_UINT16 MediaHeaderLen;\r
959ccb23 1628\r
3ed785e9 1629 ///\r
1630 /// Number of packet fragment descriptors.\r
1631 ///\r
2f88bd3a 1632 PXE_UINT16 FragCnt;\r
959ccb23 1633\r
3ed785e9 1634 ///\r
1635 /// Reserved, must be set to zero.\r
1636 ///\r
2f88bd3a 1637 PXE_UINT16 reserved;\r
959ccb23 1638\r
3ed785e9 1639 ///\r
1640 /// Array of packet fragment descriptors. The first byte of the media\r
1641 /// header is the first byte of the first fragment.\r
1642 ///\r
959ccb23 1643 struct {\r
3ed785e9 1644 ///\r
1645 /// Address of this packet fragment.\r
1646 ///\r
2f88bd3a 1647 PXE_UINT64 FragAddr;\r
959ccb23 1648\r
3ed785e9 1649 ///\r
1650 /// Length of this packet fragment.\r
1651 ///\r
2f88bd3a 1652 PXE_UINT32 FragLen;\r
959ccb23 1653\r
3ed785e9 1654 ///\r
1655 /// Reserved, must be set to zero.\r
1656 ///\r
2f88bd3a 1657 PXE_UINT32 reserved;\r
959ccb23 1658 } FragDesc[MAX_XMIT_FRAGMENTS];\r
2f88bd3a 1659} PXE_CPB_FILL_HEADER_FRAGMENTED;\r
959ccb23 1660\r
1661typedef struct s_pxe_cpb_transmit {\r
3ed785e9 1662 ///\r
1663 /// Address of first byte of frame buffer. This is also the first byte\r
1664 /// of the media header.\r
1665 ///\r
2f88bd3a 1666 PXE_UINT64 FrameAddr;\r
959ccb23 1667\r
3ed785e9 1668 ///\r
1669 /// Length of the data portion of the frame buffer in bytes. Do not\r
1670 /// include the length of the media header.\r
1671 ///\r
2f88bd3a 1672 PXE_UINT32 DataLen;\r
959ccb23 1673\r
3ed785e9 1674 ///\r
1675 /// Length of the media header in bytes.\r
1676 ///\r
2f88bd3a 1677 PXE_UINT16 MediaheaderLen;\r
959ccb23 1678\r
3ed785e9 1679 ///\r
1680 /// Reserved, must be zero.\r
1681 ///\r
2f88bd3a 1682 PXE_UINT16 reserved;\r
959ccb23 1683} PXE_CPB_TRANSMIT;\r
1684\r
1685typedef struct s_pxe_cpb_transmit_fragments {\r
3ed785e9 1686 ///\r
1687 /// Length of packet data in bytes (not including the media header).\r
1688 ///\r
2f88bd3a 1689 PXE_UINT32 FrameLen;\r
959ccb23 1690\r
3ed785e9 1691 ///\r
1692 /// Length of the media header in bytes.\r
1693 ///\r
2f88bd3a 1694 PXE_UINT16 MediaheaderLen;\r
959ccb23 1695\r
3ed785e9 1696 ///\r
1697 /// Number of packet fragment descriptors.\r
1698 ///\r
2f88bd3a 1699 PXE_UINT16 FragCnt;\r
959ccb23 1700\r
3ed785e9 1701 ///\r
1702 /// Array of frame fragment descriptors. The first byte of the first\r
1703 /// fragment is also the first byte of the media header.\r
1704 ///\r
959ccb23 1705 struct {\r
3ed785e9 1706 ///\r
1707 /// Address of this frame fragment.\r
1708 ///\r
2f88bd3a 1709 PXE_UINT64 FragAddr;\r
959ccb23 1710\r
3ed785e9 1711 ///\r
1712 /// Length of this frame fragment.\r
1713 ///\r
2f88bd3a 1714 PXE_UINT32 FragLen;\r
959ccb23 1715\r
3ed785e9 1716 ///\r
1717 /// Reserved, must be set to zero.\r
1718 ///\r
2f88bd3a 1719 PXE_UINT32 reserved;\r
959ccb23 1720 } FragDesc[MAX_XMIT_FRAGMENTS];\r
2f88bd3a 1721} PXE_CPB_TRANSMIT_FRAGMENTS;\r
959ccb23 1722\r
1723typedef struct s_pxe_cpb_receive {\r
3ed785e9 1724 ///\r
1725 /// Address of first byte of receive buffer. This is also the first byte\r
1726 /// of the frame header.\r
1727 ///\r
2f88bd3a 1728 PXE_UINT64 BufferAddr;\r
959ccb23 1729\r
3ed785e9 1730 ///\r
1731 /// Length of receive buffer. This must be large enough to hold the\r
1732 /// received frame (media header + data). If the length of smaller than\r
1733 /// the received frame, data will be lost.\r
1734 ///\r
2f88bd3a 1735 PXE_UINT32 BufferLen;\r
959ccb23 1736\r
3ed785e9 1737 ///\r
1738 /// Reserved, must be set to zero.\r
1739 ///\r
2f88bd3a 1740 PXE_UINT32 reserved;\r
959ccb23 1741} PXE_CPB_RECEIVE;\r
1742\r
1743typedef struct s_pxe_db_receive {\r
3ed785e9 1744 ///\r
1745 /// Source and destination MAC addresses from media header.\r
1746 ///\r
2f88bd3a
MK
1747 PXE_MAC_ADDR SrcAddr;\r
1748 PXE_MAC_ADDR DestAddr;\r
959ccb23 1749\r
3ed785e9 1750 ///\r
1751 /// Length of received frame. May be larger than receive buffer size.\r
1752 /// The receive buffer will not be overwritten. This is how to tell\r
1753 /// if data was lost because the receive buffer was too small.\r
1754 ///\r
2f88bd3a 1755 PXE_UINT32 FrameLen;\r
959ccb23 1756\r
3ed785e9 1757 ///\r
1758 /// Protocol type from media header.\r
1759 ///\r
2f88bd3a 1760 PXE_MEDIA_PROTOCOL Protocol;\r
959ccb23 1761\r
3ed785e9 1762 ///\r
1763 /// Length of media header in received frame.\r
1764 ///\r
2f88bd3a 1765 PXE_UINT16 MediaHeaderLen;\r
959ccb23 1766\r
3ed785e9 1767 ///\r
1768 /// Type of receive frame.\r
1769 ///\r
2f88bd3a 1770 PXE_FRAME_TYPE Type;\r
959ccb23 1771\r
3ed785e9 1772 ///\r
1773 /// Reserved, must be zero.\r
1774 ///\r
2f88bd3a 1775 PXE_UINT8 reserved[7];\r
959ccb23 1776} PXE_DB_RECEIVE;\r
1777\r
959ccb23 1778#pragma pack()\r
1779\r
1780#endif\r