iPXE
igbvf_vf.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  Intel(R) 82576 Virtual Function Linux driver
4  Copyright(c) 1999 - 2008 Intel Corporation.
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms and conditions of the GNU General Public License,
8  version 2, as published by the Free Software Foundation.
9 
10  This program is distributed in the hope it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  more details.
14 
15  You should have received a copy of the GNU General Public License along with
16  this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 
19  The full GNU General Public License is included in this distribution in
20  the file called "COPYING".
21 
22  Contact Information:
23  Linux NICS <linux.nics@intel.com>
24  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 
27 *******************************************************************************/
28 
29 FILE_LICENCE ( GPL2_ONLY );
30 
31 #ifndef _IGBVF_VF_H_
32 #define _IGBVF_VF_H_
33 
34 #include <stddef.h>
35 #include <stdint.h>
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <string.h>
39 #include <unistd.h>
40 #include <byteswap.h>
41 #include <errno.h>
42 #include <ipxe/pci.h>
43 #include <ipxe/malloc.h>
44 #include <ipxe/if_ether.h>
45 #include <ipxe/io.h>
46 #include <ipxe/ethernet.h>
47 #include <ipxe/iobuf.h>
48 #include <ipxe/netdevice.h>
49 
50 #include "igbvf_osdep.h"
51 #include "igbvf_regs.h"
52 #include "igbvf_defines.h"
53 
54 struct e1000_hw;
55 
56 #define E1000_DEV_ID_82576_VF 0x10CA
57 #define E1000_DEV_ID_I350_VF 0x1520
58 
59 #define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */
60 
61 /* Additional Descriptor Control definitions */
62 #define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */
63 #define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Rx Queue */
64 
65 /* SRRCTL bit definitions */
66 #define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */
67 #define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00
68 #define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */
69 #define E1000_SRRCTL_DESCTYPE_LEGACY 0x00000000
70 #define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000
71 #define E1000_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000
72 #define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000
73 #define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION 0x06000000
74 #define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000
75 #define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000
76 #define E1000_SRRCTL_DROP_EN 0x80000000
77 
78 #define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F
79 #define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00
80 
81 /* Interrupt Defines */
82 #define E1000_EICR 0x01580 /* Ext. Interrupt Cause Read - R/clr */
83 #define E1000_EITR(_n) (0x01680 + ((_n) << 2))
84 #define E1000_EICS 0x01520 /* Ext. Interrupt Cause Set - W0 */
85 #define E1000_EIMS 0x01524 /* Ext. Interrupt Mask Set/Read - RW */
86 #define E1000_EIMC 0x01528 /* Ext. Interrupt Mask Clear - WO */
87 #define E1000_EIAC 0x0152C /* Ext. Interrupt Auto Clear - RW */
88 #define E1000_EIAM 0x01530 /* Ext. Interrupt Ack Auto Clear Mask - RW */
89 #define E1000_IVAR0 0x01700 /* Interrupt Vector Allocation (array) - RW */
90 #define E1000_IVAR_MISC 0x01740 /* IVAR for "other" causes - RW */
91 #define E1000_IVAR_VALID 0x80
92 
93 /* Receive Descriptor - Advanced */
95  struct {
96  u64 pkt_addr; /* Packet buffer address */
97  u64 hdr_addr; /* Header buffer address */
98  } read;
99  struct {
100  struct {
101  union {
103  struct {
104  u16 pkt_info; /* RSS type, Packet type */
105  u16 hdr_info; /* Split Header,
106  * header buffer length */
107  } hs_rss;
108  } lo_dword;
109  union {
110  u32 rss; /* RSS Hash */
111  struct {
112  u16 ip_id; /* IP id */
113  u16 csum; /* Packet Checksum */
114  } csum_ip;
115  } hi_dword;
116  } lower;
117  struct {
118  u32 status_error; /* ext status/error */
119  u16 length; /* Packet length */
120  u16 vlan; /* VLAN tag */
121  } upper;
122  } wb; /* writeback */
123 };
124 
125 #define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0
126 #define E1000_RXDADV_HDRBUFLEN_SHIFT 5
127 
128 /* Transmit Descriptor - Advanced */
130  struct {
131  u64 buffer_addr; /* Address of descriptor's data buf */
134  } read;
135  struct {
136  u64 rsvd; /* Reserved */
139  } wb;
140 };
141 
142 /* Adv Transmit Descriptor Config Masks */
143 #define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */
144 #define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */
145 #define E1000_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */
146 #define E1000_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */
147 #define E1000_ADVTXD_DCMD_RS 0x08000000 /* Report Status */
148 #define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */
149 #define E1000_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */
150 #define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */
151 #define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */
152 
153 /* Context descriptors */
159 };
160 
161 #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
162 #define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */
163 #define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */
164 #define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */
165 #define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */
166 
170  e1000_num_macs /* List is 1-based, so subtract 1 for true count. */
171 };
172 
183 
193 
203 };
204 
205 #include "igbvf_mbx.h"
206 
208  /* Function pointers for the MAC. */
209  s32 (*init_params)(struct e1000_hw *);
211  void (*clear_vfta)(struct e1000_hw *);
212  s32 (*get_bus_info)(struct e1000_hw *);
213  s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
214  void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32);
215  s32 (*reset_hw)(struct e1000_hw *);
216  s32 (*init_hw)(struct e1000_hw *);
217  s32 (*setup_link)(struct e1000_hw *);
218  void (*write_vfta)(struct e1000_hw *, u32, u32);
219  void (*mta_set)(struct e1000_hw *, u32);
220  void (*rar_set)(struct e1000_hw *, u8*, u32);
221  s32 (*read_mac_addr)(struct e1000_hw *);
222 };
223 
226  u8 addr[6];
228 
230 
233 
235 };
236 
243 };
244 
255 };
256 
266 };
267 
272 
275 };
276 
278  s32 (*init_params)(struct e1000_hw *hw);
279  s32 (*read)(struct e1000_hw *, u32 *, u16, u16);
280  s32 (*write)(struct e1000_hw *, u32 *, u16, u16);
281  s32 (*read_posted)(struct e1000_hw *, u32 *, u16, u16);
282  s32 (*write_posted)(struct e1000_hw *, u32 *, u16, u16);
283  s32 (*check_for_msg)(struct e1000_hw *, u16);
284  s32 (*check_for_ack)(struct e1000_hw *, u16);
285  s32 (*check_for_rst)(struct e1000_hw *, u16);
286 };
287 
291 
295 };
296 
303 };
304 
308 };
309 
310 struct e1000_hw {
311  void *back;
312 
315  unsigned long io_base;
316 
320 
321  union {
323  } dev_spec;
324 
329 
331 };
332 
334  e1000_promisc_disabled = 0, /* all promisc modes disabled */
335  e1000_promisc_unicast = 1, /* unicast promiscuous enabled */
336  e1000_promisc_multicast = 2, /* multicast promiscuous enabled */
337  e1000_promisc_enabled = 3, /* both uni and multicast promisc */
339 };
340 
341 /* These functions must be implemented by drivers */
343 void igbvf_vfta_set_vf(struct e1000_hw *, u16, bool);
344 void igbvf_rlpml_set_vf(struct e1000_hw *, u16);
346 #endif /* _IGBVF_VF_H_ */
bool get_link_status
Definition: igbvf_vf.h:234
#define u16
Definition: vga.h:20
uint16_t u16
Definition: stdint.h:21
enum e1000_bus_width width
Definition: igbvf_vf.h:271
iPXE I/O API
s32(* read_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:281
e1000_bus_speed
Definition: igbvf_vf.h:245
enum e1000_bus_speed speed
Definition: igbvf_vf.h:270
s32 igbvf_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
s32(* check_for_link)(struct e1000_hw *)
Definition: igbvf_vf.h:210
int32_t s32
Definition: stdint.h:22
u8 __iomem * flash_address
Definition: igbvf_vf.h:314
Error codes.
I/O buffers.
struct e1000_mac_operations ops
Definition: igbvf_vf.h:225
u16 subsystem_vendor_id
Definition: igbvf_vf.h:326
u16 pci_cmd_word
Definition: igbvf_vf.h:274
s32(* reset_hw)(struct e1000_hw *)
Definition: igbvf_vf.h:215
union e1000_adv_rx_desc::@48::@49::@51 lo_dword
void(* update_mc_addr_list)(struct e1000_hw *, u8 *, u32)
Definition: igbvf_vf.h:214
void(* rar_set)(struct e1000_hw *, u8 *, u32)
Definition: igbvf_vf.h:220
void(* clear_vfta)(struct e1000_hw *)
Definition: igbvf_vf.h:211
e1000_mac_type
Definition: igbvf_vf.h:167
Definition: hw.c:16
Dynamic memory allocation.
s32(* read)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:279
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
enum e1000_mac_type type
Definition: igbvf_vf.h:229
struct e1000_mbx_stats stats
Definition: igbvf_vf.h:299
FILE_LICENCE(GPL2_ONLY)
void(* write_vfta)(struct e1000_hw *, u32, u32)
Definition: igbvf_vf.h:218
u8 revision_id
Definition: igbvf_vf.h:330
Ethernet protocol.
s32(* setup_link)(struct e1000_hw *)
Definition: igbvf_vf.h:217
#define u32
Definition: vga.h:21
struct e1000_mac_info mac
Definition: igbvf_vf.h:317
void(* mta_set)(struct e1000_hw *, u32)
Definition: igbvf_vf.h:219
u8 perm_addr[6]
Definition: igbvf_vf.h:227
uint64_t u64
Definition: stdint.h:25
void igbvf_vfta_set_vf(struct e1000_hw *, u16, bool)
igbvf_vfta_set_vf - Set/Unset vlan filter table address @hw: pointer to the HW structure @vid: determ...
Definition: igbvf_vf.c:313
struct e1000_bus_info bus
Definition: igbvf_vf.h:318
struct e1000_mbx_info mbx
Definition: igbvf_vf.h:319
u16 subsystem_device_id
Definition: igbvf_vf.h:327
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
struct e1000_adv_rx_desc::@48::@50 upper
s32(* init_hw)(struct e1000_hw *)
Definition: igbvf_vf.h:216
static unsigned int unsigned int reg
Definition: intel.h:245
PCI bus.
#define __iomem
Definition: igbvf_osdep.h:45
struct e1000_adv_rx_desc::@48::@49::@51::@53 hs_rss
s32(* write)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:280
unsigned long io_base
Definition: igbvf_vf.h:315
struct e1000_adv_rx_desc::@48 wb
enum e1000_bus_type type
Definition: igbvf_vf.h:269
e1000_bus_type
Definition: igbvf_vf.h:237
s32(* get_link_up_info)(struct e1000_hw *, u16 *, u16 *)
Definition: igbvf_vf.h:213
union e1000_hw::@57 dev_spec
struct e1000_adv_rx_desc::@48::@49::@52::@54 csum_ip
u16 vendor_id
Definition: igbvf_vf.h:328
struct e1000_adv_tx_desc::@56 wb
Network device management.
void igbvf_rlpml_set_vf(struct e1000_hw *, u16)
igbvf_rlpml_set_vf - Set the maximum receive packet length @hw: pointer to the HW structure @max_size...
Definition: igbvf_vf.c:331
u8 __iomem * hw_addr
Definition: igbvf_vf.h:313
s32 igbvf_promisc_set_vf(struct e1000_hw *, enum e1000_promisc_type)
igbvf_promisc_set_vf - Set flags for Unicast or Multicast promisc @hw: pointer to the HW structure @u...
Definition: igbvf_vf.c:348
u16 device_id
Definition: igbvf_vf.h:325
s32(* check_for_rst)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:285
union e1000_adv_rx_desc::@48::@49::@52 hi_dword
void * back
Definition: igbvf_vf.h:311
struct e1000_adv_rx_desc::@48::@49 lower
s32(* init_params)(struct e1000_hw *hw)
Definition: igbvf_vf.h:278
struct e1000_dev_spec_vf vf
Definition: igbvf_vf.h:322
s32(* check_for_ack)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:284
e1000_promisc_type
Definition: igbvf_vf.h:333
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282
e1000_bus_width
Definition: igbvf_vf.h:257
s32(* get_bus_info)(struct e1000_hw *)
Definition: igbvf_vf.h:212
s32(* check_for_msg)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:283
u16 rar_entry_count
Definition: igbvf_vf.h:232
String functions.
s32(* read_mac_addr)(struct e1000_hw *)
Definition: igbvf_vf.h:221
uint8_t u8
Definition: stdint.h:19
uint32_t u32
Definition: stdint.h:23
struct e1000_adv_tx_desc::@55 read
u16 mta_reg_count
Definition: igbvf_vf.h:231
struct e1000_adv_rx_desc::@47 read
s32(* init_params)(struct e1000_hw *)
Definition: igbvf_vf.h:209