1*f334afcfSToomas Soome /** @file 2*f334afcfSToomas Soome The EFI_SIMPLE_NETWORK_PROTOCOL provides services to initialize a network interface, 3*f334afcfSToomas Soome transmit packets, receive packets, and close a network interface. 4*f334afcfSToomas Soome 5*f334afcfSToomas Soome Basic network device abstraction. 6*f334afcfSToomas Soome 7*f334afcfSToomas Soome Rx - Received 8*f334afcfSToomas Soome Tx - Transmit 9*f334afcfSToomas Soome MCast - MultiCast 10*f334afcfSToomas Soome ... 11*f334afcfSToomas Soome 12*f334afcfSToomas Soome Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 13*f334afcfSToomas Soome SPDX-License-Identifier: BSD-2-Clause-Patent 14*f334afcfSToomas Soome 15*f334afcfSToomas Soome @par Revision Reference: 16*f334afcfSToomas Soome This Protocol is introduced in EFI Specification 1.10. 17*f334afcfSToomas Soome 18*f334afcfSToomas Soome **/ 19*f334afcfSToomas Soome 20*f334afcfSToomas Soome #ifndef __SIMPLE_NETWORK_H__ 21*f334afcfSToomas Soome #define __SIMPLE_NETWORK_H__ 22*f334afcfSToomas Soome 23*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \ 24*f334afcfSToomas Soome { \ 25*f334afcfSToomas Soome 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } \ 26*f334afcfSToomas Soome } 27*f334afcfSToomas Soome 28*f334afcfSToomas Soome typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL; 29*f334afcfSToomas Soome 30*f334afcfSToomas Soome /// 31*f334afcfSToomas Soome /// Protocol defined in EFI1.1. 32*f334afcfSToomas Soome /// 33*f334afcfSToomas Soome typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK; 34*f334afcfSToomas Soome 35*f334afcfSToomas Soome /// 36*f334afcfSToomas Soome /// Simple Network Protocol data structures. 37*f334afcfSToomas Soome /// 38*f334afcfSToomas Soome typedef struct { 39*f334afcfSToomas Soome /// 40*f334afcfSToomas Soome /// Total number of frames received. Includes frames with errors and 41*f334afcfSToomas Soome /// dropped frames. 42*f334afcfSToomas Soome /// 43*f334afcfSToomas Soome UINT64 RxTotalFrames; 44*f334afcfSToomas Soome 45*f334afcfSToomas Soome /// 46*f334afcfSToomas Soome /// Number of valid frames received and copied into receive buffers. 47*f334afcfSToomas Soome /// 48*f334afcfSToomas Soome UINT64 RxGoodFrames; 49*f334afcfSToomas Soome 50*f334afcfSToomas Soome /// 51*f334afcfSToomas Soome /// Number of frames below the minimum length for the media. 52*f334afcfSToomas Soome /// This would be <64 for ethernet. 53*f334afcfSToomas Soome /// 54*f334afcfSToomas Soome UINT64 RxUndersizeFrames; 55*f334afcfSToomas Soome 56*f334afcfSToomas Soome /// 57*f334afcfSToomas Soome /// Number of frames longer than the maxminum length for the 58*f334afcfSToomas Soome /// media. This would be >1500 for ethernet. 59*f334afcfSToomas Soome /// 60*f334afcfSToomas Soome UINT64 RxOversizeFrames; 61*f334afcfSToomas Soome 62*f334afcfSToomas Soome /// 63*f334afcfSToomas Soome /// Valid frames that were dropped because receive buffers were full. 64*f334afcfSToomas Soome /// 65*f334afcfSToomas Soome UINT64 RxDroppedFrames; 66*f334afcfSToomas Soome 67*f334afcfSToomas Soome /// 68*f334afcfSToomas Soome /// Number of valid unicast frames received and not dropped. 69*f334afcfSToomas Soome /// 70*f334afcfSToomas Soome UINT64 RxUnicastFrames; 71*f334afcfSToomas Soome 72*f334afcfSToomas Soome /// 73*f334afcfSToomas Soome /// Number of valid broadcast frames received and not dropped. 74*f334afcfSToomas Soome /// 75*f334afcfSToomas Soome UINT64 RxBroadcastFrames; 76*f334afcfSToomas Soome 77*f334afcfSToomas Soome /// 78*f334afcfSToomas Soome /// Number of valid mutlicast frames received and not dropped. 79*f334afcfSToomas Soome /// 80*f334afcfSToomas Soome UINT64 RxMulticastFrames; 81*f334afcfSToomas Soome 82*f334afcfSToomas Soome /// 83*f334afcfSToomas Soome /// Number of frames w/ CRC or alignment errors. 84*f334afcfSToomas Soome /// 85*f334afcfSToomas Soome UINT64 RxCrcErrorFrames; 86*f334afcfSToomas Soome 87*f334afcfSToomas Soome /// 88*f334afcfSToomas Soome /// Total number of bytes received. Includes frames with errors 89*f334afcfSToomas Soome /// and dropped frames. 90*f334afcfSToomas Soome // 91*f334afcfSToomas Soome UINT64 RxTotalBytes; 92*f334afcfSToomas Soome 93*f334afcfSToomas Soome /// 94*f334afcfSToomas Soome /// Transmit statistics. 95*f334afcfSToomas Soome /// 96*f334afcfSToomas Soome UINT64 TxTotalFrames; 97*f334afcfSToomas Soome UINT64 TxGoodFrames; 98*f334afcfSToomas Soome UINT64 TxUndersizeFrames; 99*f334afcfSToomas Soome UINT64 TxOversizeFrames; 100*f334afcfSToomas Soome UINT64 TxDroppedFrames; 101*f334afcfSToomas Soome UINT64 TxUnicastFrames; 102*f334afcfSToomas Soome UINT64 TxBroadcastFrames; 103*f334afcfSToomas Soome UINT64 TxMulticastFrames; 104*f334afcfSToomas Soome UINT64 TxCrcErrorFrames; 105*f334afcfSToomas Soome UINT64 TxTotalBytes; 106*f334afcfSToomas Soome 107*f334afcfSToomas Soome /// 108*f334afcfSToomas Soome /// Number of collisions detection on this subnet. 109*f334afcfSToomas Soome /// 110*f334afcfSToomas Soome UINT64 Collisions; 111*f334afcfSToomas Soome 112*f334afcfSToomas Soome /// 113*f334afcfSToomas Soome /// Number of frames destined for unsupported protocol. 114*f334afcfSToomas Soome /// 115*f334afcfSToomas Soome UINT64 UnsupportedProtocol; 116*f334afcfSToomas Soome 117*f334afcfSToomas Soome /// 118*f334afcfSToomas Soome /// Number of valid frames received that were duplicated. 119*f334afcfSToomas Soome /// 120*f334afcfSToomas Soome UINT64 RxDuplicatedFrames; 121*f334afcfSToomas Soome 122*f334afcfSToomas Soome /// 123*f334afcfSToomas Soome /// Number of encrypted frames received that failed to decrypt. 124*f334afcfSToomas Soome /// 125*f334afcfSToomas Soome UINT64 RxDecryptErrorFrames; 126*f334afcfSToomas Soome 127*f334afcfSToomas Soome /// 128*f334afcfSToomas Soome /// Number of frames that failed to transmit after exceeding the retry limit. 129*f334afcfSToomas Soome /// 130*f334afcfSToomas Soome UINT64 TxErrorFrames; 131*f334afcfSToomas Soome 132*f334afcfSToomas Soome /// 133*f334afcfSToomas Soome /// Number of frames transmitted successfully after more than one attempt. 134*f334afcfSToomas Soome /// 135*f334afcfSToomas Soome UINT64 TxRetryFrames; 136*f334afcfSToomas Soome } EFI_NETWORK_STATISTICS; 137*f334afcfSToomas Soome 138*f334afcfSToomas Soome /// 139*f334afcfSToomas Soome /// The state of the network interface. 140*f334afcfSToomas Soome /// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a 141*f334afcfSToomas Soome /// network interface, the network interface is left in the EfiSimpleNetworkStopped state. 142*f334afcfSToomas Soome /// 143*f334afcfSToomas Soome typedef enum { 144*f334afcfSToomas Soome EfiSimpleNetworkStopped, 145*f334afcfSToomas Soome EfiSimpleNetworkStarted, 146*f334afcfSToomas Soome EfiSimpleNetworkInitialized, 147*f334afcfSToomas Soome EfiSimpleNetworkMaxState 148*f334afcfSToomas Soome } EFI_SIMPLE_NETWORK_STATE; 149*f334afcfSToomas Soome 150*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01 151*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02 152*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04 153*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 154*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 155*f334afcfSToomas Soome 156*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01 157*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02 158*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04 159*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08 160*f334afcfSToomas Soome 161*f334afcfSToomas Soome #define MAX_MCAST_FILTER_CNT 16 162*f334afcfSToomas Soome typedef struct { 163*f334afcfSToomas Soome /// 164*f334afcfSToomas Soome /// Reports the current state of the network interface. 165*f334afcfSToomas Soome /// 166*f334afcfSToomas Soome UINT32 State; 167*f334afcfSToomas Soome /// 168*f334afcfSToomas Soome /// The size, in bytes, of the network interface's HW address. 169*f334afcfSToomas Soome /// 170*f334afcfSToomas Soome UINT32 HwAddressSize; 171*f334afcfSToomas Soome /// 172*f334afcfSToomas Soome /// The size, in bytes, of the network interface's media header. 173*f334afcfSToomas Soome /// 174*f334afcfSToomas Soome UINT32 MediaHeaderSize; 175*f334afcfSToomas Soome /// 176*f334afcfSToomas Soome /// The maximum size, in bytes, of the packets supported by the network interface. 177*f334afcfSToomas Soome /// 178*f334afcfSToomas Soome UINT32 MaxPacketSize; 179*f334afcfSToomas Soome /// 180*f334afcfSToomas Soome /// The size, in bytes, of the NVRAM device attached to the network interface. 181*f334afcfSToomas Soome /// 182*f334afcfSToomas Soome UINT32 NvRamSize; 183*f334afcfSToomas Soome /// 184*f334afcfSToomas Soome /// The size that must be used for all NVRAM reads and writes. The 185*f334afcfSToomas Soome /// start address for NVRAM read and write operations and the total 186*f334afcfSToomas Soome /// length of those operations, must be a multiple of this value. The 187*f334afcfSToomas Soome /// legal values for this field are 0, 1, 2, 4, and 8. 188*f334afcfSToomas Soome /// 189*f334afcfSToomas Soome UINT32 NvRamAccessSize; 190*f334afcfSToomas Soome /// 191*f334afcfSToomas Soome /// The multicast receive filter settings supported by the network interface. 192*f334afcfSToomas Soome /// 193*f334afcfSToomas Soome UINT32 ReceiveFilterMask; 194*f334afcfSToomas Soome /// 195*f334afcfSToomas Soome /// The current multicast receive filter settings. 196*f334afcfSToomas Soome /// 197*f334afcfSToomas Soome UINT32 ReceiveFilterSetting; 198*f334afcfSToomas Soome /// 199*f334afcfSToomas Soome /// The maximum number of multicast address receive filters supported by the driver. 200*f334afcfSToomas Soome /// 201*f334afcfSToomas Soome UINT32 MaxMCastFilterCount; 202*f334afcfSToomas Soome /// 203*f334afcfSToomas Soome /// The current number of multicast address receive filters. 204*f334afcfSToomas Soome /// 205*f334afcfSToomas Soome UINT32 MCastFilterCount; 206*f334afcfSToomas Soome /// 207*f334afcfSToomas Soome /// Array containing the addresses of the current multicast address receive filters. 208*f334afcfSToomas Soome /// 209*f334afcfSToomas Soome EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT]; 210*f334afcfSToomas Soome /// 211*f334afcfSToomas Soome /// The current HW MAC address for the network interface. 212*f334afcfSToomas Soome /// 213*f334afcfSToomas Soome EFI_MAC_ADDRESS CurrentAddress; 214*f334afcfSToomas Soome /// 215*f334afcfSToomas Soome /// The current HW MAC address for broadcast packets. 216*f334afcfSToomas Soome /// 217*f334afcfSToomas Soome EFI_MAC_ADDRESS BroadcastAddress; 218*f334afcfSToomas Soome /// 219*f334afcfSToomas Soome /// The permanent HW MAC address for the network interface. 220*f334afcfSToomas Soome /// 221*f334afcfSToomas Soome EFI_MAC_ADDRESS PermanentAddress; 222*f334afcfSToomas Soome /// 223*f334afcfSToomas Soome /// The interface type of the network interface. 224*f334afcfSToomas Soome /// 225*f334afcfSToomas Soome UINT8 IfType; 226*f334afcfSToomas Soome /// 227*f334afcfSToomas Soome /// TRUE if the HW MAC address can be changed. 228*f334afcfSToomas Soome /// 229*f334afcfSToomas Soome BOOLEAN MacAddressChangeable; 230*f334afcfSToomas Soome /// 231*f334afcfSToomas Soome /// TRUE if the network interface can transmit more than one packet at a time. 232*f334afcfSToomas Soome /// 233*f334afcfSToomas Soome BOOLEAN MultipleTxSupported; 234*f334afcfSToomas Soome /// 235*f334afcfSToomas Soome /// TRUE if the presence of media can be determined; otherwise FALSE. 236*f334afcfSToomas Soome /// 237*f334afcfSToomas Soome BOOLEAN MediaPresentSupported; 238*f334afcfSToomas Soome /// 239*f334afcfSToomas Soome /// TRUE if media are connected to the network interface; otherwise FALSE. 240*f334afcfSToomas Soome /// 241*f334afcfSToomas Soome BOOLEAN MediaPresent; 242*f334afcfSToomas Soome } EFI_SIMPLE_NETWORK_MODE; 243*f334afcfSToomas Soome 244*f334afcfSToomas Soome // 245*f334afcfSToomas Soome // Protocol Member Functions 246*f334afcfSToomas Soome // 247*f334afcfSToomas Soome 248*f334afcfSToomas Soome /** 249*f334afcfSToomas Soome Changes the state of a network interface from "stopped" to "started". 250*f334afcfSToomas Soome 251*f334afcfSToomas Soome @param This Protocol instance pointer. 252*f334afcfSToomas Soome 253*f334afcfSToomas Soome @retval EFI_SUCCESS The network interface was started. 254*f334afcfSToomas Soome @retval EFI_ALREADY_STARTED The network interface is already in the started state. 255*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 256*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 257*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 258*f334afcfSToomas Soome 259*f334afcfSToomas Soome **/ 260*f334afcfSToomas Soome typedef 261*f334afcfSToomas Soome EFI_STATUS 262*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_START)( 263*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This 264*f334afcfSToomas Soome ); 265*f334afcfSToomas Soome 266*f334afcfSToomas Soome /** 267*f334afcfSToomas Soome Changes the state of a network interface from "started" to "stopped". 268*f334afcfSToomas Soome 269*f334afcfSToomas Soome @param This Protocol instance pointer. 270*f334afcfSToomas Soome 271*f334afcfSToomas Soome @retval EFI_SUCCESS The network interface was stopped. 272*f334afcfSToomas Soome @retval EFI_ALREADY_STARTED The network interface is already in the stopped state. 273*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 274*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 275*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 276*f334afcfSToomas Soome 277*f334afcfSToomas Soome **/ 278*f334afcfSToomas Soome typedef 279*f334afcfSToomas Soome EFI_STATUS 280*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_STOP)( 281*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This 282*f334afcfSToomas Soome ); 283*f334afcfSToomas Soome 284*f334afcfSToomas Soome /** 285*f334afcfSToomas Soome Resets a network adapter and allocates the transmit and receive buffers 286*f334afcfSToomas Soome required by the network interface; optionally, also requests allocation 287*f334afcfSToomas Soome of additional transmit and receive buffers. 288*f334afcfSToomas Soome 289*f334afcfSToomas Soome @param This The protocol instance pointer. 290*f334afcfSToomas Soome @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space 291*f334afcfSToomas Soome that the driver should allocate for the network interface. 292*f334afcfSToomas Soome Some network interfaces will not be able to use the extra 293*f334afcfSToomas Soome buffer, and the caller will not know if it is actually 294*f334afcfSToomas Soome being used. 295*f334afcfSToomas Soome @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space 296*f334afcfSToomas Soome that the driver should allocate for the network interface. 297*f334afcfSToomas Soome Some network interfaces will not be able to use the extra 298*f334afcfSToomas Soome buffer, and the caller will not know if it is actually 299*f334afcfSToomas Soome being used. 300*f334afcfSToomas Soome 301*f334afcfSToomas Soome @retval EFI_SUCCESS The network interface was initialized. 302*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 303*f334afcfSToomas Soome @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and 304*f334afcfSToomas Soome receive buffers. 305*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 306*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 307*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 308*f334afcfSToomas Soome 309*f334afcfSToomas Soome **/ 310*f334afcfSToomas Soome typedef 311*f334afcfSToomas Soome EFI_STATUS 312*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE)( 313*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 314*f334afcfSToomas Soome IN UINTN ExtraRxBufferSize OPTIONAL, 315*f334afcfSToomas Soome IN UINTN ExtraTxBufferSize OPTIONAL 316*f334afcfSToomas Soome ); 317*f334afcfSToomas Soome 318*f334afcfSToomas Soome /** 319*f334afcfSToomas Soome Resets a network adapter and re-initializes it with the parameters that were 320*f334afcfSToomas Soome provided in the previous call to Initialize(). 321*f334afcfSToomas Soome 322*f334afcfSToomas Soome @param This The protocol instance pointer. 323*f334afcfSToomas Soome @param ExtendedVerification Indicates that the driver may perform a more 324*f334afcfSToomas Soome exhaustive verification operation of the device 325*f334afcfSToomas Soome during reset. 326*f334afcfSToomas Soome 327*f334afcfSToomas Soome @retval EFI_SUCCESS The network interface was reset. 328*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 329*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 330*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 331*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 332*f334afcfSToomas Soome 333*f334afcfSToomas Soome **/ 334*f334afcfSToomas Soome typedef 335*f334afcfSToomas Soome EFI_STATUS 336*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_RESET)( 337*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 338*f334afcfSToomas Soome IN BOOLEAN ExtendedVerification 339*f334afcfSToomas Soome ); 340*f334afcfSToomas Soome 341*f334afcfSToomas Soome /** 342*f334afcfSToomas Soome Resets a network adapter and leaves it in a state that is safe for 343*f334afcfSToomas Soome another driver to initialize. 344*f334afcfSToomas Soome 345*f334afcfSToomas Soome @param This Protocol instance pointer. 346*f334afcfSToomas Soome 347*f334afcfSToomas Soome @retval EFI_SUCCESS The network interface was shutdown. 348*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 349*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 350*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 351*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 352*f334afcfSToomas Soome 353*f334afcfSToomas Soome **/ 354*f334afcfSToomas Soome typedef 355*f334afcfSToomas Soome EFI_STATUS 356*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN)( 357*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This 358*f334afcfSToomas Soome ); 359*f334afcfSToomas Soome 360*f334afcfSToomas Soome /** 361*f334afcfSToomas Soome Manages the multicast receive filters of a network interface. 362*f334afcfSToomas Soome 363*f334afcfSToomas Soome @param This The protocol instance pointer. 364*f334afcfSToomas Soome @param Enable A bit mask of receive filters to enable on the network interface. 365*f334afcfSToomas Soome @param Disable A bit mask of receive filters to disable on the network interface. 366*f334afcfSToomas Soome @param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive 367*f334afcfSToomas Soome filters on the network interface to their default values. 368*f334afcfSToomas Soome @param McastFilterCnt Number of multicast HW MAC addresses in the new 369*f334afcfSToomas Soome MCastFilter list. This value must be less than or equal to 370*f334afcfSToomas Soome the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This 371*f334afcfSToomas Soome field is optional if ResetMCastFilter is TRUE. 372*f334afcfSToomas Soome @param MCastFilter A pointer to a list of new multicast receive filter HW MAC 373*f334afcfSToomas Soome addresses. This list will replace any existing multicast 374*f334afcfSToomas Soome HW MAC address list. This field is optional if 375*f334afcfSToomas Soome ResetMCastFilter is TRUE. 376*f334afcfSToomas Soome 377*f334afcfSToomas Soome @retval EFI_SUCCESS The multicast receive filter list was updated. 378*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 379*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 380*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 381*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 382*f334afcfSToomas Soome 383*f334afcfSToomas Soome **/ 384*f334afcfSToomas Soome typedef 385*f334afcfSToomas Soome EFI_STATUS 386*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS)( 387*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 388*f334afcfSToomas Soome IN UINT32 Enable, 389*f334afcfSToomas Soome IN UINT32 Disable, 390*f334afcfSToomas Soome IN BOOLEAN ResetMCastFilter, 391*f334afcfSToomas Soome IN UINTN MCastFilterCnt OPTIONAL, 392*f334afcfSToomas Soome IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL 393*f334afcfSToomas Soome ); 394*f334afcfSToomas Soome 395*f334afcfSToomas Soome /** 396*f334afcfSToomas Soome Modifies or resets the current station address, if supported. 397*f334afcfSToomas Soome 398*f334afcfSToomas Soome @param This The protocol instance pointer. 399*f334afcfSToomas Soome @param Reset Flag used to reset the station address to the network interfaces 400*f334afcfSToomas Soome permanent address. 401*f334afcfSToomas Soome @param New The new station address to be used for the network interface. 402*f334afcfSToomas Soome 403*f334afcfSToomas Soome @retval EFI_SUCCESS The network interfaces station address was updated. 404*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 405*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 406*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 407*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 408*f334afcfSToomas Soome 409*f334afcfSToomas Soome **/ 410*f334afcfSToomas Soome typedef 411*f334afcfSToomas Soome EFI_STATUS 412*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS)( 413*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 414*f334afcfSToomas Soome IN BOOLEAN Reset, 415*f334afcfSToomas Soome IN EFI_MAC_ADDRESS *New OPTIONAL 416*f334afcfSToomas Soome ); 417*f334afcfSToomas Soome 418*f334afcfSToomas Soome /** 419*f334afcfSToomas Soome Resets or collects the statistics on a network interface. 420*f334afcfSToomas Soome 421*f334afcfSToomas Soome @param This Protocol instance pointer. 422*f334afcfSToomas Soome @param Reset Set to TRUE to reset the statistics for the network interface. 423*f334afcfSToomas Soome @param StatisticsSize On input the size, in bytes, of StatisticsTable. On 424*f334afcfSToomas Soome output the size, in bytes, of the resulting table of 425*f334afcfSToomas Soome statistics. 426*f334afcfSToomas Soome @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that 427*f334afcfSToomas Soome contains the statistics. 428*f334afcfSToomas Soome 429*f334afcfSToomas Soome @retval EFI_SUCCESS The statistics were collected from the network interface. 430*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 431*f334afcfSToomas Soome @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer 432*f334afcfSToomas Soome size needed to hold the statistics is returned in 433*f334afcfSToomas Soome StatisticsSize. 434*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 435*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 436*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 437*f334afcfSToomas Soome 438*f334afcfSToomas Soome **/ 439*f334afcfSToomas Soome typedef 440*f334afcfSToomas Soome EFI_STATUS 441*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS)( 442*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 443*f334afcfSToomas Soome IN BOOLEAN Reset, 444*f334afcfSToomas Soome IN OUT UINTN *StatisticsSize OPTIONAL, 445*f334afcfSToomas Soome OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL 446*f334afcfSToomas Soome ); 447*f334afcfSToomas Soome 448*f334afcfSToomas Soome /** 449*f334afcfSToomas Soome Converts a multicast IP address to a multicast HW MAC address. 450*f334afcfSToomas Soome 451*f334afcfSToomas Soome @param This The protocol instance pointer. 452*f334afcfSToomas Soome @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set 453*f334afcfSToomas Soome to FALSE if the multicast IP address is IPv4 [RFC 791]. 454*f334afcfSToomas Soome @param IP The multicast IP address that is to be converted to a multicast 455*f334afcfSToomas Soome HW MAC address. 456*f334afcfSToomas Soome @param MAC The multicast HW MAC address that is to be generated from IP. 457*f334afcfSToomas Soome 458*f334afcfSToomas Soome @retval EFI_SUCCESS The multicast IP address was mapped to the multicast 459*f334afcfSToomas Soome HW MAC address. 460*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 461*f334afcfSToomas Soome @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer 462*f334afcfSToomas Soome size needed to hold the statistics is returned in 463*f334afcfSToomas Soome StatisticsSize. 464*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 465*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 466*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 467*f334afcfSToomas Soome 468*f334afcfSToomas Soome **/ 469*f334afcfSToomas Soome typedef 470*f334afcfSToomas Soome EFI_STATUS 471*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC)( 472*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 473*f334afcfSToomas Soome IN BOOLEAN IPv6, 474*f334afcfSToomas Soome IN EFI_IP_ADDRESS *IP, 475*f334afcfSToomas Soome OUT EFI_MAC_ADDRESS *MAC 476*f334afcfSToomas Soome ); 477*f334afcfSToomas Soome 478*f334afcfSToomas Soome /** 479*f334afcfSToomas Soome Performs read and write operations on the NVRAM device attached to a 480*f334afcfSToomas Soome network interface. 481*f334afcfSToomas Soome 482*f334afcfSToomas Soome @param This The protocol instance pointer. 483*f334afcfSToomas Soome @param ReadWrite TRUE for read operations, FALSE for write operations. 484*f334afcfSToomas Soome @param Offset Byte offset in the NVRAM device at which to start the read or 485*f334afcfSToomas Soome write operation. This must be a multiple of NvRamAccessSize and 486*f334afcfSToomas Soome less than NvRamSize. 487*f334afcfSToomas Soome @param BufferSize The number of bytes to read or write from the NVRAM device. 488*f334afcfSToomas Soome This must also be a multiple of NvramAccessSize. 489*f334afcfSToomas Soome @param Buffer A pointer to the data buffer. 490*f334afcfSToomas Soome 491*f334afcfSToomas Soome @retval EFI_SUCCESS The NVRAM access was performed. 492*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 493*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 494*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 495*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 496*f334afcfSToomas Soome 497*f334afcfSToomas Soome **/ 498*f334afcfSToomas Soome typedef 499*f334afcfSToomas Soome EFI_STATUS 500*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA)( 501*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 502*f334afcfSToomas Soome IN BOOLEAN ReadWrite, 503*f334afcfSToomas Soome IN UINTN Offset, 504*f334afcfSToomas Soome IN UINTN BufferSize, 505*f334afcfSToomas Soome IN OUT VOID *Buffer 506*f334afcfSToomas Soome ); 507*f334afcfSToomas Soome 508*f334afcfSToomas Soome /** 509*f334afcfSToomas Soome Reads the current interrupt status and recycled transmit buffer status from 510*f334afcfSToomas Soome a network interface. 511*f334afcfSToomas Soome 512*f334afcfSToomas Soome @param This The protocol instance pointer. 513*f334afcfSToomas Soome @param InterruptStatus A pointer to the bit mask of the currently active interrupts 514*f334afcfSToomas Soome If this is NULL, the interrupt status will not be read from 515*f334afcfSToomas Soome the device. If this is not NULL, the interrupt status will 516*f334afcfSToomas Soome be read from the device. When the interrupt status is read, 517*f334afcfSToomas Soome it will also be cleared. Clearing the transmit interrupt 518*f334afcfSToomas Soome does not empty the recycled transmit buffer array. 519*f334afcfSToomas Soome @param TxBuf Recycled transmit buffer address. The network interface will 520*f334afcfSToomas Soome not transmit if its internal recycled transmit buffer array 521*f334afcfSToomas Soome is full. Reading the transmit buffer does not clear the 522*f334afcfSToomas Soome transmit interrupt. If this is NULL, then the transmit buffer 523*f334afcfSToomas Soome status will not be read. If there are no transmit buffers to 524*f334afcfSToomas Soome recycle and TxBuf is not NULL, * TxBuf will be set to NULL. 525*f334afcfSToomas Soome 526*f334afcfSToomas Soome @retval EFI_SUCCESS The status of the network interface was retrieved. 527*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 528*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 529*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 530*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 531*f334afcfSToomas Soome 532*f334afcfSToomas Soome **/ 533*f334afcfSToomas Soome typedef 534*f334afcfSToomas Soome EFI_STATUS 535*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS)( 536*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 537*f334afcfSToomas Soome OUT UINT32 *InterruptStatus OPTIONAL, 538*f334afcfSToomas Soome OUT VOID **TxBuf OPTIONAL 539*f334afcfSToomas Soome ); 540*f334afcfSToomas Soome 541*f334afcfSToomas Soome /** 542*f334afcfSToomas Soome Places a packet in the transmit queue of a network interface. 543*f334afcfSToomas Soome 544*f334afcfSToomas Soome @param This The protocol instance pointer. 545*f334afcfSToomas Soome @param HeaderSize The size, in bytes, of the media header to be filled in by 546*f334afcfSToomas Soome the Transmit() function. If HeaderSize is non-zero, then it 547*f334afcfSToomas Soome must be equal to This->Mode->MediaHeaderSize and the DestAddr 548*f334afcfSToomas Soome and Protocol parameters must not be NULL. 549*f334afcfSToomas Soome @param BufferSize The size, in bytes, of the entire packet (media header and 550*f334afcfSToomas Soome data) to be transmitted through the network interface. 551*f334afcfSToomas Soome @param Buffer A pointer to the packet (media header followed by data) to be 552*f334afcfSToomas Soome transmitted. This parameter cannot be NULL. If HeaderSize is zero, 553*f334afcfSToomas Soome then the media header in Buffer must already be filled in by the 554*f334afcfSToomas Soome caller. If HeaderSize is non-zero, then the media header will be 555*f334afcfSToomas Soome filled in by the Transmit() function. 556*f334afcfSToomas Soome @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter 557*f334afcfSToomas Soome is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then 558*f334afcfSToomas Soome This->Mode->CurrentAddress is used for the source HW MAC address. 559*f334afcfSToomas Soome @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this 560*f334afcfSToomas Soome parameter is ignored. 561*f334afcfSToomas Soome @param Protocol The type of header to build. If HeaderSize is zero, then this 562*f334afcfSToomas Soome parameter is ignored. See RFC 1700, section "Ether Types", for 563*f334afcfSToomas Soome examples. 564*f334afcfSToomas Soome 565*f334afcfSToomas Soome @retval EFI_SUCCESS The packet was placed on the transmit queue. 566*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 567*f334afcfSToomas Soome @retval EFI_NOT_READY The network interface is too busy to accept this transmit request. 568*f334afcfSToomas Soome @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small. 569*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 570*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 571*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 572*f334afcfSToomas Soome 573*f334afcfSToomas Soome **/ 574*f334afcfSToomas Soome typedef 575*f334afcfSToomas Soome EFI_STATUS 576*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT)( 577*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 578*f334afcfSToomas Soome IN UINTN HeaderSize, 579*f334afcfSToomas Soome IN UINTN BufferSize, 580*f334afcfSToomas Soome IN VOID *Buffer, 581*f334afcfSToomas Soome IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, 582*f334afcfSToomas Soome IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, 583*f334afcfSToomas Soome IN UINT16 *Protocol OPTIONAL 584*f334afcfSToomas Soome ); 585*f334afcfSToomas Soome 586*f334afcfSToomas Soome /** 587*f334afcfSToomas Soome Receives a packet from a network interface. 588*f334afcfSToomas Soome 589*f334afcfSToomas Soome @param This The protocol instance pointer. 590*f334afcfSToomas Soome @param HeaderSize The size, in bytes, of the media header received on the network 591*f334afcfSToomas Soome interface. If this parameter is NULL, then the media header size 592*f334afcfSToomas Soome will not be returned. 593*f334afcfSToomas Soome @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in 594*f334afcfSToomas Soome bytes, of the packet that was received on the network interface. 595*f334afcfSToomas Soome @param Buffer A pointer to the data buffer to receive both the media header and 596*f334afcfSToomas Soome the data. 597*f334afcfSToomas Soome @param SrcAddr The source HW MAC address. If this parameter is NULL, the 598*f334afcfSToomas Soome HW MAC source address will not be extracted from the media 599*f334afcfSToomas Soome header. 600*f334afcfSToomas Soome @param DestAddr The destination HW MAC address. If this parameter is NULL, 601*f334afcfSToomas Soome the HW MAC destination address will not be extracted from the 602*f334afcfSToomas Soome media header. 603*f334afcfSToomas Soome @param Protocol The media header type. If this parameter is NULL, then the 604*f334afcfSToomas Soome protocol will not be extracted from the media header. See 605*f334afcfSToomas Soome RFC 1700 section "Ether Types" for examples. 606*f334afcfSToomas Soome 607*f334afcfSToomas Soome @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has 608*f334afcfSToomas Soome been updated to the number of bytes received. 609*f334afcfSToomas Soome @retval EFI_NOT_STARTED The network interface has not been started. 610*f334afcfSToomas Soome @retval EFI_NOT_READY The network interface is too busy to accept this transmit 611*f334afcfSToomas Soome request. 612*f334afcfSToomas Soome @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small. 613*f334afcfSToomas Soome @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 614*f334afcfSToomas Soome @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 615*f334afcfSToomas Soome @retval EFI_UNSUPPORTED This function is not supported by the network interface. 616*f334afcfSToomas Soome 617*f334afcfSToomas Soome **/ 618*f334afcfSToomas Soome typedef 619*f334afcfSToomas Soome EFI_STATUS 620*f334afcfSToomas Soome (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE)( 621*f334afcfSToomas Soome IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 622*f334afcfSToomas Soome OUT UINTN *HeaderSize OPTIONAL, 623*f334afcfSToomas Soome IN OUT UINTN *BufferSize, 624*f334afcfSToomas Soome OUT VOID *Buffer, 625*f334afcfSToomas Soome OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL, 626*f334afcfSToomas Soome OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL, 627*f334afcfSToomas Soome OUT UINT16 *Protocol OPTIONAL 628*f334afcfSToomas Soome ); 629*f334afcfSToomas Soome 630*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000 631*f334afcfSToomas Soome 632*f334afcfSToomas Soome // 633*f334afcfSToomas Soome // Revision defined in EFI1.1 634*f334afcfSToomas Soome // 635*f334afcfSToomas Soome #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 636*f334afcfSToomas Soome 637*f334afcfSToomas Soome /// 638*f334afcfSToomas Soome /// The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access 639*f334afcfSToomas Soome /// to a network adapter. Once the network adapter initializes, 640*f334afcfSToomas Soome /// the EFI_SIMPLE_NETWORK_PROTOCOL protocol provides services that 641*f334afcfSToomas Soome /// allow packets to be transmitted and received. 642*f334afcfSToomas Soome /// 643*f334afcfSToomas Soome struct _EFI_SIMPLE_NETWORK_PROTOCOL { 644*f334afcfSToomas Soome /// 645*f334afcfSToomas Soome /// Revision of the EFI_SIMPLE_NETWORK_PROTOCOL. All future revisions must 646*f334afcfSToomas Soome /// be backwards compatible. If a future version is not backwards compatible 647*f334afcfSToomas Soome /// it is not the same GUID. 648*f334afcfSToomas Soome /// 649*f334afcfSToomas Soome UINT64 Revision; 650*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_START Start; 651*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_STOP Stop; 652*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_INITIALIZE Initialize; 653*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_RESET Reset; 654*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown; 655*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters; 656*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress; 657*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_STATISTICS Statistics; 658*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac; 659*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_NVDATA NvData; 660*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_GET_STATUS GetStatus; 661*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_TRANSMIT Transmit; 662*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_RECEIVE Receive; 663*f334afcfSToomas Soome /// 664*f334afcfSToomas Soome /// Event used with WaitForEvent() to wait for a packet to be received. 665*f334afcfSToomas Soome /// 666*f334afcfSToomas Soome EFI_EVENT WaitForPacket; 667*f334afcfSToomas Soome /// 668*f334afcfSToomas Soome /// Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device. 669*f334afcfSToomas Soome /// 670*f334afcfSToomas Soome EFI_SIMPLE_NETWORK_MODE *Mode; 671*f334afcfSToomas Soome }; 672*f334afcfSToomas Soome 673*f334afcfSToomas Soome extern EFI_GUID gEfiSimpleNetworkProtocolGuid; 674*f334afcfSToomas Soome 675*f334afcfSToomas Soome #endif 676