1 /******************************************************************************
3 Copyright (c) 2001-2012, Intel Corporation
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
32 ******************************************************************************/
38 #include "e1000_osdep.h"
39 #include "e1000_regs.h"
40 #include "e1000_defines.h"
44 #define E1000_DEV_ID_82576 0x10C9
45 #define E1000_DEV_ID_82576_FIBER 0x10E6
46 #define E1000_DEV_ID_82576_SERDES 0x10E7
47 #define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8
48 #define E1000_DEV_ID_82576_QUAD_COPPER_ET2 0x1526
49 #define E1000_DEV_ID_82576_NS 0x150A
50 #define E1000_DEV_ID_82576_NS_SERDES 0x1518
51 #define E1000_DEV_ID_82576_SERDES_QUAD 0x150D
52 #define E1000_DEV_ID_82576_VF 0x10CA
53 #define E1000_DEV_ID_I350_VF 0x1520
54 #define E1000_DEV_ID_82575EB_COPPER 0x10A7
55 #define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9
56 #define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6
57 #define E1000_DEV_ID_82580_COPPER 0x150E
58 #define E1000_DEV_ID_82580_FIBER 0x150F
59 #define E1000_DEV_ID_82580_SERDES 0x1510
60 #define E1000_DEV_ID_82580_SGMII 0x1511
61 #define E1000_DEV_ID_82580_COPPER_DUAL 0x1516
62 #define E1000_DEV_ID_82580_QUAD_FIBER 0x1527
63 #define E1000_DEV_ID_I350_COPPER 0x1521
64 #define E1000_DEV_ID_I350_FIBER 0x1522
65 #define E1000_DEV_ID_I350_SERDES 0x1523
66 #define E1000_DEV_ID_I350_SGMII 0x1524
67 #define E1000_DEV_ID_I350_DA4 0x1546
68 #define E1000_DEV_ID_I210_COPPER 0x1533
69 #define E1000_DEV_ID_I210_COPPER_OEM1 0x1534
70 #define E1000_DEV_ID_I210_COPPER_IT 0x1535
71 #define E1000_DEV_ID_I210_FIBER 0x1536
72 #define E1000_DEV_ID_I210_SERDES 0x1537
73 #define E1000_DEV_ID_I210_SGMII 0x1538
74 #define E1000_DEV_ID_I211_COPPER 0x1539
75 #define E1000_DEV_ID_DH89XXCC_SGMII 0x0438
76 #define E1000_DEV_ID_DH89XXCC_SERDES 0x043A
77 #define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C
78 #define E1000_DEV_ID_DH89XXCC_SFP 0x0440
79 #define E1000_REVISION_0 0
80 #define E1000_REVISION_1 1
81 #define E1000_REVISION_2 2
82 #define E1000_REVISION_3 3
83 #define E1000_REVISION_4 4
85 #define E1000_FUNC_0 0
86 #define E1000_FUNC_1 1
87 #define E1000_FUNC_2 2
88 #define E1000_FUNC_3 3
90 #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0
91 #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
92 #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN2 6
93 #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN3 9
105 e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */
111 /* Receive Descriptor */
112 struct e1000_rx_desc {
113 __le64 buffer_addr; /* Address of the descriptor's data buffer */
114 __le16 length; /* Length of data DMAed into data buffer */
115 __le16 csum; /* Packet checksum */
116 u8 status; /* Descriptor status */
117 u8 errors; /* Descriptor Errors */
121 /* Receive Descriptor - Extended */
122 union e1000_rx_desc_extended {
129 __le32 mrq; /* Multiple Rx Queues */
131 __le32 rss; /* RSS Hash */
133 __le16 ip_id; /* IP id */
134 __le16 csum; /* Packet Checksum */
139 __le32 status_error; /* ext status/error */
141 __le16 vlan; /* VLAN tag */
143 } wb; /* writeback */
146 #define MAX_PS_BUFFERS 4
147 /* Receive Descriptor - Packet Split */
148 union e1000_rx_desc_packet_split {
150 /* one buffer for protocol header(s), three data buffers */
151 __le64 buffer_addr[MAX_PS_BUFFERS];
155 __le32 mrq; /* Multiple Rx Queues */
157 __le32 rss; /* RSS Hash */
159 __le16 ip_id; /* IP id */
160 __le16 csum; /* Packet Checksum */
165 __le32 status_error; /* ext status/error */
166 __le16 length0; /* length of buffer 0 */
167 __le16 vlan; /* VLAN tag */
170 __le16 header_status;
171 __le16 length[3]; /* length of buffers 1-3 */
174 } wb; /* writeback */
177 /* Transmit Descriptor */
178 struct e1000_tx_desc {
179 __le64 buffer_addr; /* Address of the descriptor's data buffer */
183 __le16 length; /* Data buffer length */
184 u8 cso; /* Checksum offset */
185 u8 cmd; /* Descriptor control */
191 u8 status; /* Descriptor status */
192 u8 css; /* Checksum start */
198 /* Offload Context Descriptor */
199 struct e1000_context_desc {
203 u8 ipcss; /* IP checksum start */
204 u8 ipcso; /* IP checksum offset */
205 __le16 ipcse; /* IP checksum end */
211 u8 tucss; /* TCP checksum start */
212 u8 tucso; /* TCP checksum offset */
213 __le16 tucse; /* TCP checksum end */
216 __le32 cmd_and_length;
220 u8 status; /* Descriptor status */
221 u8 hdr_len; /* Header length */
222 __le16 mss; /* Maximum segment size */
227 /* Offload data descriptor */
228 struct e1000_data_desc {
229 __le64 buffer_addr; /* Address of the descriptor's buffer address */
233 __le16 length; /* Data buffer length */
241 u8 status; /* Descriptor status */
242 u8 popts; /* Packet Options */
248 struct e1000_mac_info {
249 u8 addr[ETH_ADDR_LEN];
250 u8 perm_addr[ETH_ADDR_LEN];
251 enum e1000_mac_type type;
258 struct e1000_mac_info mac;
260 u16 subsystem_vendor_id;
261 u16 subsystem_device_id;