Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / efi / efi_snp.h
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 #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>
20
21 /** An SNP device */
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 */
30         EFI_HANDLE handle;
31         /** The SNP structure itself */
32         EFI_SIMPLE_NETWORK_PROTOCOL snp;
33         /** The SNP "mode" (parameters) */
34         EFI_SIMPLE_NETWORK_MODE mode;
35         /** Started flag */
36         int started;
37         /** Outstanding TX packet count (via "interrupt status")
38          *
39          * Used in order to generate TX completions.
40          */
41         unsigned int tx_count_interrupts;
42         /** Outstanding TX packet count (via "recycled tx buffers")
43          *
44          * Used in order to generate TX completions.
45          */
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;
61         /** HII handle */
62         EFI_HII_HANDLE hii_handle;
63         /** Device name */
64         wchar_t name[ sizeof ( ( ( struct net_device * ) NULL )->name ) ];
65         /** Driver 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;
71 };
72
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 );
78
79 /**
80  * Claim network devices for use by iPXE
81  *
82  */
83 static inline void efi_snp_claim ( void ) {
84         efi_snp_set_claimed ( 1 );
85 }
86
87 /**
88  * Release network devices for use via SNP
89  *
90  */
91 static inline void efi_snp_release ( void ) {
92         efi_snp_set_claimed ( 0 );
93 }
94
95 #endif /* _IPXE_EFI_SNP_H */