These changes are the raw update to qemu-2.6.
[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 /** SNP transmit completion ring size */
22 #define EFI_SNP_NUM_TX 32
23
24 /** An SNP device */
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 */
33         EFI_HANDLE handle;
34         /** The SNP structure itself */
35         EFI_SIMPLE_NETWORK_PROTOCOL snp;
36         /** The SNP "mode" (parameters) */
37         EFI_SIMPLE_NETWORK_MODE mode;
38         /** Started flag */
39         int started;
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 */
45         unsigned int tx_prod;
46         /** Transmit completion ring consumer counter */
47         unsigned int tx_cons;
48         /** Receive queue */
49         struct list_head rx;
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;
60         /** HII handle */
61         EFI_HII_HANDLE hii_handle;
62         /** Device name */
63         wchar_t name[ sizeof ( ( ( struct net_device * ) NULL )->name ) ];
64         /** Driver 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;
70 };
71
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 );
77
78 /**
79  * Claim network devices for use by iPXE
80  *
81  */
82 static inline void efi_snp_claim ( void ) {
83         efi_snp_set_claimed ( 1 );
84 }
85
86 /**
87  * Release network devices for use via SNP
88  *
89  */
90 static inline void efi_snp_release ( void ) {
91         efi_snp_set_claimed ( 0 );
92 }
93
94 #endif /* _IPXE_EFI_SNP_H */