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