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.

SimpleNetwork.h 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. /** @file
  2. Simple Network protocol as defined in the UEFI 2.0 specification.
  3. Basic network device abstraction.
  4. Rx - Received
  5. Tx - Transmit
  6. MCast - MultiCast
  7. ...
  8. Copyright (c) 2006 - 2008, Intel Corporation
  9. All rights reserved. This program and the accompanying materials
  10. are licensed and made available under the terms and conditions of the BSD License
  11. which accompanies this distribution. The full text of the license may be found at
  12. http://opensource.org/licenses/bsd-license.php
  13. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  15. **/
  16. #ifndef __SIMPLE_NETWORK_H__
  17. #define __SIMPLE_NETWORK_H__
  18. #define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
  19. { \
  20. 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } \
  21. }
  22. typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL;
  23. ///
  24. /// Protocol defined in EFI1.1.
  25. ///
  26. typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK;
  27. ///
  28. /// Simple Network Protocol data structures
  29. ///
  30. typedef struct {
  31. ///
  32. /// Total number of frames received. Includes frames with errors and
  33. /// dropped frames.
  34. ///
  35. UINT64 RxTotalFrames;
  36. ///
  37. /// Number of valid frames received and copied into receive buffers.
  38. ///
  39. UINT64 RxGoodFrames;
  40. ///
  41. /// Number of frames below the minimum length for the media.
  42. /// This would be <64 for ethernet.
  43. ///
  44. UINT64 RxUndersizeFrames;
  45. ///
  46. /// Number of frames longer than the maxminum length for the
  47. /// media. This would be >1500 for ethernet.
  48. ///
  49. UINT64 RxOversizeFrames;
  50. ///
  51. /// Valid frames that were dropped because receive buffers were full.
  52. ///
  53. UINT64 RxDroppedFrames;
  54. ///
  55. /// Number of valid unicast frames received and not dropped.
  56. ///
  57. UINT64 RxUnicastFrames;
  58. ///
  59. /// Number of valid broadcast frames received and not dropped.
  60. ///
  61. UINT64 RxBroadcastFrames;
  62. ///
  63. /// Number of valid mutlicast frames received and not dropped.
  64. ///
  65. UINT64 RxMulticastFrames;
  66. ///
  67. /// Number of frames w/ CRC or alignment errors.
  68. ///
  69. UINT64 RxCrcErrorFrames;
  70. ///
  71. /// Total number of bytes received. Includes frames with errors
  72. /// and dropped frames.
  73. //
  74. UINT64 RxTotalBytes;
  75. ///
  76. /// Transmit statistics.
  77. ///
  78. UINT64 TxTotalFrames;
  79. UINT64 TxGoodFrames;
  80. UINT64 TxUndersizeFrames;
  81. UINT64 TxOversizeFrames;
  82. UINT64 TxDroppedFrames;
  83. UINT64 TxUnicastFrames;
  84. UINT64 TxBroadcastFrames;
  85. UINT64 TxMulticastFrames;
  86. UINT64 TxCrcErrorFrames;
  87. UINT64 TxTotalBytes;
  88. ///
  89. /// Number of collisions detection on this subnet.
  90. ///
  91. UINT64 Collisions;
  92. ///
  93. /// Number of frames destined for unsupported protocol.
  94. ///
  95. UINT64 UnsupportedProtocol;
  96. } EFI_NETWORK_STATISTICS;
  97. typedef enum {
  98. EfiSimpleNetworkStopped,
  99. EfiSimpleNetworkStarted,
  100. EfiSimpleNetworkInitialized,
  101. EfiSimpleNetworkMaxState
  102. } EFI_SIMPLE_NETWORK_STATE;
  103. #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01
  104. #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02
  105. #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04
  106. #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08
  107. #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
  108. #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01
  109. #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02
  110. #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04
  111. #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08
  112. #define MAX_MCAST_FILTER_CNT 16
  113. typedef struct {
  114. UINT32 State;
  115. UINT32 HwAddressSize;
  116. UINT32 MediaHeaderSize;
  117. UINT32 MaxPacketSize;
  118. UINT32 NvRamSize;
  119. UINT32 NvRamAccessSize;
  120. UINT32 ReceiveFilterMask;
  121. UINT32 ReceiveFilterSetting;
  122. UINT32 MaxMCastFilterCount;
  123. UINT32 MCastFilterCount;
  124. EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];
  125. EFI_MAC_ADDRESS CurrentAddress;
  126. EFI_MAC_ADDRESS BroadcastAddress;
  127. EFI_MAC_ADDRESS PermanentAddress;
  128. UINT8 IfType;
  129. BOOLEAN MacAddressChangeable;
  130. BOOLEAN MultipleTxSupported;
  131. BOOLEAN MediaPresentSupported;
  132. BOOLEAN MediaPresent;
  133. } EFI_SIMPLE_NETWORK_MODE;
  134. //
  135. // Protocol Member Functions
  136. //
  137. /**
  138. Changes the state of a network interface from "stopped" to "started".
  139. @param This Protocol instance pointer.
  140. @retval EFI_SUCCESS The network interface was started.
  141. @retval EFI_ALREADY_STARTED The network interface is already in the started state.
  142. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  143. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  144. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  145. **/
  146. typedef
  147. EFI_STATUS
  148. (EFIAPI *EFI_SIMPLE_NETWORK_START)(
  149. IN EFI_SIMPLE_NETWORK_PROTOCOL *This
  150. );
  151. /**
  152. Changes the state of a network interface from "started" to "stopped".
  153. @param This Protocol instance pointer.
  154. @retval EFI_SUCCESS The network interface was stopped.
  155. @retval EFI_ALREADY_STARTED The network interface is already in the stopped state.
  156. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  157. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  158. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  159. **/
  160. typedef
  161. EFI_STATUS
  162. (EFIAPI *EFI_SIMPLE_NETWORK_STOP)(
  163. IN EFI_SIMPLE_NETWORK_PROTOCOL *This
  164. );
  165. /**
  166. Resets a network adapter and allocates the transmit and receive buffers
  167. required by the network interface; optionally, also requests allocation
  168. of additional transmit and receive buffers.
  169. @param This Protocol instance pointer.
  170. @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space
  171. that the driver should allocate for the network interface.
  172. Some network interfaces will not be able to use the extra
  173. buffer, and the caller will not know if it is actually
  174. being used.
  175. @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space
  176. that the driver should allocate for the network interface.
  177. Some network interfaces will not be able to use the extra
  178. buffer, and the caller will not know if it is actually
  179. being used.
  180. @retval EFI_SUCCESS The network interface was initialized.
  181. @retval EFI_NOT_STARTED The network interface has not been started
  182. @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and
  183. receive buffers. .
  184. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  185. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  186. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  187. **/
  188. typedef
  189. EFI_STATUS
  190. (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE)(
  191. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  192. IN UINTN ExtraRxBufferSize OPTIONAL,
  193. IN UINTN ExtraTxBufferSize OPTIONAL
  194. );
  195. /**
  196. Resets a network adapter and re-initializes it with the parameters that were
  197. provided in the previous call to Initialize().
  198. @param This Protocol instance pointer.
  199. @param ExtendedVerification Indicates that the driver may perform a more
  200. exhaustive verification operation of the device
  201. during reset.
  202. @retval EFI_SUCCESS The network interface was reset.
  203. @retval EFI_NOT_STARTED The network interface has not been started
  204. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  205. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  206. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  207. **/
  208. typedef
  209. EFI_STATUS
  210. (EFIAPI *EFI_SIMPLE_NETWORK_RESET)(
  211. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  212. IN BOOLEAN ExtendedVerification
  213. );
  214. /**
  215. Resets a network adapter and leaves it in a state that is safe for
  216. another driver to initialize.
  217. @param This Protocol instance pointer.
  218. @retval EFI_SUCCESS The network interface was shutdown.
  219. @retval EFI_NOT_STARTED The network interface has not been started
  220. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  221. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  222. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  223. **/
  224. typedef
  225. EFI_STATUS
  226. (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN)(
  227. IN EFI_SIMPLE_NETWORK_PROTOCOL *This
  228. );
  229. /**
  230. Manages the multicast receive filters of a network interface.
  231. @param This Protocol instance pointer.
  232. @param Enable A bit mask of receive filters to enable on the network interface.
  233. @param Disable A bit mask of receive filters to disable on the network interface.
  234. @param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive
  235. filters on the network interface to their default values.
  236. @param McastFilterCnt Number of multicast HW MAC addresses in the new
  237. MCastFilter list. This value must be less than or equal to
  238. the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This
  239. field is optional if ResetMCastFilter is TRUE.
  240. @param MCastFilter A pointer to a list of new multicast receive filter HW MAC
  241. addresses. This list will replace any existing multicast
  242. HW MAC address list. This field is optional if
  243. ResetMCastFilter is TRUE.
  244. @retval EFI_SUCCESS The multicast receive filter list was updated.
  245. @retval EFI_NOT_STARTED The network interface has not been started
  246. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  247. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  248. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  249. **/
  250. typedef
  251. EFI_STATUS
  252. (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS)(
  253. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  254. IN UINT32 Enable,
  255. IN UINT32 Disable,
  256. IN BOOLEAN ResetMCastFilter,
  257. IN UINTN MCastFilterCnt OPTIONAL,
  258. IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
  259. );
  260. /**
  261. Modifies or resets the current station address, if supported.
  262. @param This Protocol instance pointer.
  263. @param Reset Flag used to reset the station address to the network interfaces
  264. permanent address.
  265. @param New New station address to be used for the network interface.
  266. @retval EFI_SUCCESS The network interfaces station address was updated.
  267. @retval EFI_NOT_STARTED The network interface has not been started
  268. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  269. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  270. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  271. **/
  272. typedef
  273. EFI_STATUS
  274. (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS)(
  275. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  276. IN BOOLEAN Reset,
  277. IN EFI_MAC_ADDRESS *New OPTIONAL
  278. );
  279. /**
  280. Resets or collects the statistics on a network interface.
  281. @param This Protocol instance pointer.
  282. @param Reset Set to TRUE to reset the statistics for the network interface.
  283. @param StatisticsSize On input the size, in bytes, of StatisticsTable. On
  284. output the size, in bytes, of the resulting table of
  285. statistics.
  286. @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
  287. contains the statistics.
  288. @retval EFI_SUCCESS The statistics were collected from the network interface.
  289. @retval EFI_NOT_STARTED The network interface has not been started.
  290. @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
  291. size needed to hold the statistics is returned in
  292. StatisticsSize.
  293. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  294. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  295. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  296. **/
  297. typedef
  298. EFI_STATUS
  299. (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS)(
  300. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  301. IN BOOLEAN Reset,
  302. IN OUT UINTN *StatisticsSize OPTIONAL,
  303. OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
  304. );
  305. /**
  306. Converts a multicast IP address to a multicast HW MAC address.
  307. @param This Protocol instance pointer.
  308. @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set
  309. to FALSE if the multicast IP address is IPv4 [RFC 791].
  310. @param IP The multicast IP address that is to be converted to a multicast
  311. HW MAC address.
  312. @param MAC The multicast HW MAC address that is to be generated from IP.
  313. @retval EFI_SUCCESS The multicast IP address was mapped to the multicast
  314. HW MAC address.
  315. @retval EFI_NOT_STARTED The network interface has not been started.
  316. @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
  317. size needed to hold the statistics is returned in
  318. StatisticsSize.
  319. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  320. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  321. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  322. **/
  323. typedef
  324. EFI_STATUS
  325. (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC)(
  326. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  327. IN BOOLEAN IPv6,
  328. IN EFI_IP_ADDRESS *IP,
  329. OUT EFI_MAC_ADDRESS *MAC
  330. );
  331. /**
  332. Performs read and write operations on the NVRAM device attached to a
  333. network interface.
  334. @param This Protocol instance pointer.
  335. @param ReadWrite TRUE for read operations, FALSE for write operations.
  336. @param Offset Byte offset in the NVRAM device at which to start the read or
  337. write operation. This must be a multiple of NvRamAccessSize and
  338. less than NvRamSize.
  339. @param BufferSize The number of bytes to read or write from the NVRAM device.
  340. This must also be a multiple of NvramAccessSize.
  341. @param Buffer A pointer to the data buffer.
  342. @retval EFI_SUCCESS The NVRAM access was performed.
  343. @retval EFI_NOT_STARTED The network interface has not been started.
  344. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  345. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  346. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  347. **/
  348. typedef
  349. EFI_STATUS
  350. (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA)(
  351. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  352. IN BOOLEAN ReadWrite,
  353. IN UINTN Offset,
  354. IN UINTN BufferSize,
  355. IN OUT VOID *Buffer
  356. );
  357. /**
  358. Reads the current interrupt status and recycled transmit buffer status from
  359. a network interface.
  360. @param This Protocol instance pointer.
  361. @param InterruptStatus A pointer to the bit mask of the currently active interrupts
  362. If this is NULL, the interrupt status will not be read from
  363. the device. If this is not NULL, the interrupt status will
  364. be read from the device. When the interrupt status is read,
  365. it will also be cleared. Clearing the transmit interrupt
  366. does not empty the recycled transmit buffer array.
  367. @param TxBuf Recycled transmit buffer address. The network interface will
  368. not transmit if its internal recycled transmit buffer array
  369. is full. Reading the transmit buffer does not clear the
  370. transmit interrupt. If this is NULL, then the transmit buffer
  371. status will not be read. If there are no transmit buffers to
  372. recycle and TxBuf is not NULL, * TxBuf will be set to NULL.
  373. @retval EFI_SUCCESS The status of the network interface was retrieved.
  374. @retval EFI_NOT_STARTED The network interface has not been started.
  375. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  376. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  377. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  378. **/
  379. typedef
  380. EFI_STATUS
  381. (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS)(
  382. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  383. OUT UINT32 *InterruptStatus OPTIONAL,
  384. OUT VOID **TxBuf OPTIONAL
  385. );
  386. /**
  387. Places a packet in the transmit queue of a network interface.
  388. @param This Protocol instance pointer.
  389. @param HeaderSize The size, in bytes, of the media header to be filled in by
  390. the Transmit() function. If HeaderSize is non-zero, then it
  391. must be equal to This->Mode->MediaHeaderSize and the DestAddr
  392. and Protocol parameters must not be NULL.
  393. @param BufferSize The size, in bytes, of the entire packet (media header and
  394. data) to be transmitted through the network interface.
  395. @param Buffer A pointer to the packet (media header followed by data) to be
  396. transmitted. This parameter cannot be NULL. If HeaderSize is zero,
  397. then the media header in Buffer must already be filled in by the
  398. caller. If HeaderSize is non-zero, then the media header will be
  399. filled in by the Transmit() function.
  400. @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter
  401. is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then
  402. This->Mode->CurrentAddress is used for the source HW MAC address.
  403. @param DsetAddr The destination HW MAC address. If HeaderSize is zero, then this
  404. parameter is ignored.
  405. @param Protocol The type of header to build. If HeaderSize is zero, then this
  406. parameter is ignored. See RFC 1700, section "Ether Types", for
  407. examples.
  408. @retval EFI_SUCCESS The packet was placed on the transmit queue.
  409. @retval EFI_NOT_STARTED The network interface has not been started.
  410. @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.
  411. @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
  412. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  413. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  414. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  415. **/
  416. typedef
  417. EFI_STATUS
  418. (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT)(
  419. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  420. IN UINTN HeaderSize,
  421. IN UINTN BufferSize,
  422. IN VOID *Buffer,
  423. IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
  424. IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
  425. IN UINT16 *Protocol OPTIONAL
  426. );
  427. /**
  428. Receives a packet from a network interface.
  429. @param This Protocol instance pointer.
  430. @param HeaderSize The size, in bytes, of the media header received on the network
  431. interface. If this parameter is NULL, then the media header size
  432. will not be returned.
  433. @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in
  434. bytes, of the packet that was received on the network interface.
  435. @param Buffer A pointer to the data buffer to receive both the media header and
  436. the data.
  437. @param SrcAddr The source HW MAC address. If this parameter is NULL, the
  438. HW MAC source address will not be extracted from the media
  439. header.
  440. @param DsetAddr The destination HW MAC address. If this parameter is NULL,
  441. the HW MAC destination address will not be extracted from the
  442. media header.
  443. @param Protocol The media header type. If this parameter is NULL, then the
  444. protocol will not be extracted from the media header. See
  445. RFC 1700 section "Ether Types" for examples.
  446. @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has
  447. been updated to the number of bytes received.
  448. @retval EFI_NOT_STARTED The network interface has not been started.
  449. @retval EFI_NOT_READY The network interface is too busy to accept this transmit
  450. request.
  451. @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
  452. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  453. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  454. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  455. **/
  456. typedef
  457. EFI_STATUS
  458. (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE)(
  459. IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
  460. OUT UINTN *HeaderSize OPTIONAL,
  461. IN OUT UINTN *BufferSize,
  462. OUT VOID *Buffer,
  463. OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
  464. OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
  465. OUT UINT16 *Protocol OPTIONAL
  466. );
  467. #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000
  468. //
  469. // Revision defined in EFI1.1
  470. //
  471. #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
  472. ///
  473. /// The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access
  474. /// to a network adapter. Once the network adapter initializes,
  475. /// the EFI_SIMPLE_NETWORK_PROTOCOL protocol provides services that
  476. /// allow packets to be transmitted and received.
  477. ///
  478. struct _EFI_SIMPLE_NETWORK_PROTOCOL {
  479. ///
  480. /// Revision of the EFI_SIMPLE_NETWORK_PROTOCOL. All future revisions must
  481. /// be backwards compatible. If a future version is not backwards compatible
  482. /// it is not the same GUID.
  483. ///
  484. UINT64 Revision;
  485. EFI_SIMPLE_NETWORK_START Start;
  486. EFI_SIMPLE_NETWORK_STOP Stop;
  487. EFI_SIMPLE_NETWORK_INITIALIZE Initialize;
  488. EFI_SIMPLE_NETWORK_RESET Reset;
  489. EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown;
  490. EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters;
  491. EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress;
  492. EFI_SIMPLE_NETWORK_STATISTICS Statistics;
  493. EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac;
  494. EFI_SIMPLE_NETWORK_NVDATA NvData;
  495. EFI_SIMPLE_NETWORK_GET_STATUS GetStatus;
  496. EFI_SIMPLE_NETWORK_TRANSMIT Transmit;
  497. EFI_SIMPLE_NETWORK_RECEIVE Receive;
  498. ///
  499. /// Event used with WaitForEvent() to wait for a packet to be received.
  500. ///
  501. EFI_EVENT WaitForPacket;
  502. ///
  503. /// Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
  504. ///
  505. EFI_SIMPLE_NETWORK_MODE *Mode;
  506. };
  507. extern EFI_GUID gEfiSimpleNetworkProtocolGuid;
  508. #endif