79#ifdef EFI_DOWNGRADE_UX
80static EFI_GUID dummy_load_file_protocol_guid = {
81 0x6f6c7323, 0x2077, 0x7523,
82 { 0x6e, 0x68, 0x65, 0x6c, 0x70, 0x66, 0x75, 0x6c }
84#define efi_load_file_protocol_guid dummy_load_file_protocol_guid
194 DBGC ( snpdev,
"SNPDEV %p START\n", snpdev );
198 DBGC ( snpdev,
"SNPDEV %p allowing start while claimed\n",
218 DBGC ( snpdev,
"SNPDEV %p STOP\n", snpdev );
240 UINTN extra_rx_bufsize,
UINTN extra_tx_bufsize ) {
246 DBGC ( snpdev,
"SNPDEV %p INITIALIZE (%ld extra RX, %ld extra TX)\n",
247 snpdev, ( (
unsigned long ) extra_rx_bufsize ),
248 ( (
unsigned long ) extra_tx_bufsize ) );
257 DBGC ( snpdev,
"SNPDEV %p ignoring initialization while "
258 "claimed\n", snpdev );
267 DBGC ( snpdev,
"SNPDEV %p could not open %s: %s\n",
292 DBGC ( snpdev,
"SNPDEV %p RESET (%s extended verification)\n",
293 snpdev, ( ext_verify ?
"with" :
"without" ) );
311 DBGC ( snpdev,
"SNPDEV %p could not reopen %s: %s\n",
335 DBGC ( snpdev,
"SNPDEV %p SHUTDOWN\n", snpdev );
374 DBGC ( snpdev,
"SNPDEV %p RECEIVE_FILTERS %08x&~%08x%s %ld mcast\n",
375 snpdev, enable, disable, ( mcast_reset ?
" reset" :
"" ),
376 ( (
unsigned long ) mcast_count ) );
377 for ( i = 0 ; i < mcast_count ; i++ ) {
407 DBGC ( snpdev,
"SNPDEV %p STATION_ADDRESS %s\n", snpdev,
421 DBGC ( snpdev,
"SNPDEV %p MAC address changed while net "
422 "device open\n", snpdev );
444 DBGC ( snpdev,
"SNPDEV %p STATISTICS%s", snpdev,
445 ( reset ?
" reset" :
"" ) );
452 memset ( &stats_buf, 0,
sizeof ( stats_buf ) );
461 if ( *stats_len >
sizeof ( stats_buf ) )
462 *stats_len =
sizeof ( stats_buf );
464 memcpy ( stats, &stats_buf, *stats_len );
495 ip_str = ( ipv6 ?
"(IPv6)" :
497 DBGC ( snpdev,
"SNPDEV %p MCAST_IP_TO_MAC %s\n", snpdev, ip_str );
506 DBGC ( snpdev,
"SNPDEV %p could not hash %s: %s\n",
530 DBGC ( snpdev,
"SNPDEV %p NVDATA %s %lx+%lx\n", snpdev,
531 (
read ?
"read" :
"write" ), ( (
unsigned long )
offset ),
532 ( (
unsigned long )
len ) );
558 DBGC2 ( snpdev,
"SNPDEV %p GET_STATUS", snpdev );
562 DBGC2 ( snpdev,
"\n" );
577 DBGC2 ( snpdev,
" INTS:%02x", *interrupts );
588 DBGC2 ( snpdev,
" TX:%p", *txbuf );
594 DBGC2 ( snpdev,
"\n" );
621 unsigned int tx_fill;
624 DBGC2 ( snpdev,
"SNPDEV %p TRANSMIT %p+%lx", snpdev,
data,
625 ( (
unsigned long )
len ) );
626 if ( ll_header_len ) {
628 DBGC2 ( snpdev,
" src %s",
632 DBGC2 ( snpdev,
" dest %s",
636 DBGC2 ( snpdev,
" proto %04x", *net_proto );
639 DBGC2 ( snpdev,
"\n" );
651 if ( ll_header_len ) {
653 DBGC ( snpdev,
"SNPDEV %p TX invalid header length "
655 ( (
unsigned long ) ll_header_len ) );
659 if (
len < ll_header_len ) {
660 DBGC ( snpdev,
"SNPDEV %p invalid packet length %ld\n",
661 snpdev, ( (
unsigned long )
len ) );
666 DBGC ( snpdev,
"SNPDEV %p TX missing destination "
667 "address\n", snpdev );
672 DBGC ( snpdev,
"SNPDEV %p TX missing network "
673 "protocol\n", snpdev );
686 DBGC ( snpdev,
"SNPDEV %p TX could not allocate %ld-byte "
687 "buffer\n", snpdev, ( (
unsigned long )
len ) );
696 if ( ll_header_len ) {
699 iobuf, ll_dest, ll_src,
700 htons ( *net_proto ) )) != 0 ){
701 DBGC ( snpdev,
"SNPDEV %p TX could not construct "
709 DBGC ( snpdev,
"SNPDEV %p TX could not transmit: %s\n",
725 DBGC ( snpdev,
"SNPDEV %p TX completion ring full\n", snpdev );
770 const void *iob_ll_dest;
771 const void *iob_ll_src;
773 unsigned int iob_flags;
777 DBGC2 ( snpdev,
"SNPDEV %p RECEIVE %p(+%lx)", snpdev,
data,
778 ( (
unsigned long ) *
len ) );
795 DBGC2 ( snpdev,
"\n" );
806 if ( copy_len > *
len )
813 &iob_ll_src, &iob_net_proto,
814 &iob_flags ) ) != 0 ) {
815 DBGC ( snpdev,
"SNPDEV %p could not parse header: %s\n",
817 goto out_bad_ll_header;
828 *net_proto =
ntohs ( iob_net_proto );
852 DBGCP ( snpdev,
"SNPDEV %p WAIT_FOR_PACKET\n", snpdev );
991 DBGC ( snpdev,
"UNDI %p GET STATE\n", snpdev );
1014 DBGC ( snpdev,
"UNDI %p START\n", snpdev );
1032 DBGC ( snpdev,
"UNDI %p STOP\n", snpdev );
1055 DBGC ( snpdev,
"UNDI %p GET INIT INFO\n", snpdev );
1081 DBGC ( snpdev,
"UNDI %p INITIALIZE\n", snpdev );
1103 DBGC ( snpdev,
"UNDI %p RESET\n", snpdev );
1121 DBGC ( snpdev,
"UNDI %p SHUTDOWN\n", snpdev );
1140 DBGC ( snpdev,
"UNDI %p RECEIVE FILTERS\n", snpdev );
1169 DBGC ( snpdev,
"UNDI %p STATION ADDRESS\n", snpdev );
1174 if ( ( reset ||
mac ) &&
1208 DBGC2 ( snpdev,
"UNDI %p GET STATUS\n", snpdev );
1306 DBGC2 ( snpdev,
"UNDI %p TRANSMIT\n", snpdev );
1336 DBGC2 ( snpdev,
"UNDI %p RECEIVE\n", snpdev );
1340 &
src, &
dest, &proto ) ) != 0 )
1348 db->Protocol = proto;
1366 DBGC ( cdb,
"UNDI invalid interface number %d\n", cdb->
IFnum );
1398 &
db->get_init_info );
1420 &
db->station_address );
1441 DBGC ( snpdev,
"UNDI %p unsupported opcode %#04x\n",
1489 .Ipv6Supported =
TRUE,
1520 DBGC ( snpdev,
"SNPDEV %p could not create VLAN tag %d: %s\n",
1524 DBGC ( snpdev,
"SNPDEV %p created VLAN tag %d priority %d\n",
1572 len = ( (*count) *
sizeof ( *entry ) );
1625 DBGC ( snpdev,
"SNPDEV %p could not find VLAN tag %d\n",
1633 DBGC ( snpdev,
"SNPDEV %p removed VLAN tag %d\n", snpdev,
tag );
1725 DBGC ( snpdev,
"SNPDEV %p cannot load non-boot file\n",
1791 char vlan_name[ 12 ];
1797 snpdev =
zalloc (
sizeof ( *snpdev ) );
1812 DBGC ( snpdev,
"SNPDEV %p cannot support link-layer address "
1813 "length %d for %s\n", snpdev,
1816 goto err_ll_addr_len;
1826 DBGC ( snpdev,
"SNPDEV %p could not create event: %s\n",
1828 goto err_create_event;
1858 snprintf ( vlan_name,
sizeof ( vlan_name ),
", VLAN %d",
1861 vlan_name[0] =
'\0';
1879 sizeof ( snpdev->
name[0] ) ),
1884 if ( ! snpdev->
path ) {
1901 DBGC ( snpdev,
"SNPDEV %p could not install protocols: %s\n",
1903 goto err_install_protocol_interface;
1919 DBGC ( snpdev,
"SNPDEV %p could not open NII protocol: %s\n",
1926 DBGC ( snpdev,
"SNPDEV %p could not open NII31 protocol: %s\n",
1928 goto err_open_nii31;
1934 snpdev->
handle ) ) != 0 ) ) {
1935 DBGC ( snpdev,
"SNPDEV %p could not become child of %s: %s\n",
1938 goto err_efi_child_add;
1943 DBGC ( snpdev,
"SNPDEV %p could not install HII: %s\n",
1954 DBGC ( snpdev,
"SNPDEV %p installed for %s as device %s\n",
1978 DBGC ( snpdev,
"SNPDEV %p could not uninstall: %s\n",
1987 err_install_protocol_interface:
2000 DBGC ( snpdev,
"SNPDEV %p nullified and leaked\n", snpdev );
2016 DBG (
"SNP skipping non-SNP device %s\n",
netdev->name );
2023 DBGC ( snpdev,
"SNPDEV %p link is %s\n", snpdev,
2045 DBG (
"SNP skipping non-SNP device %s\n",
netdev->name );
2068 DBGC ( snpdev,
"SNPDEV %p could not uninstall: %s\n",
2087 DBGC ( snpdev,
"SNPDEV %p nullified and leaked\n", snpdev );
unsigned short UINT16
2-byte unsigned value.
unsigned char BOOLEAN
Logical Boolean.
char CHAR8
1-byte Character
UINT64 UINTN
Unsigned value of native width.
unsigned long long UINT64
8-byte unsigned value.
unsigned short CHAR16
2-byte Character.
unsigned char UINT8
1-byte unsigned value.
unsigned int UINT32
4-byte unsigned value.
#define NULL
NULL pointer (VOID *)
#define VOID
Undeclared type.
struct _EFI_COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2_PROTOCOL
struct _EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_PROTOCOL
@ EfiNetworkInterfaceUndi
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION
struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
Forward reference for pure ANSI compatability.
#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST
#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT
@ EfiSimpleNetworkInitialized
@ EfiSimpleNetworkStarted
@ EfiSimpleNetworkStopped
struct _EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL
#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST
#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
#define EFI_NOT_READY
Enumeration of EFI_STATUS.
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
#define EFI_INVALID_PARAMETER
Enumeration of EFI_STATUS.
#define EFI_PROTOCOL_ERROR
Enumeration of EFI_STATUS.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
GUID EFI_GUID
128-bit buffer containing a unique identifier value.
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
@ EfiBootServicesData
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
#define PXE_ROMID_MAJORVER
UNDI command interface revision.
#define PXE_STATCODE_INVALID_CDB
#define PXE_OPCODE_TRANSMIT
Transmit packet(s).
#define PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED
#define PXE_STATFLAGS_COMMAND_FAILED
#define PXE_STATFLAGS_GET_STATUS_TRANSMIT
If set, at least one transmit interrupt occurred.
#define PXE_STATCODE_DEVICE_FAILURE
#define PXE_OPCODE_STOP
Change UNDI operational state from Started to Stopped.
#define PXE_OPCODE_GET_STATUS
Get & clear interrupt status.
#define PXE_STATFLAGS_GET_STATUS_RECEIVE
If set, at least one receive interrupt occurred.
#define PXE_STATFLAGS_GET_STATE_STARTED
#define PXE_OPCODE_GET_STATE
Return UNDI operational state.
#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED
#define PXE_STATCODE_NO_DATA
struct s_pxe_dpb_station_address PXE_DB_STATION_ADDRESS
#define PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST
If set, all multicast packets will be received.
#define PXE_STATFLAGS_RECEIVE_FILTER_BROADCAST
If set, broadcast packets will be received.
struct s_pxe_cpb_station_address PXE_CPB_STATION_ADDRESS
struct s_pxe_cpb_fill_header PXE_CPB_FILL_HEADER
#define PXE_OPFLAGS_STATION_ADDRESS_RESET
#define PXE_STATFLAGS_CABLE_DETECT_SUPPORTED
struct s_pxe_sw_undi PXE_SW_UNDI
#define PXE_OPCODE_STATION_ADDRESS
Read & change station MAC address.
struct s_pxe_cpb_transmit PXE_CPB_TRANSMIT
#define PXE_STATFLAGS_COMMAND_COMPLETE
struct s_pxe_db_get_init_info PXE_DB_GET_INIT_INFO
#define PXE_ROMID_REV
!PXE structure format revision
#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA
This flag is set if there is no media detected.
#define PXE_STATCODE_BUFFER_FULL
#define PXE_STATCODE_BUSY
#define PXE_ROMID_SIGNATURE
Signature of !PXE structure.
#define PXE_ROMID_IMP_STATION_ADDR_SETTABLE
#define PXE_OPCODE_FILL_HEADER
Fill media header in packet for transmit.
struct s_pxe_cpb_fill_header_fragmented PXE_CPB_FILL_HEADER_FRAGMENTED
#define PXE_STATFLAGS_RECEIVE_FILTER_UNICAST
UNDI Receive Filters.
struct s_pxe_db_get_status PXE_DB_GET_STATUS
#define PXE_OPCODE_RESET
Re-initialize the NIC H/W.
#define PXE_OPFLAGS_FILL_HEADER_FRAGMENTED
struct s_pxe_db_receive PXE_DB_RECEIVE
#define PXE_STATCODE_INVALID_PARAMETER
#define PXE_STATFLAGS_STATUS_MASK
Common StatFlags that can be returned by all commands.
#define PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY
This flag is set if the transmitted buffer queue is empty.
#define PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED
#define PXE_OPCODE_RECEIVE
Receive packet.
#define PXE_BUSTYPE(a, b, c, d)
#define PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED
#define PXE_OPCODE_INITIALIZE
Changed UNDI operational state from Started to Initialized.
#define PXE_FRAME_TYPE_PROMISCUOUS
#define PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN
This flag is set if no transmitted buffer addresses were written into the DB.
#define PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED
#define PXE_OPCODE_RECEIVE_FILTERS
Read & change state of packet receive filters.
#define PXE_ROMID_IMP_TX_COMPLETE_INT_SUPPORTED
PXE_UINT16 PXE_STATCODE
UNDI Fill Header.
#define PXE_STATFLAGS_RECEIVE_FILTER_PROMISCUOUS
If set, all packets will be received.
#define PXE_STATFLAGS_GET_STATE_STOPPED
#define PXE_ROMID_MINORVER
#define PXE_OPCODE_START
Change UNDI operational state from Stopped to Started.
#define PXE_OPCODE_GET_INIT_INFO
Get UNDI initialization information.
#define PXE_ROMID_IMP_SW_VIRT_ADDR
struct s_pxe_cpb_receive PXE_CPB_RECEIVE
#define PXE_STATFLAGS_INITIALIZED_NO_MEDIA
UNDI Initialize.
#define PXE_STATCODE_SUCCESS
Common StatCodes returned by all UNDI commands, UNDI protocol functions and BC protocol functions.
#define PXE_STATCODE_UNSUPPORTED
#define PXE_OPCODE_SHUTDOWN
Change the UNDI operational state from Initialized to Started.
#define PXE_STATFLAGS_GET_STATE_INITIALIZED
struct _EFI_VLAN_CONFIG_PROTOCOL EFI_VLAN_CONFIG_PROTOCOL
struct arbelprm_rc_send_wqe rc
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" retur dest)
#define assert(condition)
Assert a condition at run-time.
int ipxe(struct net_device *netdev)
Main iPXE flow of execution.
uint16_t offset
Offset to command line.
static struct dmfe_private * db
uint64_t tag
Identity tag.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
struct efi_device * efidev_parent(struct device *dev)
Get parent EFI device.
EFI_GUID efi_component_name2_protocol_guid
Component name 2 protocol GUID.
EFI_GUID efi_simple_network_protocol_guid
Simple network protocol GUID.
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
EFI_GUID efi_vlan_config_protocol_guid
VLAN configuration protocol GUID.
EFI_GUID efi_load_file_protocol_guid
Load file protocol GUID.
EFI_GUID efi_nii_protocol_guid
Network interface identifier protocol GUID (old version)
EFI_GUID efi_nii31_protocol_guid
Network interface identifier protocol GUID (new version)
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
int efi_shutdown_in_progress
EFI shutdown is in progress.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
void efi_nullify_snp(EFI_SIMPLE_NETWORK_PROTOCOL *snp)
Nullify SNP interface.
void efi_nullify_nii(EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *nii)
Nullify NII interface.
void efi_nullify_load_file(EFI_LOAD_FILE_PROTOCOL *load_file)
Nullify Load File Protocol interface.
void efi_nullify_vlan(EFI_VLAN_CONFIG_PROTOCOL *vcfg)
Nullify VLAN configuration interface.
void efi_nullify_name2(EFI_COMPONENT_NAME2_PROTOCOL *name2)
Nullify Component Name Protocol interface.
void efi_close_by_driver(EFI_HANDLE handle, EFI_GUID *protocol)
Close protocol opened for persistent use by a driver.
EFI_DEVICE_PATH_PROTOCOL * efi_netdev_path(struct net_device *netdev)
Construct EFI device path for network device.
static EFI_STATUS EFIAPI efi_snp_statistics(EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN reset, UINTN *stats_len, EFI_NETWORK_STATISTICS *stats)
Get (or reset) statistics.
static EFI_STATUS EFIAPI efi_snp_station_address(EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN reset, EFI_MAC_ADDRESS *new)
Set station address.
static int efi_snp_probe(struct net_device *netdev, void *priv __unused)
Create SNP device.
static void efi_snp_set_state(struct efi_snp_device *snpdev)
Set EFI SNP mode state.
static EFI_STATUS EFIAPI efi_snp_receive_filters(EFI_SIMPLE_NETWORK_PROTOCOL *snp, UINT32 enable, UINT32 disable, BOOLEAN mcast_reset, UINTN mcast_count, EFI_MAC_ADDRESS *mcast)
Manage receive filters.
static EFI_STATUS EFIAPI efi_snp_shutdown(EFI_SIMPLE_NETWORK_PROTOCOL *snp)
Shut down the network device.
static PXE_SW_UNDI efi_snp_undi
UNDI interface.
static EFI_STATUS EFIAPI efi_snp_receive(EFI_SIMPLE_NETWORK_PROTOCOL *snp, UINTN *ll_header_len, UINTN *len, VOID *data, EFI_MAC_ADDRESS *ll_src, EFI_MAC_ADDRESS *ll_dest, UINT16 *net_proto)
Receive packet.
static struct efi_saved_tpl efi_snp_saved_tpl
TPL prior to network devices being claimed.
static EFI_STATUS efi_undi_receive(struct efi_snp_device *snpdev, PXE_CPB_RECEIVE *cpb, PXE_DB_RECEIVE *db)
Receive.
static EFI_STATUS EFIAPI efi_vlan_remove(EFI_VLAN_CONFIG_PROTOCOL *vcfg, UINT16 tag)
Remove VLAN device.
static EFI_SIMPLE_NETWORK_PROTOCOL efi_snp_device_snp
SNP interface.
struct efi_snp_device * find_snpdev(EFI_HANDLE handle)
Find SNP device by EFI device handle.
static EFIAPI VOID efi_undi_issue(UINT64 cdb_phys)
UNDI entry point.
static EFI_STATUS EFIAPI efi_snp_mcast_ip_to_mac(EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN ipv6, EFI_IP_ADDRESS *ip, EFI_MAC_ADDRESS *mac)
Convert multicast IP address to MAC address.
static EFI_STATUS EFIAPI efi_snp_load_file(EFI_LOAD_FILE_PROTOCOL *load_file, EFI_DEVICE_PATH_PROTOCOL *path __unused, BOOLEAN booting, UINTN *len __unused, VOID *data __unused)
Load file.
static EFI_STATUS EFIAPI efi_snp_initialize(EFI_SIMPLE_NETWORK_PROTOCOL *snp, UINTN extra_rx_bufsize, UINTN extra_tx_bufsize)
Open the network device.
static EFI_STATUS efi_undi_receive_filters(struct efi_snp_device *snpdev, PXE_CDB *cdb)
Get/set receive filters.
static void efi_snp_flush(struct efi_snp_device *snpdev)
Flush transmit ring and receive queue.
static struct efi_snp_device * efi_undi_snpdev(unsigned int ifnum)
Identify UNDI SNP device.
static EFI_STATUS efi_undi_start(struct efi_snp_device *snpdev)
Start.
static EFI_STATUS efi_undi_get_init_info(struct efi_snp_device *snpdev, PXE_CDB *cdb, PXE_DB_GET_INIT_INFO *db)
Get initialisation information.
struct efi_snp_device * last_opened_snpdev(void)
Get most recently opened SNP device.
static int efi_snp_claimed
Network devices are currently claimed for use by iPXE.
static unsigned int efi_undi_ifnum(struct efi_snp_device *snpdev)
Get UNDI SNP device interface number.
static EFI_STATUS EFIAPI efi_snp_start(EFI_SIMPLE_NETWORK_PROTOCOL *snp)
Change SNP state from "stopped" to "started".
static EFI_STATUS EFIAPI efi_snp_reset(EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN ext_verify)
Reset the network device.
static EFI_STATUS EFIAPI efi_snp_nvdata(EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN read, UINTN offset, UINTN len, VOID *data)
Read or write non-volatile storage.
static uint8_t efi_undi_checksum(void *data, size_t len)
Calculate UNDI byte checksum.
static EFI_STATUS EFIAPI efi_snp_get_status(EFI_SIMPLE_NETWORK_PROTOCOL *snp, UINT32 *interrupts, VOID **txbuf)
Read interrupt status and TX recycled buffer status.
void efi_snp_add_claim(int delta)
Add to SNP claimed/released count.
static EFI_STATUS efi_undi_reset(struct efi_snp_device *snpdev)
Reset.
static struct efi_snp_device * efi_snp_demux(struct net_device *netdev)
Locate SNP device corresponding to network device.
static EFI_STATUS efi_undi_stop(struct efi_snp_device *snpdev)
Stop.
static EFI_STATUS EFIAPI efi_vlan_find(EFI_VLAN_CONFIG_PROTOCOL *vcfg, UINT16 *filter, UINT16 *count, EFI_VLAN_FIND_DATA **entries)
Find VLAN device(s)
static EFI_LOAD_FILE_PROTOCOL efi_snp_load_file_protocol
Load file protocol.
static PXE_STATCODE efi_undi_statcode(EFI_STATUS efirc)
Convert EFI status code to UNDI status code.
static EFI_STATUS efi_undi_fill_header(struct efi_snp_device *snpdev, PXE_CDB *cdb, PXE_CPB_ANY *cpb)
Fill header.
static EFI_STATUS EFIAPI efi_snp_get_controller_name(EFI_COMPONENT_NAME2_PROTOCOL *name2, EFI_HANDLE device __unused, EFI_HANDLE child __unused, CHAR8 *language __unused, CHAR16 **controller_name)
Look up controller name.
static void efi_snp_set_mode(struct efi_snp_device *snpdev)
Set EFI SNP mode based on iPXE net device parameters.
static EFI_STATUS efi_undi_shutdown(struct efi_snp_device *snpdev)
Shutdown.
static void efi_snp_poll(struct efi_snp_device *snpdev)
Poll net device and count received packets.
static EFI_STATUS efi_undi_initialize(struct efi_snp_device *snpdev, PXE_CDB *cdb)
Initialise.
static EFI_VLAN_CONFIG_PROTOCOL efi_vlan
VLAN configuration protocol.
static void efi_snp_notify(struct net_device *netdev, void *priv __unused)
Handle SNP device or link state change.
static EFI_STATUS efi_undi_transmit(struct efi_snp_device *snpdev, PXE_CPB_TRANSMIT *cpb)
Transmit.
static EFI_STATUS EFIAPI efi_snp_stop(EFI_SIMPLE_NETWORK_PROTOCOL *snp)
Change SNP state from "started" to "stopped".
static EFI_STATUS efi_undi_get_status(struct efi_snp_device *snpdev, PXE_CDB *cdb, PXE_DB_GET_STATUS *db)
Get interrupt status.
static EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL efi_snp_device_nii
Network Identification Interface (NII)
static void efi_snp_remove(struct net_device *netdev, void *priv __unused)
Destroy SNP device.
static EFI_STATUS EFIAPI efi_snp_transmit(EFI_SIMPLE_NETWORK_PROTOCOL *snp, UINTN ll_header_len, UINTN len, VOID *data, EFI_MAC_ADDRESS *ll_src, EFI_MAC_ADDRESS *ll_dest, UINT16 *net_proto)
Start packet transmission.
static EFI_STATUS EFIAPI efi_vlan_set(EFI_VLAN_CONFIG_PROTOCOL *vcfg, UINT16 tag, UINT8 priority)
Create or modify VLAN device.
static EFI_STATUS efi_undi_station_address(struct efi_snp_device *snpdev, PXE_CDB *cdb, PXE_CPB_STATION_ADDRESS *cpb, PXE_DB_STATION_ADDRESS *db)
Get/set station address.
static EFI_STATUS efi_undi_get_state(struct efi_snp_device *snpdev, PXE_CDB *cdb)
Get state.
static EFI_STATUS EFIAPI efi_snp_get_driver_name(EFI_COMPONENT_NAME2_PROTOCOL *name2, CHAR8 *language __unused, CHAR16 **driver_name)
Look up driver name.
static VOID EFIAPI efi_snp_wait_for_packet(EFI_EVENT event __unused, VOID *context)
Poll event.
static void efi_snp_claim(void)
Claim network devices for use by iPXE.
static void efi_snp_release(void)
Release network devices for use via SNP.
#define EFI_SNP_NUM_TX
SNP transmit completion ring size.
int efi_snp_hii_install(struct efi_snp_device *snpdev)
Install HII protocol and packages for SNP device.
int efi_snp_hii_uninstall(struct efi_snp_device *snpdev)
Uninstall HII protocol and package for SNP device.
int efi_snprintf(wchar_t *wbuf, size_t wsize, const char *fmt,...)
Write a formatted string to a buffer.
void efi_child_del(EFI_HANDLE parent, EFI_HANDLE child)
Remove EFI device as child of another EFI device.
int efi_child_add(EFI_HANDLE parent, EFI_HANDLE child)
Add EFI device as child of another EFI device.
EFI watchdog holdoff timer.
static void efi_watchdog_start(void)
Start EFI watchdog holdoff timer.
static void efi_watchdog_stop(void)
Stop EFI watchdog holdoff timer.
uint8_t data[48]
Additional event data.
uint8_t mac[ETH_ALEN]
MAC address.
uint16_t mode
Acceleration mode.
static struct net_device * netdev
#define AF_INET
IPv4 Internet addresses.
#define AF_INET6
IPv6 Internet addresses.
#define __unused
Declare a variable or data structure as unused.
#define DBG(...)
Print a debugging message.
static unsigned int count
Number of entries.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ENOENT
No such file or directory.
#define EINVAL
Invalid argument.
#define ENOMEM
Not enough space.
#define ENOTSUP
Operation not supported.
#define ENOBUFS
No buffer space available.
#define ERANGE
Result too large.
#define EAGAIN
Resource temporarily unavailable.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
static void console_reset(void)
Reset console.
#define efi_open_by_driver(handle, protocol, interface)
Open protocol for persistent use by a driver.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
EFI_SYSTEM_TABLE * efi_systab
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define IOB_ZLEN
Minimum I/O buffer length and alignment.
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
#define iob_put(iobuf, len)
#define iob_disown(iobuf)
Disown an I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_reserve(iobuf, len)
#define iob_pull(iobuf, len)
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
#define list_del(list)
Delete an entry from a list.
#define INIT_LIST_HEAD(list)
Initialise a list head.
#define LIST_HEAD(list)
Declare a static list head.
#define list_add(new, head)
Add a new entry to the head of a list.
void * zalloc(size_t size)
Allocate cleared memory.
struct net_device * last_opened_netdev(void)
Get most recently opened network device.
struct io_buffer * netdev_rx_dequeue(struct net_device *netdev)
Remove packet from device's receive queue.
int netdev_open(struct net_device *netdev)
Open network device.
void netdev_close(struct net_device *netdev)
Close network device.
__weak unsigned int vlan_tci(struct net_device *netdev __unused)
Get the VLAN tag control information (when VLAN support is not present)
void netdev_poll(struct net_device *netdev)
Poll for completed and received packets on network device.
int netdev_tx(struct net_device *netdev, struct io_buffer *iobuf)
Transmit raw packet via network device.
Network device management.
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
static const char * netdev_addr(struct net_device *netdev)
Get printable network device link-layer address.
#define __net_driver
Declare a network driver.
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
struct option_descriptor read[1]
UINT8_t filter
Receive packet filter.
IP4_t ip
Destination IP address.
static void(* free)(struct refcnt *refcnt))
#define container_of(ptr, type, field)
Get containing structure.
uint16_t priority
Priotity.
char * strerror(int errno)
Retrieve string representation of error number.
EFI_CREATE_EVENT CreateEvent
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
EFI_CLOSE_EVENT CloseEvent
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
EFI_ALLOCATE_POOL AllocatePool
EFI_SIGNAL_EVENT SignalEvent
This protocol can be used on any device handle to obtain generic path/location information concerning...
32-byte buffer containing a network Media Access Control address.
Simple Network Protocol data structures.
UINT64 RxTotalFrames
Total number of frames received.
UINT64 RxDroppedFrames
Valid frames that were dropped because receive buffers were full.
UINT64 TxTotalFrames
Transmit statistics.
UINT64 RxGoodFrames
Number of valid frames received and copied into receive buffers.
EFI_MAC_ADDRESS CurrentAddress
The current HW MAC address for the network interface.
BOOLEAN MediaPresent
TRUE if media are connected to the network interface; otherwise FALSE.
UINT32 State
Reports the current state of the network interface.
EFI_MAC_ADDRESS PermanentAddress
The permanent HW MAC address for the network interface.
EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName
CHAR8 * SupportedLanguages
A Null-terminated ASCII string array that contains one or more supported language codes.
EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName
UINT16 IfNum
The network interface number that is being identified by this Network Interface Identifier Protocol.
UINT64 Id
The address of the first byte of the identifying structure for this network interface.
EFI_EVENT WaitForPacket
Event used with WaitForEvent() to wait for a packet to be received.
EFI_SIMPLE_NETWORK_MODE * Mode
Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
EFI_HANDLE device
EFI device handle.
An EFI saved task priority level.
EFI_HANDLE handle
EFI device handle.
EFI_VLAN_CONFIG_PROTOCOL vcfg
VLAN configuration protocol.
wchar_t controller_name[64]
Controller name.
struct list_head rx
Receive queue.
EFI_HANDLE parent
EFI parent device handle (if any)
unsigned int interrupts
Pending interrupt status.
EFI_HII_PACKAGE_LIST_HEADER * package_list
HII package list.
EFI_DEVICE_PATH_PROTOCOL * path
The device path.
struct net_device * netdev
The underlying iPXE network device.
wchar_t name[sizeof(((struct net_device *) NULL) ->name)]
Device name.
EFI_COMPONENT_NAME2_PROTOCOL name2
Component name protocol.
unsigned int tx_prod
Transmit completion ring producer counter.
unsigned int tx_cons
Transmit completion ring consumer counter.
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL nii
The network interface identifier.
EFI_SIMPLE_NETWORK_MODE mode
The SNP "mode" (parameters)
EFI_LOAD_FILE_PROTOCOL load_file
Load file protocol handle.
wchar_t driver_name[16]
Driver name.
VOID * tx[EFI_SNP_NUM_TX]
Transmit completion ring.
EFI_SIMPLE_NETWORK_PROTOCOL snp
The SNP structure itself.
struct list_head list
List of SNP devices.
void * data
Start of data.
struct list_head list
List of which this buffer is a member.
int(* push)(struct net_device *netdev, struct io_buffer *iobuf, const void *ll_dest, const void *ll_source, uint16_t net_proto)
Add link-layer header.
void(* init_addr)(const void *hw_addr, void *ll_addr)
Initialise link-layer address.
const char *(* ntoa)(const void *ll_addr)
Transcribe link-layer address.
int(* mc_hash)(unsigned int af, const void *net_addr, void *ll_addr)
Hash multicast address.
int(* pull)(struct net_device *netdev, struct io_buffer *iobuf, const void **ll_dest, const void **ll_source, uint16_t *net_proto, unsigned int *flags)
Remove link-layer header.
uint8_t ll_addr_len
Link-layer address length.
uint8_t ll_header_len
Link-layer header length.
uint8_t hw_addr_len
Hardware address length.
uint16_t ll_proto
Link-layer protocol.
unsigned int good
Count of successful completions.
unsigned int bad
Count of error completions.
struct net_device_stats rx_stats
RX statistics.
struct ll_protocol * ll_protocol
Link-layer protocol.
char name[NETDEV_NAME_LEN]
Name of this network device.
unsigned int scope_id
Scope ID.
struct net_device_stats tx_stats
TX statistics.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
A network upper-layer driver.
PXE_UINT32 BufferLen
Length of receive buffer.
PXE_UINT64 BufferAddr
Address of first byte of receive buffer.
PXE_MAC_ADDR StationAddr
If supplied and supported, the current station MAC address will be changed.
PXE_UINT32 DataLen
Length of the data portion of the frame buffer in bytes.
PXE_UINT64 FrameAddr
Address of first byte of frame buffer.
static struct tlan_private * priv
16-byte buffer aligned on a 4-byte boundary.
Union type for command parameter blocks.
PXE_CPB_FILL_HEADER_FRAGMENTED fill_header_fragmented
PXE_CPB_STATION_ADDRESS station_address
PXE_CPB_TRANSMIT transmit
PXE_CPB_FILL_HEADER fill_header
Union type for data blocks.
PXE_DB_STATION_ADDRESS station_address
PXE_DB_GET_INIT_INFO get_init_info
PXE_DB_GET_STATUS get_status
const char product_short_name[]
Product short name string.
struct net_device * vlan_find(struct net_device *trunk, unsigned int tag)
Identify VLAN device.
int vlan_destroy(struct net_device *netdev)
Destroy VLAN device.
int vlan_create(struct net_device *trunk, unsigned int tag, unsigned int priority)
Create VLAN device.
#define VLAN_TAG_IS_VALID(tag)
Check VLAN tag is valid.
#define VLAN_TAG(tci)
Extract VLAN tag from tag control information.
#define VLAN_PRIORITY(tci)
Extract VLAN priority from tag control information.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.