1 #ifndef _IPXE_EFI_SNP_H
2 #define _IPXE_EFI_SNP_H
6 * iPXE EFI SNP interface
10 #include <ipxe/list.h>
11 #include <ipxe/netdevice.h>
12 #include <ipxe/efi/efi.h>
13 #include <ipxe/efi/Protocol/SimpleNetwork.h>
14 #include <ipxe/efi/Protocol/NetworkInterfaceIdentifier.h>
15 #include <ipxe/efi/Protocol/ComponentName2.h>
16 #include <ipxe/efi/Protocol/DevicePath.h>
17 #include <ipxe/efi/Protocol/HiiConfigAccess.h>
18 #include <ipxe/efi/Protocol/HiiDatabase.h>
19 #include <ipxe/efi/Protocol/LoadFile.h>
22 struct efi_snp_device {
23 /** List of SNP devices */
24 struct list_head list;
25 /** The underlying iPXE network device */
26 struct net_device *netdev;
27 /** The underlying EFI device */
28 struct efi_device *efidev;
29 /** EFI device handle */
31 /** The SNP structure itself */
32 EFI_SIMPLE_NETWORK_PROTOCOL snp;
33 /** The SNP "mode" (parameters) */
34 EFI_SIMPLE_NETWORK_MODE mode;
37 /** Outstanding TX packet count (via "interrupt status")
39 * Used in order to generate TX completions.
41 unsigned int tx_count_interrupts;
42 /** Outstanding TX packet count (via "recycled tx buffers")
44 * Used in order to generate TX completions.
46 unsigned int tx_count_txbufs;
47 /** Outstanding RX packet count (via "interrupt status") */
48 unsigned int rx_count_interrupts;
49 /** Outstanding RX packet count (via WaitForPacket event) */
50 unsigned int rx_count_events;
51 /** The network interface identifier */
52 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL nii;
53 /** Component name protocol */
54 EFI_COMPONENT_NAME2_PROTOCOL name2;
55 /** Load file protocol handle */
56 EFI_LOAD_FILE_PROTOCOL load_file;
57 /** HII configuration access protocol */
58 EFI_HII_CONFIG_ACCESS_PROTOCOL hii;
59 /** HII package list */
60 EFI_HII_PACKAGE_LIST_HEADER *package_list;
62 EFI_HII_HANDLE hii_handle;
64 wchar_t name[ sizeof ( ( ( struct net_device * ) NULL )->name ) ];
66 wchar_t driver_name[16];
67 /** Controller name */
68 wchar_t controller_name[64];
69 /** The device path */
70 EFI_DEVICE_PATH_PROTOCOL *path;
73 extern int efi_snp_hii_install ( struct efi_snp_device *snpdev );
74 extern void efi_snp_hii_uninstall ( struct efi_snp_device *snpdev );
75 extern struct efi_snp_device * find_snpdev ( EFI_HANDLE handle );
76 extern struct efi_snp_device * last_opened_snpdev ( void );
77 extern void efi_snp_set_claimed ( int claimed );
80 * Claim network devices for use by iPXE
83 static inline void efi_snp_claim ( void ) {
84 efi_snp_set_claimed ( 1 );
88 * Release network devices for use via SNP
91 static inline void efi_snp_release ( void ) {
92 efi_snp_set_claimed ( 0 );
95 #endif /* _IPXE_EFI_SNP_H */