simplenetwork.h
来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 640 行 · 第 1/2 页
H
640 行
/*++
Copyright (c) 2004, 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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
SimpleNetwork.h
Abstract:
Simple Network protocol as defined in the EFI 1.0 specification.
Basic network device abstraction.
Rx - Received
Tx - Transmit
MCast - MultiCast
...
--*/
#ifndef _SIMPLE_NETWORK_H_
#define _SIMPLE_NETWORK_H_
#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
{ \
0xA19832B9, 0xAC25, 0x11D3, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D \
}
EFI_FORWARD_DECLARATION (EFI_SIMPLE_NETWORK_PROTOCOL);
//
// Simple Network Protocol data structures
//
typedef struct {
//
// Total number of frames received. Includes frames with errors and
// dropped frames.
//
UINT64 RxTotalFrames;
//
// 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.
//
UINT64 RxUndersizeFrames;
//
// 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.
//
UINT64 RxDroppedFrames;
//
// Number of valid unicast frames received and not dropped.
//
UINT64 RxUnicastFrames;
//
// Number of valid broadcast frames received and not dropped.
//
UINT64 RxBroadcastFrames;
//
// Number of valid mutlicast frames received and not dropped.
//
UINT64 RxMulticastFrames;
//
// Number of frames w/ CRC or alignment errors.
//
UINT64 RxCrcErrorFrames;
//
// Total number of bytes received. Includes frames with errors
// and dropped frames.
//
UINT64 RxTotalBytes;
//
// Transmit statistics.
//
UINT64 TxTotalFrames;
UINT64 TxGoodFrames;
UINT64 TxUndersizeFrames;
UINT64 TxOversizeFrames;
UINT64 TxDroppedFrames;
UINT64 TxUnicastFrames;
UINT64 TxBroadcastFrames;
UINT64 TxMulticastFrames;
UINT64 TxCrcErrorFrames;
UINT64 TxTotalBytes;
//
// Number of collisions detection on this subnet.
//
UINT64 Collisions;
//
// Number of frames destined for unsupported protocol.
//
UINT64 UnsupportedProtocol;
} EFI_NETWORK_STATISTICS;
typedef enum {
EfiSimpleNetworkStopped,
EfiSimpleNetworkStarted,
EfiSimpleNetworkInitialized,
EfiSimpleNetworkMaxState
} EFI_SIMPLE_NETWORK_STATE;
#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01
#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02
#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01
#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02
#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04
#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08
#define MAX_MCAST_FILTER_CNT 16
typedef struct {
UINT32 State;
UINT32 HwAddressSize;
UINT32 MediaHeaderSize;
UINT32 MaxPacketSize;
UINT32 NvRamSize;
UINT32 NvRamAccessSize;
UINT32 ReceiveFilterMask;
UINT32 ReceiveFilterSetting;
UINT32 MaxMCastFilterCount;
UINT32 MCastFilterCount;
EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];
EFI_MAC_ADDRESS CurrentAddress;
EFI_MAC_ADDRESS BroadcastAddress;
EFI_MAC_ADDRESS PermanentAddress;
UINT8 IfType;
BOOLEAN MacAddressChangeable;
BOOLEAN MultipleTxSupported;
BOOLEAN MediaPresentSupported;
BOOLEAN MediaPresent;
} EFI_SIMPLE_NETWORK_MODE;
//
// Protocol Member Functions
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_START) (
IN EFI_SIMPLE_NETWORK_PROTOCOL * This
)
/*++
Routine Description:
Changes the state of a network interface from "stopped" to "started".
Arguments:
This - Protocol instance pointer.
Returns:
EFI_SUCCESS - The network interface was started.
EFI_ALREADY_STARTED - The network interface is already in the started state.
EFI_INVALID_PARAMETER - One or more of the parameters has an unsupported value.
EFI_DEVICE_ERROR - The command could not be sent to the network interface.
EFI_UNSUPPORTED - This function is not supported by the network interface.
--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_STOP) (
IN EFI_SIMPLE_NETWORK_PROTOCOL * This
)
/*++
Routine Description:
Changes the state of a network interface from "started" to "stopped".
Arguments:
This - Protocol instance pointer.
Returns:
EFI_SUCCESS - The network interface was stopped.
EFI_ALREADY_STARTED - The network interface is already in the stopped state.
EFI_INVALID_PARAMETER - One or more of the parameters has an unsupported value.
EFI_DEVICE_ERROR - The command could not be sent to the network interface.
EFI_UNSUPPORTED - This function is not supported by the network interface.
--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) (
IN EFI_SIMPLE_NETWORK_PROTOCOL * This,
IN UINTN ExtraRxBufferSize OPTIONAL,
IN UINTN ExtraTxBufferSize OPTIONAL
)
/*++
Routine Description:
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.
Arguments:
This - Protocol instance pointer.
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
buffer, and the caller will not know if it is actually
being used.
ExtraTxBufferSize - The size, in bytes, of the extra transmit buffer space
that the driver should allocate for the network interface.
Some network interfaces will not be able to use the extra
buffer, and the caller will not know if it is actually
being used.
Returns:
EFI_SUCCESS - The network interface was initialized.
EFI_NOT_STARTED - The network interface has not been started
EFI_OUT_OF_RESOURCES - There was not enough memory for the transmit and
receive buffers. .
EFI_INVALID_PARAMETER - One or more of the parameters has an unsupported value.
EFI_DEVICE_ERROR - The command could not be sent to the network interface.
EFI_UNSUPPORTED - This function is not supported by the network interface.
--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_RESET) (
IN EFI_SIMPLE_NETWORK_PROTOCOL * This,
IN BOOLEAN ExtendedVerification
)
/*++
Routine Description:
Resets a network adapter and re-initializes it with the parameters that were
provided in the previous call to Initialize().
Arguments:
This - Protocol instance pointer.
ExtendedVerification - Indicates that the driver may perform a more
exhaustive verification operation of the device
during reset.
Returns:
EFI_SUCCESS - The network interface was reset.
EFI_NOT_STARTED - The network interface has not been started
EFI_INVALID_PARAMETER - One or more of the parameters has an unsupported value.
EFI_DEVICE_ERROR - The command could not be sent to the network interface.
EFI_UNSUPPORTED - This function is not supported by the network interface.
--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) (
IN EFI_SIMPLE_NETWORK_PROTOCOL * This
)
/*++
Routine Description:
Resets a network adapter and leaves it in a state that is safe for
another driver to initialize.
Arguments:
This - Protocol instance pointer.
Returns:
EFI_SUCCESS - The network interface was shutdown.
EFI_NOT_STARTED - The network interface has not been started
EFI_INVALID_PARAMETER - One or more of the parameters has an unsupported value.
EFI_DEVICE_ERROR - The command could not be sent to the network interface.
EFI_UNSUPPORTED - This function is not supported by the network interface.
--*/
;
typedef
EFI_STATUS
(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
)
/*++
Routine Description:
Manages the multicast receive filters of a network interface.
Arguments:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?