efinet.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. #ifndef _EFINET_H
  2. #define _EFINET_H
  3. /*++
  4. Copyright (c) 1999 Intel Corporation
  5. Module Name:
  6. efinet.h
  7. Abstract:
  8. EFI Simple Network protocol
  9. Revision History
  10. --*/
  11. ///////////////////////////////////////////////////////////////////////////////
  12. //
  13. // Simple Network Protocol
  14. //
  15. #define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
  16. { 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
  17. INTERFACE_DECL(_EFI_SIMPLE_NETWORK_PROTOCOL);
  18. ///////////////////////////////////////////////////////////////////////////////
  19. //
  20. typedef struct {
  21. //
  22. // Total number of frames received. Includes frames with errors and
  23. // dropped frames.
  24. //
  25. UINT64 RxTotalFrames;
  26. //
  27. // Number of valid frames received and copied into receive buffers.
  28. //
  29. UINT64 RxGoodFrames;
  30. //
  31. // Number of frames below the minimum length for the media.
  32. // This would be <64 for ethernet.
  33. //
  34. UINT64 RxUndersizeFrames;
  35. //
  36. // Number of frames longer than the maxminum length for the
  37. // media. This would be >1500 for ethernet.
  38. //
  39. UINT64 RxOversizeFrames;
  40. //
  41. // Valid frames that were dropped because receive buffers were full.
  42. //
  43. UINT64 RxDroppedFrames;
  44. //
  45. // Number of valid unicast frames received and not dropped.
  46. //
  47. UINT64 RxUnicastFrames;
  48. //
  49. // Number of valid broadcast frames received and not dropped.
  50. //
  51. UINT64 RxBroadcastFrames;
  52. //
  53. // Number of valid mutlicast frames received and not dropped.
  54. //
  55. UINT64 RxMulticastFrames;
  56. //
  57. // Number of frames w/ CRC or alignment errors.
  58. //
  59. UINT64 RxCrcErrorFrames;
  60. //
  61. // Total number of bytes received. Includes frames with errors
  62. // and dropped frames.
  63. //
  64. UINT64 RxTotalBytes;
  65. //
  66. // Transmit statistics.
  67. //
  68. UINT64 TxTotalFrames;
  69. UINT64 TxGoodFrames;
  70. UINT64 TxUndersizeFrames;
  71. UINT64 TxOversizeFrames;
  72. UINT64 TxDroppedFrames;
  73. UINT64 TxUnicastFrames;
  74. UINT64 TxBroadcastFrames;
  75. UINT64 TxMulticastFrames;
  76. UINT64 TxCrcErrorFrames;
  77. UINT64 TxTotalBytes;
  78. //
  79. // Number of collisions detection on this subnet.
  80. //
  81. UINT64 Collisions;
  82. //
  83. // Number of frames destined for unsupported protocol.
  84. //
  85. UINT64 UnsupportedProtocol;
  86. } EFI_NETWORK_STATISTICS;
  87. ///////////////////////////////////////////////////////////////////////////////
  88. //
  89. typedef enum {
  90. EfiSimpleNetworkStopped,
  91. EfiSimpleNetworkStarted,
  92. EfiSimpleNetworkInitialized,
  93. EfiSimpleNetworkMaxState
  94. } EFI_SIMPLE_NETWORK_STATE;
  95. ///////////////////////////////////////////////////////////////////////////////
  96. //
  97. #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01
  98. #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02
  99. #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04
  100. #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08
  101. #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
  102. ///////////////////////////////////////////////////////////////////////////////
  103. //
  104. #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01
  105. #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02
  106. #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04
  107. #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08
  108. ///////////////////////////////////////////////////////////////////////////////
  109. //
  110. #define MAX_MCAST_FILTER_CNT 16
  111. typedef struct {
  112. UINT32 State;
  113. UINT32 HwAddressSize;
  114. UINT32 MediaHeaderSize;
  115. UINT32 MaxPacketSize;
  116. UINT32 NvRamSize;
  117. UINT32 NvRamAccessSize;
  118. UINT32 ReceiveFilterMask;
  119. UINT32 ReceiveFilterSetting;
  120. UINT32 MaxMCastFilterCount;
  121. UINT32 MCastFilterCount;
  122. EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];
  123. EFI_MAC_ADDRESS CurrentAddress;
  124. EFI_MAC_ADDRESS BroadcastAddress;
  125. EFI_MAC_ADDRESS PermanentAddress;
  126. UINT8 IfType;
  127. BOOLEAN MacAddressChangeable;
  128. BOOLEAN MultipleTxSupported;
  129. BOOLEAN MediaPresentSupported;
  130. BOOLEAN MediaPresent;
  131. } EFI_SIMPLE_NETWORK_MODE;
  132. ///////////////////////////////////////////////////////////////////////////////
  133. //
  134. typedef
  135. EFI_STATUS
  136. (EFIAPI *EFI_SIMPLE_NETWORK_START) (
  137. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This
  138. );
  139. ///////////////////////////////////////////////////////////////////////////////
  140. //
  141. typedef
  142. EFI_STATUS
  143. (EFIAPI *EFI_SIMPLE_NETWORK_STOP) (
  144. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This
  145. );
  146. ///////////////////////////////////////////////////////////////////////////////
  147. //
  148. typedef
  149. EFI_STATUS
  150. (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) (
  151. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  152. IN UINTN ExtraRxBufferSize OPTIONAL,
  153. IN UINTN ExtraTxBufferSize OPTIONAL
  154. );
  155. ///////////////////////////////////////////////////////////////////////////////
  156. //
  157. typedef
  158. EFI_STATUS
  159. (EFIAPI *EFI_SIMPLE_NETWORK_RESET) (
  160. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  161. IN BOOLEAN ExtendedVerification
  162. );
  163. ///////////////////////////////////////////////////////////////////////////////
  164. //
  165. typedef
  166. EFI_STATUS
  167. (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) (
  168. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This
  169. );
  170. ///////////////////////////////////////////////////////////////////////////////
  171. //
  172. typedef
  173. EFI_STATUS
  174. (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) (
  175. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  176. IN UINT32 Enable,
  177. IN UINT32 Disable,
  178. IN BOOLEAN ResetMCastFilter,
  179. IN UINTN MCastFilterCnt OPTIONAL,
  180. IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
  181. );
  182. ///////////////////////////////////////////////////////////////////////////////
  183. //
  184. typedef
  185. EFI_STATUS
  186. (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) (
  187. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  188. IN BOOLEAN Reset,
  189. IN EFI_MAC_ADDRESS *New OPTIONAL
  190. );
  191. ///////////////////////////////////////////////////////////////////////////////
  192. //
  193. typedef
  194. EFI_STATUS
  195. (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) (
  196. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  197. IN BOOLEAN Reset,
  198. IN OUT UINTN *StatisticsSize OPTIONAL,
  199. OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
  200. );
  201. ///////////////////////////////////////////////////////////////////////////////
  202. //
  203. typedef
  204. EFI_STATUS
  205. (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) (
  206. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  207. IN BOOLEAN IPv6,
  208. IN EFI_IP_ADDRESS *IP,
  209. OUT EFI_MAC_ADDRESS *MAC
  210. );
  211. ///////////////////////////////////////////////////////////////////////////////
  212. //
  213. typedef
  214. EFI_STATUS
  215. (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) (
  216. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  217. IN BOOLEAN ReadWrite,
  218. IN UINTN Offset,
  219. IN UINTN BufferSize,
  220. IN OUT VOID *Buffer
  221. );
  222. ///////////////////////////////////////////////////////////////////////////////
  223. //
  224. typedef
  225. EFI_STATUS
  226. (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) (
  227. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  228. OUT UINT32 *InterruptStatus OPTIONAL,
  229. OUT VOID **TxBuf OPTIONAL
  230. );
  231. ///////////////////////////////////////////////////////////////////////////////
  232. //
  233. typedef
  234. EFI_STATUS
  235. (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) (
  236. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  237. IN UINTN HeaderSize,
  238. IN UINTN BufferSize,
  239. IN VOID *Buffer,
  240. IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
  241. IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
  242. IN UINT16 *Protocol OPTIONAL
  243. );
  244. ///////////////////////////////////////////////////////////////////////////////
  245. //
  246. typedef
  247. EFI_STATUS
  248. (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) (
  249. IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
  250. OUT UINTN *HeaderSize OPTIONAL,
  251. IN OUT UINTN *BufferSize,
  252. OUT VOID *Buffer,
  253. OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
  254. OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
  255. OUT UINT16 *Protocol OPTIONAL
  256. );
  257. ///////////////////////////////////////////////////////////////////////////////
  258. //
  259. #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000
  260. #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
  261. typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL {
  262. UINT64 Revision;
  263. EFI_SIMPLE_NETWORK_START Start;
  264. EFI_SIMPLE_NETWORK_STOP Stop;
  265. EFI_SIMPLE_NETWORK_INITIALIZE Initialize;
  266. EFI_SIMPLE_NETWORK_RESET Reset;
  267. EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown;
  268. EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters;
  269. EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress;
  270. EFI_SIMPLE_NETWORK_STATISTICS Statistics;
  271. EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac;
  272. EFI_SIMPLE_NETWORK_NVDATA NvData;
  273. EFI_SIMPLE_NETWORK_GET_STATUS GetStatus;
  274. EFI_SIMPLE_NETWORK_TRANSMIT Transmit;
  275. EFI_SIMPLE_NETWORK_RECEIVE Receive;
  276. EFI_EVENT WaitForPacket;
  277. EFI_SIMPLE_NETWORK_MODE *Mode;
  278. } EFI_SIMPLE_NETWORK_PROTOCOL;
  279. // Note: Because it conflicted with the EDK2 struct name, the
  280. // 'EFI_SIMPLE_NETWORK_PROTOCOL' GUID definition, from older
  281. // versions of gnu-efi, is now obsoleted.
  282. // Use 'EFI_SIMPLE_NETWORK_PROTOCOL_GUID' instead.
  283. typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL _EFI_SIMPLE_NETWORK;
  284. typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK;
  285. #endif /* _EFINET_H */