78 #ifdef EFI_DOWNGRADE_UX 79 static EFI_GUID dummy_load_file_protocol_guid = {
80 0x6f6c7323, 0x2077, 0x7523,
81 { 0x6e, 0x68, 0x65, 0x6c, 0x70, 0x66, 0x75, 0x6c }
83 #define efi_load_file_protocol_guid dummy_load_file_protocol_guid 193 DBGC ( snpdev,
"SNPDEV %p START\n", snpdev );
197 DBGC ( snpdev,
"SNPDEV %p allowing start while claimed\n",
217 DBGC ( snpdev,
"SNPDEV %p STOP\n", snpdev );
239 UINTN extra_rx_bufsize,
UINTN extra_tx_bufsize ) {
245 DBGC ( snpdev,
"SNPDEV %p INITIALIZE (%ld extra RX, %ld extra TX)\n",
246 snpdev, ( (
unsigned long ) extra_rx_bufsize ),
247 ( (
unsigned long ) extra_tx_bufsize ) );
256 DBGC ( snpdev,
"SNPDEV %p ignoring initialization while " 257 "claimed\n", snpdev );
266 DBGC ( snpdev,
"SNPDEV %p could not open %s: %s\n",
291 DBGC ( snpdev,
"SNPDEV %p RESET (%s extended verification)\n",
292 snpdev, ( ext_verify ?
"with" :
"without" ) );
310 DBGC ( snpdev,
"SNPDEV %p could not reopen %s: %s\n",
334 DBGC ( snpdev,
"SNPDEV %p SHUTDOWN\n", snpdev );
373 DBGC ( snpdev,
"SNPDEV %p RECEIVE_FILTERS %08x&~%08x%s %ld mcast\n",
374 snpdev, enable, disable, ( mcast_reset ?
" reset" :
"" ),
375 ( (
unsigned long ) mcast_count ) );
376 for ( i = 0 ; i < mcast_count ; i++ ) {
406 DBGC ( snpdev,
"SNPDEV %p STATION_ADDRESS %s\n", snpdev,
420 DBGC ( snpdev,
"SNPDEV %p MAC address changed while net " 421 "device open\n", snpdev );
443 DBGC ( snpdev,
"SNPDEV %p STATISTICS%s", snpdev,
444 ( reset ?
" reset" :
"" ) );
451 memset ( &stats_buf, 0,
sizeof ( stats_buf ) );
460 if ( *stats_len >
sizeof ( stats_buf ) )
461 *stats_len =
sizeof ( stats_buf );
463 memcpy ( stats, &stats_buf, *stats_len );
494 ip_str = ( ipv6 ?
"(IPv6)" :
496 DBGC ( snpdev,
"SNPDEV %p MCAST_IP_TO_MAC %s\n", snpdev, ip_str );
505 DBGC ( snpdev,
"SNPDEV %p could not hash %s: %s\n",
529 DBGC ( snpdev,
"SNPDEV %p NVDATA %s %lx+%lx\n", snpdev,
530 (
read ?
"read" :
"write" ), ( (
unsigned long )
offset ),
531 ( (
unsigned long )
len ) );
557 DBGC2 ( snpdev,
"SNPDEV %p GET_STATUS", snpdev );
561 DBGC2 ( snpdev,
"\n" );
576 DBGC2 ( snpdev,
" INTS:%02x", *interrupts );
587 DBGC2 ( snpdev,
" TX:%p", *txbuf );
593 DBGC2 ( snpdev,
"\n" );
620 unsigned int tx_fill;
623 DBGC2 ( snpdev,
"SNPDEV %p TRANSMIT %p+%lx", snpdev,
data,
624 ( (
unsigned long )
len ) );
625 if ( ll_header_len ) {
627 DBGC2 ( snpdev,
" src %s",
631 DBGC2 ( snpdev,
" dest %s",
635 DBGC2 ( snpdev,
" proto %04x", *net_proto );
638 DBGC2 ( snpdev,
"\n" );
650 if ( ll_header_len ) {
652 DBGC ( snpdev,
"SNPDEV %p TX invalid header length " 654 ( (
unsigned long ) ll_header_len ) );
658 if (
len < ll_header_len ) {
659 DBGC ( snpdev,
"SNPDEV %p invalid packet length %ld\n",
660 snpdev, ( (
unsigned long )
len ) );
665 DBGC ( snpdev,
"SNPDEV %p TX missing destination " 666 "address\n", snpdev );
671 DBGC ( snpdev,
"SNPDEV %p TX missing network " 672 "protocol\n", snpdev );
685 DBGC ( snpdev,
"SNPDEV %p TX could not allocate %ld-byte " 686 "buffer\n", snpdev, ( (
unsigned long )
len ) );
695 if ( ll_header_len ) {
698 iobuf, ll_dest, ll_src,
699 htons ( *net_proto ) )) != 0 ){
700 DBGC ( snpdev,
"SNPDEV %p TX could not construct " 708 DBGC ( snpdev,
"SNPDEV %p TX could not transmit: %s\n",
724 DBGC ( snpdev,
"SNPDEV %p TX completion ring full\n", snpdev );
769 const void *iob_ll_dest;
770 const void *iob_ll_src;
772 unsigned int iob_flags;
776 DBGC2 ( snpdev,
"SNPDEV %p RECEIVE %p(+%lx)", snpdev,
data,
777 ( (
unsigned long ) *
len ) );
794 DBGC2 ( snpdev,
"\n" );
805 if ( copy_len > *
len )
812 &iob_ll_src, &iob_net_proto,
813 &iob_flags ) ) != 0 ) {
814 DBGC ( snpdev,
"SNPDEV %p could not parse header: %s\n",
816 goto out_bad_ll_header;
827 *net_proto =
ntohs ( iob_net_proto );
851 DBGCP ( snpdev,
"SNPDEV %p WAIT_FOR_PACKET\n", snpdev );
990 DBGC ( snpdev,
"UNDI %p GET STATE\n", snpdev );
1013 DBGC ( snpdev,
"UNDI %p START\n", snpdev );
1031 DBGC ( snpdev,
"UNDI %p STOP\n", snpdev );
1054 DBGC ( snpdev,
"UNDI %p GET INIT INFO\n", snpdev );
1080 DBGC ( snpdev,
"UNDI %p INITIALIZE\n", snpdev );
1102 DBGC ( snpdev,
"UNDI %p RESET\n", snpdev );
1120 DBGC ( snpdev,
"UNDI %p SHUTDOWN\n", snpdev );
1139 DBGC ( snpdev,
"UNDI %p RECEIVE FILTERS\n", snpdev );
1168 DBGC ( snpdev,
"UNDI %p STATION ADDRESS\n", snpdev );
1173 if ( ( reset ||
mac ) &&
1207 DBGC2 ( snpdev,
"UNDI %p GET STATUS\n", snpdev );
1305 DBGC2 ( snpdev,
"UNDI %p TRANSMIT\n", snpdev );
1335 DBGC2 ( snpdev,
"UNDI %p RECEIVE\n", snpdev );
1339 &
src, &
dest, &proto ) ) != 0 )
1347 db->Protocol = proto;
1365 DBGC ( cdb,
"UNDI invalid interface number %d\n", cdb->
IFnum );
1397 &
db->get_init_info );
1419 &
db->station_address );
1440 DBGC ( snpdev,
"UNDI %p unsupported opcode %#04x\n",
1488 .Ipv6Supported =
TRUE,
1519 DBGC ( snpdev,
"SNPDEV %p could not create VLAN tag %d: %s\n",
1523 DBGC ( snpdev,
"SNPDEV %p created VLAN tag %d priority %d\n",
1571 len = ( (*count) *
sizeof ( *entry ) );
1624 DBGC ( snpdev,
"SNPDEV %p could not find VLAN tag %d\n",
1632 DBGC ( snpdev,
"SNPDEV %p removed VLAN tag %d\n", snpdev,
tag );
1724 DBGC ( snpdev,
"SNPDEV %p cannot load non-boot file\n",
1790 char vlan_name[ 12 ];
1804 snpdev =
zalloc (
sizeof ( *snpdev ) );
1815 DBGC ( snpdev,
"SNPDEV %p cannot support link-layer address " 1816 "length %d for %s\n", snpdev,
1819 goto err_ll_addr_len;
1829 DBGC ( snpdev,
"SNPDEV %p could not create event: %s\n",
1831 goto err_create_event;
1861 snprintf ( vlan_name,
sizeof ( vlan_name ),
", VLAN %d",
1864 vlan_name[0] =
'\0';
1882 sizeof ( snpdev->
name[0] ) ),
1887 if ( ! snpdev->
path ) {
1904 DBGC ( snpdev,
"SNPDEV %p could not install protocols: %s\n",
1906 goto err_install_protocol_interface;
1925 DBGC ( snpdev,
"SNPDEV %p could not open NII protocol: %s\n",
1935 DBGC ( snpdev,
"SNPDEV %p could not open NII31 protocol: %s\n",
1937 goto err_open_nii31;
1942 DBGC ( snpdev,
"SNPDEV %p could not become child of %s: %s\n",
1945 goto err_efi_child_add;
1950 DBGC ( snpdev,
"SNPDEV %p could not install HII: %s\n",
1965 DBGC ( snpdev,
"SNPDEV %p installed for %s as device %s\n",
1990 DBGC ( snpdev,
"SNPDEV %p could not uninstall: %s\n",
1999 err_install_protocol_interface:
2013 DBGC ( snpdev,
"SNPDEV %p nullified and leaked\n", snpdev );
2036 DBGC ( snpdev,
"SNPDEV %p link is %s\n", snpdev,
2082 DBGC ( snpdev,
"SNPDEV %p could not uninstall: %s\n",
2101 DBGC ( snpdev,
"SNPDEV %p nullified and leaked\n", snpdev );
EFI_GUID efi_nii31_protocol_guid
Network interface identifier protocol GUID (new version)
const char product_short_name[]
Product short name string.
static EFI_STATUS efi_undi_shutdown(struct efi_snp_device *snpdev)
Shutdown.
static LIST_HEAD(efi_snp_devices)
List of SNP devices.
#define iob_pull(iobuf, len)
static EFI_STATUS EFIAPI efi_snp_initialize(EFI_SIMPLE_NETWORK_PROTOCOL *snp, UINTN extra_rx_bufsize, UINTN extra_tx_bufsize)
Open the network device.
#define VLAN_TAG(tci)
Extract VLAN tag from tag control information.
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
#define EINVAL
Invalid argument.
struct option_descriptor read[1]
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
struct arbelprm_rc_send_wqe rc
static PXE_STATCODE efi_undi_statcode(EFI_STATUS efirc)
Convert EFI status code to UNDI status code.
#define iob_put(iobuf, len)
PXE_UINT32 BufferLen
Length of receive buffer.
static EFI_STATUS efi_undi_get_state(struct efi_snp_device *snpdev, PXE_CDB *cdb)
Get state.
The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access to a network adapter.
#define PXE_OPCODE_SHUTDOWN
Change the UNDI operational state from Initialized to Started.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
#define AF_INET6
IPv6 Internet addresses.
static EFI_STATUS EFIAPI efi_snp_start(EFI_SIMPLE_NETWORK_PROTOCOL *snp)
Change SNP state from "stopped" to "started".
#define PXE_ROMID_MAJORVER
UNDI command interface revision.
uint8_t ll_header_len
Link-layer header length.
This protocol is used to retrieve user readable names of drivers and controllers managed by UEFI Driv...
uint8_t ll_addr_len
Link-layer address length.
UINT32 MediaHeaderSize
The size, in bytes, of the network interface's media header.
static void efi_snp_flush(struct efi_snp_device *snpdev)
Flush transmit ring and receive queue.
EFI_VLAN_CONFIG_PROTOCOL vcfg
VLAN configuration protocol.
#define PXE_ROMID_SIGNATURE
Signature of !PXE structure.
PXE_UINT16 PXE_STATCODE
UNDI Fill Header.
static EFI_STATUS efi_undi_receive_filters(struct efi_snp_device *snpdev, PXE_CDB *cdb)
Get/set receive filters.
BOOLEAN MediaPresent
TRUE if media are connected to the network interface; otherwise FALSE.
#define list_add(new, head)
Add a new entry to the head of a list.
static void efi_snp_notify(struct net_device *netdev, void *priv __unused)
Handle SNP device or link state change.
128 bit buffer containing a unique identifier value.
#define PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL nii
The network interface identifier.
UINT8_t filter
Receive packet filter.
static EFI_STATUS efi_undi_transmit(struct efi_snp_device *snpdev, PXE_CPB_TRANSMIT *cpb)
Transmit.
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
EFI_COMPONENT_NAME2_PROTOCOL name2
Component name protocol.
An optional protocol that is used to describe details about the software layer that is used to produc...
32-byte buffer containing a network Media Access Control address.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
VOID * EFI_EVENT
Handle to an event structure.
#define PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED
PXE_UINT32 DataLen
Length of the data portion of the frame buffer in bytes.
size_t mtu
Maximum transmission unit length.
static void efi_snp_remove(struct net_device *netdev, void *priv __unused)
Destroy SNP device.
#define PXE_BUSTYPE(a, b, c, d)
#define EFI_PROTOCOL_ERROR
Enumeration of EFI_STATUS.
EFI_GUID efi_simple_network_protocol_guid
Simple network protocol GUID.
#define PXE_STATFLAGS_GET_STATE_STARTED
#define PXE_STATFLAGS_COMMAND_FAILED
#define PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN
This flag is set if no transmitted buffer addresses were written into the DB.
#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST
static PXE_SW_UNDI efi_snp_undi
UNDI interface.
#define ENOENT
No such file or directory.
const uint8_t * ll_broadcast
Link-layer broadcast address.
#define PXE_ROMID_IMP_STATION_ADDR_SETTABLE
#define EFI_OPEN_PROTOCOL_BY_DRIVER
#define PXE_STATFLAGS_INITIALIZED_NO_MEDIA
UNDI Initialize.
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
static void efi_snp_set_state(struct efi_snp_device *snpdev)
Set EFI SNP mode state.
#define EFI_OPEN_PROTOCOL_EXCLUSIVE
BOOLEAN MediaPresentSupported
TRUE if the presence of media can be determined; otherwise FALSE.
EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName
static EFI_STATUS EFIAPI efi_snp_station_address(EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN reset, EFI_MAC_ADDRESS *new)
Set station address.
EFI_CLOSE_EVENT CloseEvent
static unsigned int efi_undi_ifnum(struct efi_snp_device *snpdev)
Get UNDI SNP device interface number.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
#define PXE_OPCODE_INITIALIZE
Changed UNDI operational state from Started to Initialized.
EFI_HANDLE device
EFI device handle.
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.
UINT32 State
Reports the current state of the network interface.
This protocol can be used on any device handle to obtain generic path/location information concerning...
#define PXE_STATCODE_BUSY
#define VLAN_TAG_IS_VALID(tag)
Check VLAN tag is valid.
static void efi_snp_claim(void)
Claim network devices for use by iPXE.
uint8_t mac[ETH_ALEN]
MAC address.
PXE_MAC_ADDR StationAddr
If supplied and supported, the current station MAC address will be changed.
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
int efi_child_add(EFI_HANDLE parent, EFI_HANDLE child)
Add EFI device as child of another EFI device.
#define PXE_OPCODE_FILL_HEADER
Fill media header in packet for transmit.
#define EFI_SNP_NUM_TX
SNP transmit completion ring size.
#define PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY
This flag is set if the transmitted buffer queue is empty.
wchar_t controller_name[64]
Controller name.
EFI_CLOSE_PROTOCOL CloseProtocol
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 int efi_snp_claimed
Network devices are currently claimed for use by iPXE.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
static const char * netdev_addr(struct net_device *netdev)
Get printable network device link-layer address.
struct net_device_stats tx_stats
TX statistics.
unsigned int scope_id
Scope ID.
void(* init_addr)(const void *hw_addr, void *ll_addr)
Initialise link-layer address.
A network upper-layer driver.
EFI_HANDLE handle
EFI device handle.
static EFI_SIMPLE_NETWORK_PROTOCOL efi_snp_device_snp
SNP interface.
#define PXE_STATFLAGS_GET_STATUS_RECEIVE
If set, at least one receive interrupt occurred.
EFI_MAC_ADDRESS CurrentAddress
The current HW MAC address for the network interface.
int vlan_create(struct net_device *trunk, unsigned int tag, unsigned int priority)
Create VLAN device.
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
static EFI_STATUS efi_undi_stop(struct efi_snp_device *snpdev)
Stop.
#define PXE_OPCODE_STATION_ADDRESS
Read & change station MAC address.
struct net_device * vlan_find(struct net_device *trunk, unsigned int tag)
Identify VLAN device.
#define ENOTSUP
Operation not supported.
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.
PXE_DB_GET_INIT_INFO get_init_info
UINT64 Id
The address of the first byte of the identifying structure for this network interface.
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.
static EFI_STATUS efi_undi_reset(struct efi_snp_device *snpdev)
Reset.
static EFI_STATUS EFIAPI efi_snp_get_driver_name(EFI_COMPONENT_NAME2_PROTOCOL *name2, CHAR8 *language __unused, CHAR16 **driver_name)
Look up driver name.
int ipxe(struct net_device *netdev)
Main iPXE flow of execution.
EFI_SIMPLE_NETWORK_MODE * Mode
Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
struct net_device * netdev
The underlying iPXE network device.
EFI_MAC_ADDRESS BroadcastAddress
The current HW MAC address for broadcast packets.
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.
UINT64 RxGoodFrames
Number of valid frames received and copied into receive buffers.
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
void efi_child_del(EFI_HANDLE parent, EFI_HANDLE child)
Remove EFI device as child of another EFI device.
#define list_del(list)
Delete an entry from a list.
UINT8 IfType
The interface type of the network interface.
PXE_UINT64 FrameAddr
Address of first byte of frame buffer.
UINT32 MaxPacketSize
The maximum size, in bytes, of the packets supported by the network interface.
struct efi_snp_device * last_opened_snpdev(void)
Get most recently opened SNP device.
#define ENOMEM
Not enough space.
#define iob_disown(iobuf)
Disown an I/O buffer.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define PXE_OPCODE_RESET
Re-initialize the NIC H/W.
unsigned int tx_cons
Transmit completion ring consumer counter.
int efi_snp_hii_uninstall(struct efi_snp_device *snpdev)
Uninstall HII protocol and package for SNP device.
int efi_snp_hii_install(struct efi_snp_device *snpdev)
Install HII protocol and packages for SNP device.
#define PXE_OPCODE_TRANSMIT
Transmit packet(s).
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
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.
EFI_HII_PACKAGE_LIST_HEADER * package_list
HII package list.
PXE_CPB_FILL_HEADER_FRAGMENTED fill_header_fragmented
#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
static EFI_STATUS EFIAPI efi_snp_stop(EFI_SIMPLE_NETWORK_PROTOCOL *snp)
Change SNP state from "started" to "stopped".
The EFI_LOAD_FILE_PROTOCOL is a simple protocol used to obtain files from arbitrary devices.
#define PXE_STATFLAGS_STATUS_MASK
Common StatFlags that can be returned by all commands.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define container_of(ptr, type, field)
Get containing structure.
uint8_t hw_addr_len
Hardware address length.
16-byte buffer aligned on a 4-byte boundary.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
static void efi_watchdog_start(void)
Start EFI watchdog holdoff timer.
FILE_LICENCE(GPL2_OR_LATER)
#define __unused
Declare a variable or data structure as unused.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
#define PXE_STATCODE_DEVICE_FAILURE
PXE_DB_GET_STATUS get_status
UINT64 TxTotalFrames
Transmit statistics.
EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName
PXE_DB_STATION_ADDRESS station_address
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
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 struct net_device * netdev
struct net_device * last_opened_netdev(void)
Get most recently opened network device.
int efi_snprintf(wchar_t *wbuf, size_t wsize, const char *fmt,...)
Write a formatted string to a buffer.
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
static EFI_STATUS EFIAPI efi_vlan_remove(EFI_VLAN_CONFIG_PROTOCOL *vcfg, UINT16 tag)
Remove VLAN device.
EFI_CREATE_EVENT CreateEvent
uint16_t count
Number of entries.
UINT64 RxDroppedFrames
Valid frames that were dropped because receive buffers were full.
VOID * tx[EFI_SNP_NUM_TX]
Transmit completion ring.
#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT
static EFI_VLAN_CONFIG_PROTOCOL efi_vlan
VLAN configuration protocol.
#define PXE_STATFLAGS_CABLE_DETECT_SUPPORTED
EFI_GUID efi_vlan_config_protocol_guid
VLAN configuration protocol GUID.
static struct efi_saved_tpl efi_snp_saved_tpl
TPL prior to network devices being claimed.
static EFI_LOAD_FILE_PROTOCOL efi_snp_load_file_protocol
Load file protocol.
#define PXE_ROMID_MINORVER
const char * driver_name
Driver name.
void efi_snp_add_claim(int delta)
Add to SNP claimed/released count.
#define PXE_ROMID_IMP_SW_VIRT_ADDR
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.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
PXE_CPB_STATION_ADDRESS station_address
wchar_t name[sizeof(((struct net_device *) NULL) ->name)]
Device name.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
EFI_SIGNAL_EVENT SignalEvent
EFI_SIMPLE_NETWORK_PROTOCOL snp
The SNP structure itself.
BOOLEAN MacAddressChangeable
TRUE if the HW MAC address can be changed.
static EFIAPI VOID efi_undi_issue(UINT64 cdb_phys)
UNDI entry point.
void netdev_poll(struct net_device *netdev)
Poll for completed and received packets on network device.
#define ERANGE
Result too large.
PXE_UINT64 BufferAddr
Address of first byte of receive buffer.
static void efi_watchdog_stop(void)
Stop EFI watchdog holdoff timer.
char * strerror(int errno)
Retrieve string representation of error number.
EFI_DEVICE_PATH_PROTOCOL * efi_netdev_path(struct net_device *netdev)
Construct EFI device path for network device.
#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST
static EFI_STATUS efi_undi_receive(struct efi_snp_device *snpdev, PXE_CPB_RECEIVE *cpb, PXE_DB_RECEIVE *db)
Receive.
static void(* free)(struct refcnt *refcnt))
UINT64 Revision
The revision of the EFI_NETWORK_INTERFACE_IDENTIFIER protocol.
static struct efi_snp_device * efi_undi_snpdev(unsigned int ifnum)
Identify UNDI SNP device.
void * zalloc(size_t size)
Allocate cleared memory.
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
UINT64 RxTotalFrames
Total number of frames received.
#define PXE_OPFLAGS_FILL_HEADER_FRAGMENTED
EFI_VLAN_CONFIG_PROTOCOL provide manageability interface for VLAN setting.
#define PXE_ROMID_REV
!PXE structure format revision
EFI watchdog holdoff timer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
struct net_device_stats rx_stats
RX statistics.
static void efi_snp_set_mode(struct efi_snp_device *snpdev)
Set EFI SNP mode based on iPXE net device parameters.
unsigned int bad
Count of error completions.
#define PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED
#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA
This flag is set if there is no media detected.
#define PXE_STATCODE_UNSUPPORTED
Union type for data blocks.
struct net_driver efi_snp_driver __net_driver
SNP driver.
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
PXE_CPB_FILL_HEADER fill_header
static void efi_snp_release(void)
Release network devices for use via SNP.
char * inet_ntoa(struct in_addr in)
Convert IPv4 address to dotted-quad notation.
IP4_t ip
Destination IP address.
int netdev_tx(struct net_device *netdev, struct io_buffer *iobuf)
Transmit raw packet via network device.
PXE_UINT8 Fudge
makes 8-bit cksum zero.
static void console_reset(void)
Reset console.
struct efi_device * efidev
The underlying EFI device.
UINT64 UINTN
Unsigned value of native width.
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.
#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED
#define EFI_NOT_READY
Enumeration of EFI_STATUS.
PXE_CPB_TRANSMIT transmit
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
#define PXE_OPCODE_STOP
Change UNDI operational state from Started to Stopped.
#define PXE_OPCODE_GET_STATUS
Get & clear interrupt status.
#define EFI_INVALID_PARAMETER
Enumeration of EFI_STATUS.
void efi_nullify_vlan(EFI_VLAN_CONFIG_PROTOCOL *vcfg)
Nullify VLAN configuration interface.
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
int vlan_destroy(struct net_device *netdev)
Destroy VLAN device.
EFI_GUID efi_component_name2_protocol_guid
Component name 2 protocol GUID.
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.
uint16_t ll_proto
Link-layer protocol.
#define VOID
Undeclared type.
unsigned long long UINT64
static uint8_t efi_undi_checksum(void *data, size_t len)
Calculate UNDI byte checksum.
int(* mc_hash)(unsigned int af, const void *net_addr, void *ll_addr)
Hash multicast address.
#define PXE_OPFLAGS_STATION_ADDRESS_RESET
#define EAGAIN
Resource temporarily unavailable.
#define PXE_STATFLAGS_RECEIVE_FILTER_UNICAST
UNDI Receive Filters.
struct list_head rx
Receive queue.
static EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL efi_snp_device_nii
Network Identification Interface (NII)
unsigned int tx_prod
Transmit completion ring producer counter.
wchar_t driver_name[16]
Driver name.
struct device * dev
Underlying hardware device.
EFI_GUID efi_nii_protocol_guid
Network interface identifier protocol GUID (old version)
void netdev_close(struct net_device *netdev)
Close network device.
static EFI_STATUS EFIAPI efi_snp_shutdown(EFI_SIMPLE_NETWORK_PROTOCOL *snp)
Shut down the network device.
void efi_nullify_name2(EFI_COMPONENT_NAME2_PROTOCOL *name2)
Nullify Component Name Protocol interface.
Network device management.
static struct dmfe_private * db
static EFI_STATUS efi_undi_fill_header(struct efi_snp_device *snpdev, PXE_CDB *cdb, PXE_CPB_ANY *cpb)
Fill header.
struct efi_snp_device * find_snpdev(EFI_HANDLE handle)
Find SNP device by EFI device handle.
static EFI_STATUS efi_undi_get_status(struct efi_snp_device *snpdev, PXE_CDB *cdb, PXE_DB_GET_STATUS *db)
Get interrupt status.
#define iob_reserve(iobuf, len)
#define INIT_LIST_HEAD(list)
Initialise a list head.
#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
unsigned int good
Count of successful completions.
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.
char name[NETDEV_NAME_LEN]
Name of this network device.
#define PXE_STATCODE_NO_DATA
An EFI saved task priority level.
struct list_head list
List of which this buffer is a member.
CHAR8 * SupportedLanguages
A Null-terminated ASCII string array that contains one or more supported language codes.
#define ENOBUFS
No buffer space available.
PXE_UINT8 IFcntExt
physical connector count upper byte.
static struct tlan_private * priv
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.
UINT32 HwAddressSize
The size, in bytes, of the network interface's HW address.
EFI_LOAD_FILE_PROTOCOL load_file
Load file protocol handle.
uint16_t priority
Priotity.
PXE_UINT64 EntryPoint
API entry point.
#define IOB_ZLEN
Minimum I/O buffer length.
void * data
Start of data.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
UINT32 ReceiveFilterMask
The multicast receive filter settings supported by the network interface.
UINT64 Revision
Revision of the EFI_SIMPLE_NETWORK_PROTOCOL.
PXE_UINT8 IFcnt
physical connector count lower byte.
static void efi_snp_poll(struct efi_snp_device *snpdev)
Poll net device and count received packets.
#define PXE_STATCODE_BUFFER_FULL
#define PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST
If set, all multicast packets will be received.
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" return dest
void efi_nullify_load_file(EFI_LOAD_FILE_PROTOCOL *load_file)
Nullify Load File Protocol interface.
#define PXE_OPCODE_RECEIVE
Receive packet.
uint8_t data[48]
Additional event data.
#define PXE_OPCODE_RECEIVE_FILTERS
Read & change state of packet receive filters.
const char *(* ntoa)(const void *ll_addr)
Transcribe link-layer address.
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION
__weak unsigned int vlan_tci(struct net_device *netdev __unused)
Get the VLAN tag control information (when VLAN support is not present)
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)
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
uint16_t offset
Offset to command line.
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
void efi_nullify_nii(EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *nii)
Nullify NII interface.
#define PXE_STATCODE_INVALID_CDB
struct efi_device * efidev_parent(struct device *dev)
Get parent EFI device.
UINT16 IfNum
The network interface number that is being identified by this Network Interface Identifier Protocol.
#define PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED
#define PXE_OPCODE_GET_STATE
Return UNDI operational state.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
size_t max_pkt_len
Maximum packet length.
#define PXE_ROMID_IMP_TX_COMPLETE_INT_SUPPORTED
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
static int efi_snp_probe(struct net_device *netdev, void *priv __unused)
Create SNP device.
#define DBG(...)
Print a debugging message.
#define PXE_OPCODE_GET_INIT_INFO
Get UNDI initialization information.
static EFI_STATUS efi_undi_initialize(struct efi_snp_device *snpdev, PXE_CDB *cdb)
Initialise.
EFI_GUID efi_load_file_protocol_guid
Load file protocol GUID.
#define PXE_FRAME_TYPE_PROMISCUOUS
EFI_DEVICE_PATH_PROTOCOL * path
The device path.
#define PXE_STATFLAGS_GET_STATE_STOPPED
uint64_t tag
Identity tag.
Simple Network Protocol data structures.
#define PXE_STATCODE_INVALID_PARAMETER
EFI_SIMPLE_NETWORK_MODE mode
The SNP "mode" (parameters)
static VOID EFIAPI efi_snp_wait_for_packet(EFI_EVENT event __unused, VOID *context)
Poll event.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define NULL
NULL pointer (VOID *)
static struct efi_snp_device * efi_snp_demux(struct net_device *netdev)
Locate SNP device corresponding to network device.
#define PXE_STATFLAGS_GET_STATUS_TRANSMIT
If set, at least one transmit interrupt occurred.
EFI_EVENT WaitForPacket
Event used with WaitForEvent() to wait for a packet to be received.
static EFI_STATUS EFIAPI efi_snp_reset(EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN ext_verify)
Reset the network device.
#define PXE_OPCODE_START
Change UNDI operational state from Stopped to Started.
#define PXE_STATFLAGS_RECEIVE_FILTER_BROADCAST
If set, broadcast packets will be received.
#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
int netdev_open(struct net_device *netdev)
Open network device.
#define VLAN_PRIORITY(tci)
Extract VLAN priority from tag control information.
#define AF_INET
IPv4 Internet addresses.
void efi_nullify_snp(EFI_SIMPLE_NETWORK_PROTOCOL *snp)
Nullify SNP interface.
#define PXE_STATFLAGS_COMMAND_COMPLETE
struct list_head list
List of SNP devices.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
static EFI_STATUS EFIAPI efi_vlan_set(EFI_VLAN_CONFIG_PROTOCOL *vcfg, UINT16 tag, UINT8 priority)
Create or modify VLAN device.
struct ll_protocol * ll_protocol
Link-layer protocol.
Union type for command parameter blocks.
unsigned int interrupts
Pending interrupt status.
EFI_MAC_ADDRESS PermanentAddress
The permanent HW MAC address for the network interface.
#define PXE_STATFLAGS_RECEIVE_FILTER_PROMISCUOUS
If set, all packets will be received.
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.
#define PXE_STATFLAGS_GET_STATE_INITIALIZED
EFI_ALLOCATE_POOL AllocatePool
#define PXE_STATCODE_SUCCESS
Common StatCodes returned by all UNDI commands, UNDI protocol functions and BC protocol functions.
void * memset(void *dest, int character, size_t len) __nonnull
static EFI_STATUS efi_undi_start(struct efi_snp_device *snpdev)
Start.
int efi_shutdown_in_progress
EFI shutdown is in progress.
struct io_buffer * netdev_rx_dequeue(struct net_device *netdev)
Remove packet from device's receive queue.