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>
21 /** SNP transmit completion ring size */
22 #define EFI_SNP_NUM_TX 32
25 struct efi_snp_device {
26 /** List of SNP devices */
27 struct list_head list;
28 /** The underlying iPXE network device */
29 struct net_device *netdev;
30 /** The underlying EFI device */
31 struct efi_device *efidev;
32 /** EFI device handle */
34 /** The SNP structure itself */
35 EFI_SIMPLE_NETWORK_PROTOCOL snp;
36 /** The SNP "mode" (parameters) */
37 EFI_SIMPLE_NETWORK_MODE mode;
40 /** Pending interrupt status */
41 unsigned int interrupts;
42 /** Transmit completion ring */
43 VOID *tx[EFI_SNP_NUM_TX];
44 /** Transmit completion ring producer counter */
46 /** Transmit completion ring consumer counter */
50 /** The network interface identifier */
51 EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL nii;
52 /** Component name protocol */
53 EFI_COMPONENT_NAME2_PROTOCOL name2;
54 /** Load file protocol handle */
55 EFI_LOAD_FILE_PROTOCOL load_file;
56 /** HII configuration access protocol */
57 EFI_HII_CONFIG_ACCESS_PROTOCOL hii;
58 /** HII package list */
59 EFI_HII_PACKAGE_LIST_HEADER *package_list;
61 EFI_HII_HANDLE hii_handle;
63 wchar_t name[ sizeof ( ( ( struct net_device * ) NULL )->name ) ];
65 wchar_t driver_name[16];
66 /** Controller name */
67 wchar_t controller_name[64];
68 /** The device path */
69 EFI_DEVICE_PATH_PROTOCOL *path;
72 extern int efi_snp_hii_install ( struct efi_snp_device *snpdev );
73 extern void efi_snp_hii_uninstall ( struct efi_snp_device *snpdev );
74 extern struct efi_snp_device * find_snpdev ( EFI_HANDLE handle );
75 extern struct efi_snp_device * last_opened_snpdev ( void );
76 extern void efi_snp_set_claimed ( int claimed );
79 * Claim network devices for use by iPXE
82 static inline void efi_snp_claim ( void ) {
83 efi_snp_set_claimed ( 1 );
87 * Release network devices for use via SNP
90 static inline void efi_snp_release ( void ) {
91 efi_snp_set_claimed ( 0 );
94 #endif /* _IPXE_EFI_SNP_H */