Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1737 lines
47 KiB

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