iPXE
efi_snp.h
Go to the documentation of this file.
1 #ifndef _IPXE_EFI_SNP_H
2 #define _IPXE_EFI_SNP_H
3 
4 /** @file
5  *
6  * iPXE EFI SNP interface
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER );
11 
12 #include <ipxe/list.h>
13 #include <ipxe/netdevice.h>
14 #include <ipxe/efi/efi.h>
22 
23 /** SNP transmit completion ring size */
24 #define EFI_SNP_NUM_TX 32
25 
26 /** An SNP device */
28  /** List of SNP devices */
29  struct list_head list;
30  /** The underlying iPXE network device */
31  struct net_device *netdev;
32  /** The underlying EFI device */
33  struct efi_device *efidev;
34  /** EFI device handle */
36  /** The SNP structure itself */
38  /** The SNP "mode" (parameters) */
40  /** Started flag */
41  int started;
42  /** Pending interrupt status */
43  unsigned int interrupts;
44  /** Transmit completion ring */
46  /** Transmit completion ring producer counter */
47  unsigned int tx_prod;
48  /** Transmit completion ring consumer counter */
49  unsigned int tx_cons;
50  /** Receive queue */
51  struct list_head rx;
52  /** The network interface identifier */
54  /** Component name protocol */
56  /** Load file protocol handle */
58  /** HII configuration access protocol */
60  /** HII package list */
62  /** EFI child handle for HII association */
64  /** Device path of HII child handle */
66  /** HII handle */
68  /** Device name */
69  wchar_t name[ sizeof ( ( ( struct net_device * ) NULL )->name ) ];
70  /** Driver name */
71  wchar_t driver_name[16];
72  /** Controller name */
73  wchar_t controller_name[64];
74  /** The device path */
76 };
77 
78 extern int efi_snp_hii_install ( struct efi_snp_device *snpdev );
79 extern void efi_snp_hii_uninstall ( struct efi_snp_device *snpdev );
80 extern struct efi_snp_device * find_snpdev ( EFI_HANDLE handle );
81 extern struct efi_snp_device * last_opened_snpdev ( void );
82 extern void efi_snp_add_claim ( int delta );
83 
84 /**
85  * Claim network devices for use by iPXE
86  *
87  */
88 static inline void efi_snp_claim ( void ) {
89  efi_snp_add_claim ( +1 );
90 }
91 
92 /**
93  * Release network devices for use via SNP
94  *
95  */
96 static inline void efi_snp_release ( void ) {
97  efi_snp_add_claim ( -1 );
98 }
99 
100 #endif /* _IPXE_EFI_SNP_H */
struct efi_snp_device * find_snpdev(EFI_HANDLE handle)
Find SNP device by EFI device handle.
Definition: efi_snp.c:1939
The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access to a network adapter.
The device path protocol as defined in UEFI 2.0.
This protocol is used to retrieve user readable names of drivers and controllers managed by UEFI Driv...
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL nii
The network interface identifier.
Definition: efi_snp.h:53
EFI_COMPONENT_NAME2_PROTOCOL name2
Component name protocol.
Definition: efi_snp.h:55
An optional protocol that is used to describe details about the software layer that is used to produc...
int started
Started flag.
Definition: efi_snp.h:41
Load File protocol as defined in the UEFI 2.0 specification.
void efi_snp_hii_uninstall(struct efi_snp_device *snpdev)
Uninstall HII protocol and package for SNP device.
Definition: efi_snp_hii.c:779
EFI Network Interface Identifier Protocol.
This protocol can be used on any device handle to obtain generic path/location information concerning...
Definition: DevicePath.h:51
static void efi_snp_claim(void)
Claim network devices for use by iPXE.
Definition: efi_snp.h:88
#define EFI_SNP_NUM_TX
SNP transmit completion ring size.
Definition: efi_snp.h:24
wchar_t controller_name[64]
Controller name.
Definition: efi_snp.h:73
FILE_LICENCE(GPL2_OR_LATER)
EFI_HANDLE hii_child_handle
EFI child handle for HII association.
Definition: efi_snp.h:63
EFI_HII_CONFIG_ACCESS_PROTOCOL hii
HII configuration access protocol.
Definition: efi_snp.h:59
EFI_HANDLE handle
EFI device handle.
Definition: efi_snp.h:35
A doubly-linked list entry (or list head)
Definition: list.h:18
This protocol provides a callable interface between the HII and drivers.
struct net_device * netdev
The underlying iPXE network device.
Definition: efi_snp.h:31
EFI_HII_HANDLE hii_handle
HII handle.
Definition: efi_snp.h:67
unsigned int tx_cons
Transmit completion ring consumer counter.
Definition: efi_snp.h:49
EFI_HII_PACKAGE_LIST_HEADER * package_list
HII package list.
Definition: efi_snp.h:61
The EFI_LOAD_FILE_PROTOCOL is a simple protocol used to obtain files from arbitrary devices.
Definition: LoadFile.h:84
UEFI Component Name 2 Protocol as defined in the UEFI 2.1 specification.
The EFI_SIMPLE_NETWORK_PROTOCOL provides services to initialize a network interface,...
VOID * tx[EFI_SNP_NUM_TX]
Transmit completion ring.
Definition: efi_snp.h:45
wchar_t name[sizeof(((struct net_device *) NULL) ->name)]
Device name.
Definition: efi_snp.h:69
Linked lists.
EFI_SIMPLE_NETWORK_PROTOCOL snp
The SNP structure itself.
Definition: efi_snp.h:37
struct efi_snp_device * last_opened_snpdev(void)
Get most recently opened SNP device.
Definition: efi_snp.c:1954
A network device.
Definition: netdevice.h:348
An SNP device.
Definition: efi_snp.h:27
static void efi_snp_release(void)
Release network devices for use via SNP.
Definition: efi_snp.h:96
struct efi_device * efidev
The underlying EFI device.
Definition: efi_snp.h:33
An EFI device.
Definition: efi_driver.h:17
EFI_DEVICE_PATH_PROTOCOL * hii_child_path
Device path of HII child handle.
Definition: efi_snp.h:65
#define VOID
Undeclared type.
Definition: Base.h:319
The file provides Database manager for HII-related data structures.
EFI API.
struct list_head rx
Receive queue.
Definition: efi_snp.h:51
unsigned int tx_prod
Transmit completion ring producer counter.
Definition: efi_snp.h:47
wchar_t driver_name[16]
Driver name.
Definition: efi_snp.h:71
Network device management.
The EFI HII results processing protocol invokes this type of protocol when it needs to forward result...
void efi_snp_add_claim(int delta)
Add to SNP claimed/released count.
Definition: efi_snp.c:1969
EFI_LOAD_FILE_PROTOCOL load_file
Load file protocol handle.
Definition: efi_snp.h:57
int efi_snp_hii_install(struct efi_snp_device *snpdev)
Install HII protocol and packages for SNP device.
Definition: efi_snp_hii.c:655
EFI_DEVICE_PATH_PROTOCOL * path
The device path.
Definition: efi_snp.h:75
uint16_t handle
Handle.
Definition: smbios.h:16
The header found at the start of each package list.
EFI_SIMPLE_NETWORK_MODE mode
The SNP "mode" (parameters)
Definition: efi_snp.h:39
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
struct list_head list
List of SNP devices.
Definition: efi_snp.h:29
Definition: efi.h:55
VOID * EFI_HII_HANDLE
The following types are currently defined:
unsigned int interrupts
Pending interrupt status.
Definition: efi_snp.h:43