/** @file\r
+ Declaration of strctures and functions for SnpDxe driver.\r
\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2004 - 2008, Intel Corporation. <BR> \r
+All rights reserved. This program and the accompanying materials are licensed \r
+and made available under the terms and conditions of the BSD License which \r
+accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module name:\r
- snp.h\r
-\r
-Abstract:\r
-\r
-Revision history:\r
-\r
-\r
**/\r
-#ifndef _SNP_H\r
-#define _SNP_H\r
+#ifndef _SNP_H_\r
+#define _SNP_H_\r
\r
\r
#include <PiDxe.h>\r
#define PCI_BAR_MEM_MODE 0x00000000\r
#define PCI_BAR_MEM_64BIT 0x00000004\r
\r
+typedef\r
+EFI_STATUS\r
+(*ISSUE_UNDI32_COMMAND) (\r
+ UINT64 Cdb\r
+ );\r
+ \r
typedef struct {\r
UINT32 Signature;\r
- EFI_LOCK lock;\r
+ EFI_LOCK Lock;\r
\r
- EFI_SIMPLE_NETWORK_PROTOCOL snp;\r
- EFI_SIMPLE_NETWORK_MODE mode;\r
+ EFI_SIMPLE_NETWORK_PROTOCOL Snp;\r
+ EFI_SIMPLE_NETWORK_MODE Mode;\r
\r
- EFI_HANDLE device_handle;\r
- EFI_DEVICE_PATH_PROTOCOL *device_path;\r
+ EFI_HANDLE DeviceHandle;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
\r
//\r
// Local instance data needed by SNP driver\r
// Pointer to S/W UNDI API entry point\r
// This will be NULL for H/W UNDI\r
//\r
- EFI_STATUS (*issue_undi32_command) (UINT64 cdb);\r
+ ISSUE_UNDI32_COMMAND IssueUndi32Command;\r
\r
- BOOLEAN is_swundi;\r
+ BOOLEAN IsSwUndi;\r
\r
//\r
// undi interface number, if one undi manages more nics\r
//\r
- PXE_IFNUM if_num;\r
+ PXE_IFNUM IfNum;\r
\r
//\r
// Allocated tx/rx buffer that was passed to UNDI Initialize.\r
//\r
- UINT32 tx_rx_bufsize;\r
- VOID *tx_rx_buffer;\r
+ UINT32 TxRxBufferSize;\r
+ VOID *TxRxBuffer;\r
//\r
// mappable buffers for receive and fill header for undi3.0\r
// these will be used if the user buffers are above 4GB limit (instead of\r
// mapping the user buffers)\r
//\r
- UINT8 *receive_buf;\r
- VOID *ReceiveBufUnmap;\r
- UINT8 *fill_hdr_buf;\r
- VOID *FillHdrBufUnmap;\r
+ UINT8 *ReceiveBufffer;\r
+ VOID *ReceiveBufferUnmap;\r
+ UINT8 *FillHeaderBuffer;\r
+ VOID *FillHeaderBufferUnmap;\r
\r
- EFI_PCI_IO_PROTOCOL *IoFncs;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
UINT8 IoBarIndex;\r
UINT8 MemoryBarIndex;\r
\r
// Buffers for command descriptor block, command parameter block\r
// and data block.\r
//\r
- PXE_CDB cdb;\r
- VOID *cpb;\r
+ PXE_CDB Cdb;\r
+ VOID *Cpb;\r
VOID *CpbUnmap;\r
- VOID *db;\r
+ VOID *Db;\r
\r
//\r
// UNDI structure, we need to remember the init info for a long time!\r
//\r
- PXE_DB_GET_INIT_INFO init_info;\r
+ PXE_DB_GET_INIT_INFO InitInfo;\r
\r
VOID *SnpDriverUnmap;\r
//\r
// when ever we map an address, we must remember it's address and the un-map\r
// cookie so that we can unmap later\r
//\r
- struct s_map_list {\r
- EFI_PHYSICAL_ADDRESS virt;\r
- VOID *map_cookie;\r
- } map_list[MAX_MAP_LENGTH];\r
-}\r
-SNP_DRIVER;\r
+ struct MAP_LIST {\r
+ EFI_PHYSICAL_ADDRESS VirtualAddress;\r
+ VOID *MapCookie;\r
+ } MapList[MAX_MAP_LENGTH];\r
+} SNP_DRIVER;\r
\r
-#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, snp, SNP_DRIVER_SIGNATURE)\r
+#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE)\r
\r
//\r
// Global Variables\r
//\r
// Virtual to physical mapping for all UNDI 3.0s.\r
//\r
-extern struct s_v2p {\r
- struct s_v2p *next;\r
- VOID *vaddr;\r
- UINTN bsize;\r
- EFI_PHYSICAL_ADDRESS paddr;\r
- VOID *unmap;\r
-}\r
-*_v2p;\r
+typedef struct _V2P {\r
+ struct _V2P *Next;\r
+ VOID *VirtualAddress;\r
+ UINTN BufferSize;\r
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;\r
+ VOID *Unmap;\r
+} V2P;\r
+\r
+/**\r
+ This routine maps the given CPU address to a Device address. It creates a\r
+ an entry in the map list with the virtual and physical addresses and the\r
+ un map cookie.\r
+\r
+ @param V2p pointer to return a map list node pointer.\r
+ @param Type the direction in which the data flows from the given\r
+ virtual address device->cpu or cpu->device or both\r
+ ways.\r
+ @param VirtualAddress virtual address (or CPU address) to be mapped.\r
+ @param BufferSize size of the buffer to be mapped.\r
+\r
+ @retval EFI_SUCEESS routine has completed the mapping.\r
+ @retval other error as indicated.\r
\r
+**/\r
EFI_STATUS\r
-add_v2p (\r
- struct s_v2p **v2p,\r
- EFI_PCI_IO_PROTOCOL_OPERATION type,\r
- VOID *vaddr,\r
- UINTN bsize\r
+AddV2p (\r
+ V2P **V2p,\r
+ EFI_PCI_IO_PROTOCOL_OPERATION Type,\r
+ VOID *VirtualAddress,\r
+ UINTN BufferSize\r
);\r
\r
+/**\r
+ This routine searches the linked list of mapped address nodes (for undi3.0\r
+ interface) to find the node that corresponds to the given virtual address and\r
+ returns a pointer to that node.\r
+\r
+ @param V2p pointer to return a map list node pointer.\r
+ @param VirtualAddress virtual address (or CPU address) to be searched in\r
+ the map list\r
+\r
+ @retval EFI_SUCEESS if a match found!\r
+ @retval Other match not found\r
+\r
+**/\r
EFI_STATUS\r
-find_v2p (\r
- struct s_v2p **v2p,\r
- VOID *vaddr\r
+FindV2p (\r
+ V2P **V2p,\r
+ VOID *VirtualAddress\r
);\r
\r
+/**\r
+ this routine calls undi to start the interface and changes the snp state.\r
+\r
+ @param Snp pointer to snp driver structure\r
+\r
+ @retval EFI_DEVICE_ERROR UNDI could not be started\r
+ @retval EFI_SUCCESS UNDI is started successfully\r
+ \r
+**/\r
+EFI_STATUS\r
+PxeStart (\r
+ IN SNP_DRIVER *Snp\r
+ );\r
+\r
+/**\r
+ this routine calls undi to stop the interface and changes the snp state.\r
+\r
+ @param Snp pointer to snp driver structure\r
+\r
+ @retval EFI_INVALID_PARAMETER invalid parameter\r
+ @retval EFI_NOT_STARTED SNP is not started\r
+ @retval EFI_DEVICE_ERROR SNP is not initialized\r
+ @retval EFI_UNSUPPORTED operation unsupported\r
+\r
+**/\r
+EFI_STATUS\r
+PxeStop (\r
+ SNP_DRIVER *Snp\r
+ );\r
+\r
+/**\r
+ this routine calls undi to initialize the interface.\r
+\r
+ @param Snp pointer to snp driver structure\r
+ @param CableDetectFlag Do/don't detect the cable (depending on what undi supports)\r
+ \r
+ @retval EFI_SUCCESS UNDI is initialized successfully\r
+ @retval EFI_DEVICE_ERROR UNDI could not be initialized\r
+ @retval Other other errors \r
+\r
+**/\r
+EFI_STATUS\r
+PxeInit (\r
+ SNP_DRIVER *Snp,\r
+ UINT16 CableDetectFlag\r
+ );\r
+ \r
+/**\r
+ this routine calls undi to shut down the interface.\r
+\r
+ @param Snp pointer to snp driver structure\r
+\r
+ @retval EFI_SUCCESS UNDI is shut down successfully\r
+ @retval EFI_DEVICE_ERROR UNDI could not be shut down\r
+\r
+**/\r
EFI_STATUS\r
-del_v2p (\r
- VOID *vaddr\r
+PxeShutdown (\r
+ IN SNP_DRIVER *Snp\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_block_30 (\r
+/**\r
+ this routine calls undi to read the MAC address of the NIC and updates the\r
+ mode structure with the address.\r
+\r
+ @param Snp pointer to snp driver structure.\r
+ \r
+ @retval EFI_SUCCESS the MAC address of the NIC is read successfully.\r
+ @retval EFI_DEVICE_ERROR failed to read the MAC address of the NIC.\r
+\r
+**/\r
+EFI_STATUS\r
+PxeGetStnAddr (\r
+ SNP_DRIVER *Snp\r
+ );\r
+\r
+/**\r
+ This routine unmaps the given virtual address and frees the memory allocated\r
+ for the map list node corresponding to that address.\r
+\r
+ @param VirtualAddress virtual address (or CPU address) to be unmapped\r
+\r
+ @retval EFI_SUCEESS if successfully unmapped\r
+ @retval Other as indicated by the error\r
+\r
+**/\r
+EFI_STATUS\r
+DelV2p (\r
+ VOID *VirtualAddress\r
+ );\r
+\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ UNDI call this routine when it wants to have exclusive access to a critical\r
+ section of the code/data.\r
+\r
+ @param Enable non-zero indicates acquire\r
+ zero indicates release\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackBlock30 (\r
IN UINT32 Enable\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_delay_30 (\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ UNDI call this routine with the number of micro seconds when it wants to\r
+ pause.\r
+\r
+ @param MicroSeconds number of micro seconds to pause, ususlly multiple of 10.\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackDelay30 (\r
IN UINT64 MicroSeconds\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_memio_30 (\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ This is the IO routine for UNDI. This is not currently being used by UNDI3.0\r
+ because Undi3.0 uses io/mem offsets relative to the beginning of the device\r
+ io/mem address and so it needs to use the PCI_IO_FUNCTION that abstracts the\r
+ start of the device's io/mem addresses. Since SNP cannot retrive the context\r
+ of the undi3.0 interface it cannot use the PCI_IO_FUNCTION that specific for\r
+ that NIC and uses one global IO functions structure, this does not work.\r
+ This however works fine for EFI1.0 Undis because they use absolute addresses\r
+ for io/mem access.\r
+\r
+ @param ReadOrWrite indicates read or write, IO or Memory\r
+ @param NumBytes number of bytes to read or write\r
+ @param Address IO or memory address to read from or write to\r
+ @param BufferAddr memory location to read into or that contains the bytes to \r
+ write\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackMemio30 (\r
IN UINT8 ReadOrWrite,\r
IN UINT8 NumBytes,\r
- IN UINT64 MemOrPortAddress,\r
- IN OUT UINT64 BufferPtr\r
+ IN UINT64 Address,\r
+ IN OUT UINT64 BufferAddr\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_v2p_30 (\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ UNDI call this routine with a virtual or CPU address that SNP provided to \r
+ convert it to a physical or device address. Since EFI uses the identical \r
+ mapping, this routine returns the physical address same as the virtual address\r
+ for most of the addresses. an address above 4GB cannot generally be used as a \r
+ device address, it needs to be mapped to a lower physical address. This \r
+ routine does not call the map routine itself, but it assumes that the mapping\r
+ was done at the time of providing the address to UNDI. This routine just \r
+ looks up the address in a map table (which is the v2p structure chain). \r
+ \r
+ @param CpuAddr virtual address of a buffer.\r
+ @param DeviceAddrPtr pointer to the physical address.\r
+ The DeviceAddrPtr will contain 0 in case of any error.\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackV2p30 (\r
IN UINT64 CpuAddr,\r
IN OUT UINT64 DeviceAddrPtr\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_block (\r
+/**\r
+ This is a callback routine supplied to UNDI3.1 at undi_start time.\r
+ UNDI call this routine when it wants to have exclusive access to a critical\r
+ section of the code/data.\r
+ New callbacks for 3.1:\r
+ there won't be a virtual2physical callback for UNDI 3.1 because undi3.1 uses\r
+ the MemMap call to map the required address by itself!\r
+\r
+ @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this to \r
+ store Undi interface context (Undi does not read or write\r
+ this variable)\r
+ @param Enable non-zero indicates acquire\r
+ zero indicates release\r
+**/\r
+VOID\r
+SnpUndi32CallbackBlock (\r
IN UINT64 UniqueId,\r
IN UINT32 Enable\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_delay (\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ UNDI call this routine with the number of micro seconds when it wants to\r
+ pause.\r
+\r
+ @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this to\r
+ store Undi interface context (Undi does not read or write\r
+ this variable)\r
+ @param MicroSeconds number of micro seconds to pause, ususlly multiple of 10.\r
+**/\r
+VOID\r
+SnpUndi32CallbackDelay (\r
IN UINT64 UniqueId,\r
IN UINT64 MicroSeconds\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_memio (\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ This is the IO routine for UNDI3.1 to start CPB.\r
+\r
+ @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this \r
+ to store Undi interface context (Undi does not read or\r
+ write this variable)\r
+ @param ReadOrWrite indicates read or write, IO or Memory.\r
+ @param NumBytes number of bytes to read or write.\r
+ @param MemOrPortAddr IO or memory address to read from or write to.\r
+ @param BufferPtr memory location to read into or that contains the bytes\r
+ to write.\r
+**/\r
+VOID\r
+SnpUndi32CallbackMemio (\r
IN UINT64 UniqueId,\r
IN UINT8 ReadOrWrite,\r
IN UINT8 NumBytes,\r
IN OUT UINT64 BufferPtr\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_map (\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ UNDI call this routine when it has to map a CPU address to a device\r
+ address.\r
+\r
+ @param UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store\r
+ Undi interface context (Undi does not read or write this variable)\r
+ @param CpuAddr - Virtual address to be mapped!\r
+ @param NumBytes - size of memory to be mapped\r
+ @param Direction - direction of data flow for this memory's usage:\r
+ cpu->device, device->cpu or both ways\r
+ @param DeviceAddrPtr - pointer to return the mapped device address\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackMap (\r
IN UINT64 UniqueId,\r
IN UINT64 CpuAddr,\r
IN UINT32 NumBytes,\r
IN OUT UINT64 DeviceAddrPtr\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_unmap (\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ UNDI call this routine when it wants to unmap an address that was previously\r
+ mapped using map callback.\r
+\r
+ @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this to store.\r
+ Undi interface context (Undi does not read or write this variable)\r
+ @param CpuAddr Virtual address that was mapped!\r
+ @param NumBytes size of memory mapped\r
+ @param Direction direction of data flow for this memory's usage:\r
+ cpu->device, device->cpu or both ways\r
+ @param DeviceAddr the mapped device address\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackUnmap (\r
IN UINT64 UniqueId,\r
IN UINT64 CpuAddr,\r
IN UINT32 NumBytes,\r
IN UINT32 Direction,\r
- IN UINT64 DeviceAddr // not a pointer to device address\r
+ IN UINT64 DeviceAddr\r
);\r
\r
-extern\r
-VOID \r
-snp_undi32_callback_sync (\r
+/**\r
+ This is a callback routine supplied to UNDI at undi_start time.\r
+ UNDI call this routine when it wants synchronize the virtual buffer contents\r
+ with the mapped buffer contents. The virtual and mapped buffers need not\r
+ correspond to the same physical memory (especially if the virtual address is\r
+ > 4GB). Depending on the direction for which the buffer is mapped, undi will\r
+ need to synchronize their contents whenever it writes to/reads from the buffer\r
+ using either the cpu address or the device address.\r
+\r
+ EFI does not provide a sync call, since virt=physical, we sould just do\r
+ the synchronization ourself here!\r
+\r
+ @param UniqueId This was supplied to UNDI at Undi_Start, SNP uses this to store\r
+ Undi interface context (Undi does not read or write this variable)\r
+ @param CpuAddr Virtual address that was mapped!\r
+ @param NumBytes size of memory mapped.\r
+ @param Direction direction of data flow for this memory's usage:\r
+ cpu->device, device->cpu or both ways.\r
+ @param DeviceAddr the mapped device address.\r
+\r
+**/\r
+VOID\r
+SnpUndi32CallbackSync (\r
IN UINT64 UniqueId,\r
IN UINT64 CpuAddr,\r
IN UINT32 NumBytes,\r
IN UINT32 Direction,\r
- IN UINT64 DeviceAddr // not a pointer to device address\r
+ IN UINT64 DeviceAddr\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Changes the state of a network interface from "stopped" to "started".\r
+ \r
+ This function starts a network interface. If the network interface successfully\r
+ starts, then EFI_SUCCESS will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS The network interface was started.\r
+ @retval EFI_ALREADY_STARTED The network interface is already in the started state.\r
+ @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid \r
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
+ @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_start (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Start (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Changes the state of a network interface from "started" to "stopped".\r
+ \r
+ This function stops a network interface. This call is only valid if the network\r
+ interface is in the started state. If the network interface was successfully\r
+ stopped, then EFI_SUCCESS will be returned.\r
+ \r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ \r
+ \r
+ @retval EFI_SUCCESS The network interface was stopped.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid \r
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
+ @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_stop (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Stop (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
);\r
\r
-extern\r
+/**\r
+ Resets a network adapter and allocates the transmit and receive buffers \r
+ required by the network interface; optionally, also requests allocation of \r
+ additional transmit and receive buffers.\r
+\r
+ This function allocates the transmit and receive buffers required by the network\r
+ interface. If this allocation fails, then EFI_OUT_OF_RESOURCES is returned.\r
+ If the allocation succeeds and the network interface is successfully initialized,\r
+ then EFI_SUCCESS will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+ @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space\r
+ that the driver should allocate for the network interface.\r
+ Some network interfaces will not be able to use the \r
+ extra buffer, and the caller will not know if it is \r
+ actually being used.\r
+ @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space\r
+ that the driver should allocate for the network interface.\r
+ Some network interfaces will not be able to use the\r
+ extra buffer, and the caller will not know if it is\r
+ actually being used.\r
+\r
+ @retval EFI_SUCCESS The network interface was initialized.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and\r
+ receive buffers.\r
+ @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid\r
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
+ @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.\r
+\r
+**/\r
EFI_STATUS \r
EFIAPI\r
-snp_undi32_initialize (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
- IN UINTN extra_rx_buffer_size OPTIONAL,\r
- IN UINTN extra_tx_buffer_size OPTIONAL\r
+SnpUndi32Initialize (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+ IN UINTN ExtraRxBufferSize OPTIONAL,\r
+ IN UINTN ExtraTxBufferSize OPTIONAL\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Resets a network adapter and reinitializes it with the parameters that were\r
+ provided in the previous call to Initialize().\r
+\r
+ This function resets a network adapter and reinitializes it with the parameters\r
+ that were provided in the previous call to Initialize(). The transmit and \r
+ receive queues are emptied and all pending interrupts are cleared.\r
+ Receive filters, the station address, the statistics, and the multicast-IP-to-HW \r
+ MAC addresses are not reset by this call. If the network interface was \r
+ successfully reset, then EFI_SUCCESS will be returned. If the driver has not \r
+ been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param ExtendedVerification Indicates that the driver may perform a more \r
+ exhaustive verification operation of the device \r
+ during reset.\r
+\r
+ @retval EFI_SUCCESS The network interface was reset.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
+ @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_reset (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
+SnpUndi32Reset (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
IN BOOLEAN ExtendedVerification\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Resets a network adapter and leaves it in a state that is safe for another \r
+ driver to initialize. \r
+ \r
+ This function releases the memory buffers assigned in the Initialize() call.\r
+ Pending transmits and receives are lost, and interrupts are cleared and disabled.\r
+ After this call, only the Initialize() and Stop() calls may be used. If the \r
+ network interface was successfully shutdown, then EFI_SUCCESS will be returned.\r
+ If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+\r
+ @retval EFI_SUCCESS The network interface was shutdown.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid \r
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_shutdown (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this\r
+SnpUndi32Shutdown (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Manages the multicast receive filters of a network interface.\r
+ \r
+ This function is used enable and disable the hardware and software receive \r
+ filters for the underlying network device.\r
+ The receive filter change is broken down into three steps: \r
+ * The filter mask bits that are set (ON) in the Enable parameter are added to \r
+ the current receive filter settings. \r
+ * The filter mask bits that are set (ON) in the Disable parameter are subtracted\r
+ from the updated receive filter settings.\r
+ * If the resulting receive filter setting is not supported by the hardware a\r
+ more liberal setting is selected.\r
+ If the same bits are set in the Enable and Disable parameters, then the bits \r
+ in the Disable parameter takes precedence.\r
+ If the ResetMCastFilter parameter is TRUE, then the multicast address list \r
+ filter is disabled (irregardless of what other multicast bits are set in the \r
+ Enable and Disable parameters). The SNP->Mode->MCastFilterCount field is set \r
+ to zero. The Snp->Mode->MCastFilter contents are undefined.\r
+ After enabling or disabling receive filter settings, software should verify \r
+ the new settings by checking the Snp->Mode->ReceiveFilterSettings, \r
+ Snp->Mode->MCastFilterCount and Snp->Mode->MCastFilter fields.\r
+ Note: Some network drivers and/or devices will automatically promote receive \r
+ filter settings if the requested setting can not be honored. For example, if\r
+ a request for four multicast addresses is made and the underlying hardware \r
+ only supports two multicast addresses the driver might set the promiscuous \r
+ or promiscuous multicast receive filters instead. The receiving software is\r
+ responsible for discarding any extra packets that get through the hardware \r
+ receive filters.\r
+ Note: Note: To disable all receive filter hardware, the network driver must \r
+ be Shutdown() and Stopped(). Calling ReceiveFilters() with Disable set to\r
+ Snp->Mode->ReceiveFilterSettings will make it so no more packets are \r
+ returned by the Receive() function, but the receive hardware may still be \r
+ moving packets into system memory before inspecting and discarding them.\r
+ Unexpected system errors, reboots and hangs can occur if an OS is loaded \r
+ and the network devices are not Shutdown() and Stopped().\r
+ If ResetMCastFilter is TRUE, then the multicast receive filter list on the \r
+ network interface will be reset to the default multicast receive filter list.\r
+ If ResetMCastFilter is FALSE, and this network interface allows the multicast \r
+ receive filter list to be modified, then the MCastFilterCnt and MCastFilter \r
+ are used to update the current multicast receive filter list. The modified \r
+ receive filter list settings can be found in the MCastFilter field of \r
+ EFI_SIMPLE_NETWORK_MODE. If the network interface does not allow the multicast\r
+ receive filter list to be modified, then EFI_INVALID_PARAMETER will be returned.\r
+ If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+ If the receive filter mask and multicast receive filter list have been \r
+ successfully updated on the network interface, EFI_SUCCESS will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param Enable A bit mask of receive filters to enable on the network\r
+ interface.\r
+ @param Disable A bit mask of receive filters to disable on the network\r
+ interface. For backward compatibility with EFI 1.1 \r
+ platforms, the EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit\r
+ must be set when the ResetMCastFilter parameter is TRUE.\r
+ @param ResetMCastFilter Set to TRUE to reset the contents of the multicast \r
+ receive filters on the network interface to their \r
+ default values. \r
+ @param MCastFilterCnt Number of multicast HW MAC addresses in the new MCastFilter\r
+ list. This value must be less than or equal to the \r
+ MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. \r
+ This field is optional if ResetMCastFilter is TRUE.\r
+ @param MCastFilter A pointer to a list of new multicast receive filter HW\r
+ MAC addresses. This list will replace any existing \r
+ multicast HW MAC address list. This field is optional \r
+ if ResetMCastFilter is TRUE.\r
+ \r
+ @retval EFI_SUCCESS The multicast receive filter list was updated.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ * This is NULL\r
+ * There are bits set in Enable that are not set\r
+ in Snp->Mode->ReceiveFilterMask\r
+ * There are bits set in Disable that are not set\r
+ in Snp->Mode->ReceiveFilterMask\r
+ * Multicast is being enabled (the \r
+ EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit is \r
+ set in Enable, it is not set in Disable, and \r
+ ResetMCastFilter is FALSE) and MCastFilterCount\r
+ is zero\r
+ * Multicast is being enabled and MCastFilterCount\r
+ is greater than Snp->Mode->MaxMCastFilterCount\r
+ * Multicast is being enabled and MCastFilter is NULL\r
+ * Multicast is being enabled and one or more of\r
+ the addresses in the MCastFilter list are not\r
+ valid multicast MAC addresses\r
+ @retval EFI_DEVICE_ERROR One or more of the following conditions is TRUE:\r
+ * The network interface has been started but has\r
+ not been initialized\r
+ * An unexpected error was returned by the \r
+ underlying network driver or device\r
+ @retval EFI_UNSUPPORTED This function is not supported by the network\r
+ interface.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_receive_filters (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
- IN UINT32 enable,\r
- IN UINT32 disable,\r
- IN BOOLEAN reset_mcast_filter,\r
- IN UINTN mcast_filter_count OPTIONAL,\r
- IN EFI_MAC_ADDRESS * mcast_filter OPTIONAL\r
+SnpUndi32ReceiveFilters (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+ IN UINT32 Enable,\r
+ IN UINT32 Disable,\r
+ IN BOOLEAN ResetMCastFilter,\r
+ IN UINTN MCastFilterCnt, OPTIONAL\r
+ IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Modifies or resets the current station address, if supported.\r
+ \r
+ This function modifies or resets the current station address of a network \r
+ interface, if supported. If Reset is TRUE, then the current station address is\r
+ set to the network interface's permanent address. If Reset is FALSE, and the \r
+ network interface allows its station address to be modified, then the current \r
+ station address is changed to the address specified by New. If the network \r
+ interface does not allow its station address to be modified, then \r
+ EFI_INVALID_PARAMETER will be returned. If the station address is successfully\r
+ updated on the network interface, EFI_SUCCESS will be returned. If the driver\r
+ has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param Reset Flag used to reset the station address to the network interface's \r
+ permanent address.\r
+ @param New New station address to be used for the network interface.\r
+\r
+\r
+ @retval EFI_SUCCESS The network interface's station address was updated.\r
+ @retval EFI_NOT_STARTED The Simple Network Protocol interface has not been \r
+ started by calling Start().\r
+ @retval EFI_INVALID_PARAMETER The New station address was not accepted by the NIC.\r
+ @retval EFI_INVALID_PARAMETER Reset is FALSE and New is NULL.\r
+ @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not \r
+ been initialized by calling Initialize().\r
+ @retval EFI_DEVICE_ERROR An error occurred attempting to set the new \r
+ station address.\r
+ @retval EFI_UNSUPPORTED The NIC does not support changing the network \r
+ interface's station address.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_station_address (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
- IN BOOLEAN reset,\r
- IN EFI_MAC_ADDRESS *new OPTIONAL\r
+SnpUndi32StationAddress (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+ IN BOOLEAN Reset,\r
+ IN EFI_MAC_ADDRESS *New OPTIONAL\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Resets or collects the statistics on a network interface.\r
+ \r
+ This function resets or collects the statistics on a network interface. If the\r
+ size of the statistics table specified by StatisticsSize is not big enough for\r
+ all the statistics that are collected by the network interface, then a partial\r
+ buffer of statistics is returned in StatisticsTable, StatisticsSize is set to \r
+ the size required to collect all the available statistics, and \r
+ EFI_BUFFER_TOO_SMALL is returned.\r
+ If StatisticsSize is big enough for all the statistics, then StatisticsTable \r
+ will be filled, StatisticsSize will be set to the size of the returned \r
+ StatisticsTable structure, and EFI_SUCCESS is returned.\r
+ If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+ If Reset is FALSE, and both StatisticsSize and StatisticsTable are NULL, then\r
+ no operations will be performed, and EFI_SUCCESS will be returned.\r
+ If Reset is TRUE, then all of the supported statistics counters on this network\r
+ interface will be reset to zero.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param Reset Set to TRUE to reset the statistics for the network interface.\r
+ @param StatisticsSize On input the size, in bytes, of StatisticsTable. On output \r
+ the size, in bytes, of the resulting table of statistics.\r
+ @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that \r
+ contains the statistics. Type EFI_NETWORK_STATISTICS is \r
+ defined in "Related Definitions" below. \r
+ \r
+ @retval EFI_SUCCESS The requested operation succeeded.\r
+ @retval EFI_NOT_STARTED The Simple Network Protocol interface has not been\r
+ started by calling Start().\r
+ @retval EFI_BUFFER_TOO_SMALL StatisticsSize is not NULL and StatisticsTable is \r
+ NULL. The current buffer size that is needed to \r
+ hold all the statistics is returned in StatisticsSize.\r
+ @retval EFI_BUFFER_TOO_SMALL StatisticsSize is not NULL and StatisticsTable is \r
+ not NULL. The current buffer size that is needed\r
+ to hold all the statistics is returned in \r
+ StatisticsSize. A partial set of statistics is \r
+ returned in StatisticsTable.\r
+ @retval EFI_INVALID_PARAMETER StatisticsSize is NULL and StatisticsTable is not \r
+ NULL.\r
+ @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not \r
+ been initialized by calling Initialize().\r
+ @retval EFI_DEVICE_ERROR An error was encountered collecting statistics \r
+ from the NIC.\r
+ @retval EFI_UNSUPPORTED The NIC does not support collecting statistics \r
+ from the network interface.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_statistics (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
- IN BOOLEAN reset,\r
- IN OUT UINTN *statistics_size OPTIONAL,\r
- IN OUT EFI_NETWORK_STATISTICS * statistics_table OPTIONAL\r
+SnpUndi32Statistics (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+ IN BOOLEAN Reset,\r
+ IN OUT UINTN *StatisticsSize, OPTIONAL\r
+ IN OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Converts a multicast IP address to a multicast HW MAC address.\r
+ \r
+ This function converts a multicast IP address to a multicast HW MAC address \r
+ for all packet transactions. If the mapping is accepted, then EFI_SUCCESS will\r
+ be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460].\r
+ Set to FALSE if the multicast IP address is IPv4 [RFC 791]. \r
+ @param IP The multicast IP address that is to be converted to a multicast \r
+ HW MAC address.\r
+ @param MAC The multicast HW MAC address that is to be generated from IP.\r
+ \r
+ @retval EFI_SUCCESS The multicast IP address was mapped to the\r
+ multicast HW MAC address.\r
+ @retval EFI_NOT_STARTED The Simple Network Protocol interface has not\r
+ been started by calling Start().\r
+ @retval EFI_INVALID_PARAMETER IP is NULL.\r
+ @retval EFI_INVALID_PARAMETER MAC is NULL.\r
+ @retval EFI_INVALID_PARAMETER IP does not point to a valid IPv4 or IPv6 \r
+ multicast address.\r
+ @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not \r
+ been initialized by calling Initialize().\r
+ @retval EFI_UNSUPPORTED IPv6 is TRUE and the implementation does not \r
+ support IPv6 multicast to MAC address conversion.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_mcast_ip_to_mac (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
+SnpUndi32McastIpToMac (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
IN BOOLEAN IPv6,\r
IN EFI_IP_ADDRESS *IP,\r
OUT EFI_MAC_ADDRESS *MAC\r
);\r
\r
-extern\r
-EFI_STATUS \r
-EFIAPI\r
-snp_undi32_nvdata (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,\r
- IN BOOLEAN read_write,\r
- IN UINTN offset,\r
- IN UINTN buffer_size,\r
- IN OUT VOID *buffer\r
- );\r
+/**\r
+ Performs read and write operations on the NVRAM device attached to a network \r
+ interface.\r
+ \r
+ This function performs read and write operations on the NVRAM device attached \r
+ to a network interface. If ReadWrite is TRUE, a read operation is performed.\r
+ If ReadWrite is FALSE, a write operation is performed. Offset specifies the \r
+ byte offset at which to start either operation. Offset must be a multiple of \r
+ NvRamAccessSize , and it must have a value between zero and NvRamSize. \r
+ BufferSize specifies the length of the read or write operation. BufferSize must\r
+ also be a multiple of NvRamAccessSize, and Offset + BufferSize must not exceed\r
+ NvRamSize. \r
+ If any of the above conditions is not met, then EFI_INVALID_PARAMETER will be \r
+ returned. \r
+ If all the conditions are met and the operation is "read," the NVRAM device \r
+ attached to the network interface will be read into Buffer and EFI_SUCCESS \r
+ will be returned. If this is a write operation, the contents of Buffer will be\r
+ used to update the contents of the NVRAM device attached to the network \r
+ interface and EFI_SUCCESS will be returned.\r
+ \r
+ It does the basic checking on the input parameters and retrieves snp structure\r
+ and then calls the read_nvdata() call which does the actual reading\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param ReadWrite TRUE for read operations, FALSE for write operations.\r
+ @param Offset Byte offset in the NVRAM device at which to start the read or \r
+ write operation. This must be a multiple of NvRamAccessSize \r
+ and less than NvRamSize. (See EFI_SIMPLE_NETWORK_MODE) \r
+ @param BufferSize The number of bytes to read or write from the NVRAM device. \r
+ This must also be a multiple of NvramAccessSize.\r
+ @param Buffer A pointer to the data buffer.\r
+\r
+ @retval EFI_SUCCESS The NVRAM access was performed.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ * The This parameter is NULL \r
+ * The This parameter does not point to a valid \r
+ EFI_SIMPLE_NETWORK_PROTOCOL structure\r
+ * The Offset parameter is not a multiple of \r
+ EFI_SIMPLE_NETWORK_MODE.NvRamAccessSize\r
+ * The Offset parameter is not less than \r
+ EFI_SIMPLE_NETWORK_MODE.NvRamSize\r
+ * The BufferSize parameter is not a multiple of \r
+ EFI_SIMPLE_NETWORK_MODE.NvRamAccessSize\r
+ * The Buffer parameter is NULL\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network \r
+ interface.\r
+ @retval EFI_UNSUPPORTED This function is not supported by the network\r
+ interface.\r
\r
-extern\r
-EFI_STATUS \r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_get_status (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
- OUT UINT32 *interrupt_status OPTIONAL,\r
- OUT VOID **tx_buffer OPTIONAL\r
+SnpUndi32NvData (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+ IN BOOLEAN ReadWrite,\r
+ IN UINTN Offset,\r
+ IN UINTN BufferSize,\r
+ IN OUT VOID *Buffer\r
);\r
\r
-extern\r
-EFI_STATUS \r
+/**\r
+ Reads the current interrupt status and recycled transmit buffer status from a\r
+ network interface.\r
+ \r
+ This function gets the current interrupt and recycled transmit buffer status \r
+ from the network interface. The interrupt status is returned as a bit mask in\r
+ InterruptStatus. If InterruptStatus is NULL, the interrupt status will not be\r
+ read. If TxBuf is not NULL, a recycled transmit buffer address will be retrieved.\r
+ If a recycled transmit buffer address is returned in TxBuf, then the buffer has\r
+ been successfully transmitted, and the status for that buffer is cleared. If\r
+ the status of the network interface is successfully collected, EFI_SUCCESS \r
+ will be returned. If the driver has not been initialized, EFI_DEVICE_ERROR will\r
+ be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param InterruptStatus A pointer to the bit mask of the currently active \r
+ interrupts (see "Related Definitions"). If this is NULL,\r
+ the interrupt status will not be read from the device.\r
+ If this is not NULL, the interrupt status will be read\r
+ from the device. When the interrupt status is read, it \r
+ will also be cleared. Clearing the transmit interrupt does \r
+ not empty the recycled transmit buffer array.\r
+ @param TxBuf Recycled transmit buffer address. The network interface\r
+ will not transmit if its internal recycled transmit \r
+ buffer array is full. Reading the transmit buffer does\r
+ not clear the transmit interrupt. If this is NULL, then\r
+ the transmit buffer status will not be read. If there \r
+ are no transmit buffers to recycle and TxBuf is not NULL, \r
+ TxBuf will be set to NULL.\r
+\r
+ @retval EFI_SUCCESS The status of the network interface was retrieved.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid \r
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network \r
+ interface.\r
+\r
+**/\r
+EFI_STATUS\r
EFIAPI\r
-snp_undi32_transmit (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
- IN UINTN header_size,\r
- IN UINTN buffer_size,\r
- IN VOID *buffer,\r
- IN EFI_MAC_ADDRESS * src_addr OPTIONAL,\r
- IN EFI_MAC_ADDRESS * dest_addr OPTIONAL,\r
- IN UINT16 *protocol OPTIONAL\r
+SnpUndi32GetStatus (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+ OUT UINT32 *InterruptStatus, OPTIONAL\r
+ OUT VOID **TxBuf OPTIONAL\r
);\r
\r
-extern\r
+/**\r
+ Places a packet in the transmit queue of a network interface.\r
+ \r
+ This function places the packet specified by Header and Buffer on the transmit\r
+ queue. If HeaderSize is nonzero and HeaderSize is not equal to \r
+ This->Mode->MediaHeaderSize, then EFI_INVALID_PARAMETER will be returned. If \r
+ BufferSize is less than This->Mode->MediaHeaderSize, then EFI_BUFFER_TOO_SMALL\r
+ will be returned. If Buffer is NULL, then EFI_INVALID_PARAMETER will be \r
+ returned. If HeaderSize is nonzero and DestAddr or Protocol is NULL, then\r
+ EFI_INVALID_PARAMETER will be returned. If the transmit engine of the network\r
+ interface is busy, then EFI_NOT_READY will be returned. If this packet can be \r
+ accepted by the transmit engine of the network interface, the packet contents \r
+ specified by Buffer will be placed on the transmit queue of the network \r
+ interface, and EFI_SUCCESS will be returned. GetStatus() can be used to \r
+ determine when the packet has actually been transmitted. The contents of the \r
+ Buffer must not be modified until the packet has actually been transmitted. \r
+ The Transmit() function performs nonblocking I/O. A caller who wants to perform\r
+ blocking I/O, should call Transmit(), and then GetStatus() until the \r
+ transmitted buffer shows up in the recycled transmit buffer.\r
+ If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param HeaderSize The size, in bytes, of the media header to be filled in by the \r
+ Transmit() function. If HeaderSize is nonzero, then it must\r
+ be equal to This->Mode->MediaHeaderSize and the DestAddr and\r
+ Protocol parameters must not be NULL.\r
+ @param BufferSize The size, in bytes, of the entire packet (media header and\r
+ data) to be transmitted through the network interface.\r
+ @param Buffer A pointer to the packet (media header followed by data) to be \r
+ transmitted. This parameter cannot be NULL. If HeaderSize is \r
+ zero, then the media header in Buffer must already be filled\r
+ in by the caller. If HeaderSize is nonzero, then the media \r
+ header will be filled in by the Transmit() function.\r
+ @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this \r
+ parameter is ignored. If HeaderSize is nonzero and SrcAddr \r
+ is NULL, then This->Mode->CurrentAddress is used for the \r
+ source HW MAC address.\r
+ @param DestAddr The destination HW MAC address. If HeaderSize is zero, then \r
+ this parameter is ignored.\r
+ @param Protocol The type of header to build. If HeaderSize is zero, then this \r
+ parameter is ignored. See RFC 1700, section "Ether Types," \r
+ for examples.\r
+\r
+ @retval EFI_SUCCESS The packet was placed on the transmit queue.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_NOT_READY The network interface is too busy to accept this\r
+ transmit request.\r
+ @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r
+ @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported\r
+ value.\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
+ @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
+\r
+**/\r
EFI_STATUS \r
EFIAPI\r
-snp_undi32_receive (\r
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,\r
- OUT UINTN *header_size OPTIONAL,\r
- IN OUT UINTN *buffer_size,\r
- OUT VOID *buffer,\r
- OUT EFI_MAC_ADDRESS * src_addr OPTIONAL,\r
- OUT EFI_MAC_ADDRESS * dest_addr OPTIONAL,\r
- OUT UINT16 *protocol OPTIONAL\r
+SnpUndi32Transmit (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+ IN UINTN HeaderSize,\r
+ IN UINTN BufferSize,\r
+ IN VOID *Buffer,\r
+ IN EFI_MAC_ADDRESS *SrcAddr, OPTIONAL\r
+ IN EFI_MAC_ADDRESS *DestAddr, OPTIONAL\r
+ IN UINT16 *Protocol OPTIONAL\r
);\r
\r
-typedef\r
+/**\r
+ Receives a packet from a network interface.\r
+\r
+ This function retrieves one packet from the receive queue of a network interface.\r
+ If there are no packets on the receive queue, then EFI_NOT_READY will be \r
+ returned. If there is a packet on the receive queue, and the size of the packet\r
+ is smaller than BufferSize, then the contents of the packet will be placed in\r
+ Buffer, and BufferSize will be updated with the actual size of the packet.\r
+ In addition, if SrcAddr, DestAddr, and Protocol are not NULL, then these values\r
+ will be extracted from the media header and returned. EFI_SUCCESS will be \r
+ returned if a packet was successfully received.\r
+ If BufferSize is smaller than the received packet, then the size of the receive\r
+ packet will be placed in BufferSize and EFI_BUFFER_TOO_SMALL will be returned.\r
+ If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.\r
+\r
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.\r
+ @param HeaderSize The size, in bytes, of the media header received on the network \r
+ interface. If this parameter is NULL, then the media header size \r
+ will not be returned.\r
+ @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in \r
+ bytes, of the packet that was received on the network interface.\r
+ @param Buffer A pointer to the data buffer to receive both the media\r
+ header and the data.\r
+ @param SrcAddr The source HW MAC address. If this parameter is NULL, the HW\r
+ MAC source address will not be extracted from the media header. \r
+ @param DestAddr The destination HW MAC address. If this parameter is NULL, \r
+ the HW MAC destination address will not be extracted from \r
+ the media header.\r
+ @param Protocol The media header type. If this parameter is NULL, then the \r
+ protocol will not be extracted from the media header. See \r
+ RFC 1700 section "Ether Types" for examples.\r
+\r
+ @retval EFI_SUCCESS The received data was stored in Buffer, and \r
+ BufferSize has been updated to the number of \r
+ bytes received.\r
+ @retval EFI_NOT_STARTED The network interface has not been started.\r
+ @retval EFI_NOT_READY No packets have been received on the network interface.\r
+ @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the received packets. \r
+ BufferSize has been updated to the required size.\r
+ @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+ * The This parameter is NULL\r
+ * The This parameter does not point to a valid \r
+ EFI_SIMPLE_NETWORK_PROTOCOL structure.\r
+ * The BufferSize parameter is NULL\r
+ * The Buffer parameter is NULL\r
+ @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
+\r
+**/\r
EFI_STATUS\r
-(*issue_undi32_command) (\r
- UINT64 cdb\r
- );\r
-typedef\r
-VOID\r
-(*ptr) (\r
- VOID\r
+EFIAPI\r
+SnpUndi32Receive (\r
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
+ OUT UINTN *HeaderSize OPTIONAL,\r
+ IN OUT UINTN *BufferSize,\r
+ OUT VOID *Buffer,\r
+ OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,\r
+ OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,\r
+ OUT UINT16 *Protocol OPTIONAL\r
);\r
\r
-\r
/**\r
- Install all the driver protocol\r
-\r
- @param ImageHandle Driver image handle\r
- @param SystemTable System services table\r
+ Nofication call back function for WaitForPacket event.\r
\r
- @retval EFI_SUCEESS Initialization routine has found UNDI hardware, loaded it's\r
- ROM, and installed a notify event for the Network\r
- Indentifier Interface Protocol successfully.\r
- @retval Other Return value from HandleProtocol for DeviceIoProtocol or\r
- LoadedImageProtocol\r
+ @param Event EFI Event.\r
+ @param SnpPtr Pointer to SNP_DRIVER structure.\r
\r
**/\r
-EFI_STATUS\r
+VOID\r
EFIAPI\r
-InitializeSnpNiiDriver (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+SnpWaitForPacketNotify (\r
+ EFI_EVENT Event,\r
+ VOID *SnpPtr\r
);\r
\r
#define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1)\r
\r
\r
-#endif /* _SNP_H */\r
+#endif /* _SNP_H_ */\r