X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FInclude%2FProtocol%2FSimpleNetwork.h;h=18c09f3f4d59fd126fa9316ae8dcf467395d99bd;hp=ad873f188d9f1d0ca9c65ad792752905ec807b1d;hb=04789f89d5c762d3dc2274bd26a42b7badd46634;hpb=8a7d75b0625cffee0c67b85afe56763f93d86481 diff --git a/MdePkg/Include/Protocol/SimpleNetwork.h b/MdePkg/Include/Protocol/SimpleNetwork.h index ad873f188d..18c09f3f4d 100644 --- a/MdePkg/Include/Protocol/SimpleNetwork.h +++ b/MdePkg/Include/Protocol/SimpleNetwork.h @@ -1,5 +1,6 @@ /** @file - Simple Network protocol as defined in the UEFI 2.0 specification. + The EFI_SIMPLE_NETWORK_PROTOCOL provides services to initialize a network interface, + transmit packets, receive packets, and close a network interface. Basic network device abstraction. @@ -8,14 +9,17 @@ MCast - MultiCast ... - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php +Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + @par Revision Reference: + This Protocol is introduced in EFI Specification 1.10. **/ @@ -30,72 +34,72 @@ typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL; -// -// Protocol defined in EFI1.1. -// +/// +/// Protocol defined in EFI1.1. +/// typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK; -// -// Simple Network Protocol data structures -// +/// +/// Simple Network Protocol data structures. +/// typedef struct { - // - // Total number of frames received. Includes frames with errors and - // dropped frames. - // + /// + /// Total number of frames received. Includes frames with errors and + /// dropped frames. + /// UINT64 RxTotalFrames; - // - // Number of valid frames received and copied into receive buffers. - // + /// + /// Number of valid frames received and copied into receive buffers. + /// UINT64 RxGoodFrames; - // - // Number of frames below the minimum length for the media. - // This would be <64 for ethernet. - // + /// + /// Number of frames below the minimum length for the media. + /// This would be <64 for ethernet. + /// UINT64 RxUndersizeFrames; - // - // Number of frames longer than the maxminum length for the - // media. This would be >1500 for ethernet. - // + /// + /// Number of frames longer than the maxminum length for the + /// media. This would be >1500 for ethernet. + /// UINT64 RxOversizeFrames; - // - // Valid frames that were dropped because receive buffers were full. - // + /// + /// Valid frames that were dropped because receive buffers were full. + /// UINT64 RxDroppedFrames; - // - // Number of valid unicast frames received and not dropped. - // + /// + /// Number of valid unicast frames received and not dropped. + /// UINT64 RxUnicastFrames; - // - // Number of valid broadcast frames received and not dropped. - // + /// + /// Number of valid broadcast frames received and not dropped. + /// UINT64 RxBroadcastFrames; - // - // Number of valid mutlicast frames received and not dropped. - // + /// + /// Number of valid mutlicast frames received and not dropped. + /// UINT64 RxMulticastFrames; - // - // Number of frames w/ CRC or alignment errors. - // + /// + /// Number of frames w/ CRC or alignment errors. + /// UINT64 RxCrcErrorFrames; - // - // Total number of bytes received. Includes frames with errors - // and dropped frames. + /// + /// Total number of bytes received. Includes frames with errors + /// and dropped frames. // UINT64 RxTotalBytes; - // - // Transmit statistics. - // + /// + /// Transmit statistics. + /// UINT64 TxTotalFrames; UINT64 TxGoodFrames; UINT64 TxUndersizeFrames; @@ -107,18 +111,23 @@ typedef struct { UINT64 TxCrcErrorFrames; UINT64 TxTotalBytes; - // - // Number of collisions detection on this subnet. - // + /// + /// Number of collisions detection on this subnet. + /// UINT64 Collisions; - // - // Number of frames destined for unsupported protocol. - // + /// + /// Number of frames destined for unsupported protocol. + /// UINT64 UnsupportedProtocol; } EFI_NETWORK_STATISTICS; +/// +/// The state of the network interface. +/// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a +/// network interface, the network interface is left in the EfiSimpleNetworkStopped state. +/// typedef enum { EfiSimpleNetworkStopped, EfiSimpleNetworkStarted, @@ -139,24 +148,84 @@ typedef enum { #define MAX_MCAST_FILTER_CNT 16 typedef struct { + /// + /// Reports the current state of the network interface. + /// UINT32 State; + /// + /// The size, in bytes, of the network interface's HW address. + /// UINT32 HwAddressSize; + /// + /// The size, in bytes, of the network interface's media header. + /// UINT32 MediaHeaderSize; + /// + /// The maximum size, in bytes, of the packets supported by the network interface. + /// UINT32 MaxPacketSize; + /// + /// The size, in bytes, of the NVRAM device attached to the network interface. + /// UINT32 NvRamSize; + /// + /// The size that must be used for all NVRAM reads and writes. The + /// start address for NVRAM read and write operations and the total + /// length of those operations, must be a multiple of this value. The + /// legal values for this field are 0, 1, 2, 4, and 8. + /// UINT32 NvRamAccessSize; + /// + /// The multicast receive filter settings supported by the network interface. + /// UINT32 ReceiveFilterMask; + /// + /// The current multicast receive filter settings. + /// UINT32 ReceiveFilterSetting; + /// + /// The maximum number of multicast address receive filters supported by the driver. + /// UINT32 MaxMCastFilterCount; + /// + /// The current number of multicast address receive filters. + /// UINT32 MCastFilterCount; + /// + /// Array containing the addresses of the current multicast address receive filters. + /// EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT]; + /// + /// The current HW MAC address for the network interface. + /// EFI_MAC_ADDRESS CurrentAddress; + /// + /// The current HW MAC address for broadcast packets. + /// EFI_MAC_ADDRESS BroadcastAddress; + /// + /// The permanent HW MAC address for the network interface. + /// EFI_MAC_ADDRESS PermanentAddress; + /// + /// The interface type of the network interface. + /// UINT8 IfType; + /// + /// TRUE if the HW MAC address can be changed. + /// BOOLEAN MacAddressChangeable; + /// + /// TRUE if the network interface can transmit more than one packet at a time. + /// BOOLEAN MultipleTxSupported; + /// + /// TRUE if the presence of media can be determined; otherwise FALSE. + /// BOOLEAN MediaPresentSupported; + /// + /// TRUE if media are connected to the network interface; otherwise FALSE. + /// BOOLEAN MediaPresent; } EFI_SIMPLE_NETWORK_MODE; @@ -177,10 +246,9 @@ typedef struct { **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_START) ( +(EFIAPI *EFI_SIMPLE_NETWORK_START)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This - ) -; + ); /** Changes the state of a network interface from "started" to "stopped". @@ -196,17 +264,16 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_STOP) ( +(EFIAPI *EFI_SIMPLE_NETWORK_STOP)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This - ) -; + ); /** Resets a network adapter and allocates the transmit and receive buffers required by the network interface; optionally, also requests allocation of additional transmit and receive buffers. - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space that the driver should allocate for the network interface. Some network interfaces will not be able to use the extra @@ -219,9 +286,9 @@ EFI_STATUS being used. @retval EFI_SUCCESS The network interface was initialized. - @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_NOT_STARTED The network interface has not been started. @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and - receive buffers. . + receive buffers. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. @retval EFI_UNSUPPORTED This function is not supported by the network interface. @@ -229,24 +296,23 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) ( +(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINTN ExtraRxBufferSize OPTIONAL, IN UINTN ExtraTxBufferSize OPTIONAL - ) -; + ); /** Resets a network adapter and re-initializes it with the parameters that were provided in the previous call to Initialize(). - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param ExtendedVerification Indicates that the driver may perform a more exhaustive verification operation of the device during reset. @retval EFI_SUCCESS The network interface was reset. - @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_NOT_STARTED The network interface has not been started. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. @retval EFI_UNSUPPORTED This function is not supported by the network interface. @@ -254,11 +320,10 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_RESET) ( +(EFIAPI *EFI_SIMPLE_NETWORK_RESET)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN ExtendedVerification - ) -; + ); /** Resets a network adapter and leaves it in a state that is safe for @@ -267,7 +332,7 @@ EFI_STATUS @param This Protocol instance pointer. @retval EFI_SUCCESS The network interface was shutdown. - @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_NOT_STARTED The network interface has not been started. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. @retval EFI_UNSUPPORTED This function is not supported by the network interface. @@ -275,15 +340,14 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) ( +(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This - ) -; + ); /** Manages the multicast receive filters of a network interface. - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param Enable A bit mask of receive filters to enable on the network interface. @param Disable A bit mask of receive filters to disable on the network interface. @param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive @@ -298,7 +362,7 @@ EFI_STATUS ResetMCastFilter is TRUE. @retval EFI_SUCCESS The multicast receive filter list was updated. - @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_NOT_STARTED The network interface has not been started. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. @retval EFI_UNSUPPORTED This function is not supported by the network interface. @@ -306,26 +370,25 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) ( +(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINT32 Enable, IN UINT32 Disable, IN BOOLEAN ResetMCastFilter, IN UINTN MCastFilterCnt OPTIONAL, IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL - ) -; + ); /** Modifies or resets the current station address, if supported. - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param Reset Flag used to reset the station address to the network interfaces permanent address. - @param New New station address to be used for the network interface. + @param New The new station address to be used for the network interface. @retval EFI_SUCCESS The network interfaces station address was updated. - @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_NOT_STARTED The network interface has not been started. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. @retval EFI_UNSUPPORTED This function is not supported by the network interface. @@ -333,12 +396,11 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) ( +(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN EFI_MAC_ADDRESS *New OPTIONAL - ) -; + ); /** Resets or collects the statistics on a network interface. @@ -363,18 +425,17 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) ( +(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL - ) -; + ); /** Converts a multicast IP address to a multicast HW MAC address. - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set to FALSE if the multicast IP address is IPv4 [RFC 791]. @param IP The multicast IP address that is to be converted to a multicast @@ -394,19 +455,18 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) ( +(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN IPv6, IN EFI_IP_ADDRESS *IP, OUT EFI_MAC_ADDRESS *MAC - ) -; + ); /** Performs read and write operations on the NVRAM device attached to a network interface. - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param ReadWrite TRUE for read operations, FALSE for write operations. @param Offset Byte offset in the NVRAM device at which to start the read or write operation. This must be a multiple of NvRamAccessSize and @@ -424,20 +484,19 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) ( +(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN ReadWrite, IN UINTN Offset, IN UINTN BufferSize, IN OUT VOID *Buffer - ) -; + ); /** Reads the current interrupt status and recycled transmit buffer status from a network interface. - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param InterruptStatus A pointer to the bit mask of the currently active interrupts If this is NULL, the interrupt status will not be read from the device. If this is not NULL, the interrupt status will @@ -460,17 +519,16 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) ( +(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, OUT UINT32 *InterruptStatus OPTIONAL, OUT VOID **TxBuf OPTIONAL - ) -; + ); /** Places a packet in the transmit queue of a network interface. - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param HeaderSize The size, in bytes, of the media header to be filled in by the Transmit() function. If HeaderSize is non-zero, then it must be equal to This->Mode->MediaHeaderSize and the DestAddr @@ -485,7 +543,7 @@ EFI_STATUS @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then This->Mode->CurrentAddress is used for the source HW MAC address. - @param DsetAddr The destination HW MAC address. If HeaderSize is zero, then this + @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this parameter is ignored. @param Protocol The type of header to build. If HeaderSize is zero, then this parameter is ignored. See RFC 1700, section "Ether Types", for @@ -502,7 +560,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) ( +(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINTN HeaderSize, IN UINTN BufferSize, @@ -510,13 +568,12 @@ EFI_STATUS IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, IN UINT16 *Protocol OPTIONAL - ) -; + ); /** Receives a packet from a network interface. - @param This Protocol instance pointer. + @param This The protocol instance pointer. @param HeaderSize The size, in bytes, of the media header received on the network interface. If this parameter is NULL, then the media header size will not be returned. @@ -527,7 +584,7 @@ EFI_STATUS @param SrcAddr The source HW MAC address. If this parameter is NULL, the HW MAC source address will not be extracted from the media header. - @param DsetAddr The destination HW MAC address. If this parameter is NULL, + @param DestAddr The destination HW MAC address. If this parameter is NULL, the HW MAC destination address will not be extracted from the media header. @param Protocol The media header type. If this parameter is NULL, then the @@ -547,7 +604,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) ( +(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE)( IN EFI_SIMPLE_NETWORK_PROTOCOL *This, OUT UINTN *HeaderSize OPTIONAL, IN OUT UINTN *BufferSize, @@ -555,8 +612,7 @@ EFI_STATUS OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL, OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL, OUT UINT16 *Protocol OPTIONAL - ) -; + ); #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000 @@ -565,7 +621,18 @@ EFI_STATUS // #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION +/// +/// The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access +/// to a network adapter. Once the network adapter initializes, +/// the EFI_SIMPLE_NETWORK_PROTOCOL protocol provides services that +/// allow packets to be transmitted and received. +/// struct _EFI_SIMPLE_NETWORK_PROTOCOL { + /// + /// Revision of the EFI_SIMPLE_NETWORK_PROTOCOL. All future revisions must + /// be backwards compatible. If a future version is not backwards compatible + /// it is not the same GUID. + /// UINT64 Revision; EFI_SIMPLE_NETWORK_START Start; EFI_SIMPLE_NETWORK_STOP Stop; @@ -580,7 +647,13 @@ struct _EFI_SIMPLE_NETWORK_PROTOCOL { EFI_SIMPLE_NETWORK_GET_STATUS GetStatus; EFI_SIMPLE_NETWORK_TRANSMIT Transmit; EFI_SIMPLE_NETWORK_RECEIVE Receive; + /// + /// Event used with WaitForEvent() to wait for a packet to be received. + /// EFI_EVENT WaitForPacket; + /// + /// Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device. + /// EFI_SIMPLE_NETWORK_MODE *Mode; };