(no commit message)
[linux-2.6.git] / linux-2.6-730-igb-driver.patch
1 diff -Nru vanilla/drivers/net/igb/e1000_82575.c linux-i686-2.6.22/drivers/net/igb/e1000_82575.c
2 --- vanilla/drivers/net/igb/e1000_82575.c       1969-12-31 19:00:00.000000000 -0500
3 +++ linux-i686-2.6.22/drivers/net/igb/e1000_82575.c     2009-07-16 19:25:22.000000000 -0400
4 @@ -0,0 +1,1663 @@
5 +/*******************************************************************************
6 +
7 +  Intel(R) Gigabit Ethernet Linux driver
8 +  Copyright(c) 2007-2008 Intel Corporation.
9 +
10 +  This program is free software; you can redistribute it and/or modify it
11 +  under the terms and conditions of the GNU General Public License,
12 +  version 2, as published by the Free Software Foundation.
13 +
14 +  This program is distributed in the hope it will be useful, but WITHOUT
15 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17 +  more details.
18 +
19 +  You should have received a copy of the GNU General Public License along with
20 +  this program; if not, write to the Free Software Foundation, Inc.,
21 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
22 +
23 +  The full GNU General Public License is included in this distribution in
24 +  the file called "COPYING".
25 +
26 +  Contact Information:
27 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
28 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
29 +
30 +*******************************************************************************/
31 +
32 +/*
33 + * 82575EB Gigabit Network Connection
34 + * 82575EB Gigabit Backplane Connection
35 + * 82575GB Gigabit Network Connection
36 + * 82576 Gigabit Network Connection
37 + */
38 +
39 +#include "e1000_api.h"
40 +
41 +static s32  e1000_init_phy_params_82575(struct e1000_hw *hw);
42 +static s32  e1000_init_nvm_params_82575(struct e1000_hw *hw);
43 +static s32  e1000_init_mac_params_82575(struct e1000_hw *hw);
44 +static s32  e1000_acquire_phy_82575(struct e1000_hw *hw);
45 +static void e1000_release_phy_82575(struct e1000_hw *hw);
46 +static s32  e1000_acquire_nvm_82575(struct e1000_hw *hw);
47 +static void e1000_release_nvm_82575(struct e1000_hw *hw);
48 +static s32  e1000_check_for_link_82575(struct e1000_hw *hw);
49 +static s32  e1000_get_cfg_done_82575(struct e1000_hw *hw);
50 +static s32  e1000_get_link_up_info_82575(struct e1000_hw *hw, u16 *speed,
51 +                                         u16 *duplex);
52 +static s32  e1000_init_hw_82575(struct e1000_hw *hw);
53 +static s32  e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw);
54 +static s32  e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
55 +                                           u16 *data);
56 +static s32  e1000_reset_hw_82575(struct e1000_hw *hw);
57 +static s32  e1000_set_d0_lplu_state_82575(struct e1000_hw *hw,
58 +                                          bool active);
59 +static s32  e1000_setup_copper_link_82575(struct e1000_hw *hw);
60 +static s32  e1000_setup_fiber_serdes_link_82575(struct e1000_hw *hw);
61 +static s32  e1000_valid_led_default_82575(struct e1000_hw *hw, u16 *data);
62 +static s32  e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw,
63 +                                            u32 offset, u16 data);
64 +static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw);
65 +static s32  e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask);
66 +static s32  e1000_configure_pcs_link_82575(struct e1000_hw *hw);
67 +static s32  e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw,
68 +                                                 u16 *speed, u16 *duplex);
69 +static s32  e1000_get_phy_id_82575(struct e1000_hw *hw);
70 +static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask);
71 +static bool e1000_sgmii_active_82575(struct e1000_hw *hw);
72 +static s32  e1000_reset_init_script_82575(struct e1000_hw *hw);
73 +static s32  e1000_read_mac_addr_82575(struct e1000_hw *hw);
74 +static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw);
75 +
76 +static void e1000_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count);
77 +static void e1000_update_mc_addr_list_82575(struct e1000_hw *hw,
78 +                                           u8 *mc_addr_list, u32 mc_addr_count,
79 +                                           u32 rar_used_count, u32 rar_count);
80 +void e1000_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw);
81 +
82 +/**
83 + *  e1000_init_phy_params_82575 - Init PHY func ptrs.
84 + *  @hw: pointer to the HW structure
85 + **/
86 +static s32 e1000_init_phy_params_82575(struct e1000_hw *hw)
87 +{
88 +       struct e1000_phy_info *phy = &hw->phy;
89 +       s32 ret_val = E1000_SUCCESS;
90 +
91 +       DEBUGFUNC("e1000_init_phy_params_82575");
92 +
93 +       if (hw->phy.media_type != e1000_media_type_copper) {
94 +               phy->type = e1000_phy_none;
95 +               goto out;
96 +       } else {
97 +               phy->ops.power_up   = e1000_power_up_phy_copper;
98 +               phy->ops.power_down = e1000_power_down_phy_copper_82575;
99 +       }
100 +
101 +       phy->autoneg_mask           = AUTONEG_ADVERTISE_SPEED_DEFAULT;
102 +       phy->reset_delay_us         = 100;
103 +
104 +       phy->ops.acquire            = e1000_acquire_phy_82575;
105 +       phy->ops.check_reset_block  = e1000_check_reset_block_generic;
106 +       phy->ops.commit             = e1000_phy_sw_reset_generic;
107 +       phy->ops.get_cfg_done       = e1000_get_cfg_done_82575;
108 +       phy->ops.release            = e1000_release_phy_82575;
109 +
110 +       if (e1000_sgmii_active_82575(hw)) {
111 +               phy->ops.reset      = e1000_phy_hw_reset_sgmii_82575;
112 +               phy->ops.read_reg   = e1000_read_phy_reg_sgmii_82575;
113 +               phy->ops.write_reg  = e1000_write_phy_reg_sgmii_82575;
114 +       } else {
115 +               phy->ops.reset      = e1000_phy_hw_reset_generic;
116 +               phy->ops.read_reg   = e1000_read_phy_reg_igp;
117 +               phy->ops.write_reg  = e1000_write_phy_reg_igp;
118 +       }
119 +
120 +       /* Set phy->phy_addr and phy->id. */
121 +       ret_val = e1000_get_phy_id_82575(hw);
122 +
123 +       /* Verify phy id and set remaining function pointers */
124 +       switch (phy->id) {
125 +       case M88E1111_I_PHY_ID:
126 +               phy->type                   = e1000_phy_m88;
127 +               phy->ops.check_polarity     = e1000_check_polarity_m88;
128 +               phy->ops.get_info           = e1000_get_phy_info_m88;
129 +               phy->ops.get_cable_length   = e1000_get_cable_length_m88;
130 +               phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88;
131 +               break;
132 +       case IGP03E1000_E_PHY_ID:
133 +       case IGP04E1000_E_PHY_ID:
134 +               phy->type                   = e1000_phy_igp_3;
135 +               phy->ops.check_polarity     = e1000_check_polarity_igp;
136 +               phy->ops.get_info           = e1000_get_phy_info_igp;
137 +               phy->ops.get_cable_length   = e1000_get_cable_length_igp_2;
138 +               phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp;
139 +               phy->ops.set_d0_lplu_state  = e1000_set_d0_lplu_state_82575;
140 +               phy->ops.set_d3_lplu_state  = e1000_set_d3_lplu_state_generic;
141 +               break;
142 +       default:
143 +               ret_val = -E1000_ERR_PHY;
144 +               goto out;
145 +       }
146 +
147 +out:
148 +       return ret_val;
149 +}
150 +
151 +/**
152 + *  e1000_init_nvm_params_82575 - Init NVM func ptrs.
153 + *  @hw: pointer to the HW structure
154 + **/
155 +static s32 e1000_init_nvm_params_82575(struct e1000_hw *hw)
156 +{
157 +       struct e1000_nvm_info *nvm = &hw->nvm;
158 +       u32 eecd = E1000_READ_REG(hw, E1000_EECD);
159 +       u16 size;
160 +
161 +       DEBUGFUNC("e1000_init_nvm_params_82575");
162 +
163 +       nvm->opcode_bits        = 8;
164 +       nvm->delay_usec         = 1;
165 +       switch (nvm->override) {
166 +       case e1000_nvm_override_spi_large:
167 +               nvm->page_size    = 32;
168 +               nvm->address_bits = 16;
169 +               break;
170 +       case e1000_nvm_override_spi_small:
171 +               nvm->page_size    = 8;
172 +               nvm->address_bits = 8;
173 +               break;
174 +       default:
175 +               nvm->page_size    = eecd & E1000_EECD_ADDR_BITS ? 32 : 8;
176 +               nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8;
177 +               break;
178 +       }
179 +
180 +       nvm->type              = e1000_nvm_eeprom_spi;
181 +
182 +       size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
183 +                         E1000_EECD_SIZE_EX_SHIFT);
184 +
185 +       /*
186 +        * Added to a constant, "size" becomes the left-shift value
187 +        * for setting word_size.
188 +        */
189 +       size += NVM_WORD_SIZE_BASE_SHIFT;
190 +
191 +       /* EEPROM access above 16k is unsupported */
192 +       if (size > 14)
193 +               size = 14;
194 +       nvm->word_size  = 1 << size;
195 +
196 +       /* Function Pointers */
197 +       nvm->ops.acquire       = e1000_acquire_nvm_82575;
198 +       nvm->ops.read          = e1000_read_nvm_eerd;
199 +       nvm->ops.release       = e1000_release_nvm_82575;
200 +       nvm->ops.update        = e1000_update_nvm_checksum_generic;
201 +       nvm->ops.valid_led_default = e1000_valid_led_default_82575;
202 +       nvm->ops.validate      = e1000_validate_nvm_checksum_generic;
203 +       nvm->ops.write         = e1000_write_nvm_spi;
204 +
205 +       return E1000_SUCCESS;
206 +}
207 +
208 +/**
209 + *  e1000_init_mac_params_82575 - Init MAC func ptrs.
210 + *  @hw: pointer to the HW structure
211 + **/
212 +static s32 e1000_init_mac_params_82575(struct e1000_hw *hw)
213 +{
214 +       struct e1000_mac_info *mac = &hw->mac;
215 +       struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575;
216 +       u32 ctrl_ext = 0;
217 +
218 +       DEBUGFUNC("e1000_init_mac_params_82575");
219 +
220 +       /* Set media type */
221 +        /*
222 +        * The 82575 uses bits 22:23 for link mode. The mode can be changed
223 +         * based on the EEPROM. We cannot rely upon device ID. There
224 +         * is no distinguishable difference between fiber and internal
225 +         * SerDes mode on the 82575. There can be an external PHY attached
226 +         * on the SGMII interface. For this, we'll set sgmii_active to true.
227 +         */
228 +       hw->phy.media_type = e1000_media_type_copper;
229 +       dev_spec->sgmii_active = false;
230 +
231 +       ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT);
232 +       if ((ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) ==
233 +           E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES) {
234 +               hw->phy.media_type = e1000_media_type_internal_serdes;
235 +               ctrl_ext |= E1000_CTRL_I2C_ENA;
236 +       } else if (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_SGMII) {
237 +               dev_spec->sgmii_active = true;
238 +               ctrl_ext |= E1000_CTRL_I2C_ENA;
239 +       } else {
240 +               ctrl_ext &= ~E1000_CTRL_I2C_ENA;
241 +       }
242 +       E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext);
243 +
244 +       /* Set mta register count */
245 +       mac->mta_reg_count = 128;
246 +       /* Set rar entry count */
247 +       mac->rar_entry_count = E1000_RAR_ENTRIES_82575;
248 +       if (mac->type == e1000_82576)
249 +               mac->rar_entry_count = E1000_RAR_ENTRIES_82576;
250 +       /* Set if part includes ASF firmware */
251 +       mac->asf_firmware_present = true;
252 +       /* Set if manageability features are enabled. */
253 +       mac->arc_subsystem_valid =
254 +               (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK)
255 +                       ? true : false;
256 +
257 +       /* Function pointers */
258 +
259 +       /* bus type/speed/width */
260 +       mac->ops.get_bus_info = e1000_get_bus_info_pcie_generic;
261 +       /* reset */
262 +       mac->ops.reset_hw = e1000_reset_hw_82575;
263 +       /* hw initialization */
264 +       mac->ops.init_hw = e1000_init_hw_82575;
265 +       /* link setup */
266 +       mac->ops.setup_link = e1000_setup_link_generic;
267 +       /* physical interface link setup */
268 +       mac->ops.setup_physical_interface =
269 +               (hw->phy.media_type == e1000_media_type_copper)
270 +                       ? e1000_setup_copper_link_82575
271 +                       : e1000_setup_fiber_serdes_link_82575;
272 +       /* physical interface shutdown */
273 +       mac->ops.shutdown_serdes = e1000_shutdown_fiber_serdes_link_82575;
274 +       /* check for link */
275 +       mac->ops.check_for_link = e1000_check_for_link_82575;
276 +       /* receive address register setting */
277 +       mac->ops.rar_set = e1000_rar_set_generic;
278 +       /* read mac address */
279 +       mac->ops.read_mac_addr = e1000_read_mac_addr_82575;
280 +       /* multicast address update */
281 +       mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_82575;
282 +       /* writing VFTA */
283 +       mac->ops.write_vfta = e1000_write_vfta_generic;
284 +       /* clearing VFTA */
285 +       mac->ops.clear_vfta = e1000_clear_vfta_generic;
286 +       /* setting MTA */
287 +       mac->ops.mta_set = e1000_mta_set_generic;
288 +       /* blink LED */
289 +       mac->ops.blink_led = e1000_blink_led_generic;
290 +       /* setup LED */
291 +       mac->ops.setup_led = e1000_setup_led_generic;
292 +       /* cleanup LED */
293 +       mac->ops.cleanup_led = e1000_cleanup_led_generic;
294 +       /* turn on/off LED */
295 +       mac->ops.led_on = e1000_led_on_generic;
296 +       mac->ops.led_off = e1000_led_off_generic;
297 +       /* clear hardware counters */
298 +       mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_82575;
299 +       /* link info */
300 +       mac->ops.get_link_up_info = e1000_get_link_up_info_82575;
301 +
302 +       return E1000_SUCCESS;
303 +}
304 +
305 +/**
306 + *  e1000_init_function_pointers_82575 - Init func ptrs.
307 + *  @hw: pointer to the HW structure
308 + *
309 + *  Called to initialize all function pointers and parameters.
310 + **/
311 +void e1000_init_function_pointers_82575(struct e1000_hw *hw)
312 +{
313 +       DEBUGFUNC("e1000_init_function_pointers_82575");
314 +
315 +       hw->mac.ops.init_params = e1000_init_mac_params_82575;
316 +       hw->nvm.ops.init_params = e1000_init_nvm_params_82575;
317 +       hw->phy.ops.init_params = e1000_init_phy_params_82575;
318 +}
319 +
320 +/**
321 + *  e1000_acquire_phy_82575 - Acquire rights to access PHY
322 + *  @hw: pointer to the HW structure
323 + *
324 + *  Acquire access rights to the correct PHY.
325 + **/
326 +static s32 e1000_acquire_phy_82575(struct e1000_hw *hw)
327 +{
328 +       u16 mask;
329 +
330 +       DEBUGFUNC("e1000_acquire_phy_82575");
331 +
332 +       mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM;
333 +
334 +       return e1000_acquire_swfw_sync_82575(hw, mask);
335 +}
336 +
337 +/**
338 + *  e1000_release_phy_82575 - Release rights to access PHY
339 + *  @hw: pointer to the HW structure
340 + *
341 + *  A wrapper to release access rights to the correct PHY.
342 + **/
343 +static void e1000_release_phy_82575(struct e1000_hw *hw)
344 +{
345 +       u16 mask;
346 +
347 +       DEBUGFUNC("e1000_release_phy_82575");
348 +
349 +       mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM;
350 +       e1000_release_swfw_sync_82575(hw, mask);
351 +}
352 +
353 +/**
354 + *  e1000_read_phy_reg_sgmii_82575 - Read PHY register using sgmii
355 + *  @hw: pointer to the HW structure
356 + *  @offset: register offset to be read
357 + *  @data: pointer to the read data
358 + *
359 + *  Reads the PHY register at offset using the serial gigabit media independent
360 + *  interface and stores the retrieved information in data.
361 + **/
362 +static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
363 +                                          u16 *data)
364 +{
365 +       struct e1000_phy_info *phy = &hw->phy;
366 +       u32 i, i2ccmd = 0;
367 +
368 +       DEBUGFUNC("e1000_read_phy_reg_sgmii_82575");
369 +
370 +       if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
371 +               DEBUGOUT1("PHY Address %u is out of range\n", offset);
372 +               return -E1000_ERR_PARAM;
373 +       }
374 +
375 +       /*
376 +        * Set up Op-code, Phy Address, and register address in the I2CCMD
377 +        * register.  The MAC will take care of interfacing with the
378 +        * PHY to retrieve the desired data.
379 +        */
380 +       i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) |
381 +                 (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) |
382 +                 (E1000_I2CCMD_OPCODE_READ));
383 +
384 +       E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd);
385 +
386 +       /* Poll the ready bit to see if the I2C read completed */
387 +       for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) {
388 +               usec_delay(50);
389 +               i2ccmd = E1000_READ_REG(hw, E1000_I2CCMD);
390 +               if (i2ccmd & E1000_I2CCMD_READY)
391 +                       break;
392 +       }
393 +       if (!(i2ccmd & E1000_I2CCMD_READY)) {
394 +               DEBUGOUT("I2CCMD Read did not complete\n");
395 +               return -E1000_ERR_PHY;
396 +       }
397 +       if (i2ccmd & E1000_I2CCMD_ERROR) {
398 +               DEBUGOUT("I2CCMD Error bit set\n");
399 +               return -E1000_ERR_PHY;
400 +       }
401 +
402 +       /* Need to byte-swap the 16-bit value. */
403 +       *data = ((i2ccmd >> 8) & 0x00FF) | ((i2ccmd << 8) & 0xFF00);
404 +
405 +       return E1000_SUCCESS;
406 +}
407 +
408 +/**
409 + *  e1000_write_phy_reg_sgmii_82575 - Write PHY register using sgmii
410 + *  @hw: pointer to the HW structure
411 + *  @offset: register offset to write to
412 + *  @data: data to write at register offset
413 + *
414 + *  Writes the data to PHY register at the offset using the serial gigabit
415 + *  media independent interface.
416 + **/
417 +static s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,
418 +                                           u16 data)
419 +{
420 +       struct e1000_phy_info *phy = &hw->phy;
421 +       u32 i, i2ccmd = 0;
422 +       u16 phy_data_swapped;
423 +
424 +       DEBUGFUNC("e1000_write_phy_reg_sgmii_82575");
425 +
426 +       if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
427 +               DEBUGOUT1("PHY Address %d is out of range\n", offset);
428 +               return -E1000_ERR_PARAM;
429 +       }
430 +
431 +       /* Swap the data bytes for the I2C interface */
432 +       phy_data_swapped = ((data >> 8) & 0x00FF) | ((data << 8) & 0xFF00);
433 +
434 +       /*
435 +        * Set up Op-code, Phy Address, and register address in the I2CCMD
436 +        * register.  The MAC will take care of interfacing with the
437 +        * PHY to retrieve the desired data.
438 +        */
439 +       i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) |
440 +                 (phy->addr << E1000_I2CCMD_PHY_ADDR_SHIFT) |
441 +                 E1000_I2CCMD_OPCODE_WRITE |
442 +                 phy_data_swapped);
443 +
444 +       E1000_WRITE_REG(hw, E1000_I2CCMD, i2ccmd);
445 +
446 +       /* Poll the ready bit to see if the I2C read completed */
447 +       for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) {
448 +               usec_delay(50);
449 +               i2ccmd = E1000_READ_REG(hw, E1000_I2CCMD);
450 +               if (i2ccmd & E1000_I2CCMD_READY)
451 +                       break;
452 +       }
453 +       if (!(i2ccmd & E1000_I2CCMD_READY)) {
454 +               DEBUGOUT("I2CCMD Write did not complete\n");
455 +               return -E1000_ERR_PHY;
456 +       }
457 +       if (i2ccmd & E1000_I2CCMD_ERROR) {
458 +               DEBUGOUT("I2CCMD Error bit set\n");
459 +               return -E1000_ERR_PHY;
460 +       }
461 +
462 +       return E1000_SUCCESS;
463 +}
464 +
465 +/**
466 + *  e1000_get_phy_id_82575 - Retrieve PHY addr and id
467 + *  @hw: pointer to the HW structure
468 + *
469 + *  Retrieves the PHY address and ID for both PHY's which do and do not use
470 + *  sgmi interface.
471 + **/
472 +static s32 e1000_get_phy_id_82575(struct e1000_hw *hw)
473 +{
474 +       struct e1000_phy_info *phy = &hw->phy;
475 +       s32  ret_val = E1000_SUCCESS;
476 +       u16 phy_id;
477 +
478 +       DEBUGFUNC("e1000_get_phy_id_82575");
479 +
480 +       /*
481 +        * For SGMII PHYs, we try the list of possible addresses until
482 +        * we find one that works.  For non-SGMII PHYs
483 +        * (e.g. integrated copper PHYs), an address of 1 should
484 +        * work.  The result of this function should mean phy->phy_addr
485 +        * and phy->id are set correctly.
486 +        */
487 +       if (!(e1000_sgmii_active_82575(hw))) {
488 +               phy->addr = 1;
489 +               ret_val = e1000_get_phy_id(hw);
490 +               goto out;
491 +       }
492 +
493 +       /*
494 +        * The address field in the I2CCMD register is 3 bits and 0 is invalid.
495 +        * Therefore, we need to test 1-7
496 +        */
497 +       for (phy->addr = 1; phy->addr < 8; phy->addr++) {
498 +               ret_val = e1000_read_phy_reg_sgmii_82575(hw, PHY_ID1, &phy_id);
499 +               if (ret_val == E1000_SUCCESS) {
500 +                       DEBUGOUT2("Vendor ID 0x%08X read at address %u\n",
501 +                                 phy_id,
502 +                                 phy->addr);
503 +                       /*
504 +                        * At the time of this writing, The M88 part is
505 +                        * the only supported SGMII PHY product.
506 +                        */
507 +                       if (phy_id == M88_VENDOR)
508 +                               break;
509 +               } else {
510 +                       DEBUGOUT1("PHY address %u was unreadable\n",
511 +                                 phy->addr);
512 +               }
513 +       }
514 +
515 +       /* A valid PHY type couldn't be found. */
516 +       if (phy->addr == 8) {
517 +               phy->addr = 0;
518 +               ret_val = -E1000_ERR_PHY;
519 +               goto out;
520 +       }
521 +
522 +       ret_val = e1000_get_phy_id(hw);
523 +
524 +out:
525 +       return ret_val;
526 +}
527 +
528 +/**
529 + *  e1000_phy_hw_reset_sgmii_82575 - Performs a PHY reset
530 + *  @hw: pointer to the HW structure
531 + *
532 + *  Resets the PHY using the serial gigabit media independent interface.
533 + **/
534 +static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw)
535 +{
536 +       s32 ret_val = E1000_SUCCESS;
537 +
538 +       DEBUGFUNC("e1000_phy_hw_reset_sgmii_82575");
539 +
540 +       /*
541 +        * This isn't a true "hard" reset, but is the only reset
542 +        * available to us at this time.
543 +        */
544 +
545 +       DEBUGOUT("Soft resetting SGMII attached PHY...\n");
546 +
547 +       if (!(hw->phy.ops.write_reg))
548 +               goto out;
549 +
550 +       /*
551 +        * SFP documentation requires the following to configure the SPF module
552 +        * to work on SGMII.  No further documentation is given.
553 +        */
554 +       ret_val = hw->phy.ops.write_reg(hw, 0x1B, 0x8084);
555 +       if (ret_val)
556 +               goto out;
557 +
558 +       ret_val = hw->phy.ops.commit(hw);
559 +
560 +out:
561 +       return ret_val;
562 +}
563 +
564 +/**
565 + *  e1000_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state
566 + *  @hw: pointer to the HW structure
567 + *  @active: true to enable LPLU, false to disable
568 + *
569 + *  Sets the LPLU D0 state according to the active flag.  When
570 + *  activating LPLU this function also disables smart speed
571 + *  and vice versa.  LPLU will not be activated unless the
572 + *  device autonegotiation advertisement meets standards of
573 + *  either 10 or 10/100 or 10/100/1000 at all duplexes.
574 + *  This is a function pointer entry point only called by
575 + *  PHY setup routines.
576 + **/
577 +static s32 e1000_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active)
578 +{
579 +       struct e1000_phy_info *phy = &hw->phy;
580 +       s32 ret_val = E1000_SUCCESS;
581 +       u16 data;
582 +
583 +       DEBUGFUNC("e1000_set_d0_lplu_state_82575");
584 +
585 +       if (!(hw->phy.ops.read_reg))
586 +               goto out;
587 +
588 +       ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data);
589 +       if (ret_val)
590 +               goto out;
591 +
592 +       if (active) {
593 +               data |= IGP02E1000_PM_D0_LPLU;
594 +               ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
595 +                                            data);
596 +               if (ret_val)
597 +                       goto out;
598 +
599 +               /* When LPLU is enabled, we should disable SmartSpeed */
600 +               ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
601 +                                           &data);
602 +               data &= ~IGP01E1000_PSCFR_SMART_SPEED;
603 +               ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
604 +                                            data);
605 +               if (ret_val)
606 +                       goto out;
607 +       } else {
608 +               data &= ~IGP02E1000_PM_D0_LPLU;
609 +               ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
610 +                                            data);
611 +               /*
612 +                * LPLU and SmartSpeed are mutually exclusive.  LPLU is used
613 +                * during Dx states where the power conservation is most
614 +                * important.  During driver activity we should enable
615 +                * SmartSpeed, so performance is maintained.
616 +                */
617 +               if (phy->smart_speed == e1000_smart_speed_on) {
618 +                       ret_val = phy->ops.read_reg(hw,
619 +                                                   IGP01E1000_PHY_PORT_CONFIG,
620 +                                                   &data);
621 +                       if (ret_val)
622 +                               goto out;
623 +
624 +                       data |= IGP01E1000_PSCFR_SMART_SPEED;
625 +                       ret_val = phy->ops.write_reg(hw,
626 +                                                    IGP01E1000_PHY_PORT_CONFIG,
627 +                                                    data);
628 +                       if (ret_val)
629 +                               goto out;
630 +               } else if (phy->smart_speed == e1000_smart_speed_off) {
631 +                       ret_val = phy->ops.read_reg(hw,
632 +                                                   IGP01E1000_PHY_PORT_CONFIG,
633 +                                                   &data);
634 +                       if (ret_val)
635 +                               goto out;
636 +
637 +                       data &= ~IGP01E1000_PSCFR_SMART_SPEED;
638 +                       ret_val = phy->ops.write_reg(hw,
639 +                                                    IGP01E1000_PHY_PORT_CONFIG,
640 +                                                    data);
641 +                       if (ret_val)
642 +                               goto out;
643 +               }
644 +       }
645 +
646 +out:
647 +       return ret_val;
648 +}
649 +
650 +/**
651 + *  e1000_acquire_nvm_82575 - Request for access to EEPROM
652 + *  @hw: pointer to the HW structure
653 + *
654 + *  Acquire the necessary semaphores for exclusive access to the EEPROM.
655 + *  Set the EEPROM access request bit and wait for EEPROM access grant bit.
656 + *  Return successful if access grant bit set, else clear the request for
657 + *  EEPROM access and return -E1000_ERR_NVM (-1).
658 + **/
659 +static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw)
660 +{
661 +       s32 ret_val;
662 +
663 +       DEBUGFUNC("e1000_acquire_nvm_82575");
664 +
665 +       ret_val = e1000_acquire_swfw_sync_82575(hw, E1000_SWFW_EEP_SM);
666 +       if (ret_val)
667 +               goto out;
668 +
669 +       ret_val = e1000_acquire_nvm_generic(hw);
670 +
671 +       if (ret_val)
672 +               e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM);
673 +
674 +out:
675 +       return ret_val;
676 +}
677 +
678 +/**
679 + *  e1000_release_nvm_82575 - Release exclusive access to EEPROM
680 + *  @hw: pointer to the HW structure
681 + *
682 + *  Stop any current commands to the EEPROM and clear the EEPROM request bit,
683 + *  then release the semaphores acquired.
684 + **/
685 +static void e1000_release_nvm_82575(struct e1000_hw *hw)
686 +{
687 +       DEBUGFUNC("e1000_release_nvm_82575");
688 +
689 +       e1000_release_nvm_generic(hw);
690 +       e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM);
691 +}
692 +
693 +/**
694 + *  e1000_acquire_swfw_sync_82575 - Acquire SW/FW semaphore
695 + *  @hw: pointer to the HW structure
696 + *  @mask: specifies which semaphore to acquire
697 + *
698 + *  Acquire the SW/FW semaphore to access the PHY or NVM.  The mask
699 + *  will also specify which port we're acquiring the lock for.
700 + **/
701 +static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
702 +{
703 +       u32 swfw_sync;
704 +       u32 swmask = mask;
705 +       u32 fwmask = mask << 16;
706 +       s32 ret_val = E1000_SUCCESS;
707 +       s32 i = 0, timeout = 200; /* FIXME: find real value to use here */
708 +
709 +       DEBUGFUNC("e1000_acquire_swfw_sync_82575");
710 +
711 +       while (i < timeout) {
712 +               if (e1000_get_hw_semaphore_generic(hw)) {
713 +                       ret_val = -E1000_ERR_SWFW_SYNC;
714 +                       goto out;
715 +               }
716 +
717 +               swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
718 +               if (!(swfw_sync & (fwmask | swmask)))
719 +                       break;
720 +
721 +               /*
722 +                * Firmware currently using resource (fwmask)
723 +                * or other software thread using resource (swmask)
724 +                */
725 +               e1000_put_hw_semaphore_generic(hw);
726 +               msec_delay_irq(5);
727 +               i++;
728 +       }
729 +
730 +       if (i == timeout) {
731 +               DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n");
732 +               ret_val = -E1000_ERR_SWFW_SYNC;
733 +               goto out;
734 +       }
735 +
736 +       swfw_sync |= swmask;
737 +       E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
738 +
739 +       e1000_put_hw_semaphore_generic(hw);
740 +
741 +out:
742 +       return ret_val;
743 +}
744 +
745 +/**
746 + *  e1000_release_swfw_sync_82575 - Release SW/FW semaphore
747 + *  @hw: pointer to the HW structure
748 + *  @mask: specifies which semaphore to acquire
749 + *
750 + *  Release the SW/FW semaphore used to access the PHY or NVM.  The mask
751 + *  will also specify which port we're releasing the lock for.
752 + **/
753 +static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
754 +{
755 +       u32 swfw_sync;
756 +
757 +       DEBUGFUNC("e1000_release_swfw_sync_82575");
758 +
759 +       while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS);
760 +       /* Empty */
761 +
762 +       swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
763 +       swfw_sync &= ~mask;
764 +       E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
765 +
766 +       e1000_put_hw_semaphore_generic(hw);
767 +}
768 +
769 +/**
770 + *  e1000_get_cfg_done_82575 - Read config done bit
771 + *  @hw: pointer to the HW structure
772 + *
773 + *  Read the management control register for the config done bit for
774 + *  completion status.  NOTE: silicon which is EEPROM-less will fail trying
775 + *  to read the config done bit, so an error is *ONLY* logged and returns
776 + *  E1000_SUCCESS.  If we were to return with error, EEPROM-less silicon
777 + *  would not be able to be reset or change link.
778 + **/
779 +static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw)
780 +{
781 +       s32 timeout = PHY_CFG_TIMEOUT;
782 +       s32 ret_val = E1000_SUCCESS;
783 +       u32 mask = E1000_NVM_CFG_DONE_PORT_0;
784 +
785 +       DEBUGFUNC("e1000_get_cfg_done_82575");
786 +
787 +       if (hw->bus.func == 1)
788 +               mask = E1000_NVM_CFG_DONE_PORT_1;
789 +
790 +       while (timeout) {
791 +               if (E1000_READ_REG(hw, E1000_EEMNGCTL) & mask)
792 +                       break;
793 +               msec_delay(1);
794 +               timeout--;
795 +       }
796 +       if (!timeout) {
797 +               DEBUGOUT("MNG configuration cycle has not completed.\n");
798 +       }
799 +
800 +       /* If EEPROM is not marked present, init the PHY manually */
801 +       if (((E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) == 0) &&
802 +           (hw->phy.type == e1000_phy_igp_3)) {
803 +               e1000_phy_init_script_igp3(hw);
804 +       }
805 +
806 +       return ret_val;
807 +}
808 +
809 +/**
810 + *  e1000_get_link_up_info_82575 - Get link speed/duplex info
811 + *  @hw: pointer to the HW structure
812 + *  @speed: stores the current speed
813 + *  @duplex: stores the current duplex
814 + *
815 + *  This is a wrapper function, if using the serial gigabit media independent
816 + *  interface, use PCS to retrieve the link speed and duplex information.
817 + *  Otherwise, use the generic function to get the link speed and duplex info.
818 + **/
819 +static s32 e1000_get_link_up_info_82575(struct e1000_hw *hw, u16 *speed,
820 +                                        u16 *duplex)
821 +{
822 +       s32 ret_val;
823 +
824 +       DEBUGFUNC("e1000_get_link_up_info_82575");
825 +
826 +       if (hw->phy.media_type != e1000_media_type_copper ||
827 +           e1000_sgmii_active_82575(hw)) {
828 +               ret_val = e1000_get_pcs_speed_and_duplex_82575(hw, speed,
829 +                                                              duplex);
830 +       } else {
831 +               ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed,
832 +                                                                   duplex);
833 +       }
834 +
835 +       return ret_val;
836 +}
837 +
838 +/**
839 + *  e1000_check_for_link_82575 - Check for link
840 + *  @hw: pointer to the HW structure
841 + *
842 + *  If sgmii is enabled, then use the pcs register to determine link, otherwise
843 + *  use the generic interface for determining link.
844 + **/
845 +static s32 e1000_check_for_link_82575(struct e1000_hw *hw)
846 +{
847 +       s32 ret_val;
848 +       u16 speed, duplex;
849 +
850 +       DEBUGFUNC("e1000_check_for_link_82575");
851 +
852 +       /* SGMII link check is done through the PCS register. */
853 +       if ((hw->phy.media_type != e1000_media_type_copper) ||
854 +           (e1000_sgmii_active_82575(hw)))
855 +               ret_val = e1000_get_pcs_speed_and_duplex_82575(hw, &speed,
856 +                                                              &duplex);
857 +       else
858 +               ret_val = e1000_check_for_copper_link_generic(hw);
859 +
860 +       return ret_val;
861 +}
862 +
863 +/**
864 + *  e1000_get_pcs_speed_and_duplex_82575 - Retrieve current speed/duplex
865 + *  @hw: pointer to the HW structure
866 + *  @speed: stores the current speed
867 + *  @duplex: stores the current duplex
868 + *
869 + *  Using the physical coding sub-layer (PCS), retrieve the current speed and
870 + *  duplex, then store the values in the pointers provided.
871 + **/
872 +static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw,
873 +                                                u16 *speed, u16 *duplex)
874 +{
875 +       struct e1000_mac_info *mac = &hw->mac;
876 +       u32 pcs;
877 +
878 +       DEBUGFUNC("e1000_get_pcs_speed_and_duplex_82575");
879 +
880 +       /* Set up defaults for the return values of this function */
881 +       mac->serdes_has_link = false;
882 +       *speed = 0;
883 +       *duplex = 0;
884 +
885 +       /*
886 +        * Read the PCS Status register for link state. For non-copper mode,
887 +        * the status register is not accurate. The PCS status register is
888 +        * used instead.
889 +        */
890 +       pcs = E1000_READ_REG(hw, E1000_PCS_LSTAT);
891 +
892 +       /*
893 +        * The link up bit determines when link is up on autoneg. The sync ok
894 +        * gets set once both sides sync up and agree upon link. Stable link
895 +        * can be determined by checking for both link up and link sync ok
896 +        */
897 +       if ((pcs & E1000_PCS_LSTS_LINK_OK) && (pcs & E1000_PCS_LSTS_SYNK_OK)) {
898 +               mac->serdes_has_link = true;
899 +
900 +               /* Detect and store PCS speed */
901 +               if (pcs & E1000_PCS_LSTS_SPEED_1000) {
902 +                       *speed = SPEED_1000;
903 +               } else if (pcs & E1000_PCS_LSTS_SPEED_100) {
904 +                       *speed = SPEED_100;
905 +               } else {
906 +                       *speed = SPEED_10;
907 +               }
908 +
909 +               /* Detect and store PCS duplex */
910 +               if (pcs & E1000_PCS_LSTS_DUPLEX_FULL) {
911 +                       *duplex = FULL_DUPLEX;
912 +               } else {
913 +                       *duplex = HALF_DUPLEX;
914 +               }
915 +       }
916 +
917 +       return E1000_SUCCESS;
918 +}
919 +
920 +/**
921 + *  e1000_init_rx_addrs_82575 - Initialize receive address's
922 + *  @hw: pointer to the HW structure
923 + *  @rar_count: receive address registers
924 + *
925 + *  Setups the receive address registers by setting the base receive address
926 + *  register to the devices MAC address and clearing all the other receive
927 + *  address registers to 0.
928 + **/
929 +static void e1000_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count)
930 +{
931 +       u32 i;
932 +       u8 addr[6] = {0,0,0,0,0,0};
933 +       /*
934 +        * This function is essentially the same as that of
935 +        * e1000_init_rx_addrs_generic. However it also takes care
936 +        * of the special case where the register offset of the
937 +        * second set of RARs begins elsewhere. This is implicitly taken care by
938 +        * function e1000_rar_set_generic.
939 +        */
940 +
941 +       DEBUGFUNC("e1000_init_rx_addrs_82575");
942 +
943 +       /* Setup the receive address */
944 +       DEBUGOUT("Programming MAC Address into RAR[0]\n");
945 +       hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
946 +
947 +       /* Zero out the other (rar_entry_count - 1) receive addresses */
948 +       DEBUGOUT1("Clearing RAR[1-%u]\n", rar_count-1);
949 +       for (i = 1; i < rar_count; i++) {
950 +           hw->mac.ops.rar_set(hw, addr, i);
951 +       }
952 +}
953 +
954 +/**
955 + *  e1000_update_mc_addr_list_82575 - Update Multicast addresses
956 + *  @hw: pointer to the HW structure
957 + *  @mc_addr_list: array of multicast addresses to program
958 + *  @mc_addr_count: number of multicast addresses to program
959 + *  @rar_used_count: the first RAR register free to program
960 + *  @rar_count: total number of supported Receive Address Registers
961 + *
962 + *  Updates the Receive Address Registers and Multicast Table Array.
963 + *  The caller must have a packed mc_addr_list of multicast addresses.
964 + *  The parameter rar_count will usually be hw->mac.rar_entry_count
965 + *  unless there are workarounds that change this.
966 + **/
967 +static void e1000_update_mc_addr_list_82575(struct e1000_hw *hw,
968 +                                     u8 *mc_addr_list, u32 mc_addr_count,
969 +                                     u32 rar_used_count, u32 rar_count)
970 +{
971 +       u32 hash_value;
972 +       u32 i;
973 +       u8 addr[6] = {0,0,0,0,0,0};
974 +       /*
975 +        * This function is essentially the same as that of 
976 +        * e1000_update_mc_addr_list_generic. However it also takes care 
977 +        * of the special case where the register offset of the 
978 +        * second set of RARs begins elsewhere. This is implicitly taken care by 
979 +        * function e1000_rar_set_generic.
980 +        */
981 +
982 +       DEBUGFUNC("e1000_update_mc_addr_list_82575");
983 +
984 +       /*
985 +        * Load the first set of multicast addresses into the exact
986 +        * filters (RAR).  If there are not enough to fill the RAR
987 +        * array, clear the filters.
988 +        */
989 +       for (i = rar_used_count; i < rar_count; i++) {
990 +               if (mc_addr_count) {
991 +                       e1000_rar_set_generic(hw, mc_addr_list, i);
992 +                       mc_addr_count--;
993 +                       mc_addr_list += ETH_ADDR_LEN;
994 +               } else {
995 +                       e1000_rar_set_generic(hw, addr, i);
996 +               }
997 +       }
998 +
999 +       /* Clear the old settings from the MTA */
1000 +       DEBUGOUT("Clearing MTA\n");
1001 +       for (i = 0; i < hw->mac.mta_reg_count; i++) {
1002 +               E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
1003 +               E1000_WRITE_FLUSH(hw);
1004 +       }
1005 +
1006 +       /* Load any remaining multicast addresses into the hash table. */
1007 +       for (; mc_addr_count > 0; mc_addr_count--) {
1008 +               hash_value = e1000_hash_mc_addr(hw, mc_addr_list);
1009 +               DEBUGOUT1("Hash value = 0x%03X\n", hash_value);
1010 +               hw->mac.ops.mta_set(hw, hash_value);
1011 +               mc_addr_list += ETH_ADDR_LEN;
1012 +       }
1013 +}
1014 +
1015 +/**
1016 + *  e1000_shutdown_fiber_serdes_link_82575 - Remove link during power down
1017 + *  @hw: pointer to the HW structure
1018 + *
1019 + *  In the case of fiber serdes shut down optics and PCS on driver unload
1020 + *  when management pass thru is not enabled.
1021 + **/
1022 +void e1000_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw)
1023 +{
1024 +       u32 reg;
1025 +       u16 eeprom_data = 0;
1026 +
1027 +       if (hw->mac.type != e1000_82576 ||
1028 +          (hw->phy.media_type != e1000_media_type_fiber &&
1029 +           hw->phy.media_type != e1000_media_type_internal_serdes))
1030 +               return;
1031 +
1032 +       if (hw->bus.func == 0)
1033 +               hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
1034 +
1035 +       /*
1036 +        * If APM is not enabled in the EEPROM and management interface is
1037 +        * not enabled, then power down.
1038 +        */
1039 +       if (!(eeprom_data & E1000_NVM_APME_82575) &&
1040 +           !e1000_enable_mng_pass_thru(hw)) {
1041 +               /* Disable PCS to turn off link */
1042 +               reg = E1000_READ_REG(hw, E1000_PCS_CFG0);
1043 +               reg &= ~E1000_PCS_CFG_PCS_EN;
1044 +               E1000_WRITE_REG(hw, E1000_PCS_CFG0, reg);
1045 +
1046 +               /* shutdown the laser */
1047 +               reg = E1000_READ_REG(hw, E1000_CTRL_EXT);
1048 +               reg |= E1000_CTRL_EXT_SDP7_DATA;
1049 +               E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg);
1050 +
1051 +               /* flush the write to verfiy completion */
1052 +               E1000_WRITE_FLUSH(hw);
1053 +               msec_delay(1);
1054 +       }
1055 +
1056 +       return;
1057 +}
1058 +
1059 +/**
1060 + *  e1000_reset_hw_82575 - Reset hardware
1061 + *  @hw: pointer to the HW structure
1062 + *
1063 + *  This resets the hardware into a known state.
1064 + **/
1065 +static s32 e1000_reset_hw_82575(struct e1000_hw *hw)
1066 +{
1067 +       u32 ctrl, icr;
1068 +       s32 ret_val;
1069 +
1070 +       DEBUGFUNC("e1000_reset_hw_82575");
1071 +
1072 +       /*
1073 +        * Prevent the PCI-E bus from sticking if there is no TLP connection
1074 +        * on the last TLP read/write transaction when MAC is reset.
1075 +        */
1076 +       ret_val = e1000_disable_pcie_master_generic(hw);
1077 +       if (ret_val) {
1078 +               DEBUGOUT("PCI-E Master disable polling has failed.\n");
1079 +       }
1080 +
1081 +       DEBUGOUT("Masking off all interrupts\n");
1082 +       E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
1083 +
1084 +       E1000_WRITE_REG(hw, E1000_RCTL, 0);
1085 +       E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP);
1086 +       E1000_WRITE_FLUSH(hw);
1087 +
1088 +       msec_delay(10);
1089 +
1090 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
1091 +
1092 +       DEBUGOUT("Issuing a global reset to MAC\n");
1093 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST);
1094 +
1095 +       ret_val = e1000_get_auto_rd_done_generic(hw);
1096 +       if (ret_val) {
1097 +               /*
1098 +                * When auto config read does not complete, do not
1099 +                * return with an error. This can happen in situations
1100 +                * where there is no eeprom and prevents getting link.
1101 +                */
1102 +               DEBUGOUT("Auto Read Done did not complete\n");
1103 +       }
1104 +
1105 +       /* If EEPROM is not present, run manual init scripts */
1106 +       if ((E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_PRES) == 0)
1107 +               e1000_reset_init_script_82575(hw);
1108 +
1109 +       /* Clear any pending interrupt events. */
1110 +       E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
1111 +       icr = E1000_READ_REG(hw, E1000_ICR);
1112 +
1113 +       e1000_check_alt_mac_addr_generic(hw);
1114 +
1115 +       return ret_val;
1116 +}
1117 +
1118 +/**
1119 + *  e1000_init_hw_82575 - Initialize hardware
1120 + *  @hw: pointer to the HW structure
1121 + *
1122 + *  This inits the hardware readying it for operation.
1123 + **/
1124 +static s32 e1000_init_hw_82575(struct e1000_hw *hw)
1125 +{
1126 +       struct e1000_mac_info *mac = &hw->mac;
1127 +       s32 ret_val;
1128 +       u16 i, rar_count = mac->rar_entry_count;
1129 +
1130 +       DEBUGFUNC("e1000_init_hw_82575");
1131 +
1132 +       /* Initialize identification LED */
1133 +       ret_val = e1000_id_led_init_generic(hw);
1134 +       if (ret_val) {
1135 +               DEBUGOUT("Error initializing identification LED\n");
1136 +               /* This is not fatal and we should not stop init due to this */
1137 +       }
1138 +
1139 +       /* Disabling VLAN filtering */
1140 +       DEBUGOUT("Initializing the IEEE VLAN\n");
1141 +       mac->ops.clear_vfta(hw);
1142 +
1143 +       /* Setup the receive address */
1144 +       e1000_init_rx_addrs_82575(hw, rar_count);
1145 +       /* Zero out the Multicast HASH table */
1146 +       DEBUGOUT("Zeroing the MTA\n");
1147 +       for (i = 0; i < mac->mta_reg_count; i++)
1148 +               E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
1149 +
1150 +       /* Setup link and flow control */
1151 +       ret_val = mac->ops.setup_link(hw);
1152 +
1153 +       /*
1154 +        * Clear all of the statistics registers (clear on read).  It is
1155 +        * important that we do this after we have tried to establish link
1156 +        * because the symbol error count will increment wildly if there
1157 +        * is no link.
1158 +        */
1159 +       e1000_clear_hw_cntrs_82575(hw);
1160 +
1161 +       return ret_val;
1162 +}
1163 +
1164 +/**
1165 + *  e1000_setup_copper_link_82575 - Configure copper link settings
1166 + *  @hw: pointer to the HW structure
1167 + *
1168 + *  Configures the link for auto-neg or forced speed and duplex.  Then we check
1169 + *  for link, once link is established calls to configure collision distance
1170 + *  and flow control are called.
1171 + **/
1172 +static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw)
1173 +{
1174 +       u32 ctrl, led_ctrl;
1175 +       s32  ret_val;
1176 +       bool link;
1177 +
1178 +       DEBUGFUNC("e1000_setup_copper_link_82575");
1179 +
1180 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
1181 +       ctrl |= E1000_CTRL_SLU;
1182 +       ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
1183 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
1184 +
1185 +       switch (hw->phy.type) {
1186 +       case e1000_phy_m88:
1187 +               ret_val = e1000_copper_link_setup_m88(hw);
1188 +               break;
1189 +       case e1000_phy_igp_3:
1190 +               ret_val = e1000_copper_link_setup_igp(hw);
1191 +               /* Setup activity LED */
1192 +               led_ctrl = E1000_READ_REG(hw, E1000_LEDCTL);
1193 +               led_ctrl &= IGP_ACTIVITY_LED_MASK;
1194 +               led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE);
1195 +               E1000_WRITE_REG(hw, E1000_LEDCTL, led_ctrl);
1196 +               break;
1197 +       default:
1198 +               ret_val = -E1000_ERR_PHY;
1199 +               break;
1200 +       }
1201 +
1202 +       if (ret_val)
1203 +               goto out;
1204 +
1205 +       if (hw->mac.autoneg) {
1206 +               /*
1207 +                * Setup autoneg and flow control advertisement
1208 +                * and perform autonegotiation.
1209 +                */
1210 +               ret_val = e1000_copper_link_autoneg(hw);
1211 +               if (ret_val)
1212 +                       goto out;
1213 +       } else {
1214 +               /*
1215 +                * PHY will be set to 10H, 10F, 100H or 100F
1216 +                * depending on user settings.
1217 +                */
1218 +               DEBUGOUT("Forcing Speed and Duplex\n");
1219 +               ret_val = hw->phy.ops.force_speed_duplex(hw);
1220 +               if (ret_val) {
1221 +                       DEBUGOUT("Error Forcing Speed and Duplex\n");
1222 +                       goto out;
1223 +               }
1224 +       }
1225 +
1226 +       ret_val = e1000_configure_pcs_link_82575(hw);
1227 +       if (ret_val)
1228 +               goto out;
1229 +
1230 +       /*
1231 +        * Check link status. Wait up to 100 microseconds for link to become
1232 +        * valid.
1233 +        */
1234 +       ret_val = e1000_phy_has_link_generic(hw,
1235 +                                            COPPER_LINK_UP_LIMIT,
1236 +                                            10,
1237 +                                            &link);
1238 +       if (ret_val)
1239 +               goto out;
1240 +
1241 +       if (link) {
1242 +               DEBUGOUT("Valid link established!!!\n");
1243 +               /* Config the MAC and PHY after link is up */
1244 +               e1000_config_collision_dist_generic(hw);
1245 +               ret_val = e1000_config_fc_after_link_up_generic(hw);
1246 +       } else {
1247 +               DEBUGOUT("Unable to establish link!!!\n");
1248 +       }
1249 +
1250 +out:
1251 +       return ret_val;
1252 +}
1253 +
1254 +/**
1255 + *  e1000_setup_fiber_serdes_link_82575 - Setup link for fiber/serdes
1256 + *  @hw: pointer to the HW structure
1257 + *
1258 + *  Configures speed and duplex for fiber and serdes links.
1259 + **/
1260 +static s32 e1000_setup_fiber_serdes_link_82575(struct e1000_hw *hw)
1261 +{
1262 +       u32 reg;
1263 +
1264 +       DEBUGFUNC("e1000_setup_fiber_serdes_link_82575");
1265 +
1266 +       /*
1267 +        * On the 82575, SerDes loopback mode persists until it is
1268 +        * explicitly turned off or a power cycle is performed.  A read to
1269 +        * the register does not indicate its status.  Therefore, we ensure
1270 +        * loopback mode is disabled during initialization.
1271 +        */
1272 +       E1000_WRITE_REG(hw, E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
1273 +
1274 +       /* Force link up, set 1gb, set both sw defined pins */
1275 +       reg = E1000_READ_REG(hw, E1000_CTRL);
1276 +       reg |= E1000_CTRL_SLU |
1277 +              E1000_CTRL_SPD_1000 |
1278 +              E1000_CTRL_FRCSPD |
1279 +              E1000_CTRL_SWDPIN0 |
1280 +              E1000_CTRL_SWDPIN1;
1281 +       E1000_WRITE_REG(hw, E1000_CTRL, reg);
1282 +
1283 +       /* Power on phy for 82576 fiber adapters */
1284 +       if (hw->mac.type == e1000_82576) {
1285 +               reg = E1000_READ_REG(hw, E1000_CTRL_EXT);
1286 +               reg &= ~E1000_CTRL_EXT_SDP7_DATA;
1287 +               E1000_WRITE_REG(hw, E1000_CTRL_EXT, reg);
1288 +       }
1289 +
1290 +       /* Set switch control to serdes energy detect */
1291 +       reg = E1000_READ_REG(hw, E1000_CONNSW);
1292 +       reg |= E1000_CONNSW_ENRGSRC;
1293 +       E1000_WRITE_REG(hw, E1000_CONNSW, reg);
1294 +
1295 +       /*
1296 +        * New SerDes mode allows for forcing speed or autonegotiating speed
1297 +        * at 1gb. Autoneg should be default set by most drivers. This is the
1298 +        * mode that will be compatible with older link partners and switches.
1299 +        * However, both are supported by the hardware and some drivers/tools.
1300 +        */
1301 +       reg = E1000_READ_REG(hw, E1000_PCS_LCTL);
1302 +
1303 +       reg &= ~(E1000_PCS_LCTL_AN_ENABLE | E1000_PCS_LCTL_FLV_LINK_UP |
1304 +               E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK);
1305 +
1306 +       if (hw->mac.autoneg) {
1307 +               /* Set PCS register for autoneg */
1308 +               reg |= E1000_PCS_LCTL_FSV_1000 |      /* Force 1000    */
1309 +                      E1000_PCS_LCTL_FDV_FULL |      /* SerDes Full duplex */
1310 +                      E1000_PCS_LCTL_AN_ENABLE |     /* Enable Autoneg */
1311 +                      E1000_PCS_LCTL_AN_RESTART;     /* Restart autoneg */
1312 +               DEBUGOUT1("Configuring Autoneg; PCS_LCTL = 0x%08X\n", reg);
1313 +       } else {
1314 +               /* Set PCS register for forced speed */
1315 +               reg |= E1000_PCS_LCTL_FLV_LINK_UP |   /* Force link up */
1316 +                      E1000_PCS_LCTL_FSV_1000 |      /* Force 1000    */
1317 +                      E1000_PCS_LCTL_FDV_FULL |      /* SerDes Full duplex */
1318 +                      E1000_PCS_LCTL_FSD |           /* Force Speed */
1319 +                      E1000_PCS_LCTL_FORCE_LINK;     /* Force Link */
1320 +               DEBUGOUT1("Configuring Forced Link; PCS_LCTL = 0x%08X\n", reg);
1321 +       }
1322 +
1323 +       if (hw->mac.type == e1000_82576) {
1324 +               reg |= E1000_PCS_LCTL_FORCE_FCTRL;
1325 +               e1000_force_mac_fc_generic(hw);
1326 +       }
1327 +
1328 +       E1000_WRITE_REG(hw, E1000_PCS_LCTL, reg);
1329 +
1330 +       return E1000_SUCCESS;
1331 +}
1332 +
1333 +/**
1334 + *  e1000_valid_led_default_82575 - Verify a valid default LED config
1335 + *  @hw: pointer to the HW structure
1336 + *  @data: pointer to the NVM (EEPROM)
1337 + *
1338 + *  Read the EEPROM for the current default LED configuration.  If the
1339 + *  LED configuration is not valid, set to a valid LED configuration.
1340 + **/
1341 +static s32 e1000_valid_led_default_82575(struct e1000_hw *hw, u16 *data)
1342 +{
1343 +       s32 ret_val;
1344 +
1345 +       DEBUGFUNC("e1000_valid_led_default_82575");
1346 +
1347 +       ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data);
1348 +       if (ret_val) {
1349 +               DEBUGOUT("NVM Read Error\n");
1350 +               goto out;
1351 +       }
1352 +
1353 +       if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) {
1354 +               switch(hw->phy.media_type) {
1355 +               case e1000_media_type_fiber:
1356 +               case e1000_media_type_internal_serdes:
1357 +                       *data = ID_LED_DEFAULT_82575_SERDES;
1358 +                       break;
1359 +               case e1000_media_type_copper:
1360 +               default:
1361 +                       *data = ID_LED_DEFAULT;
1362 +                       break;
1363 +               }
1364 +       }
1365 +out:
1366 +       return ret_val;
1367 +}
1368 +
1369 +/**
1370 + *  e1000_configure_pcs_link_82575 - Configure PCS link
1371 + *  @hw: pointer to the HW structure
1372 + *
1373 + *  Configure the physical coding sub-layer (PCS) link.  The PCS link is
1374 + *  only used on copper connections where the serialized gigabit media
1375 + *  independent interface (sgmii) is being used.  Configures the link
1376 + *  for auto-negotiation or forces speed/duplex.
1377 + **/
1378 +static s32 e1000_configure_pcs_link_82575(struct e1000_hw *hw)
1379 +{
1380 +       struct e1000_mac_info *mac = &hw->mac;
1381 +       u32 reg = 0;
1382 +
1383 +       DEBUGFUNC("e1000_configure_pcs_link_82575");
1384 +
1385 +       if (hw->phy.media_type != e1000_media_type_copper ||
1386 +           !(e1000_sgmii_active_82575(hw)))
1387 +               goto out;
1388 +
1389 +       /* For SGMII, we need to issue a PCS autoneg restart */
1390 +       reg = E1000_READ_REG(hw, E1000_PCS_LCTL);
1391 +
1392 +       /* AN time out should be disabled for SGMII mode */
1393 +       reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT);
1394 +
1395 +       if (mac->autoneg) {
1396 +               /* Make sure forced speed and force link are not set */
1397 +               reg &= ~(E1000_PCS_LCTL_FSD | E1000_PCS_LCTL_FORCE_LINK);
1398 +
1399 +               /*
1400 +                * The PHY should be setup prior to calling this function.
1401 +                * All we need to do is restart autoneg and enable autoneg.
1402 +                */
1403 +               reg |= E1000_PCS_LCTL_AN_RESTART | E1000_PCS_LCTL_AN_ENABLE;
1404 +       } else {
1405 +               /* Set PCS register for forced speed */
1406 +
1407 +               /* Turn off bits for full duplex, speed, and autoneg */
1408 +               reg &= ~(E1000_PCS_LCTL_FSV_1000 |
1409 +                        E1000_PCS_LCTL_FSV_100 |
1410 +                        E1000_PCS_LCTL_FDV_FULL |
1411 +                        E1000_PCS_LCTL_AN_ENABLE);
1412 +
1413 +               /* Check for duplex first */
1414 +               if (mac->forced_speed_duplex & E1000_ALL_FULL_DUPLEX)
1415 +                       reg |= E1000_PCS_LCTL_FDV_FULL;
1416 +
1417 +               /* Now set speed */
1418 +               if (mac->forced_speed_duplex & E1000_ALL_100_SPEED)
1419 +                       reg |= E1000_PCS_LCTL_FSV_100;
1420 +
1421 +               /* Force speed and force link */
1422 +               reg |= E1000_PCS_LCTL_FSD |
1423 +                      E1000_PCS_LCTL_FORCE_LINK |
1424 +                      E1000_PCS_LCTL_FLV_LINK_UP;
1425 +
1426 +               DEBUGOUT1("Wrote 0x%08X to PCS_LCTL to configure forced link\n",
1427 +                         reg);
1428 +       }
1429 +       E1000_WRITE_REG(hw, E1000_PCS_LCTL, reg);
1430 +
1431 +out:
1432 +       return E1000_SUCCESS;
1433 +}
1434 +
1435 +/**
1436 + *  e1000_sgmii_active_82575 - Return sgmii state
1437 + *  @hw: pointer to the HW structure
1438 + *
1439 + *  82575 silicon has a serialized gigabit media independent interface (sgmii)
1440 + *  which can be enabled for use in the embedded applications.  Simply
1441 + *  return the current state of the sgmii interface.
1442 + **/
1443 +static bool e1000_sgmii_active_82575(struct e1000_hw *hw)
1444 +{
1445 +       struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575;
1446 +
1447 +       DEBUGFUNC("e1000_sgmii_active_82575");
1448 +
1449 +       if (hw->mac.type != e1000_82575 && hw->mac.type != e1000_82576)
1450 +               return false;
1451 +
1452 +       return dev_spec->sgmii_active;
1453 +}
1454 +
1455 +/**
1456 + *  e1000_reset_init_script_82575 - Inits HW defaults after reset
1457 + *  @hw: pointer to the HW structure
1458 + *
1459 + *  Inits recommended HW defaults after a reset when there is no EEPROM
1460 + *  detected. This is only for the 82575.
1461 + **/
1462 +static s32 e1000_reset_init_script_82575(struct e1000_hw* hw)
1463 +{
1464 +       DEBUGFUNC("e1000_reset_init_script_82575");
1465 +
1466 +       if (hw->mac.type == e1000_82575) {
1467 +               DEBUGOUT("Running reset init script for 82575\n");
1468 +               /* SerDes configuration via SERDESCTRL */
1469 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_SCTL, 0x00, 0x0C);
1470 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_SCTL, 0x01, 0x78);
1471 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_SCTL, 0x1B, 0x23);
1472 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_SCTL, 0x23, 0x15);
1473 +
1474 +               /* CCM configuration via CCMCTL register */
1475 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_CCMCTL, 0x14, 0x00);
1476 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_CCMCTL, 0x10, 0x00);
1477 +
1478 +               /* PCIe lanes configuration */
1479 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_GIOCTL, 0x00, 0xEC);
1480 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_GIOCTL, 0x61, 0xDF);
1481 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_GIOCTL, 0x34, 0x05);
1482 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_GIOCTL, 0x2F, 0x81);
1483 +
1484 +               /* PCIe PLL Configuration */
1485 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_SCCTL, 0x02, 0x47);
1486 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_SCCTL, 0x14, 0x00);
1487 +               e1000_write_8bit_ctrl_reg_generic(hw, E1000_SCCTL, 0x10, 0x00);
1488 +       }
1489 +
1490 +       return E1000_SUCCESS;
1491 +}
1492 +
1493 +/**
1494 + *  e1000_read_mac_addr_82575 - Read device MAC address
1495 + *  @hw: pointer to the HW structure
1496 + **/
1497 +static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw)
1498 +{
1499 +       s32 ret_val = E1000_SUCCESS;
1500 +
1501 +       DEBUGFUNC("e1000_read_mac_addr_82575");
1502 +       if (e1000_check_alt_mac_addr_generic(hw))
1503 +               ret_val = e1000_read_mac_addr_generic(hw);
1504 +
1505 +       return ret_val;
1506 +}
1507 +
1508 +/**
1509 + * e1000_power_down_phy_copper_82575 - Remove link during PHY power down
1510 + * @hw: pointer to the HW structure
1511 + *
1512 + * In the case of a PHY power down to save power, or to turn off link during a
1513 + * driver unload, or wake on lan is not enabled, remove the link.
1514 + **/
1515 +static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw)
1516 +{
1517 +       struct e1000_phy_info *phy = &hw->phy;
1518 +       struct e1000_mac_info *mac = &hw->mac;
1519 +
1520 +       if (!(phy->ops.check_reset_block))
1521 +               return;
1522 +
1523 +       /* If the management interface is not enabled, then power down */
1524 +       if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw)))
1525 +               e1000_power_down_phy_copper(hw);
1526 +
1527 +       return;
1528 +}
1529 +
1530 +/**
1531 + *  e1000_clear_hw_cntrs_82575 - Clear device specific hardware counters
1532 + *  @hw: pointer to the HW structure
1533 + *
1534 + *  Clears the hardware counters by reading the counter registers.
1535 + **/
1536 +static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw)
1537 +{
1538 +       volatile u32 temp;
1539 +
1540 +       DEBUGFUNC("e1000_clear_hw_cntrs_82575");
1541 +
1542 +       e1000_clear_hw_cntrs_base_generic(hw);
1543 +
1544 +       temp = E1000_READ_REG(hw, E1000_PRC64);
1545 +       temp = E1000_READ_REG(hw, E1000_PRC127);
1546 +       temp = E1000_READ_REG(hw, E1000_PRC255);
1547 +       temp = E1000_READ_REG(hw, E1000_PRC511);
1548 +       temp = E1000_READ_REG(hw, E1000_PRC1023);
1549 +       temp = E1000_READ_REG(hw, E1000_PRC1522);
1550 +       temp = E1000_READ_REG(hw, E1000_PTC64);
1551 +       temp = E1000_READ_REG(hw, E1000_PTC127);
1552 +       temp = E1000_READ_REG(hw, E1000_PTC255);
1553 +       temp = E1000_READ_REG(hw, E1000_PTC511);
1554 +       temp = E1000_READ_REG(hw, E1000_PTC1023);
1555 +       temp = E1000_READ_REG(hw, E1000_PTC1522);
1556 +
1557 +       temp = E1000_READ_REG(hw, E1000_ALGNERRC);
1558 +       temp = E1000_READ_REG(hw, E1000_RXERRC);
1559 +       temp = E1000_READ_REG(hw, E1000_TNCRS);
1560 +       temp = E1000_READ_REG(hw, E1000_CEXTERR);
1561 +       temp = E1000_READ_REG(hw, E1000_TSCTC);
1562 +       temp = E1000_READ_REG(hw, E1000_TSCTFC);
1563 +
1564 +       temp = E1000_READ_REG(hw, E1000_MGTPRC);
1565 +       temp = E1000_READ_REG(hw, E1000_MGTPDC);
1566 +       temp = E1000_READ_REG(hw, E1000_MGTPTC);
1567 +
1568 +       temp = E1000_READ_REG(hw, E1000_IAC);
1569 +       temp = E1000_READ_REG(hw, E1000_ICRXOC);
1570 +
1571 +       temp = E1000_READ_REG(hw, E1000_ICRXPTC);
1572 +       temp = E1000_READ_REG(hw, E1000_ICRXATC);
1573 +       temp = E1000_READ_REG(hw, E1000_ICTXPTC);
1574 +       temp = E1000_READ_REG(hw, E1000_ICTXATC);
1575 +       temp = E1000_READ_REG(hw, E1000_ICTXQEC);
1576 +       temp = E1000_READ_REG(hw, E1000_ICTXQMTC);
1577 +       temp = E1000_READ_REG(hw, E1000_ICRXDMTC);
1578 +
1579 +       temp = E1000_READ_REG(hw, E1000_CBTMPC);
1580 +       temp = E1000_READ_REG(hw, E1000_HTDPMC);
1581 +       temp = E1000_READ_REG(hw, E1000_CBRMPC);
1582 +       temp = E1000_READ_REG(hw, E1000_RPTHC);
1583 +       temp = E1000_READ_REG(hw, E1000_HGPTC);
1584 +       temp = E1000_READ_REG(hw, E1000_HTCBDPC);
1585 +       temp = E1000_READ_REG(hw, E1000_HGORCL);
1586 +       temp = E1000_READ_REG(hw, E1000_HGORCH);
1587 +       temp = E1000_READ_REG(hw, E1000_HGOTCL);
1588 +       temp = E1000_READ_REG(hw, E1000_HGOTCH);
1589 +       temp = E1000_READ_REG(hw, E1000_LENERRS);
1590 +
1591 +       /* This register should not be read in copper configurations */
1592 +       if (hw->phy.media_type == e1000_media_type_internal_serdes)
1593 +               temp = E1000_READ_REG(hw, E1000_SCVPC);
1594 +}
1595 +/**
1596 + *  e1000_rx_fifo_flush_82575 - Clean rx fifo after RX enable
1597 + *  @hw: pointer to the HW structure
1598 + *
1599 + *  After rx enable if managability is enabled then there is likely some
1600 + *  bad data at the start of the fifo and possibly in the DMA fifo.  This
1601 + *  function clears the fifos and flushes any packets that came in as rx was
1602 + *  being enabled.
1603 + **/
1604 +void e1000_rx_fifo_flush_82575(struct e1000_hw *hw)
1605 +{
1606 +       u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled;
1607 +       int i, ms_wait;
1608 +
1609 +       DEBUGFUNC("e1000_rx_fifo_workaround_82575");
1610 +       if (hw->mac.type != e1000_82575 ||
1611 +           !(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_RCV_TCO_EN))
1612 +               return;
1613 +
1614 +       /* Disable all RX queues */
1615 +       for (i = 0; i < 4; i++) {
1616 +               rxdctl[i] = E1000_READ_REG(hw, E1000_RXDCTL(i));
1617 +               E1000_WRITE_REG(hw, E1000_RXDCTL(i),
1618 +                               rxdctl[i] & ~E1000_RXDCTL_QUEUE_ENABLE);
1619 +       }
1620 +       /* Poll all queues to verify they have shut down */
1621 +       for (ms_wait = 0; ms_wait < 10; ms_wait++) {
1622 +               msec_delay(1);
1623 +               rx_enabled = 0;
1624 +               for (i = 0; i < 4; i++)
1625 +                       rx_enabled |= E1000_READ_REG(hw, E1000_RXDCTL(i));
1626 +               if (!(rx_enabled & E1000_RXDCTL_QUEUE_ENABLE))
1627 +                       break;
1628 +       }
1629 +
1630 +       if (ms_wait == 10)
1631 +               DEBUGOUT("Queue disable timed out after 10ms\n");
1632 +
1633 +       /* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all
1634 +        * incoming packets are rejected.  Set enable and wait 2ms so that
1635 +        * any packet that was coming in as RCTL.EN was set is flushed
1636 +        */
1637 +       rfctl = E1000_READ_REG(hw, E1000_RFCTL);
1638 +       E1000_WRITE_REG(hw, E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF);
1639 +
1640 +       rlpml = E1000_READ_REG(hw, E1000_RLPML);
1641 +       E1000_WRITE_REG(hw, E1000_RLPML, 0);
1642 +
1643 +       rctl = E1000_READ_REG(hw, E1000_RCTL);
1644 +       temp_rctl = rctl & ~(E1000_RCTL_EN | E1000_RCTL_SBP);
1645 +       temp_rctl |= E1000_RCTL_LPE;
1646 +
1647 +       E1000_WRITE_REG(hw, E1000_RCTL, temp_rctl);
1648 +       E1000_WRITE_REG(hw, E1000_RCTL, temp_rctl | E1000_RCTL_EN);
1649 +       E1000_WRITE_FLUSH(hw);
1650 +       msec_delay(2);
1651 +
1652 +       /* Enable RX queues that were previously enabled and restore our
1653 +        * previous state
1654 +        */
1655 +       for (i = 0; i < 4; i++)
1656 +               E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl[i]);
1657 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl);
1658 +       E1000_WRITE_FLUSH(hw);
1659 +
1660 +       E1000_WRITE_REG(hw, E1000_RLPML, rlpml);
1661 +       E1000_WRITE_REG(hw, E1000_RFCTL, rfctl);
1662 +
1663 +       /* Flush receive errors generated by workaround */
1664 +       E1000_READ_REG(hw, E1000_ROC);
1665 +       E1000_READ_REG(hw, E1000_RNBC);
1666 +       E1000_READ_REG(hw, E1000_MPC);
1667 +}
1668 diff -Nru vanilla/drivers/net/igb/e1000_82575.h linux-i686-2.6.22/drivers/net/igb/e1000_82575.h
1669 --- vanilla/drivers/net/igb/e1000_82575.h       1969-12-31 19:00:00.000000000 -0500
1670 +++ linux-i686-2.6.22/drivers/net/igb/e1000_82575.h     2009-07-16 19:25:22.000000000 -0400
1671 @@ -0,0 +1,452 @@
1672 +/*******************************************************************************
1673 +
1674 +  Intel(R) Gigabit Ethernet Linux driver
1675 +  Copyright(c) 2007-2008 Intel Corporation.
1676 +
1677 +  This program is free software; you can redistribute it and/or modify it
1678 +  under the terms and conditions of the GNU General Public License,
1679 +  version 2, as published by the Free Software Foundation.
1680 +
1681 +  This program is distributed in the hope it will be useful, but WITHOUT
1682 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1683 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
1684 +  more details.
1685 +
1686 +  You should have received a copy of the GNU General Public License along with
1687 +  this program; if not, write to the Free Software Foundation, Inc.,
1688 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
1689 +
1690 +  The full GNU General Public License is included in this distribution in
1691 +  the file called "COPYING".
1692 +
1693 +  Contact Information:
1694 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
1695 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
1696 +
1697 +*******************************************************************************/
1698 +
1699 +#ifndef _E1000_82575_H_
1700 +#define _E1000_82575_H_
1701 +
1702 +#define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \
1703 +                                     (ID_LED_DEF1_DEF2 <<  8) | \
1704 +                                     (ID_LED_DEF1_DEF2 <<  4) | \
1705 +                                     (ID_LED_OFF1_ON2))
1706 +/*
1707 + * Receive Address Register Count
1708 + * Number of high/low register pairs in the RAR.  The RAR (Receive Address
1709 + * Registers) holds the directed and multicast addresses that we monitor.
1710 + * These entries are also used for MAC-based filtering.
1711 + */
1712 +/*
1713 + * For 82576, there are an additional set of RARs that begin at an offset
1714 + * separate from the first set of RARs.
1715 + */
1716 +#define E1000_RAR_ENTRIES_82575   16
1717 +#define E1000_RAR_ENTRIES_82576   24
1718 +
1719 +struct e1000_adv_data_desc {
1720 +       u64 buffer_addr;    /* Address of the descriptor's data buffer */
1721 +       union {
1722 +               u32 data;
1723 +               struct {
1724 +                       u32 datalen :16; /* Data buffer length */
1725 +                       u32 rsvd    :4;
1726 +                       u32 dtyp    :4;  /* Descriptor type */
1727 +                       u32 dcmd    :8;  /* Descriptor command */
1728 +               } config;
1729 +       } lower;
1730 +       union {
1731 +               u32 data;
1732 +               struct {
1733 +                       u32 status  :4;  /* Descriptor status */
1734 +                       u32 idx     :4;
1735 +                       u32 popts   :6;  /* Packet Options */
1736 +                       u32 paylen  :18; /* Payload length */
1737 +               } options;
1738 +       } upper;
1739 +};
1740 +
1741 +#define E1000_TXD_DTYP_ADV_C    0x2  /* Advanced Context Descriptor */
1742 +#define E1000_TXD_DTYP_ADV_D    0x3  /* Advanced Data Descriptor */
1743 +#define E1000_ADV_TXD_CMD_DEXT  0x20 /* Descriptor extension (0 = legacy) */
1744 +#define E1000_ADV_TUCMD_IPV4    0x2  /* IP Packet Type: 1=IPv4 */
1745 +#define E1000_ADV_TUCMD_IPV6    0x0  /* IP Packet Type: 0=IPv6 */
1746 +#define E1000_ADV_TUCMD_L4T_UDP 0x0  /* L4 Packet TYPE of UDP */
1747 +#define E1000_ADV_TUCMD_L4T_TCP 0x4  /* L4 Packet TYPE of TCP */
1748 +#define E1000_ADV_TUCMD_MKRREQ  0x10 /* Indicates markers are required */
1749 +#define E1000_ADV_DCMD_EOP      0x1  /* End of Packet */
1750 +#define E1000_ADV_DCMD_IFCS     0x2  /* Insert FCS (Ethernet CRC) */
1751 +#define E1000_ADV_DCMD_RS       0x8  /* Report Status */
1752 +#define E1000_ADV_DCMD_VLE      0x40 /* Add VLAN tag */
1753 +#define E1000_ADV_DCMD_TSE      0x80 /* TCP Seg enable */
1754 +/* Extended Device Control */
1755 +#define E1000_CTRL_EXT_NSICR    0x00000001 /* Disable Intr Clear all on read */
1756 +
1757 +struct e1000_adv_context_desc {
1758 +       union {
1759 +               u32 ip_config;
1760 +               struct {
1761 +                       u32 iplen    :9;
1762 +                       u32 maclen   :7;
1763 +                       u32 vlan_tag :16;
1764 +               } fields;
1765 +       } ip_setup;
1766 +       u32 seq_num;
1767 +       union {
1768 +               u64 l4_config;
1769 +               struct {
1770 +                       u32 mkrloc :9;
1771 +                       u32 tucmd  :11;
1772 +                       u32 dtyp   :4;
1773 +                       u32 adv    :8;
1774 +                       u32 rsvd   :4;
1775 +                       u32 idx    :4;
1776 +                       u32 l4len  :8;
1777 +                       u32 mss    :16;
1778 +               } fields;
1779 +       } l4_setup;
1780 +};
1781 +
1782 +/* SRRCTL bit definitions */
1783 +#define E1000_SRRCTL_BSIZEPKT_SHIFT                     10 /* Shift _right_ */
1784 +#define E1000_SRRCTL_BSIZEHDRSIZE_MASK                  0x00000F00
1785 +#define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT                 2  /* Shift _left_ */
1786 +#define E1000_SRRCTL_DESCTYPE_LEGACY                    0x00000000
1787 +#define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF                0x02000000
1788 +#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT                 0x04000000
1789 +#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS          0x0A000000
1790 +#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION           0x06000000
1791 +#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000
1792 +#define E1000_SRRCTL_DESCTYPE_MASK                      0x0E000000
1793 +
1794 +#define E1000_SRRCTL_BSIZEPKT_MASK      0x0000007F
1795 +#define E1000_SRRCTL_BSIZEHDR_MASK      0x00003F00
1796 +
1797 +#define E1000_TX_HEAD_WB_ENABLE   0x1
1798 +#define E1000_TX_SEQNUM_WB_ENABLE 0x2
1799 +
1800 +#define E1000_MRQC_ENABLE_RSS_4Q            0x00000002
1801 +#define E1000_MRQC_ENABLE_VMDQ              0x00000003
1802 +#define E1000_MRQC_RSS_FIELD_IPV4_UDP       0x00400000
1803 +#define E1000_MRQC_RSS_FIELD_IPV6_UDP       0x00800000
1804 +#define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX    0x01000000
1805 +
1806 +#define E1000_VMRCTL_MIRROR_PORT_SHIFT      8
1807 +#define E1000_VMRCTL_MIRROR_DSTPORT_MASK    (7 << E1000_VMRCTL_MIRROR_PORT_SHIFT)
1808 +#define E1000_VMRCTL_POOL_MIRROR_ENABLE     (1 << 0)
1809 +#define E1000_VMRCTL_UPLINK_MIRROR_ENABLE   (1 << 1)
1810 +#define E1000_VMRCTL_DOWNLINK_MIRROR_ENABLE (1 << 2)
1811 +
1812 +#define E1000_EICR_TX_QUEUE ( \
1813 +    E1000_EICR_TX_QUEUE0 |    \
1814 +    E1000_EICR_TX_QUEUE1 |    \
1815 +    E1000_EICR_TX_QUEUE2 |    \
1816 +    E1000_EICR_TX_QUEUE3)
1817 +
1818 +#define E1000_EICR_RX_QUEUE ( \
1819 +    E1000_EICR_RX_QUEUE0 |    \
1820 +    E1000_EICR_RX_QUEUE1 |    \
1821 +    E1000_EICR_RX_QUEUE2 |    \
1822 +    E1000_EICR_RX_QUEUE3)
1823 +
1824 +#define E1000_EIMS_RX_QUEUE E1000_EICR_RX_QUEUE
1825 +#define E1000_EIMS_TX_QUEUE E1000_EICR_TX_QUEUE
1826 +
1827 +#define EIMS_ENABLE_MASK ( \
1828 +    E1000_EIMS_RX_QUEUE  | \
1829 +    E1000_EIMS_TX_QUEUE  | \
1830 +    E1000_EIMS_TCP_TIMER | \
1831 +    E1000_EIMS_OTHER)
1832 +
1833 +/* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */
1834 +#define E1000_IMIR_PORT_IM_EN     0x00010000  /* TCP port enable */
1835 +#define E1000_IMIR_PORT_BP        0x00020000  /* TCP port check bypass */
1836 +#define E1000_IMIREXT_SIZE_BP     0x00001000  /* Packet size bypass */
1837 +#define E1000_IMIREXT_CTRL_URG    0x00002000  /* Check URG bit in header */
1838 +#define E1000_IMIREXT_CTRL_ACK    0x00004000  /* Check ACK bit in header */
1839 +#define E1000_IMIREXT_CTRL_PSH    0x00008000  /* Check PSH bit in header */
1840 +#define E1000_IMIREXT_CTRL_RST    0x00010000  /* Check RST bit in header */
1841 +#define E1000_IMIREXT_CTRL_SYN    0x00020000  /* Check SYN bit in header */
1842 +#define E1000_IMIREXT_CTRL_FIN    0x00040000  /* Check FIN bit in header */
1843 +#define E1000_IMIREXT_CTRL_BP     0x00080000  /* Bypass check of ctrl bits */
1844 +
1845 +/* Receive Descriptor - Advanced */
1846 +union e1000_adv_rx_desc {
1847 +       struct {
1848 +               u64 pkt_addr;             /* Packet buffer address */
1849 +               u64 hdr_addr;             /* Header buffer address */
1850 +       } read;
1851 +       struct {
1852 +               struct {
1853 +                       union {
1854 +                               u32 data;
1855 +                               struct {
1856 +                                       u16 pkt_info; /* RSS type, Packet type */
1857 +                                       u16 hdr_info; /* Split Header,
1858 +                                                      * header buffer length */
1859 +                               } hs_rss;
1860 +                       } lo_dword;
1861 +                       union {
1862 +                               u32 rss;          /* RSS Hash */
1863 +                               struct {
1864 +                                       u16 ip_id;    /* IP id */
1865 +                                       u16 csum;     /* Packet Checksum */
1866 +                               } csum_ip;
1867 +                       } hi_dword;
1868 +               } lower;
1869 +               struct {
1870 +                       u32 status_error;     /* ext status/error */
1871 +                       u16 length;           /* Packet length */
1872 +                       u16 vlan;             /* VLAN tag */
1873 +               } upper;
1874 +       } wb;  /* writeback */
1875 +};
1876 +
1877 +#define E1000_RXDADV_RSSTYPE_MASK        0x0000F000
1878 +#define E1000_RXDADV_RSSTYPE_SHIFT       12
1879 +#define E1000_RXDADV_HDRBUFLEN_MASK      0x7FE0
1880 +#define E1000_RXDADV_HDRBUFLEN_SHIFT     5
1881 +#define E1000_RXDADV_SPLITHEADER_EN      0x00001000
1882 +#define E1000_RXDADV_SPH                 0x8000
1883 +#define E1000_RXDADV_ERR_HBO             0x00800000
1884 +
1885 +/* RSS Hash results */
1886 +#define E1000_RXDADV_RSSTYPE_NONE        0x00000000
1887 +#define E1000_RXDADV_RSSTYPE_IPV4_TCP    0x00000001
1888 +#define E1000_RXDADV_RSSTYPE_IPV4        0x00000002
1889 +#define E1000_RXDADV_RSSTYPE_IPV6_TCP    0x00000003
1890 +#define E1000_RXDADV_RSSTYPE_IPV6_EX     0x00000004
1891 +#define E1000_RXDADV_RSSTYPE_IPV6        0x00000005
1892 +#define E1000_RXDADV_RSSTYPE_IPV6_TCP_EX 0x00000006
1893 +#define E1000_RXDADV_RSSTYPE_IPV4_UDP    0x00000007
1894 +#define E1000_RXDADV_RSSTYPE_IPV6_UDP    0x00000008
1895 +#define E1000_RXDADV_RSSTYPE_IPV6_UDP_EX 0x00000009
1896 +
1897 +/* RSS Packet Types as indicated in the receive descriptor */
1898 +#define E1000_RXDADV_PKTTYPE_NONE        0x00000000
1899 +#define E1000_RXDADV_PKTTYPE_IPV4        0x00000010 /* IPV4 hdr present */
1900 +#define E1000_RXDADV_PKTTYPE_IPV4_EX     0x00000020 /* IPV4 hdr + extensions */
1901 +#define E1000_RXDADV_PKTTYPE_IPV6        0x00000040 /* IPV6 hdr present */
1902 +#define E1000_RXDADV_PKTTYPE_IPV6_EX     0x00000080 /* IPV6 hdr + extensions */
1903 +#define E1000_RXDADV_PKTTYPE_TCP         0x00000100 /* TCP hdr present */
1904 +#define E1000_RXDADV_PKTTYPE_UDP         0x00000200 /* UDP hdr present */
1905 +#define E1000_RXDADV_PKTTYPE_SCTP        0x00000400 /* SCTP hdr present */
1906 +#define E1000_RXDADV_PKTTYPE_NFS         0x00000800 /* NFS hdr present */
1907 +
1908 +#define E1000_RXDADV_PKTTYPE_IPSEC_ESP   0x00001000 /* IPSec ESP */
1909 +#define E1000_RXDADV_PKTTYPE_IPSEC_AH    0x00002000 /* IPSec AH */
1910 +#define E1000_RXDADV_PKTTYPE_LINKSEC     0x00004000 /* LinkSec Encap */
1911 +#define E1000_RXDADV_PKTTYPE_ETQF        0x00008000 /* PKTTYPE is ETQF index */
1912 +#define E1000_RXDADV_PKTTYPE_ETQF_MASK   0x00000070 /* ETQF has 8 indices */
1913 +#define E1000_RXDADV_PKTTYPE_ETQF_SHIFT  4          /* Right-shift 4 bits */
1914 +
1915 +/* LinkSec results */
1916 +/* Security Processing bit Indication */
1917 +#define E1000_RXDADV_LNKSEC_STATUS_SECP         0x00020000
1918 +#define E1000_RXDADV_LNKSEC_ERROR_BIT_MASK      0x18000000
1919 +#define E1000_RXDADV_LNKSEC_ERROR_NO_SA_MATCH   0x08000000
1920 +#define E1000_RXDADV_LNKSEC_ERROR_REPLAY_ERROR  0x10000000
1921 +#define E1000_RXDADV_LNKSEC_ERROR_BAD_SIG       0x18000000
1922 +
1923 +#define E1000_RXDADV_IPSEC_STATUS_SECP          0x00020000
1924 +#define E1000_RXDADV_IPSEC_ERROR_BIT_MASK       0x18000000
1925 +#define E1000_RXDADV_IPSEC_ERROR_INVALID_PROTOCOL       0x08000000
1926 +#define E1000_RXDADV_IPSEC_ERROR_INVALID_LENGTH         0x10000000
1927 +#define E1000_RXDADV_IPSEC_ERROR_AUTHENTICATION_FAILED  0x18000000
1928 +
1929 +/* Transmit Descriptor - Advanced */
1930 +union e1000_adv_tx_desc {
1931 +       struct {
1932 +               u64 buffer_addr;    /* Address of descriptor's data buf */
1933 +               u32 cmd_type_len;
1934 +               u32 olinfo_status;
1935 +       } read;
1936 +       struct {
1937 +               u64 rsvd;       /* Reserved */
1938 +               u32 nxtseq_seed;
1939 +               u32 status;
1940 +       } wb;
1941 +};
1942 +
1943 +/* Adv Transmit Descriptor Config Masks */
1944 +#define E1000_ADVTXD_DTYP_CTXT    0x00200000 /* Advanced Context Descriptor */
1945 +#define E1000_ADVTXD_DTYP_DATA    0x00300000 /* Advanced Data Descriptor */
1946 +#define E1000_ADVTXD_DCMD_EOP     0x01000000 /* End of Packet */
1947 +#define E1000_ADVTXD_DCMD_IFCS    0x02000000 /* Insert FCS (Ethernet CRC) */
1948 +#define E1000_ADVTXD_DCMD_RS      0x08000000 /* Report Status */
1949 +#define E1000_ADVTXD_DCMD_DDTYP_ISCSI  0x10000000 /* DDP hdr type or iSCSI */
1950 +#define E1000_ADVTXD_DCMD_DEXT    0x20000000 /* Descriptor extension (1=Adv) */
1951 +#define E1000_ADVTXD_DCMD_VLE     0x40000000 /* VLAN pkt enable */
1952 +#define E1000_ADVTXD_DCMD_TSE     0x80000000 /* TCP Seg enable */
1953 +#define E1000_ADVTXD_MAC_LINKSEC  0x00040000 /* Apply LinkSec on packet */
1954 +#define E1000_ADVTXD_MAC_TSTAMP   0x00080000 /* IEEE1588 Timestamp packet */
1955 +#define E1000_ADVTXD_STAT_SN_CRC  0x00000002 /* NXTSEQ/SEED present in WB */
1956 +#define E1000_ADVTXD_IDX_SHIFT    4  /* Adv desc Index shift */
1957 +#define E1000_ADVTXD_POPTS_ISCO_1ST  0x00000000 /* 1st TSO of iSCSI PDU */
1958 +#define E1000_ADVTXD_POPTS_ISCO_MDL  0x00000800 /* Middle TSO of iSCSI PDU */
1959 +#define E1000_ADVTXD_POPTS_ISCO_LAST 0x00001000 /* Last TSO of iSCSI PDU */
1960 +#define E1000_ADVTXD_POPTS_ISCO_FULL 0x00001800 /* 1st&Last TSO-full iSCSI PDU*/
1961 +#define E1000_ADVTXD_POPTS_IPSEC     0x00000400 /* IPSec offload request */
1962 +#define E1000_ADVTXD_PAYLEN_SHIFT    14 /* Adv desc PAYLEN shift */
1963 +
1964 +/* Context descriptors */
1965 +struct e1000_adv_tx_context_desc {
1966 +       u32 vlan_macip_lens;
1967 +       u32 seqnum_seed;
1968 +       u32 type_tucmd_mlhl;
1969 +       u32 mss_l4len_idx;
1970 +};
1971 +
1972 +#define E1000_ADVTXD_MACLEN_SHIFT    9  /* Adv ctxt desc mac len shift */
1973 +#define E1000_ADVTXD_VLAN_SHIFT     16  /* Adv ctxt vlan tag shift */
1974 +#define E1000_ADVTXD_TUCMD_IPV4    0x00000400  /* IP Packet Type: 1=IPv4 */
1975 +#define E1000_ADVTXD_TUCMD_IPV6    0x00000000  /* IP Packet Type: 0=IPv6 */
1976 +#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000  /* L4 Packet TYPE of UDP */
1977 +#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800  /* L4 Packet TYPE of TCP */
1978 +#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP    0x00002000 /* IPSec Type ESP */
1979 +/* IPSec Encrypt Enable for ESP */
1980 +#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN  0x00004000
1981 +#define E1000_ADVTXD_TUCMD_MKRREQ  0x00002000 /* Req requires Markers and CRC */
1982 +#define E1000_ADVTXD_L4LEN_SHIFT     8  /* Adv ctxt L4LEN shift */
1983 +#define E1000_ADVTXD_MSS_SHIFT      16  /* Adv ctxt MSS shift */
1984 +/* Adv ctxt IPSec SA IDX mask */
1985 +#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK     0x000000FF
1986 +/* Adv ctxt IPSec ESP len mask */
1987 +#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK      0x000000FF
1988 +
1989 +/* Additional Transmit Descriptor Control definitions */
1990 +#define E1000_TXDCTL_QUEUE_ENABLE  0x02000000 /* Enable specific Tx Queue */
1991 +#define E1000_TXDCTL_SWFLSH        0x04000000 /* Tx Desc. write-back flushing */
1992 +/* Tx Queue Arbitration Priority 0=low, 1=high */
1993 +#define E1000_TXDCTL_PRIORITY      0x08000000
1994 +
1995 +/* Additional Receive Descriptor Control definitions */
1996 +#define E1000_RXDCTL_QUEUE_ENABLE  0x02000000 /* Enable specific Rx Queue */
1997 +#define E1000_RXDCTL_SWFLSH        0x04000000 /* Rx Desc. write-back flushing */
1998 +
1999 +/* Direct Cache Access (DCA) definitions */
2000 +#define E1000_DCA_CTRL_DCA_ENABLE  0x00000000 /* DCA Enable */
2001 +#define E1000_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */
2002 +
2003 +#define E1000_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */
2004 +#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */
2005 +
2006 +#define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */
2007 +#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */
2008 +#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */
2009 +#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */
2010 +
2011 +#define E1000_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */
2012 +#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */
2013 +#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */
2014 +
2015 +/* Additional DCA related definitions, note change in position of CPUID */
2016 +#define E1000_DCA_TXCTRL_CPUID_MASK_82576 0xFF000000 /* Tx CPUID Mask */
2017 +#define E1000_DCA_RXCTRL_CPUID_MASK_82576 0xFF000000 /* Rx CPUID Mask */
2018 +#define E1000_DCA_TXCTRL_CPUID_SHIFT 24 /* Tx CPUID now in the last byte */
2019 +#define E1000_DCA_RXCTRL_CPUID_SHIFT 24 /* Rx CPUID now in the last byte */
2020 +
2021 +/* Additional interrupt register bit definitions */
2022 +#define E1000_ICR_LSECPNS       0x00000020          /* PN threshold - server */
2023 +#define E1000_IMS_LSECPNS       E1000_ICR_LSECPNS   /* PN threshold - server */
2024 +#define E1000_ICS_LSECPNS       E1000_ICR_LSECPNS   /* PN threshold - server */
2025 +
2026 +/* ETQF register bit definitions */
2027 +#define E1000_ETQF_FILTER_ENABLE   (1 << 26)
2028 +#define E1000_ETQF_IMM_INT         (1 << 29)
2029 +/*
2030 + * ETQF filter list: one static filter per filter consumer. This is
2031 + *                   to avoid filter collisions later. Add new filters
2032 + *                   here!!
2033 + *
2034 + * Current filters:
2035 + *    EAPOL 802.1x (0x888e): Filter 0
2036 + */
2037 +#define E1000_ETQF_FILTER_EAPOL          0
2038 +
2039 +#define E1000_NVM_APME_82575          0x0400
2040 +#define MAX_NUM_VFS                   8
2041 +
2042 +#define E1000_DTXSWC_MAC_SPOOF_MASK   0x000000FF /* Per VF MAC spoof control */
2043 +#define E1000_DTXSWC_VLAN_SPOOF_MASK  0x0000FF00 /* Per VF VLAN spoof control */
2044 +#define E1000_DTXSWC_LLE_MASK         0x00FF0000 /* Per VF Local LB enables */
2045 +#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31)  /* global VF LB enable */
2046 +
2047 +/* Easy defines for setting default pool, would normally be left a zero */
2048 +#define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7
2049 +#define E1000_VT_CTL_DEFAULT_POOL_MASK  (0x7 << E1000_VT_CTL_DEFAULT_POOL_SHIFT)
2050 +
2051 +/* Other useful VMD_CTL register defines */
2052 +#define E1000_VT_CTL_IGNORE_MAC         (1 << 28)
2053 +#define E1000_VT_CTL_DISABLE_DEF_POOL   (1 << 29)
2054 +#define E1000_VT_CTL_VM_REPL_EN         (1 << 30)
2055 +
2056 +/* Per VM Offload register setup */
2057 +#define E1000_VMOLR_LPE        0x00010000 /* Accept Long packet */
2058 +#define E1000_VMOLR_AUPE       0x01000000 /* Accept untagged packets */
2059 +#define E1000_VMOLR_BAM        0x08000000 /* Accept Broadcast packets */
2060 +#define E1000_VMOLR_MPME       0x10000000 /* Multicast promiscuous mode */
2061 +#define E1000_VMOLR_STRVLAN    0x40000000 /* Vlan stripping enable */
2062 +
2063 +#define E1000_V2PMAILBOX_REQ   0x00000001 /* Request for PF Ready bit */
2064 +#define E1000_V2PMAILBOX_ACK   0x00000002 /* Ack PF message received */
2065 +#define E1000_V2PMAILBOX_VFU   0x00000004 /* VF owns the mailbox buffer */
2066 +#define E1000_V2PMAILBOX_PFU   0x00000008 /* PF owns the mailbox buffer */
2067 +#define E1000_V2PMAILBOX_PFSTS 0x00000010 /* PF wrote a message in the MB */
2068 +#define E1000_V2PMAILBOX_PFACK 0x00000020 /* PF ack the previous VF msg */
2069 +#define E1000_V2PMAILBOX_RSTI  0x00000040 /* PF has reset indication */
2070 +
2071 +#define E1000_P2VMAILBOX_STS   0x00000001 /* Initiate message send to VF */
2072 +#define E1000_P2VMAILBOX_ACK   0x00000002 /* Ack message recv'd from VF */
2073 +#define E1000_P2VMAILBOX_VFU   0x00000004 /* VF owns the mailbox buffer */
2074 +#define E1000_P2VMAILBOX_PFU   0x00000008 /* PF owns the mailbox buffer */
2075 +#define E1000_P2VMAILBOX_RVFU  0x00000010 /* Reset VFU - used when VF stuck */
2076 +
2077 +#define E1000_VFMAILBOX_SIZE   16 /* 16 32 bit words - 64 bytes */
2078 +
2079 +/* If it's a E1000_VF_* msg then it originates in the VF and is sent to the
2080 + * PF.  The reverse is true if it is E1000_PF_*.
2081 + * Message ACK's are the value or'd with 0xF0000000
2082 + */
2083 +#define E1000_VT_MSGTYPE_ACK      0xF0000000  /* Messages below or'd with
2084 +                                               * this are the ACK */
2085 +#define E1000_VT_MSGTYPE_NACK     0xFF000000  /* Messages below or'd with
2086 +                                               * this are the NACK */
2087 +#define E1000_VT_MSGINFO_SHIFT    16
2088 +/* bits 23:16 are used for exra info for certain messages */
2089 +#define E1000_VT_MSGINFO_MASK     (0xFF << E1000_VT_MSGINFO_SHIFT)
2090 +
2091 +#define E1000_VF_MSGTYPE_REQ_MAC  1 /* VF needs to know its MAC */
2092 +#define E1000_VF_MSGTYPE_VFLR     2 /* VF notifies VFLR to PF */
2093 +#define E1000_VF_SET_MULTICAST    3 /* VF requests PF to set MC addr */
2094 +#define E1000_VF_SET_VLAN         4 /* VF requests PF to set VLAN */
2095 +
2096 +/* Add 100h to all PF msgs, leaves room for up to 255 discrete message types
2097 + * from VF to PF - way more than we'll ever need */
2098 +#define E1000_PF_MSGTYPE_RESET    (1 + 0x100) /* PF notifies global reset
2099 +                                               * imminent to VF */
2100 +#define E1000_PF_MSGTYPE_LSC      (2 + 0x100) /* PF notifies VF of LSC... VF
2101 +                                               * will see extra msg info for
2102 +                                               * status */
2103 +
2104 +#define E1000_PF_MSG_LSCDOWN      (1 << E1000_VT_MSGINFO_SHIFT)
2105 +#define E1000_PF_MSG_LSCUP        (2 << E1000_VT_MSGINFO_SHIFT)
2106 +
2107 +s32  e1000_send_mail_to_pf_vf(struct e1000_hw *hw, u32 *msg,
2108 +                              s16 size);
2109 +s32  e1000_receive_mail_from_pf_vf(struct e1000_hw *hw,
2110 +                                   u32 *msg, s16 size);
2111 +s32  e1000_send_mail_to_vf(struct e1000_hw *hw, u32 *msg,
2112 +                           u32 vf_number, s16 size);
2113 +s32  e1000_receive_mail_from_vf(struct e1000_hw *hw, u32 *msg,
2114 +                                u32 vf_number, s16 size);
2115 +void e1000_vmdq_loopback_enable_vf(struct e1000_hw *hw);
2116 +void e1000_vmdq_loopback_disable_vf(struct e1000_hw *hw);
2117 +void e1000_vmdq_replication_enable_vf(struct e1000_hw *hw, u32 enables);
2118 +void e1000_vmdq_replication_disable_vf(struct e1000_hw *hw);
2119 +bool e1000_check_for_pf_ack_vf(struct e1000_hw *hw);
2120 +bool e1000_check_for_pf_mail_vf(struct e1000_hw *hw, u32*);
2121 +
2122 +
2123 +#endif
2124 Binary files vanilla/drivers/net/igb/e1000_82575.o and linux-i686-2.6.22/drivers/net/igb/e1000_82575.o differ
2125 diff -Nru vanilla/drivers/net/igb/.e1000_82575.o.cmd linux-i686-2.6.22/drivers/net/igb/.e1000_82575.o.cmd
2126 --- vanilla/drivers/net/igb/.e1000_82575.o.cmd  1969-12-31 19:00:00.000000000 -0500
2127 +++ linux-i686-2.6.22/drivers/net/igb/.e1000_82575.o.cmd        2009-07-16 19:52:19.000000000 -0400
2128 @@ -0,0 +1,549 @@
2129 +cmd_drivers/net/igb/e1000_82575.o := gcc -m32 -Wp,-MD,drivers/net/igb/.e1000_82575.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(e1000_82575)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_e1000_82575.o drivers/net/igb/e1000_82575.c
2130 +
2131 +deps_drivers/net/igb/e1000_82575.o := \
2132 +  drivers/net/igb/e1000_82575.c \
2133 +  drivers/net/igb/e1000_api.h \
2134 +  drivers/net/igb/e1000_hw.h \
2135 +  drivers/net/igb/e1000_osdep.h \
2136 +  include/linux/pci.h \
2137 +    $(wildcard include/config/pci/msi.h) \
2138 +    $(wildcard include/config/pci.h) \
2139 +    $(wildcard include/config/ht/irq.h) \
2140 +    $(wildcard include/config/pci/domains.h) \
2141 +  include/linux/pci_regs.h \
2142 +  include/linux/mod_devicetable.h \
2143 +  include/linux/types.h \
2144 +    $(wildcard include/config/uid16.h) \
2145 +    $(wildcard include/config/lbd.h) \
2146 +    $(wildcard include/config/lsf.h) \
2147 +    $(wildcard include/config/resources/64bit.h) \
2148 +  include/linux/posix_types.h \
2149 +  include/linux/stddef.h \
2150 +  include/linux/compiler.h \
2151 +    $(wildcard include/config/enable/must/check.h) \
2152 +  include/linux/compiler-gcc4.h \
2153 +    $(wildcard include/config/forced/inlining.h) \
2154 +  include/linux/compiler-gcc.h \
2155 +  include/asm/posix_types.h \
2156 +  include/asm/types.h \
2157 +    $(wildcard include/config/highmem64g.h) \
2158 +  include/linux/ioport.h \
2159 +  include/linux/list.h \
2160 +    $(wildcard include/config/debug/list.h) \
2161 +  include/linux/poison.h \
2162 +  include/linux/prefetch.h \
2163 +  include/asm/processor.h \
2164 +    $(wildcard include/config/smp.h) \
2165 +    $(wildcard include/config/x86/ht.h) \
2166 +    $(wildcard include/config/paravirt.h) \
2167 +    $(wildcard include/config/mk8.h) \
2168 +    $(wildcard include/config/mk7.h) \
2169 +  include/asm/vm86.h \
2170 +    $(wildcard include/config/vm86.h) \
2171 +  include/asm/ptrace.h \
2172 +  include/asm/ptrace-abi.h \
2173 +  include/asm/segment.h \
2174 +  include/asm/math_emu.h \
2175 +  include/asm/sigcontext.h \
2176 +  include/asm/page.h \
2177 +    $(wildcard include/config/x86/use/3dnow.h) \
2178 +    $(wildcard include/config/x86/pae.h) \
2179 +    $(wildcard include/config/hugetlb/page.h) \
2180 +    $(wildcard include/config/highmem4g.h) \
2181 +    $(wildcard include/config/page/offset.h) \
2182 +    $(wildcard include/config/flatmem.h) \
2183 +  include/asm-generic/pgtable-nopmd.h \
2184 +  include/asm-generic/pgtable-nopud.h \
2185 +  include/asm-generic/memory_model.h \
2186 +    $(wildcard include/config/discontigmem.h) \
2187 +    $(wildcard include/config/sparsemem.h) \
2188 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
2189 +  include/asm-generic/page.h \
2190 +  include/asm/cpufeature.h \
2191 +  include/linux/bitops.h \
2192 +  include/asm/bitops.h \
2193 +  include/asm/alternative.h \
2194 +  include/asm-generic/bitops/sched.h \
2195 +  include/asm-generic/bitops/hweight.h \
2196 +  include/asm-generic/bitops/fls64.h \
2197 +  include/asm-generic/bitops/ext2-non-atomic.h \
2198 +  include/asm-generic/bitops/le.h \
2199 +  include/asm/byteorder.h \
2200 +    $(wildcard include/config/x86/bswap.h) \
2201 +  include/linux/byteorder/little_endian.h \
2202 +  include/linux/byteorder/swab.h \
2203 +  include/linux/byteorder/generic.h \
2204 +  include/asm-generic/bitops/minix.h \
2205 +  include/asm/required-features.h \
2206 +    $(wildcard include/config/x86/minimum/cpu.h) \
2207 +    $(wildcard include/config/x86/cmov.h) \
2208 +    $(wildcard include/config/x86/cmpxchg64.h) \
2209 +  include/asm/msr.h \
2210 +  include/asm/msr-index.h \
2211 +  include/asm/errno.h \
2212 +  include/asm-generic/errno.h \
2213 +  include/asm-generic/errno-base.h \
2214 +  include/linux/errno.h \
2215 +  include/asm/system.h \
2216 +    $(wildcard include/config/x86/oostore.h) \
2217 +  include/linux/kernel.h \
2218 +    $(wildcard include/config/preempt/voluntary.h) \
2219 +    $(wildcard include/config/debug/spinlock/sleep.h) \
2220 +    $(wildcard include/config/printk.h) \
2221 +    $(wildcard include/config/numa.h) \
2222 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
2223 +  include/linux/linkage.h \
2224 +  include/asm/linkage.h \
2225 +    $(wildcard include/config/x86/alignment/16.h) \
2226 +  include/linux/log2.h \
2227 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
2228 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
2229 +  include/asm/bug.h \
2230 +    $(wildcard include/config/bug.h) \
2231 +    $(wildcard include/config/debug/bugverbose.h) \
2232 +  include/asm-generic/bug.h \
2233 +    $(wildcard include/config/generic/bug.h) \
2234 +  include/asm/cmpxchg.h \
2235 +    $(wildcard include/config/x86/cmpxchg.h) \
2236 +  include/linux/irqflags.h \
2237 +    $(wildcard include/config/trace/irqflags.h) \
2238 +    $(wildcard include/config/trace/irqflags/support.h) \
2239 +    $(wildcard include/config/x86.h) \
2240 +  include/asm/irqflags.h \
2241 +  include/asm/processor-flags.h \
2242 +  include/linux/cache.h \
2243 +  include/asm/cache.h \
2244 +    $(wildcard include/config/x86/l1/cache/shift.h) \
2245 +  include/linux/threads.h \
2246 +    $(wildcard include/config/nr/cpus.h) \
2247 +    $(wildcard include/config/base/small.h) \
2248 +  include/asm/percpu.h \
2249 +  include/linux/cpumask.h \
2250 +    $(wildcard include/config/hotplug/cpu.h) \
2251 +  include/linux/bitmap.h \
2252 +  include/linux/string.h \
2253 +  include/asm/string.h \
2254 +  include/linux/init.h \
2255 +    $(wildcard include/config/modules.h) \
2256 +    $(wildcard include/config/hotplug.h) \
2257 +    $(wildcard include/config/memory/hotplug.h) \
2258 +    $(wildcard include/config/acpi/hotplug/memory.h) \
2259 +  include/asm/atomic.h \
2260 +    $(wildcard include/config/m386.h) \
2261 +  include/asm-generic/atomic.h \
2262 +  include/linux/device.h \
2263 +    $(wildcard include/config/debug/devres.h) \
2264 +  include/linux/kobject.h \
2265 +  include/linux/sysfs.h \
2266 +    $(wildcard include/config/sysfs.h) \
2267 +  include/linux/spinlock.h \
2268 +    $(wildcard include/config/debug/spinlock.h) \
2269 +    $(wildcard include/config/preempt.h) \
2270 +    $(wildcard include/config/debug/lock/alloc.h) \
2271 +  include/linux/preempt.h \
2272 +    $(wildcard include/config/debug/preempt.h) \
2273 +  include/linux/thread_info.h \
2274 +  include/asm/thread_info.h \
2275 +    $(wildcard include/config/4kstacks.h) \
2276 +    $(wildcard include/config/debug/stack/usage.h) \
2277 +  include/linux/stringify.h \
2278 +  include/linux/bottom_half.h \
2279 +  include/linux/spinlock_types.h \
2280 +  include/linux/lockdep.h \
2281 +    $(wildcard include/config/lockdep.h) \
2282 +    $(wildcard include/config/generic/hardirqs.h) \
2283 +    $(wildcard include/config/prove/locking.h) \
2284 +  include/asm/spinlock_types.h \
2285 +  include/asm/spinlock.h \
2286 +    $(wildcard include/config/x86/ppro/fence.h) \
2287 +  include/asm/rwlock.h \
2288 +  include/linux/spinlock_api_smp.h \
2289 +  include/linux/kref.h \
2290 +  include/linux/wait.h \
2291 +  include/asm/current.h \
2292 +  include/linux/klist.h \
2293 +  include/linux/completion.h \
2294 +  include/linux/module.h \
2295 +    $(wildcard include/config/modversions.h) \
2296 +    $(wildcard include/config/unused/symbols.h) \
2297 +    $(wildcard include/config/module/unload.h) \
2298 +    $(wildcard include/config/kallsyms.h) \
2299 +  include/linux/stat.h \
2300 +  include/asm/stat.h \
2301 +  include/linux/time.h \
2302 +  include/linux/seqlock.h \
2303 +  include/linux/vs_time.h \
2304 +    $(wildcard include/config/vserver/vtime.h) \
2305 +  include/linux/kmod.h \
2306 +    $(wildcard include/config/kmod.h) \
2307 +  include/linux/elf.h \
2308 +  include/linux/auxvec.h \
2309 +  include/asm/auxvec.h \
2310 +  include/linux/elf-em.h \
2311 +  include/asm/elf.h \
2312 +  include/asm/user.h \
2313 +  include/asm/desc.h \
2314 +  include/asm/ldt.h \
2315 +  include/linux/smp.h \
2316 +  include/asm/smp.h \
2317 +    $(wildcard include/config/x86/local/apic.h) \
2318 +    $(wildcard include/config/x86/io/apic.h) \
2319 +  include/asm/mpspec.h \
2320 +    $(wildcard include/config/acpi.h) \
2321 +  include/asm/mpspec_def.h \
2322 +  include/asm-i386/mach-generic/mach_mpspec.h \
2323 +  include/asm/apic.h \
2324 +    $(wildcard include/config/x86/good/apic.h) \
2325 +  include/linux/pm.h \
2326 +    $(wildcard include/config/pm.h) \
2327 +  include/linux/delay.h \
2328 +  include/asm/delay.h \
2329 +  include/asm/fixmap.h \
2330 +    $(wildcard include/config/highmem.h) \
2331 +    $(wildcard include/config/x86/visws/apic.h) \
2332 +    $(wildcard include/config/x86/f00f/bug.h) \
2333 +    $(wildcard include/config/x86/cyclone/timer.h) \
2334 +    $(wildcard include/config/pci/mmconfig.h) \
2335 +  include/asm/acpi.h \
2336 +    $(wildcard include/config/acpi/sleep.h) \
2337 +  include/acpi/pdc_intel.h \
2338 +  include/asm/apicdef.h \
2339 +  include/asm/kmap_types.h \
2340 +    $(wildcard include/config/debug/highmem.h) \
2341 +  include/asm/io_apic.h \
2342 +  include/asm-i386/mach-generic/mach_apicdef.h \
2343 +  include/asm/genapic.h \
2344 +  include/linux/percpu.h \
2345 +  include/linux/slab.h \
2346 +    $(wildcard include/config/slab/debug.h) \
2347 +    $(wildcard include/config/slab.h) \
2348 +    $(wildcard include/config/slub.h) \
2349 +    $(wildcard include/config/debug/slab.h) \
2350 +  include/linux/gfp.h \
2351 +    $(wildcard include/config/zone/dma.h) \
2352 +    $(wildcard include/config/zone/dma32.h) \
2353 +  include/linux/mmzone.h \
2354 +    $(wildcard include/config/force/max/zoneorder.h) \
2355 +    $(wildcard include/config/arch/populates/node/map.h) \
2356 +    $(wildcard include/config/flat/node/mem/map.h) \
2357 +    $(wildcard include/config/have/memory/present.h) \
2358 +    $(wildcard include/config/need/node/memmap/size.h) \
2359 +    $(wildcard include/config/need/multiple/nodes.h) \
2360 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
2361 +    $(wildcard include/config/sparsemem/extreme.h) \
2362 +    $(wildcard include/config/nodes/span/other/nodes.h) \
2363 +    $(wildcard include/config/holes/in/zone.h) \
2364 +  include/linux/numa.h \
2365 +    $(wildcard include/config/nodes/shift.h) \
2366 +  include/linux/nodemask.h \
2367 +  include/linux/memory_hotplug.h \
2368 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
2369 +  include/linux/notifier.h \
2370 +  include/linux/mutex.h \
2371 +    $(wildcard include/config/debug/mutexes.h) \
2372 +    $(wildcard include/config/chopstix.h) \
2373 +  include/linux/rwsem.h \
2374 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
2375 +  include/asm/rwsem.h \
2376 +  include/linux/srcu.h \
2377 +  include/linux/topology.h \
2378 +    $(wildcard include/config/sched/smt.h) \
2379 +    $(wildcard include/config/sched/mc.h) \
2380 +  include/asm/topology.h \
2381 +  include/asm-generic/topology.h \
2382 +  include/linux/slab_def.h \
2383 +  include/linux/kmalloc_sizes.h \
2384 +  include/asm/mmu.h \
2385 +  include/asm/semaphore.h \
2386 +  include/linux/moduleparam.h \
2387 +  include/asm/local.h \
2388 +  include/asm/module.h \
2389 +    $(wildcard include/config/m486.h) \
2390 +    $(wildcard include/config/m586.h) \
2391 +    $(wildcard include/config/m586tsc.h) \
2392 +    $(wildcard include/config/m586mmx.h) \
2393 +    $(wildcard include/config/mcore2.h) \
2394 +    $(wildcard include/config/m686.h) \
2395 +    $(wildcard include/config/mpentiumii.h) \
2396 +    $(wildcard include/config/mpentiumiii.h) \
2397 +    $(wildcard include/config/mpentiumm.h) \
2398 +    $(wildcard include/config/mpentium4.h) \
2399 +    $(wildcard include/config/mk6.h) \
2400 +    $(wildcard include/config/x86/elan.h) \
2401 +    $(wildcard include/config/mcrusoe.h) \
2402 +    $(wildcard include/config/mefficeon.h) \
2403 +    $(wildcard include/config/mwinchipc6.h) \
2404 +    $(wildcard include/config/mwinchip2.h) \
2405 +    $(wildcard include/config/mwinchip3d.h) \
2406 +    $(wildcard include/config/mcyrixiii.h) \
2407 +    $(wildcard include/config/mviac3/2.h) \
2408 +    $(wildcard include/config/mviac7.h) \
2409 +    $(wildcard include/config/mgeodegx1.h) \
2410 +    $(wildcard include/config/mgeode/lx.h) \
2411 +  include/asm/device.h \
2412 +  include/linux/pci_ids.h \
2413 +  include/linux/dmapool.h \
2414 +  include/asm/io.h \
2415 +    $(wildcard include/config/x86/numaq.h) \
2416 +  include/asm-generic/iomap.h \
2417 +  include/linux/vmalloc.h \
2418 +  include/asm/scatterlist.h \
2419 +  include/asm/pci.h \
2420 +  include/linux/mm.h \
2421 +    $(wildcard include/config/sysctl.h) \
2422 +    $(wildcard include/config/mmu.h) \
2423 +    $(wildcard include/config/stack/growsup.h) \
2424 +    $(wildcard include/config/debug/vm.h) \
2425 +    $(wildcard include/config/shmem.h) \
2426 +    $(wildcard include/config/split/ptlock/cpus.h) \
2427 +    $(wildcard include/config/ia64.h) \
2428 +    $(wildcard include/config/proc/fs.h) \
2429 +    $(wildcard include/config/debug/pagealloc.h) \
2430 +  include/linux/capability.h \
2431 +  include/linux/rbtree.h \
2432 +  include/linux/prio_tree.h \
2433 +  include/linux/fs.h \
2434 +    $(wildcard include/config/dnotify.h) \
2435 +    $(wildcard include/config/vserver/cowbl.h) \
2436 +    $(wildcard include/config/quota.h) \
2437 +    $(wildcard include/config/inotify.h) \
2438 +    $(wildcard include/config/security.h) \
2439 +    $(wildcard include/config/epoll.h) \
2440 +    $(wildcard include/config/auditsyscall.h) \
2441 +    $(wildcard include/config/block.h) \
2442 +    $(wildcard include/config/fs/xip.h) \
2443 +    $(wildcard include/config/migration.h) \
2444 +  include/linux/limits.h \
2445 +  include/linux/ioctl.h \
2446 +  include/asm/ioctl.h \
2447 +  include/asm-generic/ioctl.h \
2448 +  include/linux/kdev_t.h \
2449 +  include/linux/dcache.h \
2450 +    $(wildcard include/config/profiling.h) \
2451 +  include/linux/rcupdate.h \
2452 +  include/linux/namei.h \
2453 +  include/linux/radix-tree.h \
2454 +  include/linux/pid.h \
2455 +  include/linux/quota.h \
2456 +  include/linux/dqblk_xfs.h \
2457 +  include/linux/dqblk_v1.h \
2458 +  include/linux/dqblk_v2.h \
2459 +  include/linux/nfs_fs_i.h \
2460 +  include/linux/nfs.h \
2461 +  include/linux/sunrpc/msg_prot.h \
2462 +  include/linux/fcntl.h \
2463 +  include/asm/fcntl.h \
2464 +  include/asm-generic/fcntl.h \
2465 +    $(wildcard include/config/64bit.h) \
2466 +  include/linux/err.h \
2467 +  include/linux/debug_locks.h \
2468 +    $(wildcard include/config/debug/locking/api/selftests.h) \
2469 +  include/linux/backing-dev.h \
2470 +  include/linux/mm_types.h \
2471 +  include/asm/pgtable.h \
2472 +    $(wildcard include/config/highpte.h) \
2473 +  include/asm/paravirt.h \
2474 +  include/asm/pgtable-2level-defs.h \
2475 +  include/asm/pgtable-2level.h \
2476 +  include/asm-generic/pgtable.h \
2477 +  include/linux/page-flags.h \
2478 +    $(wildcard include/config/s390.h) \
2479 +    $(wildcard include/config/swap.h) \
2480 +  include/linux/vmstat.h \
2481 +    $(wildcard include/config/vm/event/counters.h) \
2482 +  include/asm-generic/pci-dma-compat.h \
2483 +  include/linux/dma-mapping.h \
2484 +  include/asm/dma-mapping.h \
2485 +  include/asm-generic/pci.h \
2486 +  include/linux/interrupt.h \
2487 +    $(wildcard include/config/high/res/timers.h) \
2488 +    $(wildcard include/config/generic/irq/probe.h) \
2489 +  include/linux/irqreturn.h \
2490 +  include/linux/hardirq.h \
2491 +    $(wildcard include/config/preempt/bkl.h) \
2492 +    $(wildcard include/config/virt/cpu/accounting.h) \
2493 +  include/linux/smp_lock.h \
2494 +    $(wildcard include/config/lock/kernel.h) \
2495 +  include/linux/sched.h \
2496 +    $(wildcard include/config/no/hz.h) \
2497 +    $(wildcard include/config/detect/softlockup.h) \
2498 +    $(wildcard include/config/keys.h) \
2499 +    $(wildcard include/config/bsd/process/acct.h) \
2500 +    $(wildcard include/config/taskstats.h) \
2501 +    $(wildcard include/config/inotify/user.h) \
2502 +    $(wildcard include/config/schedstats.h) \
2503 +    $(wildcard include/config/task/delay/acct.h) \
2504 +    $(wildcard include/config/blk/dev/io/trace.h) \
2505 +    $(wildcard include/config/cc/stackprotector.h) \
2506 +    $(wildcard include/config/sysvipc.h) \
2507 +    $(wildcard include/config/rt/mutexes.h) \
2508 +    $(wildcard include/config/task/xacct.h) \
2509 +    $(wildcard include/config/cpusets.h) \
2510 +    $(wildcard include/config/compat.h) \
2511 +    $(wildcard include/config/fault/injection.h) \
2512 +  include/asm/param.h \
2513 +    $(wildcard include/config/hz.h) \
2514 +  include/linux/timex.h \
2515 +    $(wildcard include/config/time/interpolation.h) \
2516 +  include/asm/timex.h \
2517 +  include/asm/tsc.h \
2518 +    $(wildcard include/config/x86/tsc.h) \
2519 +    $(wildcard include/config/x86/generic.h) \
2520 +  include/linux/jiffies.h \
2521 +  include/linux/calc64.h \
2522 +  include/asm/div64.h \
2523 +  include/asm/cputime.h \
2524 +  include/asm-generic/cputime.h \
2525 +  include/linux/sem.h \
2526 +  include/linux/ipc.h \
2527 +    $(wildcard include/config/ipc/ns.h) \
2528 +  include/asm/ipcbuf.h \
2529 +  include/asm/sembuf.h \
2530 +  include/linux/signal.h \
2531 +  include/asm/signal.h \
2532 +  include/asm-generic/signal.h \
2533 +  include/asm/siginfo.h \
2534 +  include/asm-generic/siginfo.h \
2535 +  include/linux/securebits.h \
2536 +  include/linux/fs_struct.h \
2537 +  include/linux/seccomp.h \
2538 +    $(wildcard include/config/seccomp.h) \
2539 +  include/linux/futex.h \
2540 +    $(wildcard include/config/futex.h) \
2541 +  include/linux/rtmutex.h \
2542 +    $(wildcard include/config/debug/rt/mutexes.h) \
2543 +  include/linux/plist.h \
2544 +    $(wildcard include/config/debug/pi/list.h) \
2545 +  include/linux/param.h \
2546 +  include/linux/resource.h \
2547 +  include/asm/resource.h \
2548 +  include/asm-generic/resource.h \
2549 +  include/linux/timer.h \
2550 +    $(wildcard include/config/timer/stats.h) \
2551 +  include/linux/ktime.h \
2552 +    $(wildcard include/config/ktime/scalar.h) \
2553 +  include/linux/hrtimer.h \
2554 +  include/linux/task_io_accounting.h \
2555 +    $(wildcard include/config/task/io/accounting.h) \
2556 +  include/linux/aio.h \
2557 +  include/linux/workqueue.h \
2558 +  include/linux/aio_abi.h \
2559 +  include/linux/uio.h \
2560 +  include/asm/hardirq.h \
2561 +  include/linux/irq.h \
2562 +    $(wildcard include/config/irq/per/cpu.h) \
2563 +    $(wildcard include/config/irq/release/method.h) \
2564 +    $(wildcard include/config/generic/pending/irq.h) \
2565 +    $(wildcard include/config/irqbalance.h) \
2566 +    $(wildcard include/config/auto/irq/affinity.h) \
2567 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
2568 +  include/asm/irq.h \
2569 +  include/asm-i386/mach-default/irq_vectors.h \
2570 +  include/asm-i386/mach-default/irq_vectors_limits.h \
2571 +  include/asm/irq_regs.h \
2572 +  include/asm/hw_irq.h \
2573 +  include/linux/profile.h \
2574 +  include/asm/sections.h \
2575 +  include/asm-generic/sections.h \
2576 +  include/linux/irq_cpustat.h \
2577 +  include/linux/if_ether.h \
2578 +  include/linux/skbuff.h \
2579 +    $(wildcard include/config/nf/conntrack.h) \
2580 +    $(wildcard include/config/bridge/netfilter.h) \
2581 +    $(wildcard include/config/vlan/8021q.h) \
2582 +    $(wildcard include/config/net/sched.h) \
2583 +    $(wildcard include/config/net/cls/act.h) \
2584 +    $(wildcard include/config/net/dma.h) \
2585 +    $(wildcard include/config/network/secmark.h) \
2586 +  include/linux/net.h \
2587 +  include/asm/socket.h \
2588 +  include/asm/sockios.h \
2589 +  include/linux/random.h \
2590 +  include/linux/sysctl.h \
2591 +    $(wildcard include/config/icmp/ipod.h) \
2592 +    $(wildcard include/config/web100/net100.h) \
2593 +    $(wildcard include/config/web100/stats.h) \
2594 +  include/linux/textsearch.h \
2595 +  include/net/checksum.h \
2596 +  include/asm/uaccess.h \
2597 +    $(wildcard include/config/x86/intel/usercopy.h) \
2598 +    $(wildcard include/config/x86/wp/works/ok.h) \
2599 +  include/asm/checksum.h \
2600 +  include/linux/in6.h \
2601 +  include/linux/dmaengine.h \
2602 +    $(wildcard include/config/dma/engine.h) \
2603 +  drivers/net/igb/kcompat.h \
2604 +    $(wildcard include/config/e1000/napi.h) \
2605 +    $(wildcard include/config/e1000e/napi.h) \
2606 +    $(wildcard include/config/ixgb/napi.h) \
2607 +    $(wildcard include/config/e1000/disable/packet/split.h) \
2608 +    $(wildcard include/config/igb/disable/packet/split.h) \
2609 +    $(wildcard include/config/net/poll/controller.h) \
2610 +    $(wildcard include/config/space/len.h) \
2611 +    $(wildcard include/config/netpoll.h) \
2612 +    $(wildcard include/config/netdevices/multiqueue.h) \
2613 +  include/linux/version.h \
2614 +  include/linux/netdevice.h \
2615 +    $(wildcard include/config/ax25.h) \
2616 +    $(wildcard include/config/tr.h) \
2617 +    $(wildcard include/config/net/ipip.h) \
2618 +    $(wildcard include/config/net/ipgre.h) \
2619 +    $(wildcard include/config/ipv6/sit.h) \
2620 +    $(wildcard include/config/ipv6/tunnel.h) \
2621 +    $(wildcard include/config/wireless/ext.h) \
2622 +    $(wildcard include/config/netpoll/trap.h) \
2623 +  include/linux/if.h \
2624 +  include/linux/socket.h \
2625 +  include/linux/sockios.h \
2626 +  include/linux/hdlc/ioctl.h \
2627 +  include/linux/if_packet.h \
2628 +  include/linux/etherdevice.h \
2629 +  include/linux/in.h \
2630 +  include/linux/ip.h \
2631 +  include/linux/udp.h \
2632 +  include/net/inet_sock.h \
2633 +    $(wildcard include/config/ipv6.h) \
2634 +  include/linux/jhash.h \
2635 +  include/net/flow.h \
2636 +    $(wildcard include/config/ipv6/mip6.h) \
2637 +  include/net/sock.h \
2638 +    $(wildcard include/config/security/network.h) \
2639 +  include/linux/security.h \
2640 +    $(wildcard include/config/security/network/xfrm.h) \
2641 +  include/linux/binfmts.h \
2642 +  include/linux/shm.h \
2643 +  include/asm/shmparam.h \
2644 +  include/asm/shmbuf.h \
2645 +  include/linux/msg.h \
2646 +  include/asm/msgbuf.h \
2647 +  include/linux/key.h \
2648 +  include/linux/xfrm.h \
2649 +  include/linux/filter.h \
2650 +  include/net/dst.h \
2651 +    $(wildcard include/config/net/cls/route.h) \
2652 +    $(wildcard include/config/xfrm.h) \
2653 +  include/linux/rtnetlink.h \
2654 +  include/linux/netlink.h \
2655 +  include/linux/if_link.h \
2656 +  include/linux/if_addr.h \
2657 +  include/linux/neighbour.h \
2658 +  include/net/neighbour.h \
2659 +  include/linux/seq_file.h \
2660 +  include/net/rtnetlink.h \
2661 +  include/net/netlink.h \
2662 +  include/net/request_sock.h \
2663 +  include/linux/mii.h \
2664 +  include/linux/latency.h \
2665 +  drivers/net/igb/e1000_regs.h \
2666 +  drivers/net/igb/e1000_defines.h \
2667 +    $(wildcard include/config/res.h) \
2668 +    $(wildcard include/config/fault.h) \
2669 +  drivers/net/igb/e1000_mac.h \
2670 +  drivers/net/igb/e1000_phy.h \
2671 +  drivers/net/igb/e1000_nvm.h \
2672 +  drivers/net/igb/e1000_manage.h \
2673 +  drivers/net/igb/e1000_82575.h \
2674 +
2675 +drivers/net/igb/e1000_82575.o: $(deps_drivers/net/igb/e1000_82575.o)
2676 +
2677 +$(deps_drivers/net/igb/e1000_82575.o):
2678 diff -Nru vanilla/drivers/net/igb/e1000_api.c linux-i686-2.6.22/drivers/net/igb/e1000_api.c
2679 --- vanilla/drivers/net/igb/e1000_api.c 1969-12-31 19:00:00.000000000 -0500
2680 +++ linux-i686-2.6.22/drivers/net/igb/e1000_api.c       2009-07-16 19:25:22.000000000 -0400
2681 @@ -0,0 +1,1057 @@
2682 +/*******************************************************************************
2683 +
2684 +  Intel(R) Gigabit Ethernet Linux driver
2685 +  Copyright(c) 2007-2008 Intel Corporation.
2686 +
2687 +  This program is free software; you can redistribute it and/or modify it
2688 +  under the terms and conditions of the GNU General Public License,
2689 +  version 2, as published by the Free Software Foundation.
2690 +
2691 +  This program is distributed in the hope it will be useful, but WITHOUT
2692 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2693 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
2694 +  more details.
2695 +
2696 +  You should have received a copy of the GNU General Public License along with
2697 +  this program; if not, write to the Free Software Foundation, Inc.,
2698 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
2699 +
2700 +  The full GNU General Public License is included in this distribution in
2701 +  the file called "COPYING".
2702 +
2703 +  Contact Information:
2704 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
2705 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
2706 +
2707 +*******************************************************************************/
2708 +
2709 +#include "e1000_api.h"
2710 +
2711 +/**
2712 + *  e1000_init_mac_params - Initialize MAC function pointers
2713 + *  @hw: pointer to the HW structure
2714 + *
2715 + *  This function initializes the function pointers for the MAC
2716 + *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
2717 + **/
2718 +s32 e1000_init_mac_params(struct e1000_hw *hw)
2719 +{
2720 +       s32 ret_val = E1000_SUCCESS;
2721 +
2722 +       if (hw->mac.ops.init_params) {
2723 +               ret_val = hw->mac.ops.init_params(hw);
2724 +               if (ret_val) {
2725 +                       DEBUGOUT("MAC Initialization Error\n");
2726 +                       goto out;
2727 +               }
2728 +       } else {
2729 +               DEBUGOUT("mac.init_mac_params was NULL\n");
2730 +               ret_val = -E1000_ERR_CONFIG;
2731 +       }
2732 +
2733 +out:
2734 +       return ret_val;
2735 +}
2736 +
2737 +/**
2738 + *  e1000_init_nvm_params - Initialize NVM function pointers
2739 + *  @hw: pointer to the HW structure
2740 + *
2741 + *  This function initializes the function pointers for the NVM
2742 + *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
2743 + **/
2744 +s32 e1000_init_nvm_params(struct e1000_hw *hw)
2745 +{
2746 +       s32 ret_val = E1000_SUCCESS;
2747 +
2748 +       if (hw->nvm.ops.init_params) {
2749 +               ret_val = hw->nvm.ops.init_params(hw);
2750 +               if (ret_val) {
2751 +                       DEBUGOUT("NVM Initialization Error\n");
2752 +                       goto out;
2753 +               }
2754 +       } else {
2755 +               DEBUGOUT("nvm.init_nvm_params was NULL\n");
2756 +               ret_val = -E1000_ERR_CONFIG;
2757 +       }
2758 +
2759 +out:
2760 +       return ret_val;
2761 +}
2762 +
2763 +/**
2764 + *  e1000_init_phy_params - Initialize PHY function pointers
2765 + *  @hw: pointer to the HW structure
2766 + *
2767 + *  This function initializes the function pointers for the PHY
2768 + *  set of functions.  Called by drivers or by e1000_setup_init_funcs.
2769 + **/
2770 +s32 e1000_init_phy_params(struct e1000_hw *hw)
2771 +{
2772 +       s32 ret_val = E1000_SUCCESS;
2773 +
2774 +       if (hw->phy.ops.init_params) {
2775 +               ret_val = hw->phy.ops.init_params(hw);
2776 +               if (ret_val) {
2777 +                       DEBUGOUT("PHY Initialization Error\n");
2778 +                       goto out;
2779 +               }
2780 +       } else {
2781 +               DEBUGOUT("phy.init_phy_params was NULL\n");
2782 +               ret_val =  -E1000_ERR_CONFIG;
2783 +       }
2784 +
2785 +out:
2786 +       return ret_val;
2787 +}
2788 +
2789 +/**
2790 + *  e1000_set_mac_type - Sets MAC type
2791 + *  @hw: pointer to the HW structure
2792 + *
2793 + *  This function sets the mac type of the adapter based on the
2794 + *  device ID stored in the hw structure.
2795 + *  MUST BE FIRST FUNCTION CALLED (explicitly or through
2796 + *  e1000_setup_init_funcs()).
2797 + **/
2798 +s32 e1000_set_mac_type(struct e1000_hw *hw)
2799 +{
2800 +       struct e1000_mac_info *mac = &hw->mac;
2801 +       s32 ret_val = E1000_SUCCESS;
2802 +
2803 +       DEBUGFUNC("e1000_set_mac_type");
2804 +
2805 +       switch (hw->device_id) {
2806 +       case E1000_DEV_ID_82575EB_COPPER:
2807 +       case E1000_DEV_ID_82575EB_FIBER_SERDES:
2808 +       case E1000_DEV_ID_82575GB_QUAD_COPPER:
2809 +               mac->type = e1000_82575;
2810 +               break;
2811 +       case E1000_DEV_ID_82576:
2812 +       case E1000_DEV_ID_82576_FIBER:
2813 +       case E1000_DEV_ID_82576_SERDES:
2814 +               mac->type = e1000_82576;
2815 +               break;
2816 +       default:
2817 +               /* Should never have loaded on this device */
2818 +               ret_val = -E1000_ERR_MAC_INIT;
2819 +               break;
2820 +       }
2821 +
2822 +       return ret_val;
2823 +}
2824 +
2825 +/**
2826 + *  e1000_setup_init_funcs - Initializes function pointers
2827 + *  @hw: pointer to the HW structure
2828 + *  @init_device: true will initialize the rest of the function pointers
2829 + *                 getting the device ready for use.  false will only set
2830 + *                 MAC type and the function pointers for the other init
2831 + *                 functions.  Passing false will not generate any hardware
2832 + *                 reads or writes.
2833 + *
2834 + *  This function must be called by a driver in order to use the rest
2835 + *  of the 'shared' code files. Called by drivers only.
2836 + **/
2837 +s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
2838 +{
2839 +       s32 ret_val;
2840 +
2841 +       /* Can't do much good without knowing the MAC type. */
2842 +       ret_val = e1000_set_mac_type(hw);
2843 +       if (ret_val) {
2844 +               DEBUGOUT("ERROR: MAC type could not be set properly.\n");
2845 +               goto out;
2846 +       }
2847 +
2848 +       if (!hw->hw_addr) {
2849 +               DEBUGOUT("ERROR: Registers not mapped\n");
2850 +               ret_val = -E1000_ERR_CONFIG;
2851 +               goto out;
2852 +       }
2853 +
2854 +       /*
2855 +        * Init function pointers to generic implementations. We do this first
2856 +        * allowing a driver module to override it afterward.
2857 +        */
2858 +       e1000_init_mac_ops_generic(hw);
2859 +       e1000_init_nvm_ops_generic(hw);
2860 +
2861 +       /*
2862 +        * Set up the init function pointers. These are functions within the
2863 +        * adapter family file that sets up function pointers for the rest of
2864 +        * the functions in that family.
2865 +        */
2866 +       switch (hw->mac.type) {
2867 +       case e1000_82575:
2868 +       case e1000_82576:
2869 +               e1000_init_function_pointers_82575(hw);
2870 +               break;
2871 +       default:
2872 +               DEBUGOUT("Hardware not supported\n");
2873 +               ret_val = -E1000_ERR_CONFIG;
2874 +               break;
2875 +       }
2876 +
2877 +       /*
2878 +        * Initialize the rest of the function pointers. These require some
2879 +        * register reads/writes in some cases.
2880 +        */
2881 +       if (!(ret_val) && init_device) {
2882 +               ret_val = e1000_init_mac_params(hw);
2883 +               if (ret_val)
2884 +                       goto out;
2885 +
2886 +               ret_val = e1000_init_nvm_params(hw);
2887 +               if (ret_val)
2888 +                       goto out;
2889 +
2890 +               ret_val = e1000_init_phy_params(hw);
2891 +               if (ret_val)
2892 +                       goto out;
2893 +
2894 +       }
2895 +
2896 +out:
2897 +       return ret_val;
2898 +}
2899 +
2900 +/**
2901 + *  e1000_get_bus_info - Obtain bus information for adapter
2902 + *  @hw: pointer to the HW structure
2903 + *
2904 + *  This will obtain information about the HW bus for which the
2905 + *  adapter is attached and stores it in the hw structure. This is a
2906 + *  function pointer entry point called by drivers.
2907 + **/
2908 +s32 e1000_get_bus_info(struct e1000_hw *hw)
2909 +{
2910 +       if (hw->mac.ops.get_bus_info)
2911 +               return hw->mac.ops.get_bus_info(hw);
2912 +
2913 +       return E1000_SUCCESS;
2914 +}
2915 +
2916 +/**
2917 + *  e1000_clear_vfta - Clear VLAN filter table
2918 + *  @hw: pointer to the HW structure
2919 + *
2920 + *  This clears the VLAN filter table on the adapter. This is a function
2921 + *  pointer entry point called by drivers.
2922 + **/
2923 +void e1000_clear_vfta(struct e1000_hw *hw)
2924 +{
2925 +       if (hw->mac.ops.clear_vfta)
2926 +               hw->mac.ops.clear_vfta(hw);
2927 +}
2928 +
2929 +/**
2930 + *  e1000_write_vfta - Write value to VLAN filter table
2931 + *  @hw: pointer to the HW structure
2932 + *  @offset: the 32-bit offset in which to write the value to.
2933 + *  @value: the 32-bit value to write at location offset.
2934 + *
2935 + *  This writes a 32-bit value to a 32-bit offset in the VLAN filter
2936 + *  table. This is a function pointer entry point called by drivers.
2937 + **/
2938 +void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
2939 +{
2940 +       if (hw->mac.ops.write_vfta)
2941 +               hw->mac.ops.write_vfta(hw, offset, value);
2942 +}
2943 +
2944 +/**
2945 + *  e1000_update_mc_addr_list - Update Multicast addresses
2946 + *  @hw: pointer to the HW structure
2947 + *  @mc_addr_list: array of multicast addresses to program
2948 + *  @mc_addr_count: number of multicast addresses to program
2949 + *  @rar_used_count: the first RAR register free to program
2950 + *  @rar_count: total number of supported Receive Address Registers
2951 + *
2952 + *  Updates the Receive Address Registers and Multicast Table Array.
2953 + *  The caller must have a packed mc_addr_list of multicast addresses.
2954 + *  The parameter rar_count will usually be hw->mac.rar_entry_count
2955 + *  unless there are workarounds that change this.  Currently no func pointer
2956 + *  exists and all implementations are handled in the generic version of this
2957 + *  function.
2958 + **/
2959 +void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
2960 +                               u32 mc_addr_count, u32 rar_used_count,
2961 +                               u32 rar_count)
2962 +{
2963 +       if (hw->mac.ops.update_mc_addr_list)
2964 +               hw->mac.ops.update_mc_addr_list(hw,
2965 +                                               mc_addr_list,
2966 +                                               mc_addr_count,
2967 +                                               rar_used_count,
2968 +                                               rar_count);
2969 +}
2970 +
2971 +/**
2972 + *  e1000_force_mac_fc - Force MAC flow control
2973 + *  @hw: pointer to the HW structure
2974 + *
2975 + *  Force the MAC's flow control settings. Currently no func pointer exists
2976 + *  and all implementations are handled in the generic version of this
2977 + *  function.
2978 + **/
2979 +s32 e1000_force_mac_fc(struct e1000_hw *hw)
2980 +{
2981 +       return e1000_force_mac_fc_generic(hw);
2982 +}
2983 +
2984 +/**
2985 + *  e1000_check_for_link - Check/Store link connection
2986 + *  @hw: pointer to the HW structure
2987 + *
2988 + *  This checks the link condition of the adapter and stores the
2989 + *  results in the hw->mac structure. This is a function pointer entry
2990 + *  point called by drivers.
2991 + **/
2992 +s32 e1000_check_for_link(struct e1000_hw *hw)
2993 +{
2994 +       if (hw->mac.ops.check_for_link)
2995 +               return hw->mac.ops.check_for_link(hw);
2996 +
2997 +       return -E1000_ERR_CONFIG;
2998 +}
2999 +
3000 +/**
3001 + *  e1000_check_mng_mode - Check management mode
3002 + *  @hw: pointer to the HW structure
3003 + *
3004 + *  This checks if the adapter has manageability enabled.
3005 + *  This is a function pointer entry point called by drivers.
3006 + **/
3007 +bool e1000_check_mng_mode(struct e1000_hw *hw)
3008 +{
3009 +       if (hw->mac.ops.check_mng_mode)
3010 +               return hw->mac.ops.check_mng_mode(hw);
3011 +
3012 +       return false;
3013 +}
3014 +
3015 +/**
3016 + *  e1000_mng_write_dhcp_info - Writes DHCP info to host interface
3017 + *  @hw: pointer to the HW structure
3018 + *  @buffer: pointer to the host interface
3019 + *  @length: size of the buffer
3020 + *
3021 + *  Writes the DHCP information to the host interface.
3022 + **/
3023 +s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
3024 +{
3025 +       return e1000_mng_write_dhcp_info_generic(hw, buffer, length);
3026 +}
3027 +
3028 +/**
3029 + *  e1000_reset_hw - Reset hardware
3030 + *  @hw: pointer to the HW structure
3031 + *
3032 + *  This resets the hardware into a known state. This is a function pointer
3033 + *  entry point called by drivers.
3034 + **/
3035 +s32 e1000_reset_hw(struct e1000_hw *hw)
3036 +{
3037 +       if (hw->mac.ops.reset_hw)
3038 +               return hw->mac.ops.reset_hw(hw);
3039 +
3040 +       return -E1000_ERR_CONFIG;
3041 +}
3042 +
3043 +/**
3044 + *  e1000_init_hw - Initialize hardware
3045 + *  @hw: pointer to the HW structure
3046 + *
3047 + *  This inits the hardware readying it for operation. This is a function
3048 + *  pointer entry point called by drivers.
3049 + **/
3050 +s32 e1000_init_hw(struct e1000_hw *hw)
3051 +{
3052 +       if (hw->mac.ops.init_hw)
3053 +               return hw->mac.ops.init_hw(hw);
3054 +
3055 +       return -E1000_ERR_CONFIG;
3056 +}
3057 +
3058 +/**
3059 + *  e1000_setup_link - Configures link and flow control
3060 + *  @hw: pointer to the HW structure
3061 + *
3062 + *  This configures link and flow control settings for the adapter. This
3063 + *  is a function pointer entry point called by drivers. While modules can
3064 + *  also call this, they probably call their own version of this function.
3065 + **/
3066 +s32 e1000_setup_link(struct e1000_hw *hw)
3067 +{
3068 +       if (hw->mac.ops.setup_link)
3069 +               return hw->mac.ops.setup_link(hw);
3070 +
3071 +       return -E1000_ERR_CONFIG;
3072 +}
3073 +
3074 +/**
3075 + *  e1000_get_speed_and_duplex - Returns current speed and duplex
3076 + *  @hw: pointer to the HW structure
3077 + *  @speed: pointer to a 16-bit value to store the speed
3078 + *  @duplex: pointer to a 16-bit value to store the duplex.
3079 + *
3080 + *  This returns the speed and duplex of the adapter in the two 'out'
3081 + *  variables passed in. This is a function pointer entry point called
3082 + *  by drivers.
3083 + **/
3084 +s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
3085 +{
3086 +       if (hw->mac.ops.get_link_up_info)
3087 +               return hw->mac.ops.get_link_up_info(hw, speed, duplex);
3088 +
3089 +       return -E1000_ERR_CONFIG;
3090 +}
3091 +
3092 +/**
3093 + *  e1000_setup_led - Configures SW controllable LED
3094 + *  @hw: pointer to the HW structure
3095 + *
3096 + *  This prepares the SW controllable LED for use and saves the current state
3097 + *  of the LED so it can be later restored. This is a function pointer entry
3098 + *  point called by drivers.
3099 + **/
3100 +s32 e1000_setup_led(struct e1000_hw *hw)
3101 +{
3102 +       if (hw->mac.ops.setup_led)
3103 +               return hw->mac.ops.setup_led(hw);
3104 +
3105 +       return E1000_SUCCESS;
3106 +}
3107 +
3108 +/**
3109 + *  e1000_cleanup_led - Restores SW controllable LED
3110 + *  @hw: pointer to the HW structure
3111 + *
3112 + *  This restores the SW controllable LED to the value saved off by
3113 + *  e1000_setup_led. This is a function pointer entry point called by drivers.
3114 + **/
3115 +s32 e1000_cleanup_led(struct e1000_hw *hw)
3116 +{
3117 +       if (hw->mac.ops.cleanup_led)
3118 +               return hw->mac.ops.cleanup_led(hw);
3119 +
3120 +       return E1000_SUCCESS;
3121 +}
3122 +
3123 +/**
3124 + *  e1000_blink_led - Blink SW controllable LED
3125 + *  @hw: pointer to the HW structure
3126 + *
3127 + *  This starts the adapter LED blinking. Request the LED to be setup first
3128 + *  and cleaned up after. This is a function pointer entry point called by
3129 + *  drivers.
3130 + **/
3131 +s32 e1000_blink_led(struct e1000_hw *hw)
3132 +{
3133 +       if (hw->mac.ops.blink_led)
3134 +               return hw->mac.ops.blink_led(hw);
3135 +
3136 +       return E1000_SUCCESS;
3137 +}
3138 +
3139 +/**
3140 + *  e1000_led_on - Turn on SW controllable LED
3141 + *  @hw: pointer to the HW structure
3142 + *
3143 + *  Turns the SW defined LED on. This is a function pointer entry point
3144 + *  called by drivers.
3145 + **/
3146 +s32 e1000_led_on(struct e1000_hw *hw)
3147 +{
3148 +       if (hw->mac.ops.led_on)
3149 +               return hw->mac.ops.led_on(hw);
3150 +
3151 +       return E1000_SUCCESS;
3152 +}
3153 +
3154 +/**
3155 + *  e1000_led_off - Turn off SW controllable LED
3156 + *  @hw: pointer to the HW structure
3157 + *
3158 + *  Turns the SW defined LED off. This is a function pointer entry point
3159 + *  called by drivers.
3160 + **/
3161 +s32 e1000_led_off(struct e1000_hw *hw)
3162 +{
3163 +       if (hw->mac.ops.led_off)
3164 +               return hw->mac.ops.led_off(hw);
3165 +
3166 +       return E1000_SUCCESS;
3167 +}
3168 +
3169 +/**
3170 + *  e1000_reset_adaptive - Reset adaptive IFS
3171 + *  @hw: pointer to the HW structure
3172 + *
3173 + *  Resets the adaptive IFS. Currently no func pointer exists and all
3174 + *  implementations are handled in the generic version of this function.
3175 + **/
3176 +void e1000_reset_adaptive(struct e1000_hw *hw)
3177 +{
3178 +       e1000_reset_adaptive_generic(hw);
3179 +}
3180 +
3181 +/**
3182 + *  e1000_update_adaptive - Update adaptive IFS
3183 + *  @hw: pointer to the HW structure
3184 + *
3185 + *  Updates adapter IFS. Currently no func pointer exists and all
3186 + *  implementations are handled in the generic version of this function.
3187 + **/
3188 +void e1000_update_adaptive(struct e1000_hw *hw)
3189 +{
3190 +       e1000_update_adaptive_generic(hw);
3191 +}
3192 +
3193 +/**
3194 + *  e1000_disable_pcie_master - Disable PCI-Express master access
3195 + *  @hw: pointer to the HW structure
3196 + *
3197 + *  Disables PCI-Express master access and verifies there are no pending
3198 + *  requests. Currently no func pointer exists and all implementations are
3199 + *  handled in the generic version of this function.
3200 + **/
3201 +s32 e1000_disable_pcie_master(struct e1000_hw *hw)
3202 +{
3203 +       return e1000_disable_pcie_master_generic(hw);
3204 +}
3205 +
3206 +/**
3207 + *  e1000_config_collision_dist - Configure collision distance
3208 + *  @hw: pointer to the HW structure
3209 + *
3210 + *  Configures the collision distance to the default value and is used
3211 + *  during link setup.
3212 + **/
3213 +void e1000_config_collision_dist(struct e1000_hw *hw)
3214 +{
3215 +       if (hw->mac.ops.config_collision_dist)
3216 +               hw->mac.ops.config_collision_dist(hw);
3217 +}
3218 +
3219 +/**
3220 + *  e1000_rar_set - Sets a receive address register
3221 + *  @hw: pointer to the HW structure
3222 + *  @addr: address to set the RAR to
3223 + *  @index: the RAR to set
3224 + *
3225 + *  Sets a Receive Address Register (RAR) to the specified address.
3226 + **/
3227 +void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
3228 +{
3229 +       if (hw->mac.ops.rar_set)
3230 +               hw->mac.ops.rar_set(hw, addr, index);
3231 +}
3232 +
3233 +/**
3234 + *  e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
3235 + *  @hw: pointer to the HW structure
3236 + *
3237 + *  Ensures that the MDI/MDIX SW state is valid.
3238 + **/
3239 +s32 e1000_validate_mdi_setting(struct e1000_hw *hw)
3240 +{
3241 +       if (hw->mac.ops.validate_mdi_setting)
3242 +               return hw->mac.ops.validate_mdi_setting(hw);
3243 +
3244 +       return E1000_SUCCESS;
3245 +}
3246 +
3247 +/**
3248 + *  e1000_mta_set - Sets multicast table bit
3249 + *  @hw: pointer to the HW structure
3250 + *  @hash_value: Multicast hash value.
3251 + *
3252 + *  This sets the bit in the multicast table corresponding to the
3253 + *  hash value.  This is a function pointer entry point called by drivers.
3254 + **/
3255 +void e1000_mta_set(struct e1000_hw *hw, u32 hash_value)
3256 +{
3257 +       if (hw->mac.ops.mta_set)
3258 +               hw->mac.ops.mta_set(hw, hash_value);
3259 +}
3260 +
3261 +/**
3262 + *  e1000_hash_mc_addr - Determines address location in multicast table
3263 + *  @hw: pointer to the HW structure
3264 + *  @mc_addr: Multicast address to hash.
3265 + *
3266 + *  This hashes an address to determine its location in the multicast
3267 + *  table. Currently no func pointer exists and all implementations
3268 + *  are handled in the generic version of this function.
3269 + **/
3270 +u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
3271 +{
3272 +       return e1000_hash_mc_addr_generic(hw, mc_addr);
3273 +}
3274 +
3275 +/**
3276 + *  e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
3277 + *  @hw: pointer to the HW structure
3278 + *
3279 + *  Enables packet filtering on transmit packets if manageability is enabled
3280 + *  and host interface is enabled.
3281 + *  Currently no func pointer exists and all implementations are handled in the
3282 + *  generic version of this function.
3283 + **/
3284 +bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
3285 +{
3286 +       return e1000_enable_tx_pkt_filtering_generic(hw);
3287 +}
3288 +
3289 +/**
3290 + *  e1000_mng_host_if_write - Writes to the manageability host interface
3291 + *  @hw: pointer to the HW structure
3292 + *  @buffer: pointer to the host interface buffer
3293 + *  @length: size of the buffer
3294 + *  @offset: location in the buffer to write to
3295 + *  @sum: sum of the data (not checksum)
3296 + *
3297 + *  This function writes the buffer content at the offset given on the host if.
3298 + *  It also does alignment considerations to do the writes in most efficient
3299 + *  way.  Also fills up the sum of the buffer in *buffer parameter.
3300 + **/
3301 +s32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
3302 +                            u16 offset, u8 *sum)
3303 +{
3304 +       if (hw->mac.ops.mng_host_if_write)
3305 +               return hw->mac.ops.mng_host_if_write(hw, buffer, length,
3306 +                                                    offset, sum);
3307 +
3308 +       return E1000_NOT_IMPLEMENTED;
3309 +}
3310 +
3311 +/**
3312 + *  e1000_mng_write_cmd_header - Writes manageability command header
3313 + *  @hw: pointer to the HW structure
3314 + *  @hdr: pointer to the host interface command header
3315 + *
3316 + *  Writes the command header after does the checksum calculation.
3317 + **/
3318 +s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
3319 +                               struct e1000_host_mng_command_header *hdr)
3320 +{
3321 +       if (hw->mac.ops.mng_write_cmd_header)
3322 +               return hw->mac.ops.mng_write_cmd_header(hw, hdr);
3323 +
3324 +       return E1000_NOT_IMPLEMENTED;
3325 +}
3326 +
3327 +/**
3328 + *  e1000_mng_enable_host_if - Checks host interface is enabled
3329 + *  @hw: pointer to the HW structure
3330 + *
3331 + *  Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
3332 + *
3333 + *  This function checks whether the HOST IF is enabled for command operation
3334 + *  and also checks whether the previous command is completed.  It busy waits
3335 + *  in case of previous command is not completed.
3336 + **/
3337 +s32 e1000_mng_enable_host_if(struct e1000_hw * hw)
3338 +{
3339 +       if (hw->mac.ops.mng_enable_host_if)
3340 +               return hw->mac.ops.mng_enable_host_if(hw);
3341 +
3342 +       return E1000_NOT_IMPLEMENTED;
3343 +}
3344 +
3345 +/**
3346 + *  e1000_wait_autoneg - Waits for autonegotiation completion
3347 + *  @hw: pointer to the HW structure
3348 + *
3349 + *  Waits for autoneg to complete. Currently no func pointer exists and all
3350 + *  implementations are handled in the generic version of this function.
3351 + **/
3352 +s32 e1000_wait_autoneg(struct e1000_hw *hw)
3353 +{
3354 +       if (hw->mac.ops.wait_autoneg)
3355 +               return hw->mac.ops.wait_autoneg(hw);
3356 +
3357 +       return E1000_SUCCESS;
3358 +}
3359 +
3360 +/**
3361 + *  e1000_check_reset_block - Verifies PHY can be reset
3362 + *  @hw: pointer to the HW structure
3363 + *
3364 + *  Checks if the PHY is in a state that can be reset or if manageability
3365 + *  has it tied up. This is a function pointer entry point called by drivers.
3366 + **/
3367 +s32 e1000_check_reset_block(struct e1000_hw *hw)
3368 +{
3369 +       if (hw->phy.ops.check_reset_block)
3370 +               return hw->phy.ops.check_reset_block(hw);
3371 +
3372 +       return E1000_SUCCESS;
3373 +}
3374 +
3375 +/**
3376 + *  e1000_read_phy_reg - Reads PHY register
3377 + *  @hw: pointer to the HW structure
3378 + *  @offset: the register to read
3379 + *  @data: the buffer to store the 16-bit read.
3380 + *
3381 + *  Reads the PHY register and returns the value in data.
3382 + *  This is a function pointer entry point called by drivers.
3383 + **/
3384 +s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
3385 +{
3386 +       if (hw->phy.ops.read_reg)
3387 +               return hw->phy.ops.read_reg(hw, offset, data);
3388 +
3389 +       return E1000_SUCCESS;
3390 +}
3391 +
3392 +/**
3393 + *  e1000_write_phy_reg - Writes PHY register
3394 + *  @hw: pointer to the HW structure
3395 + *  @offset: the register to write
3396 + *  @data: the value to write.
3397 + *
3398 + *  Writes the PHY register at offset with the value in data.
3399 + *  This is a function pointer entry point called by drivers.
3400 + **/
3401 +s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
3402 +{
3403 +       if (hw->phy.ops.write_reg)
3404 +               return hw->phy.ops.write_reg(hw, offset, data);
3405 +
3406 +       return E1000_SUCCESS;
3407 +}
3408 +
3409 +/**
3410 + *  e1000_release_phy - Generic release PHY
3411 + *  @hw: pointer to the HW structure
3412 + *
3413 + *  Return if silicon family does not require a semaphore when accessing the
3414 + *  PHY.
3415 + **/
3416 +void e1000_release_phy(struct e1000_hw *hw)
3417 +{
3418 +       if (hw->phy.ops.release)
3419 +               hw->phy.ops.release(hw);
3420 +}
3421 +
3422 +/**
3423 + *  e1000_acquire_phy - Generic acquire PHY
3424 + *  @hw: pointer to the HW structure
3425 + *
3426 + *  Return success if silicon family does not require a semaphore when
3427 + *  accessing the PHY.
3428 + **/
3429 +s32 e1000_acquire_phy(struct e1000_hw *hw)
3430 +{
3431 +       if (hw->phy.ops.acquire)
3432 +               return hw->phy.ops.acquire(hw);
3433 +
3434 +       return E1000_SUCCESS;
3435 +}
3436 +
3437 +/**
3438 + *  e1000_read_kmrn_reg - Reads register using Kumeran interface
3439 + *  @hw: pointer to the HW structure
3440 + *  @offset: the register to read
3441 + *  @data: the location to store the 16-bit value read.
3442 + *
3443 + *  Reads a register out of the Kumeran interface. Currently no func pointer
3444 + *  exists and all implementations are handled in the generic version of
3445 + *  this function.
3446 + **/
3447 +s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
3448 +{
3449 +       return e1000_read_kmrn_reg_generic(hw, offset, data);
3450 +}
3451 +
3452 +/**
3453 + *  e1000_write_kmrn_reg - Writes register using Kumeran interface
3454 + *  @hw: pointer to the HW structure
3455 + *  @offset: the register to write
3456 + *  @data: the value to write.
3457 + *
3458 + *  Writes a register to the Kumeran interface. Currently no func pointer
3459 + *  exists and all implementations are handled in the generic version of
3460 + *  this function.
3461 + **/
3462 +s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
3463 +{
3464 +       return e1000_write_kmrn_reg_generic(hw, offset, data);
3465 +}
3466 +
3467 +/**
3468 + *  e1000_get_cable_length - Retrieves cable length estimation
3469 + *  @hw: pointer to the HW structure
3470 + *
3471 + *  This function estimates the cable length and stores them in
3472 + *  hw->phy.min_length and hw->phy.max_length. This is a function pointer
3473 + *  entry point called by drivers.
3474 + **/
3475 +s32 e1000_get_cable_length(struct e1000_hw *hw)
3476 +{
3477 +       if (hw->phy.ops.get_cable_length)
3478 +               return hw->phy.ops.get_cable_length(hw);
3479 +
3480 +       return E1000_SUCCESS;
3481 +}
3482 +
3483 +/**
3484 + *  e1000_get_phy_info - Retrieves PHY information from registers
3485 + *  @hw: pointer to the HW structure
3486 + *
3487 + *  This function gets some information from various PHY registers and
3488 + *  populates hw->phy values with it. This is a function pointer entry
3489 + *  point called by drivers.
3490 + **/
3491 +s32 e1000_get_phy_info(struct e1000_hw *hw)
3492 +{
3493 +       if (hw->phy.ops.get_info)
3494 +               return hw->phy.ops.get_info(hw);
3495 +
3496 +       return E1000_SUCCESS;
3497 +}
3498 +
3499 +/**
3500 + *  e1000_phy_hw_reset - Hard PHY reset
3501 + *  @hw: pointer to the HW structure
3502 + *
3503 + *  Performs a hard PHY reset. This is a function pointer entry point called
3504 + *  by drivers.
3505 + **/
3506 +s32 e1000_phy_hw_reset(struct e1000_hw *hw)
3507 +{
3508 +       if (hw->phy.ops.reset)
3509 +               return hw->phy.ops.reset(hw);
3510 +
3511 +       return E1000_SUCCESS;
3512 +}
3513 +
3514 +/**
3515 + *  e1000_phy_commit - Soft PHY reset
3516 + *  @hw: pointer to the HW structure
3517 + *
3518 + *  Performs a soft PHY reset on those that apply. This is a function pointer
3519 + *  entry point called by drivers.
3520 + **/
3521 +s32 e1000_phy_commit(struct e1000_hw *hw)
3522 +{
3523 +       if (hw->phy.ops.commit)
3524 +               return hw->phy.ops.commit(hw);
3525 +
3526 +       return E1000_SUCCESS;
3527 +}
3528 +
3529 +/**
3530 + *  e1000_set_d0_lplu_state - Sets low power link up state for D0
3531 + *  @hw: pointer to the HW structure
3532 + *  @active: boolean used to enable/disable lplu
3533 + *
3534 + *  Success returns 0, Failure returns 1
3535 + *
3536 + *  The low power link up (lplu) state is set to the power management level D0
3537 + *  and SmartSpeed is disabled when active is true, else clear lplu for D0
3538 + *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
3539 + *  is used during Dx states where the power conservation is most important.
3540 + *  During driver activity, SmartSpeed should be enabled so performance is
3541 + *  maintained.  This is a function pointer entry point called by drivers.
3542 + **/
3543 +s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
3544 +{
3545 +       if (hw->phy.ops.set_d0_lplu_state)
3546 +               return hw->phy.ops.set_d0_lplu_state(hw, active);
3547 +
3548 +       return E1000_SUCCESS;
3549 +}
3550 +
3551 +/**
3552 + *  e1000_set_d3_lplu_state - Sets low power link up state for D3
3553 + *  @hw: pointer to the HW structure
3554 + *  @active: boolean used to enable/disable lplu
3555 + *
3556 + *  Success returns 0, Failure returns 1
3557 + *
3558 + *  The low power link up (lplu) state is set to the power management level D3
3559 + *  and SmartSpeed is disabled when active is true, else clear lplu for D3
3560 + *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
3561 + *  is used during Dx states where the power conservation is most important.
3562 + *  During driver activity, SmartSpeed should be enabled so performance is
3563 + *  maintained.  This is a function pointer entry point called by drivers.
3564 + **/
3565 +s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
3566 +{
3567 +       if (hw->phy.ops.set_d3_lplu_state)
3568 +               return hw->phy.ops.set_d3_lplu_state(hw, active);
3569 +
3570 +       return E1000_SUCCESS;
3571 +}
3572 +
3573 +/**
3574 + *  e1000_read_mac_addr - Reads MAC address
3575 + *  @hw: pointer to the HW structure
3576 + *
3577 + *  Reads the MAC address out of the adapter and stores it in the HW structure.
3578 + *  Currently no func pointer exists and all implementations are handled in the
3579 + *  generic version of this function.
3580 + **/
3581 +s32 e1000_read_mac_addr(struct e1000_hw *hw)
3582 +{
3583 +       if (hw->mac.ops.read_mac_addr)
3584 +               return hw->mac.ops.read_mac_addr(hw);
3585 +
3586 +       return e1000_read_mac_addr_generic(hw);
3587 +}
3588 +
3589 +/**
3590 + *  e1000_read_pba_num - Read device part number
3591 + *  @hw: pointer to the HW structure
3592 + *  @pba_num: pointer to device part number
3593 + *
3594 + *  Reads the product board assembly (PBA) number from the EEPROM and stores
3595 + *  the value in pba_num.
3596 + *  Currently no func pointer exists and all implementations are handled in the
3597 + *  generic version of this function.
3598 + **/
3599 +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
3600 +{
3601 +       return e1000_read_pba_num_generic(hw, pba_num);
3602 +}
3603 +
3604 +/**
3605 + *  e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
3606 + *  @hw: pointer to the HW structure
3607 + *
3608 + *  Validates the NVM checksum is correct. This is a function pointer entry
3609 + *  point called by drivers.
3610 + **/
3611 +s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
3612 +{
3613 +       if (hw->nvm.ops.validate)
3614 +               return hw->nvm.ops.validate(hw);
3615 +
3616 +       return -E1000_ERR_CONFIG;
3617 +}
3618 +
3619 +/**
3620 + *  e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
3621 + *  @hw: pointer to the HW structure
3622 + *
3623 + *  Updates the NVM checksum. Currently no func pointer exists and all
3624 + *  implementations are handled in the generic version of this function.
3625 + **/
3626 +s32 e1000_update_nvm_checksum(struct e1000_hw *hw)
3627 +{
3628 +       if (hw->nvm.ops.update)
3629 +               return hw->nvm.ops.update(hw);
3630 +
3631 +       return -E1000_ERR_CONFIG;
3632 +}
3633 +
3634 +/**
3635 + *  e1000_reload_nvm - Reloads EEPROM
3636 + *  @hw: pointer to the HW structure
3637 + *
3638 + *  Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
3639 + *  extended control register.
3640 + **/
3641 +void e1000_reload_nvm(struct e1000_hw *hw)
3642 +{
3643 +       if (hw->nvm.ops.reload)
3644 +               hw->nvm.ops.reload(hw);
3645 +}
3646 +
3647 +/**
3648 + *  e1000_read_nvm - Reads NVM (EEPROM)
3649 + *  @hw: pointer to the HW structure
3650 + *  @offset: the word offset to read
3651 + *  @words: number of 16-bit words to read
3652 + *  @data: pointer to the properly sized buffer for the data.
3653 + *
3654 + *  Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
3655 + *  pointer entry point called by drivers.
3656 + **/
3657 +s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
3658 +{
3659 +       if (hw->nvm.ops.read)
3660 +               return hw->nvm.ops.read(hw, offset, words, data);
3661 +
3662 +       return -E1000_ERR_CONFIG;
3663 +}
3664 +
3665 +/**
3666 + *  e1000_write_nvm - Writes to NVM (EEPROM)
3667 + *  @hw: pointer to the HW structure
3668 + *  @offset: the word offset to read
3669 + *  @words: number of 16-bit words to write
3670 + *  @data: pointer to the properly sized buffer for the data.
3671 + *
3672 + *  Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
3673 + *  pointer entry point called by drivers.
3674 + **/
3675 +s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
3676 +{
3677 +       if (hw->nvm.ops.write)
3678 +               return hw->nvm.ops.write(hw, offset, words, data);
3679 +
3680 +       return E1000_SUCCESS;
3681 +}
3682 +
3683 +/**
3684 + *  e1000_write_8bit_ctrl_reg - Writes 8bit Control register
3685 + *  @hw: pointer to the HW structure
3686 + *  @reg: 32bit register offset
3687 + *  @offset: the register to write
3688 + *  @data: the value to write.
3689 + *
3690 + *  Writes the PHY register at offset with the value in data.
3691 + *  This is a function pointer entry point called by drivers.
3692 + **/
3693 +s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
3694 +                              u8 data)
3695 +{
3696 +       return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
3697 +}
3698 +
3699 +/**
3700 + * e1000_power_up_phy - Restores link in case of PHY power down
3701 + * @hw: pointer to the HW structure
3702 + *
3703 + * The phy may be powered down to save power, to turn off link when the
3704 + * driver is unloaded, or wake on lan is not enabled (among others).
3705 + **/
3706 +void e1000_power_up_phy(struct e1000_hw *hw)
3707 +{
3708 +       if (hw->phy.ops.power_up)
3709 +               hw->phy.ops.power_up(hw);
3710 +
3711 +       e1000_setup_link(hw);
3712 +}
3713 +
3714 +/**
3715 + * e1000_power_down_phy - Power down PHY
3716 + * @hw: pointer to the HW structure
3717 + *
3718 + * The phy may be powered down to save power, to turn off link when the
3719 + * driver is unloaded, or wake on lan is not enabled (among others).
3720 + **/
3721 +void e1000_power_down_phy(struct e1000_hw *hw)
3722 +{
3723 +       if (hw->phy.ops.power_down)
3724 +               hw->phy.ops.power_down(hw);
3725 +}
3726 +
3727 +/**
3728 + *  e1000_shutdown_fiber_serdes_link - Remove link during power down
3729 + *  @hw: pointer to the HW structure
3730 + *
3731 + *  Shutdown the optics and PCS on driver unload.
3732 + **/
3733 +void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
3734 +{
3735 +       if (hw->mac.ops.shutdown_serdes)
3736 +               hw->mac.ops.shutdown_serdes(hw);
3737 +}
3738 +
3739 diff -Nru vanilla/drivers/net/igb/e1000_api.h linux-i686-2.6.22/drivers/net/igb/e1000_api.h
3740 --- vanilla/drivers/net/igb/e1000_api.h 1969-12-31 19:00:00.000000000 -0500
3741 +++ linux-i686-2.6.22/drivers/net/igb/e1000_api.h       2009-07-16 19:25:22.000000000 -0400
3742 @@ -0,0 +1,146 @@
3743 +/*******************************************************************************
3744 +
3745 +  Intel(R) Gigabit Ethernet Linux driver
3746 +  Copyright(c) 2007-2008 Intel Corporation.
3747 +
3748 +  This program is free software; you can redistribute it and/or modify it
3749 +  under the terms and conditions of the GNU General Public License,
3750 +  version 2, as published by the Free Software Foundation.
3751 +
3752 +  This program is distributed in the hope it will be useful, but WITHOUT
3753 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3754 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
3755 +  more details.
3756 +
3757 +  You should have received a copy of the GNU General Public License along with
3758 +  this program; if not, write to the Free Software Foundation, Inc.,
3759 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
3760 +
3761 +  The full GNU General Public License is included in this distribution in
3762 +  the file called "COPYING".
3763 +
3764 +  Contact Information:
3765 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
3766 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
3767 +
3768 +*******************************************************************************/
3769 +
3770 +#ifndef _E1000_API_H_
3771 +#define _E1000_API_H_
3772 +
3773 +#include "e1000_hw.h"
3774 +
3775 +extern void    e1000_init_function_pointers_82575(struct e1000_hw *hw);
3776 +extern void    e1000_rx_fifo_flush_82575(struct e1000_hw *hw);
3777 +extern void    e1000_init_function_pointers_vf(struct e1000_hw *hw);
3778 +extern void    e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw);
3779 +
3780 +s32  e1000_set_mac_type(struct e1000_hw *hw);
3781 +s32  e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device);
3782 +s32  e1000_init_mac_params(struct e1000_hw *hw);
3783 +s32  e1000_init_nvm_params(struct e1000_hw *hw);
3784 +s32  e1000_init_phy_params(struct e1000_hw *hw);
3785 +s32  e1000_get_bus_info(struct e1000_hw *hw);
3786 +void e1000_clear_vfta(struct e1000_hw *hw);
3787 +void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
3788 +s32  e1000_force_mac_fc(struct e1000_hw *hw);
3789 +s32  e1000_check_for_link(struct e1000_hw *hw);
3790 +s32  e1000_reset_hw(struct e1000_hw *hw);
3791 +s32  e1000_init_hw(struct e1000_hw *hw);
3792 +s32  e1000_setup_link(struct e1000_hw *hw);
3793 +s32  e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed,
3794 +                                u16 *duplex);
3795 +s32  e1000_disable_pcie_master(struct e1000_hw *hw);
3796 +void e1000_config_collision_dist(struct e1000_hw *hw);
3797 +void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
3798 +void e1000_mta_set(struct e1000_hw *hw, u32 hash_value);
3799 +u32  e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
3800 +void e1000_update_mc_addr_list(struct e1000_hw *hw,
3801 +                               u8 *mc_addr_list, u32 mc_addr_count,
3802 +                               u32 rar_used_count, u32 rar_count);
3803 +s32  e1000_setup_led(struct e1000_hw *hw);
3804 +s32  e1000_cleanup_led(struct e1000_hw *hw);
3805 +s32  e1000_check_reset_block(struct e1000_hw *hw);
3806 +s32  e1000_blink_led(struct e1000_hw *hw);
3807 +s32  e1000_led_on(struct e1000_hw *hw);
3808 +s32  e1000_led_off(struct e1000_hw *hw);
3809 +void e1000_reset_adaptive(struct e1000_hw *hw);
3810 +void e1000_update_adaptive(struct e1000_hw *hw);
3811 +s32  e1000_get_cable_length(struct e1000_hw *hw);
3812 +s32  e1000_validate_mdi_setting(struct e1000_hw *hw);
3813 +s32  e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data);
3814 +s32  e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data);
3815 +s32  e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,
3816 +                               u32 offset, u8 data);
3817 +s32  e1000_get_phy_info(struct e1000_hw *hw);
3818 +void e1000_release_phy(struct e1000_hw *hw);
3819 +s32  e1000_acquire_phy(struct e1000_hw *hw);
3820 +s32  e1000_phy_hw_reset(struct e1000_hw *hw);
3821 +s32  e1000_phy_commit(struct e1000_hw *hw);
3822 +void e1000_power_up_phy(struct e1000_hw *hw);
3823 +void e1000_power_down_phy(struct e1000_hw *hw);
3824 +s32  e1000_read_mac_addr(struct e1000_hw *hw);
3825 +s32  e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num);
3826 +void e1000_reload_nvm(struct e1000_hw *hw);
3827 +s32  e1000_update_nvm_checksum(struct e1000_hw *hw);
3828 +s32  e1000_validate_nvm_checksum(struct e1000_hw *hw);
3829 +s32  e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
3830 +s32  e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
3831 +s32  e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
3832 +s32  e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words,
3833 +                     u16 *data);
3834 +s32  e1000_wait_autoneg(struct e1000_hw *hw);
3835 +s32  e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
3836 +s32  e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
3837 +bool e1000_check_mng_mode(struct e1000_hw *hw);
3838 +bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
3839 +s32  e1000_mng_enable_host_if(struct e1000_hw *hw);
3840 +s32  e1000_mng_host_if_write(struct e1000_hw *hw,
3841 +                             u8 *buffer, u16 length, u16 offset, u8 *sum);
3842 +s32  e1000_mng_write_cmd_header(struct e1000_hw *hw,
3843 +                                struct e1000_host_mng_command_header *hdr);
3844 +s32  e1000_mng_write_dhcp_info(struct e1000_hw * hw,
3845 +                                    u8 *buffer, u16 length);
3846 +
3847 +/*
3848 + * TBI_ACCEPT macro definition:
3849 + *
3850 + * This macro requires:
3851 + *      adapter = a pointer to struct e1000_hw
3852 + *      status = the 8 bit status field of the Rx descriptor with EOP set
3853 + *      error = the 8 bit error field of the Rx descriptor with EOP set
3854 + *      length = the sum of all the length fields of the Rx descriptors that
3855 + *               make up the current frame
3856 + *      last_byte = the last byte of the frame DMAed by the hardware
3857 + *      max_frame_length = the maximum frame length we want to accept.
3858 + *      min_frame_length = the minimum frame length we want to accept.
3859 + *
3860 + * This macro is a conditional that should be used in the interrupt
3861 + * handler's Rx processing routine when RxErrors have been detected.
3862 + *
3863 + * Typical use:
3864 + *  ...
3865 + *  if (TBI_ACCEPT) {
3866 + *      accept_frame = true;
3867 + *      e1000_tbi_adjust_stats(adapter, MacAddress);
3868 + *      frame_length--;
3869 + *  } else {
3870 + *      accept_frame = false;
3871 + *  }
3872 + *  ...
3873 + */
3874 +
3875 +/* The carrier extension symbol, as received by the NIC. */
3876 +#define CARRIER_EXTENSION   0x0F
3877 +
3878 +#define TBI_ACCEPT(a, status, errors, length, last_byte, min_frame_size, max_frame_size) \
3879 +    (e1000_tbi_sbp_enabled_82543(a) && \
3880 +     (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \
3881 +     ((last_byte) == CARRIER_EXTENSION) && \
3882 +     (((status) & E1000_RXD_STAT_VP) ? \
3883 +          (((length) > (min_frame_size - VLAN_TAG_SIZE)) && \
3884 +           ((length) <= (max_frame_size + 1))) : \
3885 +          (((length) > min_frame_size) && \
3886 +           ((length) <= (max_frame_size + VLAN_TAG_SIZE + 1)))))
3887 +
3888 +#endif
3889 Binary files vanilla/drivers/net/igb/e1000_api.o and linux-i686-2.6.22/drivers/net/igb/e1000_api.o differ
3890 diff -Nru vanilla/drivers/net/igb/.e1000_api.o.cmd linux-i686-2.6.22/drivers/net/igb/.e1000_api.o.cmd
3891 --- vanilla/drivers/net/igb/.e1000_api.o.cmd    1969-12-31 19:00:00.000000000 -0500
3892 +++ linux-i686-2.6.22/drivers/net/igb/.e1000_api.o.cmd  2009-07-16 19:53:45.000000000 -0400
3893 @@ -0,0 +1,549 @@
3894 +cmd_drivers/net/igb/e1000_api.o := gcc -m32 -Wp,-MD,drivers/net/igb/.e1000_api.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(e1000_api)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_e1000_api.o drivers/net/igb/e1000_api.c
3895 +
3896 +deps_drivers/net/igb/e1000_api.o := \
3897 +  drivers/net/igb/e1000_api.c \
3898 +  drivers/net/igb/e1000_api.h \
3899 +  drivers/net/igb/e1000_hw.h \
3900 +  drivers/net/igb/e1000_osdep.h \
3901 +  include/linux/pci.h \
3902 +    $(wildcard include/config/pci/msi.h) \
3903 +    $(wildcard include/config/pci.h) \
3904 +    $(wildcard include/config/ht/irq.h) \
3905 +    $(wildcard include/config/pci/domains.h) \
3906 +  include/linux/pci_regs.h \
3907 +  include/linux/mod_devicetable.h \
3908 +  include/linux/types.h \
3909 +    $(wildcard include/config/uid16.h) \
3910 +    $(wildcard include/config/lbd.h) \
3911 +    $(wildcard include/config/lsf.h) \
3912 +    $(wildcard include/config/resources/64bit.h) \
3913 +  include/linux/posix_types.h \
3914 +  include/linux/stddef.h \
3915 +  include/linux/compiler.h \
3916 +    $(wildcard include/config/enable/must/check.h) \
3917 +  include/linux/compiler-gcc4.h \
3918 +    $(wildcard include/config/forced/inlining.h) \
3919 +  include/linux/compiler-gcc.h \
3920 +  include/asm/posix_types.h \
3921 +  include/asm/types.h \
3922 +    $(wildcard include/config/highmem64g.h) \
3923 +  include/linux/ioport.h \
3924 +  include/linux/list.h \
3925 +    $(wildcard include/config/debug/list.h) \
3926 +  include/linux/poison.h \
3927 +  include/linux/prefetch.h \
3928 +  include/asm/processor.h \
3929 +    $(wildcard include/config/smp.h) \
3930 +    $(wildcard include/config/x86/ht.h) \
3931 +    $(wildcard include/config/paravirt.h) \
3932 +    $(wildcard include/config/mk8.h) \
3933 +    $(wildcard include/config/mk7.h) \
3934 +  include/asm/vm86.h \
3935 +    $(wildcard include/config/vm86.h) \
3936 +  include/asm/ptrace.h \
3937 +  include/asm/ptrace-abi.h \
3938 +  include/asm/segment.h \
3939 +  include/asm/math_emu.h \
3940 +  include/asm/sigcontext.h \
3941 +  include/asm/page.h \
3942 +    $(wildcard include/config/x86/use/3dnow.h) \
3943 +    $(wildcard include/config/x86/pae.h) \
3944 +    $(wildcard include/config/hugetlb/page.h) \
3945 +    $(wildcard include/config/highmem4g.h) \
3946 +    $(wildcard include/config/page/offset.h) \
3947 +    $(wildcard include/config/flatmem.h) \
3948 +  include/asm-generic/pgtable-nopmd.h \
3949 +  include/asm-generic/pgtable-nopud.h \
3950 +  include/asm-generic/memory_model.h \
3951 +    $(wildcard include/config/discontigmem.h) \
3952 +    $(wildcard include/config/sparsemem.h) \
3953 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
3954 +  include/asm-generic/page.h \
3955 +  include/asm/cpufeature.h \
3956 +  include/linux/bitops.h \
3957 +  include/asm/bitops.h \
3958 +  include/asm/alternative.h \
3959 +  include/asm-generic/bitops/sched.h \
3960 +  include/asm-generic/bitops/hweight.h \
3961 +  include/asm-generic/bitops/fls64.h \
3962 +  include/asm-generic/bitops/ext2-non-atomic.h \
3963 +  include/asm-generic/bitops/le.h \
3964 +  include/asm/byteorder.h \
3965 +    $(wildcard include/config/x86/bswap.h) \
3966 +  include/linux/byteorder/little_endian.h \
3967 +  include/linux/byteorder/swab.h \
3968 +  include/linux/byteorder/generic.h \
3969 +  include/asm-generic/bitops/minix.h \
3970 +  include/asm/required-features.h \
3971 +    $(wildcard include/config/x86/minimum/cpu.h) \
3972 +    $(wildcard include/config/x86/cmov.h) \
3973 +    $(wildcard include/config/x86/cmpxchg64.h) \
3974 +  include/asm/msr.h \
3975 +  include/asm/msr-index.h \
3976 +  include/asm/errno.h \
3977 +  include/asm-generic/errno.h \
3978 +  include/asm-generic/errno-base.h \
3979 +  include/linux/errno.h \
3980 +  include/asm/system.h \
3981 +    $(wildcard include/config/x86/oostore.h) \
3982 +  include/linux/kernel.h \
3983 +    $(wildcard include/config/preempt/voluntary.h) \
3984 +    $(wildcard include/config/debug/spinlock/sleep.h) \
3985 +    $(wildcard include/config/printk.h) \
3986 +    $(wildcard include/config/numa.h) \
3987 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
3988 +  include/linux/linkage.h \
3989 +  include/asm/linkage.h \
3990 +    $(wildcard include/config/x86/alignment/16.h) \
3991 +  include/linux/log2.h \
3992 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
3993 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
3994 +  include/asm/bug.h \
3995 +    $(wildcard include/config/bug.h) \
3996 +    $(wildcard include/config/debug/bugverbose.h) \
3997 +  include/asm-generic/bug.h \
3998 +    $(wildcard include/config/generic/bug.h) \
3999 +  include/asm/cmpxchg.h \
4000 +    $(wildcard include/config/x86/cmpxchg.h) \
4001 +  include/linux/irqflags.h \
4002 +    $(wildcard include/config/trace/irqflags.h) \
4003 +    $(wildcard include/config/trace/irqflags/support.h) \
4004 +    $(wildcard include/config/x86.h) \
4005 +  include/asm/irqflags.h \
4006 +  include/asm/processor-flags.h \
4007 +  include/linux/cache.h \
4008 +  include/asm/cache.h \
4009 +    $(wildcard include/config/x86/l1/cache/shift.h) \
4010 +  include/linux/threads.h \
4011 +    $(wildcard include/config/nr/cpus.h) \
4012 +    $(wildcard include/config/base/small.h) \
4013 +  include/asm/percpu.h \
4014 +  include/linux/cpumask.h \
4015 +    $(wildcard include/config/hotplug/cpu.h) \
4016 +  include/linux/bitmap.h \
4017 +  include/linux/string.h \
4018 +  include/asm/string.h \
4019 +  include/linux/init.h \
4020 +    $(wildcard include/config/modules.h) \
4021 +    $(wildcard include/config/hotplug.h) \
4022 +    $(wildcard include/config/memory/hotplug.h) \
4023 +    $(wildcard include/config/acpi/hotplug/memory.h) \
4024 +  include/asm/atomic.h \
4025 +    $(wildcard include/config/m386.h) \
4026 +  include/asm-generic/atomic.h \
4027 +  include/linux/device.h \
4028 +    $(wildcard include/config/debug/devres.h) \
4029 +  include/linux/kobject.h \
4030 +  include/linux/sysfs.h \
4031 +    $(wildcard include/config/sysfs.h) \
4032 +  include/linux/spinlock.h \
4033 +    $(wildcard include/config/debug/spinlock.h) \
4034 +    $(wildcard include/config/preempt.h) \
4035 +    $(wildcard include/config/debug/lock/alloc.h) \
4036 +  include/linux/preempt.h \
4037 +    $(wildcard include/config/debug/preempt.h) \
4038 +  include/linux/thread_info.h \
4039 +  include/asm/thread_info.h \
4040 +    $(wildcard include/config/4kstacks.h) \
4041 +    $(wildcard include/config/debug/stack/usage.h) \
4042 +  include/linux/stringify.h \
4043 +  include/linux/bottom_half.h \
4044 +  include/linux/spinlock_types.h \
4045 +  include/linux/lockdep.h \
4046 +    $(wildcard include/config/lockdep.h) \
4047 +    $(wildcard include/config/generic/hardirqs.h) \
4048 +    $(wildcard include/config/prove/locking.h) \
4049 +  include/asm/spinlock_types.h \
4050 +  include/asm/spinlock.h \
4051 +    $(wildcard include/config/x86/ppro/fence.h) \
4052 +  include/asm/rwlock.h \
4053 +  include/linux/spinlock_api_smp.h \
4054 +  include/linux/kref.h \
4055 +  include/linux/wait.h \
4056 +  include/asm/current.h \
4057 +  include/linux/klist.h \
4058 +  include/linux/completion.h \
4059 +  include/linux/module.h \
4060 +    $(wildcard include/config/modversions.h) \
4061 +    $(wildcard include/config/unused/symbols.h) \
4062 +    $(wildcard include/config/module/unload.h) \
4063 +    $(wildcard include/config/kallsyms.h) \
4064 +  include/linux/stat.h \
4065 +  include/asm/stat.h \
4066 +  include/linux/time.h \
4067 +  include/linux/seqlock.h \
4068 +  include/linux/vs_time.h \
4069 +    $(wildcard include/config/vserver/vtime.h) \
4070 +  include/linux/kmod.h \
4071 +    $(wildcard include/config/kmod.h) \
4072 +  include/linux/elf.h \
4073 +  include/linux/auxvec.h \
4074 +  include/asm/auxvec.h \
4075 +  include/linux/elf-em.h \
4076 +  include/asm/elf.h \
4077 +  include/asm/user.h \
4078 +  include/asm/desc.h \
4079 +  include/asm/ldt.h \
4080 +  include/linux/smp.h \
4081 +  include/asm/smp.h \
4082 +    $(wildcard include/config/x86/local/apic.h) \
4083 +    $(wildcard include/config/x86/io/apic.h) \
4084 +  include/asm/mpspec.h \
4085 +    $(wildcard include/config/acpi.h) \
4086 +  include/asm/mpspec_def.h \
4087 +  include/asm-i386/mach-generic/mach_mpspec.h \
4088 +  include/asm/apic.h \
4089 +    $(wildcard include/config/x86/good/apic.h) \
4090 +  include/linux/pm.h \
4091 +    $(wildcard include/config/pm.h) \
4092 +  include/linux/delay.h \
4093 +  include/asm/delay.h \
4094 +  include/asm/fixmap.h \
4095 +    $(wildcard include/config/highmem.h) \
4096 +    $(wildcard include/config/x86/visws/apic.h) \
4097 +    $(wildcard include/config/x86/f00f/bug.h) \
4098 +    $(wildcard include/config/x86/cyclone/timer.h) \
4099 +    $(wildcard include/config/pci/mmconfig.h) \
4100 +  include/asm/acpi.h \
4101 +    $(wildcard include/config/acpi/sleep.h) \
4102 +  include/acpi/pdc_intel.h \
4103 +  include/asm/apicdef.h \
4104 +  include/asm/kmap_types.h \
4105 +    $(wildcard include/config/debug/highmem.h) \
4106 +  include/asm/io_apic.h \
4107 +  include/asm-i386/mach-generic/mach_apicdef.h \
4108 +  include/asm/genapic.h \
4109 +  include/linux/percpu.h \
4110 +  include/linux/slab.h \
4111 +    $(wildcard include/config/slab/debug.h) \
4112 +    $(wildcard include/config/slab.h) \
4113 +    $(wildcard include/config/slub.h) \
4114 +    $(wildcard include/config/debug/slab.h) \
4115 +  include/linux/gfp.h \
4116 +    $(wildcard include/config/zone/dma.h) \
4117 +    $(wildcard include/config/zone/dma32.h) \
4118 +  include/linux/mmzone.h \
4119 +    $(wildcard include/config/force/max/zoneorder.h) \
4120 +    $(wildcard include/config/arch/populates/node/map.h) \
4121 +    $(wildcard include/config/flat/node/mem/map.h) \
4122 +    $(wildcard include/config/have/memory/present.h) \
4123 +    $(wildcard include/config/need/node/memmap/size.h) \
4124 +    $(wildcard include/config/need/multiple/nodes.h) \
4125 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
4126 +    $(wildcard include/config/sparsemem/extreme.h) \
4127 +    $(wildcard include/config/nodes/span/other/nodes.h) \
4128 +    $(wildcard include/config/holes/in/zone.h) \
4129 +  include/linux/numa.h \
4130 +    $(wildcard include/config/nodes/shift.h) \
4131 +  include/linux/nodemask.h \
4132 +  include/linux/memory_hotplug.h \
4133 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
4134 +  include/linux/notifier.h \
4135 +  include/linux/mutex.h \
4136 +    $(wildcard include/config/debug/mutexes.h) \
4137 +    $(wildcard include/config/chopstix.h) \
4138 +  include/linux/rwsem.h \
4139 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
4140 +  include/asm/rwsem.h \
4141 +  include/linux/srcu.h \
4142 +  include/linux/topology.h \
4143 +    $(wildcard include/config/sched/smt.h) \
4144 +    $(wildcard include/config/sched/mc.h) \
4145 +  include/asm/topology.h \
4146 +  include/asm-generic/topology.h \
4147 +  include/linux/slab_def.h \
4148 +  include/linux/kmalloc_sizes.h \
4149 +  include/asm/mmu.h \
4150 +  include/asm/semaphore.h \
4151 +  include/linux/moduleparam.h \
4152 +  include/asm/local.h \
4153 +  include/asm/module.h \
4154 +    $(wildcard include/config/m486.h) \
4155 +    $(wildcard include/config/m586.h) \
4156 +    $(wildcard include/config/m586tsc.h) \
4157 +    $(wildcard include/config/m586mmx.h) \
4158 +    $(wildcard include/config/mcore2.h) \
4159 +    $(wildcard include/config/m686.h) \
4160 +    $(wildcard include/config/mpentiumii.h) \
4161 +    $(wildcard include/config/mpentiumiii.h) \
4162 +    $(wildcard include/config/mpentiumm.h) \
4163 +    $(wildcard include/config/mpentium4.h) \
4164 +    $(wildcard include/config/mk6.h) \
4165 +    $(wildcard include/config/x86/elan.h) \
4166 +    $(wildcard include/config/mcrusoe.h) \
4167 +    $(wildcard include/config/mefficeon.h) \
4168 +    $(wildcard include/config/mwinchipc6.h) \
4169 +    $(wildcard include/config/mwinchip2.h) \
4170 +    $(wildcard include/config/mwinchip3d.h) \
4171 +    $(wildcard include/config/mcyrixiii.h) \
4172 +    $(wildcard include/config/mviac3/2.h) \
4173 +    $(wildcard include/config/mviac7.h) \
4174 +    $(wildcard include/config/mgeodegx1.h) \
4175 +    $(wildcard include/config/mgeode/lx.h) \
4176 +  include/asm/device.h \
4177 +  include/linux/pci_ids.h \
4178 +  include/linux/dmapool.h \
4179 +  include/asm/io.h \
4180 +    $(wildcard include/config/x86/numaq.h) \
4181 +  include/asm-generic/iomap.h \
4182 +  include/linux/vmalloc.h \
4183 +  include/asm/scatterlist.h \
4184 +  include/asm/pci.h \
4185 +  include/linux/mm.h \
4186 +    $(wildcard include/config/sysctl.h) \
4187 +    $(wildcard include/config/mmu.h) \
4188 +    $(wildcard include/config/stack/growsup.h) \
4189 +    $(wildcard include/config/debug/vm.h) \
4190 +    $(wildcard include/config/shmem.h) \
4191 +    $(wildcard include/config/split/ptlock/cpus.h) \
4192 +    $(wildcard include/config/ia64.h) \
4193 +    $(wildcard include/config/proc/fs.h) \
4194 +    $(wildcard include/config/debug/pagealloc.h) \
4195 +  include/linux/capability.h \
4196 +  include/linux/rbtree.h \
4197 +  include/linux/prio_tree.h \
4198 +  include/linux/fs.h \
4199 +    $(wildcard include/config/dnotify.h) \
4200 +    $(wildcard include/config/vserver/cowbl.h) \
4201 +    $(wildcard include/config/quota.h) \
4202 +    $(wildcard include/config/inotify.h) \
4203 +    $(wildcard include/config/security.h) \
4204 +    $(wildcard include/config/epoll.h) \
4205 +    $(wildcard include/config/auditsyscall.h) \
4206 +    $(wildcard include/config/block.h) \
4207 +    $(wildcard include/config/fs/xip.h) \
4208 +    $(wildcard include/config/migration.h) \
4209 +  include/linux/limits.h \
4210 +  include/linux/ioctl.h \
4211 +  include/asm/ioctl.h \
4212 +  include/asm-generic/ioctl.h \
4213 +  include/linux/kdev_t.h \
4214 +  include/linux/dcache.h \
4215 +    $(wildcard include/config/profiling.h) \
4216 +  include/linux/rcupdate.h \
4217 +  include/linux/namei.h \
4218 +  include/linux/radix-tree.h \
4219 +  include/linux/pid.h \
4220 +  include/linux/quota.h \
4221 +  include/linux/dqblk_xfs.h \
4222 +  include/linux/dqblk_v1.h \
4223 +  include/linux/dqblk_v2.h \
4224 +  include/linux/nfs_fs_i.h \
4225 +  include/linux/nfs.h \
4226 +  include/linux/sunrpc/msg_prot.h \
4227 +  include/linux/fcntl.h \
4228 +  include/asm/fcntl.h \
4229 +  include/asm-generic/fcntl.h \
4230 +    $(wildcard include/config/64bit.h) \
4231 +  include/linux/err.h \
4232 +  include/linux/debug_locks.h \
4233 +    $(wildcard include/config/debug/locking/api/selftests.h) \
4234 +  include/linux/backing-dev.h \
4235 +  include/linux/mm_types.h \
4236 +  include/asm/pgtable.h \
4237 +    $(wildcard include/config/highpte.h) \
4238 +  include/asm/paravirt.h \
4239 +  include/asm/pgtable-2level-defs.h \
4240 +  include/asm/pgtable-2level.h \
4241 +  include/asm-generic/pgtable.h \
4242 +  include/linux/page-flags.h \
4243 +    $(wildcard include/config/s390.h) \
4244 +    $(wildcard include/config/swap.h) \
4245 +  include/linux/vmstat.h \
4246 +    $(wildcard include/config/vm/event/counters.h) \
4247 +  include/asm-generic/pci-dma-compat.h \
4248 +  include/linux/dma-mapping.h \
4249 +  include/asm/dma-mapping.h \
4250 +  include/asm-generic/pci.h \
4251 +  include/linux/interrupt.h \
4252 +    $(wildcard include/config/high/res/timers.h) \
4253 +    $(wildcard include/config/generic/irq/probe.h) \
4254 +  include/linux/irqreturn.h \
4255 +  include/linux/hardirq.h \
4256 +    $(wildcard include/config/preempt/bkl.h) \
4257 +    $(wildcard include/config/virt/cpu/accounting.h) \
4258 +  include/linux/smp_lock.h \
4259 +    $(wildcard include/config/lock/kernel.h) \
4260 +  include/linux/sched.h \
4261 +    $(wildcard include/config/no/hz.h) \
4262 +    $(wildcard include/config/detect/softlockup.h) \
4263 +    $(wildcard include/config/keys.h) \
4264 +    $(wildcard include/config/bsd/process/acct.h) \
4265 +    $(wildcard include/config/taskstats.h) \
4266 +    $(wildcard include/config/inotify/user.h) \
4267 +    $(wildcard include/config/schedstats.h) \
4268 +    $(wildcard include/config/task/delay/acct.h) \
4269 +    $(wildcard include/config/blk/dev/io/trace.h) \
4270 +    $(wildcard include/config/cc/stackprotector.h) \
4271 +    $(wildcard include/config/sysvipc.h) \
4272 +    $(wildcard include/config/rt/mutexes.h) \
4273 +    $(wildcard include/config/task/xacct.h) \
4274 +    $(wildcard include/config/cpusets.h) \
4275 +    $(wildcard include/config/compat.h) \
4276 +    $(wildcard include/config/fault/injection.h) \
4277 +  include/asm/param.h \
4278 +    $(wildcard include/config/hz.h) \
4279 +  include/linux/timex.h \
4280 +    $(wildcard include/config/time/interpolation.h) \
4281 +  include/asm/timex.h \
4282 +  include/asm/tsc.h \
4283 +    $(wildcard include/config/x86/tsc.h) \
4284 +    $(wildcard include/config/x86/generic.h) \
4285 +  include/linux/jiffies.h \
4286 +  include/linux/calc64.h \
4287 +  include/asm/div64.h \
4288 +  include/asm/cputime.h \
4289 +  include/asm-generic/cputime.h \
4290 +  include/linux/sem.h \
4291 +  include/linux/ipc.h \
4292 +    $(wildcard include/config/ipc/ns.h) \
4293 +  include/asm/ipcbuf.h \
4294 +  include/asm/sembuf.h \
4295 +  include/linux/signal.h \
4296 +  include/asm/signal.h \
4297 +  include/asm-generic/signal.h \
4298 +  include/asm/siginfo.h \
4299 +  include/asm-generic/siginfo.h \
4300 +  include/linux/securebits.h \
4301 +  include/linux/fs_struct.h \
4302 +  include/linux/seccomp.h \
4303 +    $(wildcard include/config/seccomp.h) \
4304 +  include/linux/futex.h \
4305 +    $(wildcard include/config/futex.h) \
4306 +  include/linux/rtmutex.h \
4307 +    $(wildcard include/config/debug/rt/mutexes.h) \
4308 +  include/linux/plist.h \
4309 +    $(wildcard include/config/debug/pi/list.h) \
4310 +  include/linux/param.h \
4311 +  include/linux/resource.h \
4312 +  include/asm/resource.h \
4313 +  include/asm-generic/resource.h \
4314 +  include/linux/timer.h \
4315 +    $(wildcard include/config/timer/stats.h) \
4316 +  include/linux/ktime.h \
4317 +    $(wildcard include/config/ktime/scalar.h) \
4318 +  include/linux/hrtimer.h \
4319 +  include/linux/task_io_accounting.h \
4320 +    $(wildcard include/config/task/io/accounting.h) \
4321 +  include/linux/aio.h \
4322 +  include/linux/workqueue.h \
4323 +  include/linux/aio_abi.h \
4324 +  include/linux/uio.h \
4325 +  include/asm/hardirq.h \
4326 +  include/linux/irq.h \
4327 +    $(wildcard include/config/irq/per/cpu.h) \
4328 +    $(wildcard include/config/irq/release/method.h) \
4329 +    $(wildcard include/config/generic/pending/irq.h) \
4330 +    $(wildcard include/config/irqbalance.h) \
4331 +    $(wildcard include/config/auto/irq/affinity.h) \
4332 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
4333 +  include/asm/irq.h \
4334 +  include/asm-i386/mach-default/irq_vectors.h \
4335 +  include/asm-i386/mach-default/irq_vectors_limits.h \
4336 +  include/asm/irq_regs.h \
4337 +  include/asm/hw_irq.h \
4338 +  include/linux/profile.h \
4339 +  include/asm/sections.h \
4340 +  include/asm-generic/sections.h \
4341 +  include/linux/irq_cpustat.h \
4342 +  include/linux/if_ether.h \
4343 +  include/linux/skbuff.h \
4344 +    $(wildcard include/config/nf/conntrack.h) \
4345 +    $(wildcard include/config/bridge/netfilter.h) \
4346 +    $(wildcard include/config/vlan/8021q.h) \
4347 +    $(wildcard include/config/net/sched.h) \
4348 +    $(wildcard include/config/net/cls/act.h) \
4349 +    $(wildcard include/config/net/dma.h) \
4350 +    $(wildcard include/config/network/secmark.h) \
4351 +  include/linux/net.h \
4352 +  include/asm/socket.h \
4353 +  include/asm/sockios.h \
4354 +  include/linux/random.h \
4355 +  include/linux/sysctl.h \
4356 +    $(wildcard include/config/icmp/ipod.h) \
4357 +    $(wildcard include/config/web100/net100.h) \
4358 +    $(wildcard include/config/web100/stats.h) \
4359 +  include/linux/textsearch.h \
4360 +  include/net/checksum.h \
4361 +  include/asm/uaccess.h \
4362 +    $(wildcard include/config/x86/intel/usercopy.h) \
4363 +    $(wildcard include/config/x86/wp/works/ok.h) \
4364 +  include/asm/checksum.h \
4365 +  include/linux/in6.h \
4366 +  include/linux/dmaengine.h \
4367 +    $(wildcard include/config/dma/engine.h) \
4368 +  drivers/net/igb/kcompat.h \
4369 +    $(wildcard include/config/e1000/napi.h) \
4370 +    $(wildcard include/config/e1000e/napi.h) \
4371 +    $(wildcard include/config/ixgb/napi.h) \
4372 +    $(wildcard include/config/e1000/disable/packet/split.h) \
4373 +    $(wildcard include/config/igb/disable/packet/split.h) \
4374 +    $(wildcard include/config/net/poll/controller.h) \
4375 +    $(wildcard include/config/space/len.h) \
4376 +    $(wildcard include/config/netpoll.h) \
4377 +    $(wildcard include/config/netdevices/multiqueue.h) \
4378 +  include/linux/version.h \
4379 +  include/linux/netdevice.h \
4380 +    $(wildcard include/config/ax25.h) \
4381 +    $(wildcard include/config/tr.h) \
4382 +    $(wildcard include/config/net/ipip.h) \
4383 +    $(wildcard include/config/net/ipgre.h) \
4384 +    $(wildcard include/config/ipv6/sit.h) \
4385 +    $(wildcard include/config/ipv6/tunnel.h) \
4386 +    $(wildcard include/config/wireless/ext.h) \
4387 +    $(wildcard include/config/netpoll/trap.h) \
4388 +  include/linux/if.h \
4389 +  include/linux/socket.h \
4390 +  include/linux/sockios.h \
4391 +  include/linux/hdlc/ioctl.h \
4392 +  include/linux/if_packet.h \
4393 +  include/linux/etherdevice.h \
4394 +  include/linux/in.h \
4395 +  include/linux/ip.h \
4396 +  include/linux/udp.h \
4397 +  include/net/inet_sock.h \
4398 +    $(wildcard include/config/ipv6.h) \
4399 +  include/linux/jhash.h \
4400 +  include/net/flow.h \
4401 +    $(wildcard include/config/ipv6/mip6.h) \
4402 +  include/net/sock.h \
4403 +    $(wildcard include/config/security/network.h) \
4404 +  include/linux/security.h \
4405 +    $(wildcard include/config/security/network/xfrm.h) \
4406 +  include/linux/binfmts.h \
4407 +  include/linux/shm.h \
4408 +  include/asm/shmparam.h \
4409 +  include/asm/shmbuf.h \
4410 +  include/linux/msg.h \
4411 +  include/asm/msgbuf.h \
4412 +  include/linux/key.h \
4413 +  include/linux/xfrm.h \
4414 +  include/linux/filter.h \
4415 +  include/net/dst.h \
4416 +    $(wildcard include/config/net/cls/route.h) \
4417 +    $(wildcard include/config/xfrm.h) \
4418 +  include/linux/rtnetlink.h \
4419 +  include/linux/netlink.h \
4420 +  include/linux/if_link.h \
4421 +  include/linux/if_addr.h \
4422 +  include/linux/neighbour.h \
4423 +  include/net/neighbour.h \
4424 +  include/linux/seq_file.h \
4425 +  include/net/rtnetlink.h \
4426 +  include/net/netlink.h \
4427 +  include/net/request_sock.h \
4428 +  include/linux/mii.h \
4429 +  include/linux/latency.h \
4430 +  drivers/net/igb/e1000_regs.h \
4431 +  drivers/net/igb/e1000_defines.h \
4432 +    $(wildcard include/config/res.h) \
4433 +    $(wildcard include/config/fault.h) \
4434 +  drivers/net/igb/e1000_mac.h \
4435 +  drivers/net/igb/e1000_phy.h \
4436 +  drivers/net/igb/e1000_nvm.h \
4437 +  drivers/net/igb/e1000_manage.h \
4438 +  drivers/net/igb/e1000_82575.h \
4439 +
4440 +drivers/net/igb/e1000_api.o: $(deps_drivers/net/igb/e1000_api.o)
4441 +
4442 +$(deps_drivers/net/igb/e1000_api.o):
4443 diff -Nru vanilla/drivers/net/igb/e1000_defines.h linux-i686-2.6.22/drivers/net/igb/e1000_defines.h
4444 --- vanilla/drivers/net/igb/e1000_defines.h     1969-12-31 19:00:00.000000000 -0500
4445 +++ linux-i686-2.6.22/drivers/net/igb/e1000_defines.h   2009-07-16 19:25:22.000000000 -0400
4446 @@ -0,0 +1,1426 @@
4447 +/*******************************************************************************
4448 +
4449 +  Intel(R) Gigabit Ethernet Linux driver
4450 +  Copyright(c) 2007-2008 Intel Corporation.
4451 +
4452 +  This program is free software; you can redistribute it and/or modify it
4453 +  under the terms and conditions of the GNU General Public License,
4454 +  version 2, as published by the Free Software Foundation.
4455 +
4456 +  This program is distributed in the hope it will be useful, but WITHOUT
4457 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4458 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
4459 +  more details.
4460 +
4461 +  You should have received a copy of the GNU General Public License along with
4462 +  this program; if not, write to the Free Software Foundation, Inc.,
4463 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
4464 +
4465 +  The full GNU General Public License is included in this distribution in
4466 +  the file called "COPYING".
4467 +
4468 +  Contact Information:
4469 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
4470 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
4471 +
4472 +*******************************************************************************/
4473 +
4474 +#ifndef _E1000_DEFINES_H_
4475 +#define _E1000_DEFINES_H_
4476 +
4477 +/* Number of Transmit and Receive Descriptors must be a multiple of 8 */
4478 +#define REQ_TX_DESCRIPTOR_MULTIPLE  8
4479 +#define REQ_RX_DESCRIPTOR_MULTIPLE  8
4480 +
4481 +/* Definitions for power management and wakeup registers */
4482 +/* Wake Up Control */
4483 +#define E1000_WUC_APME       0x00000001 /* APM Enable */
4484 +#define E1000_WUC_PME_EN     0x00000002 /* PME Enable */
4485 +#define E1000_WUC_PME_STATUS 0x00000004 /* PME Status */
4486 +#define E1000_WUC_APMPME     0x00000008 /* Assert PME on APM Wakeup */
4487 +#define E1000_WUC_LSCWE      0x00000010 /* Link Status wake up enable */
4488 +#define E1000_WUC_LSCWO      0x00000020 /* Link Status wake up override */
4489 +#define E1000_WUC_SPM        0x80000000 /* Enable SPM */
4490 +#define E1000_WUC_PHY_WAKE   0x00000100 /* if PHY supports wakeup */
4491 +
4492 +/* Wake Up Filter Control */
4493 +#define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */
4494 +#define E1000_WUFC_MAG  0x00000002 /* Magic Packet Wakeup Enable */
4495 +#define E1000_WUFC_EX   0x00000004 /* Directed Exact Wakeup Enable */
4496 +#define E1000_WUFC_MC   0x00000008 /* Directed Multicast Wakeup Enable */
4497 +#define E1000_WUFC_BC   0x00000010 /* Broadcast Wakeup Enable */
4498 +#define E1000_WUFC_ARP  0x00000020 /* ARP Request Packet Wakeup Enable */
4499 +#define E1000_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */
4500 +#define E1000_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */
4501 +#define E1000_WUFC_IGNORE_TCO   0x00008000 /* Ignore WakeOn TCO packets */
4502 +#define E1000_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */
4503 +#define E1000_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */
4504 +#define E1000_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */
4505 +#define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */
4506 +#define E1000_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */
4507 +#define E1000_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */
4508 +#define E1000_WUFC_ALL_FILTERS  0x000F00FF /* Mask for all wakeup filters */
4509 +#define E1000_WUFC_FLX_OFFSET   16 /* Offset to the Flexible Filters bits */
4510 +#define E1000_WUFC_FLX_FILTERS  0x000F0000 /* Mask for the 4 flexible filters */
4511 +/*
4512 + * For 82576 to utilize Extended filter masks in addition to
4513 + * existing (filter) masks
4514 + */
4515 +#define E1000_WUFC_EXT_FLX_FILTERS      0x00300000 /* Ext. FLX filter mask */
4516 +
4517 +/* Wake Up Status */
4518 +#define E1000_WUS_LNKC         E1000_WUFC_LNKC
4519 +#define E1000_WUS_MAG          E1000_WUFC_MAG
4520 +#define E1000_WUS_EX           E1000_WUFC_EX
4521 +#define E1000_WUS_MC           E1000_WUFC_MC
4522 +#define E1000_WUS_BC           E1000_WUFC_BC
4523 +#define E1000_WUS_ARP          E1000_WUFC_ARP
4524 +#define E1000_WUS_IPV4         E1000_WUFC_IPV4
4525 +#define E1000_WUS_IPV6         E1000_WUFC_IPV6
4526 +#define E1000_WUS_FLX0         E1000_WUFC_FLX0
4527 +#define E1000_WUS_FLX1         E1000_WUFC_FLX1
4528 +#define E1000_WUS_FLX2         E1000_WUFC_FLX2
4529 +#define E1000_WUS_FLX3         E1000_WUFC_FLX3
4530 +#define E1000_WUS_FLX_FILTERS  E1000_WUFC_FLX_FILTERS
4531 +
4532 +/* Wake Up Packet Length */
4533 +#define E1000_WUPL_LENGTH_MASK 0x0FFF   /* Only the lower 12 bits are valid */
4534 +
4535 +/* Four Flexible Filters are supported */
4536 +#define E1000_FLEXIBLE_FILTER_COUNT_MAX 4
4537 +/* Two Extended Flexible Filters are supported (82576) */
4538 +#define E1000_EXT_FLEXIBLE_FILTER_COUNT_MAX     2
4539 +#define E1000_FHFT_LENGTH_OFFSET        0xFC /* Length byte in FHFT */
4540 +#define E1000_FHFT_LENGTH_MASK          0x0FF /* Length in lower byte */
4541 +
4542 +/* Each Flexible Filter is at most 128 (0x80) bytes in length */
4543 +#define E1000_FLEXIBLE_FILTER_SIZE_MAX  128
4544 +
4545 +#define E1000_FFLT_SIZE E1000_FLEXIBLE_FILTER_COUNT_MAX
4546 +#define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX
4547 +#define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX
4548 +
4549 +/* Extended Device Control */
4550 +#define E1000_CTRL_EXT_GPI0_EN   0x00000001 /* Maps SDP4 to GPI0 */
4551 +#define E1000_CTRL_EXT_GPI1_EN   0x00000002 /* Maps SDP5 to GPI1 */
4552 +#define E1000_CTRL_EXT_PHYINT_EN E1000_CTRL_EXT_GPI1_EN
4553 +#define E1000_CTRL_EXT_GPI2_EN   0x00000004 /* Maps SDP6 to GPI2 */
4554 +#define E1000_CTRL_EXT_GPI3_EN   0x00000008 /* Maps SDP7 to GPI3 */
4555 +/* Reserved (bits 4,5) in >= 82575 */
4556 +#define E1000_CTRL_EXT_SDP4_DATA 0x00000010 /* Value of SW Definable Pin 4 */
4557 +#define E1000_CTRL_EXT_SDP5_DATA 0x00000020 /* Value of SW Definable Pin 5 */
4558 +#define E1000_CTRL_EXT_PHY_INT   E1000_CTRL_EXT_SDP5_DATA
4559 +#define E1000_CTRL_EXT_SDP6_DATA 0x00000040 /* Value of SW Definable Pin 6 */
4560 +#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Definable Pin 7 */
4561 +/* SDP 4/5 (bits 8,9) are reserved in >= 82575 */
4562 +#define E1000_CTRL_EXT_SDP4_DIR  0x00000100 /* Direction of SDP4 0=in 1=out */
4563 +#define E1000_CTRL_EXT_SDP5_DIR  0x00000200 /* Direction of SDP5 0=in 1=out */
4564 +#define E1000_CTRL_EXT_SDP6_DIR  0x00000400 /* Direction of SDP6 0=in 1=out */
4565 +#define E1000_CTRL_EXT_SDP7_DIR  0x00000800 /* Direction of SDP7 0=in 1=out */
4566 +#define E1000_CTRL_EXT_ASDCHK    0x00001000 /* Initiate an ASD sequence */
4567 +#define E1000_CTRL_EXT_EE_RST    0x00002000 /* Reinitialize from EEPROM */
4568 +#define E1000_CTRL_EXT_IPS       0x00004000 /* Invert Power State */
4569 +/* Physical Func Reset Done Indication */
4570 +#define E1000_CTRL_EXT_PFRSTD    0x00004000
4571 +#define E1000_CTRL_EXT_SPD_BYPS  0x00008000 /* Speed Select Bypass */
4572 +#define E1000_CTRL_EXT_RO_DIS    0x00020000 /* Relaxed Ordering disable */
4573 +#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
4574 +#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
4575 +#define E1000_CTRL_EXT_LINK_MODE_TBI  0x00C00000
4576 +#define E1000_CTRL_EXT_LINK_MODE_KMRN    0x00000000
4577 +#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES  0x00C00000
4578 +#define E1000_CTRL_EXT_LINK_MODE_PCIX_SERDES  0x00800000
4579 +#define E1000_CTRL_EXT_LINK_MODE_SGMII   0x00800000
4580 +#define E1000_CTRL_EXT_EIAME          0x01000000
4581 +#define E1000_CTRL_EXT_IRCA           0x00000001
4582 +#define E1000_CTRL_EXT_WR_WMARK_MASK  0x03000000
4583 +#define E1000_CTRL_EXT_WR_WMARK_256   0x00000000
4584 +#define E1000_CTRL_EXT_WR_WMARK_320   0x01000000
4585 +#define E1000_CTRL_EXT_WR_WMARK_384   0x02000000
4586 +#define E1000_CTRL_EXT_WR_WMARK_448   0x03000000
4587 +#define E1000_CTRL_EXT_CANC           0x04000000 /* Interrupt delay cancellation */
4588 +#define E1000_CTRL_EXT_DRV_LOAD       0x10000000 /* Driver loaded bit for FW */
4589 +/* IAME enable bit (27) was removed in >= 82575 */
4590 +#define E1000_CTRL_EXT_IAME           0x08000000 /* Interrupt acknowledge Auto-mask */
4591 +#define E1000_CTRL_EXT_INT_TIMER_CLR  0x20000000 /* Clear Interrupt timers after IMS clear */
4592 +#define E1000_CRTL_EXT_PB_PAREN       0x01000000 /* packet buffer parity error detection enabled */
4593 +#define E1000_CTRL_EXT_DF_PAREN       0x02000000 /* descriptor FIFO parity error detection enable */
4594 +#define E1000_CTRL_EXT_GHOST_PAREN    0x40000000
4595 +#define E1000_CTRL_EXT_PBA_CLR        0x80000000 /* PBA Clear */
4596 +#define E1000_I2CCMD_REG_ADDR_SHIFT   16
4597 +#define E1000_I2CCMD_REG_ADDR         0x00FF0000
4598 +#define E1000_I2CCMD_PHY_ADDR_SHIFT   24
4599 +#define E1000_I2CCMD_PHY_ADDR         0x07000000
4600 +#define E1000_I2CCMD_OPCODE_READ      0x08000000
4601 +#define E1000_I2CCMD_OPCODE_WRITE     0x00000000
4602 +#define E1000_I2CCMD_RESET            0x10000000
4603 +#define E1000_I2CCMD_READY            0x20000000
4604 +#define E1000_I2CCMD_INTERRUPT_ENA    0x40000000
4605 +#define E1000_I2CCMD_ERROR            0x80000000
4606 +#define E1000_MAX_SGMII_PHY_REG_ADDR  255
4607 +#define E1000_I2CCMD_PHY_TIMEOUT      200
4608 +#define E1000_IVAR_VALID        0x80
4609 +#define E1000_GPIE_NSICR        0x00000001
4610 +#define E1000_GPIE_MSIX_MODE    0x00000010
4611 +#define E1000_GPIE_EIAME        0x40000000
4612 +#define E1000_GPIE_PBA          0x80000000
4613 +
4614 +/* Receive Descriptor bit definitions */
4615 +#define E1000_RXD_STAT_DD       0x01    /* Descriptor Done */
4616 +#define E1000_RXD_STAT_EOP      0x02    /* End of Packet */
4617 +#define E1000_RXD_STAT_IXSM     0x04    /* Ignore checksum */
4618 +#define E1000_RXD_STAT_VP       0x08    /* IEEE VLAN Packet */
4619 +#define E1000_RXD_STAT_UDPCS    0x10    /* UDP xsum calculated */
4620 +#define E1000_RXD_STAT_TCPCS    0x20    /* TCP xsum calculated */
4621 +#define E1000_RXD_STAT_IPCS     0x40    /* IP xsum calculated */
4622 +#define E1000_RXD_STAT_PIF      0x80    /* passed in-exact filter */
4623 +#define E1000_RXD_STAT_CRCV     0x100   /* Speculative CRC Valid */
4624 +#define E1000_RXD_STAT_IPIDV    0x200   /* IP identification valid */
4625 +#define E1000_RXD_STAT_UDPV     0x400   /* Valid UDP checksum */
4626 +#define E1000_RXD_STAT_DYNINT   0x800   /* Pkt caused INT via DYNINT */
4627 +#define E1000_RXD_STAT_ACK      0x8000  /* ACK Packet indication */
4628 +#define E1000_RXD_ERR_CE        0x01    /* CRC Error */
4629 +#define E1000_RXD_ERR_SE        0x02    /* Symbol Error */
4630 +#define E1000_RXD_ERR_SEQ       0x04    /* Sequence Error */
4631 +#define E1000_RXD_ERR_CXE       0x10    /* Carrier Extension Error */
4632 +#define E1000_RXD_ERR_TCPE      0x20    /* TCP/UDP Checksum Error */
4633 +#define E1000_RXD_ERR_IPE       0x40    /* IP Checksum Error */
4634 +#define E1000_RXD_ERR_RXE       0x80    /* Rx Data Error */
4635 +#define E1000_RXD_SPC_VLAN_MASK 0x0FFF  /* VLAN ID is in lower 12 bits */
4636 +#define E1000_RXD_SPC_PRI_MASK  0xE000  /* Priority is in upper 3 bits */
4637 +#define E1000_RXD_SPC_PRI_SHIFT 13
4638 +#define E1000_RXD_SPC_CFI_MASK  0x1000  /* CFI is bit 12 */
4639 +#define E1000_RXD_SPC_CFI_SHIFT 12
4640 +
4641 +#define E1000_RXDEXT_STATERR_CE    0x01000000
4642 +#define E1000_RXDEXT_STATERR_SE    0x02000000
4643 +#define E1000_RXDEXT_STATERR_SEQ   0x04000000
4644 +#define E1000_RXDEXT_STATERR_CXE   0x10000000
4645 +#define E1000_RXDEXT_STATERR_TCPE  0x20000000
4646 +#define E1000_RXDEXT_STATERR_IPE   0x40000000
4647 +#define E1000_RXDEXT_STATERR_RXE   0x80000000
4648 +
4649 +/* mask to determine if packets should be dropped due to frame errors */
4650 +#define E1000_RXD_ERR_FRAME_ERR_MASK ( \
4651 +    E1000_RXD_ERR_CE  |                \
4652 +    E1000_RXD_ERR_SE  |                \
4653 +    E1000_RXD_ERR_SEQ |                \
4654 +    E1000_RXD_ERR_CXE |                \
4655 +    E1000_RXD_ERR_RXE)
4656 +
4657 +/* Same mask, but for extended and packet split descriptors */
4658 +#define E1000_RXDEXT_ERR_FRAME_ERR_MASK ( \
4659 +    E1000_RXDEXT_STATERR_CE  |            \
4660 +    E1000_RXDEXT_STATERR_SE  |            \
4661 +    E1000_RXDEXT_STATERR_SEQ |            \
4662 +    E1000_RXDEXT_STATERR_CXE |            \
4663 +    E1000_RXDEXT_STATERR_RXE)
4664 +
4665 +#define E1000_MRQC_ENABLE_MASK                 0x00000007
4666 +#define E1000_MRQC_ENABLE_RSS_2Q               0x00000001
4667 +#define E1000_MRQC_ENABLE_RSS_INT              0x00000004
4668 +#define E1000_MRQC_RSS_FIELD_MASK              0xFFFF0000
4669 +#define E1000_MRQC_RSS_FIELD_IPV4_TCP          0x00010000
4670 +#define E1000_MRQC_RSS_FIELD_IPV4              0x00020000
4671 +#define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX       0x00040000
4672 +#define E1000_MRQC_RSS_FIELD_IPV6_EX           0x00080000
4673 +#define E1000_MRQC_RSS_FIELD_IPV6              0x00100000
4674 +#define E1000_MRQC_RSS_FIELD_IPV6_TCP          0x00200000
4675 +
4676 +#define E1000_RXDPS_HDRSTAT_HDRSP              0x00008000
4677 +#define E1000_RXDPS_HDRSTAT_HDRLEN_MASK        0x000003FF
4678 +
4679 +/* Management Control */
4680 +#define E1000_MANC_SMBUS_EN      0x00000001 /* SMBus Enabled - RO */
4681 +#define E1000_MANC_ASF_EN        0x00000002 /* ASF Enabled - RO */
4682 +#define E1000_MANC_R_ON_FORCE    0x00000004 /* Reset on Force TCO - RO */
4683 +#define E1000_MANC_RMCP_EN       0x00000100 /* Enable RCMP 026Fh Filtering */
4684 +#define E1000_MANC_0298_EN       0x00000200 /* Enable RCMP 0298h Filtering */
4685 +#define E1000_MANC_IPV4_EN       0x00000400 /* Enable IPv4 */
4686 +#define E1000_MANC_IPV6_EN       0x00000800 /* Enable IPv6 */
4687 +#define E1000_MANC_SNAP_EN       0x00001000 /* Accept LLC/SNAP */
4688 +#define E1000_MANC_ARP_EN        0x00002000 /* Enable ARP Request Filtering */
4689 +/* Enable Neighbor Discovery Filtering */
4690 +#define E1000_MANC_NEIGHBOR_EN   0x00004000
4691 +#define E1000_MANC_ARP_RES_EN    0x00008000 /* Enable ARP response Filtering */
4692 +#define E1000_MANC_TCO_RESET     0x00010000 /* TCO Reset Occurred */
4693 +#define E1000_MANC_RCV_TCO_EN    0x00020000 /* Receive TCO Packets Enabled */
4694 +#define E1000_MANC_REPORT_STATUS 0x00040000 /* Status Reporting Enabled */
4695 +#define E1000_MANC_RCV_ALL       0x00080000 /* Receive All Enabled */
4696 +#define E1000_MANC_BLK_PHY_RST_ON_IDE   0x00040000 /* Block phy resets */
4697 +/* Enable MAC address filtering */
4698 +#define E1000_MANC_EN_MAC_ADDR_FILTER   0x00100000
4699 +/* Enable MNG packets to host memory */
4700 +#define E1000_MANC_EN_MNG2HOST   0x00200000
4701 +/* Enable IP address filtering */
4702 +#define E1000_MANC_EN_IP_ADDR_FILTER    0x00400000
4703 +#define E1000_MANC_EN_XSUM_FILTER   0x00800000 /* Enable checksum filtering */
4704 +#define E1000_MANC_BR_EN            0x01000000 /* Enable broadcast filtering */
4705 +#define E1000_MANC_SMB_REQ       0x01000000 /* SMBus Request */
4706 +#define E1000_MANC_SMB_GNT       0x02000000 /* SMBus Grant */
4707 +#define E1000_MANC_SMB_CLK_IN    0x04000000 /* SMBus Clock In */
4708 +#define E1000_MANC_SMB_DATA_IN   0x08000000 /* SMBus Data In */
4709 +#define E1000_MANC_SMB_DATA_OUT  0x10000000 /* SMBus Data Out */
4710 +#define E1000_MANC_SMB_CLK_OUT   0x20000000 /* SMBus Clock Out */
4711 +
4712 +#define E1000_MANC_SMB_DATA_OUT_SHIFT  28 /* SMBus Data Out Shift */
4713 +#define E1000_MANC_SMB_CLK_OUT_SHIFT   29 /* SMBus Clock Out Shift */
4714 +
4715 +/* Receive Control */
4716 +#define E1000_RCTL_RST            0x00000001    /* Software reset */
4717 +#define E1000_RCTL_EN             0x00000002    /* enable */
4718 +#define E1000_RCTL_SBP            0x00000004    /* store bad packet */
4719 +#define E1000_RCTL_UPE            0x00000008    /* unicast promiscuous enable */
4720 +#define E1000_RCTL_MPE            0x00000010    /* multicast promiscuous enab */
4721 +#define E1000_RCTL_LPE            0x00000020    /* long packet enable */
4722 +#define E1000_RCTL_LBM_NO         0x00000000    /* no loopback mode */
4723 +#define E1000_RCTL_LBM_MAC        0x00000040    /* MAC loopback mode */
4724 +#define E1000_RCTL_LBM_SLP        0x00000080    /* serial link loopback mode */
4725 +#define E1000_RCTL_LBM_TCVR       0x000000C0    /* tcvr loopback mode */
4726 +#define E1000_RCTL_DTYP_MASK      0x00000C00    /* Descriptor type mask */
4727 +#define E1000_RCTL_DTYP_PS        0x00000400    /* Packet Split descriptor */
4728 +#define E1000_RCTL_RDMTS_HALF     0x00000000    /* rx desc min threshold size */
4729 +#define E1000_RCTL_RDMTS_QUAT     0x00000100    /* rx desc min threshold size */
4730 +#define E1000_RCTL_RDMTS_EIGTH    0x00000200    /* rx desc min threshold size */
4731 +#define E1000_RCTL_MO_SHIFT       12            /* multicast offset shift */
4732 +#define E1000_RCTL_MO_0           0x00000000    /* multicast offset 11:0 */
4733 +#define E1000_RCTL_MO_1           0x00001000    /* multicast offset 12:1 */
4734 +#define E1000_RCTL_MO_2           0x00002000    /* multicast offset 13:2 */
4735 +#define E1000_RCTL_MO_3           0x00003000    /* multicast offset 15:4 */
4736 +#define E1000_RCTL_MDR            0x00004000    /* multicast desc ring 0 */
4737 +#define E1000_RCTL_BAM            0x00008000    /* broadcast enable */
4738 +/* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */
4739 +#define E1000_RCTL_SZ_2048        0x00000000    /* rx buffer size 2048 */
4740 +#define E1000_RCTL_SZ_1024        0x00010000    /* rx buffer size 1024 */
4741 +#define E1000_RCTL_SZ_512         0x00020000    /* rx buffer size 512 */
4742 +#define E1000_RCTL_SZ_256         0x00030000    /* rx buffer size 256 */
4743 +/* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */
4744 +#define E1000_RCTL_SZ_16384       0x00010000    /* rx buffer size 16384 */
4745 +#define E1000_RCTL_SZ_8192        0x00020000    /* rx buffer size 8192 */
4746 +#define E1000_RCTL_SZ_4096        0x00030000    /* rx buffer size 4096 */
4747 +#define E1000_RCTL_VFE            0x00040000    /* vlan filter enable */
4748 +#define E1000_RCTL_CFIEN          0x00080000    /* canonical form enable */
4749 +#define E1000_RCTL_CFI            0x00100000    /* canonical form indicator */
4750 +#define E1000_RCTL_DPF            0x00400000    /* discard pause frames */
4751 +#define E1000_RCTL_PMCF           0x00800000    /* pass MAC control frames */
4752 +#define E1000_RCTL_BSEX           0x02000000    /* Buffer size extension */
4753 +#define E1000_RCTL_SECRC          0x04000000    /* Strip Ethernet CRC */
4754 +#define E1000_RCTL_FLXBUF_MASK    0x78000000    /* Flexible buffer size */
4755 +#define E1000_RCTL_FLXBUF_SHIFT   27            /* Flexible buffer shift */
4756 +
4757 +/*
4758 + * Use byte values for the following shift parameters
4759 + * Usage:
4760 + *     psrctl |= (((ROUNDUP(value0, 128) >> E1000_PSRCTL_BSIZE0_SHIFT) &
4761 + *                  E1000_PSRCTL_BSIZE0_MASK) |
4762 + *                ((ROUNDUP(value1, 1024) >> E1000_PSRCTL_BSIZE1_SHIFT) &
4763 + *                  E1000_PSRCTL_BSIZE1_MASK) |
4764 + *                ((ROUNDUP(value2, 1024) << E1000_PSRCTL_BSIZE2_SHIFT) &
4765 + *                  E1000_PSRCTL_BSIZE2_MASK) |
4766 + *                ((ROUNDUP(value3, 1024) << E1000_PSRCTL_BSIZE3_SHIFT) |;
4767 + *                  E1000_PSRCTL_BSIZE3_MASK))
4768 + * where value0 = [128..16256],  default=256
4769 + *       value1 = [1024..64512], default=4096
4770 + *       value2 = [0..64512],    default=4096
4771 + *       value3 = [0..64512],    default=0
4772 + */
4773 +
4774 +#define E1000_PSRCTL_BSIZE0_MASK   0x0000007F
4775 +#define E1000_PSRCTL_BSIZE1_MASK   0x00003F00
4776 +#define E1000_PSRCTL_BSIZE2_MASK   0x003F0000
4777 +#define E1000_PSRCTL_BSIZE3_MASK   0x3F000000
4778 +
4779 +#define E1000_PSRCTL_BSIZE0_SHIFT  7            /* Shift _right_ 7 */
4780 +#define E1000_PSRCTL_BSIZE1_SHIFT  2            /* Shift _right_ 2 */
4781 +#define E1000_PSRCTL_BSIZE2_SHIFT  6            /* Shift _left_ 6 */
4782 +#define E1000_PSRCTL_BSIZE3_SHIFT 14            /* Shift _left_ 14 */
4783 +
4784 +/* SWFW_SYNC Definitions */
4785 +#define E1000_SWFW_EEP_SM   0x1
4786 +#define E1000_SWFW_PHY0_SM  0x2
4787 +#define E1000_SWFW_PHY1_SM  0x4
4788 +#define E1000_SWFW_CSR_SM   0x8
4789 +
4790 +/* FACTPS Definitions */
4791 +#define E1000_FACTPS_LFS    0x40000000  /* LAN Function Select */
4792 +/* Device Control */
4793 +#define E1000_CTRL_FD       0x00000001  /* Full duplex.0=half; 1=full */
4794 +#define E1000_CTRL_BEM      0x00000002  /* Endian Mode.0=little,1=big */
4795 +#define E1000_CTRL_PRIOR    0x00000004  /* Priority on PCI. 0=rx,1=fair */
4796 +#define E1000_CTRL_GIO_MASTER_DISABLE 0x00000004 /*Blocks new Master requests */
4797 +#define E1000_CTRL_LRST     0x00000008  /* Link reset. 0=normal,1=reset */
4798 +#define E1000_CTRL_TME      0x00000010  /* Test mode. 0=normal,1=test */
4799 +#define E1000_CTRL_SLE      0x00000020  /* Serial Link on 0=dis,1=en */
4800 +#define E1000_CTRL_ASDE     0x00000020  /* Auto-speed detect enable */
4801 +#define E1000_CTRL_SLU      0x00000040  /* Set link up (Force Link) */
4802 +#define E1000_CTRL_ILOS     0x00000080  /* Invert Loss-Of Signal */
4803 +#define E1000_CTRL_SPD_SEL  0x00000300  /* Speed Select Mask */
4804 +#define E1000_CTRL_SPD_10   0x00000000  /* Force 10Mb */
4805 +#define E1000_CTRL_SPD_100  0x00000100  /* Force 100Mb */
4806 +#define E1000_CTRL_SPD_1000 0x00000200  /* Force 1Gb */
4807 +#define E1000_CTRL_BEM32    0x00000400  /* Big Endian 32 mode */
4808 +#define E1000_CTRL_FRCSPD   0x00000800  /* Force Speed */
4809 +#define E1000_CTRL_FRCDPX   0x00001000  /* Force Duplex */
4810 +#define E1000_CTRL_D_UD_EN  0x00002000  /* Dock/Undock enable */
4811 +#define E1000_CTRL_D_UD_POLARITY 0x00004000 /* Defined polarity of Dock/Undock indication in SDP[0] */
4812 +#define E1000_CTRL_FORCE_PHY_RESET 0x00008000 /* Reset both PHY ports, through PHYRST_N pin */
4813 +#define E1000_CTRL_EXT_LINK_EN 0x00010000 /* enable link status from external LINK_0 and LINK_1 pins */
4814 +#define E1000_CTRL_SWDPIN0  0x00040000  /* SWDPIN 0 value */
4815 +#define E1000_CTRL_SWDPIN1  0x00080000  /* SWDPIN 1 value */
4816 +#define E1000_CTRL_SWDPIN2  0x00100000  /* SWDPIN 2 value */
4817 +#define E1000_CTRL_SWDPIN3  0x00200000  /* SWDPIN 3 value */
4818 +#define E1000_CTRL_SWDPIO0  0x00400000  /* SWDPIN 0 Input or output */
4819 +#define E1000_CTRL_SWDPIO1  0x00800000  /* SWDPIN 1 input or output */
4820 +#define E1000_CTRL_SWDPIO2  0x01000000  /* SWDPIN 2 input or output */
4821 +#define E1000_CTRL_SWDPIO3  0x02000000  /* SWDPIN 3 input or output */
4822 +#define E1000_CTRL_RST      0x04000000  /* Global reset */
4823 +#define E1000_CTRL_RFCE     0x08000000  /* Receive Flow Control enable */
4824 +#define E1000_CTRL_TFCE     0x10000000  /* Transmit flow control enable */
4825 +#define E1000_CTRL_RTE      0x20000000  /* Routing tag enable */
4826 +#define E1000_CTRL_VME      0x40000000  /* IEEE VLAN mode enable */
4827 +#define E1000_CTRL_PHY_RST  0x80000000  /* PHY Reset */
4828 +#define E1000_CTRL_SW2FW_INT 0x02000000  /* Initiate an interrupt to manageability engine */
4829 +#define E1000_CTRL_I2C_ENA  0x02000000  /* I2C enable */
4830 +
4831 +/*
4832 + * Bit definitions for the Management Data IO (MDIO) and Management Data
4833 + * Clock (MDC) pins in the Device Control Register.
4834 + */
4835 +#define E1000_CTRL_PHY_RESET_DIR  E1000_CTRL_SWDPIO0
4836 +#define E1000_CTRL_PHY_RESET      E1000_CTRL_SWDPIN0
4837 +#define E1000_CTRL_MDIO_DIR       E1000_CTRL_SWDPIO2
4838 +#define E1000_CTRL_MDIO           E1000_CTRL_SWDPIN2
4839 +#define E1000_CTRL_MDC_DIR        E1000_CTRL_SWDPIO3
4840 +#define E1000_CTRL_MDC            E1000_CTRL_SWDPIN3
4841 +#define E1000_CTRL_PHY_RESET_DIR4 E1000_CTRL_EXT_SDP4_DIR
4842 +#define E1000_CTRL_PHY_RESET4     E1000_CTRL_EXT_SDP4_DATA
4843 +
4844 +#define E1000_CONNSW_ENRGSRC             0x4
4845 +#define E1000_PCS_CFG_PCS_EN             8
4846 +#define E1000_PCS_LCTL_FLV_LINK_UP       1
4847 +#define E1000_PCS_LCTL_FSV_10            0
4848 +#define E1000_PCS_LCTL_FSV_100           2
4849 +#define E1000_PCS_LCTL_FSV_1000          4
4850 +#define E1000_PCS_LCTL_FDV_FULL          8
4851 +#define E1000_PCS_LCTL_FSD               0x10
4852 +#define E1000_PCS_LCTL_FORCE_LINK        0x20
4853 +#define E1000_PCS_LCTL_LOW_LINK_LATCH    0x40
4854 +#define E1000_PCS_LCTL_FORCE_FCTRL       0x80
4855 +#define E1000_PCS_LCTL_AN_ENABLE         0x10000
4856 +#define E1000_PCS_LCTL_AN_RESTART        0x20000
4857 +#define E1000_PCS_LCTL_AN_TIMEOUT        0x40000
4858 +#define E1000_PCS_LCTL_AN_SGMII_BYPASS   0x80000
4859 +#define E1000_PCS_LCTL_AN_SGMII_TRIGGER  0x100000
4860 +#define E1000_PCS_LCTL_FAST_LINK_TIMER   0x1000000
4861 +#define E1000_PCS_LCTL_LINK_OK_FIX       0x2000000
4862 +#define E1000_PCS_LCTL_CRS_ON_NI         0x4000000
4863 +#define E1000_ENABLE_SERDES_LOOPBACK     0x0410
4864 +
4865 +#define E1000_PCS_LSTS_LINK_OK           1
4866 +#define E1000_PCS_LSTS_SPEED_10          0
4867 +#define E1000_PCS_LSTS_SPEED_100         2
4868 +#define E1000_PCS_LSTS_SPEED_1000        4
4869 +#define E1000_PCS_LSTS_DUPLEX_FULL       8
4870 +#define E1000_PCS_LSTS_SYNK_OK           0x10
4871 +#define E1000_PCS_LSTS_AN_COMPLETE       0x10000
4872 +#define E1000_PCS_LSTS_AN_PAGE_RX        0x20000
4873 +#define E1000_PCS_LSTS_AN_TIMED_OUT      0x40000
4874 +#define E1000_PCS_LSTS_AN_REMOTE_FAULT   0x80000
4875 +#define E1000_PCS_LSTS_AN_ERROR_RWS      0x100000
4876 +
4877 +/* Device Status */
4878 +#define E1000_STATUS_FD         0x00000001      /* Full duplex.0=half,1=full */
4879 +#define E1000_STATUS_LU         0x00000002      /* Link up.0=no,1=link */
4880 +#define E1000_STATUS_FUNC_MASK  0x0000000C      /* PCI Function Mask */
4881 +#define E1000_STATUS_FUNC_SHIFT 2
4882 +#define E1000_STATUS_FUNC_0     0x00000000      /* Function 0 */
4883 +#define E1000_STATUS_FUNC_1     0x00000004      /* Function 1 */
4884 +#define E1000_STATUS_TXOFF      0x00000010      /* transmission paused */
4885 +#define E1000_STATUS_TBIMODE    0x00000020      /* TBI mode */
4886 +#define E1000_STATUS_SPEED_MASK 0x000000C0
4887 +#define E1000_STATUS_SPEED_10   0x00000000      /* Speed 10Mb/s */
4888 +#define E1000_STATUS_SPEED_100  0x00000040      /* Speed 100Mb/s */
4889 +#define E1000_STATUS_SPEED_1000 0x00000080      /* Speed 1000Mb/s */
4890 +#define E1000_STATUS_LAN_INIT_DONE 0x00000200   /* Lan Init Completion by NVM */
4891 +#define E1000_STATUS_ASDV       0x00000300      /* Auto speed detect value */
4892 +#define E1000_STATUS_DOCK_CI    0x00000800      /* Change in Dock/Undock state. Clear on write '0'. */
4893 +#define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */
4894 +#define E1000_STATUS_MTXCKOK    0x00000400      /* MTX clock running OK */
4895 +#define E1000_STATUS_PCI66      0x00000800      /* In 66Mhz slot */
4896 +#define E1000_STATUS_BUS64      0x00001000      /* In 64 bit slot */
4897 +#define E1000_STATUS_PCIX_MODE  0x00002000      /* PCI-X mode */
4898 +#define E1000_STATUS_PCIX_SPEED 0x0000C000      /* PCI-X bus speed */
4899 +#define E1000_STATUS_BMC_SKU_0  0x00100000 /* BMC USB redirect disabled */
4900 +#define E1000_STATUS_BMC_SKU_1  0x00200000 /* BMC SRAM disabled */
4901 +#define E1000_STATUS_BMC_SKU_2  0x00400000 /* BMC SDRAM disabled */
4902 +#define E1000_STATUS_BMC_CRYPTO 0x00800000 /* BMC crypto disabled */
4903 +#define E1000_STATUS_BMC_LITE   0x01000000 /* BMC external code execution disabled */
4904 +#define E1000_STATUS_RGMII_ENABLE 0x02000000 /* RGMII disabled */
4905 +#define E1000_STATUS_FUSE_8       0x04000000
4906 +#define E1000_STATUS_FUSE_9       0x08000000
4907 +#define E1000_STATUS_SERDES0_DIS  0x10000000 /* SERDES disabled on port 0 */
4908 +#define E1000_STATUS_SERDES1_DIS  0x20000000 /* SERDES disabled on port 1 */
4909 +
4910 +/* Constants used to interpret the masked PCI-X bus speed. */
4911 +#define E1000_STATUS_PCIX_SPEED_66  0x00000000 /* PCI-X bus speed  50-66 MHz */
4912 +#define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus speed  66-100 MHz */
4913 +#define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus speed 100-133 MHz */
4914 +
4915 +#define SPEED_10    10
4916 +#define SPEED_100   100
4917 +#define SPEED_1000  1000
4918 +#define HALF_DUPLEX 1
4919 +#define FULL_DUPLEX 2
4920 +
4921 +#define PHY_FORCE_TIME   20
4922 +
4923 +#define ADVERTISE_10_HALF                 0x0001
4924 +#define ADVERTISE_10_FULL                 0x0002
4925 +#define ADVERTISE_100_HALF                0x0004
4926 +#define ADVERTISE_100_FULL                0x0008
4927 +#define ADVERTISE_1000_HALF               0x0010 /* Not used, just FYI */
4928 +#define ADVERTISE_1000_FULL               0x0020
4929 +
4930 +/* 1000/H is not supported, nor spec-compliant. */
4931 +#define E1000_ALL_SPEED_DUPLEX ( ADVERTISE_10_HALF |   ADVERTISE_10_FULL | \
4932 +                                ADVERTISE_100_HALF |  ADVERTISE_100_FULL | \
4933 +                                                     ADVERTISE_1000_FULL)
4934 +#define E1000_ALL_NOT_GIG      ( ADVERTISE_10_HALF |   ADVERTISE_10_FULL | \
4935 +                                ADVERTISE_100_HALF |  ADVERTISE_100_FULL)
4936 +#define E1000_ALL_100_SPEED    (ADVERTISE_100_HALF |  ADVERTISE_100_FULL)
4937 +#define E1000_ALL_10_SPEED      (ADVERTISE_10_HALF |   ADVERTISE_10_FULL)
4938 +#define E1000_ALL_FULL_DUPLEX   (ADVERTISE_10_FULL |  ADVERTISE_100_FULL | \
4939 +                                                     ADVERTISE_1000_FULL)
4940 +#define E1000_ALL_HALF_DUPLEX   (ADVERTISE_10_HALF |  ADVERTISE_100_HALF)
4941 +
4942 +#define AUTONEG_ADVERTISE_SPEED_DEFAULT   E1000_ALL_SPEED_DUPLEX
4943 +
4944 +/* LED Control */
4945 +#define E1000_LEDCTL_LED0_MODE_MASK       0x0000000F
4946 +#define E1000_LEDCTL_LED0_MODE_SHIFT      0
4947 +#define E1000_LEDCTL_LED0_BLINK_RATE      0x00000020
4948 +#define E1000_LEDCTL_LED0_IVRT            0x00000040
4949 +#define E1000_LEDCTL_LED0_BLINK           0x00000080
4950 +#define E1000_LEDCTL_LED1_MODE_MASK       0x00000F00
4951 +#define E1000_LEDCTL_LED1_MODE_SHIFT      8
4952 +#define E1000_LEDCTL_LED1_BLINK_RATE      0x00002000
4953 +#define E1000_LEDCTL_LED1_IVRT            0x00004000
4954 +#define E1000_LEDCTL_LED1_BLINK           0x00008000
4955 +#define E1000_LEDCTL_LED2_MODE_MASK       0x000F0000
4956 +#define E1000_LEDCTL_LED2_MODE_SHIFT      16
4957 +#define E1000_LEDCTL_LED2_BLINK_RATE      0x00200000
4958 +#define E1000_LEDCTL_LED2_IVRT            0x00400000
4959 +#define E1000_LEDCTL_LED2_BLINK           0x00800000
4960 +#define E1000_LEDCTL_LED3_MODE_MASK       0x0F000000
4961 +#define E1000_LEDCTL_LED3_MODE_SHIFT      24
4962 +#define E1000_LEDCTL_LED3_BLINK_RATE      0x20000000
4963 +#define E1000_LEDCTL_LED3_IVRT            0x40000000
4964 +#define E1000_LEDCTL_LED3_BLINK           0x80000000
4965 +
4966 +#define E1000_LEDCTL_MODE_LINK_10_1000  0x0
4967 +#define E1000_LEDCTL_MODE_LINK_100_1000 0x1
4968 +#define E1000_LEDCTL_MODE_LINK_UP       0x2
4969 +#define E1000_LEDCTL_MODE_ACTIVITY      0x3
4970 +#define E1000_LEDCTL_MODE_LINK_ACTIVITY 0x4
4971 +#define E1000_LEDCTL_MODE_LINK_10       0x5
4972 +#define E1000_LEDCTL_MODE_LINK_100      0x6
4973 +#define E1000_LEDCTL_MODE_LINK_1000     0x7
4974 +#define E1000_LEDCTL_MODE_PCIX_MODE     0x8
4975 +#define E1000_LEDCTL_MODE_FULL_DUPLEX   0x9
4976 +#define E1000_LEDCTL_MODE_COLLISION     0xA
4977 +#define E1000_LEDCTL_MODE_BUS_SPEED     0xB
4978 +#define E1000_LEDCTL_MODE_BUS_SIZE      0xC
4979 +#define E1000_LEDCTL_MODE_PAUSED        0xD
4980 +#define E1000_LEDCTL_MODE_LED_ON        0xE
4981 +#define E1000_LEDCTL_MODE_LED_OFF       0xF
4982 +
4983 +/* Transmit Descriptor bit definitions */
4984 +#define E1000_TXD_DTYP_D     0x00100000 /* Data Descriptor */
4985 +#define E1000_TXD_DTYP_C     0x00000000 /* Context Descriptor */
4986 +#define E1000_TXD_POPTS_SHIFT 8         /* POPTS shift */
4987 +#define E1000_TXD_POPTS_IXSM 0x01       /* Insert IP checksum */
4988 +#define E1000_TXD_POPTS_TXSM 0x02       /* Insert TCP/UDP checksum */
4989 +#define E1000_TXD_CMD_EOP    0x01000000 /* End of Packet */
4990 +#define E1000_TXD_CMD_IFCS   0x02000000 /* Insert FCS (Ethernet CRC) */
4991 +#define E1000_TXD_CMD_IC     0x04000000 /* Insert Checksum */
4992 +#define E1000_TXD_CMD_RS     0x08000000 /* Report Status */
4993 +#define E1000_TXD_CMD_RPS    0x10000000 /* Report Packet Sent */
4994 +#define E1000_TXD_CMD_DEXT   0x20000000 /* Descriptor extension (0 = legacy) */
4995 +#define E1000_TXD_CMD_VLE    0x40000000 /* Add VLAN tag */
4996 +#define E1000_TXD_CMD_IDE    0x80000000 /* Enable Tidv register */
4997 +#define E1000_TXD_STAT_DD    0x00000001 /* Descriptor Done */
4998 +#define E1000_TXD_STAT_EC    0x00000002 /* Excess Collisions */
4999 +#define E1000_TXD_STAT_LC    0x00000004 /* Late Collisions */
5000 +#define E1000_TXD_STAT_TU    0x00000008 /* Transmit underrun */
5001 +#define E1000_TXD_CMD_TCP    0x01000000 /* TCP packet */
5002 +#define E1000_TXD_CMD_IP     0x02000000 /* IP packet */
5003 +#define E1000_TXD_CMD_TSE    0x04000000 /* TCP Seg enable */
5004 +#define E1000_TXD_STAT_TC    0x00000004 /* Tx Underrun */
5005 +/* Extended desc bits for Linksec and timesync */
5006 +
5007 +/* Transmit Control */
5008 +#define E1000_TCTL_RST    0x00000001    /* software reset */
5009 +#define E1000_TCTL_EN     0x00000002    /* enable tx */
5010 +#define E1000_TCTL_BCE    0x00000004    /* busy check enable */
5011 +#define E1000_TCTL_PSP    0x00000008    /* pad short packets */
5012 +#define E1000_TCTL_CT     0x00000ff0    /* collision threshold */
5013 +#define E1000_TCTL_COLD   0x003ff000    /* collision distance */
5014 +#define E1000_TCTL_SWXOFF 0x00400000    /* SW Xoff transmission */
5015 +#define E1000_TCTL_PBE    0x00800000    /* Packet Burst Enable */
5016 +#define E1000_TCTL_RTLC   0x01000000    /* Re-transmit on late collision */
5017 +#define E1000_TCTL_NRTU   0x02000000    /* No Re-transmit on underrun */
5018 +#define E1000_TCTL_MULR   0x10000000    /* Multiple request support */
5019 +
5020 +/* Transmit Arbitration Count */
5021 +#define E1000_TARC0_ENABLE     0x00000400   /* Enable Tx Queue 0 */
5022 +
5023 +/* SerDes Control */
5024 +#define E1000_SCTL_DISABLE_SERDES_LOOPBACK 0x0400
5025 +
5026 +/* Receive Checksum Control */
5027 +#define E1000_RXCSUM_PCSS_MASK 0x000000FF   /* Packet Checksum Start */
5028 +#define E1000_RXCSUM_IPOFL     0x00000100   /* IPv4 checksum offload */
5029 +#define E1000_RXCSUM_TUOFL     0x00000200   /* TCP / UDP checksum offload */
5030 +#define E1000_RXCSUM_IPV6OFL   0x00000400   /* IPv6 checksum offload */
5031 +#define E1000_RXCSUM_CRCOFL    0x00000800   /* CRC32 offload enable */
5032 +#define E1000_RXCSUM_IPPCSE    0x00001000   /* IP payload checksum enable */
5033 +#define E1000_RXCSUM_PCSD      0x00002000   /* packet checksum disabled */
5034 +
5035 +/* Header split receive */
5036 +#define E1000_RFCTL_ISCSI_DIS           0x00000001
5037 +#define E1000_RFCTL_ISCSI_DWC_MASK      0x0000003E
5038 +#define E1000_RFCTL_ISCSI_DWC_SHIFT     1
5039 +#define E1000_RFCTL_NFSW_DIS            0x00000040
5040 +#define E1000_RFCTL_NFSR_DIS            0x00000080
5041 +#define E1000_RFCTL_NFS_VER_MASK        0x00000300
5042 +#define E1000_RFCTL_NFS_VER_SHIFT       8
5043 +#define E1000_RFCTL_IPV6_DIS            0x00000400
5044 +#define E1000_RFCTL_IPV6_XSUM_DIS       0x00000800
5045 +#define E1000_RFCTL_ACK_DIS             0x00001000
5046 +#define E1000_RFCTL_ACKD_DIS            0x00002000
5047 +#define E1000_RFCTL_IPFRSP_DIS          0x00004000
5048 +#define E1000_RFCTL_EXTEN               0x00008000
5049 +#define E1000_RFCTL_IPV6_EX_DIS         0x00010000
5050 +#define E1000_RFCTL_NEW_IPV6_EXT_DIS    0x00020000
5051 +#define E1000_RFCTL_LEF                 0x00040000
5052 +
5053 +/* Collision related configuration parameters */
5054 +#define E1000_COLLISION_THRESHOLD       15
5055 +#define E1000_CT_SHIFT                  4
5056 +#define E1000_COLLISION_DISTANCE        63
5057 +#define E1000_COLD_SHIFT                12
5058 +
5059 +/* Default values for the transmit IPG register */
5060 +#define DEFAULT_82543_TIPG_IPGT_FIBER  9
5061 +#define DEFAULT_82543_TIPG_IPGT_COPPER 8
5062 +
5063 +#define E1000_TIPG_IPGT_MASK  0x000003FF
5064 +#define E1000_TIPG_IPGR1_MASK 0x000FFC00
5065 +#define E1000_TIPG_IPGR2_MASK 0x3FF00000
5066 +
5067 +#define DEFAULT_82543_TIPG_IPGR1 8
5068 +#define E1000_TIPG_IPGR1_SHIFT  10
5069 +
5070 +#define DEFAULT_82543_TIPG_IPGR2 6
5071 +#define DEFAULT_80003ES2LAN_TIPG_IPGR2 7
5072 +#define E1000_TIPG_IPGR2_SHIFT  20
5073 +
5074 +/* Ethertype field values */
5075 +#define ETHERNET_IEEE_VLAN_TYPE 0x8100  /* 802.3ac packet */
5076 +
5077 +#define ETHERNET_FCS_SIZE       4
5078 +#define MAX_JUMBO_FRAME_SIZE    0x3F00
5079 +
5080 +/* Extended Configuration Control and Size */
5081 +#define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP      0x00000020
5082 +#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE       0x00000001
5083 +#define E1000_EXTCNF_CTRL_SWFLAG                 0x00000020
5084 +#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK   0x00FF0000
5085 +#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT          16
5086 +#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK   0x0FFF0000
5087 +#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT          16
5088 +
5089 +#define E1000_PHY_CTRL_SPD_EN             0x00000001
5090 +#define E1000_PHY_CTRL_D0A_LPLU           0x00000002
5091 +#define E1000_PHY_CTRL_NOND0A_LPLU        0x00000004
5092 +#define E1000_PHY_CTRL_NOND0A_GBE_DISABLE 0x00000008
5093 +#define E1000_PHY_CTRL_GBE_DISABLE        0x00000040
5094 +
5095 +#define E1000_KABGTXD_BGSQLBIAS           0x00050000
5096 +
5097 +/* PBA constants */
5098 +#define E1000_PBA_6K  0x0006   /* 6KB */
5099 +#define E1000_PBA_8K  0x0008    /* 8KB */
5100 +#define E1000_PBA_12K 0x000C    /* 12KB */
5101 +#define E1000_PBA_16K 0x0010    /* 16KB */
5102 +#define E1000_PBA_20K 0x0014
5103 +#define E1000_PBA_22K 0x0016
5104 +#define E1000_PBA_24K 0x0018
5105 +#define E1000_PBA_30K 0x001E
5106 +#define E1000_PBA_32K 0x0020
5107 +#define E1000_PBA_34K 0x0022
5108 +#define E1000_PBA_38K 0x0026
5109 +#define E1000_PBA_40K 0x0028
5110 +#define E1000_PBA_48K 0x0030    /* 48KB */
5111 +#define E1000_PBA_64K 0x0040    /* 64KB */
5112 +
5113 +#define E1000_PBS_16K E1000_PBA_16K
5114 +#define E1000_PBS_24K E1000_PBA_24K
5115 +
5116 +#define IFS_MAX       80
5117 +#define IFS_MIN       40
5118 +#define IFS_RATIO     4
5119 +#define IFS_STEP      10
5120 +#define MIN_NUM_XMITS 1000
5121 +
5122 +/* SW Semaphore Register */
5123 +#define E1000_SWSM_SMBI         0x00000001 /* Driver Semaphore bit */
5124 +#define E1000_SWSM_SWESMBI      0x00000002 /* FW Semaphore bit */
5125 +#define E1000_SWSM_WMNG         0x00000004 /* Wake MNG Clock */
5126 +#define E1000_SWSM_DRV_LOAD     0x00000008 /* Driver Loaded Bit */
5127 +
5128 +/* Interrupt Cause Read */
5129 +#define E1000_ICR_TXDW          0x00000001 /* Transmit desc written back */
5130 +#define E1000_ICR_TXQE          0x00000002 /* Transmit Queue empty */
5131 +#define E1000_ICR_LSC           0x00000004 /* Link Status Change */
5132 +#define E1000_ICR_RXSEQ         0x00000008 /* rx sequence error */
5133 +#define E1000_ICR_RXDMT0        0x00000010 /* rx desc min. threshold (0) */
5134 +#define E1000_ICR_RXO           0x00000040 /* rx overrun */
5135 +#define E1000_ICR_RXT0          0x00000080 /* rx timer intr (ring 0) */
5136 +#define E1000_ICR_VMMB          0x00000100 /* VM MB event */
5137 +#define E1000_ICR_MDAC          0x00000200 /* MDIO access complete */
5138 +#define E1000_ICR_RXCFG         0x00000400 /* Rx /c/ ordered set */
5139 +#define E1000_ICR_GPI_EN0       0x00000800 /* GP Int 0 */
5140 +#define E1000_ICR_GPI_EN1       0x00001000 /* GP Int 1 */
5141 +#define E1000_ICR_GPI_EN2       0x00002000 /* GP Int 2 */
5142 +#define E1000_ICR_GPI_EN3       0x00004000 /* GP Int 3 */
5143 +#define E1000_ICR_TXD_LOW       0x00008000
5144 +#define E1000_ICR_SRPD          0x00010000
5145 +#define E1000_ICR_ACK           0x00020000 /* Receive Ack frame */
5146 +#define E1000_ICR_MNG           0x00040000 /* Manageability event */
5147 +#define E1000_ICR_DOCK          0x00080000 /* Dock/Undock */
5148 +#define E1000_ICR_INT_ASSERTED  0x80000000 /* If this bit asserted, the driver should claim the interrupt */
5149 +#define E1000_ICR_RXD_FIFO_PAR0 0x00100000 /* queue 0 Rx descriptor FIFO parity error */
5150 +#define E1000_ICR_TXD_FIFO_PAR0 0x00200000 /* queue 0 Tx descriptor FIFO parity error */
5151 +#define E1000_ICR_HOST_ARB_PAR  0x00400000 /* host arb read buffer parity error */
5152 +#define E1000_ICR_PB_PAR        0x00800000 /* packet buffer parity error */
5153 +#define E1000_ICR_RXD_FIFO_PAR1 0x01000000 /* queue 1 Rx descriptor FIFO parity error */
5154 +#define E1000_ICR_TXD_FIFO_PAR1 0x02000000 /* queue 1 Tx descriptor FIFO parity error */
5155 +#define E1000_ICR_ALL_PARITY    0x03F00000 /* all parity error bits */
5156 +#define E1000_ICR_DSW           0x00000020 /* FW changed the status of DISSW bit in the FWSM */
5157 +#define E1000_ICR_PHYINT        0x00001000 /* LAN connected device generates an interrupt */
5158 +#define E1000_ICR_EPRST         0x00100000 /* ME hardware reset occurs */
5159 +
5160 +/* Extended Interrupt Cause Read */
5161 +#define E1000_EICR_RX_QUEUE0    0x00000001 /* Rx Queue 0 Interrupt */
5162 +#define E1000_EICR_RX_QUEUE1    0x00000002 /* Rx Queue 1 Interrupt */
5163 +#define E1000_EICR_RX_QUEUE2    0x00000004 /* Rx Queue 2 Interrupt */
5164 +#define E1000_EICR_RX_QUEUE3    0x00000008 /* Rx Queue 3 Interrupt */
5165 +#define E1000_EICR_TX_QUEUE0    0x00000100 /* Tx Queue 0 Interrupt */
5166 +#define E1000_EICR_TX_QUEUE1    0x00000200 /* Tx Queue 1 Interrupt */
5167 +#define E1000_EICR_TX_QUEUE2    0x00000400 /* Tx Queue 2 Interrupt */
5168 +#define E1000_EICR_TX_QUEUE3    0x00000800 /* Tx Queue 3 Interrupt */
5169 +#define E1000_EICR_TCP_TIMER    0x40000000 /* TCP Timer */
5170 +#define E1000_EICR_OTHER        0x80000000 /* Interrupt Cause Active */
5171 +/* TCP Timer */
5172 +#define E1000_TCPTIMER_KS       0x00000100 /* KickStart */
5173 +#define E1000_TCPTIMER_COUNT_ENABLE       0x00000200 /* Count Enable */
5174 +#define E1000_TCPTIMER_COUNT_FINISH       0x00000400 /* Count finish */
5175 +#define E1000_TCPTIMER_LOOP     0x00000800 /* Loop */
5176 +
5177 +/*
5178 + * This defines the bits that are set in the Interrupt Mask
5179 + * Set/Read Register.  Each bit is documented below:
5180 + *   o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0)
5181 + *   o RXSEQ  = Receive Sequence Error
5182 + */
5183 +#define POLL_IMS_ENABLE_MASK ( \
5184 +    E1000_IMS_RXDMT0 |    \
5185 +    E1000_IMS_RXSEQ)
5186 +
5187 +/*
5188 + * This defines the bits that are set in the Interrupt Mask
5189 + * Set/Read Register.  Each bit is documented below:
5190 + *   o RXT0   = Receiver Timer Interrupt (ring 0)
5191 + *   o TXDW   = Transmit Descriptor Written Back
5192 + *   o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0)
5193 + *   o RXSEQ  = Receive Sequence Error
5194 + *   o LSC    = Link Status Change
5195 + */
5196 +#define IMS_ENABLE_MASK ( \
5197 +    E1000_IMS_RXT0   |    \
5198 +    E1000_IMS_TXDW   |    \
5199 +    E1000_IMS_RXDMT0 |    \
5200 +    E1000_IMS_RXSEQ  |    \
5201 +    E1000_IMS_LSC)
5202 +
5203 +/* Interrupt Mask Set */
5204 +#define E1000_IMS_TXDW      E1000_ICR_TXDW      /* Transmit desc written back */
5205 +#define E1000_IMS_TXQE      E1000_ICR_TXQE      /* Transmit Queue empty */
5206 +#define E1000_IMS_LSC       E1000_ICR_LSC       /* Link Status Change */
5207 +#define E1000_IMS_VMMB      E1000_ICR_VMMB      /* Mail box activity */
5208 +#define E1000_IMS_RXSEQ     E1000_ICR_RXSEQ     /* rx sequence error */
5209 +#define E1000_IMS_RXDMT0    E1000_ICR_RXDMT0    /* rx desc min. threshold */
5210 +#define E1000_IMS_RXO       E1000_ICR_RXO       /* rx overrun */
5211 +#define E1000_IMS_RXT0      E1000_ICR_RXT0      /* rx timer intr */
5212 +#define E1000_IMS_MDAC      E1000_ICR_MDAC      /* MDIO access complete */
5213 +#define E1000_IMS_RXCFG     E1000_ICR_RXCFG     /* Rx /c/ ordered set */
5214 +#define E1000_IMS_GPI_EN0   E1000_ICR_GPI_EN0   /* GP Int 0 */
5215 +#define E1000_IMS_GPI_EN1   E1000_ICR_GPI_EN1   /* GP Int 1 */
5216 +#define E1000_IMS_GPI_EN2   E1000_ICR_GPI_EN2   /* GP Int 2 */
5217 +#define E1000_IMS_GPI_EN3   E1000_ICR_GPI_EN3   /* GP Int 3 */
5218 +#define E1000_IMS_TXD_LOW   E1000_ICR_TXD_LOW
5219 +#define E1000_IMS_SRPD      E1000_ICR_SRPD
5220 +#define E1000_IMS_ACK       E1000_ICR_ACK       /* Receive Ack frame */
5221 +#define E1000_IMS_MNG       E1000_ICR_MNG       /* Manageability event */
5222 +#define E1000_IMS_DOCK      E1000_ICR_DOCK      /* Dock/Undock */
5223 +#define E1000_IMS_RXD_FIFO_PAR0 E1000_ICR_RXD_FIFO_PAR0 /* queue 0 Rx descriptor FIFO parity error */
5224 +#define E1000_IMS_TXD_FIFO_PAR0 E1000_ICR_TXD_FIFO_PAR0 /* queue 0 Tx descriptor FIFO parity error */
5225 +#define E1000_IMS_HOST_ARB_PAR  E1000_ICR_HOST_ARB_PAR  /* host arb read buffer parity error */
5226 +#define E1000_IMS_PB_PAR        E1000_ICR_PB_PAR        /* packet buffer parity error */
5227 +#define E1000_IMS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */
5228 +#define E1000_IMS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */
5229 +#define E1000_IMS_DSW       E1000_ICR_DSW
5230 +#define E1000_IMS_PHYINT    E1000_ICR_PHYINT
5231 +#define E1000_IMS_EPRST     E1000_ICR_EPRST
5232 +
5233 +/* Extended Interrupt Mask Set */
5234 +#define E1000_EIMS_RX_QUEUE0    E1000_EICR_RX_QUEUE0 /* Rx Queue 0 Interrupt */
5235 +#define E1000_EIMS_RX_QUEUE1    E1000_EICR_RX_QUEUE1 /* Rx Queue 1 Interrupt */
5236 +#define E1000_EIMS_RX_QUEUE2    E1000_EICR_RX_QUEUE2 /* Rx Queue 2 Interrupt */
5237 +#define E1000_EIMS_RX_QUEUE3    E1000_EICR_RX_QUEUE3 /* Rx Queue 3 Interrupt */
5238 +#define E1000_EIMS_TX_QUEUE0    E1000_EICR_TX_QUEUE0 /* Tx Queue 0 Interrupt */
5239 +#define E1000_EIMS_TX_QUEUE1    E1000_EICR_TX_QUEUE1 /* Tx Queue 1 Interrupt */
5240 +#define E1000_EIMS_TX_QUEUE2    E1000_EICR_TX_QUEUE2 /* Tx Queue 2 Interrupt */
5241 +#define E1000_EIMS_TX_QUEUE3    E1000_EICR_TX_QUEUE3 /* Tx Queue 3 Interrupt */
5242 +#define E1000_EIMS_TCP_TIMER    E1000_EICR_TCP_TIMER /* TCP Timer */
5243 +#define E1000_EIMS_OTHER        E1000_EICR_OTHER   /* Interrupt Cause Active */
5244 +
5245 +/* Interrupt Cause Set */
5246 +#define E1000_ICS_TXDW      E1000_ICR_TXDW      /* Transmit desc written back */
5247 +#define E1000_ICS_TXQE      E1000_ICR_TXQE      /* Transmit Queue empty */
5248 +#define E1000_ICS_LSC       E1000_ICR_LSC       /* Link Status Change */
5249 +#define E1000_ICS_RXSEQ     E1000_ICR_RXSEQ     /* rx sequence error */
5250 +#define E1000_ICS_RXDMT0    E1000_ICR_RXDMT0    /* rx desc min. threshold */
5251 +#define E1000_ICS_RXO       E1000_ICR_RXO       /* rx overrun */
5252 +#define E1000_ICS_RXT0      E1000_ICR_RXT0      /* rx timer intr */
5253 +#define E1000_ICS_MDAC      E1000_ICR_MDAC      /* MDIO access complete */
5254 +#define E1000_ICS_RXCFG     E1000_ICR_RXCFG     /* Rx /c/ ordered set */
5255 +#define E1000_ICS_GPI_EN0   E1000_ICR_GPI_EN0   /* GP Int 0 */
5256 +#define E1000_ICS_GPI_EN1   E1000_ICR_GPI_EN1   /* GP Int 1 */
5257 +#define E1000_ICS_GPI_EN2   E1000_ICR_GPI_EN2   /* GP Int 2 */
5258 +#define E1000_ICS_GPI_EN3   E1000_ICR_GPI_EN3   /* GP Int 3 */
5259 +#define E1000_ICS_TXD_LOW   E1000_ICR_TXD_LOW
5260 +#define E1000_ICS_SRPD      E1000_ICR_SRPD
5261 +#define E1000_ICS_ACK       E1000_ICR_ACK       /* Receive Ack frame */
5262 +#define E1000_ICS_MNG       E1000_ICR_MNG       /* Manageability event */
5263 +#define E1000_ICS_DOCK      E1000_ICR_DOCK      /* Dock/Undock */
5264 +#define E1000_ICS_RXD_FIFO_PAR0 E1000_ICR_RXD_FIFO_PAR0 /* queue 0 Rx descriptor FIFO parity error */
5265 +#define E1000_ICS_TXD_FIFO_PAR0 E1000_ICR_TXD_FIFO_PAR0 /* queue 0 Tx descriptor FIFO parity error */
5266 +#define E1000_ICS_HOST_ARB_PAR  E1000_ICR_HOST_ARB_PAR  /* host arb read buffer parity error */
5267 +#define E1000_ICS_PB_PAR        E1000_ICR_PB_PAR        /* packet buffer parity error */
5268 +#define E1000_ICS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */
5269 +#define E1000_ICS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */
5270 +#define E1000_ICS_DSW       E1000_ICR_DSW
5271 +#define E1000_ICS_PHYINT    E1000_ICR_PHYINT
5272 +#define E1000_ICS_EPRST     E1000_ICR_EPRST
5273 +
5274 +/* Extended Interrupt Cause Set */
5275 +#define E1000_EICS_RX_QUEUE0    E1000_EICR_RX_QUEUE0 /* Rx Queue 0 Interrupt */
5276 +#define E1000_EICS_RX_QUEUE1    E1000_EICR_RX_QUEUE1 /* Rx Queue 1 Interrupt */
5277 +#define E1000_EICS_RX_QUEUE2    E1000_EICR_RX_QUEUE2 /* Rx Queue 2 Interrupt */
5278 +#define E1000_EICS_RX_QUEUE3    E1000_EICR_RX_QUEUE3 /* Rx Queue 3 Interrupt */
5279 +#define E1000_EICS_TX_QUEUE0    E1000_EICR_TX_QUEUE0 /* Tx Queue 0 Interrupt */
5280 +#define E1000_EICS_TX_QUEUE1    E1000_EICR_TX_QUEUE1 /* Tx Queue 1 Interrupt */
5281 +#define E1000_EICS_TX_QUEUE2    E1000_EICR_TX_QUEUE2 /* Tx Queue 2 Interrupt */
5282 +#define E1000_EICS_TX_QUEUE3    E1000_EICR_TX_QUEUE3 /* Tx Queue 3 Interrupt */
5283 +#define E1000_EICS_TCP_TIMER    E1000_EICR_TCP_TIMER /* TCP Timer */
5284 +#define E1000_EICS_OTHER        E1000_EICR_OTHER   /* Interrupt Cause Active */
5285 +
5286 +/* Transmit Descriptor Control */
5287 +#define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */
5288 +#define E1000_TXDCTL_HTHRESH 0x00003F00 /* TXDCTL Host Threshold */
5289 +#define E1000_TXDCTL_WTHRESH 0x003F0000 /* TXDCTL Writeback Threshold */
5290 +#define E1000_TXDCTL_GRAN    0x01000000 /* TXDCTL Granularity */
5291 +#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */
5292 +#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */
5293 +#define E1000_TXDCTL_MAX_TX_DESC_PREFETCH 0x0100001F /* GRAN=1, PTHRESH=31 */
5294 +/* Enable the counting of descriptors still to be processed. */
5295 +#define E1000_TXDCTL_COUNT_DESC 0x00400000
5296 +
5297 +/* Flow Control Constants */
5298 +#define FLOW_CONTROL_ADDRESS_LOW  0x00C28001
5299 +#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100
5300 +#define FLOW_CONTROL_TYPE         0x8808
5301 +
5302 +/* 802.1q VLAN Packet Size */
5303 +#define VLAN_TAG_SIZE              4    /* 802.3ac tag (not DMA'd) */
5304 +#define E1000_VLAN_FILTER_TBL_SIZE 128  /* VLAN Filter Table (4096 bits) */
5305 +
5306 +/* Receive Address */
5307 +/*
5308 + * Number of high/low register pairs in the RAR. The RAR (Receive Address
5309 + * Registers) holds the directed and multicast addresses that we monitor.
5310 + * Technically, we have 16 spots.  However, we reserve one of these spots
5311 + * (RAR[15]) for our directed address used by controllers with
5312 + * manageability enabled, allowing us room for 15 multicast addresses.
5313 + */
5314 +#define E1000_RAR_ENTRIES     15
5315 +#define E1000_RAH_AV  0x80000000        /* Receive descriptor valid */
5316 +
5317 +/* Error Codes */
5318 +#define E1000_SUCCESS      0
5319 +#define E1000_ERR_NVM      1
5320 +#define E1000_ERR_PHY      2
5321 +#define E1000_ERR_CONFIG   3
5322 +#define E1000_ERR_PARAM    4
5323 +#define E1000_ERR_MAC_INIT 5
5324 +#define E1000_ERR_PHY_TYPE 6
5325 +#define E1000_ERR_RESET   9
5326 +#define E1000_ERR_MASTER_REQUESTS_PENDING 10
5327 +#define E1000_ERR_HOST_INTERFACE_COMMAND 11
5328 +#define E1000_BLK_PHY_RESET   12
5329 +#define E1000_ERR_SWFW_SYNC 13
5330 +#define E1000_NOT_IMPLEMENTED 14
5331 +
5332 +/* Loop limit on how long we wait for auto-negotiation to complete */
5333 +#define FIBER_LINK_UP_LIMIT               50
5334 +#define COPPER_LINK_UP_LIMIT              10
5335 +#define PHY_AUTO_NEG_LIMIT                45
5336 +#define PHY_FORCE_LIMIT                   20
5337 +/* Number of 100 microseconds we wait for PCI Express master disable */
5338 +#define MASTER_DISABLE_TIMEOUT      800
5339 +/* Number of milliseconds we wait for PHY configuration done after MAC reset */
5340 +#define PHY_CFG_TIMEOUT             100
5341 +/* Number of 2 milliseconds we wait for acquiring MDIO ownership. */
5342 +#define MDIO_OWNERSHIP_TIMEOUT      10
5343 +/* Number of milliseconds for NVM auto read done after MAC reset. */
5344 +#define AUTO_READ_DONE_TIMEOUT      10
5345 +
5346 +/* Flow Control */
5347 +#define E1000_FCRTH_RTH  0x0000FFF8     /* Mask Bits[15:3] for RTH */
5348 +#define E1000_FCRTH_XFCE 0x80000000     /* External Flow Control Enable */
5349 +#define E1000_FCRTL_RTL  0x0000FFF8     /* Mask Bits[15:3] for RTL */
5350 +#define E1000_FCRTL_XONE 0x80000000     /* Enable XON frame transmission */
5351 +
5352 +/* Transmit Configuration Word */
5353 +#define E1000_TXCW_FD         0x00000020        /* TXCW full duplex */
5354 +#define E1000_TXCW_HD         0x00000040        /* TXCW half duplex */
5355 +#define E1000_TXCW_PAUSE      0x00000080        /* TXCW sym pause request */
5356 +#define E1000_TXCW_ASM_DIR    0x00000100        /* TXCW astm pause direction */
5357 +#define E1000_TXCW_PAUSE_MASK 0x00000180        /* TXCW pause request mask */
5358 +#define E1000_TXCW_RF         0x00003000        /* TXCW remote fault */
5359 +#define E1000_TXCW_NP         0x00008000        /* TXCW next page */
5360 +#define E1000_TXCW_CW         0x0000ffff        /* TxConfigWord mask */
5361 +#define E1000_TXCW_TXC        0x40000000        /* Transmit Config control */
5362 +#define E1000_TXCW_ANE        0x80000000        /* Auto-neg enable */
5363 +
5364 +/* Receive Configuration Word */
5365 +#define E1000_RXCW_CW         0x0000ffff        /* RxConfigWord mask */
5366 +#define E1000_RXCW_NC         0x04000000        /* Receive config no carrier */
5367 +#define E1000_RXCW_IV         0x08000000        /* Receive config invalid */
5368 +#define E1000_RXCW_CC         0x10000000        /* Receive config change */
5369 +#define E1000_RXCW_C          0x20000000        /* Receive config */
5370 +#define E1000_RXCW_SYNCH      0x40000000        /* Receive config synch */
5371 +#define E1000_RXCW_ANC        0x80000000        /* Auto-neg complete */
5372 +
5373 +/* PCI Express Control */
5374 +#define E1000_GCR_RXD_NO_SNOOP          0x00000001
5375 +#define E1000_GCR_RXDSCW_NO_SNOOP       0x00000002
5376 +#define E1000_GCR_RXDSCR_NO_SNOOP       0x00000004
5377 +#define E1000_GCR_TXD_NO_SNOOP          0x00000008
5378 +#define E1000_GCR_TXDSCW_NO_SNOOP       0x00000010
5379 +#define E1000_GCR_TXDSCR_NO_SNOOP       0x00000020
5380 +
5381 +#define PCIE_NO_SNOOP_ALL (E1000_GCR_RXD_NO_SNOOP         | \
5382 +                           E1000_GCR_RXDSCW_NO_SNOOP      | \
5383 +                           E1000_GCR_RXDSCR_NO_SNOOP      | \
5384 +                           E1000_GCR_TXD_NO_SNOOP         | \
5385 +                           E1000_GCR_TXDSCW_NO_SNOOP      | \
5386 +                           E1000_GCR_TXDSCR_NO_SNOOP)
5387 +
5388 +/* PHY Control Register */
5389 +#define MII_CR_SPEED_SELECT_MSB 0x0040  /* bits 6,13: 10=1000, 01=100, 00=10 */
5390 +#define MII_CR_COLL_TEST_ENABLE 0x0080  /* Collision test enable */
5391 +#define MII_CR_FULL_DUPLEX      0x0100  /* FDX =1, half duplex =0 */
5392 +#define MII_CR_RESTART_AUTO_NEG 0x0200  /* Restart auto negotiation */
5393 +#define MII_CR_ISOLATE          0x0400  /* Isolate PHY from MII */
5394 +#define MII_CR_POWER_DOWN       0x0800  /* Power down */
5395 +#define MII_CR_AUTO_NEG_EN      0x1000  /* Auto Neg Enable */
5396 +#define MII_CR_SPEED_SELECT_LSB 0x2000  /* bits 6,13: 10=1000, 01=100, 00=10 */
5397 +#define MII_CR_LOOPBACK         0x4000  /* 0 = normal, 1 = loopback */
5398 +#define MII_CR_RESET            0x8000  /* 0 = normal, 1 = PHY reset */
5399 +#define MII_CR_SPEED_1000       0x0040
5400 +#define MII_CR_SPEED_100        0x2000
5401 +#define MII_CR_SPEED_10         0x0000
5402 +
5403 +/* PHY Status Register */
5404 +#define MII_SR_EXTENDED_CAPS     0x0001 /* Extended register capabilities */
5405 +#define MII_SR_JABBER_DETECT     0x0002 /* Jabber Detected */
5406 +#define MII_SR_LINK_STATUS       0x0004 /* Link Status 1 = link */
5407 +#define MII_SR_AUTONEG_CAPS      0x0008 /* Auto Neg Capable */
5408 +#define MII_SR_REMOTE_FAULT      0x0010 /* Remote Fault Detect */
5409 +#define MII_SR_AUTONEG_COMPLETE  0x0020 /* Auto Neg Complete */
5410 +#define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */
5411 +#define MII_SR_EXTENDED_STATUS   0x0100 /* Ext. status info in Reg 0x0F */
5412 +#define MII_SR_100T2_HD_CAPS     0x0200 /* 100T2 Half Duplex Capable */
5413 +#define MII_SR_100T2_FD_CAPS     0x0400 /* 100T2 Full Duplex Capable */
5414 +#define MII_SR_10T_HD_CAPS       0x0800 /* 10T   Half Duplex Capable */
5415 +#define MII_SR_10T_FD_CAPS       0x1000 /* 10T   Full Duplex Capable */
5416 +#define MII_SR_100X_HD_CAPS      0x2000 /* 100X  Half Duplex Capable */
5417 +#define MII_SR_100X_FD_CAPS      0x4000 /* 100X  Full Duplex Capable */
5418 +#define MII_SR_100T4_CAPS        0x8000 /* 100T4 Capable */
5419 +
5420 +/* Autoneg Advertisement Register */
5421 +#define NWAY_AR_SELECTOR_FIELD   0x0001   /* indicates IEEE 802.3 CSMA/CD */
5422 +#define NWAY_AR_10T_HD_CAPS      0x0020   /* 10T   Half Duplex Capable */
5423 +#define NWAY_AR_10T_FD_CAPS      0x0040   /* 10T   Full Duplex Capable */
5424 +#define NWAY_AR_100TX_HD_CAPS    0x0080   /* 100TX Half Duplex Capable */
5425 +#define NWAY_AR_100TX_FD_CAPS    0x0100   /* 100TX Full Duplex Capable */
5426 +#define NWAY_AR_100T4_CAPS       0x0200   /* 100T4 Capable */
5427 +#define NWAY_AR_PAUSE            0x0400   /* Pause operation desired */
5428 +#define NWAY_AR_ASM_DIR          0x0800   /* Asymmetric Pause Direction bit */
5429 +#define NWAY_AR_REMOTE_FAULT     0x2000   /* Remote Fault detected */
5430 +#define NWAY_AR_NEXT_PAGE        0x8000   /* Next Page ability supported */
5431 +
5432 +/* Link Partner Ability Register (Base Page) */
5433 +#define NWAY_LPAR_SELECTOR_FIELD 0x0000 /* LP protocol selector field */
5434 +#define NWAY_LPAR_10T_HD_CAPS    0x0020 /* LP is 10T   Half Duplex Capable */
5435 +#define NWAY_LPAR_10T_FD_CAPS    0x0040 /* LP is 10T   Full Duplex Capable */
5436 +#define NWAY_LPAR_100TX_HD_CAPS  0x0080 /* LP is 100TX Half Duplex Capable */
5437 +#define NWAY_LPAR_100TX_FD_CAPS  0x0100 /* LP is 100TX Full Duplex Capable */
5438 +#define NWAY_LPAR_100T4_CAPS     0x0200 /* LP is 100T4 Capable */
5439 +#define NWAY_LPAR_PAUSE          0x0400 /* LP Pause operation desired */
5440 +#define NWAY_LPAR_ASM_DIR        0x0800 /* LP Asymmetric Pause Direction bit */
5441 +#define NWAY_LPAR_REMOTE_FAULT   0x2000 /* LP has detected Remote Fault */
5442 +#define NWAY_LPAR_ACKNOWLEDGE    0x4000 /* LP has rx'd link code word */
5443 +#define NWAY_LPAR_NEXT_PAGE      0x8000 /* Next Page ability supported */
5444 +
5445 +/* Autoneg Expansion Register */
5446 +#define NWAY_ER_LP_NWAY_CAPS      0x0001 /* LP has Auto Neg Capability */
5447 +#define NWAY_ER_PAGE_RXD          0x0002 /* LP is 10T   Half Duplex Capable */
5448 +#define NWAY_ER_NEXT_PAGE_CAPS    0x0004 /* LP is 10T   Full Duplex Capable */
5449 +#define NWAY_ER_LP_NEXT_PAGE_CAPS 0x0008 /* LP is 100TX Half Duplex Capable */
5450 +#define NWAY_ER_PAR_DETECT_FAULT  0x0010 /* LP is 100TX Full Duplex Capable */
5451 +
5452 +/* 1000BASE-T Control Register */
5453 +#define CR_1000T_ASYM_PAUSE      0x0080 /* Advertise asymmetric pause bit */
5454 +#define CR_1000T_HD_CAPS         0x0100 /* Advertise 1000T HD capability */
5455 +#define CR_1000T_FD_CAPS         0x0200 /* Advertise 1000T FD capability  */
5456 +#define CR_1000T_REPEATER_DTE    0x0400 /* 1=Repeater/switch device port */
5457 +                                        /* 0=DTE device */
5458 +#define CR_1000T_MS_VALUE        0x0800 /* 1=Configure PHY as Master */
5459 +                                        /* 0=Configure PHY as Slave */
5460 +#define CR_1000T_MS_ENABLE       0x1000 /* 1=Master/Slave manual config value */
5461 +                                        /* 0=Automatic Master/Slave config */
5462 +#define CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */
5463 +#define CR_1000T_TEST_MODE_1     0x2000 /* Transmit Waveform test */
5464 +#define CR_1000T_TEST_MODE_2     0x4000 /* Master Transmit Jitter test */
5465 +#define CR_1000T_TEST_MODE_3     0x6000 /* Slave Transmit Jitter test */
5466 +#define CR_1000T_TEST_MODE_4     0x8000 /* Transmitter Distortion test */
5467 +
5468 +/* 1000BASE-T Status Register */
5469 +#define SR_1000T_IDLE_ERROR_CNT   0x00FF /* Num idle errors since last read */
5470 +#define SR_1000T_ASYM_PAUSE_DIR   0x0100 /* LP asymmetric pause direction bit */
5471 +#define SR_1000T_LP_HD_CAPS       0x0400 /* LP is 1000T HD capable */
5472 +#define SR_1000T_LP_FD_CAPS       0x0800 /* LP is 1000T FD capable */
5473 +#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */
5474 +#define SR_1000T_LOCAL_RX_STATUS  0x2000 /* Local receiver OK */
5475 +#define SR_1000T_MS_CONFIG_RES    0x4000 /* 1=Local Tx is Master, 0=Slave */
5476 +#define SR_1000T_MS_CONFIG_FAULT  0x8000 /* Master/Slave config fault */
5477 +
5478 +#define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5
5479 +
5480 +/* PHY 1000 MII Register/Bit Definitions */
5481 +/* PHY Registers defined by IEEE */
5482 +#define PHY_CONTROL      0x00 /* Control Register */
5483 +#define PHY_STATUS       0x01 /* Status Register */
5484 +#define PHY_ID1          0x02 /* Phy Id Reg (word 1) */
5485 +#define PHY_ID2          0x03 /* Phy Id Reg (word 2) */
5486 +#define PHY_AUTONEG_ADV  0x04 /* Autoneg Advertisement */
5487 +#define PHY_LP_ABILITY   0x05 /* Link Partner Ability (Base Page) */
5488 +#define PHY_AUTONEG_EXP  0x06 /* Autoneg Expansion Reg */
5489 +#define PHY_NEXT_PAGE_TX 0x07 /* Next Page Tx */
5490 +#define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */
5491 +#define PHY_1000T_CTRL   0x09 /* 1000Base-T Control Reg */
5492 +#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */
5493 +#define PHY_EXT_STATUS   0x0F /* Extended Status Reg */
5494 +
5495 +/* NVM Control */
5496 +#define E1000_EECD_SK        0x00000001 /* NVM Clock */
5497 +#define E1000_EECD_CS        0x00000002 /* NVM Chip Select */
5498 +#define E1000_EECD_DI        0x00000004 /* NVM Data In */
5499 +#define E1000_EECD_DO        0x00000008 /* NVM Data Out */
5500 +#define E1000_EECD_FWE_MASK  0x00000030
5501 +#define E1000_EECD_FWE_DIS   0x00000010 /* Disable FLASH writes */
5502 +#define E1000_EECD_FWE_EN    0x00000020 /* Enable FLASH writes */
5503 +#define E1000_EECD_FWE_SHIFT 4
5504 +#define E1000_EECD_REQ       0x00000040 /* NVM Access Request */
5505 +#define E1000_EECD_GNT       0x00000080 /* NVM Access Grant */
5506 +#define E1000_EECD_PRES      0x00000100 /* NVM Present */
5507 +#define E1000_EECD_SIZE      0x00000200 /* NVM Size (0=64 word 1=256 word) */
5508 +/* NVM Addressing bits based on type 0=small, 1=large */
5509 +#define E1000_EECD_ADDR_BITS 0x00000400
5510 +#define E1000_EECD_TYPE      0x00002000 /* NVM Type (1-SPI, 0-Microwire) */
5511 +#define E1000_NVM_GRANT_ATTEMPTS   1000 /* NVM # attempts to gain grant */
5512 +#define E1000_EECD_AUTO_RD          0x00000200  /* NVM Auto Read done */
5513 +#define E1000_EECD_SIZE_EX_MASK     0x00007800  /* NVM Size */
5514 +#define E1000_EECD_SIZE_EX_SHIFT     11
5515 +#define E1000_EECD_NVADDS    0x00018000 /* NVM Address Size */
5516 +#define E1000_EECD_SELSHAD   0x00020000 /* Select Shadow RAM */
5517 +#define E1000_EECD_INITSRAM  0x00040000 /* Initialize Shadow RAM */
5518 +#define E1000_EECD_FLUPD     0x00080000 /* Update FLASH */
5519 +#define E1000_EECD_AUPDEN    0x00100000 /* Enable Autonomous FLASH update */
5520 +#define E1000_EECD_SHADV     0x00200000 /* Shadow RAM Data Valid */
5521 +#define E1000_EECD_SEC1VAL   0x00400000 /* Sector One Valid */
5522 +#define E1000_EECD_SECVAL_SHIFT      22
5523 +
5524 +#define E1000_NVM_SWDPIN0   0x0001   /* SWDPIN 0 NVM Value */
5525 +#define E1000_NVM_LED_LOGIC 0x0020   /* Led Logic Word */
5526 +#define E1000_NVM_RW_REG_DATA   16   /* Offset to data in NVM read/write registers */
5527 +#define E1000_NVM_RW_REG_DONE   2    /* Offset to READ/WRITE done bit */
5528 +#define E1000_NVM_RW_REG_START  1    /* Start operation */
5529 +#define E1000_NVM_RW_ADDR_SHIFT 2    /* Shift to the address bits */
5530 +#define E1000_NVM_POLL_WRITE    1    /* Flag for polling for write complete */
5531 +#define E1000_NVM_POLL_READ     0    /* Flag for polling for read complete */
5532 +#define E1000_FLASH_UPDATES  2000
5533 +
5534 +/* NVM Word Offsets */
5535 +#define NVM_COMPAT                 0x0003
5536 +#define NVM_ID_LED_SETTINGS        0x0004
5537 +#define NVM_VERSION                0x0005
5538 +#define NVM_SERDES_AMPLITUDE       0x0006 /* For SERDES output amplitude adjustment. */
5539 +#define NVM_PHY_CLASS_WORD         0x0007
5540 +#define NVM_INIT_CONTROL1_REG      0x000A
5541 +#define NVM_INIT_CONTROL2_REG      0x000F
5542 +#define NVM_SWDEF_PINS_CTRL_PORT_1 0x0010
5543 +#define NVM_INIT_CONTROL3_PORT_B   0x0014
5544 +#define NVM_INIT_3GIO_3            0x001A
5545 +#define NVM_SWDEF_PINS_CTRL_PORT_0 0x0020
5546 +#define NVM_INIT_CONTROL3_PORT_A   0x0024
5547 +#define NVM_CFG                    0x0012
5548 +#define NVM_FLASH_VERSION          0x0032
5549 +#define NVM_ALT_MAC_ADDR_PTR       0x0037
5550 +#define NVM_CHECKSUM_REG           0x003F
5551 +
5552 +#define E1000_NVM_CFG_DONE_PORT_0  0x40000 /* MNG config cycle done */
5553 +#define E1000_NVM_CFG_DONE_PORT_1  0x80000 /* ...for second port */
5554 +
5555 +/* Mask bits for fields in Word 0x0f of the NVM */
5556 +#define NVM_WORD0F_PAUSE_MASK       0x3000
5557 +#define NVM_WORD0F_PAUSE            0x1000
5558 +#define NVM_WORD0F_ASM_DIR          0x2000
5559 +#define NVM_WORD0F_ANE              0x0800
5560 +#define NVM_WORD0F_SWPDIO_EXT_MASK  0x00F0
5561 +#define NVM_WORD0F_LPLU             0x0001
5562 +
5563 +/* Mask bits for fields in Word 0x1a of the NVM */
5564 +#define NVM_WORD1A_ASPM_MASK  0x000C
5565 +
5566 +/* For checksumming, the sum of all words in the NVM should equal 0xBABA. */
5567 +#define NVM_SUM                    0xBABA
5568 +
5569 +#define NVM_MAC_ADDR_OFFSET        0
5570 +#define NVM_PBA_OFFSET_0           8
5571 +#define NVM_PBA_OFFSET_1           9
5572 +#define NVM_RESERVED_WORD          0xFFFF
5573 +#define NVM_PHY_CLASS_A            0x8000
5574 +#define NVM_SERDES_AMPLITUDE_MASK  0x000F
5575 +#define NVM_SIZE_MASK              0x1C00
5576 +#define NVM_SIZE_SHIFT             10
5577 +#define NVM_WORD_SIZE_BASE_SHIFT   6
5578 +#define NVM_SWDPIO_EXT_SHIFT       4
5579 +
5580 +/* NVM Commands - SPI */
5581 +#define NVM_MAX_RETRY_SPI          5000 /* Max wait of 5ms, for RDY signal */
5582 +#define NVM_READ_OPCODE_SPI        0x03 /* NVM read opcode */
5583 +#define NVM_WRITE_OPCODE_SPI       0x02 /* NVM write opcode */
5584 +#define NVM_A8_OPCODE_SPI          0x08 /* opcode bit-3 = address bit-8 */
5585 +#define NVM_WREN_OPCODE_SPI        0x06 /* NVM set Write Enable latch */
5586 +#define NVM_WRDI_OPCODE_SPI        0x04 /* NVM reset Write Enable latch */
5587 +#define NVM_RDSR_OPCODE_SPI        0x05 /* NVM read Status register */
5588 +#define NVM_WRSR_OPCODE_SPI        0x01 /* NVM write Status register */
5589 +
5590 +/* SPI NVM Status Register */
5591 +#define NVM_STATUS_RDY_SPI         0x01
5592 +#define NVM_STATUS_WEN_SPI         0x02
5593 +#define NVM_STATUS_BP0_SPI         0x04
5594 +#define NVM_STATUS_BP1_SPI         0x08
5595 +#define NVM_STATUS_WPEN_SPI        0x80
5596 +
5597 +/* Word definitions for ID LED Settings */
5598 +#define ID_LED_RESERVED_0000 0x0000
5599 +#define ID_LED_RESERVED_FFFF 0xFFFF
5600 +#define ID_LED_DEFAULT       ((ID_LED_OFF1_ON2  << 12) | \
5601 +                              (ID_LED_OFF1_OFF2 <<  8) | \
5602 +                              (ID_LED_DEF1_DEF2 <<  4) | \
5603 +                              (ID_LED_DEF1_DEF2))
5604 +#define ID_LED_DEF1_DEF2     0x1
5605 +#define ID_LED_DEF1_ON2      0x2
5606 +#define ID_LED_DEF1_OFF2     0x3
5607 +#define ID_LED_ON1_DEF2      0x4
5608 +#define ID_LED_ON1_ON2       0x5
5609 +#define ID_LED_ON1_OFF2      0x6
5610 +#define ID_LED_OFF1_DEF2     0x7
5611 +#define ID_LED_OFF1_ON2      0x8
5612 +#define ID_LED_OFF1_OFF2     0x9
5613 +
5614 +#define IGP_ACTIVITY_LED_MASK   0xFFFFF0FF
5615 +#define IGP_ACTIVITY_LED_ENABLE 0x0300
5616 +#define IGP_LED3_MODE           0x07000000
5617 +
5618 +/* PCI/PCI-X/PCI-EX Config space */
5619 +#define PCI_HEADER_TYPE_REGISTER     0x0E
5620 +#define PCIE_LINK_STATUS             0x12
5621 +
5622 +#define PCI_HEADER_TYPE_MULTIFUNC    0x80
5623 +#define PCIE_LINK_WIDTH_MASK         0x3F0
5624 +#define PCIE_LINK_WIDTH_SHIFT        4
5625 +
5626 +#ifndef ETH_ADDR_LEN
5627 +#define ETH_ADDR_LEN                 6
5628 +#endif
5629 +
5630 +#define PHY_REVISION_MASK      0xFFFFFFF0
5631 +#define MAX_PHY_REG_ADDRESS    0x1F  /* 5 bit address bus (0-0x1F) */
5632 +#define MAX_PHY_MULTI_PAGE_REG 0xF
5633 +
5634 +/* Bit definitions for valid PHY IDs. */
5635 +/*
5636 + * I = Integrated
5637 + * E = External
5638 + */
5639 +#define M88E1000_E_PHY_ID    0x01410C50
5640 +#define M88E1000_I_PHY_ID    0x01410C30
5641 +#define M88E1011_I_PHY_ID    0x01410C20
5642 +#define IGP01E1000_I_PHY_ID  0x02A80380
5643 +#define M88E1011_I_REV_4     0x04
5644 +#define M88E1111_I_PHY_ID    0x01410CC0
5645 +#define GG82563_E_PHY_ID     0x01410CA0
5646 +#define IGP03E1000_E_PHY_ID  0x02A80390
5647 +#define IFE_E_PHY_ID         0x02A80330
5648 +#define IFE_PLUS_E_PHY_ID    0x02A80320
5649 +#define IFE_C_E_PHY_ID       0x02A80310
5650 +#define IGP04E1000_E_PHY_ID  0x02A80391
5651 +#define M88_VENDOR           0x0141
5652 +
5653 +/* M88E1000 Specific Registers */
5654 +#define M88E1000_PHY_SPEC_CTRL     0x10  /* PHY Specific Control Register */
5655 +#define M88E1000_PHY_SPEC_STATUS   0x11  /* PHY Specific Status Register */
5656 +#define M88E1000_INT_ENABLE        0x12  /* Interrupt Enable Register */
5657 +#define M88E1000_INT_STATUS        0x13  /* Interrupt Status Register */
5658 +#define M88E1000_EXT_PHY_SPEC_CTRL 0x14  /* Extended PHY Specific Control */
5659 +#define M88E1000_RX_ERR_CNTR       0x15  /* Receive Error Counter */
5660 +
5661 +#define M88E1000_PHY_EXT_CTRL      0x1A  /* PHY extend control register */
5662 +#define M88E1000_PHY_PAGE_SELECT   0x1D  /* Reg 29 for page number setting */
5663 +#define M88E1000_PHY_GEN_CONTROL   0x1E  /* Its meaning depends on reg 29 */
5664 +#define M88E1000_PHY_VCO_REG_BIT8  0x100 /* Bits 8 & 11 are adjusted for */
5665 +#define M88E1000_PHY_VCO_REG_BIT11 0x800    /* improved BER performance */
5666 +
5667 +/* M88E1000 PHY Specific Control Register */
5668 +#define M88E1000_PSCR_JABBER_DISABLE    0x0001 /* 1=Jabber Function disabled */
5669 +#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */
5670 +#define M88E1000_PSCR_SQE_TEST          0x0004 /* 1=SQE Test enabled */
5671 +/* 1=CLK125 low, 0=CLK125 toggling */
5672 +#define M88E1000_PSCR_CLK125_DISABLE    0x0010
5673 +#define M88E1000_PSCR_MDI_MANUAL_MODE  0x0000  /* MDI Crossover Mode bits 6:5 */
5674 +                                               /* Manual MDI configuration */
5675 +#define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020  /* Manual MDIX configuration */
5676 +/* 1000BASE-T: Auto crossover, 100BASE-TX/10BASE-T: MDI Mode */
5677 +#define M88E1000_PSCR_AUTO_X_1000T     0x0040
5678 +/* Auto crossover enabled all speeds */
5679 +#define M88E1000_PSCR_AUTO_X_MODE      0x0060
5680 +/*
5681 + * 1=Enable Extended 10BASE-T distance (Lower 10BASE-T Rx Threshold
5682 + * 0=Normal 10BASE-T Rx Threshold
5683 + */
5684 +#define M88E1000_PSCR_EN_10BT_EXT_DIST 0x0080
5685 +/* 1=5-bit interface in 100BASE-TX, 0=MII interface in 100BASE-TX */
5686 +#define M88E1000_PSCR_MII_5BIT_ENABLE      0x0100
5687 +#define M88E1000_PSCR_SCRAMBLER_DISABLE    0x0200 /* 1=Scrambler disable */
5688 +#define M88E1000_PSCR_FORCE_LINK_GOOD      0x0400 /* 1=Force link good */
5689 +#define M88E1000_PSCR_ASSERT_CRS_ON_TX     0x0800 /* 1=Assert CRS on Transmit */
5690 +
5691 +/* M88E1000 PHY Specific Status Register */
5692 +#define M88E1000_PSSR_JABBER             0x0001 /* 1=Jabber */
5693 +#define M88E1000_PSSR_REV_POLARITY       0x0002 /* 1=Polarity reversed */
5694 +#define M88E1000_PSSR_DOWNSHIFT          0x0020 /* 1=Downshifted */
5695 +#define M88E1000_PSSR_MDIX               0x0040 /* 1=MDIX; 0=MDI */
5696 +/*
5697 + * 0 = <50M
5698 + * 1 = 50-80M
5699 + * 2 = 80-110M
5700 + * 3 = 110-140M
5701 + * 4 = >140M
5702 + */
5703 +#define M88E1000_PSSR_CABLE_LENGTH       0x0380
5704 +#define M88E1000_PSSR_LINK               0x0400 /* 1=Link up, 0=Link down */
5705 +#define M88E1000_PSSR_SPD_DPLX_RESOLVED  0x0800 /* 1=Speed & Duplex resolved */
5706 +#define M88E1000_PSSR_PAGE_RCVD          0x1000 /* 1=Page received */
5707 +#define M88E1000_PSSR_DPLX               0x2000 /* 1=Duplex 0=Half Duplex */
5708 +#define M88E1000_PSSR_SPEED              0xC000 /* Speed, bits 14:15 */
5709 +#define M88E1000_PSSR_10MBS              0x0000 /* 00=10Mbs */
5710 +#define M88E1000_PSSR_100MBS             0x4000 /* 01=100Mbs */
5711 +#define M88E1000_PSSR_1000MBS            0x8000 /* 10=1000Mbs */
5712 +
5713 +#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7
5714 +
5715 +/* M88E1000 Extended PHY Specific Control Register */
5716 +#define M88E1000_EPSCR_FIBER_LOOPBACK 0x4000 /* 1=Fiber loopback */
5717 +/*
5718 + * 1 = Lost lock detect enabled.
5719 + * Will assert lost lock and bring
5720 + * link down if idle not seen
5721 + * within 1ms in 1000BASE-T
5722 + */
5723 +#define M88E1000_EPSCR_DOWN_NO_IDLE   0x8000
5724 +/*
5725 + * Number of times we will attempt to autonegotiate before downshifting if we
5726 + * are the master
5727 + */
5728 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00
5729 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X   0x0000
5730 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_2X   0x0400
5731 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_3X   0x0800
5732 +#define M88E1000_EPSCR_MASTER_DOWNSHIFT_4X   0x0C00
5733 +/*
5734 + * Number of times we will attempt to autonegotiate before downshifting if we
5735 + * are the slave
5736 + */
5737 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK  0x0300
5738 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_DIS   0x0000
5739 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X    0x0100
5740 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_2X    0x0200
5741 +#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_3X    0x0300
5742 +#define M88E1000_EPSCR_TX_CLK_2_5     0x0060 /* 2.5 MHz TX_CLK */
5743 +#define M88E1000_EPSCR_TX_CLK_25      0x0070 /* 25  MHz TX_CLK */
5744 +#define M88E1000_EPSCR_TX_CLK_0       0x0000 /* NO  TX_CLK */
5745 +
5746 +/* M88EC018 Rev 2 specific DownShift settings */
5747 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK  0x0E00
5748 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_1X    0x0000
5749 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_2X    0x0200
5750 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_3X    0x0400
5751 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_4X    0x0600
5752 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X    0x0800
5753 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_6X    0x0A00
5754 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_7X    0x0C00
5755 +#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_8X    0x0E00
5756 +
5757 +/*
5758 + * Bits...
5759 + * 15-5: page
5760 + * 4-0: register offset
5761 + */
5762 +#define GG82563_PAGE_SHIFT        5
5763 +#define GG82563_REG(page, reg)    \
5764 +        (((page) << GG82563_PAGE_SHIFT) | ((reg) & MAX_PHY_REG_ADDRESS))
5765 +#define GG82563_MIN_ALT_REG       30
5766 +
5767 +/* GG82563 Specific Registers */
5768 +#define GG82563_PHY_SPEC_CTRL           \
5769 +        GG82563_REG(0, 16) /* PHY Specific Control */
5770 +#define GG82563_PHY_SPEC_STATUS         \
5771 +        GG82563_REG(0, 17) /* PHY Specific Status */
5772 +#define GG82563_PHY_INT_ENABLE          \
5773 +        GG82563_REG(0, 18) /* Interrupt Enable */
5774 +#define GG82563_PHY_SPEC_STATUS_2       \
5775 +        GG82563_REG(0, 19) /* PHY Specific Status 2 */
5776 +#define GG82563_PHY_RX_ERR_CNTR         \
5777 +        GG82563_REG(0, 21) /* Receive Error Counter */
5778 +#define GG82563_PHY_PAGE_SELECT         \
5779 +        GG82563_REG(0, 22) /* Page Select */
5780 +#define GG82563_PHY_SPEC_CTRL_2         \
5781 +        GG82563_REG(0, 26) /* PHY Specific Control 2 */
5782 +#define GG82563_PHY_PAGE_SELECT_ALT     \
5783 +        GG82563_REG(0, 29) /* Alternate Page Select */
5784 +#define GG82563_PHY_TEST_CLK_CTRL       \
5785 +        GG82563_REG(0, 30) /* Test Clock Control (use reg. 29 to select) */
5786 +
5787 +#define GG82563_PHY_MAC_SPEC_CTRL       \
5788 +        GG82563_REG(2, 21) /* MAC Specific Control Register */
5789 +#define GG82563_PHY_MAC_SPEC_CTRL_2     \
5790 +        GG82563_REG(2, 26) /* MAC Specific Control 2 */
5791 +
5792 +#define GG82563_PHY_DSP_DISTANCE    \
5793 +        GG82563_REG(5, 26) /* DSP Distance */
5794 +
5795 +/* Page 193 - Port Control Registers */
5796 +#define GG82563_PHY_KMRN_MODE_CTRL   \
5797 +        GG82563_REG(193, 16) /* Kumeran Mode Control */
5798 +#define GG82563_PHY_PORT_RESET          \
5799 +        GG82563_REG(193, 17) /* Port Reset */
5800 +#define GG82563_PHY_REVISION_ID         \
5801 +        GG82563_REG(193, 18) /* Revision ID */
5802 +#define GG82563_PHY_DEVICE_ID           \
5803 +        GG82563_REG(193, 19) /* Device ID */
5804 +#define GG82563_PHY_PWR_MGMT_CTRL       \
5805 +        GG82563_REG(193, 20) /* Power Management Control */
5806 +#define GG82563_PHY_RATE_ADAPT_CTRL     \
5807 +        GG82563_REG(193, 25) /* Rate Adaptation Control */
5808 +
5809 +/* Page 194 - KMRN Registers */
5810 +#define GG82563_PHY_KMRN_FIFO_CTRL_STAT \
5811 +        GG82563_REG(194, 16) /* FIFO's Control/Status */
5812 +#define GG82563_PHY_KMRN_CTRL           \
5813 +        GG82563_REG(194, 17) /* Control */
5814 +#define GG82563_PHY_INBAND_CTRL         \
5815 +        GG82563_REG(194, 18) /* Inband Control */
5816 +#define GG82563_PHY_KMRN_DIAGNOSTIC     \
5817 +        GG82563_REG(194, 19) /* Diagnostic */
5818 +#define GG82563_PHY_ACK_TIMEOUTS        \
5819 +        GG82563_REG(194, 20) /* Acknowledge Timeouts */
5820 +#define GG82563_PHY_ADV_ABILITY         \
5821 +        GG82563_REG(194, 21) /* Advertised Ability */
5822 +#define GG82563_PHY_LINK_PARTNER_ADV_ABILITY \
5823 +        GG82563_REG(194, 23) /* Link Partner Advertised Ability */
5824 +#define GG82563_PHY_ADV_NEXT_PAGE       \
5825 +        GG82563_REG(194, 24) /* Advertised Next Page */
5826 +#define GG82563_PHY_LINK_PARTNER_ADV_NEXT_PAGE \
5827 +        GG82563_REG(194, 25) /* Link Partner Advertised Next page */
5828 +#define GG82563_PHY_KMRN_MISC           \
5829 +        GG82563_REG(194, 26) /* Misc. */
5830 +
5831 +/* MDI Control */
5832 +#define E1000_MDIC_DATA_MASK 0x0000FFFF
5833 +#define E1000_MDIC_REG_MASK  0x001F0000
5834 +#define E1000_MDIC_REG_SHIFT 16
5835 +#define E1000_MDIC_PHY_MASK  0x03E00000
5836 +#define E1000_MDIC_PHY_SHIFT 21
5837 +#define E1000_MDIC_OP_WRITE  0x04000000
5838 +#define E1000_MDIC_OP_READ   0x08000000
5839 +#define E1000_MDIC_READY     0x10000000
5840 +#define E1000_MDIC_INT_EN    0x20000000
5841 +#define E1000_MDIC_ERROR     0x40000000
5842 +
5843 +/* SerDes Control */
5844 +#define E1000_GEN_CTL_READY             0x80000000
5845 +#define E1000_GEN_CTL_ADDRESS_SHIFT     8
5846 +#define E1000_GEN_POLL_TIMEOUT          640
5847 +
5848 +/* LinkSec register fields */
5849 +#define E1000_LSECTXCAP_SUM_MASK        0x00FF0000
5850 +#define E1000_LSECTXCAP_SUM_SHIFT       16
5851 +#define E1000_LSECRXCAP_SUM_MASK        0x00FF0000
5852 +#define E1000_LSECRXCAP_SUM_SHIFT       16
5853 +
5854 +#define E1000_LSECTXCTRL_EN_MASK        0x00000003
5855 +#define E1000_LSECTXCTRL_DISABLE        0x0
5856 +#define E1000_LSECTXCTRL_AUTH           0x1
5857 +#define E1000_LSECTXCTRL_AUTH_ENCRYPT   0x2
5858 +#define E1000_LSECTXCTRL_AISCI          0x00000020
5859 +#define E1000_LSECTXCTRL_PNTHRSH_MASK   0xFFFFFF00
5860 +#define E1000_LSECTXCTRL_RSV_MASK       0x000000D8
5861 +
5862 +#define E1000_LSECRXCTRL_EN_MASK        0x0000000C
5863 +#define E1000_LSECRXCTRL_EN_SHIFT       2
5864 +#define E1000_LSECRXCTRL_DISABLE        0x0
5865 +#define E1000_LSECRXCTRL_CHECK          0x1
5866 +#define E1000_LSECRXCTRL_STRICT         0x2
5867 +#define E1000_LSECRXCTRL_DROP           0x3
5868 +#define E1000_LSECRXCTRL_PLSH           0x00000040
5869 +#define E1000_LSECRXCTRL_RP             0x00000080
5870 +#define E1000_LSECRXCTRL_RSV_MASK       0xFFFFFF33
5871 +
5872 +#endif /* _E1000_DEFINES_H_ */
5873 diff -Nru vanilla/drivers/net/igb/e1000_hw.h linux-i686-2.6.22/drivers/net/igb/e1000_hw.h
5874 --- vanilla/drivers/net/igb/e1000_hw.h  1969-12-31 19:00:00.000000000 -0500
5875 +++ linux-i686-2.6.22/drivers/net/igb/e1000_hw.h        2009-07-16 19:25:22.000000000 -0400
5876 @@ -0,0 +1,633 @@
5877 +/*******************************************************************************
5878 +
5879 +  Intel(R) Gigabit Ethernet Linux driver
5880 +  Copyright(c) 2007-2008 Intel Corporation.
5881 +
5882 +  This program is free software; you can redistribute it and/or modify it
5883 +  under the terms and conditions of the GNU General Public License,
5884 +  version 2, as published by the Free Software Foundation.
5885 +
5886 +  This program is distributed in the hope it will be useful, but WITHOUT
5887 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5888 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
5889 +  more details.
5890 +
5891 +  You should have received a copy of the GNU General Public License along with
5892 +  this program; if not, write to the Free Software Foundation, Inc.,
5893 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
5894 +
5895 +  The full GNU General Public License is included in this distribution in
5896 +  the file called "COPYING".
5897 +
5898 +  Contact Information:
5899 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
5900 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
5901 +
5902 +*******************************************************************************/
5903 +
5904 +#ifndef _E1000_HW_H_
5905 +#define _E1000_HW_H_
5906 +
5907 +#include "e1000_osdep.h"
5908 +#include "e1000_regs.h"
5909 +#include "e1000_defines.h"
5910 +
5911 +struct e1000_hw;
5912 +
5913 +#define E1000_DEV_ID_82576                    0x10C9
5914 +#define E1000_DEV_ID_82576_FIBER              0x10E6
5915 +#define E1000_DEV_ID_82576_SERDES             0x10E7
5916 +#define E1000_DEV_ID_82575EB_COPPER           0x10A7
5917 +#define E1000_DEV_ID_82575EB_FIBER_SERDES     0x10A9
5918 +#define E1000_DEV_ID_82575GB_QUAD_COPPER      0x10D6
5919 +#define E1000_REVISION_0 0
5920 +#define E1000_REVISION_1 1
5921 +#define E1000_REVISION_2 2
5922 +#define E1000_REVISION_3 3
5923 +#define E1000_REVISION_4 4
5924 +
5925 +#define E1000_FUNC_0     0
5926 +#define E1000_FUNC_1     1
5927 +
5928 +enum e1000_mac_type {
5929 +       e1000_undefined = 0,
5930 +       e1000_82575,
5931 +       e1000_82576,
5932 +       e1000_num_macs  /* List is 1-based, so subtract 1 for true count. */
5933 +};
5934 +
5935 +enum e1000_media_type {
5936 +       e1000_media_type_unknown = 0,
5937 +       e1000_media_type_copper = 1,
5938 +       e1000_media_type_fiber = 2,
5939 +       e1000_media_type_internal_serdes = 3,
5940 +       e1000_num_media_types
5941 +};
5942 +
5943 +enum e1000_nvm_type {
5944 +       e1000_nvm_unknown = 0,
5945 +       e1000_nvm_none,
5946 +       e1000_nvm_eeprom_spi,
5947 +       e1000_nvm_flash_hw,
5948 +       e1000_nvm_flash_sw
5949 +};
5950 +
5951 +enum e1000_nvm_override {
5952 +       e1000_nvm_override_none = 0,
5953 +       e1000_nvm_override_spi_small,
5954 +       e1000_nvm_override_spi_large,
5955 +};
5956 +
5957 +enum e1000_phy_type {
5958 +       e1000_phy_unknown = 0,
5959 +       e1000_phy_none,
5960 +       e1000_phy_m88,
5961 +       e1000_phy_igp,
5962 +       e1000_phy_igp_2,
5963 +       e1000_phy_gg82563,
5964 +       e1000_phy_igp_3,
5965 +       e1000_phy_ife,
5966 +       e1000_phy_vf,
5967 +};
5968 +
5969 +enum e1000_bus_type {
5970 +       e1000_bus_type_unknown = 0,
5971 +       e1000_bus_type_pci,
5972 +       e1000_bus_type_pcix,
5973 +       e1000_bus_type_pci_express,
5974 +       e1000_bus_type_reserved
5975 +};
5976 +
5977 +enum e1000_bus_speed {
5978 +       e1000_bus_speed_unknown = 0,
5979 +       e1000_bus_speed_33,
5980 +       e1000_bus_speed_66,
5981 +       e1000_bus_speed_100,
5982 +       e1000_bus_speed_120,
5983 +       e1000_bus_speed_133,
5984 +       e1000_bus_speed_2500,
5985 +       e1000_bus_speed_5000,
5986 +       e1000_bus_speed_reserved
5987 +};
5988 +
5989 +enum e1000_bus_width {
5990 +       e1000_bus_width_unknown = 0,
5991 +       e1000_bus_width_pcie_x1,
5992 +       e1000_bus_width_pcie_x2,
5993 +       e1000_bus_width_pcie_x4 = 4,
5994 +       e1000_bus_width_pcie_x8 = 8,
5995 +       e1000_bus_width_32,
5996 +       e1000_bus_width_64,
5997 +       e1000_bus_width_reserved
5998 +};
5999 +
6000 +enum e1000_1000t_rx_status {
6001 +       e1000_1000t_rx_status_not_ok = 0,
6002 +       e1000_1000t_rx_status_ok,
6003 +       e1000_1000t_rx_status_undefined = 0xFF
6004 +};
6005 +
6006 +enum e1000_rev_polarity {
6007 +       e1000_rev_polarity_normal = 0,
6008 +       e1000_rev_polarity_reversed,
6009 +       e1000_rev_polarity_undefined = 0xFF
6010 +};
6011 +
6012 +enum e1000_fc_type {
6013 +       e1000_fc_none = 0,
6014 +       e1000_fc_rx_pause,
6015 +       e1000_fc_tx_pause,
6016 +       e1000_fc_full,
6017 +       e1000_fc_default = 0xFF
6018 +};
6019 +
6020 +enum e1000_ms_type {
6021 +       e1000_ms_hw_default = 0,
6022 +       e1000_ms_force_master,
6023 +       e1000_ms_force_slave,
6024 +       e1000_ms_auto
6025 +};
6026 +
6027 +enum e1000_smart_speed {
6028 +       e1000_smart_speed_default = 0,
6029 +       e1000_smart_speed_on,
6030 +       e1000_smart_speed_off
6031 +};
6032 +
6033 +/* Receive Descriptor */
6034 +struct e1000_rx_desc {
6035 +       __le64 buffer_addr; /* Address of the descriptor's data buffer */
6036 +       __le16 length;      /* Length of data DMAed into data buffer */
6037 +       __le16 csum;        /* Packet checksum */
6038 +       u8  status;         /* Descriptor status */
6039 +       u8  errors;         /* Descriptor Errors */
6040 +       __le16 special;
6041 +};
6042 +
6043 +/* Receive Descriptor - Extended */
6044 +union e1000_rx_desc_extended {
6045 +       struct {
6046 +               __le64 buffer_addr;
6047 +               __le64 reserved;
6048 +       } read;
6049 +       struct {
6050 +               struct {
6051 +                       __le32 mrq;           /* Multiple Rx Queues */
6052 +                       union {
6053 +                               __le32 rss;         /* RSS Hash */
6054 +                               struct {
6055 +                                       __le16 ip_id;  /* IP id */
6056 +                                       __le16 csum;   /* Packet Checksum */
6057 +                               } csum_ip;
6058 +                       } hi_dword;
6059 +               } lower;
6060 +               struct {
6061 +                       __le32 status_error;  /* ext status/error */
6062 +                       __le16 length;
6063 +                       __le16 vlan;          /* VLAN tag */
6064 +               } upper;
6065 +       } wb;  /* writeback */
6066 +};
6067 +
6068 +#define MAX_PS_BUFFERS 4
6069 +/* Receive Descriptor - Packet Split */
6070 +union e1000_rx_desc_packet_split {
6071 +       struct {
6072 +               /* one buffer for protocol header(s), three data buffers */
6073 +               __le64 buffer_addr[MAX_PS_BUFFERS];
6074 +       } read;
6075 +       struct {
6076 +               struct {
6077 +                       __le32 mrq;           /* Multiple Rx Queues */
6078 +                       union {
6079 +                               __le32 rss;           /* RSS Hash */
6080 +                               struct {
6081 +                                       __le16 ip_id;    /* IP id */
6082 +                                       __le16 csum;     /* Packet Checksum */
6083 +                               } csum_ip;
6084 +                       } hi_dword;
6085 +               } lower;
6086 +               struct {
6087 +                       __le32 status_error;  /* ext status/error */
6088 +                       __le16 length0;       /* length of buffer 0 */
6089 +                       __le16 vlan;          /* VLAN tag */
6090 +               } middle;
6091 +               struct {
6092 +                       __le16 header_status;
6093 +                       __le16 length[3];     /* length of buffers 1-3 */
6094 +               } upper;
6095 +               __le64 reserved;
6096 +       } wb; /* writeback */
6097 +};
6098 +
6099 +/* Transmit Descriptor */
6100 +struct e1000_tx_desc {
6101 +       __le64 buffer_addr;   /* Address of the descriptor's data buffer */
6102 +       union {
6103 +               __le32 data;
6104 +               struct {
6105 +                       __le16 length;    /* Data buffer length */
6106 +                       u8 cso;           /* Checksum offset */
6107 +                       u8 cmd;           /* Descriptor control */
6108 +               } flags;
6109 +       } lower;
6110 +       union {
6111 +               __le32 data;
6112 +               struct {
6113 +                       u8 status;        /* Descriptor status */
6114 +                       u8 css;           /* Checksum start */
6115 +                       __le16 special;
6116 +               } fields;
6117 +       } upper;
6118 +};
6119 +
6120 +/* Offload Context Descriptor */
6121 +struct e1000_context_desc {
6122 +       union {
6123 +               __le32 ip_config;
6124 +               struct {
6125 +                       u8 ipcss;         /* IP checksum start */
6126 +                       u8 ipcso;         /* IP checksum offset */
6127 +                       __le16 ipcse;     /* IP checksum end */
6128 +               } ip_fields;
6129 +       } lower_setup;
6130 +       union {
6131 +               __le32 tcp_config;
6132 +               struct {
6133 +                       u8 tucss;         /* TCP checksum start */
6134 +                       u8 tucso;         /* TCP checksum offset */
6135 +                       __le16 tucse;     /* TCP checksum end */
6136 +               } tcp_fields;
6137 +       } upper_setup;
6138 +       __le32 cmd_and_length;
6139 +       union {
6140 +               __le32 data;
6141 +               struct {
6142 +                       u8 status;        /* Descriptor status */
6143 +                       u8 hdr_len;       /* Header length */
6144 +                       __le16 mss;       /* Maximum segment size */
6145 +               } fields;
6146 +       } tcp_seg_setup;
6147 +};
6148 +
6149 +/* Offload data descriptor */
6150 +struct e1000_data_desc {
6151 +       __le64 buffer_addr;   /* Address of the descriptor's buffer address */
6152 +       union {
6153 +               __le32 data;
6154 +               struct {
6155 +                       __le16 length;    /* Data buffer length */
6156 +                       u8 typ_len_ext;
6157 +                       u8 cmd;
6158 +               } flags;
6159 +       } lower;
6160 +       union {
6161 +               __le32 data;
6162 +               struct {
6163 +                       u8 status;        /* Descriptor status */
6164 +                       u8 popts;         /* Packet Options */
6165 +                       __le16 special;
6166 +               } fields;
6167 +       } upper;
6168 +};
6169 +
6170 +/* Statistics counters collected by the MAC */
6171 +struct e1000_hw_stats {
6172 +       u64 crcerrs;
6173 +       u64 algnerrc;
6174 +       u64 symerrs;
6175 +       u64 rxerrc;
6176 +       u64 mpc;
6177 +       u64 scc;
6178 +       u64 ecol;
6179 +       u64 mcc;
6180 +       u64 latecol;
6181 +       u64 colc;
6182 +       u64 dc;
6183 +       u64 tncrs;
6184 +       u64 sec;
6185 +       u64 cexterr;
6186 +       u64 rlec;
6187 +       u64 xonrxc;
6188 +       u64 xontxc;
6189 +       u64 xoffrxc;
6190 +       u64 xofftxc;
6191 +       u64 fcruc;
6192 +       u64 prc64;
6193 +       u64 prc127;
6194 +       u64 prc255;
6195 +       u64 prc511;
6196 +       u64 prc1023;
6197 +       u64 prc1522;
6198 +       u64 gprc;
6199 +       u64 bprc;
6200 +       u64 mprc;
6201 +       u64 gptc;
6202 +       u64 gorc;
6203 +       u64 gotc;
6204 +       u64 rnbc;
6205 +       u64 ruc;
6206 +       u64 rfc;
6207 +       u64 roc;
6208 +       u64 rjc;
6209 +       u64 mgprc;
6210 +       u64 mgpdc;
6211 +       u64 mgptc;
6212 +       u64 tor;
6213 +       u64 tot;
6214 +       u64 tpr;
6215 +       u64 tpt;
6216 +       u64 ptc64;
6217 +       u64 ptc127;
6218 +       u64 ptc255;
6219 +       u64 ptc511;
6220 +       u64 ptc1023;
6221 +       u64 ptc1522;
6222 +       u64 mptc;
6223 +       u64 bptc;
6224 +       u64 tsctc;
6225 +       u64 tsctfc;
6226 +       u64 iac;
6227 +       u64 icrxptc;
6228 +       u64 icrxatc;
6229 +       u64 ictxptc;
6230 +       u64 ictxatc;
6231 +       u64 ictxqec;
6232 +       u64 ictxqmtc;
6233 +       u64 icrxdmtc;
6234 +       u64 icrxoc;
6235 +       u64 cbtmpc;
6236 +       u64 htdpmc;
6237 +       u64 cbrdpc;
6238 +       u64 cbrmpc;
6239 +       u64 rpthc;
6240 +       u64 hgptc;
6241 +       u64 htcbdpc;
6242 +       u64 hgorc;
6243 +       u64 hgotc;
6244 +       u64 lenerrs;
6245 +       u64 scvpc;
6246 +       u64 hrmpc;
6247 +};
6248 +
6249 +struct e1000_phy_stats {
6250 +       u32 idle_errors;
6251 +       u32 receive_errors;
6252 +};
6253 +
6254 +struct e1000_host_mng_dhcp_cookie {
6255 +       u32 signature;
6256 +       u8  status;
6257 +       u8  reserved0;
6258 +       u16 vlan_id;
6259 +       u32 reserved1;
6260 +       u16 reserved2;
6261 +       u8  reserved3;
6262 +       u8  checksum;
6263 +};
6264 +
6265 +/* Host Interface "Rev 1" */
6266 +struct e1000_host_command_header {
6267 +       u8 command_id;
6268 +       u8 command_length;
6269 +       u8 command_options;
6270 +       u8 checksum;
6271 +};
6272 +
6273 +#define E1000_HI_MAX_DATA_LENGTH     252
6274 +struct e1000_host_command_info {
6275 +       struct e1000_host_command_header command_header;
6276 +       u8 command_data[E1000_HI_MAX_DATA_LENGTH];
6277 +};
6278 +
6279 +/* Host Interface "Rev 2" */
6280 +struct e1000_host_mng_command_header {
6281 +       u8  command_id;
6282 +       u8  checksum;
6283 +       u16 reserved1;
6284 +       u16 reserved2;
6285 +       u16 command_length;
6286 +};
6287 +
6288 +#define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8
6289 +struct e1000_host_mng_command_info {
6290 +       struct e1000_host_mng_command_header command_header;
6291 +       u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH];
6292 +};
6293 +
6294 +#include "e1000_mac.h"
6295 +#include "e1000_phy.h"
6296 +#include "e1000_nvm.h"
6297 +#include "e1000_manage.h"
6298 +
6299 +struct e1000_mac_operations {
6300 +       /* Function pointers for the MAC. */
6301 +       s32  (*init_params)(struct e1000_hw *);
6302 +       s32  (*blink_led)(struct e1000_hw *);
6303 +       s32  (*check_for_link)(struct e1000_hw *);
6304 +       bool (*check_mng_mode)(struct e1000_hw *hw);
6305 +       s32  (*cleanup_led)(struct e1000_hw *);
6306 +       void (*clear_hw_cntrs)(struct e1000_hw *);
6307 +       void (*clear_vfta)(struct e1000_hw *);
6308 +       s32  (*get_bus_info)(struct e1000_hw *);
6309 +       s32  (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
6310 +       s32  (*led_on)(struct e1000_hw *);
6311 +       s32  (*led_off)(struct e1000_hw *);
6312 +       void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32, u32, u32);
6313 +       s32  (*reset_hw)(struct e1000_hw *);
6314 +       s32  (*init_hw)(struct e1000_hw *);
6315 +       void (*shutdown_serdes)(struct e1000_hw *);
6316 +       s32  (*setup_link)(struct e1000_hw *);
6317 +       s32  (*setup_physical_interface)(struct e1000_hw *);
6318 +       s32  (*setup_led)(struct e1000_hw *);
6319 +       void (*write_vfta)(struct e1000_hw *, u32, u32);
6320 +       void (*mta_set)(struct e1000_hw *, u32);
6321 +       void (*config_collision_dist)(struct e1000_hw*);
6322 +       void (*rar_set)(struct e1000_hw*, u8*, u32);
6323 +       s32  (*read_mac_addr)(struct e1000_hw*);
6324 +       s32  (*validate_mdi_setting)(struct e1000_hw*);
6325 +       s32  (*mng_host_if_write)(struct e1000_hw*, u8*, u16, u16, u8*);
6326 +       s32  (*mng_write_cmd_header)(struct e1000_hw *hw,
6327 +                      struct e1000_host_mng_command_header*);
6328 +       s32  (*mng_enable_host_if)(struct e1000_hw*);
6329 +       s32  (*wait_autoneg)(struct e1000_hw*);
6330 +};
6331 +
6332 +struct e1000_phy_operations {
6333 +       s32  (*init_params)(struct e1000_hw *);
6334 +       s32  (*acquire)(struct e1000_hw *);
6335 +       s32  (*check_polarity)(struct e1000_hw *);
6336 +       s32  (*check_reset_block)(struct e1000_hw *);
6337 +       s32  (*commit)(struct e1000_hw *);
6338 +       s32  (*force_speed_duplex)(struct e1000_hw *);
6339 +       s32  (*get_cfg_done)(struct e1000_hw *hw);
6340 +       s32  (*get_cable_length)(struct e1000_hw *);
6341 +       s32  (*get_info)(struct e1000_hw *);
6342 +       s32  (*read_reg)(struct e1000_hw *, u32, u16 *);
6343 +       void (*release)(struct e1000_hw *);
6344 +       s32  (*reset)(struct e1000_hw *);
6345 +       s32  (*set_d0_lplu_state)(struct e1000_hw *, bool);
6346 +       s32  (*set_d3_lplu_state)(struct e1000_hw *, bool);
6347 +       s32  (*write_reg)(struct e1000_hw *, u32, u16);
6348 +       void (*power_up)(struct e1000_hw *);
6349 +       void (*power_down)(struct e1000_hw *);
6350 +};
6351 +
6352 +struct e1000_nvm_operations {
6353 +       s32  (*init_params)(struct e1000_hw *);
6354 +       s32  (*acquire)(struct e1000_hw *);
6355 +       s32  (*read)(struct e1000_hw *, u16, u16, u16 *);
6356 +       void (*release)(struct e1000_hw *);
6357 +       void (*reload)(struct e1000_hw *);
6358 +       s32  (*update)(struct e1000_hw *);
6359 +       s32  (*valid_led_default)(struct e1000_hw *, u16 *);
6360 +       s32  (*validate)(struct e1000_hw *);
6361 +       s32  (*write)(struct e1000_hw *, u16, u16, u16 *);
6362 +};
6363 +
6364 +struct e1000_mac_info {
6365 +       struct e1000_mac_operations ops;
6366 +       u8 addr[6];
6367 +       u8 perm_addr[6];
6368 +
6369 +       enum e1000_mac_type type;
6370 +
6371 +       u32 collision_delta;
6372 +       u32 ledctl_default;
6373 +       u32 ledctl_mode1;
6374 +       u32 ledctl_mode2;
6375 +       u32 mc_filter_type;
6376 +       u32 tx_packet_delta;
6377 +       u32 txcw;
6378 +
6379 +       u16 current_ifs_val;
6380 +       u16 ifs_max_val;
6381 +       u16 ifs_min_val;
6382 +       u16 ifs_ratio;
6383 +       u16 ifs_step_size;
6384 +       u16 mta_reg_count;
6385 +       u16 rar_entry_count;
6386 +
6387 +       u8  forced_speed_duplex;
6388 +
6389 +       bool adaptive_ifs;
6390 +       bool arc_subsystem_valid;
6391 +       bool asf_firmware_present;
6392 +       bool autoneg;
6393 +       bool autoneg_failed;
6394 +       bool get_link_status;
6395 +       bool in_ifs_mode;
6396 +       bool serdes_has_link;
6397 +       bool tx_pkt_filtering;
6398 +};
6399 +
6400 +struct e1000_phy_info {
6401 +       struct e1000_phy_operations ops;
6402 +       enum e1000_phy_type type;
6403 +
6404 +       enum e1000_1000t_rx_status local_rx;
6405 +       enum e1000_1000t_rx_status remote_rx;
6406 +       enum e1000_ms_type ms_type;
6407 +       enum e1000_ms_type original_ms_type;
6408 +       enum e1000_rev_polarity cable_polarity;
6409 +       enum e1000_smart_speed smart_speed;
6410 +
6411 +       u32 addr;
6412 +       u32 id;
6413 +       u32 reset_delay_us; /* in usec */
6414 +       u32 revision;
6415 +
6416 +       enum e1000_media_type media_type;
6417 +
6418 +       u16 autoneg_advertised;
6419 +       u16 autoneg_mask;
6420 +       u16 cable_length;
6421 +       u16 max_cable_length;
6422 +       u16 min_cable_length;
6423 +
6424 +       u8 mdix;
6425 +
6426 +       bool disable_polarity_correction;
6427 +       bool is_mdix;
6428 +       bool polarity_correction;
6429 +       bool reset_disable;
6430 +       bool speed_downgraded;
6431 +       bool autoneg_wait_to_complete;
6432 +};
6433 +
6434 +struct e1000_nvm_info {
6435 +       struct e1000_nvm_operations ops;
6436 +       enum e1000_nvm_type type;
6437 +       enum e1000_nvm_override override;
6438 +
6439 +       u32 flash_bank_size;
6440 +       u32 flash_base_addr;
6441 +
6442 +       u16 word_size;
6443 +       u16 delay_usec;
6444 +       u16 address_bits;
6445 +       u16 opcode_bits;
6446 +       u16 page_size;
6447 +};
6448 +
6449 +struct e1000_bus_info {
6450 +       enum e1000_bus_type type;
6451 +       enum e1000_bus_speed speed;
6452 +       enum e1000_bus_width width;
6453 +
6454 +       u16 func;
6455 +       u16 pci_cmd_word;
6456 +};
6457 +
6458 +struct e1000_fc_info {
6459 +       u32 high_water;          /* Flow control high-water mark */
6460 +       u32 low_water;           /* Flow control low-water mark */
6461 +       u16 pause_time;          /* Flow control pause timer */
6462 +       bool send_xon;           /* Flow control send XON */
6463 +       bool strict_ieee;        /* Strict IEEE mode */
6464 +       enum e1000_fc_type type; /* Type of flow control */
6465 +       enum e1000_fc_type original_type;
6466 +};
6467 +
6468 +struct e1000_dev_spec_82575 {
6469 +       bool sgmii_active;
6470 +};
6471 +
6472 +struct e1000_dev_spec_vf {
6473 +       u32     vf_number;
6474 +};
6475 +
6476 +struct e1000_hw {
6477 +       void *back;
6478 +
6479 +       u8 __iomem *hw_addr;
6480 +       u8 __iomem *flash_address;
6481 +       unsigned long io_base;
6482 +
6483 +       struct e1000_mac_info  mac;
6484 +       struct e1000_fc_info   fc;
6485 +       struct e1000_phy_info  phy;
6486 +       struct e1000_nvm_info  nvm;
6487 +       struct e1000_bus_info  bus;
6488 +       struct e1000_host_mng_dhcp_cookie mng_cookie;
6489 +
6490 +       union {
6491 +               struct e1000_dev_spec_82575     _82575;
6492 +               struct e1000_dev_spec_vf        vf;
6493 +       } dev_spec;
6494 +
6495 +       u16 device_id;
6496 +       u16 subsystem_vendor_id;
6497 +       u16 subsystem_device_id;
6498 +       u16 vendor_id;
6499 +
6500 +       u8  revision_id;
6501 +};
6502 +
6503 +#include "e1000_82575.h"
6504 +
6505 +/* These functions must be implemented by drivers */
6506 +s32  e1000_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
6507 +void e1000_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
6508 +
6509 +#endif
6510 diff -Nru vanilla/drivers/net/igb/e1000_mac.c linux-i686-2.6.22/drivers/net/igb/e1000_mac.c
6511 --- vanilla/drivers/net/igb/e1000_mac.c 1969-12-31 19:00:00.000000000 -0500
6512 +++ linux-i686-2.6.22/drivers/net/igb/e1000_mac.c       2009-07-16 19:25:22.000000000 -0400
6513 @@ -0,0 +1,1971 @@
6514 +/*******************************************************************************
6515 +
6516 +  Intel(R) Gigabit Ethernet Linux driver
6517 +  Copyright(c) 2007-2008 Intel Corporation.
6518 +
6519 +  This program is free software; you can redistribute it and/or modify it
6520 +  under the terms and conditions of the GNU General Public License,
6521 +  version 2, as published by the Free Software Foundation.
6522 +
6523 +  This program is distributed in the hope it will be useful, but WITHOUT
6524 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6525 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
6526 +  more details.
6527 +
6528 +  You should have received a copy of the GNU General Public License along with
6529 +  this program; if not, write to the Free Software Foundation, Inc.,
6530 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
6531 +
6532 +  The full GNU General Public License is included in this distribution in
6533 +  the file called "COPYING".
6534 +
6535 +  Contact Information:
6536 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
6537 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
6538 +
6539 +*******************************************************************************/
6540 +
6541 +#include "e1000_api.h"
6542 +
6543 +static s32 e1000_set_default_fc_generic(struct e1000_hw *hw);
6544 +static s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw);
6545 +static s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw);
6546 +static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw);
6547 +
6548 +/**
6549 + *  e1000_init_mac_ops_generic - Initialize MAC function pointers
6550 + *  @hw: pointer to the HW structure
6551 + *
6552 + *  Setups up the function pointers to no-op functions
6553 + **/
6554 +void e1000_init_mac_ops_generic(struct e1000_hw *hw)
6555 +{
6556 +       struct e1000_mac_info *mac = &hw->mac;
6557 +       DEBUGFUNC("e1000_init_mac_ops_generic");
6558 +
6559 +       /* General Setup */
6560 +       mac->ops.read_mac_addr = e1000_read_mac_addr_generic;
6561 +       mac->ops.config_collision_dist = e1000_config_collision_dist_generic;
6562 +       /* LINK */
6563 +       mac->ops.wait_autoneg = e1000_wait_autoneg_generic;
6564 +       /* Management */
6565 +       mac->ops.mng_host_if_write = e1000_mng_host_if_write_generic;
6566 +       mac->ops.mng_write_cmd_header = e1000_mng_write_cmd_header_generic;
6567 +       mac->ops.mng_enable_host_if = e1000_mng_enable_host_if_generic;
6568 +       /* VLAN, MC, etc. */
6569 +       mac->ops.rar_set = e1000_rar_set_generic;
6570 +       mac->ops.validate_mdi_setting = e1000_validate_mdi_setting_generic;
6571 +}
6572 +
6573 +/**
6574 + *  e1000_get_bus_info_pcie_generic - Get PCIe bus information
6575 + *  @hw: pointer to the HW structure
6576 + *
6577 + *  Determines and stores the system bus information for a particular
6578 + *  network interface.  The following bus information is determined and stored:
6579 + *  bus speed, bus width, type (PCIe), and PCIe function.
6580 + **/
6581 +s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw)
6582 +{
6583 +       struct e1000_bus_info *bus = &hw->bus;
6584 +       s32 ret_val;
6585 +       u32 status;
6586 +       u16 pcie_link_status, pci_header_type;
6587 +
6588 +       DEBUGFUNC("e1000_get_bus_info_pcie_generic");
6589 +
6590 +       bus->type = e1000_bus_type_pci_express;
6591 +       bus->speed = e1000_bus_speed_2500;
6592 +
6593 +       ret_val = e1000_read_pcie_cap_reg(hw,
6594 +                                         PCIE_LINK_STATUS,
6595 +                                         &pcie_link_status);
6596 +       if (ret_val)
6597 +               bus->width = e1000_bus_width_unknown;
6598 +       else
6599 +               bus->width = (enum e1000_bus_width)((pcie_link_status &
6600 +                                               PCIE_LINK_WIDTH_MASK) >>
6601 +                                              PCIE_LINK_WIDTH_SHIFT);
6602 +
6603 +       e1000_read_pci_cfg(hw, PCI_HEADER_TYPE_REGISTER, &pci_header_type);
6604 +       if (pci_header_type & PCI_HEADER_TYPE_MULTIFUNC) {
6605 +               status = E1000_READ_REG(hw, E1000_STATUS);
6606 +               bus->func = (status & E1000_STATUS_FUNC_MASK)
6607 +                           >> E1000_STATUS_FUNC_SHIFT;
6608 +       } else {
6609 +               bus->func = 0;
6610 +       }
6611 +
6612 +       return E1000_SUCCESS;
6613 +}
6614 +
6615 +/**
6616 + *  e1000_clear_vfta_generic - Clear VLAN filter table
6617 + *  @hw: pointer to the HW structure
6618 + *
6619 + *  Clears the register array which contains the VLAN filter table by
6620 + *  setting all the values to 0.
6621 + **/
6622 +void e1000_clear_vfta_generic(struct e1000_hw *hw)
6623 +{
6624 +       u32 offset;
6625 +
6626 +       DEBUGFUNC("e1000_clear_vfta_generic");
6627 +
6628 +       for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
6629 +               E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, 0);
6630 +               E1000_WRITE_FLUSH(hw);
6631 +       }
6632 +}
6633 +
6634 +/**
6635 + *  e1000_write_vfta_generic - Write value to VLAN filter table
6636 + *  @hw: pointer to the HW structure
6637 + *  @offset: register offset in VLAN filter table
6638 + *  @value: register value written to VLAN filter table
6639 + *
6640 + *  Writes value at the given offset in the register array which stores
6641 + *  the VLAN filter table.
6642 + **/
6643 +void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value)
6644 +{
6645 +       DEBUGFUNC("e1000_write_vfta_generic");
6646 +
6647 +       E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, value);
6648 +       E1000_WRITE_FLUSH(hw);
6649 +}
6650 +
6651 +/**
6652 + *  e1000_init_rx_addrs_generic - Initialize receive address's
6653 + *  @hw: pointer to the HW structure
6654 + *  @rar_count: receive address registers
6655 + *
6656 + *  Setups the receive address registers by setting the base receive address
6657 + *  register to the devices MAC address and clearing all the other receive
6658 + *  address registers to 0.
6659 + **/
6660 +void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count)
6661 +{
6662 +       u32 i;
6663 +
6664 +       DEBUGFUNC("e1000_init_rx_addrs_generic");
6665 +
6666 +       /* Setup the receive address */
6667 +       DEBUGOUT("Programming MAC Address into RAR[0]\n");
6668 +
6669 +       hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
6670 +
6671 +       /* Zero out the other (rar_entry_count - 1) receive addresses */
6672 +       DEBUGOUT1("Clearing RAR[1-%u]\n", rar_count-1);
6673 +       for (i = 1; i < rar_count; i++) {
6674 +               E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1), 0);
6675 +               E1000_WRITE_FLUSH(hw);
6676 +               E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((i << 1) + 1), 0);
6677 +               E1000_WRITE_FLUSH(hw);
6678 +       }
6679 +}
6680 +
6681 +/**
6682 + *  e1000_check_alt_mac_addr_generic - Check for alternate MAC addr
6683 + *  @hw: pointer to the HW structure
6684 + *
6685 + *  Checks the nvm for an alternate MAC address.  An alternate MAC address
6686 + *  can be setup by pre-boot software and must be treated like a permanent
6687 + *  address and must override the actual permanent MAC address.  If an
6688 + *  alternate MAC address is found it is saved in the hw struct and
6689 + *  programmed into RAR0 and the function returns success, otherwise the
6690 + *  function returns an error.
6691 + **/
6692 +s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw)
6693 +{
6694 +       u32 i;
6695 +       s32 ret_val = E1000_SUCCESS;
6696 +       u16 offset, nvm_alt_mac_addr_offset, nvm_data;
6697 +       u8 alt_mac_addr[ETH_ADDR_LEN];
6698 +
6699 +       DEBUGFUNC("e1000_check_alt_mac_addr_generic");
6700 +
6701 +       ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1,
6702 +                                &nvm_alt_mac_addr_offset);
6703 +       if (ret_val) {
6704 +               DEBUGOUT("NVM Read Error\n");
6705 +               goto out;
6706 +       }
6707 +
6708 +       if (nvm_alt_mac_addr_offset == 0xFFFF) {
6709 +               ret_val = -(E1000_NOT_IMPLEMENTED);
6710 +               goto out;
6711 +       }
6712 +
6713 +       if (hw->bus.func == E1000_FUNC_1)
6714 +               nvm_alt_mac_addr_offset += ETH_ADDR_LEN/sizeof(u16);
6715 +
6716 +       for (i = 0; i < ETH_ADDR_LEN; i += 2) {
6717 +               offset = nvm_alt_mac_addr_offset + (i >> 1);
6718 +               ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
6719 +               if (ret_val) {
6720 +                       DEBUGOUT("NVM Read Error\n");
6721 +                       goto out;
6722 +               }
6723 +
6724 +               alt_mac_addr[i] = (u8)(nvm_data & 0xFF);
6725 +               alt_mac_addr[i + 1] = (u8)(nvm_data >> 8);
6726 +       }
6727 +
6728 +       /* if multicast bit is set, the alternate address will not be used */
6729 +       if (alt_mac_addr[0] & 0x01) {
6730 +               ret_val = -(E1000_NOT_IMPLEMENTED);
6731 +               goto out;
6732 +       }
6733 +
6734 +       for (i = 0; i < ETH_ADDR_LEN; i++)
6735 +               hw->mac.addr[i] = hw->mac.perm_addr[i] = alt_mac_addr[i];
6736 +
6737 +       hw->mac.ops.rar_set(hw, hw->mac.perm_addr, 0);
6738 +
6739 +out:
6740 +       return ret_val;
6741 +}
6742 +
6743 +/**
6744 + *  e1000_rar_set_generic - Set receive address register
6745 + *  @hw: pointer to the HW structure
6746 + *  @addr: pointer to the receive address
6747 + *  @index: receive address array register
6748 + *
6749 + *  Sets the receive address array register at index to the address passed
6750 + *  in by addr.
6751 + **/
6752 +void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index)
6753 +{
6754 +       u32 rar_low, rar_high;
6755 +
6756 +       DEBUGFUNC("e1000_rar_set_generic");
6757 +
6758 +       /*
6759 +        * HW expects these in little endian so we reverse the byte order
6760 +        * from network order (big endian) to little endian
6761 +        */
6762 +       rar_low = ((u32) addr[0] |
6763 +                  ((u32) addr[1] << 8) |
6764 +                  ((u32) addr[2] << 16) | ((u32) addr[3] << 24));
6765 +
6766 +       rar_high = ((u32) addr[4] | ((u32) addr[5] << 8));
6767 +
6768 +       /* If MAC address zero, no need to set the AV bit */
6769 +       if (rar_low || rar_high)
6770 +               rar_high |= E1000_RAH_AV;
6771 +
6772 +       E1000_WRITE_REG(hw, E1000_RAL(index), rar_low);
6773 +       E1000_WRITE_REG(hw, E1000_RAH(index), rar_high);
6774 +}
6775 +
6776 +/**
6777 + *  e1000_mta_set_generic - Set multicast filter table address
6778 + *  @hw: pointer to the HW structure
6779 + *  @hash_value: determines the MTA register and bit to set
6780 + *
6781 + *  The multicast table address is a register array of 32-bit registers.
6782 + *  The hash_value is used to determine what register the bit is in, the
6783 + *  current value is read, the new bit is OR'd in and the new value is
6784 + *  written back into the register.
6785 + **/
6786 +void e1000_mta_set_generic(struct e1000_hw *hw, u32 hash_value)
6787 +{
6788 +       u32 hash_bit, hash_reg, mta;
6789 +
6790 +       DEBUGFUNC("e1000_mta_set_generic");
6791 +       /*
6792 +        * The MTA is a register array of 32-bit registers. It is
6793 +        * treated like an array of (32*mta_reg_count) bits.  We want to
6794 +        * set bit BitArray[hash_value]. So we figure out what register
6795 +        * the bit is in, read it, OR in the new bit, then write
6796 +        * back the new value.  The (hw->mac.mta_reg_count - 1) serves as a
6797 +        * mask to bits 31:5 of the hash value which gives us the
6798 +        * register we're modifying.  The hash bit within that register
6799 +        * is determined by the lower 5 bits of the hash value.
6800 +        */
6801 +       hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1);
6802 +       hash_bit = hash_value & 0x1F;
6803 +
6804 +       mta = E1000_READ_REG_ARRAY(hw, E1000_MTA, hash_reg);
6805 +
6806 +       mta |= (1 << hash_bit);
6807 +
6808 +       E1000_WRITE_REG_ARRAY(hw, E1000_MTA, hash_reg, mta);
6809 +       E1000_WRITE_FLUSH(hw);
6810 +}
6811 +
6812 +/**
6813 + *  e1000_update_mc_addr_list_generic - Update Multicast addresses
6814 + *  @hw: pointer to the HW structure
6815 + *  @mc_addr_list: array of multicast addresses to program
6816 + *  @mc_addr_count: number of multicast addresses to program
6817 + *  @rar_used_count: the first RAR register free to program
6818 + *  @rar_count: total number of supported Receive Address Registers
6819 + *
6820 + *  Updates the Receive Address Registers and Multicast Table Array.
6821 + *  The caller must have a packed mc_addr_list of multicast addresses.
6822 + *  The parameter rar_count will usually be hw->mac.rar_entry_count
6823 + *  unless there are workarounds that change this.
6824 + **/
6825 +void e1000_update_mc_addr_list_generic(struct e1000_hw *hw,
6826 +                                       u8 *mc_addr_list, u32 mc_addr_count,
6827 +                                       u32 rar_used_count, u32 rar_count)
6828 +{
6829 +       u32 hash_value;
6830 +       u32 i;
6831 +
6832 +       DEBUGFUNC("e1000_update_mc_addr_list_generic");
6833 +
6834 +       /*
6835 +        * Load the first set of multicast addresses into the exact
6836 +        * filters (RAR).  If there are not enough to fill the RAR
6837 +        * array, clear the filters.
6838 +        */
6839 +       for (i = rar_used_count; i < rar_count; i++) {
6840 +               if (mc_addr_count) {
6841 +                       hw->mac.ops.rar_set(hw, mc_addr_list, i);
6842 +                       mc_addr_count--;
6843 +                       mc_addr_list += ETH_ADDR_LEN;
6844 +               } else {
6845 +                       E1000_WRITE_REG_ARRAY(hw, E1000_RA, i << 1, 0);
6846 +                       E1000_WRITE_FLUSH(hw);
6847 +                       E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1) + 1, 0);
6848 +                       E1000_WRITE_FLUSH(hw);
6849 +               }
6850 +       }
6851 +
6852 +       /* Clear the old settings from the MTA */
6853 +       DEBUGOUT("Clearing MTA\n");
6854 +       for (i = 0; i < hw->mac.mta_reg_count; i++) {
6855 +               E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
6856 +               E1000_WRITE_FLUSH(hw);
6857 +       }
6858 +
6859 +       /* Load any remaining multicast addresses into the hash table. */
6860 +       for (; mc_addr_count > 0; mc_addr_count--) {
6861 +               hash_value = e1000_hash_mc_addr_generic(hw, mc_addr_list);
6862 +               DEBUGOUT1("Hash value = 0x%03X\n", hash_value);
6863 +               hw->mac.ops.mta_set(hw, hash_value);
6864 +               mc_addr_list += ETH_ADDR_LEN;
6865 +       }
6866 +}
6867 +
6868 +/**
6869 + *  e1000_hash_mc_addr_generic - Generate a multicast hash value
6870 + *  @hw: pointer to the HW structure
6871 + *  @mc_addr: pointer to a multicast address
6872 + *
6873 + *  Generates a multicast address hash value which is used to determine
6874 + *  the multicast filter table array address and new table value.  See
6875 + *  e1000_mta_set_generic()
6876 + **/
6877 +u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr)
6878 +{
6879 +       u32 hash_value, hash_mask;
6880 +       u8 bit_shift = 0;
6881 +
6882 +       DEBUGFUNC("e1000_hash_mc_addr_generic");
6883 +
6884 +       /* Register count multiplied by bits per register */
6885 +       hash_mask = (hw->mac.mta_reg_count * 32) - 1;
6886 +
6887 +       /*
6888 +        * For a mc_filter_type of 0, bit_shift is the number of left-shifts
6889 +        * where 0xFF would still fall within the hash mask.
6890 +        */
6891 +       while (hash_mask >> bit_shift != 0xFF)
6892 +               bit_shift++;
6893 +
6894 +       /*
6895 +        * The portion of the address that is used for the hash table
6896 +        * is determined by the mc_filter_type setting.
6897 +        * The algorithm is such that there is a total of 8 bits of shifting.
6898 +        * The bit_shift for a mc_filter_type of 0 represents the number of
6899 +        * left-shifts where the MSB of mc_addr[5] would still fall within
6900 +        * the hash_mask.  Case 0 does this exactly.  Since there are a total
6901 +        * of 8 bits of shifting, then mc_addr[4] will shift right the
6902 +        * remaining number of bits. Thus 8 - bit_shift.  The rest of the
6903 +        * cases are a variation of this algorithm...essentially raising the
6904 +        * number of bits to shift mc_addr[5] left, while still keeping the
6905 +        * 8-bit shifting total.
6906 +        *
6907 +        * For example, given the following Destination MAC Address and an
6908 +        * mta register count of 128 (thus a 4096-bit vector and 0xFFF mask),
6909 +        * we can see that the bit_shift for case 0 is 4.  These are the hash
6910 +        * values resulting from each mc_filter_type...
6911 +        * [0] [1] [2] [3] [4] [5]
6912 +        * 01  AA  00  12  34  56
6913 +        * LSB                 MSB
6914 +        *
6915 +        * case 0: hash_value = ((0x34 >> 4) | (0x56 << 4)) & 0xFFF = 0x563
6916 +        * case 1: hash_value = ((0x34 >> 3) | (0x56 << 5)) & 0xFFF = 0xAC6
6917 +        * case 2: hash_value = ((0x34 >> 2) | (0x56 << 6)) & 0xFFF = 0x163
6918 +        * case 3: hash_value = ((0x34 >> 0) | (0x56 << 8)) & 0xFFF = 0x634
6919 +        */
6920 +       switch (hw->mac.mc_filter_type) {
6921 +               default:
6922 +               case 0:
6923 +                       break;
6924 +               case 1:
6925 +                       bit_shift += 1;
6926 +                       break;
6927 +               case 2:
6928 +                       bit_shift += 2;
6929 +                       break;
6930 +               case 3:
6931 +                       bit_shift += 4;
6932 +                       break;
6933 +       }
6934 +
6935 +       hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
6936 +                                 (((u16) mc_addr[5]) << bit_shift)));
6937 +
6938 +       return hash_value;
6939 +}
6940 +
6941 +/**
6942 + *  e1000_clear_hw_cntrs_base_generic - Clear base hardware counters
6943 + *  @hw: pointer to the HW structure
6944 + *
6945 + *  Clears the base hardware counters by reading the counter registers.
6946 + **/
6947 +void e1000_clear_hw_cntrs_base_generic(struct e1000_hw *hw)
6948 +{
6949 +       volatile u32 temp;
6950 +
6951 +       DEBUGFUNC("e1000_clear_hw_cntrs_base_generic");
6952 +
6953 +       temp = E1000_READ_REG(hw, E1000_CRCERRS);
6954 +       temp = E1000_READ_REG(hw, E1000_SYMERRS);
6955 +       temp = E1000_READ_REG(hw, E1000_MPC);
6956 +       temp = E1000_READ_REG(hw, E1000_SCC);
6957 +       temp = E1000_READ_REG(hw, E1000_ECOL);
6958 +       temp = E1000_READ_REG(hw, E1000_MCC);
6959 +       temp = E1000_READ_REG(hw, E1000_LATECOL);
6960 +       temp = E1000_READ_REG(hw, E1000_COLC);
6961 +       temp = E1000_READ_REG(hw, E1000_DC);
6962 +       temp = E1000_READ_REG(hw, E1000_SEC);
6963 +       temp = E1000_READ_REG(hw, E1000_RLEC);
6964 +       temp = E1000_READ_REG(hw, E1000_XONRXC);
6965 +       temp = E1000_READ_REG(hw, E1000_XONTXC);
6966 +       temp = E1000_READ_REG(hw, E1000_XOFFRXC);
6967 +       temp = E1000_READ_REG(hw, E1000_XOFFTXC);
6968 +       temp = E1000_READ_REG(hw, E1000_FCRUC);
6969 +       temp = E1000_READ_REG(hw, E1000_GPRC);
6970 +       temp = E1000_READ_REG(hw, E1000_BPRC);
6971 +       temp = E1000_READ_REG(hw, E1000_MPRC);
6972 +       temp = E1000_READ_REG(hw, E1000_GPTC);
6973 +       temp = E1000_READ_REG(hw, E1000_GORCL);
6974 +       temp = E1000_READ_REG(hw, E1000_GORCH);
6975 +       temp = E1000_READ_REG(hw, E1000_GOTCL);
6976 +       temp = E1000_READ_REG(hw, E1000_GOTCH);
6977 +       temp = E1000_READ_REG(hw, E1000_RNBC);
6978 +       temp = E1000_READ_REG(hw, E1000_RUC);
6979 +       temp = E1000_READ_REG(hw, E1000_RFC);
6980 +       temp = E1000_READ_REG(hw, E1000_ROC);
6981 +       temp = E1000_READ_REG(hw, E1000_RJC);
6982 +       temp = E1000_READ_REG(hw, E1000_TORL);
6983 +       temp = E1000_READ_REG(hw, E1000_TORH);
6984 +       temp = E1000_READ_REG(hw, E1000_TOTL);
6985 +       temp = E1000_READ_REG(hw, E1000_TOTH);
6986 +       temp = E1000_READ_REG(hw, E1000_TPR);
6987 +       temp = E1000_READ_REG(hw, E1000_TPT);
6988 +       temp = E1000_READ_REG(hw, E1000_MPTC);
6989 +       temp = E1000_READ_REG(hw, E1000_BPTC);
6990 +}
6991 +
6992 +/**
6993 + *  e1000_check_for_copper_link_generic - Check for link (Copper)
6994 + *  @hw: pointer to the HW structure
6995 + *
6996 + *  Checks to see of the link status of the hardware has changed.  If a
6997 + *  change in link status has been detected, then we read the PHY registers
6998 + *  to get the current speed/duplex if link exists.
6999 + **/
7000 +s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw)
7001 +{
7002 +       struct e1000_mac_info *mac = &hw->mac;
7003 +       s32 ret_val;
7004 +       bool link;
7005 +
7006 +       DEBUGFUNC("e1000_check_for_copper_link");
7007 +
7008 +       /*
7009 +        * We only want to go out to the PHY registers to see if Auto-Neg
7010 +        * has completed and/or if our link status has changed.  The
7011 +        * get_link_status flag is set upon receiving a Link Status
7012 +        * Change or Rx Sequence Error interrupt.
7013 +        */
7014 +       if (!mac->get_link_status) {
7015 +               ret_val = E1000_SUCCESS;
7016 +               goto out;
7017 +       }
7018 +
7019 +       /*
7020 +        * First we want to see if the MII Status Register reports
7021 +        * link.  If so, then we want to get the current speed/duplex
7022 +        * of the PHY.
7023 +        */
7024 +       ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
7025 +       if (ret_val)
7026 +               goto out;
7027 +
7028 +       if (!link)
7029 +               goto out; /* No link detected */
7030 +
7031 +       mac->get_link_status = false;
7032 +
7033 +       /*
7034 +        * Check if there was DownShift, must be checked
7035 +        * immediately after link-up
7036 +        */
7037 +       e1000_check_downshift_generic(hw);
7038 +
7039 +       /*
7040 +        * If we are forcing speed/duplex, then we simply return since
7041 +        * we have already determined whether we have link or not.
7042 +        */
7043 +       if (!mac->autoneg) {
7044 +               ret_val = -E1000_ERR_CONFIG;
7045 +               goto out;
7046 +       }
7047 +
7048 +       /*
7049 +        * Auto-Neg is enabled.  Auto Speed Detection takes care
7050 +        * of MAC speed/duplex configuration.  So we only need to
7051 +        * configure Collision Distance in the MAC.
7052 +        */
7053 +       e1000_config_collision_dist_generic(hw);
7054 +
7055 +       /*
7056 +        * Configure Flow Control now that Auto-Neg has completed.
7057 +        * First, we need to restore the desired flow control
7058 +        * settings because we may have had to re-autoneg with a
7059 +        * different link partner.
7060 +        */
7061 +       ret_val = e1000_config_fc_after_link_up_generic(hw);
7062 +       if (ret_val) {
7063 +               DEBUGOUT("Error configuring flow control\n");
7064 +       }
7065 +
7066 +out:
7067 +       return ret_val;
7068 +}
7069 +
7070 +/**
7071 + *  e1000_check_for_fiber_link_generic - Check for link (Fiber)
7072 + *  @hw: pointer to the HW structure
7073 + *
7074 + *  Checks for link up on the hardware.  If link is not up and we have
7075 + *  a signal, then we need to force link up.
7076 + **/
7077 +s32 e1000_check_for_fiber_link_generic(struct e1000_hw *hw)
7078 +{
7079 +       struct e1000_mac_info *mac = &hw->mac;
7080 +       u32 rxcw;
7081 +       u32 ctrl;
7082 +       u32 status;
7083 +       s32 ret_val = E1000_SUCCESS;
7084 +
7085 +       DEBUGFUNC("e1000_check_for_fiber_link_generic");
7086 +
7087 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
7088 +       status = E1000_READ_REG(hw, E1000_STATUS);
7089 +       rxcw = E1000_READ_REG(hw, E1000_RXCW);
7090 +
7091 +       /*
7092 +        * If we don't have link (auto-negotiation failed or link partner
7093 +        * cannot auto-negotiate), the cable is plugged in (we have signal),
7094 +        * and our link partner is not trying to auto-negotiate with us (we
7095 +        * are receiving idles or data), we need to force link up. We also
7096 +        * need to give auto-negotiation time to complete, in case the cable
7097 +        * was just plugged in. The autoneg_failed flag does this.
7098 +        */
7099 +       /* (ctrl & E1000_CTRL_SWDPIN1) == 1 == have signal */
7100 +       if ((ctrl & E1000_CTRL_SWDPIN1) && (!(status & E1000_STATUS_LU)) &&
7101 +           (!(rxcw & E1000_RXCW_C))) {
7102 +               if (mac->autoneg_failed == 0) {
7103 +                       mac->autoneg_failed = 1;
7104 +                       goto out;
7105 +               }
7106 +               DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
7107 +
7108 +               /* Disable auto-negotiation in the TXCW register */
7109 +               E1000_WRITE_REG(hw, E1000_TXCW, (mac->txcw & ~E1000_TXCW_ANE));
7110 +
7111 +               /* Force link-up and also force full-duplex. */
7112 +               ctrl = E1000_READ_REG(hw, E1000_CTRL);
7113 +               ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
7114 +               E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
7115 +
7116 +               /* Configure Flow Control after forcing link up. */
7117 +               ret_val = e1000_config_fc_after_link_up_generic(hw);
7118 +               if (ret_val) {
7119 +                       DEBUGOUT("Error configuring flow control\n");
7120 +                       goto out;
7121 +               }
7122 +       } else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
7123 +               /*
7124 +                * If we are forcing link and we are receiving /C/ ordered
7125 +                * sets, re-enable auto-negotiation in the TXCW register
7126 +                * and disable forced link in the Device Control register
7127 +                * in an attempt to auto-negotiate with our link partner.
7128 +                */
7129 +               DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n");
7130 +               E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw);
7131 +               E1000_WRITE_REG(hw, E1000_CTRL, (ctrl & ~E1000_CTRL_SLU));
7132 +
7133 +               mac->serdes_has_link = true;
7134 +       }
7135 +
7136 +out:
7137 +       return ret_val;
7138 +}
7139 +
7140 +/**
7141 + *  e1000_check_for_serdes_link_generic - Check for link (Serdes)
7142 + *  @hw: pointer to the HW structure
7143 + *
7144 + *  Checks for link up on the hardware.  If link is not up and we have
7145 + *  a signal, then we need to force link up.
7146 + **/
7147 +s32 e1000_check_for_serdes_link_generic(struct e1000_hw *hw)
7148 +{
7149 +       struct e1000_mac_info *mac = &hw->mac;
7150 +       u32 rxcw;
7151 +       u32 ctrl;
7152 +       u32 status;
7153 +       s32 ret_val = E1000_SUCCESS;
7154 +
7155 +       DEBUGFUNC("e1000_check_for_serdes_link_generic");
7156 +
7157 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
7158 +       status = E1000_READ_REG(hw, E1000_STATUS);
7159 +       rxcw = E1000_READ_REG(hw, E1000_RXCW);
7160 +
7161 +       /*
7162 +        * If we don't have link (auto-negotiation failed or link partner
7163 +        * cannot auto-negotiate), and our link partner is not trying to
7164 +        * auto-negotiate with us (we are receiving idles or data),
7165 +        * we need to force link up. We also need to give auto-negotiation
7166 +        * time to complete.
7167 +        */
7168 +       /* (ctrl & E1000_CTRL_SWDPIN1) == 1 == have signal */
7169 +       if ((!(status & E1000_STATUS_LU)) && (!(rxcw & E1000_RXCW_C))) {
7170 +               if (mac->autoneg_failed == 0) {
7171 +                       mac->autoneg_failed = 1;
7172 +                       goto out;
7173 +               }
7174 +               DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\n");
7175 +
7176 +               /* Disable auto-negotiation in the TXCW register */
7177 +               E1000_WRITE_REG(hw, E1000_TXCW, (mac->txcw & ~E1000_TXCW_ANE));
7178 +
7179 +               /* Force link-up and also force full-duplex. */
7180 +               ctrl = E1000_READ_REG(hw, E1000_CTRL);
7181 +               ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
7182 +               E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
7183 +
7184 +               /* Configure Flow Control after forcing link up. */
7185 +               ret_val = e1000_config_fc_after_link_up_generic(hw);
7186 +               if (ret_val) {
7187 +                       DEBUGOUT("Error configuring flow control\n");
7188 +                       goto out;
7189 +               }
7190 +       } else if ((ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
7191 +               /*
7192 +                * If we are forcing link and we are receiving /C/ ordered
7193 +                * sets, re-enable auto-negotiation in the TXCW register
7194 +                * and disable forced link in the Device Control register
7195 +                * in an attempt to auto-negotiate with our link partner.
7196 +                */
7197 +               DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\n");
7198 +               E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw);
7199 +               E1000_WRITE_REG(hw, E1000_CTRL, (ctrl & ~E1000_CTRL_SLU));
7200 +
7201 +               mac->serdes_has_link = true;
7202 +       } else if (!(E1000_TXCW_ANE & E1000_READ_REG(hw, E1000_TXCW))) {
7203 +               /*
7204 +                * If we force link for non-auto-negotiation switch, check
7205 +                * link status based on MAC synchronization for internal
7206 +                * serdes media type.
7207 +                */
7208 +               /* SYNCH bit and IV bit are sticky. */
7209 +               usec_delay(10);
7210 +               rxcw = E1000_READ_REG(hw, E1000_RXCW);
7211 +               if (rxcw & E1000_RXCW_SYNCH) {
7212 +                       if (!(rxcw & E1000_RXCW_IV)) {
7213 +                               mac->serdes_has_link = true;
7214 +                               DEBUGOUT("SERDES: Link up - forced.\n");
7215 +                       }
7216 +               } else {
7217 +                       mac->serdes_has_link = false;
7218 +                       DEBUGOUT("SERDES: Link down - force failed.\n");
7219 +               }
7220 +       }
7221 +
7222 +       if (E1000_TXCW_ANE & E1000_READ_REG(hw, E1000_TXCW)) {
7223 +               status = E1000_READ_REG(hw, E1000_STATUS);
7224 +               if (status & E1000_STATUS_LU) {
7225 +                       /* SYNCH bit and IV bit are sticky, so reread rxcw. */
7226 +                       usec_delay(10);
7227 +                       rxcw = E1000_READ_REG(hw, E1000_RXCW);
7228 +                       if (rxcw & E1000_RXCW_SYNCH) {
7229 +                               if (!(rxcw & E1000_RXCW_IV)) {
7230 +                                       mac->serdes_has_link = true;
7231 +                                       DEBUGOUT("SERDES: Link up - autoneg "
7232 +                                          "completed sucessfully.\n");
7233 +                               } else {
7234 +                                       mac->serdes_has_link = false;
7235 +                                       DEBUGOUT("SERDES: Link down - invalid"
7236 +                                          "codewords detected in autoneg.\n");
7237 +                               }
7238 +                       } else {
7239 +                               mac->serdes_has_link = false;
7240 +                               DEBUGOUT("SERDES: Link down - no sync.\n");
7241 +                       }
7242 +               } else {
7243 +                       mac->serdes_has_link = false;
7244 +                       DEBUGOUT("SERDES: Link down - autoneg failed\n");
7245 +               }
7246 +       }
7247 +
7248 +out:
7249 +       return ret_val;
7250 +}
7251 +
7252 +/**
7253 + *  e1000_setup_link_generic - Setup flow control and link settings
7254 + *  @hw: pointer to the HW structure
7255 + *
7256 + *  Determines which flow control settings to use, then configures flow
7257 + *  control.  Calls the appropriate media-specific link configuration
7258 + *  function.  Assuming the adapter has a valid link partner, a valid link
7259 + *  should be established.  Assumes the hardware has previously been reset
7260 + *  and the transmitter and receiver are not enabled.
7261 + **/
7262 +s32 e1000_setup_link_generic(struct e1000_hw *hw)
7263 +{
7264 +       s32 ret_val = E1000_SUCCESS;
7265 +
7266 +       DEBUGFUNC("e1000_setup_link_generic");
7267 +
7268 +       /*
7269 +        * In the case of the phy reset being blocked, we already have a link.
7270 +        * We do not need to set it up again.
7271 +        */
7272 +       if (hw->phy.ops.check_reset_block)
7273 +               if (hw->phy.ops.check_reset_block(hw))
7274 +                       goto out;
7275 +
7276 +       /*
7277 +        * If flow control is set to default, set flow control based on
7278 +        * the EEPROM flow control settings.
7279 +        */
7280 +       if (hw->fc.type == e1000_fc_default) {
7281 +               ret_val = e1000_set_default_fc_generic(hw);
7282 +               if (ret_val)
7283 +                       goto out;
7284 +       }
7285 +
7286 +       /*
7287 +        * We want to save off the original Flow Control configuration just
7288 +        * in case we get disconnected and then reconnected into a different
7289 +        * hub or switch with different Flow Control capabilities.
7290 +        */
7291 +       hw->fc.original_type = hw->fc.type;
7292 +
7293 +       DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc.type);
7294 +
7295 +       /* Call the necessary media_type subroutine to configure the link. */
7296 +       ret_val = hw->mac.ops.setup_physical_interface(hw);
7297 +       if (ret_val)
7298 +               goto out;
7299 +
7300 +       /*
7301 +        * Initialize the flow control address, type, and PAUSE timer
7302 +        * registers to their default values.  This is done even if flow
7303 +        * control is disabled, because it does not hurt anything to
7304 +        * initialize these registers.
7305 +        */
7306 +       DEBUGOUT("Initializing the Flow Control address, type and timer regs\n");
7307 +       E1000_WRITE_REG(hw, E1000_FCT, FLOW_CONTROL_TYPE);
7308 +       E1000_WRITE_REG(hw, E1000_FCAH, FLOW_CONTROL_ADDRESS_HIGH);
7309 +       E1000_WRITE_REG(hw, E1000_FCAL, FLOW_CONTROL_ADDRESS_LOW);
7310 +
7311 +       E1000_WRITE_REG(hw, E1000_FCTTV, hw->fc.pause_time);
7312 +
7313 +       ret_val = e1000_set_fc_watermarks_generic(hw);
7314 +
7315 +out:
7316 +       return ret_val;
7317 +}
7318 +
7319 +/**
7320 + *  e1000_setup_fiber_serdes_link_generic - Setup link for fiber/serdes
7321 + *  @hw: pointer to the HW structure
7322 + *
7323 + *  Configures collision distance and flow control for fiber and serdes
7324 + *  links.  Upon successful setup, poll for link.
7325 + **/
7326 +s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw)
7327 +{
7328 +       u32 ctrl;
7329 +       s32 ret_val = E1000_SUCCESS;
7330 +
7331 +       DEBUGFUNC("e1000_setup_fiber_serdes_link_generic");
7332 +
7333 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
7334 +
7335 +       /* Take the link out of reset */
7336 +       ctrl &= ~E1000_CTRL_LRST;
7337 +
7338 +       e1000_config_collision_dist_generic(hw);
7339 +
7340 +       ret_val = e1000_commit_fc_settings_generic(hw);
7341 +       if (ret_val)
7342 +               goto out;
7343 +
7344 +       /*
7345 +        * Since auto-negotiation is enabled, take the link out of reset (the
7346 +        * link will be in reset, because we previously reset the chip). This
7347 +        * will restart auto-negotiation.  If auto-negotiation is successful
7348 +        * then the link-up status bit will be set and the flow control enable
7349 +        * bits (RFCE and TFCE) will be set according to their negotiated value.
7350 +        */
7351 +       DEBUGOUT("Auto-negotiation enabled\n");
7352 +
7353 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
7354 +       E1000_WRITE_FLUSH(hw);
7355 +       msec_delay(1);
7356 +
7357 +       /*
7358 +        * For these adapters, the SW definable pin 1 is set when the optics
7359 +        * detect a signal.  If we have a signal, then poll for a "Link-Up"
7360 +        * indication.
7361 +        */
7362 +       if (hw->phy.media_type == e1000_media_type_internal_serdes ||
7363 +           (E1000_READ_REG(hw, E1000_CTRL) & E1000_CTRL_SWDPIN1)) {
7364 +               ret_val = e1000_poll_fiber_serdes_link_generic(hw);
7365 +       } else {
7366 +               DEBUGOUT("No signal detected\n");
7367 +       }
7368 +
7369 +out:
7370 +       return ret_val;
7371 +}
7372 +
7373 +/**
7374 + *  e1000_config_collision_dist_generic - Configure collision distance
7375 + *  @hw: pointer to the HW structure
7376 + *
7377 + *  Configures the collision distance to the default value and is used
7378 + *  during link setup. Currently no func pointer exists and all
7379 + *  implementations are handled in the generic version of this function.
7380 + **/
7381 +void e1000_config_collision_dist_generic(struct e1000_hw *hw)
7382 +{
7383 +       u32 tctl;
7384 +
7385 +       DEBUGFUNC("e1000_config_collision_dist_generic");
7386 +
7387 +       tctl = E1000_READ_REG(hw, E1000_TCTL);
7388 +
7389 +       tctl &= ~E1000_TCTL_COLD;
7390 +       tctl |= E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT;
7391 +
7392 +       E1000_WRITE_REG(hw, E1000_TCTL, tctl);
7393 +       E1000_WRITE_FLUSH(hw);
7394 +}
7395 +
7396 +/**
7397 + *  e1000_poll_fiber_serdes_link_generic - Poll for link up
7398 + *  @hw: pointer to the HW structure
7399 + *
7400 + *  Polls for link up by reading the status register, if link fails to come
7401 + *  up with auto-negotiation, then the link is forced if a signal is detected.
7402 + **/
7403 +s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw)
7404 +{
7405 +       struct e1000_mac_info *mac = &hw->mac;
7406 +       u32 i, status;
7407 +       s32 ret_val = E1000_SUCCESS;
7408 +
7409 +       DEBUGFUNC("e1000_poll_fiber_serdes_link_generic");
7410 +
7411 +       /*
7412 +        * If we have a signal (the cable is plugged in, or assumed true for
7413 +        * serdes media) then poll for a "Link-Up" indication in the Device
7414 +        * Status Register.  Time-out if a link isn't seen in 500 milliseconds
7415 +        * seconds (Auto-negotiation should complete in less than 500
7416 +        * milliseconds even if the other end is doing it in SW).
7417 +        */
7418 +       for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) {
7419 +               msec_delay(10);
7420 +               status = E1000_READ_REG(hw, E1000_STATUS);
7421 +               if (status & E1000_STATUS_LU)
7422 +                       break;
7423 +       }
7424 +       if (i == FIBER_LINK_UP_LIMIT) {
7425 +               DEBUGOUT("Never got a valid link from auto-neg!!!\n");
7426 +               mac->autoneg_failed = 1;
7427 +               /*
7428 +                * AutoNeg failed to achieve a link, so we'll call
7429 +                * mac->check_for_link. This routine will force the
7430 +                * link up if we detect a signal. This will allow us to
7431 +                * communicate with non-autonegotiating link partners.
7432 +                */
7433 +               ret_val = hw->mac.ops.check_for_link(hw);
7434 +               if (ret_val) {
7435 +                       DEBUGOUT("Error while checking for link\n");
7436 +                       goto out;
7437 +               }
7438 +               mac->autoneg_failed = 0;
7439 +       } else {
7440 +               mac->autoneg_failed = 0;
7441 +               DEBUGOUT("Valid Link Found\n");
7442 +       }
7443 +
7444 +out:
7445 +       return ret_val;
7446 +}
7447 +
7448 +/**
7449 + *  e1000_commit_fc_settings_generic - Configure flow control
7450 + *  @hw: pointer to the HW structure
7451 + *
7452 + *  Write the flow control settings to the Transmit Config Word Register (TXCW)
7453 + *  base on the flow control settings in e1000_mac_info.
7454 + **/
7455 +static s32 e1000_commit_fc_settings_generic(struct e1000_hw *hw)
7456 +{
7457 +       struct e1000_mac_info *mac = &hw->mac;
7458 +       u32 txcw;
7459 +       s32 ret_val = E1000_SUCCESS;
7460 +
7461 +       DEBUGFUNC("e1000_commit_fc_settings_generic");
7462 +
7463 +       /*
7464 +        * Check for a software override of the flow control settings, and
7465 +        * setup the device accordingly.  If auto-negotiation is enabled, then
7466 +        * software will have to set the "PAUSE" bits to the correct value in
7467 +        * the Transmit Config Word Register (TXCW) and re-start auto-
7468 +        * negotiation.  However, if auto-negotiation is disabled, then
7469 +        * software will have to manually configure the two flow control enable
7470 +        * bits in the CTRL register.
7471 +        *
7472 +        * The possible values of the "fc" parameter are:
7473 +        *      0:  Flow control is completely disabled
7474 +        *      1:  Rx flow control is enabled (we can receive pause frames,
7475 +        *          but not send pause frames).
7476 +        *      2:  Tx flow control is enabled (we can send pause frames but we
7477 +        *          do not support receiving pause frames).
7478 +        *      3:  Both Rx and Tx flow control (symmetric) are enabled.
7479 +        */
7480 +       switch (hw->fc.type) {
7481 +       case e1000_fc_none:
7482 +               /* Flow control completely disabled by a software over-ride. */
7483 +               txcw = (E1000_TXCW_ANE | E1000_TXCW_FD);
7484 +               break;
7485 +       case e1000_fc_rx_pause:
7486 +               /*
7487 +                * Rx Flow control is enabled and Tx Flow control is disabled
7488 +                * by a software over-ride. Since there really isn't a way to
7489 +                * advertise that we are capable of Rx Pause ONLY, we will
7490 +                * advertise that we support both symmetric and asymmetric RX
7491 +                * PAUSE.  Later, we will disable the adapter's ability to send
7492 +                * PAUSE frames.
7493 +                */
7494 +               txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK);
7495 +               break;
7496 +       case e1000_fc_tx_pause:
7497 +               /*
7498 +                * Tx Flow control is enabled, and Rx Flow control is disabled,
7499 +                * by a software over-ride.
7500 +                */
7501 +               txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR);
7502 +               break;
7503 +       case e1000_fc_full:
7504 +               /*
7505 +                * Flow control (both Rx and Tx) is enabled by a software
7506 +                * over-ride.
7507 +                */
7508 +               txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK);
7509 +               break;
7510 +       default:
7511 +               DEBUGOUT("Flow control param set incorrectly\n");
7512 +               ret_val = -E1000_ERR_CONFIG;
7513 +               goto out;
7514 +               break;
7515 +       }
7516 +
7517 +       E1000_WRITE_REG(hw, E1000_TXCW, txcw);
7518 +       mac->txcw = txcw;
7519 +
7520 +out:
7521 +       return ret_val;
7522 +}
7523 +
7524 +/**
7525 + *  e1000_set_fc_watermarks_generic - Set flow control high/low watermarks
7526 + *  @hw: pointer to the HW structure
7527 + *
7528 + *  Sets the flow control high/low threshold (watermark) registers.  If
7529 + *  flow control XON frame transmission is enabled, then set XON frame
7530 + *  transmission as well.
7531 + **/
7532 +s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw)
7533 +{
7534 +       s32 ret_val = E1000_SUCCESS;
7535 +       u32 fcrtl = 0, fcrth = 0;
7536 +
7537 +       DEBUGFUNC("e1000_set_fc_watermarks_generic");
7538 +
7539 +       /*
7540 +        * Set the flow control receive threshold registers.  Normally,
7541 +        * these registers will be set to a default threshold that may be
7542 +        * adjusted later by the driver's runtime code.  However, if the
7543 +        * ability to transmit pause frames is not enabled, then these
7544 +        * registers will be set to 0.
7545 +        */
7546 +       if (hw->fc.type & e1000_fc_tx_pause) {
7547 +               /*
7548 +                * We need to set up the Receive Threshold high and low water
7549 +                * marks as well as (optionally) enabling the transmission of
7550 +                * XON frames.
7551 +                */
7552 +               fcrtl = hw->fc.low_water;
7553 +               if (hw->fc.send_xon)
7554 +                       fcrtl |= E1000_FCRTL_XONE;
7555 +
7556 +               fcrth = hw->fc.high_water;
7557 +       }
7558 +       E1000_WRITE_REG(hw, E1000_FCRTL, fcrtl);
7559 +       E1000_WRITE_REG(hw, E1000_FCRTH, fcrth);
7560 +
7561 +       return ret_val;
7562 +}
7563 +
7564 +/**
7565 + *  e1000_set_default_fc_generic - Set flow control default values
7566 + *  @hw: pointer to the HW structure
7567 + *
7568 + *  Read the EEPROM for the default values for flow control and store the
7569 + *  values.
7570 + **/
7571 +static s32 e1000_set_default_fc_generic(struct e1000_hw *hw)
7572 +{
7573 +       s32 ret_val = E1000_SUCCESS;
7574 +       u16 nvm_data;
7575 +
7576 +       DEBUGFUNC("e1000_set_default_fc_generic");
7577 +
7578 +       /*
7579 +        * Read and store word 0x0F of the EEPROM. This word contains bits
7580 +        * that determine the hardware's default PAUSE (flow control) mode,
7581 +        * a bit that determines whether the HW defaults to enabling or
7582 +        * disabling auto-negotiation, and the direction of the
7583 +        * SW defined pins. If there is no SW over-ride of the flow
7584 +        * control setting, then the variable hw->fc will
7585 +        * be initialized based on a value in the EEPROM.
7586 +        */
7587 +       ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data);
7588 +
7589 +       if (ret_val) {
7590 +               DEBUGOUT("NVM Read Error\n");
7591 +               goto out;
7592 +       }
7593 +
7594 +       if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0)
7595 +               hw->fc.type = e1000_fc_none;
7596 +       else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) ==
7597 +                NVM_WORD0F_ASM_DIR)
7598 +               hw->fc.type = e1000_fc_tx_pause;
7599 +       else
7600 +               hw->fc.type = e1000_fc_full;
7601 +
7602 +out:
7603 +       return ret_val;
7604 +}
7605 +
7606 +/**
7607 + *  e1000_force_mac_fc_generic - Force the MAC's flow control settings
7608 + *  @hw: pointer to the HW structure
7609 + *
7610 + *  Force the MAC's flow control settings.  Sets the TFCE and RFCE bits in the
7611 + *  device control register to reflect the adapter settings.  TFCE and RFCE
7612 + *  need to be explicitly set by software when a copper PHY is used because
7613 + *  autonegotiation is managed by the PHY rather than the MAC.  Software must
7614 + *  also configure these bits when link is forced on a fiber connection.
7615 + **/
7616 +s32 e1000_force_mac_fc_generic(struct e1000_hw *hw)
7617 +{
7618 +       u32 ctrl;
7619 +       s32 ret_val = E1000_SUCCESS;
7620 +
7621 +       DEBUGFUNC("e1000_force_mac_fc_generic");
7622 +
7623 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
7624 +
7625 +       /*
7626 +        * Because we didn't get link via the internal auto-negotiation
7627 +        * mechanism (we either forced link or we got link via PHY
7628 +        * auto-neg), we have to manually enable/disable transmit an
7629 +        * receive flow control.
7630 +        *
7631 +        * The "Case" statement below enables/disable flow control
7632 +        * according to the "hw->fc.type" parameter.
7633 +        *
7634 +        * The possible values of the "fc" parameter are:
7635 +        *      0:  Flow control is completely disabled
7636 +        *      1:  Rx flow control is enabled (we can receive pause
7637 +        *          frames but not send pause frames).
7638 +        *      2:  Tx flow control is enabled (we can send pause frames
7639 +        *          frames but we do not receive pause frames).
7640 +        *      3:  Both Rx and Tx flow control (symmetric) is enabled.
7641 +        *  other:  No other values should be possible at this point.
7642 +        */
7643 +       DEBUGOUT1("hw->fc.type = %u\n", hw->fc.type);
7644 +
7645 +       switch (hw->fc.type) {
7646 +       case e1000_fc_none:
7647 +               ctrl &= (~(E1000_CTRL_TFCE | E1000_CTRL_RFCE));
7648 +               break;
7649 +       case e1000_fc_rx_pause:
7650 +               ctrl &= (~E1000_CTRL_TFCE);
7651 +               ctrl |= E1000_CTRL_RFCE;
7652 +               break;
7653 +       case e1000_fc_tx_pause:
7654 +               ctrl &= (~E1000_CTRL_RFCE);
7655 +               ctrl |= E1000_CTRL_TFCE;
7656 +               break;
7657 +       case e1000_fc_full:
7658 +               ctrl |= (E1000_CTRL_TFCE | E1000_CTRL_RFCE);
7659 +               break;
7660 +       default:
7661 +               DEBUGOUT("Flow control param set incorrectly\n");
7662 +               ret_val = -E1000_ERR_CONFIG;
7663 +               goto out;
7664 +       }
7665 +
7666 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
7667 +
7668 +out:
7669 +       return ret_val;
7670 +}
7671 +
7672 +/**
7673 + *  e1000_config_fc_after_link_up_generic - Configures flow control after link
7674 + *  @hw: pointer to the HW structure
7675 + *
7676 + *  Checks the status of auto-negotiation after link up to ensure that the
7677 + *  speed and duplex were not forced.  If the link needed to be forced, then
7678 + *  flow control needs to be forced also.  If auto-negotiation is enabled
7679 + *  and did not fail, then we configure flow control based on our link
7680 + *  partner.
7681 + **/
7682 +s32 e1000_config_fc_after_link_up_generic(struct e1000_hw *hw)
7683 +{
7684 +       struct e1000_mac_info *mac = &hw->mac;
7685 +       s32 ret_val = E1000_SUCCESS;
7686 +       u16 mii_status_reg, mii_nway_adv_reg, mii_nway_lp_ability_reg;
7687 +       u16 speed, duplex;
7688 +
7689 +       DEBUGFUNC("e1000_config_fc_after_link_up_generic");
7690 +
7691 +       /*
7692 +        * Check for the case where we have fiber media and auto-neg failed
7693 +        * so we had to force link.  In this case, we need to force the
7694 +        * configuration of the MAC to match the "fc" parameter.
7695 +        */
7696 +       if (mac->autoneg_failed) {
7697 +               if (hw->phy.media_type == e1000_media_type_fiber ||
7698 +                   hw->phy.media_type == e1000_media_type_internal_serdes)
7699 +                       ret_val = e1000_force_mac_fc_generic(hw);
7700 +       } else {
7701 +               if (hw->phy.media_type == e1000_media_type_copper)
7702 +                       ret_val = e1000_force_mac_fc_generic(hw);
7703 +       }
7704 +
7705 +       if (ret_val) {
7706 +               DEBUGOUT("Error forcing flow control settings\n");
7707 +               goto out;
7708 +       }
7709 +
7710 +       /*
7711 +        * Check for the case where we have copper media and auto-neg is
7712 +        * enabled.  In this case, we need to check and see if Auto-Neg
7713 +        * has completed, and if so, how the PHY and link partner has
7714 +        * flow control configured.
7715 +        */
7716 +       if ((hw->phy.media_type == e1000_media_type_copper) && mac->autoneg) {
7717 +               /*
7718 +                * Read the MII Status Register and check to see if AutoNeg
7719 +                * has completed.  We read this twice because this reg has
7720 +                * some "sticky" (latched) bits.
7721 +                */
7722 +               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg);
7723 +               if (ret_val)
7724 +                       goto out;
7725 +               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &mii_status_reg);
7726 +               if (ret_val)
7727 +                       goto out;
7728 +
7729 +               if (!(mii_status_reg & MII_SR_AUTONEG_COMPLETE)) {
7730 +                       DEBUGOUT("Copper PHY and Auto Neg "
7731 +                                "has not completed.\n");
7732 +                       goto out;
7733 +               }
7734 +
7735 +               /*
7736 +                * The AutoNeg process has completed, so we now need to
7737 +                * read both the Auto Negotiation Advertisement
7738 +                * Register (Address 4) and the Auto_Negotiation Base
7739 +                * Page Ability Register (Address 5) to determine how
7740 +                * flow control was negotiated.
7741 +                */
7742 +               ret_val = hw->phy.ops.read_reg(hw, PHY_AUTONEG_ADV,
7743 +                                            &mii_nway_adv_reg);
7744 +               if (ret_val)
7745 +                       goto out;
7746 +               ret_val = hw->phy.ops.read_reg(hw, PHY_LP_ABILITY,
7747 +                                            &mii_nway_lp_ability_reg);
7748 +               if (ret_val)
7749 +                       goto out;
7750 +
7751 +               /*
7752 +                * Two bits in the Auto Negotiation Advertisement Register
7753 +                * (Address 4) and two bits in the Auto Negotiation Base
7754 +                * Page Ability Register (Address 5) determine flow control
7755 +                * for both the PHY and the link partner.  The following
7756 +                * table, taken out of the IEEE 802.3ab/D6.0 dated March 25,
7757 +                * 1999, describes these PAUSE resolution bits and how flow
7758 +                * control is determined based upon these settings.
7759 +                * NOTE:  DC = Don't Care
7760 +                *
7761 +                *   LOCAL DEVICE  |   LINK PARTNER
7762 +                * PAUSE | ASM_DIR | PAUSE | ASM_DIR | NIC Resolution
7763 +                *-------|---------|-------|---------|--------------------
7764 +                *   0   |    0    |  DC   |   DC    | e1000_fc_none
7765 +                *   0   |    1    |   0   |   DC    | e1000_fc_none
7766 +                *   0   |    1    |   1   |    0    | e1000_fc_none
7767 +                *   0   |    1    |   1   |    1    | e1000_fc_tx_pause
7768 +                *   1   |    0    |   0   |   DC    | e1000_fc_none
7769 +                *   1   |   DC    |   1   |   DC    | e1000_fc_full
7770 +                *   1   |    1    |   0   |    0    | e1000_fc_none
7771 +                *   1   |    1    |   0   |    1    | e1000_fc_rx_pause
7772 +                *
7773 +                * Are both PAUSE bits set to 1?  If so, this implies
7774 +                * Symmetric Flow Control is enabled at both ends.  The
7775 +                * ASM_DIR bits are irrelevant per the spec.
7776 +                *
7777 +                * For Symmetric Flow Control:
7778 +                *
7779 +                *   LOCAL DEVICE  |   LINK PARTNER
7780 +                * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
7781 +                *-------|---------|-------|---------|--------------------
7782 +                *   1   |   DC    |   1   |   DC    | E1000_fc_full
7783 +                *
7784 +                */
7785 +               if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
7786 +                   (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) {
7787 +                       /*
7788 +                        * Now we need to check if the user selected Rx ONLY
7789 +                        * of pause frames.  In this case, we had to advertise
7790 +                        * FULL flow control because we could not advertise RX
7791 +                        * ONLY. Hence, we must now check to see if we need to
7792 +                        * turn OFF  the TRANSMISSION of PAUSE frames.
7793 +                        */
7794 +                       if (hw->fc.original_type == e1000_fc_full) {
7795 +                               hw->fc.type = e1000_fc_full;
7796 +                               DEBUGOUT("Flow Control = FULL.\r\n");
7797 +                       } else {
7798 +                               hw->fc.type = e1000_fc_rx_pause;
7799 +                               DEBUGOUT("Flow Control = "
7800 +                                        "RX PAUSE frames only.\r\n");
7801 +                       }
7802 +               }
7803 +               /*
7804 +                * For receiving PAUSE frames ONLY.
7805 +                *
7806 +                *   LOCAL DEVICE  |   LINK PARTNER
7807 +                * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
7808 +                *-------|---------|-------|---------|--------------------
7809 +                *   0   |    1    |   1   |    1    | e1000_fc_tx_pause
7810 +                */
7811 +               else if (!(mii_nway_adv_reg & NWAY_AR_PAUSE) &&
7812 +                         (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
7813 +                         (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
7814 +                         (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
7815 +                       hw->fc.type = e1000_fc_tx_pause;
7816 +                       DEBUGOUT("Flow Control = TX PAUSE frames only.\r\n");
7817 +               }
7818 +               /*
7819 +                * For transmitting PAUSE frames ONLY.
7820 +                *
7821 +                *   LOCAL DEVICE  |   LINK PARTNER
7822 +                * PAUSE | ASM_DIR | PAUSE | ASM_DIR | Result
7823 +                *-------|---------|-------|---------|--------------------
7824 +                *   1   |    1    |   0   |    1    | e1000_fc_rx_pause
7825 +                */
7826 +               else if ((mii_nway_adv_reg & NWAY_AR_PAUSE) &&
7827 +                        (mii_nway_adv_reg & NWAY_AR_ASM_DIR) &&
7828 +                        !(mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE) &&
7829 +                        (mii_nway_lp_ability_reg & NWAY_LPAR_ASM_DIR)) {
7830 +                       hw->fc.type = e1000_fc_rx_pause;
7831 +                       DEBUGOUT("Flow Control = RX PAUSE frames only.\r\n");
7832 +               } else {
7833 +                       /*
7834 +                        * Per the IEEE spec, at this point flow control
7835 +                        * should be disabled.
7836 +                        */
7837 +                       hw->fc.type = e1000_fc_none;
7838 +                       DEBUGOUT("Flow Control = NONE.\r\n");
7839 +               }
7840 +
7841 +               /*
7842 +                * Now we need to do one last check...  If we auto-
7843 +                * negotiated to HALF DUPLEX, flow control should not be
7844 +                * enabled per IEEE 802.3 spec.
7845 +                */
7846 +               ret_val = mac->ops.get_link_up_info(hw, &speed, &duplex);
7847 +               if (ret_val) {
7848 +                       DEBUGOUT("Error getting link speed and duplex\n");
7849 +                       goto out;
7850 +               }
7851 +
7852 +               if (duplex == HALF_DUPLEX)
7853 +                       hw->fc.type = e1000_fc_none;
7854 +
7855 +               /*
7856 +                * Now we call a subroutine to actually force the MAC
7857 +                * controller to use the correct flow control settings.
7858 +                */
7859 +               ret_val = e1000_force_mac_fc_generic(hw);
7860 +               if (ret_val) {
7861 +                       DEBUGOUT("Error forcing flow control settings\n");
7862 +                       goto out;
7863 +               }
7864 +       }
7865 +
7866 +out:
7867 +       return ret_val;
7868 +}
7869 +
7870 +/**
7871 + *  e1000_get_speed_and_duplex_copper_generic - Retrieve current speed/duplex
7872 + *  @hw: pointer to the HW structure
7873 + *  @speed: stores the current speed
7874 + *  @duplex: stores the current duplex
7875 + *
7876 + *  Read the status register for the current speed/duplex and store the current
7877 + *  speed and duplex for copper connections.
7878 + **/
7879 +s32 e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed,
7880 +                                              u16 *duplex)
7881 +{
7882 +       u32 status;
7883 +
7884 +       DEBUGFUNC("e1000_get_speed_and_duplex_copper_generic");
7885 +
7886 +       status = E1000_READ_REG(hw, E1000_STATUS);
7887 +       if (status & E1000_STATUS_SPEED_1000) {
7888 +               *speed = SPEED_1000;
7889 +               DEBUGOUT("1000 Mbs, ");
7890 +       } else if (status & E1000_STATUS_SPEED_100) {
7891 +               *speed = SPEED_100;
7892 +               DEBUGOUT("100 Mbs, ");
7893 +       } else {
7894 +               *speed = SPEED_10;
7895 +               DEBUGOUT("10 Mbs, ");
7896 +       }
7897 +
7898 +       if (status & E1000_STATUS_FD) {
7899 +               *duplex = FULL_DUPLEX;
7900 +               DEBUGOUT("Full Duplex\n");
7901 +       } else {
7902 +               *duplex = HALF_DUPLEX;
7903 +               DEBUGOUT("Half Duplex\n");
7904 +       }
7905 +
7906 +       return E1000_SUCCESS;
7907 +}
7908 +
7909 +/**
7910 + *  e1000_get_speed_and_duplex_fiber_generic - Retrieve current speed/duplex
7911 + *  @hw: pointer to the HW structure
7912 + *  @speed: stores the current speed
7913 + *  @duplex: stores the current duplex
7914 + *
7915 + *  Sets the speed and duplex to gigabit full duplex (the only possible option)
7916 + *  for fiber/serdes links.
7917 + **/
7918 +s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw *hw,
7919 +                                                    u16 *speed, u16 *duplex)
7920 +{
7921 +       DEBUGFUNC("e1000_get_speed_and_duplex_fiber_serdes_generic");
7922 +
7923 +       *speed = SPEED_1000;
7924 +       *duplex = FULL_DUPLEX;
7925 +
7926 +       return E1000_SUCCESS;
7927 +}
7928 +
7929 +/**
7930 + *  e1000_get_hw_semaphore_generic - Acquire hardware semaphore
7931 + *  @hw: pointer to the HW structure
7932 + *
7933 + *  Acquire the HW semaphore to access the PHY or NVM
7934 + **/
7935 +s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw)
7936 +{
7937 +       u32 swsm;
7938 +       s32 ret_val = E1000_SUCCESS;
7939 +       s32 timeout = hw->nvm.word_size + 1;
7940 +       s32 i = 0;
7941 +
7942 +       DEBUGFUNC("e1000_get_hw_semaphore_generic");
7943 +
7944 +       /* Get the SW semaphore */
7945 +       while (i < timeout) {
7946 +               swsm = E1000_READ_REG(hw, E1000_SWSM);
7947 +               if (!(swsm & E1000_SWSM_SMBI))
7948 +                       break;
7949 +
7950 +               usec_delay(50);
7951 +               i++;
7952 +       }
7953 +
7954 +       if (i == timeout) {
7955 +               DEBUGOUT("Driver can't access device - SMBI bit is set.\n");
7956 +               ret_val = -E1000_ERR_NVM;
7957 +               goto out;
7958 +       }
7959 +
7960 +       /* Get the FW semaphore. */
7961 +       for (i = 0; i < timeout; i++) {
7962 +               swsm = E1000_READ_REG(hw, E1000_SWSM);
7963 +               E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI);
7964 +
7965 +               /* Semaphore acquired if bit latched */
7966 +               if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI)
7967 +                       break;
7968 +
7969 +               usec_delay(50);
7970 +       }
7971 +
7972 +       if (i == timeout) {
7973 +               /* Release semaphores */
7974 +               e1000_put_hw_semaphore_generic(hw);
7975 +               DEBUGOUT("Driver can't access the NVM\n");
7976 +               ret_val = -E1000_ERR_NVM;
7977 +               goto out;
7978 +       }
7979 +
7980 +out:
7981 +       return ret_val;
7982 +}
7983 +
7984 +/**
7985 + *  e1000_put_hw_semaphore_generic - Release hardware semaphore
7986 + *  @hw: pointer to the HW structure
7987 + *
7988 + *  Release hardware semaphore used to access the PHY or NVM
7989 + **/
7990 +void e1000_put_hw_semaphore_generic(struct e1000_hw *hw)
7991 +{
7992 +       u32 swsm;
7993 +
7994 +       DEBUGFUNC("e1000_put_hw_semaphore_generic");
7995 +
7996 +       swsm = E1000_READ_REG(hw, E1000_SWSM);
7997 +
7998 +       swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI);
7999 +
8000 +       E1000_WRITE_REG(hw, E1000_SWSM, swsm);
8001 +}
8002 +
8003 +/**
8004 + *  e1000_get_auto_rd_done_generic - Check for auto read completion
8005 + *  @hw: pointer to the HW structure
8006 + *
8007 + *  Check EEPROM for Auto Read done bit.
8008 + **/
8009 +s32 e1000_get_auto_rd_done_generic(struct e1000_hw *hw)
8010 +{
8011 +       s32 i = 0;
8012 +       s32 ret_val = E1000_SUCCESS;
8013 +
8014 +       DEBUGFUNC("e1000_get_auto_rd_done_generic");
8015 +
8016 +       while (i < AUTO_READ_DONE_TIMEOUT) {
8017 +               if (E1000_READ_REG(hw, E1000_EECD) & E1000_EECD_AUTO_RD)
8018 +                       break;
8019 +               msec_delay(1);
8020 +               i++;
8021 +       }
8022 +
8023 +       if (i == AUTO_READ_DONE_TIMEOUT) {
8024 +               DEBUGOUT("Auto read by HW from NVM has not completed.\n");
8025 +               ret_val = -E1000_ERR_RESET;
8026 +               goto out;
8027 +       }
8028 +
8029 +out:
8030 +       return ret_val;
8031 +}
8032 +
8033 +/**
8034 + *  e1000_valid_led_default_generic - Verify a valid default LED config
8035 + *  @hw: pointer to the HW structure
8036 + *  @data: pointer to the NVM (EEPROM)
8037 + *
8038 + *  Read the EEPROM for the current default LED configuration.  If the
8039 + *  LED configuration is not valid, set to a valid LED configuration.
8040 + **/
8041 +s32 e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data)
8042 +{
8043 +       s32 ret_val;
8044 +
8045 +       DEBUGFUNC("e1000_valid_led_default_generic");
8046 +
8047 +       ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data);
8048 +       if (ret_val) {
8049 +               DEBUGOUT("NVM Read Error\n");
8050 +               goto out;
8051 +       }
8052 +
8053 +       if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF)
8054 +               *data = ID_LED_DEFAULT;
8055 +
8056 +out:
8057 +       return ret_val;
8058 +}
8059 +
8060 +/**
8061 + *  e1000_id_led_init_generic -
8062 + *  @hw: pointer to the HW structure
8063 + *
8064 + **/
8065 +s32 e1000_id_led_init_generic(struct e1000_hw * hw)
8066 +{
8067 +       struct e1000_mac_info *mac = &hw->mac;
8068 +       s32 ret_val;
8069 +       const u32 ledctl_mask = 0x000000FF;
8070 +       const u32 ledctl_on = E1000_LEDCTL_MODE_LED_ON;
8071 +       const u32 ledctl_off = E1000_LEDCTL_MODE_LED_OFF;
8072 +       u16 data, i, temp;
8073 +       const u16 led_mask = 0x0F;
8074 +
8075 +       DEBUGFUNC("e1000_id_led_init_generic");
8076 +
8077 +       ret_val = hw->nvm.ops.valid_led_default(hw, &data);
8078 +       if (ret_val)
8079 +               goto out;
8080 +
8081 +       mac->ledctl_default = E1000_READ_REG(hw, E1000_LEDCTL);
8082 +       mac->ledctl_mode1 = mac->ledctl_default;
8083 +       mac->ledctl_mode2 = mac->ledctl_default;
8084 +
8085 +       for (i = 0; i < 4; i++) {
8086 +               temp = (data >> (i << 2)) & led_mask;
8087 +               switch (temp) {
8088 +               case ID_LED_ON1_DEF2:
8089 +               case ID_LED_ON1_ON2:
8090 +               case ID_LED_ON1_OFF2:
8091 +                       mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3));
8092 +                       mac->ledctl_mode1 |= ledctl_on << (i << 3);
8093 +                       break;
8094 +               case ID_LED_OFF1_DEF2:
8095 +               case ID_LED_OFF1_ON2:
8096 +               case ID_LED_OFF1_OFF2:
8097 +                       mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3));
8098 +                       mac->ledctl_mode1 |= ledctl_off << (i << 3);
8099 +                       break;
8100 +               default:
8101 +                       /* Do nothing */
8102 +                       break;
8103 +               }
8104 +               switch (temp) {
8105 +               case ID_LED_DEF1_ON2:
8106 +               case ID_LED_ON1_ON2:
8107 +               case ID_LED_OFF1_ON2:
8108 +                       mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3));
8109 +                       mac->ledctl_mode2 |= ledctl_on << (i << 3);
8110 +                       break;
8111 +               case ID_LED_DEF1_OFF2:
8112 +               case ID_LED_ON1_OFF2:
8113 +               case ID_LED_OFF1_OFF2:
8114 +                       mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3));
8115 +                       mac->ledctl_mode2 |= ledctl_off << (i << 3);
8116 +                       break;
8117 +               default:
8118 +                       /* Do nothing */
8119 +                       break;
8120 +               }
8121 +       }
8122 +
8123 +out:
8124 +       return ret_val;
8125 +}
8126 +
8127 +/**
8128 + *  e1000_setup_led_generic - Configures SW controllable LED
8129 + *  @hw: pointer to the HW structure
8130 + *
8131 + *  This prepares the SW controllable LED for use and saves the current state
8132 + *  of the LED so it can be later restored.
8133 + **/
8134 +s32 e1000_setup_led_generic(struct e1000_hw *hw)
8135 +{
8136 +       u32 ledctl;
8137 +       s32 ret_val = E1000_SUCCESS;
8138 +
8139 +       DEBUGFUNC("e1000_setup_led_generic");
8140 +
8141 +       if (hw->mac.ops.setup_led != e1000_setup_led_generic) {
8142 +               ret_val = -E1000_ERR_CONFIG;
8143 +               goto out;
8144 +       }
8145 +
8146 +       if (hw->phy.media_type == e1000_media_type_fiber) {
8147 +               ledctl = E1000_READ_REG(hw, E1000_LEDCTL);
8148 +               hw->mac.ledctl_default = ledctl;
8149 +               /* Turn off LED0 */
8150 +               ledctl &= ~(E1000_LEDCTL_LED0_IVRT |
8151 +                           E1000_LEDCTL_LED0_BLINK |
8152 +                           E1000_LEDCTL_LED0_MODE_MASK);
8153 +               ledctl |= (E1000_LEDCTL_MODE_LED_OFF <<
8154 +                          E1000_LEDCTL_LED0_MODE_SHIFT);
8155 +               E1000_WRITE_REG(hw, E1000_LEDCTL, ledctl);
8156 +       } else if (hw->phy.media_type == e1000_media_type_copper) {
8157 +               E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode1);
8158 +       }
8159 +
8160 +out:
8161 +       return ret_val;
8162 +}
8163 +
8164 +/**
8165 + *  e1000_cleanup_led_generic - Set LED config to default operation
8166 + *  @hw: pointer to the HW structure
8167 + *
8168 + *  Remove the current LED configuration and set the LED configuration
8169 + *  to the default value, saved from the EEPROM.
8170 + **/
8171 +s32 e1000_cleanup_led_generic(struct e1000_hw *hw)
8172 +{
8173 +       s32 ret_val = E1000_SUCCESS;
8174 +
8175 +       DEBUGFUNC("e1000_cleanup_led_generic");
8176 +
8177 +       if (hw->mac.ops.cleanup_led != e1000_cleanup_led_generic) {
8178 +               ret_val = -E1000_ERR_CONFIG;
8179 +               goto out;
8180 +       }
8181 +
8182 +       E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_default);
8183 +
8184 +out:
8185 +       return ret_val;
8186 +}
8187 +
8188 +/**
8189 + *  e1000_blink_led_generic - Blink LED
8190 + *  @hw: pointer to the HW structure
8191 + *
8192 + *  Blink the LEDs which are set to be on.
8193 + **/
8194 +s32 e1000_blink_led_generic(struct e1000_hw *hw)
8195 +{
8196 +       u32 ledctl_blink = 0;
8197 +       u32 i;
8198 +
8199 +       DEBUGFUNC("e1000_blink_led_generic");
8200 +
8201 +       if (hw->phy.media_type == e1000_media_type_fiber) {
8202 +               /* always blink LED0 for PCI-E fiber */
8203 +               ledctl_blink = E1000_LEDCTL_LED0_BLINK |
8204 +                    (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED0_MODE_SHIFT);
8205 +       } else {
8206 +               /*
8207 +                * set the blink bit for each LED that's "on" (0x0E)
8208 +                * in ledctl_mode2
8209 +                */
8210 +               ledctl_blink = hw->mac.ledctl_mode2;
8211 +               for (i = 0; i < 4; i++)
8212 +                       if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) ==
8213 +                           E1000_LEDCTL_MODE_LED_ON)
8214 +                               ledctl_blink |= (E1000_LEDCTL_LED0_BLINK <<
8215 +                                                (i * 8));
8216 +       }
8217 +
8218 +       E1000_WRITE_REG(hw, E1000_LEDCTL, ledctl_blink);
8219 +
8220 +       return E1000_SUCCESS;
8221 +}
8222 +
8223 +/**
8224 + *  e1000_led_on_generic - Turn LED on
8225 + *  @hw: pointer to the HW structure
8226 + *
8227 + *  Turn LED on.
8228 + **/
8229 +s32 e1000_led_on_generic(struct e1000_hw *hw)
8230 +{
8231 +       u32 ctrl;
8232 +
8233 +       DEBUGFUNC("e1000_led_on_generic");
8234 +
8235 +       switch (hw->phy.media_type) {
8236 +       case e1000_media_type_fiber:
8237 +               ctrl = E1000_READ_REG(hw, E1000_CTRL);
8238 +               ctrl &= ~E1000_CTRL_SWDPIN0;
8239 +               ctrl |= E1000_CTRL_SWDPIO0;
8240 +               E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
8241 +               break;
8242 +       case e1000_media_type_copper:
8243 +               E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode2);
8244 +               break;
8245 +       default:
8246 +               break;
8247 +       }
8248 +
8249 +       return E1000_SUCCESS;
8250 +}
8251 +
8252 +/**
8253 + *  e1000_led_off_generic - Turn LED off
8254 + *  @hw: pointer to the HW structure
8255 + *
8256 + *  Turn LED off.
8257 + **/
8258 +s32 e1000_led_off_generic(struct e1000_hw *hw)
8259 +{
8260 +       u32 ctrl;
8261 +
8262 +       DEBUGFUNC("e1000_led_off_generic");
8263 +
8264 +       switch (hw->phy.media_type) {
8265 +       case e1000_media_type_fiber:
8266 +               ctrl = E1000_READ_REG(hw, E1000_CTRL);
8267 +               ctrl |= E1000_CTRL_SWDPIN0;
8268 +               ctrl |= E1000_CTRL_SWDPIO0;
8269 +               E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
8270 +               break;
8271 +       case e1000_media_type_copper:
8272 +               E1000_WRITE_REG(hw, E1000_LEDCTL, hw->mac.ledctl_mode1);
8273 +               break;
8274 +       default:
8275 +               break;
8276 +       }
8277 +
8278 +       return E1000_SUCCESS;
8279 +}
8280 +
8281 +/**
8282 + *  e1000_set_pcie_no_snoop_generic - Set PCI-express capabilities
8283 + *  @hw: pointer to the HW structure
8284 + *  @no_snoop: bitmap of snoop events
8285 + *
8286 + *  Set the PCI-express register to snoop for events enabled in 'no_snoop'.
8287 + **/
8288 +void e1000_set_pcie_no_snoop_generic(struct e1000_hw *hw, u32 no_snoop)
8289 +{
8290 +       u32 gcr;
8291 +
8292 +       DEBUGFUNC("e1000_set_pcie_no_snoop_generic");
8293 +
8294 +       if (hw->bus.type != e1000_bus_type_pci_express)
8295 +               goto out;
8296 +
8297 +       if (no_snoop) {
8298 +               gcr = E1000_READ_REG(hw, E1000_GCR);
8299 +               gcr &= ~(PCIE_NO_SNOOP_ALL);
8300 +               gcr |= no_snoop;
8301 +               E1000_WRITE_REG(hw, E1000_GCR, gcr);
8302 +       }
8303 +out:
8304 +       return;
8305 +}
8306 +
8307 +/**
8308 + *  e1000_disable_pcie_master_generic - Disables PCI-express master access
8309 + *  @hw: pointer to the HW structure
8310 + *
8311 + *  Returns 0 (E1000_SUCCESS) if successful, else returns -10
8312 + *  (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused
8313 + *  the master requests to be disabled.
8314 + *
8315 + *  Disables PCI-Express master access and verifies there are no pending
8316 + *  requests.
8317 + **/
8318 +s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw)
8319 +{
8320 +       u32 ctrl;
8321 +       s32 timeout = MASTER_DISABLE_TIMEOUT;
8322 +       s32 ret_val = E1000_SUCCESS;
8323 +
8324 +       DEBUGFUNC("e1000_disable_pcie_master_generic");
8325 +
8326 +       if (hw->bus.type != e1000_bus_type_pci_express)
8327 +               goto out;
8328 +
8329 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
8330 +       ctrl |= E1000_CTRL_GIO_MASTER_DISABLE;
8331 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
8332 +
8333 +       while (timeout) {
8334 +               if (!(E1000_READ_REG(hw, E1000_STATUS) &
8335 +                     E1000_STATUS_GIO_MASTER_ENABLE))
8336 +                       break;
8337 +               usec_delay(100);
8338 +               timeout--;
8339 +       }
8340 +
8341 +       if (!timeout) {
8342 +               DEBUGOUT("Master requests are pending.\n");
8343 +               ret_val = -E1000_ERR_MASTER_REQUESTS_PENDING;
8344 +               goto out;
8345 +       }
8346 +
8347 +out:
8348 +       return ret_val;
8349 +}
8350 +
8351 +/**
8352 + *  e1000_reset_adaptive_generic - Reset Adaptive Interframe Spacing
8353 + *  @hw: pointer to the HW structure
8354 + *
8355 + *  Reset the Adaptive Interframe Spacing throttle to default values.
8356 + **/
8357 +void e1000_reset_adaptive_generic(struct e1000_hw *hw)
8358 +{
8359 +       struct e1000_mac_info *mac = &hw->mac;
8360 +
8361 +       DEBUGFUNC("e1000_reset_adaptive_generic");
8362 +
8363 +       if (!mac->adaptive_ifs) {
8364 +               DEBUGOUT("Not in Adaptive IFS mode!\n");
8365 +               goto out;
8366 +       }
8367 +
8368 +       mac->current_ifs_val = 0;
8369 +       mac->ifs_min_val = IFS_MIN;
8370 +       mac->ifs_max_val = IFS_MAX;
8371 +       mac->ifs_step_size = IFS_STEP;
8372 +       mac->ifs_ratio = IFS_RATIO;
8373 +
8374 +       mac->in_ifs_mode = false;
8375 +       E1000_WRITE_REG(hw, E1000_AIT, 0);
8376 +out:
8377 +       return;
8378 +}
8379 +
8380 +/**
8381 + *  e1000_update_adaptive_generic - Update Adaptive Interframe Spacing
8382 + *  @hw: pointer to the HW structure
8383 + *
8384 + *  Update the Adaptive Interframe Spacing Throttle value based on the
8385 + *  time between transmitted packets and time between collisions.
8386 + **/
8387 +void e1000_update_adaptive_generic(struct e1000_hw *hw)
8388 +{
8389 +       struct e1000_mac_info *mac = &hw->mac;
8390 +
8391 +       DEBUGFUNC("e1000_update_adaptive_generic");
8392 +
8393 +       if (!mac->adaptive_ifs) {
8394 +               DEBUGOUT("Not in Adaptive IFS mode!\n");
8395 +               goto out;
8396 +       }
8397 +
8398 +       if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) {
8399 +               if (mac->tx_packet_delta > MIN_NUM_XMITS) {
8400 +                       mac->in_ifs_mode = true;
8401 +                       if (mac->current_ifs_val < mac->ifs_max_val) {
8402 +                               if (!mac->current_ifs_val)
8403 +                                       mac->current_ifs_val = mac->ifs_min_val;
8404 +                               else
8405 +                                       mac->current_ifs_val +=
8406 +                                               mac->ifs_step_size;
8407 +                               E1000_WRITE_REG(hw, E1000_AIT, mac->current_ifs_val);
8408 +                       }
8409 +               }
8410 +       } else {
8411 +               if (mac->in_ifs_mode &&
8412 +                   (mac->tx_packet_delta <= MIN_NUM_XMITS)) {
8413 +                       mac->current_ifs_val = 0;
8414 +                       mac->in_ifs_mode = false;
8415 +                       E1000_WRITE_REG(hw, E1000_AIT, 0);
8416 +               }
8417 +       }
8418 +out:
8419 +       return;
8420 +}
8421 +
8422 +/**
8423 + *  e1000_validate_mdi_setting_generic - Verify MDI/MDIx settings
8424 + *  @hw: pointer to the HW structure
8425 + *
8426 + *  Verify that when not using auto-negotiation that MDI/MDIx is correctly
8427 + *  set, which is forced to MDI mode only.
8428 + **/
8429 +s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw)
8430 +{
8431 +       s32 ret_val = E1000_SUCCESS;
8432 +
8433 +       DEBUGFUNC("e1000_validate_mdi_setting_generic");
8434 +
8435 +       if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) {
8436 +               DEBUGOUT("Invalid MDI setting detected\n");
8437 +               hw->phy.mdix = 1;
8438 +               ret_val = -E1000_ERR_CONFIG;
8439 +               goto out;
8440 +       }
8441 +
8442 +out:
8443 +       return ret_val;
8444 +}
8445 +
8446 +/**
8447 + *  e1000_write_8bit_ctrl_reg_generic - Write a 8bit CTRL register
8448 + *  @hw: pointer to the HW structure
8449 + *  @reg: 32bit register offset such as E1000_SCTL
8450 + *  @offset: register offset to write to
8451 + *  @data: data to write at register offset
8452 + *
8453 + *  Writes an address/data control type register.  There are several of these
8454 + *  and they all have the format address << 8 | data and bit 31 is polled for
8455 + *  completion.
8456 + **/
8457 +s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg,
8458 +                                      u32 offset, u8 data)
8459 +{
8460 +       u32 i, regvalue = 0;
8461 +       s32 ret_val = E1000_SUCCESS;
8462 +
8463 +       DEBUGFUNC("e1000_write_8bit_ctrl_reg_generic");
8464 +
8465 +       /* Set up the address and data */
8466 +       regvalue = ((u32)data) | (offset << E1000_GEN_CTL_ADDRESS_SHIFT);
8467 +       E1000_WRITE_REG(hw, reg, regvalue);
8468 +
8469 +       /* Poll the ready bit to see if the MDI read completed */
8470 +       for (i = 0; i < E1000_GEN_POLL_TIMEOUT; i++) {
8471 +               usec_delay(5);
8472 +               regvalue = E1000_READ_REG(hw, reg);
8473 +               if (regvalue & E1000_GEN_CTL_READY)
8474 +                       break;
8475 +       }
8476 +       if (!(regvalue & E1000_GEN_CTL_READY)) {
8477 +               DEBUGOUT1("Reg %08x did not indicate ready\n", reg);
8478 +               ret_val = -E1000_ERR_PHY;
8479 +               goto out;
8480 +       }
8481 +
8482 +out:
8483 +       return ret_val;
8484 +}
8485 diff -Nru vanilla/drivers/net/igb/e1000_mac.h linux-i686-2.6.22/drivers/net/igb/e1000_mac.h
8486 --- vanilla/drivers/net/igb/e1000_mac.h 1969-12-31 19:00:00.000000000 -0500
8487 +++ linux-i686-2.6.22/drivers/net/igb/e1000_mac.h       2009-07-16 19:25:22.000000000 -0400
8488 @@ -0,0 +1,80 @@
8489 +/*******************************************************************************
8490 +
8491 +  Intel(R) Gigabit Ethernet Linux driver
8492 +  Copyright(c) 2007-2008 Intel Corporation.
8493 +
8494 +  This program is free software; you can redistribute it and/or modify it
8495 +  under the terms and conditions of the GNU General Public License,
8496 +  version 2, as published by the Free Software Foundation.
8497 +
8498 +  This program is distributed in the hope it will be useful, but WITHOUT
8499 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8500 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
8501 +  more details.
8502 +
8503 +  You should have received a copy of the GNU General Public License along with
8504 +  this program; if not, write to the Free Software Foundation, Inc.,
8505 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
8506 +
8507 +  The full GNU General Public License is included in this distribution in
8508 +  the file called "COPYING".
8509 +
8510 +  Contact Information:
8511 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
8512 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
8513 +
8514 +*******************************************************************************/
8515 +
8516 +#ifndef _E1000_MAC_H_
8517 +#define _E1000_MAC_H_
8518 +
8519 +/*
8520 + * Functions that should not be called directly from drivers but can be used
8521 + * by other files in this 'shared code'
8522 + */
8523 +void e1000_init_mac_ops_generic(struct e1000_hw *hw);
8524 +s32  e1000_blink_led_generic(struct e1000_hw *hw);
8525 +s32  e1000_check_for_copper_link_generic(struct e1000_hw *hw);
8526 +s32  e1000_check_for_fiber_link_generic(struct e1000_hw *hw);
8527 +s32  e1000_check_for_serdes_link_generic(struct e1000_hw *hw);
8528 +s32  e1000_cleanup_led_generic(struct e1000_hw *hw);
8529 +s32  e1000_config_fc_after_link_up_generic(struct e1000_hw *hw);
8530 +s32  e1000_disable_pcie_master_generic(struct e1000_hw *hw);
8531 +s32  e1000_force_mac_fc_generic(struct e1000_hw *hw);
8532 +s32  e1000_get_auto_rd_done_generic(struct e1000_hw *hw);
8533 +s32  e1000_get_bus_info_pcie_generic(struct e1000_hw *hw);
8534 +s32  e1000_get_hw_semaphore_generic(struct e1000_hw *hw);
8535 +s32  e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed,
8536 +                                               u16 *duplex);
8537 +s32  e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw *hw,
8538 +                                                     u16 *speed, u16 *duplex);
8539 +s32  e1000_id_led_init_generic(struct e1000_hw *hw);
8540 +s32  e1000_led_on_generic(struct e1000_hw *hw);
8541 +s32  e1000_led_off_generic(struct e1000_hw *hw);
8542 +void e1000_update_mc_addr_list_generic(struct e1000_hw *hw,
8543 +                                      u8 *mc_addr_list, u32 mc_addr_count,
8544 +                                      u32 rar_used_count, u32 rar_count);
8545 +s32  e1000_set_fc_watermarks_generic(struct e1000_hw *hw);
8546 +s32  e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw);
8547 +s32  e1000_setup_led_generic(struct e1000_hw *hw);
8548 +s32  e1000_setup_link_generic(struct e1000_hw *hw);
8549 +s32  e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg,
8550 +                                       u32 offset, u8 data);
8551 +
8552 +u32  e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr);
8553 +
8554 +void e1000_clear_hw_cntrs_base_generic(struct e1000_hw *hw);
8555 +void e1000_clear_vfta_generic(struct e1000_hw *hw);
8556 +void e1000_config_collision_dist_generic(struct e1000_hw *hw);
8557 +void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count);
8558 +void e1000_mta_set_generic(struct e1000_hw *hw, u32 hash_value);
8559 +void e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw);
8560 +void e1000_put_hw_semaphore_generic(struct e1000_hw *hw);
8561 +void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index);
8562 +s32  e1000_check_alt_mac_addr_generic(struct e1000_hw *hw);
8563 +void e1000_reset_adaptive_generic(struct e1000_hw *hw);
8564 +void e1000_set_pcie_no_snoop_generic(struct e1000_hw *hw, u32 no_snoop);
8565 +void e1000_update_adaptive_generic(struct e1000_hw *hw);
8566 +void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value);
8567 +
8568 +#endif
8569 Binary files vanilla/drivers/net/igb/e1000_mac.o and linux-i686-2.6.22/drivers/net/igb/e1000_mac.o differ
8570 diff -Nru vanilla/drivers/net/igb/.e1000_mac.o.cmd linux-i686-2.6.22/drivers/net/igb/.e1000_mac.o.cmd
8571 --- vanilla/drivers/net/igb/.e1000_mac.o.cmd    1969-12-31 19:00:00.000000000 -0500
8572 +++ linux-i686-2.6.22/drivers/net/igb/.e1000_mac.o.cmd  2009-07-16 19:53:41.000000000 -0400
8573 @@ -0,0 +1,549 @@
8574 +cmd_drivers/net/igb/e1000_mac.o := gcc -m32 -Wp,-MD,drivers/net/igb/.e1000_mac.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(e1000_mac)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_e1000_mac.o drivers/net/igb/e1000_mac.c
8575 +
8576 +deps_drivers/net/igb/e1000_mac.o := \
8577 +  drivers/net/igb/e1000_mac.c \
8578 +  drivers/net/igb/e1000_api.h \
8579 +  drivers/net/igb/e1000_hw.h \
8580 +  drivers/net/igb/e1000_osdep.h \
8581 +  include/linux/pci.h \
8582 +    $(wildcard include/config/pci/msi.h) \
8583 +    $(wildcard include/config/pci.h) \
8584 +    $(wildcard include/config/ht/irq.h) \
8585 +    $(wildcard include/config/pci/domains.h) \
8586 +  include/linux/pci_regs.h \
8587 +  include/linux/mod_devicetable.h \
8588 +  include/linux/types.h \
8589 +    $(wildcard include/config/uid16.h) \
8590 +    $(wildcard include/config/lbd.h) \
8591 +    $(wildcard include/config/lsf.h) \
8592 +    $(wildcard include/config/resources/64bit.h) \
8593 +  include/linux/posix_types.h \
8594 +  include/linux/stddef.h \
8595 +  include/linux/compiler.h \
8596 +    $(wildcard include/config/enable/must/check.h) \
8597 +  include/linux/compiler-gcc4.h \
8598 +    $(wildcard include/config/forced/inlining.h) \
8599 +  include/linux/compiler-gcc.h \
8600 +  include/asm/posix_types.h \
8601 +  include/asm/types.h \
8602 +    $(wildcard include/config/highmem64g.h) \
8603 +  include/linux/ioport.h \
8604 +  include/linux/list.h \
8605 +    $(wildcard include/config/debug/list.h) \
8606 +  include/linux/poison.h \
8607 +  include/linux/prefetch.h \
8608 +  include/asm/processor.h \
8609 +    $(wildcard include/config/smp.h) \
8610 +    $(wildcard include/config/x86/ht.h) \
8611 +    $(wildcard include/config/paravirt.h) \
8612 +    $(wildcard include/config/mk8.h) \
8613 +    $(wildcard include/config/mk7.h) \
8614 +  include/asm/vm86.h \
8615 +    $(wildcard include/config/vm86.h) \
8616 +  include/asm/ptrace.h \
8617 +  include/asm/ptrace-abi.h \
8618 +  include/asm/segment.h \
8619 +  include/asm/math_emu.h \
8620 +  include/asm/sigcontext.h \
8621 +  include/asm/page.h \
8622 +    $(wildcard include/config/x86/use/3dnow.h) \
8623 +    $(wildcard include/config/x86/pae.h) \
8624 +    $(wildcard include/config/hugetlb/page.h) \
8625 +    $(wildcard include/config/highmem4g.h) \
8626 +    $(wildcard include/config/page/offset.h) \
8627 +    $(wildcard include/config/flatmem.h) \
8628 +  include/asm-generic/pgtable-nopmd.h \
8629 +  include/asm-generic/pgtable-nopud.h \
8630 +  include/asm-generic/memory_model.h \
8631 +    $(wildcard include/config/discontigmem.h) \
8632 +    $(wildcard include/config/sparsemem.h) \
8633 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
8634 +  include/asm-generic/page.h \
8635 +  include/asm/cpufeature.h \
8636 +  include/linux/bitops.h \
8637 +  include/asm/bitops.h \
8638 +  include/asm/alternative.h \
8639 +  include/asm-generic/bitops/sched.h \
8640 +  include/asm-generic/bitops/hweight.h \
8641 +  include/asm-generic/bitops/fls64.h \
8642 +  include/asm-generic/bitops/ext2-non-atomic.h \
8643 +  include/asm-generic/bitops/le.h \
8644 +  include/asm/byteorder.h \
8645 +    $(wildcard include/config/x86/bswap.h) \
8646 +  include/linux/byteorder/little_endian.h \
8647 +  include/linux/byteorder/swab.h \
8648 +  include/linux/byteorder/generic.h \
8649 +  include/asm-generic/bitops/minix.h \
8650 +  include/asm/required-features.h \
8651 +    $(wildcard include/config/x86/minimum/cpu.h) \
8652 +    $(wildcard include/config/x86/cmov.h) \
8653 +    $(wildcard include/config/x86/cmpxchg64.h) \
8654 +  include/asm/msr.h \
8655 +  include/asm/msr-index.h \
8656 +  include/asm/errno.h \
8657 +  include/asm-generic/errno.h \
8658 +  include/asm-generic/errno-base.h \
8659 +  include/linux/errno.h \
8660 +  include/asm/system.h \
8661 +    $(wildcard include/config/x86/oostore.h) \
8662 +  include/linux/kernel.h \
8663 +    $(wildcard include/config/preempt/voluntary.h) \
8664 +    $(wildcard include/config/debug/spinlock/sleep.h) \
8665 +    $(wildcard include/config/printk.h) \
8666 +    $(wildcard include/config/numa.h) \
8667 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
8668 +  include/linux/linkage.h \
8669 +  include/asm/linkage.h \
8670 +    $(wildcard include/config/x86/alignment/16.h) \
8671 +  include/linux/log2.h \
8672 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
8673 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
8674 +  include/asm/bug.h \
8675 +    $(wildcard include/config/bug.h) \
8676 +    $(wildcard include/config/debug/bugverbose.h) \
8677 +  include/asm-generic/bug.h \
8678 +    $(wildcard include/config/generic/bug.h) \
8679 +  include/asm/cmpxchg.h \
8680 +    $(wildcard include/config/x86/cmpxchg.h) \
8681 +  include/linux/irqflags.h \
8682 +    $(wildcard include/config/trace/irqflags.h) \
8683 +    $(wildcard include/config/trace/irqflags/support.h) \
8684 +    $(wildcard include/config/x86.h) \
8685 +  include/asm/irqflags.h \
8686 +  include/asm/processor-flags.h \
8687 +  include/linux/cache.h \
8688 +  include/asm/cache.h \
8689 +    $(wildcard include/config/x86/l1/cache/shift.h) \
8690 +  include/linux/threads.h \
8691 +    $(wildcard include/config/nr/cpus.h) \
8692 +    $(wildcard include/config/base/small.h) \
8693 +  include/asm/percpu.h \
8694 +  include/linux/cpumask.h \
8695 +    $(wildcard include/config/hotplug/cpu.h) \
8696 +  include/linux/bitmap.h \
8697 +  include/linux/string.h \
8698 +  include/asm/string.h \
8699 +  include/linux/init.h \
8700 +    $(wildcard include/config/modules.h) \
8701 +    $(wildcard include/config/hotplug.h) \
8702 +    $(wildcard include/config/memory/hotplug.h) \
8703 +    $(wildcard include/config/acpi/hotplug/memory.h) \
8704 +  include/asm/atomic.h \
8705 +    $(wildcard include/config/m386.h) \
8706 +  include/asm-generic/atomic.h \
8707 +  include/linux/device.h \
8708 +    $(wildcard include/config/debug/devres.h) \
8709 +  include/linux/kobject.h \
8710 +  include/linux/sysfs.h \
8711 +    $(wildcard include/config/sysfs.h) \
8712 +  include/linux/spinlock.h \
8713 +    $(wildcard include/config/debug/spinlock.h) \
8714 +    $(wildcard include/config/preempt.h) \
8715 +    $(wildcard include/config/debug/lock/alloc.h) \
8716 +  include/linux/preempt.h \
8717 +    $(wildcard include/config/debug/preempt.h) \
8718 +  include/linux/thread_info.h \
8719 +  include/asm/thread_info.h \
8720 +    $(wildcard include/config/4kstacks.h) \
8721 +    $(wildcard include/config/debug/stack/usage.h) \
8722 +  include/linux/stringify.h \
8723 +  include/linux/bottom_half.h \
8724 +  include/linux/spinlock_types.h \
8725 +  include/linux/lockdep.h \
8726 +    $(wildcard include/config/lockdep.h) \
8727 +    $(wildcard include/config/generic/hardirqs.h) \
8728 +    $(wildcard include/config/prove/locking.h) \
8729 +  include/asm/spinlock_types.h \
8730 +  include/asm/spinlock.h \
8731 +    $(wildcard include/config/x86/ppro/fence.h) \
8732 +  include/asm/rwlock.h \
8733 +  include/linux/spinlock_api_smp.h \
8734 +  include/linux/kref.h \
8735 +  include/linux/wait.h \
8736 +  include/asm/current.h \
8737 +  include/linux/klist.h \
8738 +  include/linux/completion.h \
8739 +  include/linux/module.h \
8740 +    $(wildcard include/config/modversions.h) \
8741 +    $(wildcard include/config/unused/symbols.h) \
8742 +    $(wildcard include/config/module/unload.h) \
8743 +    $(wildcard include/config/kallsyms.h) \
8744 +  include/linux/stat.h \
8745 +  include/asm/stat.h \
8746 +  include/linux/time.h \
8747 +  include/linux/seqlock.h \
8748 +  include/linux/vs_time.h \
8749 +    $(wildcard include/config/vserver/vtime.h) \
8750 +  include/linux/kmod.h \
8751 +    $(wildcard include/config/kmod.h) \
8752 +  include/linux/elf.h \
8753 +  include/linux/auxvec.h \
8754 +  include/asm/auxvec.h \
8755 +  include/linux/elf-em.h \
8756 +  include/asm/elf.h \
8757 +  include/asm/user.h \
8758 +  include/asm/desc.h \
8759 +  include/asm/ldt.h \
8760 +  include/linux/smp.h \
8761 +  include/asm/smp.h \
8762 +    $(wildcard include/config/x86/local/apic.h) \
8763 +    $(wildcard include/config/x86/io/apic.h) \
8764 +  include/asm/mpspec.h \
8765 +    $(wildcard include/config/acpi.h) \
8766 +  include/asm/mpspec_def.h \
8767 +  include/asm-i386/mach-generic/mach_mpspec.h \
8768 +  include/asm/apic.h \
8769 +    $(wildcard include/config/x86/good/apic.h) \
8770 +  include/linux/pm.h \
8771 +    $(wildcard include/config/pm.h) \
8772 +  include/linux/delay.h \
8773 +  include/asm/delay.h \
8774 +  include/asm/fixmap.h \
8775 +    $(wildcard include/config/highmem.h) \
8776 +    $(wildcard include/config/x86/visws/apic.h) \
8777 +    $(wildcard include/config/x86/f00f/bug.h) \
8778 +    $(wildcard include/config/x86/cyclone/timer.h) \
8779 +    $(wildcard include/config/pci/mmconfig.h) \
8780 +  include/asm/acpi.h \
8781 +    $(wildcard include/config/acpi/sleep.h) \
8782 +  include/acpi/pdc_intel.h \
8783 +  include/asm/apicdef.h \
8784 +  include/asm/kmap_types.h \
8785 +    $(wildcard include/config/debug/highmem.h) \
8786 +  include/asm/io_apic.h \
8787 +  include/asm-i386/mach-generic/mach_apicdef.h \
8788 +  include/asm/genapic.h \
8789 +  include/linux/percpu.h \
8790 +  include/linux/slab.h \
8791 +    $(wildcard include/config/slab/debug.h) \
8792 +    $(wildcard include/config/slab.h) \
8793 +    $(wildcard include/config/slub.h) \
8794 +    $(wildcard include/config/debug/slab.h) \
8795 +  include/linux/gfp.h \
8796 +    $(wildcard include/config/zone/dma.h) \
8797 +    $(wildcard include/config/zone/dma32.h) \
8798 +  include/linux/mmzone.h \
8799 +    $(wildcard include/config/force/max/zoneorder.h) \
8800 +    $(wildcard include/config/arch/populates/node/map.h) \
8801 +    $(wildcard include/config/flat/node/mem/map.h) \
8802 +    $(wildcard include/config/have/memory/present.h) \
8803 +    $(wildcard include/config/need/node/memmap/size.h) \
8804 +    $(wildcard include/config/need/multiple/nodes.h) \
8805 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
8806 +    $(wildcard include/config/sparsemem/extreme.h) \
8807 +    $(wildcard include/config/nodes/span/other/nodes.h) \
8808 +    $(wildcard include/config/holes/in/zone.h) \
8809 +  include/linux/numa.h \
8810 +    $(wildcard include/config/nodes/shift.h) \
8811 +  include/linux/nodemask.h \
8812 +  include/linux/memory_hotplug.h \
8813 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
8814 +  include/linux/notifier.h \
8815 +  include/linux/mutex.h \
8816 +    $(wildcard include/config/debug/mutexes.h) \
8817 +    $(wildcard include/config/chopstix.h) \
8818 +  include/linux/rwsem.h \
8819 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
8820 +  include/asm/rwsem.h \
8821 +  include/linux/srcu.h \
8822 +  include/linux/topology.h \
8823 +    $(wildcard include/config/sched/smt.h) \
8824 +    $(wildcard include/config/sched/mc.h) \
8825 +  include/asm/topology.h \
8826 +  include/asm-generic/topology.h \
8827 +  include/linux/slab_def.h \
8828 +  include/linux/kmalloc_sizes.h \
8829 +  include/asm/mmu.h \
8830 +  include/asm/semaphore.h \
8831 +  include/linux/moduleparam.h \
8832 +  include/asm/local.h \
8833 +  include/asm/module.h \
8834 +    $(wildcard include/config/m486.h) \
8835 +    $(wildcard include/config/m586.h) \
8836 +    $(wildcard include/config/m586tsc.h) \
8837 +    $(wildcard include/config/m586mmx.h) \
8838 +    $(wildcard include/config/mcore2.h) \
8839 +    $(wildcard include/config/m686.h) \
8840 +    $(wildcard include/config/mpentiumii.h) \
8841 +    $(wildcard include/config/mpentiumiii.h) \
8842 +    $(wildcard include/config/mpentiumm.h) \
8843 +    $(wildcard include/config/mpentium4.h) \
8844 +    $(wildcard include/config/mk6.h) \
8845 +    $(wildcard include/config/x86/elan.h) \
8846 +    $(wildcard include/config/mcrusoe.h) \
8847 +    $(wildcard include/config/mefficeon.h) \
8848 +    $(wildcard include/config/mwinchipc6.h) \
8849 +    $(wildcard include/config/mwinchip2.h) \
8850 +    $(wildcard include/config/mwinchip3d.h) \
8851 +    $(wildcard include/config/mcyrixiii.h) \
8852 +    $(wildcard include/config/mviac3/2.h) \
8853 +    $(wildcard include/config/mviac7.h) \
8854 +    $(wildcard include/config/mgeodegx1.h) \
8855 +    $(wildcard include/config/mgeode/lx.h) \
8856 +  include/asm/device.h \
8857 +  include/linux/pci_ids.h \
8858 +  include/linux/dmapool.h \
8859 +  include/asm/io.h \
8860 +    $(wildcard include/config/x86/numaq.h) \
8861 +  include/asm-generic/iomap.h \
8862 +  include/linux/vmalloc.h \
8863 +  include/asm/scatterlist.h \
8864 +  include/asm/pci.h \
8865 +  include/linux/mm.h \
8866 +    $(wildcard include/config/sysctl.h) \
8867 +    $(wildcard include/config/mmu.h) \
8868 +    $(wildcard include/config/stack/growsup.h) \
8869 +    $(wildcard include/config/debug/vm.h) \
8870 +    $(wildcard include/config/shmem.h) \
8871 +    $(wildcard include/config/split/ptlock/cpus.h) \
8872 +    $(wildcard include/config/ia64.h) \
8873 +    $(wildcard include/config/proc/fs.h) \
8874 +    $(wildcard include/config/debug/pagealloc.h) \
8875 +  include/linux/capability.h \
8876 +  include/linux/rbtree.h \
8877 +  include/linux/prio_tree.h \
8878 +  include/linux/fs.h \
8879 +    $(wildcard include/config/dnotify.h) \
8880 +    $(wildcard include/config/vserver/cowbl.h) \
8881 +    $(wildcard include/config/quota.h) \
8882 +    $(wildcard include/config/inotify.h) \
8883 +    $(wildcard include/config/security.h) \
8884 +    $(wildcard include/config/epoll.h) \
8885 +    $(wildcard include/config/auditsyscall.h) \
8886 +    $(wildcard include/config/block.h) \
8887 +    $(wildcard include/config/fs/xip.h) \
8888 +    $(wildcard include/config/migration.h) \
8889 +  include/linux/limits.h \
8890 +  include/linux/ioctl.h \
8891 +  include/asm/ioctl.h \
8892 +  include/asm-generic/ioctl.h \
8893 +  include/linux/kdev_t.h \
8894 +  include/linux/dcache.h \
8895 +    $(wildcard include/config/profiling.h) \
8896 +  include/linux/rcupdate.h \
8897 +  include/linux/namei.h \
8898 +  include/linux/radix-tree.h \
8899 +  include/linux/pid.h \
8900 +  include/linux/quota.h \
8901 +  include/linux/dqblk_xfs.h \
8902 +  include/linux/dqblk_v1.h \
8903 +  include/linux/dqblk_v2.h \
8904 +  include/linux/nfs_fs_i.h \
8905 +  include/linux/nfs.h \
8906 +  include/linux/sunrpc/msg_prot.h \
8907 +  include/linux/fcntl.h \
8908 +  include/asm/fcntl.h \
8909 +  include/asm-generic/fcntl.h \
8910 +    $(wildcard include/config/64bit.h) \
8911 +  include/linux/err.h \
8912 +  include/linux/debug_locks.h \
8913 +    $(wildcard include/config/debug/locking/api/selftests.h) \
8914 +  include/linux/backing-dev.h \
8915 +  include/linux/mm_types.h \
8916 +  include/asm/pgtable.h \
8917 +    $(wildcard include/config/highpte.h) \
8918 +  include/asm/paravirt.h \
8919 +  include/asm/pgtable-2level-defs.h \
8920 +  include/asm/pgtable-2level.h \
8921 +  include/asm-generic/pgtable.h \
8922 +  include/linux/page-flags.h \
8923 +    $(wildcard include/config/s390.h) \
8924 +    $(wildcard include/config/swap.h) \
8925 +  include/linux/vmstat.h \
8926 +    $(wildcard include/config/vm/event/counters.h) \
8927 +  include/asm-generic/pci-dma-compat.h \
8928 +  include/linux/dma-mapping.h \
8929 +  include/asm/dma-mapping.h \
8930 +  include/asm-generic/pci.h \
8931 +  include/linux/interrupt.h \
8932 +    $(wildcard include/config/high/res/timers.h) \
8933 +    $(wildcard include/config/generic/irq/probe.h) \
8934 +  include/linux/irqreturn.h \
8935 +  include/linux/hardirq.h \
8936 +    $(wildcard include/config/preempt/bkl.h) \
8937 +    $(wildcard include/config/virt/cpu/accounting.h) \
8938 +  include/linux/smp_lock.h \
8939 +    $(wildcard include/config/lock/kernel.h) \
8940 +  include/linux/sched.h \
8941 +    $(wildcard include/config/no/hz.h) \
8942 +    $(wildcard include/config/detect/softlockup.h) \
8943 +    $(wildcard include/config/keys.h) \
8944 +    $(wildcard include/config/bsd/process/acct.h) \
8945 +    $(wildcard include/config/taskstats.h) \
8946 +    $(wildcard include/config/inotify/user.h) \
8947 +    $(wildcard include/config/schedstats.h) \
8948 +    $(wildcard include/config/task/delay/acct.h) \
8949 +    $(wildcard include/config/blk/dev/io/trace.h) \
8950 +    $(wildcard include/config/cc/stackprotector.h) \
8951 +    $(wildcard include/config/sysvipc.h) \
8952 +    $(wildcard include/config/rt/mutexes.h) \
8953 +    $(wildcard include/config/task/xacct.h) \
8954 +    $(wildcard include/config/cpusets.h) \
8955 +    $(wildcard include/config/compat.h) \
8956 +    $(wildcard include/config/fault/injection.h) \
8957 +  include/asm/param.h \
8958 +    $(wildcard include/config/hz.h) \
8959 +  include/linux/timex.h \
8960 +    $(wildcard include/config/time/interpolation.h) \
8961 +  include/asm/timex.h \
8962 +  include/asm/tsc.h \
8963 +    $(wildcard include/config/x86/tsc.h) \
8964 +    $(wildcard include/config/x86/generic.h) \
8965 +  include/linux/jiffies.h \
8966 +  include/linux/calc64.h \
8967 +  include/asm/div64.h \
8968 +  include/asm/cputime.h \
8969 +  include/asm-generic/cputime.h \
8970 +  include/linux/sem.h \
8971 +  include/linux/ipc.h \
8972 +    $(wildcard include/config/ipc/ns.h) \
8973 +  include/asm/ipcbuf.h \
8974 +  include/asm/sembuf.h \
8975 +  include/linux/signal.h \
8976 +  include/asm/signal.h \
8977 +  include/asm-generic/signal.h \
8978 +  include/asm/siginfo.h \
8979 +  include/asm-generic/siginfo.h \
8980 +  include/linux/securebits.h \
8981 +  include/linux/fs_struct.h \
8982 +  include/linux/seccomp.h \
8983 +    $(wildcard include/config/seccomp.h) \
8984 +  include/linux/futex.h \
8985 +    $(wildcard include/config/futex.h) \
8986 +  include/linux/rtmutex.h \
8987 +    $(wildcard include/config/debug/rt/mutexes.h) \
8988 +  include/linux/plist.h \
8989 +    $(wildcard include/config/debug/pi/list.h) \
8990 +  include/linux/param.h \
8991 +  include/linux/resource.h \
8992 +  include/asm/resource.h \
8993 +  include/asm-generic/resource.h \
8994 +  include/linux/timer.h \
8995 +    $(wildcard include/config/timer/stats.h) \
8996 +  include/linux/ktime.h \
8997 +    $(wildcard include/config/ktime/scalar.h) \
8998 +  include/linux/hrtimer.h \
8999 +  include/linux/task_io_accounting.h \
9000 +    $(wildcard include/config/task/io/accounting.h) \
9001 +  include/linux/aio.h \
9002 +  include/linux/workqueue.h \
9003 +  include/linux/aio_abi.h \
9004 +  include/linux/uio.h \
9005 +  include/asm/hardirq.h \
9006 +  include/linux/irq.h \
9007 +    $(wildcard include/config/irq/per/cpu.h) \
9008 +    $(wildcard include/config/irq/release/method.h) \
9009 +    $(wildcard include/config/generic/pending/irq.h) \
9010 +    $(wildcard include/config/irqbalance.h) \
9011 +    $(wildcard include/config/auto/irq/affinity.h) \
9012 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
9013 +  include/asm/irq.h \
9014 +  include/asm-i386/mach-default/irq_vectors.h \
9015 +  include/asm-i386/mach-default/irq_vectors_limits.h \
9016 +  include/asm/irq_regs.h \
9017 +  include/asm/hw_irq.h \
9018 +  include/linux/profile.h \
9019 +  include/asm/sections.h \
9020 +  include/asm-generic/sections.h \
9021 +  include/linux/irq_cpustat.h \
9022 +  include/linux/if_ether.h \
9023 +  include/linux/skbuff.h \
9024 +    $(wildcard include/config/nf/conntrack.h) \
9025 +    $(wildcard include/config/bridge/netfilter.h) \
9026 +    $(wildcard include/config/vlan/8021q.h) \
9027 +    $(wildcard include/config/net/sched.h) \
9028 +    $(wildcard include/config/net/cls/act.h) \
9029 +    $(wildcard include/config/net/dma.h) \
9030 +    $(wildcard include/config/network/secmark.h) \
9031 +  include/linux/net.h \
9032 +  include/asm/socket.h \
9033 +  include/asm/sockios.h \
9034 +  include/linux/random.h \
9035 +  include/linux/sysctl.h \
9036 +    $(wildcard include/config/icmp/ipod.h) \
9037 +    $(wildcard include/config/web100/net100.h) \
9038 +    $(wildcard include/config/web100/stats.h) \
9039 +  include/linux/textsearch.h \
9040 +  include/net/checksum.h \
9041 +  include/asm/uaccess.h \
9042 +    $(wildcard include/config/x86/intel/usercopy.h) \
9043 +    $(wildcard include/config/x86/wp/works/ok.h) \
9044 +  include/asm/checksum.h \
9045 +  include/linux/in6.h \
9046 +  include/linux/dmaengine.h \
9047 +    $(wildcard include/config/dma/engine.h) \
9048 +  drivers/net/igb/kcompat.h \
9049 +    $(wildcard include/config/e1000/napi.h) \
9050 +    $(wildcard include/config/e1000e/napi.h) \
9051 +    $(wildcard include/config/ixgb/napi.h) \
9052 +    $(wildcard include/config/e1000/disable/packet/split.h) \
9053 +    $(wildcard include/config/igb/disable/packet/split.h) \
9054 +    $(wildcard include/config/net/poll/controller.h) \
9055 +    $(wildcard include/config/space/len.h) \
9056 +    $(wildcard include/config/netpoll.h) \
9057 +    $(wildcard include/config/netdevices/multiqueue.h) \
9058 +  include/linux/version.h \
9059 +  include/linux/netdevice.h \
9060 +    $(wildcard include/config/ax25.h) \
9061 +    $(wildcard include/config/tr.h) \
9062 +    $(wildcard include/config/net/ipip.h) \
9063 +    $(wildcard include/config/net/ipgre.h) \
9064 +    $(wildcard include/config/ipv6/sit.h) \
9065 +    $(wildcard include/config/ipv6/tunnel.h) \
9066 +    $(wildcard include/config/wireless/ext.h) \
9067 +    $(wildcard include/config/netpoll/trap.h) \
9068 +  include/linux/if.h \
9069 +  include/linux/socket.h \
9070 +  include/linux/sockios.h \
9071 +  include/linux/hdlc/ioctl.h \
9072 +  include/linux/if_packet.h \
9073 +  include/linux/etherdevice.h \
9074 +  include/linux/in.h \
9075 +  include/linux/ip.h \
9076 +  include/linux/udp.h \
9077 +  include/net/inet_sock.h \
9078 +    $(wildcard include/config/ipv6.h) \
9079 +  include/linux/jhash.h \
9080 +  include/net/flow.h \
9081 +    $(wildcard include/config/ipv6/mip6.h) \
9082 +  include/net/sock.h \
9083 +    $(wildcard include/config/security/network.h) \
9084 +  include/linux/security.h \
9085 +    $(wildcard include/config/security/network/xfrm.h) \
9086 +  include/linux/binfmts.h \
9087 +  include/linux/shm.h \
9088 +  include/asm/shmparam.h \
9089 +  include/asm/shmbuf.h \
9090 +  include/linux/msg.h \
9091 +  include/asm/msgbuf.h \
9092 +  include/linux/key.h \
9093 +  include/linux/xfrm.h \
9094 +  include/linux/filter.h \
9095 +  include/net/dst.h \
9096 +    $(wildcard include/config/net/cls/route.h) \
9097 +    $(wildcard include/config/xfrm.h) \
9098 +  include/linux/rtnetlink.h \
9099 +  include/linux/netlink.h \
9100 +  include/linux/if_link.h \
9101 +  include/linux/if_addr.h \
9102 +  include/linux/neighbour.h \
9103 +  include/net/neighbour.h \
9104 +  include/linux/seq_file.h \
9105 +  include/net/rtnetlink.h \
9106 +  include/net/netlink.h \
9107 +  include/net/request_sock.h \
9108 +  include/linux/mii.h \
9109 +  include/linux/latency.h \
9110 +  drivers/net/igb/e1000_regs.h \
9111 +  drivers/net/igb/e1000_defines.h \
9112 +    $(wildcard include/config/res.h) \
9113 +    $(wildcard include/config/fault.h) \
9114 +  drivers/net/igb/e1000_mac.h \
9115 +  drivers/net/igb/e1000_phy.h \
9116 +  drivers/net/igb/e1000_nvm.h \
9117 +  drivers/net/igb/e1000_manage.h \
9118 +  drivers/net/igb/e1000_82575.h \
9119 +
9120 +drivers/net/igb/e1000_mac.o: $(deps_drivers/net/igb/e1000_mac.o)
9121 +
9122 +$(deps_drivers/net/igb/e1000_mac.o):
9123 diff -Nru vanilla/drivers/net/igb/e1000_manage.c linux-i686-2.6.22/drivers/net/igb/e1000_manage.c
9124 --- vanilla/drivers/net/igb/e1000_manage.c      1969-12-31 19:00:00.000000000 -0500
9125 +++ linux-i686-2.6.22/drivers/net/igb/e1000_manage.c    2009-07-16 19:25:22.000000000 -0400
9126 @@ -0,0 +1,382 @@
9127 +/*******************************************************************************
9128 +
9129 +  Intel(R) Gigabit Ethernet Linux driver
9130 +  Copyright(c) 2007-2008 Intel Corporation.
9131 +
9132 +  This program is free software; you can redistribute it and/or modify it
9133 +  under the terms and conditions of the GNU General Public License,
9134 +  version 2, as published by the Free Software Foundation.
9135 +
9136 +  This program is distributed in the hope it will be useful, but WITHOUT
9137 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9138 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
9139 +  more details.
9140 +
9141 +  You should have received a copy of the GNU General Public License along with
9142 +  this program; if not, write to the Free Software Foundation, Inc.,
9143 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
9144 +
9145 +  The full GNU General Public License is included in this distribution in
9146 +  the file called "COPYING".
9147 +
9148 +  Contact Information:
9149 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
9150 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
9151 +
9152 +*******************************************************************************/
9153 +
9154 +#include "e1000_api.h"
9155 +
9156 +static u8 e1000_calculate_checksum(u8 *buffer, u32 length);
9157 +
9158 +/**
9159 + *  e1000_calculate_checksum - Calculate checksum for buffer
9160 + *  @buffer: pointer to EEPROM
9161 + *  @length: size of EEPROM to calculate a checksum for
9162 + *
9163 + *  Calculates the checksum for some buffer on a specified length.  The
9164 + *  checksum calculated is returned.
9165 + **/
9166 +static u8 e1000_calculate_checksum(u8 *buffer, u32 length)
9167 +{
9168 +       u32 i;
9169 +       u8  sum = 0;
9170 +
9171 +       DEBUGFUNC("e1000_calculate_checksum");
9172 +
9173 +       if (!buffer)
9174 +               return 0;
9175 +
9176 +       for (i = 0; i < length; i++)
9177 +               sum += buffer[i];
9178 +
9179 +       return (u8) (0 - sum);
9180 +}
9181 +
9182 +/**
9183 + *  e1000_mng_enable_host_if_generic - Checks host interface is enabled
9184 + *  @hw: pointer to the HW structure
9185 + *
9186 + *  Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
9187 + *
9188 + *  This function checks whether the HOST IF is enabled for command operation
9189 + *  and also checks whether the previous command is completed.  It busy waits
9190 + *  in case of previous command is not completed.
9191 + **/
9192 +s32 e1000_mng_enable_host_if_generic(struct e1000_hw * hw)
9193 +{
9194 +       u32 hicr;
9195 +       s32 ret_val = E1000_SUCCESS;
9196 +       u8  i;
9197 +
9198 +       DEBUGFUNC("e1000_mng_enable_host_if_generic");
9199 +
9200 +       /* Check that the host interface is enabled. */
9201 +       hicr = E1000_READ_REG(hw, E1000_HICR);
9202 +       if ((hicr & E1000_HICR_EN) == 0) {
9203 +               DEBUGOUT("E1000_HOST_EN bit disabled.\n");
9204 +               ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
9205 +               goto out;
9206 +       }
9207 +       /* check the previous command is completed */
9208 +       for (i = 0; i < E1000_MNG_DHCP_COMMAND_TIMEOUT; i++) {
9209 +               hicr = E1000_READ_REG(hw, E1000_HICR);
9210 +               if (!(hicr & E1000_HICR_C))
9211 +                       break;
9212 +               msec_delay_irq(1);
9213 +       }
9214 +
9215 +       if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
9216 +               DEBUGOUT("Previous command timeout failed .\n");
9217 +               ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
9218 +               goto out;
9219 +       }
9220 +
9221 +out:
9222 +       return ret_val;
9223 +}
9224 +
9225 +/**
9226 + *  e1000_check_mng_mode_generic - Generic check management mode
9227 + *  @hw: pointer to the HW structure
9228 + *
9229 + *  Reads the firmware semaphore register and returns true (>0) if
9230 + *  manageability is enabled, else false (0).
9231 + **/
9232 +bool e1000_check_mng_mode_generic(struct e1000_hw *hw)
9233 +{
9234 +       u32 fwsm;
9235 +
9236 +       DEBUGFUNC("e1000_check_mng_mode_generic");
9237 +
9238 +       fwsm = E1000_READ_REG(hw, E1000_FWSM);
9239 +
9240 +       return (fwsm & E1000_FWSM_MODE_MASK) ==
9241 +               (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
9242 +}
9243 +
9244 +/**
9245 + *  e1000_enable_tx_pkt_filtering_generic - Enable packet filtering on TX
9246 + *  @hw: pointer to the HW structure
9247 + *
9248 + *  Enables packet filtering on transmit packets if manageability is enabled
9249 + *  and host interface is enabled.
9250 + **/
9251 +bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw)
9252 +{
9253 +       struct e1000_host_mng_dhcp_cookie *hdr = &hw->mng_cookie;
9254 +       u32 *buffer = (u32 *)&hw->mng_cookie;
9255 +       u32 offset;
9256 +       s32 ret_val, hdr_csum, csum;
9257 +       u8 i, len;
9258 +       bool tx_filter = true;
9259 +
9260 +       DEBUGFUNC("e1000_enable_tx_pkt_filtering_generic");
9261 +
9262 +       /* No manageability, no filtering */
9263 +       if (!hw->mac.ops.check_mng_mode(hw)) {
9264 +               tx_filter = false;
9265 +               goto out;
9266 +       }
9267 +
9268 +       /*
9269 +        * If we can't read from the host interface for whatever
9270 +        * reason, disable filtering.
9271 +        */
9272 +       ret_val = hw->mac.ops.mng_enable_host_if(hw);
9273 +       if (ret_val != E1000_SUCCESS) {
9274 +               tx_filter = false;
9275 +               goto out;
9276 +       }
9277 +
9278 +       /* Read in the header.  Length and offset are in dwords. */
9279 +       len    = E1000_MNG_DHCP_COOKIE_LENGTH >> 2;
9280 +       offset = E1000_MNG_DHCP_COOKIE_OFFSET >> 2;
9281 +       for (i = 0; i < len; i++) {
9282 +               *(buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw,
9283 +                                                          E1000_HOST_IF,
9284 +                                                          offset + i);
9285 +       }
9286 +       hdr_csum = hdr->checksum;
9287 +       hdr->checksum = 0;
9288 +       csum = e1000_calculate_checksum((u8 *)hdr,
9289 +                                       E1000_MNG_DHCP_COOKIE_LENGTH);
9290 +       /*
9291 +        * If either the checksums or signature don't match, then
9292 +        * the cookie area isn't considered valid, in which case we
9293 +        * take the safe route of assuming Tx filtering is enabled.
9294 +        */
9295 +       if (hdr_csum != csum)
9296 +               goto out;
9297 +       if (hdr->signature != E1000_IAMT_SIGNATURE)
9298 +               goto out;
9299 +
9300 +       /* Cookie area is valid, make the final check for filtering. */
9301 +       if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING))
9302 +               tx_filter = false;
9303 +
9304 +out:
9305 +       hw->mac.tx_pkt_filtering = tx_filter;
9306 +       return tx_filter;
9307 +}
9308 +
9309 +/**
9310 + *  e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface
9311 + *  @hw: pointer to the HW structure
9312 + *  @buffer: pointer to the host interface
9313 + *  @length: size of the buffer
9314 + *
9315 + *  Writes the DHCP information to the host interface.
9316 + **/
9317 +s32 e1000_mng_write_dhcp_info_generic(struct e1000_hw * hw, u8 *buffer,
9318 +                                      u16 length)
9319 +{
9320 +       struct e1000_host_mng_command_header hdr;
9321 +       s32 ret_val;
9322 +       u32 hicr;
9323 +
9324 +       DEBUGFUNC("e1000_mng_write_dhcp_info_generic");
9325 +
9326 +       hdr.command_id = E1000_MNG_DHCP_TX_PAYLOAD_CMD;
9327 +       hdr.command_length = length;
9328 +       hdr.reserved1 = 0;
9329 +       hdr.reserved2 = 0;
9330 +       hdr.checksum = 0;
9331 +
9332 +       /* Enable the host interface */
9333 +       ret_val = hw->mac.ops.mng_enable_host_if(hw);
9334 +       if (ret_val)
9335 +               goto out;
9336 +
9337 +       /* Populate the host interface with the contents of "buffer". */
9338 +       ret_val = hw->mac.ops.mng_host_if_write(hw, buffer, length,
9339 +                                         sizeof(hdr), &(hdr.checksum));
9340 +       if (ret_val)
9341 +               goto out;
9342 +
9343 +       /* Write the manageability command header */
9344 +       ret_val = hw->mac.ops.mng_write_cmd_header(hw, &hdr);
9345 +       if (ret_val)
9346 +               goto out;
9347 +
9348 +       /* Tell the ARC a new command is pending. */
9349 +       hicr = E1000_READ_REG(hw, E1000_HICR);
9350 +       E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C);
9351 +
9352 +out:
9353 +       return ret_val;
9354 +}
9355 +
9356 +/**
9357 + *  e1000_mng_write_cmd_header_generic - Writes manageability command header
9358 + *  @hw: pointer to the HW structure
9359 + *  @hdr: pointer to the host interface command header
9360 + *
9361 + *  Writes the command header after does the checksum calculation.
9362 + **/
9363 +s32 e1000_mng_write_cmd_header_generic(struct e1000_hw * hw,
9364 +                                    struct e1000_host_mng_command_header * hdr)
9365 +{
9366 +       u16 i, length = sizeof(struct e1000_host_mng_command_header);
9367 +
9368 +       DEBUGFUNC("e1000_mng_write_cmd_header_generic");
9369 +
9370 +       /* Write the whole command header structure with new checksum. */
9371 +
9372 +       hdr->checksum = e1000_calculate_checksum((u8 *)hdr, length);
9373 +
9374 +       length >>= 2;
9375 +       /* Write the relevant command block into the ram area. */
9376 +       for (i = 0; i < length; i++) {
9377 +               E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, i,
9378 +                                           *((u32 *) hdr + i));
9379 +               E1000_WRITE_FLUSH(hw);
9380 +       }
9381 +
9382 +       return E1000_SUCCESS;
9383 +}
9384 +
9385 +/**
9386 + *  e1000_mng_host_if_write_generic - Write to the manageability host interface
9387 + *  @hw: pointer to the HW structure
9388 + *  @buffer: pointer to the host interface buffer
9389 + *  @length: size of the buffer
9390 + *  @offset: location in the buffer to write to
9391 + *  @sum: sum of the data (not checksum)
9392 + *
9393 + *  This function writes the buffer content at the offset given on the host if.
9394 + *  It also does alignment considerations to do the writes in most efficient
9395 + *  way.  Also fills up the sum of the buffer in *buffer parameter.
9396 + **/
9397 +s32 e1000_mng_host_if_write_generic(struct e1000_hw * hw, u8 *buffer,
9398 +                                    u16 length, u16 offset, u8 *sum)
9399 +{
9400 +       u8 *tmp;
9401 +       u8 *bufptr = buffer;
9402 +       u32 data = 0;
9403 +       s32 ret_val = E1000_SUCCESS;
9404 +       u16 remaining, i, j, prev_bytes;
9405 +
9406 +       DEBUGFUNC("e1000_mng_host_if_write_generic");
9407 +
9408 +       /* sum = only sum of the data and it is not checksum */
9409 +
9410 +       if (length == 0 || offset + length > E1000_HI_MAX_MNG_DATA_LENGTH) {
9411 +               ret_val = -E1000_ERR_PARAM;
9412 +               goto out;
9413 +       }
9414 +
9415 +       tmp = (u8 *)&data;
9416 +       prev_bytes = offset & 0x3;
9417 +       offset >>= 2;
9418 +
9419 +       if (prev_bytes) {
9420 +               data = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset);
9421 +               for (j = prev_bytes; j < sizeof(u32); j++) {
9422 +                       *(tmp + j) = *bufptr++;
9423 +                       *sum += *(tmp + j);
9424 +               }
9425 +               E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset, data);
9426 +               length -= j - prev_bytes;
9427 +               offset++;
9428 +       }
9429 +
9430 +       remaining = length & 0x3;
9431 +       length -= remaining;
9432 +
9433 +       /* Calculate length in DWORDs */
9434 +       length >>= 2;
9435 +
9436 +       /*
9437 +        * The device driver writes the relevant command block into the
9438 +        * ram area.
9439 +        */
9440 +       for (i = 0; i < length; i++) {
9441 +               for (j = 0; j < sizeof(u32); j++) {
9442 +                       *(tmp + j) = *bufptr++;
9443 +                       *sum += *(tmp + j);
9444 +               }
9445 +
9446 +               E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i, data);
9447 +       }
9448 +       if (remaining) {
9449 +               for (j = 0; j < sizeof(u32); j++) {
9450 +                       if (j < remaining)
9451 +                               *(tmp + j) = *bufptr++;
9452 +                       else
9453 +                               *(tmp + j) = 0;
9454 +
9455 +                       *sum += *(tmp + j);
9456 +               }
9457 +               E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i, data);
9458 +       }
9459 +
9460 +out:
9461 +       return ret_val;
9462 +}
9463 +
9464 +/**
9465 + *  e1000_enable_mng_pass_thru - Enable processing of ARP's
9466 + *  @hw: pointer to the HW structure
9467 + *
9468 + *  Verifies the hardware needs to allow ARPs to be processed by the host.
9469 + **/
9470 +bool e1000_enable_mng_pass_thru(struct e1000_hw *hw)
9471 +{
9472 +       u32 manc;
9473 +       u32 fwsm, factps;
9474 +       bool ret_val = false;
9475 +
9476 +       DEBUGFUNC("e1000_enable_mng_pass_thru");
9477 +
9478 +       if (!hw->mac.asf_firmware_present)
9479 +               goto out;
9480 +
9481 +       manc = E1000_READ_REG(hw, E1000_MANC);
9482 +
9483 +       if (!(manc & E1000_MANC_RCV_TCO_EN) ||
9484 +           !(manc & E1000_MANC_EN_MAC_ADDR_FILTER))
9485 +               goto out;
9486 +
9487 +       if (hw->mac.arc_subsystem_valid) {
9488 +               fwsm = E1000_READ_REG(hw, E1000_FWSM);
9489 +               factps = E1000_READ_REG(hw, E1000_FACTPS);
9490 +
9491 +               if (!(factps & E1000_FACTPS_MNGCG) &&
9492 +                   ((fwsm & E1000_FWSM_MODE_MASK) ==
9493 +                    (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT))) {
9494 +                       ret_val = true;
9495 +                       goto out;
9496 +               }
9497 +       } else {
9498 +               if ((manc & E1000_MANC_SMBUS_EN) &&
9499 +                   !(manc & E1000_MANC_ASF_EN)) {
9500 +                       ret_val = true;
9501 +                       goto out;
9502 +               }
9503 +       }
9504 +
9505 +out:
9506 +       return ret_val;
9507 +}
9508 +
9509 diff -Nru vanilla/drivers/net/igb/e1000_manage.h linux-i686-2.6.22/drivers/net/igb/e1000_manage.h
9510 --- vanilla/drivers/net/igb/e1000_manage.h      1969-12-31 19:00:00.000000000 -0500
9511 +++ linux-i686-2.6.22/drivers/net/igb/e1000_manage.h    2009-07-16 19:25:22.000000000 -0400
9512 @@ -0,0 +1,81 @@
9513 +/*******************************************************************************
9514 +
9515 +  Intel(R) Gigabit Ethernet Linux driver
9516 +  Copyright(c) 2007-2008 Intel Corporation.
9517 +
9518 +  This program is free software; you can redistribute it and/or modify it
9519 +  under the terms and conditions of the GNU General Public License,
9520 +  version 2, as published by the Free Software Foundation.
9521 +
9522 +  This program is distributed in the hope it will be useful, but WITHOUT
9523 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9524 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
9525 +  more details.
9526 +
9527 +  You should have received a copy of the GNU General Public License along with
9528 +  this program; if not, write to the Free Software Foundation, Inc.,
9529 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
9530 +
9531 +  The full GNU General Public License is included in this distribution in
9532 +  the file called "COPYING".
9533 +
9534 +  Contact Information:
9535 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
9536 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
9537 +
9538 +*******************************************************************************/
9539 +
9540 +#ifndef _E1000_MANAGE_H_
9541 +#define _E1000_MANAGE_H_
9542 +
9543 +bool e1000_check_mng_mode_generic(struct e1000_hw *hw);
9544 +bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw);
9545 +s32  e1000_mng_enable_host_if_generic(struct e1000_hw *hw);
9546 +s32  e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer,
9547 +                                     u16 length, u16 offset, u8 *sum);
9548 +s32  e1000_mng_write_cmd_header_generic(struct e1000_hw *hw,
9549 +                                    struct e1000_host_mng_command_header *hdr);
9550 +s32  e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw,
9551 +                                       u8 *buffer, u16 length);
9552 +bool e1000_enable_mng_pass_thru(struct e1000_hw *hw);
9553 +
9554 +enum e1000_mng_mode {
9555 +       e1000_mng_mode_none = 0,
9556 +       e1000_mng_mode_asf,
9557 +       e1000_mng_mode_pt,
9558 +       e1000_mng_mode_ipmi,
9559 +       e1000_mng_mode_host_if_only
9560 +};
9561 +
9562 +#define E1000_FACTPS_MNGCG    0x20000000
9563 +
9564 +#define E1000_FWSM_MODE_MASK  0xE
9565 +#define E1000_FWSM_MODE_SHIFT 1
9566 +
9567 +#define E1000_MNG_IAMT_MODE                  0x3
9568 +#define E1000_MNG_DHCP_COOKIE_LENGTH         0x10
9569 +#define E1000_MNG_DHCP_COOKIE_OFFSET         0x6F0
9570 +#define E1000_MNG_DHCP_COMMAND_TIMEOUT       10
9571 +#define E1000_MNG_DHCP_TX_PAYLOAD_CMD        64
9572 +#define E1000_MNG_DHCP_COOKIE_STATUS_PARSING 0x1
9573 +#define E1000_MNG_DHCP_COOKIE_STATUS_VLAN    0x2
9574 +
9575 +#define E1000_VFTA_ENTRY_SHIFT               5
9576 +#define E1000_VFTA_ENTRY_MASK                0x7F
9577 +#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK      0x1F
9578 +
9579 +#define E1000_HI_MAX_BLOCK_BYTE_LENGTH       1792 /* Num of bytes in range */
9580 +#define E1000_HI_MAX_BLOCK_DWORD_LENGTH      448 /* Num of dwords in range */
9581 +#define E1000_HI_COMMAND_TIMEOUT             500 /* Process HI command limit */
9582 +
9583 +#define E1000_HICR_EN              0x01  /* Enable bit - RO */
9584 +/* Driver sets this bit when done to put command in RAM */
9585 +#define E1000_HICR_C               0x02
9586 +#define E1000_HICR_SV              0x04  /* Status Validity */
9587 +#define E1000_HICR_FW_RESET_ENABLE 0x40
9588 +#define E1000_HICR_FW_RESET        0x80
9589 +
9590 +/* Intel(R) Active Management Technology signature */
9591 +#define E1000_IAMT_SIGNATURE  0x544D4149
9592 +
9593 +#endif
9594 Binary files vanilla/drivers/net/igb/e1000_manage.o and linux-i686-2.6.22/drivers/net/igb/e1000_manage.o differ
9595 diff -Nru vanilla/drivers/net/igb/.e1000_manage.o.cmd linux-i686-2.6.22/drivers/net/igb/.e1000_manage.o.cmd
9596 --- vanilla/drivers/net/igb/.e1000_manage.o.cmd 1969-12-31 19:00:00.000000000 -0500
9597 +++ linux-i686-2.6.22/drivers/net/igb/.e1000_manage.o.cmd       2009-07-16 19:53:43.000000000 -0400
9598 @@ -0,0 +1,549 @@
9599 +cmd_drivers/net/igb/e1000_manage.o := gcc -m32 -Wp,-MD,drivers/net/igb/.e1000_manage.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(e1000_manage)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_e1000_manage.o drivers/net/igb/e1000_manage.c
9600 +
9601 +deps_drivers/net/igb/e1000_manage.o := \
9602 +  drivers/net/igb/e1000_manage.c \
9603 +  drivers/net/igb/e1000_api.h \
9604 +  drivers/net/igb/e1000_hw.h \
9605 +  drivers/net/igb/e1000_osdep.h \
9606 +  include/linux/pci.h \
9607 +    $(wildcard include/config/pci/msi.h) \
9608 +    $(wildcard include/config/pci.h) \
9609 +    $(wildcard include/config/ht/irq.h) \
9610 +    $(wildcard include/config/pci/domains.h) \
9611 +  include/linux/pci_regs.h \
9612 +  include/linux/mod_devicetable.h \
9613 +  include/linux/types.h \
9614 +    $(wildcard include/config/uid16.h) \
9615 +    $(wildcard include/config/lbd.h) \
9616 +    $(wildcard include/config/lsf.h) \
9617 +    $(wildcard include/config/resources/64bit.h) \
9618 +  include/linux/posix_types.h \
9619 +  include/linux/stddef.h \
9620 +  include/linux/compiler.h \
9621 +    $(wildcard include/config/enable/must/check.h) \
9622 +  include/linux/compiler-gcc4.h \
9623 +    $(wildcard include/config/forced/inlining.h) \
9624 +  include/linux/compiler-gcc.h \
9625 +  include/asm/posix_types.h \
9626 +  include/asm/types.h \
9627 +    $(wildcard include/config/highmem64g.h) \
9628 +  include/linux/ioport.h \
9629 +  include/linux/list.h \
9630 +    $(wildcard include/config/debug/list.h) \
9631 +  include/linux/poison.h \
9632 +  include/linux/prefetch.h \
9633 +  include/asm/processor.h \
9634 +    $(wildcard include/config/smp.h) \
9635 +    $(wildcard include/config/x86/ht.h) \
9636 +    $(wildcard include/config/paravirt.h) \
9637 +    $(wildcard include/config/mk8.h) \
9638 +    $(wildcard include/config/mk7.h) \
9639 +  include/asm/vm86.h \
9640 +    $(wildcard include/config/vm86.h) \
9641 +  include/asm/ptrace.h \
9642 +  include/asm/ptrace-abi.h \
9643 +  include/asm/segment.h \
9644 +  include/asm/math_emu.h \
9645 +  include/asm/sigcontext.h \
9646 +  include/asm/page.h \
9647 +    $(wildcard include/config/x86/use/3dnow.h) \
9648 +    $(wildcard include/config/x86/pae.h) \
9649 +    $(wildcard include/config/hugetlb/page.h) \
9650 +    $(wildcard include/config/highmem4g.h) \
9651 +    $(wildcard include/config/page/offset.h) \
9652 +    $(wildcard include/config/flatmem.h) \
9653 +  include/asm-generic/pgtable-nopmd.h \
9654 +  include/asm-generic/pgtable-nopud.h \
9655 +  include/asm-generic/memory_model.h \
9656 +    $(wildcard include/config/discontigmem.h) \
9657 +    $(wildcard include/config/sparsemem.h) \
9658 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
9659 +  include/asm-generic/page.h \
9660 +  include/asm/cpufeature.h \
9661 +  include/linux/bitops.h \
9662 +  include/asm/bitops.h \
9663 +  include/asm/alternative.h \
9664 +  include/asm-generic/bitops/sched.h \
9665 +  include/asm-generic/bitops/hweight.h \
9666 +  include/asm-generic/bitops/fls64.h \
9667 +  include/asm-generic/bitops/ext2-non-atomic.h \
9668 +  include/asm-generic/bitops/le.h \
9669 +  include/asm/byteorder.h \
9670 +    $(wildcard include/config/x86/bswap.h) \
9671 +  include/linux/byteorder/little_endian.h \
9672 +  include/linux/byteorder/swab.h \
9673 +  include/linux/byteorder/generic.h \
9674 +  include/asm-generic/bitops/minix.h \
9675 +  include/asm/required-features.h \
9676 +    $(wildcard include/config/x86/minimum/cpu.h) \
9677 +    $(wildcard include/config/x86/cmov.h) \
9678 +    $(wildcard include/config/x86/cmpxchg64.h) \
9679 +  include/asm/msr.h \
9680 +  include/asm/msr-index.h \
9681 +  include/asm/errno.h \
9682 +  include/asm-generic/errno.h \
9683 +  include/asm-generic/errno-base.h \
9684 +  include/linux/errno.h \
9685 +  include/asm/system.h \
9686 +    $(wildcard include/config/x86/oostore.h) \
9687 +  include/linux/kernel.h \
9688 +    $(wildcard include/config/preempt/voluntary.h) \
9689 +    $(wildcard include/config/debug/spinlock/sleep.h) \
9690 +    $(wildcard include/config/printk.h) \
9691 +    $(wildcard include/config/numa.h) \
9692 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
9693 +  include/linux/linkage.h \
9694 +  include/asm/linkage.h \
9695 +    $(wildcard include/config/x86/alignment/16.h) \
9696 +  include/linux/log2.h \
9697 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
9698 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
9699 +  include/asm/bug.h \
9700 +    $(wildcard include/config/bug.h) \
9701 +    $(wildcard include/config/debug/bugverbose.h) \
9702 +  include/asm-generic/bug.h \
9703 +    $(wildcard include/config/generic/bug.h) \
9704 +  include/asm/cmpxchg.h \
9705 +    $(wildcard include/config/x86/cmpxchg.h) \
9706 +  include/linux/irqflags.h \
9707 +    $(wildcard include/config/trace/irqflags.h) \
9708 +    $(wildcard include/config/trace/irqflags/support.h) \
9709 +    $(wildcard include/config/x86.h) \
9710 +  include/asm/irqflags.h \
9711 +  include/asm/processor-flags.h \
9712 +  include/linux/cache.h \
9713 +  include/asm/cache.h \
9714 +    $(wildcard include/config/x86/l1/cache/shift.h) \
9715 +  include/linux/threads.h \
9716 +    $(wildcard include/config/nr/cpus.h) \
9717 +    $(wildcard include/config/base/small.h) \
9718 +  include/asm/percpu.h \
9719 +  include/linux/cpumask.h \
9720 +    $(wildcard include/config/hotplug/cpu.h) \
9721 +  include/linux/bitmap.h \
9722 +  include/linux/string.h \
9723 +  include/asm/string.h \
9724 +  include/linux/init.h \
9725 +    $(wildcard include/config/modules.h) \
9726 +    $(wildcard include/config/hotplug.h) \
9727 +    $(wildcard include/config/memory/hotplug.h) \
9728 +    $(wildcard include/config/acpi/hotplug/memory.h) \
9729 +  include/asm/atomic.h \
9730 +    $(wildcard include/config/m386.h) \
9731 +  include/asm-generic/atomic.h \
9732 +  include/linux/device.h \
9733 +    $(wildcard include/config/debug/devres.h) \
9734 +  include/linux/kobject.h \
9735 +  include/linux/sysfs.h \
9736 +    $(wildcard include/config/sysfs.h) \
9737 +  include/linux/spinlock.h \
9738 +    $(wildcard include/config/debug/spinlock.h) \
9739 +    $(wildcard include/config/preempt.h) \
9740 +    $(wildcard include/config/debug/lock/alloc.h) \
9741 +  include/linux/preempt.h \
9742 +    $(wildcard include/config/debug/preempt.h) \
9743 +  include/linux/thread_info.h \
9744 +  include/asm/thread_info.h \
9745 +    $(wildcard include/config/4kstacks.h) \
9746 +    $(wildcard include/config/debug/stack/usage.h) \
9747 +  include/linux/stringify.h \
9748 +  include/linux/bottom_half.h \
9749 +  include/linux/spinlock_types.h \
9750 +  include/linux/lockdep.h \
9751 +    $(wildcard include/config/lockdep.h) \
9752 +    $(wildcard include/config/generic/hardirqs.h) \
9753 +    $(wildcard include/config/prove/locking.h) \
9754 +  include/asm/spinlock_types.h \
9755 +  include/asm/spinlock.h \
9756 +    $(wildcard include/config/x86/ppro/fence.h) \
9757 +  include/asm/rwlock.h \
9758 +  include/linux/spinlock_api_smp.h \
9759 +  include/linux/kref.h \
9760 +  include/linux/wait.h \
9761 +  include/asm/current.h \
9762 +  include/linux/klist.h \
9763 +  include/linux/completion.h \
9764 +  include/linux/module.h \
9765 +    $(wildcard include/config/modversions.h) \
9766 +    $(wildcard include/config/unused/symbols.h) \
9767 +    $(wildcard include/config/module/unload.h) \
9768 +    $(wildcard include/config/kallsyms.h) \
9769 +  include/linux/stat.h \
9770 +  include/asm/stat.h \
9771 +  include/linux/time.h \
9772 +  include/linux/seqlock.h \
9773 +  include/linux/vs_time.h \
9774 +    $(wildcard include/config/vserver/vtime.h) \
9775 +  include/linux/kmod.h \
9776 +    $(wildcard include/config/kmod.h) \
9777 +  include/linux/elf.h \
9778 +  include/linux/auxvec.h \
9779 +  include/asm/auxvec.h \
9780 +  include/linux/elf-em.h \
9781 +  include/asm/elf.h \
9782 +  include/asm/user.h \
9783 +  include/asm/desc.h \
9784 +  include/asm/ldt.h \
9785 +  include/linux/smp.h \
9786 +  include/asm/smp.h \
9787 +    $(wildcard include/config/x86/local/apic.h) \
9788 +    $(wildcard include/config/x86/io/apic.h) \
9789 +  include/asm/mpspec.h \
9790 +    $(wildcard include/config/acpi.h) \
9791 +  include/asm/mpspec_def.h \
9792 +  include/asm-i386/mach-generic/mach_mpspec.h \
9793 +  include/asm/apic.h \
9794 +    $(wildcard include/config/x86/good/apic.h) \
9795 +  include/linux/pm.h \
9796 +    $(wildcard include/config/pm.h) \
9797 +  include/linux/delay.h \
9798 +  include/asm/delay.h \
9799 +  include/asm/fixmap.h \
9800 +    $(wildcard include/config/highmem.h) \
9801 +    $(wildcard include/config/x86/visws/apic.h) \
9802 +    $(wildcard include/config/x86/f00f/bug.h) \
9803 +    $(wildcard include/config/x86/cyclone/timer.h) \
9804 +    $(wildcard include/config/pci/mmconfig.h) \
9805 +  include/asm/acpi.h \
9806 +    $(wildcard include/config/acpi/sleep.h) \
9807 +  include/acpi/pdc_intel.h \
9808 +  include/asm/apicdef.h \
9809 +  include/asm/kmap_types.h \
9810 +    $(wildcard include/config/debug/highmem.h) \
9811 +  include/asm/io_apic.h \
9812 +  include/asm-i386/mach-generic/mach_apicdef.h \
9813 +  include/asm/genapic.h \
9814 +  include/linux/percpu.h \
9815 +  include/linux/slab.h \
9816 +    $(wildcard include/config/slab/debug.h) \
9817 +    $(wildcard include/config/slab.h) \
9818 +    $(wildcard include/config/slub.h) \
9819 +    $(wildcard include/config/debug/slab.h) \
9820 +  include/linux/gfp.h \
9821 +    $(wildcard include/config/zone/dma.h) \
9822 +    $(wildcard include/config/zone/dma32.h) \
9823 +  include/linux/mmzone.h \
9824 +    $(wildcard include/config/force/max/zoneorder.h) \
9825 +    $(wildcard include/config/arch/populates/node/map.h) \
9826 +    $(wildcard include/config/flat/node/mem/map.h) \
9827 +    $(wildcard include/config/have/memory/present.h) \
9828 +    $(wildcard include/config/need/node/memmap/size.h) \
9829 +    $(wildcard include/config/need/multiple/nodes.h) \
9830 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
9831 +    $(wildcard include/config/sparsemem/extreme.h) \
9832 +    $(wildcard include/config/nodes/span/other/nodes.h) \
9833 +    $(wildcard include/config/holes/in/zone.h) \
9834 +  include/linux/numa.h \
9835 +    $(wildcard include/config/nodes/shift.h) \
9836 +  include/linux/nodemask.h \
9837 +  include/linux/memory_hotplug.h \
9838 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
9839 +  include/linux/notifier.h \
9840 +  include/linux/mutex.h \
9841 +    $(wildcard include/config/debug/mutexes.h) \
9842 +    $(wildcard include/config/chopstix.h) \
9843 +  include/linux/rwsem.h \
9844 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
9845 +  include/asm/rwsem.h \
9846 +  include/linux/srcu.h \
9847 +  include/linux/topology.h \
9848 +    $(wildcard include/config/sched/smt.h) \
9849 +    $(wildcard include/config/sched/mc.h) \
9850 +  include/asm/topology.h \
9851 +  include/asm-generic/topology.h \
9852 +  include/linux/slab_def.h \
9853 +  include/linux/kmalloc_sizes.h \
9854 +  include/asm/mmu.h \
9855 +  include/asm/semaphore.h \
9856 +  include/linux/moduleparam.h \
9857 +  include/asm/local.h \
9858 +  include/asm/module.h \
9859 +    $(wildcard include/config/m486.h) \
9860 +    $(wildcard include/config/m586.h) \
9861 +    $(wildcard include/config/m586tsc.h) \
9862 +    $(wildcard include/config/m586mmx.h) \
9863 +    $(wildcard include/config/mcore2.h) \
9864 +    $(wildcard include/config/m686.h) \
9865 +    $(wildcard include/config/mpentiumii.h) \
9866 +    $(wildcard include/config/mpentiumiii.h) \
9867 +    $(wildcard include/config/mpentiumm.h) \
9868 +    $(wildcard include/config/mpentium4.h) \
9869 +    $(wildcard include/config/mk6.h) \
9870 +    $(wildcard include/config/x86/elan.h) \
9871 +    $(wildcard include/config/mcrusoe.h) \
9872 +    $(wildcard include/config/mefficeon.h) \
9873 +    $(wildcard include/config/mwinchipc6.h) \
9874 +    $(wildcard include/config/mwinchip2.h) \
9875 +    $(wildcard include/config/mwinchip3d.h) \
9876 +    $(wildcard include/config/mcyrixiii.h) \
9877 +    $(wildcard include/config/mviac3/2.h) \
9878 +    $(wildcard include/config/mviac7.h) \
9879 +    $(wildcard include/config/mgeodegx1.h) \
9880 +    $(wildcard include/config/mgeode/lx.h) \
9881 +  include/asm/device.h \
9882 +  include/linux/pci_ids.h \
9883 +  include/linux/dmapool.h \
9884 +  include/asm/io.h \
9885 +    $(wildcard include/config/x86/numaq.h) \
9886 +  include/asm-generic/iomap.h \
9887 +  include/linux/vmalloc.h \
9888 +  include/asm/scatterlist.h \
9889 +  include/asm/pci.h \
9890 +  include/linux/mm.h \
9891 +    $(wildcard include/config/sysctl.h) \
9892 +    $(wildcard include/config/mmu.h) \
9893 +    $(wildcard include/config/stack/growsup.h) \
9894 +    $(wildcard include/config/debug/vm.h) \
9895 +    $(wildcard include/config/shmem.h) \
9896 +    $(wildcard include/config/split/ptlock/cpus.h) \
9897 +    $(wildcard include/config/ia64.h) \
9898 +    $(wildcard include/config/proc/fs.h) \
9899 +    $(wildcard include/config/debug/pagealloc.h) \
9900 +  include/linux/capability.h \
9901 +  include/linux/rbtree.h \
9902 +  include/linux/prio_tree.h \
9903 +  include/linux/fs.h \
9904 +    $(wildcard include/config/dnotify.h) \
9905 +    $(wildcard include/config/vserver/cowbl.h) \
9906 +    $(wildcard include/config/quota.h) \
9907 +    $(wildcard include/config/inotify.h) \
9908 +    $(wildcard include/config/security.h) \
9909 +    $(wildcard include/config/epoll.h) \
9910 +    $(wildcard include/config/auditsyscall.h) \
9911 +    $(wildcard include/config/block.h) \
9912 +    $(wildcard include/config/fs/xip.h) \
9913 +    $(wildcard include/config/migration.h) \
9914 +  include/linux/limits.h \
9915 +  include/linux/ioctl.h \
9916 +  include/asm/ioctl.h \
9917 +  include/asm-generic/ioctl.h \
9918 +  include/linux/kdev_t.h \
9919 +  include/linux/dcache.h \
9920 +    $(wildcard include/config/profiling.h) \
9921 +  include/linux/rcupdate.h \
9922 +  include/linux/namei.h \
9923 +  include/linux/radix-tree.h \
9924 +  include/linux/pid.h \
9925 +  include/linux/quota.h \
9926 +  include/linux/dqblk_xfs.h \
9927 +  include/linux/dqblk_v1.h \
9928 +  include/linux/dqblk_v2.h \
9929 +  include/linux/nfs_fs_i.h \
9930 +  include/linux/nfs.h \
9931 +  include/linux/sunrpc/msg_prot.h \
9932 +  include/linux/fcntl.h \
9933 +  include/asm/fcntl.h \
9934 +  include/asm-generic/fcntl.h \
9935 +    $(wildcard include/config/64bit.h) \
9936 +  include/linux/err.h \
9937 +  include/linux/debug_locks.h \
9938 +    $(wildcard include/config/debug/locking/api/selftests.h) \
9939 +  include/linux/backing-dev.h \
9940 +  include/linux/mm_types.h \
9941 +  include/asm/pgtable.h \
9942 +    $(wildcard include/config/highpte.h) \
9943 +  include/asm/paravirt.h \
9944 +  include/asm/pgtable-2level-defs.h \
9945 +  include/asm/pgtable-2level.h \
9946 +  include/asm-generic/pgtable.h \
9947 +  include/linux/page-flags.h \
9948 +    $(wildcard include/config/s390.h) \
9949 +    $(wildcard include/config/swap.h) \
9950 +  include/linux/vmstat.h \
9951 +    $(wildcard include/config/vm/event/counters.h) \
9952 +  include/asm-generic/pci-dma-compat.h \
9953 +  include/linux/dma-mapping.h \
9954 +  include/asm/dma-mapping.h \
9955 +  include/asm-generic/pci.h \
9956 +  include/linux/interrupt.h \
9957 +    $(wildcard include/config/high/res/timers.h) \
9958 +    $(wildcard include/config/generic/irq/probe.h) \
9959 +  include/linux/irqreturn.h \
9960 +  include/linux/hardirq.h \
9961 +    $(wildcard include/config/preempt/bkl.h) \
9962 +    $(wildcard include/config/virt/cpu/accounting.h) \
9963 +  include/linux/smp_lock.h \
9964 +    $(wildcard include/config/lock/kernel.h) \
9965 +  include/linux/sched.h \
9966 +    $(wildcard include/config/no/hz.h) \
9967 +    $(wildcard include/config/detect/softlockup.h) \
9968 +    $(wildcard include/config/keys.h) \
9969 +    $(wildcard include/config/bsd/process/acct.h) \
9970 +    $(wildcard include/config/taskstats.h) \
9971 +    $(wildcard include/config/inotify/user.h) \
9972 +    $(wildcard include/config/schedstats.h) \
9973 +    $(wildcard include/config/task/delay/acct.h) \
9974 +    $(wildcard include/config/blk/dev/io/trace.h) \
9975 +    $(wildcard include/config/cc/stackprotector.h) \
9976 +    $(wildcard include/config/sysvipc.h) \
9977 +    $(wildcard include/config/rt/mutexes.h) \
9978 +    $(wildcard include/config/task/xacct.h) \
9979 +    $(wildcard include/config/cpusets.h) \
9980 +    $(wildcard include/config/compat.h) \
9981 +    $(wildcard include/config/fault/injection.h) \
9982 +  include/asm/param.h \
9983 +    $(wildcard include/config/hz.h) \
9984 +  include/linux/timex.h \
9985 +    $(wildcard include/config/time/interpolation.h) \
9986 +  include/asm/timex.h \
9987 +  include/asm/tsc.h \
9988 +    $(wildcard include/config/x86/tsc.h) \
9989 +    $(wildcard include/config/x86/generic.h) \
9990 +  include/linux/jiffies.h \
9991 +  include/linux/calc64.h \
9992 +  include/asm/div64.h \
9993 +  include/asm/cputime.h \
9994 +  include/asm-generic/cputime.h \
9995 +  include/linux/sem.h \
9996 +  include/linux/ipc.h \
9997 +    $(wildcard include/config/ipc/ns.h) \
9998 +  include/asm/ipcbuf.h \
9999 +  include/asm/sembuf.h \
10000 +  include/linux/signal.h \
10001 +  include/asm/signal.h \
10002 +  include/asm-generic/signal.h \
10003 +  include/asm/siginfo.h \
10004 +  include/asm-generic/siginfo.h \
10005 +  include/linux/securebits.h \
10006 +  include/linux/fs_struct.h \
10007 +  include/linux/seccomp.h \
10008 +    $(wildcard include/config/seccomp.h) \
10009 +  include/linux/futex.h \
10010 +    $(wildcard include/config/futex.h) \
10011 +  include/linux/rtmutex.h \
10012 +    $(wildcard include/config/debug/rt/mutexes.h) \
10013 +  include/linux/plist.h \
10014 +    $(wildcard include/config/debug/pi/list.h) \
10015 +  include/linux/param.h \
10016 +  include/linux/resource.h \
10017 +  include/asm/resource.h \
10018 +  include/asm-generic/resource.h \
10019 +  include/linux/timer.h \
10020 +    $(wildcard include/config/timer/stats.h) \
10021 +  include/linux/ktime.h \
10022 +    $(wildcard include/config/ktime/scalar.h) \
10023 +  include/linux/hrtimer.h \
10024 +  include/linux/task_io_accounting.h \
10025 +    $(wildcard include/config/task/io/accounting.h) \
10026 +  include/linux/aio.h \
10027 +  include/linux/workqueue.h \
10028 +  include/linux/aio_abi.h \
10029 +  include/linux/uio.h \
10030 +  include/asm/hardirq.h \
10031 +  include/linux/irq.h \
10032 +    $(wildcard include/config/irq/per/cpu.h) \
10033 +    $(wildcard include/config/irq/release/method.h) \
10034 +    $(wildcard include/config/generic/pending/irq.h) \
10035 +    $(wildcard include/config/irqbalance.h) \
10036 +    $(wildcard include/config/auto/irq/affinity.h) \
10037 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
10038 +  include/asm/irq.h \
10039 +  include/asm-i386/mach-default/irq_vectors.h \
10040 +  include/asm-i386/mach-default/irq_vectors_limits.h \
10041 +  include/asm/irq_regs.h \
10042 +  include/asm/hw_irq.h \
10043 +  include/linux/profile.h \
10044 +  include/asm/sections.h \
10045 +  include/asm-generic/sections.h \
10046 +  include/linux/irq_cpustat.h \
10047 +  include/linux/if_ether.h \
10048 +  include/linux/skbuff.h \
10049 +    $(wildcard include/config/nf/conntrack.h) \
10050 +    $(wildcard include/config/bridge/netfilter.h) \
10051 +    $(wildcard include/config/vlan/8021q.h) \
10052 +    $(wildcard include/config/net/sched.h) \
10053 +    $(wildcard include/config/net/cls/act.h) \
10054 +    $(wildcard include/config/net/dma.h) \
10055 +    $(wildcard include/config/network/secmark.h) \
10056 +  include/linux/net.h \
10057 +  include/asm/socket.h \
10058 +  include/asm/sockios.h \
10059 +  include/linux/random.h \
10060 +  include/linux/sysctl.h \
10061 +    $(wildcard include/config/icmp/ipod.h) \
10062 +    $(wildcard include/config/web100/net100.h) \
10063 +    $(wildcard include/config/web100/stats.h) \
10064 +  include/linux/textsearch.h \
10065 +  include/net/checksum.h \
10066 +  include/asm/uaccess.h \
10067 +    $(wildcard include/config/x86/intel/usercopy.h) \
10068 +    $(wildcard include/config/x86/wp/works/ok.h) \
10069 +  include/asm/checksum.h \
10070 +  include/linux/in6.h \
10071 +  include/linux/dmaengine.h \
10072 +    $(wildcard include/config/dma/engine.h) \
10073 +  drivers/net/igb/kcompat.h \
10074 +    $(wildcard include/config/e1000/napi.h) \
10075 +    $(wildcard include/config/e1000e/napi.h) \
10076 +    $(wildcard include/config/ixgb/napi.h) \
10077 +    $(wildcard include/config/e1000/disable/packet/split.h) \
10078 +    $(wildcard include/config/igb/disable/packet/split.h) \
10079 +    $(wildcard include/config/net/poll/controller.h) \
10080 +    $(wildcard include/config/space/len.h) \
10081 +    $(wildcard include/config/netpoll.h) \
10082 +    $(wildcard include/config/netdevices/multiqueue.h) \
10083 +  include/linux/version.h \
10084 +  include/linux/netdevice.h \
10085 +    $(wildcard include/config/ax25.h) \
10086 +    $(wildcard include/config/tr.h) \
10087 +    $(wildcard include/config/net/ipip.h) \
10088 +    $(wildcard include/config/net/ipgre.h) \
10089 +    $(wildcard include/config/ipv6/sit.h) \
10090 +    $(wildcard include/config/ipv6/tunnel.h) \
10091 +    $(wildcard include/config/wireless/ext.h) \
10092 +    $(wildcard include/config/netpoll/trap.h) \
10093 +  include/linux/if.h \
10094 +  include/linux/socket.h \
10095 +  include/linux/sockios.h \
10096 +  include/linux/hdlc/ioctl.h \
10097 +  include/linux/if_packet.h \
10098 +  include/linux/etherdevice.h \
10099 +  include/linux/in.h \
10100 +  include/linux/ip.h \
10101 +  include/linux/udp.h \
10102 +  include/net/inet_sock.h \
10103 +    $(wildcard include/config/ipv6.h) \
10104 +  include/linux/jhash.h \
10105 +  include/net/flow.h \
10106 +    $(wildcard include/config/ipv6/mip6.h) \
10107 +  include/net/sock.h \
10108 +    $(wildcard include/config/security/network.h) \
10109 +  include/linux/security.h \
10110 +    $(wildcard include/config/security/network/xfrm.h) \
10111 +  include/linux/binfmts.h \
10112 +  include/linux/shm.h \
10113 +  include/asm/shmparam.h \
10114 +  include/asm/shmbuf.h \
10115 +  include/linux/msg.h \
10116 +  include/asm/msgbuf.h \
10117 +  include/linux/key.h \
10118 +  include/linux/xfrm.h \
10119 +  include/linux/filter.h \
10120 +  include/net/dst.h \
10121 +    $(wildcard include/config/net/cls/route.h) \
10122 +    $(wildcard include/config/xfrm.h) \
10123 +  include/linux/rtnetlink.h \
10124 +  include/linux/netlink.h \
10125 +  include/linux/if_link.h \
10126 +  include/linux/if_addr.h \
10127 +  include/linux/neighbour.h \
10128 +  include/net/neighbour.h \
10129 +  include/linux/seq_file.h \
10130 +  include/net/rtnetlink.h \
10131 +  include/net/netlink.h \
10132 +  include/net/request_sock.h \
10133 +  include/linux/mii.h \
10134 +  include/linux/latency.h \
10135 +  drivers/net/igb/e1000_regs.h \
10136 +  drivers/net/igb/e1000_defines.h \
10137 +    $(wildcard include/config/res.h) \
10138 +    $(wildcard include/config/fault.h) \
10139 +  drivers/net/igb/e1000_mac.h \
10140 +  drivers/net/igb/e1000_phy.h \
10141 +  drivers/net/igb/e1000_nvm.h \
10142 +  drivers/net/igb/e1000_manage.h \
10143 +  drivers/net/igb/e1000_82575.h \
10144 +
10145 +drivers/net/igb/e1000_manage.o: $(deps_drivers/net/igb/e1000_manage.o)
10146 +
10147 +$(deps_drivers/net/igb/e1000_manage.o):
10148 diff -Nru vanilla/drivers/net/igb/e1000_nvm.c linux-i686-2.6.22/drivers/net/igb/e1000_nvm.c
10149 --- vanilla/drivers/net/igb/e1000_nvm.c 1969-12-31 19:00:00.000000000 -0500
10150 +++ linux-i686-2.6.22/drivers/net/igb/e1000_nvm.c       2009-07-16 19:25:22.000000000 -0400
10151 @@ -0,0 +1,634 @@
10152 +/*******************************************************************************
10153 +
10154 +  Intel(R) Gigabit Ethernet Linux driver
10155 +  Copyright(c) 2007-2008 Intel Corporation.
10156 +
10157 +  This program is free software; you can redistribute it and/or modify it
10158 +  under the terms and conditions of the GNU General Public License,
10159 +  version 2, as published by the Free Software Foundation.
10160 +
10161 +  This program is distributed in the hope it will be useful, but WITHOUT
10162 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10163 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
10164 +  more details.
10165 +
10166 +  You should have received a copy of the GNU General Public License along with
10167 +  this program; if not, write to the Free Software Foundation, Inc.,
10168 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
10169 +
10170 +  The full GNU General Public License is included in this distribution in
10171 +  the file called "COPYING".
10172 +
10173 +  Contact Information:
10174 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
10175 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
10176 +
10177 +*******************************************************************************/
10178 +
10179 +#include "e1000_api.h"
10180 +
10181 +static void e1000_stop_nvm(struct e1000_hw *hw);
10182 +static void e1000_reload_nvm_generic(struct e1000_hw *hw);
10183 +
10184 +/**
10185 + *  e1000_init_nvm_ops_generic - Initialize NVM function pointers
10186 + *  @hw: pointer to the HW structure
10187 + *
10188 + *  Setups up the function pointers to no-op functions
10189 + **/
10190 +void e1000_init_nvm_ops_generic(struct e1000_hw *hw)
10191 +{
10192 +       struct e1000_nvm_info *nvm = &hw->nvm;
10193 +       DEBUGFUNC("e1000_init_nvm_ops_generic");
10194 +
10195 +       /* Initialize function pointers */
10196 +       nvm->ops.reload = e1000_reload_nvm_generic;
10197 +}
10198 +
10199 +/**
10200 + *  e1000_raise_eec_clk - Raise EEPROM clock
10201 + *  @hw: pointer to the HW structure
10202 + *  @eecd: pointer to the EEPROM
10203 + *
10204 + *  Enable/Raise the EEPROM clock bit.
10205 + **/
10206 +static void e1000_raise_eec_clk(struct e1000_hw *hw, u32 *eecd)
10207 +{
10208 +       *eecd = *eecd | E1000_EECD_SK;
10209 +       E1000_WRITE_REG(hw, E1000_EECD, *eecd);
10210 +       E1000_WRITE_FLUSH(hw);
10211 +       usec_delay(hw->nvm.delay_usec);
10212 +}
10213 +
10214 +/**
10215 + *  e1000_lower_eec_clk - Lower EEPROM clock
10216 + *  @hw: pointer to the HW structure
10217 + *  @eecd: pointer to the EEPROM
10218 + *
10219 + *  Clear/Lower the EEPROM clock bit.
10220 + **/
10221 +static void e1000_lower_eec_clk(struct e1000_hw *hw, u32 *eecd)
10222 +{
10223 +       *eecd = *eecd & ~E1000_EECD_SK;
10224 +       E1000_WRITE_REG(hw, E1000_EECD, *eecd);
10225 +       E1000_WRITE_FLUSH(hw);
10226 +       usec_delay(hw->nvm.delay_usec);
10227 +}
10228 +
10229 +/**
10230 + *  e1000_shift_out_eec_bits - Shift data bits our to the EEPROM
10231 + *  @hw: pointer to the HW structure
10232 + *  @data: data to send to the EEPROM
10233 + *  @count: number of bits to shift out
10234 + *
10235 + *  We need to shift 'count' bits out to the EEPROM.  So, the value in the
10236 + *  "data" parameter will be shifted out to the EEPROM one bit at a time.
10237 + *  In order to do this, "data" must be broken down into bits.
10238 + **/
10239 +static void e1000_shift_out_eec_bits(struct e1000_hw *hw, u16 data, u16 count)
10240 +{
10241 +       struct e1000_nvm_info *nvm = &hw->nvm;
10242 +       u32 eecd = E1000_READ_REG(hw, E1000_EECD);
10243 +       u32 mask;
10244 +
10245 +       DEBUGFUNC("e1000_shift_out_eec_bits");
10246 +
10247 +       mask = 0x01 << (count - 1);
10248 +       if (nvm->type == e1000_nvm_eeprom_spi)
10249 +               eecd |= E1000_EECD_DO;
10250 +
10251 +       do {
10252 +               eecd &= ~E1000_EECD_DI;
10253 +
10254 +               if (data & mask)
10255 +                       eecd |= E1000_EECD_DI;
10256 +
10257 +               E1000_WRITE_REG(hw, E1000_EECD, eecd);
10258 +               E1000_WRITE_FLUSH(hw);
10259 +
10260 +               usec_delay(nvm->delay_usec);
10261 +
10262 +               e1000_raise_eec_clk(hw, &eecd);
10263 +               e1000_lower_eec_clk(hw, &eecd);
10264 +
10265 +               mask >>= 1;
10266 +       } while (mask);
10267 +
10268 +       eecd &= ~E1000_EECD_DI;
10269 +       E1000_WRITE_REG(hw, E1000_EECD, eecd);
10270 +}
10271 +
10272 +/**
10273 + *  e1000_shift_in_eec_bits - Shift data bits in from the EEPROM
10274 + *  @hw: pointer to the HW structure
10275 + *  @count: number of bits to shift in
10276 + *
10277 + *  In order to read a register from the EEPROM, we need to shift 'count' bits
10278 + *  in from the EEPROM.  Bits are "shifted in" by raising the clock input to
10279 + *  the EEPROM (setting the SK bit), and then reading the value of the data out
10280 + *  "DO" bit.  During this "shifting in" process the data in "DI" bit should
10281 + *  always be clear.
10282 + **/
10283 +static u16 e1000_shift_in_eec_bits(struct e1000_hw *hw, u16 count)
10284 +{
10285 +       u32 eecd;
10286 +       u32 i;
10287 +       u16 data;
10288 +
10289 +       DEBUGFUNC("e1000_shift_in_eec_bits");
10290 +
10291 +       eecd = E1000_READ_REG(hw, E1000_EECD);
10292 +
10293 +       eecd &= ~(E1000_EECD_DO | E1000_EECD_DI);
10294 +       data = 0;
10295 +
10296 +       for (i = 0; i < count; i++) {
10297 +               data <<= 1;
10298 +               e1000_raise_eec_clk(hw, &eecd);
10299 +
10300 +               eecd = E1000_READ_REG(hw, E1000_EECD);
10301 +
10302 +               eecd &= ~E1000_EECD_DI;
10303 +               if (eecd & E1000_EECD_DO)
10304 +                       data |= 1;
10305 +
10306 +               e1000_lower_eec_clk(hw, &eecd);
10307 +       }
10308 +
10309 +       return data;
10310 +}
10311 +
10312 +/**
10313 + *  e1000_poll_eerd_eewr_done - Poll for EEPROM read/write completion
10314 + *  @hw: pointer to the HW structure
10315 + *  @ee_reg: EEPROM flag for polling
10316 + *
10317 + *  Polls the EEPROM status bit for either read or write completion based
10318 + *  upon the value of 'ee_reg'.
10319 + **/
10320 +s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
10321 +{
10322 +       u32 attempts = 100000;
10323 +       u32 i, reg = 0;
10324 +       s32 ret_val = -E1000_ERR_NVM;
10325 +
10326 +       DEBUGFUNC("e1000_poll_eerd_eewr_done");
10327 +
10328 +       for (i = 0; i < attempts; i++) {
10329 +               if (ee_reg == E1000_NVM_POLL_READ)
10330 +                       reg = E1000_READ_REG(hw, E1000_EERD);
10331 +               else
10332 +                       reg = E1000_READ_REG(hw, E1000_EEWR);
10333 +
10334 +               if (reg & E1000_NVM_RW_REG_DONE) {
10335 +                       ret_val = E1000_SUCCESS;
10336 +                       break;
10337 +               }
10338 +
10339 +               usec_delay(5);
10340 +       }
10341 +
10342 +       return ret_val;
10343 +}
10344 +
10345 +/**
10346 + *  e1000_acquire_nvm_generic - Generic request for access to EEPROM
10347 + *  @hw: pointer to the HW structure
10348 + *
10349 + *  Set the EEPROM access request bit and wait for EEPROM access grant bit.
10350 + *  Return successful if access grant bit set, else clear the request for
10351 + *  EEPROM access and return -E1000_ERR_NVM (-1).
10352 + **/
10353 +s32 e1000_acquire_nvm_generic(struct e1000_hw *hw)
10354 +{
10355 +       u32 eecd = E1000_READ_REG(hw, E1000_EECD);
10356 +       s32 timeout = E1000_NVM_GRANT_ATTEMPTS;
10357 +       s32 ret_val = E1000_SUCCESS;
10358 +
10359 +       DEBUGFUNC("e1000_acquire_nvm_generic");
10360 +
10361 +       E1000_WRITE_REG(hw, E1000_EECD, eecd | E1000_EECD_REQ);
10362 +       eecd = E1000_READ_REG(hw, E1000_EECD);
10363 +
10364 +       while (timeout) {
10365 +               if (eecd & E1000_EECD_GNT)
10366 +                       break;
10367 +               usec_delay(5);
10368 +               eecd = E1000_READ_REG(hw, E1000_EECD);
10369 +               timeout--;
10370 +       }
10371 +
10372 +       if (!timeout) {
10373 +               eecd &= ~E1000_EECD_REQ;
10374 +               E1000_WRITE_REG(hw, E1000_EECD, eecd);
10375 +               DEBUGOUT("Could not acquire NVM grant\n");
10376 +               ret_val = -E1000_ERR_NVM;
10377 +       }
10378 +
10379 +       return ret_val;
10380 +}
10381 +
10382 +/**
10383 + *  e1000_standby_nvm - Return EEPROM to standby state
10384 + *  @hw: pointer to the HW structure
10385 + *
10386 + *  Return the EEPROM to a standby state.
10387 + **/
10388 +static void e1000_standby_nvm(struct e1000_hw *hw)
10389 +{
10390 +       struct e1000_nvm_info *nvm = &hw->nvm;
10391 +       u32 eecd = E1000_READ_REG(hw, E1000_EECD);
10392 +
10393 +       DEBUGFUNC("e1000_standby_nvm");
10394 +
10395 +       if (nvm->type == e1000_nvm_eeprom_spi) {
10396 +               /* Toggle CS to flush commands */
10397 +               eecd |= E1000_EECD_CS;
10398 +               E1000_WRITE_REG(hw, E1000_EECD, eecd);
10399 +               E1000_WRITE_FLUSH(hw);
10400 +               usec_delay(nvm->delay_usec);
10401 +               eecd &= ~E1000_EECD_CS;
10402 +               E1000_WRITE_REG(hw, E1000_EECD, eecd);
10403 +               E1000_WRITE_FLUSH(hw);
10404 +               usec_delay(nvm->delay_usec);
10405 +       }
10406 +}
10407 +
10408 +/**
10409 + *  e1000_stop_nvm - Terminate EEPROM command
10410 + *  @hw: pointer to the HW structure
10411 + *
10412 + *  Terminates the current command by inverting the EEPROM's chip select pin.
10413 + **/
10414 +static void e1000_stop_nvm(struct e1000_hw *hw)
10415 +{
10416 +       u32 eecd;
10417 +
10418 +       DEBUGFUNC("e1000_stop_nvm");
10419 +
10420 +       eecd = E1000_READ_REG(hw, E1000_EECD);
10421 +       if (hw->nvm.type == e1000_nvm_eeprom_spi) {
10422 +               /* Pull CS high */
10423 +               eecd |= E1000_EECD_CS;
10424 +               e1000_lower_eec_clk(hw, &eecd);
10425 +       }
10426 +}
10427 +
10428 +/**
10429 + *  e1000_release_nvm_generic - Release exclusive access to EEPROM
10430 + *  @hw: pointer to the HW structure
10431 + *
10432 + *  Stop any current commands to the EEPROM and clear the EEPROM request bit.
10433 + **/
10434 +void e1000_release_nvm_generic(struct e1000_hw *hw)
10435 +{
10436 +       u32 eecd;
10437 +
10438 +       DEBUGFUNC("e1000_release_nvm_generic");
10439 +
10440 +       e1000_stop_nvm(hw);
10441 +
10442 +       eecd = E1000_READ_REG(hw, E1000_EECD);
10443 +       eecd &= ~E1000_EECD_REQ;
10444 +       E1000_WRITE_REG(hw, E1000_EECD, eecd);
10445 +}
10446 +
10447 +/**
10448 + *  e1000_ready_nvm_eeprom - Prepares EEPROM for read/write
10449 + *  @hw: pointer to the HW structure
10450 + *
10451 + *  Setups the EEPROM for reading and writing.
10452 + **/
10453 +static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
10454 +{
10455 +       struct e1000_nvm_info *nvm = &hw->nvm;
10456 +       u32 eecd = E1000_READ_REG(hw, E1000_EECD);
10457 +       s32 ret_val = E1000_SUCCESS;
10458 +       u16 timeout = 0;
10459 +       u8 spi_stat_reg;
10460 +
10461 +       DEBUGFUNC("e1000_ready_nvm_eeprom");
10462 +
10463 +       if (nvm->type == e1000_nvm_eeprom_spi) {
10464 +               /* Clear SK and CS */
10465 +               eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
10466 +               E1000_WRITE_REG(hw, E1000_EECD, eecd);
10467 +               usec_delay(1);
10468 +               timeout = NVM_MAX_RETRY_SPI;
10469 +
10470 +               /*
10471 +                * Read "Status Register" repeatedly until the LSB is cleared.
10472 +                * The EEPROM will signal that the command has been completed
10473 +                * by clearing bit 0 of the internal status register.  If it's
10474 +                * not cleared within 'timeout', then error out.
10475 +                */
10476 +               while (timeout) {
10477 +                       e1000_shift_out_eec_bits(hw, NVM_RDSR_OPCODE_SPI,
10478 +                                                hw->nvm.opcode_bits);
10479 +                       spi_stat_reg = (u8)e1000_shift_in_eec_bits(hw, 8);
10480 +                       if (!(spi_stat_reg & NVM_STATUS_RDY_SPI))
10481 +                               break;
10482 +
10483 +                       usec_delay(5);
10484 +                       e1000_standby_nvm(hw);
10485 +                       timeout--;
10486 +               }
10487 +
10488 +               if (!timeout) {
10489 +                       DEBUGOUT("SPI NVM Status error\n");
10490 +                       ret_val = -E1000_ERR_NVM;
10491 +                       goto out;
10492 +               }
10493 +       }
10494 +
10495 +out:
10496 +       return ret_val;
10497 +}
10498 +
10499 +/**
10500 + *  e1000_read_nvm_eerd - Reads EEPROM using EERD register
10501 + *  @hw: pointer to the HW structure
10502 + *  @offset: offset of word in the EEPROM to read
10503 + *  @words: number of words to read
10504 + *  @data: word read from the EEPROM
10505 + *
10506 + *  Reads a 16 bit word from the EEPROM using the EERD register.
10507 + **/
10508 +s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
10509 +{
10510 +       struct e1000_nvm_info *nvm = &hw->nvm;
10511 +       u32 i, eerd = 0;
10512 +       s32 ret_val = E1000_SUCCESS;
10513 +
10514 +       DEBUGFUNC("e1000_read_nvm_eerd");
10515 +
10516 +       /*
10517 +        * A check for invalid values:  offset too large, too many words,
10518 +        * too many words for the offset, and not enough words.
10519 +        */
10520 +       if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
10521 +           (words == 0)) {
10522 +               DEBUGOUT("nvm parameter(s) out of bounds\n");
10523 +               ret_val = -E1000_ERR_NVM;
10524 +               goto out;
10525 +       }
10526 +
10527 +       for (i = 0; i < words; i++) {
10528 +               eerd = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) +
10529 +                      E1000_NVM_RW_REG_START;
10530 +
10531 +               E1000_WRITE_REG(hw, E1000_EERD, eerd);
10532 +               ret_val = e1000_poll_eerd_eewr_done(hw, E1000_NVM_POLL_READ);
10533 +               if (ret_val)
10534 +                       break;
10535 +
10536 +               data[i] = (E1000_READ_REG(hw, E1000_EERD) >>
10537 +                          E1000_NVM_RW_REG_DATA);
10538 +       }
10539 +
10540 +out:
10541 +       return ret_val;
10542 +}
10543 +
10544 +/**
10545 + *  e1000_write_nvm_spi - Write to EEPROM using SPI
10546 + *  @hw: pointer to the HW structure
10547 + *  @offset: offset within the EEPROM to be written to
10548 + *  @words: number of words to write
10549 + *  @data: 16 bit word(s) to be written to the EEPROM
10550 + *
10551 + *  Writes data to EEPROM at offset using SPI interface.
10552 + *
10553 + *  If e1000_update_nvm_checksum is not called after this function , the
10554 + *  EEPROM will most likely contain an invalid checksum.
10555 + **/
10556 +s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
10557 +{
10558 +       struct e1000_nvm_info *nvm = &hw->nvm;
10559 +       s32 ret_val;
10560 +       u16 widx = 0;
10561 +
10562 +       DEBUGFUNC("e1000_write_nvm_spi");
10563 +
10564 +       /*
10565 +        * A check for invalid values:  offset too large, too many words,
10566 +        * and not enough words.
10567 +        */
10568 +       if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
10569 +           (words == 0)) {
10570 +               DEBUGOUT("nvm parameter(s) out of bounds\n");
10571 +               ret_val = -E1000_ERR_NVM;
10572 +               goto out;
10573 +       }
10574 +
10575 +       ret_val = nvm->ops.acquire(hw);
10576 +       if (ret_val)
10577 +               goto out;
10578 +
10579 +       while (widx < words) {
10580 +               u8 write_opcode = NVM_WRITE_OPCODE_SPI;
10581 +
10582 +               ret_val = e1000_ready_nvm_eeprom(hw);
10583 +               if (ret_val)
10584 +                       goto release;
10585 +
10586 +               e1000_standby_nvm(hw);
10587 +
10588 +               /* Send the WRITE ENABLE command (8 bit opcode) */
10589 +               e1000_shift_out_eec_bits(hw, NVM_WREN_OPCODE_SPI,
10590 +                                        nvm->opcode_bits);
10591 +
10592 +               e1000_standby_nvm(hw);
10593 +
10594 +               /*
10595 +                * Some SPI eeproms use the 8th address bit embedded in the
10596 +                * opcode
10597 +                */
10598 +               if ((nvm->address_bits == 8) && (offset >= 128))
10599 +                       write_opcode |= NVM_A8_OPCODE_SPI;
10600 +
10601 +               /* Send the Write command (8-bit opcode + addr) */
10602 +               e1000_shift_out_eec_bits(hw, write_opcode, nvm->opcode_bits);
10603 +               e1000_shift_out_eec_bits(hw, (u16)((offset + widx) * 2),
10604 +                                        nvm->address_bits);
10605 +
10606 +               /* Loop to allow for up to whole page write of eeprom */
10607 +               while (widx < words) {
10608 +                       u16 word_out = data[widx];
10609 +                       word_out = (word_out >> 8) | (word_out << 8);
10610 +                       e1000_shift_out_eec_bits(hw, word_out, 16);
10611 +                       widx++;
10612 +
10613 +                       if ((((offset + widx) * 2) % nvm->page_size) == 0) {
10614 +                               e1000_standby_nvm(hw);
10615 +                               break;
10616 +                       }
10617 +               }
10618 +       }
10619 +
10620 +       msec_delay(10);
10621 +release:
10622 +       nvm->ops.release(hw);
10623 +
10624 +out:
10625 +       return ret_val;
10626 +}
10627 +
10628 +/**
10629 + *  e1000_read_pba_num_generic - Read device part number
10630 + *  @hw: pointer to the HW structure
10631 + *  @pba_num: pointer to device part number
10632 + *
10633 + *  Reads the product board assembly (PBA) number from the EEPROM and stores
10634 + *  the value in pba_num.
10635 + **/
10636 +s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num)
10637 +{
10638 +       s32  ret_val;
10639 +       u16 nvm_data;
10640 +
10641 +       DEBUGFUNC("e1000_read_pba_num_generic");
10642 +
10643 +       ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
10644 +       if (ret_val) {
10645 +               DEBUGOUT("NVM Read Error\n");
10646 +               goto out;
10647 +       }
10648 +       *pba_num = (u32)(nvm_data << 16);
10649 +
10650 +       ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
10651 +       if (ret_val) {
10652 +               DEBUGOUT("NVM Read Error\n");
10653 +               goto out;
10654 +       }
10655 +       *pba_num |= nvm_data;
10656 +
10657 +out:
10658 +       return ret_val;
10659 +}
10660 +
10661 +/**
10662 + *  e1000_read_mac_addr_generic - Read device MAC address
10663 + *  @hw: pointer to the HW structure
10664 + *
10665 + *  Reads the device MAC address from the EEPROM and stores the value.
10666 + *  Since devices with two ports use the same EEPROM, we increment the
10667 + *  last bit in the MAC address for the second port.
10668 + **/
10669 +s32 e1000_read_mac_addr_generic(struct e1000_hw *hw)
10670 +{
10671 +       s32  ret_val = E1000_SUCCESS;
10672 +       u16 offset, nvm_data, i;
10673 +
10674 +       DEBUGFUNC("e1000_read_mac_addr");
10675 +
10676 +       for (i = 0; i < ETH_ADDR_LEN; i += 2) {
10677 +               offset = i >> 1;
10678 +               ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
10679 +               if (ret_val) {
10680 +                       DEBUGOUT("NVM Read Error\n");
10681 +                       goto out;
10682 +               }
10683 +               hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
10684 +               hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
10685 +       }
10686 +
10687 +       /* Flip last bit of mac address if we're on second port */
10688 +       if (hw->bus.func == E1000_FUNC_1)
10689 +               hw->mac.perm_addr[5] ^= 1;
10690 +
10691 +       for (i = 0; i < ETH_ADDR_LEN; i++)
10692 +               hw->mac.addr[i] = hw->mac.perm_addr[i];
10693 +
10694 +out:
10695 +       return ret_val;
10696 +}
10697 +
10698 +/**
10699 + *  e1000_validate_nvm_checksum_generic - Validate EEPROM checksum
10700 + *  @hw: pointer to the HW structure
10701 + *
10702 + *  Calculates the EEPROM checksum by reading/adding each word of the EEPROM
10703 + *  and then verifies that the sum of the EEPROM is equal to 0xBABA.
10704 + **/
10705 +s32 e1000_validate_nvm_checksum_generic(struct e1000_hw *hw)
10706 +{
10707 +       s32 ret_val = E1000_SUCCESS;
10708 +       u16 checksum = 0;
10709 +       u16 i, nvm_data;
10710 +
10711 +       DEBUGFUNC("e1000_validate_nvm_checksum_generic");
10712 +
10713 +       for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
10714 +               ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
10715 +               if (ret_val) {
10716 +                       DEBUGOUT("NVM Read Error\n");
10717 +                       goto out;
10718 +               }
10719 +               checksum += nvm_data;
10720 +       }
10721 +
10722 +       if (checksum != (u16) NVM_SUM) {
10723 +               DEBUGOUT("NVM Checksum Invalid\n");
10724 +               ret_val = -E1000_ERR_NVM;
10725 +               goto out;
10726 +       }
10727 +
10728 +out:
10729 +       return ret_val;
10730 +}
10731 +
10732 +/**
10733 + *  e1000_update_nvm_checksum_generic - Update EEPROM checksum
10734 + *  @hw: pointer to the HW structure
10735 + *
10736 + *  Updates the EEPROM checksum by reading/adding each word of the EEPROM
10737 + *  up to the checksum.  Then calculates the EEPROM checksum and writes the
10738 + *  value to the EEPROM.
10739 + **/
10740 +s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw)
10741 +{
10742 +       s32  ret_val;
10743 +       u16 checksum = 0;
10744 +       u16 i, nvm_data;
10745 +
10746 +       DEBUGFUNC("e1000_update_nvm_checksum");
10747 +
10748 +       for (i = 0; i < NVM_CHECKSUM_REG; i++) {
10749 +               ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
10750 +               if (ret_val) {
10751 +                       DEBUGOUT("NVM Read Error while updating checksum.\n");
10752 +                       goto out;
10753 +               }
10754 +               checksum += nvm_data;
10755 +       }
10756 +       checksum = (u16) NVM_SUM - checksum;
10757 +       ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
10758 +       if (ret_val) {
10759 +               DEBUGOUT("NVM Write Error while updating checksum.\n");
10760 +       }
10761 +
10762 +out:
10763 +       return ret_val;
10764 +}
10765 +
10766 +/**
10767 + *  e1000_reload_nvm_generic - Reloads EEPROM
10768 + *  @hw: pointer to the HW structure
10769 + *
10770 + *  Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
10771 + *  extended control register.
10772 + **/
10773 +static void e1000_reload_nvm_generic(struct e1000_hw *hw)
10774 +{
10775 +       u32 ctrl_ext;
10776 +
10777 +       DEBUGFUNC("e1000_reload_nvm_generic");
10778 +
10779 +       usec_delay(10);
10780 +       ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT);
10781 +       ctrl_ext |= E1000_CTRL_EXT_EE_RST;
10782 +       E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext);
10783 +       E1000_WRITE_FLUSH(hw);
10784 +}
10785 +
10786 diff -Nru vanilla/drivers/net/igb/e1000_nvm.h linux-i686-2.6.22/drivers/net/igb/e1000_nvm.h
10787 --- vanilla/drivers/net/igb/e1000_nvm.h 1969-12-31 19:00:00.000000000 -0500
10788 +++ linux-i686-2.6.22/drivers/net/igb/e1000_nvm.h       2009-07-16 19:25:22.000000000 -0400
10789 @@ -0,0 +1,50 @@
10790 +/*******************************************************************************
10791 +
10792 +  Intel(R) Gigabit Ethernet Linux driver
10793 +  Copyright(c) 2007-2008 Intel Corporation.
10794 +
10795 +  This program is free software; you can redistribute it and/or modify it
10796 +  under the terms and conditions of the GNU General Public License,
10797 +  version 2, as published by the Free Software Foundation.
10798 +
10799 +  This program is distributed in the hope it will be useful, but WITHOUT
10800 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10801 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
10802 +  more details.
10803 +
10804 +  You should have received a copy of the GNU General Public License along with
10805 +  this program; if not, write to the Free Software Foundation, Inc.,
10806 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
10807 +
10808 +  The full GNU General Public License is included in this distribution in
10809 +  the file called "COPYING".
10810 +
10811 +  Contact Information:
10812 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
10813 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
10814 +
10815 +*******************************************************************************/
10816 +
10817 +#ifndef _E1000_NVM_H_
10818 +#define _E1000_NVM_H_
10819 +
10820 +void e1000_init_nvm_ops_generic(struct e1000_hw *hw);
10821 +s32  e1000_acquire_nvm_generic(struct e1000_hw *hw);
10822 +
10823 +s32  e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
10824 +s32  e1000_read_mac_addr_generic(struct e1000_hw *hw);
10825 +s32  e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num);
10826 +s32  e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words,
10827 +                         u16 *data);
10828 +s32  e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data);
10829 +s32  e1000_validate_nvm_checksum_generic(struct e1000_hw *hw);
10830 +s32  e1000_write_nvm_eewr(struct e1000_hw *hw, u16 offset,
10831 +                          u16 words, u16 *data);
10832 +s32  e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words,
10833 +                         u16 *data);
10834 +s32  e1000_update_nvm_checksum_generic(struct e1000_hw *hw);
10835 +void e1000_release_nvm_generic(struct e1000_hw *hw);
10836 +
10837 +#define E1000_STM_OPCODE  0xDB00
10838 +
10839 +#endif
10840 Binary files vanilla/drivers/net/igb/e1000_nvm.o and linux-i686-2.6.22/drivers/net/igb/e1000_nvm.o differ
10841 diff -Nru vanilla/drivers/net/igb/.e1000_nvm.o.cmd linux-i686-2.6.22/drivers/net/igb/.e1000_nvm.o.cmd
10842 --- vanilla/drivers/net/igb/.e1000_nvm.o.cmd    1969-12-31 19:00:00.000000000 -0500
10843 +++ linux-i686-2.6.22/drivers/net/igb/.e1000_nvm.o.cmd  2009-07-16 19:53:42.000000000 -0400
10844 @@ -0,0 +1,549 @@
10845 +cmd_drivers/net/igb/e1000_nvm.o := gcc -m32 -Wp,-MD,drivers/net/igb/.e1000_nvm.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(e1000_nvm)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_e1000_nvm.o drivers/net/igb/e1000_nvm.c
10846 +
10847 +deps_drivers/net/igb/e1000_nvm.o := \
10848 +  drivers/net/igb/e1000_nvm.c \
10849 +  drivers/net/igb/e1000_api.h \
10850 +  drivers/net/igb/e1000_hw.h \
10851 +  drivers/net/igb/e1000_osdep.h \
10852 +  include/linux/pci.h \
10853 +    $(wildcard include/config/pci/msi.h) \
10854 +    $(wildcard include/config/pci.h) \
10855 +    $(wildcard include/config/ht/irq.h) \
10856 +    $(wildcard include/config/pci/domains.h) \
10857 +  include/linux/pci_regs.h \
10858 +  include/linux/mod_devicetable.h \
10859 +  include/linux/types.h \
10860 +    $(wildcard include/config/uid16.h) \
10861 +    $(wildcard include/config/lbd.h) \
10862 +    $(wildcard include/config/lsf.h) \
10863 +    $(wildcard include/config/resources/64bit.h) \
10864 +  include/linux/posix_types.h \
10865 +  include/linux/stddef.h \
10866 +  include/linux/compiler.h \
10867 +    $(wildcard include/config/enable/must/check.h) \
10868 +  include/linux/compiler-gcc4.h \
10869 +    $(wildcard include/config/forced/inlining.h) \
10870 +  include/linux/compiler-gcc.h \
10871 +  include/asm/posix_types.h \
10872 +  include/asm/types.h \
10873 +    $(wildcard include/config/highmem64g.h) \
10874 +  include/linux/ioport.h \
10875 +  include/linux/list.h \
10876 +    $(wildcard include/config/debug/list.h) \
10877 +  include/linux/poison.h \
10878 +  include/linux/prefetch.h \
10879 +  include/asm/processor.h \
10880 +    $(wildcard include/config/smp.h) \
10881 +    $(wildcard include/config/x86/ht.h) \
10882 +    $(wildcard include/config/paravirt.h) \
10883 +    $(wildcard include/config/mk8.h) \
10884 +    $(wildcard include/config/mk7.h) \
10885 +  include/asm/vm86.h \
10886 +    $(wildcard include/config/vm86.h) \
10887 +  include/asm/ptrace.h \
10888 +  include/asm/ptrace-abi.h \
10889 +  include/asm/segment.h \
10890 +  include/asm/math_emu.h \
10891 +  include/asm/sigcontext.h \
10892 +  include/asm/page.h \
10893 +    $(wildcard include/config/x86/use/3dnow.h) \
10894 +    $(wildcard include/config/x86/pae.h) \
10895 +    $(wildcard include/config/hugetlb/page.h) \
10896 +    $(wildcard include/config/highmem4g.h) \
10897 +    $(wildcard include/config/page/offset.h) \
10898 +    $(wildcard include/config/flatmem.h) \
10899 +  include/asm-generic/pgtable-nopmd.h \
10900 +  include/asm-generic/pgtable-nopud.h \
10901 +  include/asm-generic/memory_model.h \
10902 +    $(wildcard include/config/discontigmem.h) \
10903 +    $(wildcard include/config/sparsemem.h) \
10904 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
10905 +  include/asm-generic/page.h \
10906 +  include/asm/cpufeature.h \
10907 +  include/linux/bitops.h \
10908 +  include/asm/bitops.h \
10909 +  include/asm/alternative.h \
10910 +  include/asm-generic/bitops/sched.h \
10911 +  include/asm-generic/bitops/hweight.h \
10912 +  include/asm-generic/bitops/fls64.h \
10913 +  include/asm-generic/bitops/ext2-non-atomic.h \
10914 +  include/asm-generic/bitops/le.h \
10915 +  include/asm/byteorder.h \
10916 +    $(wildcard include/config/x86/bswap.h) \
10917 +  include/linux/byteorder/little_endian.h \
10918 +  include/linux/byteorder/swab.h \
10919 +  include/linux/byteorder/generic.h \
10920 +  include/asm-generic/bitops/minix.h \
10921 +  include/asm/required-features.h \
10922 +    $(wildcard include/config/x86/minimum/cpu.h) \
10923 +    $(wildcard include/config/x86/cmov.h) \
10924 +    $(wildcard include/config/x86/cmpxchg64.h) \
10925 +  include/asm/msr.h \
10926 +  include/asm/msr-index.h \
10927 +  include/asm/errno.h \
10928 +  include/asm-generic/errno.h \
10929 +  include/asm-generic/errno-base.h \
10930 +  include/linux/errno.h \
10931 +  include/asm/system.h \
10932 +    $(wildcard include/config/x86/oostore.h) \
10933 +  include/linux/kernel.h \
10934 +    $(wildcard include/config/preempt/voluntary.h) \
10935 +    $(wildcard include/config/debug/spinlock/sleep.h) \
10936 +    $(wildcard include/config/printk.h) \
10937 +    $(wildcard include/config/numa.h) \
10938 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
10939 +  include/linux/linkage.h \
10940 +  include/asm/linkage.h \
10941 +    $(wildcard include/config/x86/alignment/16.h) \
10942 +  include/linux/log2.h \
10943 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
10944 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
10945 +  include/asm/bug.h \
10946 +    $(wildcard include/config/bug.h) \
10947 +    $(wildcard include/config/debug/bugverbose.h) \
10948 +  include/asm-generic/bug.h \
10949 +    $(wildcard include/config/generic/bug.h) \
10950 +  include/asm/cmpxchg.h \
10951 +    $(wildcard include/config/x86/cmpxchg.h) \
10952 +  include/linux/irqflags.h \
10953 +    $(wildcard include/config/trace/irqflags.h) \
10954 +    $(wildcard include/config/trace/irqflags/support.h) \
10955 +    $(wildcard include/config/x86.h) \
10956 +  include/asm/irqflags.h \
10957 +  include/asm/processor-flags.h \
10958 +  include/linux/cache.h \
10959 +  include/asm/cache.h \
10960 +    $(wildcard include/config/x86/l1/cache/shift.h) \
10961 +  include/linux/threads.h \
10962 +    $(wildcard include/config/nr/cpus.h) \
10963 +    $(wildcard include/config/base/small.h) \
10964 +  include/asm/percpu.h \
10965 +  include/linux/cpumask.h \
10966 +    $(wildcard include/config/hotplug/cpu.h) \
10967 +  include/linux/bitmap.h \
10968 +  include/linux/string.h \
10969 +  include/asm/string.h \
10970 +  include/linux/init.h \
10971 +    $(wildcard include/config/modules.h) \
10972 +    $(wildcard include/config/hotplug.h) \
10973 +    $(wildcard include/config/memory/hotplug.h) \
10974 +    $(wildcard include/config/acpi/hotplug/memory.h) \
10975 +  include/asm/atomic.h \
10976 +    $(wildcard include/config/m386.h) \
10977 +  include/asm-generic/atomic.h \
10978 +  include/linux/device.h \
10979 +    $(wildcard include/config/debug/devres.h) \
10980 +  include/linux/kobject.h \
10981 +  include/linux/sysfs.h \
10982 +    $(wildcard include/config/sysfs.h) \
10983 +  include/linux/spinlock.h \
10984 +    $(wildcard include/config/debug/spinlock.h) \
10985 +    $(wildcard include/config/preempt.h) \
10986 +    $(wildcard include/config/debug/lock/alloc.h) \
10987 +  include/linux/preempt.h \
10988 +    $(wildcard include/config/debug/preempt.h) \
10989 +  include/linux/thread_info.h \
10990 +  include/asm/thread_info.h \
10991 +    $(wildcard include/config/4kstacks.h) \
10992 +    $(wildcard include/config/debug/stack/usage.h) \
10993 +  include/linux/stringify.h \
10994 +  include/linux/bottom_half.h \
10995 +  include/linux/spinlock_types.h \
10996 +  include/linux/lockdep.h \
10997 +    $(wildcard include/config/lockdep.h) \
10998 +    $(wildcard include/config/generic/hardirqs.h) \
10999 +    $(wildcard include/config/prove/locking.h) \
11000 +  include/asm/spinlock_types.h \
11001 +  include/asm/spinlock.h \
11002 +    $(wildcard include/config/x86/ppro/fence.h) \
11003 +  include/asm/rwlock.h \
11004 +  include/linux/spinlock_api_smp.h \
11005 +  include/linux/kref.h \
11006 +  include/linux/wait.h \
11007 +  include/asm/current.h \
11008 +  include/linux/klist.h \
11009 +  include/linux/completion.h \
11010 +  include/linux/module.h \
11011 +    $(wildcard include/config/modversions.h) \
11012 +    $(wildcard include/config/unused/symbols.h) \
11013 +    $(wildcard include/config/module/unload.h) \
11014 +    $(wildcard include/config/kallsyms.h) \
11015 +  include/linux/stat.h \
11016 +  include/asm/stat.h \
11017 +  include/linux/time.h \
11018 +  include/linux/seqlock.h \
11019 +  include/linux/vs_time.h \
11020 +    $(wildcard include/config/vserver/vtime.h) \
11021 +  include/linux/kmod.h \
11022 +    $(wildcard include/config/kmod.h) \
11023 +  include/linux/elf.h \
11024 +  include/linux/auxvec.h \
11025 +  include/asm/auxvec.h \
11026 +  include/linux/elf-em.h \
11027 +  include/asm/elf.h \
11028 +  include/asm/user.h \
11029 +  include/asm/desc.h \
11030 +  include/asm/ldt.h \
11031 +  include/linux/smp.h \
11032 +  include/asm/smp.h \
11033 +    $(wildcard include/config/x86/local/apic.h) \
11034 +    $(wildcard include/config/x86/io/apic.h) \
11035 +  include/asm/mpspec.h \
11036 +    $(wildcard include/config/acpi.h) \
11037 +  include/asm/mpspec_def.h \
11038 +  include/asm-i386/mach-generic/mach_mpspec.h \
11039 +  include/asm/apic.h \
11040 +    $(wildcard include/config/x86/good/apic.h) \
11041 +  include/linux/pm.h \
11042 +    $(wildcard include/config/pm.h) \
11043 +  include/linux/delay.h \
11044 +  include/asm/delay.h \
11045 +  include/asm/fixmap.h \
11046 +    $(wildcard include/config/highmem.h) \
11047 +    $(wildcard include/config/x86/visws/apic.h) \
11048 +    $(wildcard include/config/x86/f00f/bug.h) \
11049 +    $(wildcard include/config/x86/cyclone/timer.h) \
11050 +    $(wildcard include/config/pci/mmconfig.h) \
11051 +  include/asm/acpi.h \
11052 +    $(wildcard include/config/acpi/sleep.h) \
11053 +  include/acpi/pdc_intel.h \
11054 +  include/asm/apicdef.h \
11055 +  include/asm/kmap_types.h \
11056 +    $(wildcard include/config/debug/highmem.h) \
11057 +  include/asm/io_apic.h \
11058 +  include/asm-i386/mach-generic/mach_apicdef.h \
11059 +  include/asm/genapic.h \
11060 +  include/linux/percpu.h \
11061 +  include/linux/slab.h \
11062 +    $(wildcard include/config/slab/debug.h) \
11063 +    $(wildcard include/config/slab.h) \
11064 +    $(wildcard include/config/slub.h) \
11065 +    $(wildcard include/config/debug/slab.h) \
11066 +  include/linux/gfp.h \
11067 +    $(wildcard include/config/zone/dma.h) \
11068 +    $(wildcard include/config/zone/dma32.h) \
11069 +  include/linux/mmzone.h \
11070 +    $(wildcard include/config/force/max/zoneorder.h) \
11071 +    $(wildcard include/config/arch/populates/node/map.h) \
11072 +    $(wildcard include/config/flat/node/mem/map.h) \
11073 +    $(wildcard include/config/have/memory/present.h) \
11074 +    $(wildcard include/config/need/node/memmap/size.h) \
11075 +    $(wildcard include/config/need/multiple/nodes.h) \
11076 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
11077 +    $(wildcard include/config/sparsemem/extreme.h) \
11078 +    $(wildcard include/config/nodes/span/other/nodes.h) \
11079 +    $(wildcard include/config/holes/in/zone.h) \
11080 +  include/linux/numa.h \
11081 +    $(wildcard include/config/nodes/shift.h) \
11082 +  include/linux/nodemask.h \
11083 +  include/linux/memory_hotplug.h \
11084 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
11085 +  include/linux/notifier.h \
11086 +  include/linux/mutex.h \
11087 +    $(wildcard include/config/debug/mutexes.h) \
11088 +    $(wildcard include/config/chopstix.h) \
11089 +  include/linux/rwsem.h \
11090 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
11091 +  include/asm/rwsem.h \
11092 +  include/linux/srcu.h \
11093 +  include/linux/topology.h \
11094 +    $(wildcard include/config/sched/smt.h) \
11095 +    $(wildcard include/config/sched/mc.h) \
11096 +  include/asm/topology.h \
11097 +  include/asm-generic/topology.h \
11098 +  include/linux/slab_def.h \
11099 +  include/linux/kmalloc_sizes.h \
11100 +  include/asm/mmu.h \
11101 +  include/asm/semaphore.h \
11102 +  include/linux/moduleparam.h \
11103 +  include/asm/local.h \
11104 +  include/asm/module.h \
11105 +    $(wildcard include/config/m486.h) \
11106 +    $(wildcard include/config/m586.h) \
11107 +    $(wildcard include/config/m586tsc.h) \
11108 +    $(wildcard include/config/m586mmx.h) \
11109 +    $(wildcard include/config/mcore2.h) \
11110 +    $(wildcard include/config/m686.h) \
11111 +    $(wildcard include/config/mpentiumii.h) \
11112 +    $(wildcard include/config/mpentiumiii.h) \
11113 +    $(wildcard include/config/mpentiumm.h) \
11114 +    $(wildcard include/config/mpentium4.h) \
11115 +    $(wildcard include/config/mk6.h) \
11116 +    $(wildcard include/config/x86/elan.h) \
11117 +    $(wildcard include/config/mcrusoe.h) \
11118 +    $(wildcard include/config/mefficeon.h) \
11119 +    $(wildcard include/config/mwinchipc6.h) \
11120 +    $(wildcard include/config/mwinchip2.h) \
11121 +    $(wildcard include/config/mwinchip3d.h) \
11122 +    $(wildcard include/config/mcyrixiii.h) \
11123 +    $(wildcard include/config/mviac3/2.h) \
11124 +    $(wildcard include/config/mviac7.h) \
11125 +    $(wildcard include/config/mgeodegx1.h) \
11126 +    $(wildcard include/config/mgeode/lx.h) \
11127 +  include/asm/device.h \
11128 +  include/linux/pci_ids.h \
11129 +  include/linux/dmapool.h \
11130 +  include/asm/io.h \
11131 +    $(wildcard include/config/x86/numaq.h) \
11132 +  include/asm-generic/iomap.h \
11133 +  include/linux/vmalloc.h \
11134 +  include/asm/scatterlist.h \
11135 +  include/asm/pci.h \
11136 +  include/linux/mm.h \
11137 +    $(wildcard include/config/sysctl.h) \
11138 +    $(wildcard include/config/mmu.h) \
11139 +    $(wildcard include/config/stack/growsup.h) \
11140 +    $(wildcard include/config/debug/vm.h) \
11141 +    $(wildcard include/config/shmem.h) \
11142 +    $(wildcard include/config/split/ptlock/cpus.h) \
11143 +    $(wildcard include/config/ia64.h) \
11144 +    $(wildcard include/config/proc/fs.h) \
11145 +    $(wildcard include/config/debug/pagealloc.h) \
11146 +  include/linux/capability.h \
11147 +  include/linux/rbtree.h \
11148 +  include/linux/prio_tree.h \
11149 +  include/linux/fs.h \
11150 +    $(wildcard include/config/dnotify.h) \
11151 +    $(wildcard include/config/vserver/cowbl.h) \
11152 +    $(wildcard include/config/quota.h) \
11153 +    $(wildcard include/config/inotify.h) \
11154 +    $(wildcard include/config/security.h) \
11155 +    $(wildcard include/config/epoll.h) \
11156 +    $(wildcard include/config/auditsyscall.h) \
11157 +    $(wildcard include/config/block.h) \
11158 +    $(wildcard include/config/fs/xip.h) \
11159 +    $(wildcard include/config/migration.h) \
11160 +  include/linux/limits.h \
11161 +  include/linux/ioctl.h \
11162 +  include/asm/ioctl.h \
11163 +  include/asm-generic/ioctl.h \
11164 +  include/linux/kdev_t.h \
11165 +  include/linux/dcache.h \
11166 +    $(wildcard include/config/profiling.h) \
11167 +  include/linux/rcupdate.h \
11168 +  include/linux/namei.h \
11169 +  include/linux/radix-tree.h \
11170 +  include/linux/pid.h \
11171 +  include/linux/quota.h \
11172 +  include/linux/dqblk_xfs.h \
11173 +  include/linux/dqblk_v1.h \
11174 +  include/linux/dqblk_v2.h \
11175 +  include/linux/nfs_fs_i.h \
11176 +  include/linux/nfs.h \
11177 +  include/linux/sunrpc/msg_prot.h \
11178 +  include/linux/fcntl.h \
11179 +  include/asm/fcntl.h \
11180 +  include/asm-generic/fcntl.h \
11181 +    $(wildcard include/config/64bit.h) \
11182 +  include/linux/err.h \
11183 +  include/linux/debug_locks.h \
11184 +    $(wildcard include/config/debug/locking/api/selftests.h) \
11185 +  include/linux/backing-dev.h \
11186 +  include/linux/mm_types.h \
11187 +  include/asm/pgtable.h \
11188 +    $(wildcard include/config/highpte.h) \
11189 +  include/asm/paravirt.h \
11190 +  include/asm/pgtable-2level-defs.h \
11191 +  include/asm/pgtable-2level.h \
11192 +  include/asm-generic/pgtable.h \
11193 +  include/linux/page-flags.h \
11194 +    $(wildcard include/config/s390.h) \
11195 +    $(wildcard include/config/swap.h) \
11196 +  include/linux/vmstat.h \
11197 +    $(wildcard include/config/vm/event/counters.h) \
11198 +  include/asm-generic/pci-dma-compat.h \
11199 +  include/linux/dma-mapping.h \
11200 +  include/asm/dma-mapping.h \
11201 +  include/asm-generic/pci.h \
11202 +  include/linux/interrupt.h \
11203 +    $(wildcard include/config/high/res/timers.h) \
11204 +    $(wildcard include/config/generic/irq/probe.h) \
11205 +  include/linux/irqreturn.h \
11206 +  include/linux/hardirq.h \
11207 +    $(wildcard include/config/preempt/bkl.h) \
11208 +    $(wildcard include/config/virt/cpu/accounting.h) \
11209 +  include/linux/smp_lock.h \
11210 +    $(wildcard include/config/lock/kernel.h) \
11211 +  include/linux/sched.h \
11212 +    $(wildcard include/config/no/hz.h) \
11213 +    $(wildcard include/config/detect/softlockup.h) \
11214 +    $(wildcard include/config/keys.h) \
11215 +    $(wildcard include/config/bsd/process/acct.h) \
11216 +    $(wildcard include/config/taskstats.h) \
11217 +    $(wildcard include/config/inotify/user.h) \
11218 +    $(wildcard include/config/schedstats.h) \
11219 +    $(wildcard include/config/task/delay/acct.h) \
11220 +    $(wildcard include/config/blk/dev/io/trace.h) \
11221 +    $(wildcard include/config/cc/stackprotector.h) \
11222 +    $(wildcard include/config/sysvipc.h) \
11223 +    $(wildcard include/config/rt/mutexes.h) \
11224 +    $(wildcard include/config/task/xacct.h) \
11225 +    $(wildcard include/config/cpusets.h) \
11226 +    $(wildcard include/config/compat.h) \
11227 +    $(wildcard include/config/fault/injection.h) \
11228 +  include/asm/param.h \
11229 +    $(wildcard include/config/hz.h) \
11230 +  include/linux/timex.h \
11231 +    $(wildcard include/config/time/interpolation.h) \
11232 +  include/asm/timex.h \
11233 +  include/asm/tsc.h \
11234 +    $(wildcard include/config/x86/tsc.h) \
11235 +    $(wildcard include/config/x86/generic.h) \
11236 +  include/linux/jiffies.h \
11237 +  include/linux/calc64.h \
11238 +  include/asm/div64.h \
11239 +  include/asm/cputime.h \
11240 +  include/asm-generic/cputime.h \
11241 +  include/linux/sem.h \
11242 +  include/linux/ipc.h \
11243 +    $(wildcard include/config/ipc/ns.h) \
11244 +  include/asm/ipcbuf.h \
11245 +  include/asm/sembuf.h \
11246 +  include/linux/signal.h \
11247 +  include/asm/signal.h \
11248 +  include/asm-generic/signal.h \
11249 +  include/asm/siginfo.h \
11250 +  include/asm-generic/siginfo.h \
11251 +  include/linux/securebits.h \
11252 +  include/linux/fs_struct.h \
11253 +  include/linux/seccomp.h \
11254 +    $(wildcard include/config/seccomp.h) \
11255 +  include/linux/futex.h \
11256 +    $(wildcard include/config/futex.h) \
11257 +  include/linux/rtmutex.h \
11258 +    $(wildcard include/config/debug/rt/mutexes.h) \
11259 +  include/linux/plist.h \
11260 +    $(wildcard include/config/debug/pi/list.h) \
11261 +  include/linux/param.h \
11262 +  include/linux/resource.h \
11263 +  include/asm/resource.h \
11264 +  include/asm-generic/resource.h \
11265 +  include/linux/timer.h \
11266 +    $(wildcard include/config/timer/stats.h) \
11267 +  include/linux/ktime.h \
11268 +    $(wildcard include/config/ktime/scalar.h) \
11269 +  include/linux/hrtimer.h \
11270 +  include/linux/task_io_accounting.h \
11271 +    $(wildcard include/config/task/io/accounting.h) \
11272 +  include/linux/aio.h \
11273 +  include/linux/workqueue.h \
11274 +  include/linux/aio_abi.h \
11275 +  include/linux/uio.h \
11276 +  include/asm/hardirq.h \
11277 +  include/linux/irq.h \
11278 +    $(wildcard include/config/irq/per/cpu.h) \
11279 +    $(wildcard include/config/irq/release/method.h) \
11280 +    $(wildcard include/config/generic/pending/irq.h) \
11281 +    $(wildcard include/config/irqbalance.h) \
11282 +    $(wildcard include/config/auto/irq/affinity.h) \
11283 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
11284 +  include/asm/irq.h \
11285 +  include/asm-i386/mach-default/irq_vectors.h \
11286 +  include/asm-i386/mach-default/irq_vectors_limits.h \
11287 +  include/asm/irq_regs.h \
11288 +  include/asm/hw_irq.h \
11289 +  include/linux/profile.h \
11290 +  include/asm/sections.h \
11291 +  include/asm-generic/sections.h \
11292 +  include/linux/irq_cpustat.h \
11293 +  include/linux/if_ether.h \
11294 +  include/linux/skbuff.h \
11295 +    $(wildcard include/config/nf/conntrack.h) \
11296 +    $(wildcard include/config/bridge/netfilter.h) \
11297 +    $(wildcard include/config/vlan/8021q.h) \
11298 +    $(wildcard include/config/net/sched.h) \
11299 +    $(wildcard include/config/net/cls/act.h) \
11300 +    $(wildcard include/config/net/dma.h) \
11301 +    $(wildcard include/config/network/secmark.h) \
11302 +  include/linux/net.h \
11303 +  include/asm/socket.h \
11304 +  include/asm/sockios.h \
11305 +  include/linux/random.h \
11306 +  include/linux/sysctl.h \
11307 +    $(wildcard include/config/icmp/ipod.h) \
11308 +    $(wildcard include/config/web100/net100.h) \
11309 +    $(wildcard include/config/web100/stats.h) \
11310 +  include/linux/textsearch.h \
11311 +  include/net/checksum.h \
11312 +  include/asm/uaccess.h \
11313 +    $(wildcard include/config/x86/intel/usercopy.h) \
11314 +    $(wildcard include/config/x86/wp/works/ok.h) \
11315 +  include/asm/checksum.h \
11316 +  include/linux/in6.h \
11317 +  include/linux/dmaengine.h \
11318 +    $(wildcard include/config/dma/engine.h) \
11319 +  drivers/net/igb/kcompat.h \
11320 +    $(wildcard include/config/e1000/napi.h) \
11321 +    $(wildcard include/config/e1000e/napi.h) \
11322 +    $(wildcard include/config/ixgb/napi.h) \
11323 +    $(wildcard include/config/e1000/disable/packet/split.h) \
11324 +    $(wildcard include/config/igb/disable/packet/split.h) \
11325 +    $(wildcard include/config/net/poll/controller.h) \
11326 +    $(wildcard include/config/space/len.h) \
11327 +    $(wildcard include/config/netpoll.h) \
11328 +    $(wildcard include/config/netdevices/multiqueue.h) \
11329 +  include/linux/version.h \
11330 +  include/linux/netdevice.h \
11331 +    $(wildcard include/config/ax25.h) \
11332 +    $(wildcard include/config/tr.h) \
11333 +    $(wildcard include/config/net/ipip.h) \
11334 +    $(wildcard include/config/net/ipgre.h) \
11335 +    $(wildcard include/config/ipv6/sit.h) \
11336 +    $(wildcard include/config/ipv6/tunnel.h) \
11337 +    $(wildcard include/config/wireless/ext.h) \
11338 +    $(wildcard include/config/netpoll/trap.h) \
11339 +  include/linux/if.h \
11340 +  include/linux/socket.h \
11341 +  include/linux/sockios.h \
11342 +  include/linux/hdlc/ioctl.h \
11343 +  include/linux/if_packet.h \
11344 +  include/linux/etherdevice.h \
11345 +  include/linux/in.h \
11346 +  include/linux/ip.h \
11347 +  include/linux/udp.h \
11348 +  include/net/inet_sock.h \
11349 +    $(wildcard include/config/ipv6.h) \
11350 +  include/linux/jhash.h \
11351 +  include/net/flow.h \
11352 +    $(wildcard include/config/ipv6/mip6.h) \
11353 +  include/net/sock.h \
11354 +    $(wildcard include/config/security/network.h) \
11355 +  include/linux/security.h \
11356 +    $(wildcard include/config/security/network/xfrm.h) \
11357 +  include/linux/binfmts.h \
11358 +  include/linux/shm.h \
11359 +  include/asm/shmparam.h \
11360 +  include/asm/shmbuf.h \
11361 +  include/linux/msg.h \
11362 +  include/asm/msgbuf.h \
11363 +  include/linux/key.h \
11364 +  include/linux/xfrm.h \
11365 +  include/linux/filter.h \
11366 +  include/net/dst.h \
11367 +    $(wildcard include/config/net/cls/route.h) \
11368 +    $(wildcard include/config/xfrm.h) \
11369 +  include/linux/rtnetlink.h \
11370 +  include/linux/netlink.h \
11371 +  include/linux/if_link.h \
11372 +  include/linux/if_addr.h \
11373 +  include/linux/neighbour.h \
11374 +  include/net/neighbour.h \
11375 +  include/linux/seq_file.h \
11376 +  include/net/rtnetlink.h \
11377 +  include/net/netlink.h \
11378 +  include/net/request_sock.h \
11379 +  include/linux/mii.h \
11380 +  include/linux/latency.h \
11381 +  drivers/net/igb/e1000_regs.h \
11382 +  drivers/net/igb/e1000_defines.h \
11383 +    $(wildcard include/config/res.h) \
11384 +    $(wildcard include/config/fault.h) \
11385 +  drivers/net/igb/e1000_mac.h \
11386 +  drivers/net/igb/e1000_phy.h \
11387 +  drivers/net/igb/e1000_nvm.h \
11388 +  drivers/net/igb/e1000_manage.h \
11389 +  drivers/net/igb/e1000_82575.h \
11390 +
11391 +drivers/net/igb/e1000_nvm.o: $(deps_drivers/net/igb/e1000_nvm.o)
11392 +
11393 +$(deps_drivers/net/igb/e1000_nvm.o):
11394 diff -Nru vanilla/drivers/net/igb/e1000_osdep.h linux-i686-2.6.22/drivers/net/igb/e1000_osdep.h
11395 --- vanilla/drivers/net/igb/e1000_osdep.h       1969-12-31 19:00:00.000000000 -0500
11396 +++ linux-i686-2.6.22/drivers/net/igb/e1000_osdep.h     2009-07-16 19:25:22.000000000 -0400
11397 @@ -0,0 +1,121 @@
11398 +/*******************************************************************************
11399 +
11400 +  Intel(R) Gigabit Ethernet Linux driver
11401 +  Copyright(c) 2007-2008 Intel Corporation.
11402 +
11403 +  This program is free software; you can redistribute it and/or modify it
11404 +  under the terms and conditions of the GNU General Public License,
11405 +  version 2, as published by the Free Software Foundation.
11406 +
11407 +  This program is distributed in the hope it will be useful, but WITHOUT
11408 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11409 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11410 +  more details.
11411 +
11412 +  You should have received a copy of the GNU General Public License along with
11413 +  this program; if not, write to the Free Software Foundation, Inc.,
11414 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
11415 +
11416 +  The full GNU General Public License is included in this distribution in
11417 +  the file called "COPYING".
11418 +
11419 +  Contact Information:
11420 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
11421 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
11422 +
11423 +*******************************************************************************/
11424 +
11425 +
11426 +/* glue for the OS independent part of e1000
11427 + * includes register access macros
11428 + */
11429 +
11430 +#ifndef _E1000_OSDEP_H_
11431 +#define _E1000_OSDEP_H_
11432 +
11433 +#include <linux/pci.h>
11434 +#include <linux/delay.h>
11435 +#include <linux/interrupt.h>
11436 +#include <linux/if_ether.h>
11437 +#include <linux/sched.h>
11438 +#include "kcompat.h"
11439 +
11440 +#define usec_delay(x) udelay(x)
11441 +#ifndef msec_delay
11442 +#define msec_delay(x)  do { if (in_interrupt()) { \
11443 +                               /* Don't mdelay in interrupt context! */ \
11444 +                               BUG(); \
11445 +                       } else { \
11446 +                               msleep(x); \
11447 +                       } } while (0)
11448 +
11449 +/* Some workarounds require millisecond delays and are run during interrupt
11450 + * context.  Most notably, when establishing link, the phy may need tweaking
11451 + * but cannot process phy register reads/writes faster than millisecond
11452 + * intervals...and we establish link due to a "link status change" interrupt.
11453 + */
11454 +#define msec_delay_irq(x) mdelay(x)
11455 +#endif
11456 +
11457 +#define PCI_COMMAND_REGISTER   PCI_COMMAND
11458 +#define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
11459 +#define ETH_ADDR_LEN           ETH_ALEN
11460 +
11461 +#ifdef __BIG_ENDIAN
11462 +#define E1000_BIG_ENDIAN __BIG_ENDIAN
11463 +#endif
11464 +
11465 +
11466 +#define DEBUGOUT(S)
11467 +#define DEBUGOUT1(S, A...)
11468 +
11469 +#define DEBUGFUNC(F) DEBUGOUT(F "\n")
11470 +#define DEBUGOUT2 DEBUGOUT1
11471 +#define DEBUGOUT3 DEBUGOUT2
11472 +#define DEBUGOUT7 DEBUGOUT3
11473 +
11474 +#define E1000_REGISTER(a, reg) reg
11475 +
11476 +#define E1000_WRITE_REG(a, reg, value) ( \
11477 +    writel((value), ((a)->hw_addr + E1000_REGISTER(a, reg))))
11478 +
11479 +#define E1000_READ_REG(a, reg) (readl((a)->hw_addr + E1000_REGISTER(a, reg)))
11480 +
11481 +#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
11482 +    writel((value), ((a)->hw_addr + E1000_REGISTER(a, reg) + ((offset) << 2))))
11483 +
11484 +#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
11485 +    readl((a)->hw_addr + E1000_REGISTER(a, reg) + ((offset) << 2)))
11486 +
11487 +#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
11488 +#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
11489 +
11490 +#define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
11491 +    writew((value), ((a)->hw_addr + E1000_REGISTER(a, reg) + ((offset) << 1))))
11492 +
11493 +#define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
11494 +    readw((a)->hw_addr + E1000_REGISTER(a, reg) + ((offset) << 1)))
11495 +
11496 +#define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
11497 +    writeb((value), ((a)->hw_addr + E1000_REGISTER(a, reg) + (offset))))
11498 +
11499 +#define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
11500 +    readb((a)->hw_addr + E1000_REGISTER(a, reg) + (offset)))
11501 +
11502 +#define E1000_WRITE_REG_IO(a, reg, offset) do { \
11503 +    outl(reg, ((a)->io_base));                  \
11504 +    outl(offset, ((a)->io_base + 4));      } while (0)
11505 +
11506 +#define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, E1000_STATUS)
11507 +
11508 +#define E1000_WRITE_FLASH_REG(a, reg, value) ( \
11509 +    writel((value), ((a)->flash_address + reg)))
11510 +
11511 +#define E1000_WRITE_FLASH_REG16(a, reg, value) ( \
11512 +    writew((value), ((a)->flash_address + reg)))
11513 +
11514 +#define E1000_READ_FLASH_REG(a, reg) (readl((a)->flash_address + reg))
11515 +
11516 +#define E1000_READ_FLASH_REG16(a, reg) (readw((a)->flash_address + reg))
11517 +
11518 +#endif /* _E1000_OSDEP_H_ */
11519 diff -Nru vanilla/drivers/net/igb/e1000_phy.c linux-i686-2.6.22/drivers/net/igb/e1000_phy.c
11520 --- vanilla/drivers/net/igb/e1000_phy.c 1969-12-31 19:00:00.000000000 -0500
11521 +++ linux-i686-2.6.22/drivers/net/igb/e1000_phy.c       2009-07-16 19:25:22.000000000 -0400
11522 @@ -0,0 +1,2052 @@
11523 +/*******************************************************************************
11524 +
11525 +  Intel(R) Gigabit Ethernet Linux driver
11526 +  Copyright(c) 2007-2008 Intel Corporation.
11527 +
11528 +  This program is free software; you can redistribute it and/or modify it
11529 +  under the terms and conditions of the GNU General Public License,
11530 +  version 2, as published by the Free Software Foundation.
11531 +
11532 +  This program is distributed in the hope it will be useful, but WITHOUT
11533 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11534 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11535 +  more details.
11536 +
11537 +  You should have received a copy of the GNU General Public License along with
11538 +  this program; if not, write to the Free Software Foundation, Inc.,
11539 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
11540 +
11541 +  The full GNU General Public License is included in this distribution in
11542 +  the file called "COPYING".
11543 +
11544 +  Contact Information:
11545 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
11546 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
11547 +
11548 +*******************************************************************************/
11549 +
11550 +#include "e1000_api.h"
11551 +
11552 +static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw);
11553 +/* Cable length tables */
11554 +static const u16 e1000_m88_cable_length_table[] =
11555 +       { 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
11556 +#define M88E1000_CABLE_LENGTH_TABLE_SIZE \
11557 +                (sizeof(e1000_m88_cable_length_table) / \
11558 +                 sizeof(e1000_m88_cable_length_table[0]))
11559 +
11560 +static const u16 e1000_igp_2_cable_length_table[] =
11561 +    { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
11562 +      0, 0, 0, 3, 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41,
11563 +      6, 10, 14, 18, 22, 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61,
11564 +      21, 26, 31, 35, 40, 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82,
11565 +      40, 45, 51, 56, 61, 66, 70, 75, 79, 83, 87, 91, 94, 98, 101, 104,
11566 +      60, 66, 72, 77, 82, 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121,
11567 +      83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
11568 +      104, 109, 114, 118, 121, 124};
11569 +#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \
11570 +                (sizeof(e1000_igp_2_cable_length_table) / \
11571 +                 sizeof(e1000_igp_2_cable_length_table[0]))
11572 +
11573 +/**
11574 + *  e1000_check_reset_block_generic - Check if PHY reset is blocked
11575 + *  @hw: pointer to the HW structure
11576 + *
11577 + *  Read the PHY management control register and check whether a PHY reset
11578 + *  is blocked.  If a reset is not blocked return E1000_SUCCESS, otherwise
11579 + *  return E1000_BLK_PHY_RESET (12).
11580 + **/
11581 +s32 e1000_check_reset_block_generic(struct e1000_hw *hw)
11582 +{
11583 +       u32 manc;
11584 +
11585 +       DEBUGFUNC("e1000_check_reset_block");
11586 +
11587 +       manc = E1000_READ_REG(hw, E1000_MANC);
11588 +
11589 +       return (manc & E1000_MANC_BLK_PHY_RST_ON_IDE) ?
11590 +              E1000_BLK_PHY_RESET : E1000_SUCCESS;
11591 +}
11592 +
11593 +/**
11594 + *  e1000_get_phy_id - Retrieve the PHY ID and revision
11595 + *  @hw: pointer to the HW structure
11596 + *
11597 + *  Reads the PHY registers and stores the PHY ID and possibly the PHY
11598 + *  revision in the hardware structure.
11599 + **/
11600 +s32 e1000_get_phy_id(struct e1000_hw *hw)
11601 +{
11602 +       struct e1000_phy_info *phy = &hw->phy;
11603 +       s32 ret_val = E1000_SUCCESS;
11604 +       u16 phy_id;
11605 +
11606 +       DEBUGFUNC("e1000_get_phy_id");
11607 +
11608 +       if (!(phy->ops.read_reg))
11609 +               goto out;
11610 +
11611 +       ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id);
11612 +       if (ret_val)
11613 +               goto out;
11614 +
11615 +       phy->id = (u32)(phy_id << 16);
11616 +       usec_delay(20);
11617 +       ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id);
11618 +       if (ret_val)
11619 +               goto out;
11620 +
11621 +       phy->id |= (u32)(phy_id & PHY_REVISION_MASK);
11622 +       phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK);
11623 +
11624 +out:
11625 +       return ret_val;
11626 +}
11627 +
11628 +/**
11629 + *  e1000_phy_reset_dsp_generic - Reset PHY DSP
11630 + *  @hw: pointer to the HW structure
11631 + *
11632 + *  Reset the digital signal processor.
11633 + **/
11634 +s32 e1000_phy_reset_dsp_generic(struct e1000_hw *hw)
11635 +{
11636 +       s32 ret_val = E1000_SUCCESS;
11637 +
11638 +       DEBUGFUNC("e1000_phy_reset_dsp_generic");
11639 +
11640 +       if (!(hw->phy.ops.write_reg))
11641 +               goto out;
11642 +
11643 +       ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xC1);
11644 +       if (ret_val)
11645 +               goto out;
11646 +
11647 +       ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0);
11648 +
11649 +out:
11650 +       return ret_val;
11651 +}
11652 +
11653 +/**
11654 + *  e1000_read_phy_reg_mdic - Read MDI control register
11655 + *  @hw: pointer to the HW structure
11656 + *  @offset: register offset to be read
11657 + *  @data: pointer to the read data
11658 + *
11659 + *  Reads the MDI control register in the PHY at offset and stores the
11660 + *  information read to data.
11661 + **/
11662 +s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
11663 +{
11664 +       struct e1000_phy_info *phy = &hw->phy;
11665 +       u32 i, mdic = 0;
11666 +       s32 ret_val = E1000_SUCCESS;
11667 +
11668 +       DEBUGFUNC("e1000_read_phy_reg_mdic");
11669 +
11670 +       /*
11671 +        * Set up Op-code, Phy Address, and register offset in the MDI
11672 +        * Control register.  The MAC will take care of interfacing with the
11673 +        * PHY to retrieve the desired data.
11674 +        */
11675 +       mdic = ((offset << E1000_MDIC_REG_SHIFT) |
11676 +               (phy->addr << E1000_MDIC_PHY_SHIFT) |
11677 +               (E1000_MDIC_OP_READ));
11678 +
11679 +       E1000_WRITE_REG(hw, E1000_MDIC, mdic);
11680 +
11681 +       /*
11682 +        * Poll the ready bit to see if the MDI read completed
11683 +        * Increasing the time out as testing showed failures with
11684 +        * the lower time out
11685 +        */
11686 +       for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) {
11687 +               usec_delay(50);
11688 +               mdic = E1000_READ_REG(hw, E1000_MDIC);
11689 +               if (mdic & E1000_MDIC_READY)
11690 +                       break;
11691 +       }
11692 +       if (!(mdic & E1000_MDIC_READY)) {
11693 +               DEBUGOUT("MDI Read did not complete\n");
11694 +               ret_val = -E1000_ERR_PHY;
11695 +               goto out;
11696 +       }
11697 +       if (mdic & E1000_MDIC_ERROR) {
11698 +               DEBUGOUT("MDI Error\n");
11699 +               ret_val = -E1000_ERR_PHY;
11700 +               goto out;
11701 +       }
11702 +       *data = (u16) mdic;
11703 +
11704 +out:
11705 +       return ret_val;
11706 +}
11707 +
11708 +/**
11709 + *  e1000_write_phy_reg_mdic - Write MDI control register
11710 + *  @hw: pointer to the HW structure
11711 + *  @offset: register offset to write to
11712 + *  @data: data to write to register at offset
11713 + *
11714 + *  Writes data to MDI control register in the PHY at offset.
11715 + **/
11716 +s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
11717 +{
11718 +       struct e1000_phy_info *phy = &hw->phy;
11719 +       u32 i, mdic = 0;
11720 +       s32 ret_val = E1000_SUCCESS;
11721 +
11722 +       DEBUGFUNC("e1000_write_phy_reg_mdic");
11723 +
11724 +       /*
11725 +        * Set up Op-code, Phy Address, and register offset in the MDI
11726 +        * Control register.  The MAC will take care of interfacing with the
11727 +        * PHY to retrieve the desired data.
11728 +        */
11729 +       mdic = (((u32)data) |
11730 +               (offset << E1000_MDIC_REG_SHIFT) |
11731 +               (phy->addr << E1000_MDIC_PHY_SHIFT) |
11732 +               (E1000_MDIC_OP_WRITE));
11733 +
11734 +       E1000_WRITE_REG(hw, E1000_MDIC, mdic);
11735 +
11736 +       /*
11737 +        * Poll the ready bit to see if the MDI read completed
11738 +        * Increasing the time out as testing showed failures with
11739 +        * the lower time out
11740 +        */
11741 +       for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) {
11742 +               usec_delay(50);
11743 +               mdic = E1000_READ_REG(hw, E1000_MDIC);
11744 +               if (mdic & E1000_MDIC_READY)
11745 +                       break;
11746 +       }
11747 +       if (!(mdic & E1000_MDIC_READY)) {
11748 +               DEBUGOUT("MDI Write did not complete\n");
11749 +               ret_val = -E1000_ERR_PHY;
11750 +               goto out;
11751 +       }
11752 +       if (mdic & E1000_MDIC_ERROR) {
11753 +               DEBUGOUT("MDI Error\n");
11754 +               ret_val = -E1000_ERR_PHY;
11755 +               goto out;
11756 +       }
11757 +
11758 +out:
11759 +       return ret_val;
11760 +}
11761 +
11762 +/**
11763 + *  e1000_read_phy_reg_m88 - Read m88 PHY register
11764 + *  @hw: pointer to the HW structure
11765 + *  @offset: register offset to be read
11766 + *  @data: pointer to the read data
11767 + *
11768 + *  Acquires semaphore, if necessary, then reads the PHY register at offset
11769 + *  and storing the retrieved information in data.  Release any acquired
11770 + *  semaphores before exiting.
11771 + **/
11772 +s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data)
11773 +{
11774 +       s32 ret_val = E1000_SUCCESS;
11775 +
11776 +       DEBUGFUNC("e1000_read_phy_reg_m88");
11777 +
11778 +       if (!(hw->phy.ops.acquire))
11779 +               goto out;
11780 +
11781 +       ret_val = hw->phy.ops.acquire(hw);
11782 +       if (ret_val)
11783 +               goto out;
11784 +
11785 +       ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
11786 +                                         data);
11787 +
11788 +       hw->phy.ops.release(hw);
11789 +
11790 +out:
11791 +       return ret_val;
11792 +}
11793 +
11794 +/**
11795 + *  e1000_write_phy_reg_m88 - Write m88 PHY register
11796 + *  @hw: pointer to the HW structure
11797 + *  @offset: register offset to write to
11798 + *  @data: data to write at register offset
11799 + *
11800 + *  Acquires semaphore, if necessary, then writes the data to PHY register
11801 + *  at the offset.  Release any acquired semaphores before exiting.
11802 + **/
11803 +s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data)
11804 +{
11805 +       s32 ret_val = E1000_SUCCESS;
11806 +
11807 +       DEBUGFUNC("e1000_write_phy_reg_m88");
11808 +
11809 +       if (!(hw->phy.ops.acquire))
11810 +               goto out;
11811 +
11812 +       ret_val = hw->phy.ops.acquire(hw);
11813 +       if (ret_val)
11814 +               goto out;
11815 +
11816 +       ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
11817 +                                          data);
11818 +
11819 +       hw->phy.ops.release(hw);
11820 +
11821 +out:
11822 +       return ret_val;
11823 +}
11824 +
11825 +/**
11826 + *  e1000_read_phy_reg_igp - Read igp PHY register
11827 + *  @hw: pointer to the HW structure
11828 + *  @offset: register offset to be read
11829 + *  @data: pointer to the read data
11830 + *
11831 + *  Acquires semaphore, if necessary, then reads the PHY register at offset
11832 + *  and storing the retrieved information in data.  Release any acquired
11833 + *  semaphores before exiting.
11834 + **/
11835 +s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
11836 +{
11837 +       s32 ret_val = E1000_SUCCESS;
11838 +
11839 +       DEBUGFUNC("e1000_read_phy_reg_igp");
11840 +
11841 +       if (!(hw->phy.ops.acquire))
11842 +               goto out;
11843 +
11844 +       ret_val = hw->phy.ops.acquire(hw);
11845 +       if (ret_val)
11846 +               goto out;
11847 +
11848 +       if (offset > MAX_PHY_MULTI_PAGE_REG) {
11849 +               ret_val = e1000_write_phy_reg_mdic(hw,
11850 +                                                  IGP01E1000_PHY_PAGE_SELECT,
11851 +                                                  (u16)offset);
11852 +               if (ret_val) {
11853 +                       hw->phy.ops.release(hw);
11854 +                       goto out;
11855 +               }
11856 +       }
11857 +
11858 +       ret_val = e1000_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
11859 +                                         data);
11860 +
11861 +       hw->phy.ops.release(hw);
11862 +
11863 +out:
11864 +       return ret_val;
11865 +}
11866 +
11867 +/**
11868 + *  e1000_write_phy_reg_igp - Write igp PHY register
11869 + *  @hw: pointer to the HW structure
11870 + *  @offset: register offset to write to
11871 + *  @data: data to write at register offset
11872 + *
11873 + *  Acquires semaphore, if necessary, then writes the data to PHY register
11874 + *  at the offset.  Release any acquired semaphores before exiting.
11875 + **/
11876 +s32 e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
11877 +{
11878 +       s32 ret_val = E1000_SUCCESS;
11879 +
11880 +       DEBUGFUNC("e1000_write_phy_reg_igp");
11881 +
11882 +       if (!(hw->phy.ops.acquire))
11883 +               goto out;
11884 +
11885 +       ret_val = hw->phy.ops.acquire(hw);
11886 +       if (ret_val)
11887 +               goto out;
11888 +
11889 +       if (offset > MAX_PHY_MULTI_PAGE_REG) {
11890 +               ret_val = e1000_write_phy_reg_mdic(hw,
11891 +                                                  IGP01E1000_PHY_PAGE_SELECT,
11892 +                                                  (u16)offset);
11893 +               if (ret_val) {
11894 +                       hw->phy.ops.release(hw);
11895 +                       goto out;
11896 +               }
11897 +       }
11898 +
11899 +       ret_val = e1000_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
11900 +                                          data);
11901 +
11902 +       hw->phy.ops.release(hw);
11903 +
11904 +out:
11905 +       return ret_val;
11906 +}
11907 +
11908 +/**
11909 + *  e1000_read_kmrn_reg_generic - Read kumeran register
11910 + *  @hw: pointer to the HW structure
11911 + *  @offset: register offset to be read
11912 + *  @data: pointer to the read data
11913 + *
11914 + *  Acquires semaphore, if necessary.  Then reads the PHY register at offset
11915 + *  using the kumeran interface.  The information retrieved is stored in data.
11916 + *  Release any acquired semaphores before exiting.
11917 + **/
11918 +s32 e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data)
11919 +{
11920 +       u32 kmrnctrlsta;
11921 +       s32 ret_val = E1000_SUCCESS;
11922 +
11923 +       DEBUGFUNC("e1000_read_kmrn_reg_generic");
11924 +
11925 +       if (!(hw->phy.ops.acquire))
11926 +               goto out;
11927 +
11928 +       ret_val = hw->phy.ops.acquire(hw);
11929 +       if (ret_val)
11930 +               goto out;
11931 +
11932 +       kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
11933 +                      E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
11934 +       E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta);
11935 +
11936 +       usec_delay(2);
11937 +
11938 +       kmrnctrlsta = E1000_READ_REG(hw, E1000_KMRNCTRLSTA);
11939 +       *data = (u16)kmrnctrlsta;
11940 +
11941 +       hw->phy.ops.release(hw);
11942 +
11943 +out:
11944 +       return ret_val;
11945 +}
11946 +
11947 +/**
11948 + *  e1000_write_kmrn_reg_generic - Write kumeran register
11949 + *  @hw: pointer to the HW structure
11950 + *  @offset: register offset to write to
11951 + *  @data: data to write at register offset
11952 + *
11953 + *  Acquires semaphore, if necessary.  Then write the data to PHY register
11954 + *  at the offset using the kumeran interface.  Release any acquired semaphores
11955 + *  before exiting.
11956 + **/
11957 +s32 e1000_write_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 data)
11958 +{
11959 +       u32 kmrnctrlsta;
11960 +       s32 ret_val = E1000_SUCCESS;
11961 +
11962 +       DEBUGFUNC("e1000_write_kmrn_reg_generic");
11963 +
11964 +       if (!(hw->phy.ops.acquire))
11965 +               goto out;
11966 +
11967 +       ret_val = hw->phy.ops.acquire(hw);
11968 +       if (ret_val)
11969 +               goto out;
11970 +
11971 +       kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
11972 +                      E1000_KMRNCTRLSTA_OFFSET) | data;
11973 +       E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta);
11974 +
11975 +       usec_delay(2);
11976 +       hw->phy.ops.release(hw);
11977 +
11978 +out:
11979 +       return ret_val;
11980 +}
11981 +
11982 +/**
11983 + *  e1000_copper_link_setup_m88 - Setup m88 PHY's for copper link
11984 + *  @hw: pointer to the HW structure
11985 + *
11986 + *  Sets up MDI/MDI-X and polarity for m88 PHY's.  If necessary, transmit clock
11987 + *  and downshift values are set also.
11988 + **/
11989 +s32 e1000_copper_link_setup_m88(struct e1000_hw *hw)
11990 +{
11991 +       struct e1000_phy_info *phy = &hw->phy;
11992 +       s32 ret_val;
11993 +       u16 phy_data;
11994 +
11995 +       DEBUGFUNC("e1000_copper_link_setup_m88");
11996 +
11997 +       if (phy->reset_disable) {
11998 +               ret_val = E1000_SUCCESS;
11999 +               goto out;
12000 +       }
12001 +
12002 +       /* Enable CRS on TX. This must be set for half-duplex operation. */
12003 +       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
12004 +       if (ret_val)
12005 +               goto out;
12006 +
12007 +       phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
12008 +
12009 +       /*
12010 +        * Options:
12011 +        *   MDI/MDI-X = 0 (default)
12012 +        *   0 - Auto for all speeds
12013 +        *   1 - MDI mode
12014 +        *   2 - MDI-X mode
12015 +        *   3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes)
12016 +        */
12017 +       phy_data &= ~M88E1000_PSCR_AUTO_X_MODE;
12018 +
12019 +       switch (phy->mdix) {
12020 +       case 1:
12021 +               phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE;
12022 +               break;
12023 +       case 2:
12024 +               phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE;
12025 +               break;
12026 +       case 3:
12027 +               phy_data |= M88E1000_PSCR_AUTO_X_1000T;
12028 +               break;
12029 +       case 0:
12030 +       default:
12031 +               phy_data |= M88E1000_PSCR_AUTO_X_MODE;
12032 +               break;
12033 +       }
12034 +
12035 +       /*
12036 +        * Options:
12037 +        *   disable_polarity_correction = 0 (default)
12038 +        *       Automatic Correction for Reversed Cable Polarity
12039 +        *   0 - Disabled
12040 +        *   1 - Enabled
12041 +        */
12042 +       phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL;
12043 +       if (phy->disable_polarity_correction == 1)
12044 +               phy_data |= M88E1000_PSCR_POLARITY_REVERSAL;
12045 +
12046 +       ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
12047 +       if (ret_val)
12048 +               goto out;
12049 +
12050 +       if (phy->revision < E1000_REVISION_4) {
12051 +               /*
12052 +                * Force TX_CLK in the Extended PHY Specific Control Register
12053 +                * to 25MHz clock.
12054 +                */
12055 +               ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
12056 +                                            &phy_data);
12057 +               if (ret_val)
12058 +                       goto out;
12059 +
12060 +               phy_data |= M88E1000_EPSCR_TX_CLK_25;
12061 +
12062 +               if ((phy->revision == E1000_REVISION_2) &&
12063 +                   (phy->id == M88E1111_I_PHY_ID)) {
12064 +                       /* 82573L PHY - set the downshift counter to 5x. */
12065 +                       phy_data &= ~M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK;
12066 +                       phy_data |= M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X;
12067 +               } else {
12068 +                       /* Configure Master and Slave downshift values */
12069 +                       phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK |
12070 +                                    M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK);
12071 +                       phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
12072 +                                    M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X);
12073 +               }
12074 +               ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
12075 +                                            phy_data);
12076 +               if (ret_val)
12077 +                       goto out;
12078 +       }
12079 +
12080 +       /* Commit the changes. */
12081 +       ret_val = phy->ops.commit(hw);
12082 +       if (ret_val) {
12083 +               DEBUGOUT("Error committing the PHY changes\n");
12084 +               goto out;
12085 +       }
12086 +
12087 +out:
12088 +       return ret_val;
12089 +}
12090 +
12091 +/**
12092 + *  e1000_copper_link_setup_igp - Setup igp PHY's for copper link
12093 + *  @hw: pointer to the HW structure
12094 + *
12095 + *  Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for
12096 + *  igp PHY's.
12097 + **/
12098 +s32 e1000_copper_link_setup_igp(struct e1000_hw *hw)
12099 +{
12100 +       struct e1000_phy_info *phy = &hw->phy;
12101 +       s32 ret_val;
12102 +       u16 data;
12103 +
12104 +       DEBUGFUNC("e1000_copper_link_setup_igp");
12105 +
12106 +       if (phy->reset_disable) {
12107 +               ret_val = E1000_SUCCESS;
12108 +               goto out;
12109 +       }
12110 +
12111 +       ret_val = hw->phy.ops.reset(hw);
12112 +       if (ret_val) {
12113 +               DEBUGOUT("Error resetting the PHY.\n");
12114 +               goto out;
12115 +       }
12116 +
12117 +       /*
12118 +        * Wait 100ms for MAC to configure PHY from NVM settings, to avoid
12119 +        * timeout issues when LFS is enabled.
12120 +        */
12121 +       msec_delay(100);
12122 +
12123 +       /*
12124 +        * The NVM settings will configure LPLU in D3 for
12125 +        * non-IGP1 PHYs.
12126 +        */
12127 +       if (phy->type == e1000_phy_igp) {
12128 +               /* disable lplu d3 during driver init */
12129 +               ret_val = hw->phy.ops.set_d3_lplu_state(hw, false);
12130 +               if (ret_val) {
12131 +                       DEBUGOUT("Error Disabling LPLU D3\n");
12132 +                       goto out;
12133 +               }
12134 +       }
12135 +
12136 +       /* disable lplu d0 during driver init */
12137 +       if (hw->phy.ops.set_d0_lplu_state) {
12138 +               ret_val = hw->phy.ops.set_d0_lplu_state(hw, false);
12139 +               if (ret_val) {
12140 +                       DEBUGOUT("Error Disabling LPLU D0\n");
12141 +                       goto out;
12142 +               }
12143 +       }
12144 +       /* Configure mdi-mdix settings */
12145 +       ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &data);
12146 +       if (ret_val)
12147 +               goto out;
12148 +
12149 +       data &= ~IGP01E1000_PSCR_AUTO_MDIX;
12150 +
12151 +       switch (phy->mdix) {
12152 +       case 1:
12153 +               data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX;
12154 +               break;
12155 +       case 2:
12156 +               data |= IGP01E1000_PSCR_FORCE_MDI_MDIX;
12157 +               break;
12158 +       case 0:
12159 +       default:
12160 +               data |= IGP01E1000_PSCR_AUTO_MDIX;
12161 +               break;
12162 +       }
12163 +       ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, data);
12164 +       if (ret_val)
12165 +               goto out;
12166 +
12167 +       /* set auto-master slave resolution settings */
12168 +       if (hw->mac.autoneg) {
12169 +               /*
12170 +                * when autonegotiation advertisement is only 1000Mbps then we
12171 +                * should disable SmartSpeed and enable Auto MasterSlave
12172 +                * resolution as hardware default.
12173 +                */
12174 +               if (phy->autoneg_advertised == ADVERTISE_1000_FULL) {
12175 +                       /* Disable SmartSpeed */
12176 +                       ret_val = phy->ops.read_reg(hw,
12177 +                                                    IGP01E1000_PHY_PORT_CONFIG,
12178 +                                                    &data);
12179 +                       if (ret_val)
12180 +                               goto out;
12181 +
12182 +                       data &= ~IGP01E1000_PSCFR_SMART_SPEED;
12183 +                       ret_val = phy->ops.write_reg(hw,
12184 +                                                    IGP01E1000_PHY_PORT_CONFIG,
12185 +                                                    data);
12186 +                       if (ret_val)
12187 +                               goto out;
12188 +
12189 +                       /* Set auto Master/Slave resolution process */
12190 +                       ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data);
12191 +                       if (ret_val)
12192 +                               goto out;
12193 +
12194 +                       data &= ~CR_1000T_MS_ENABLE;
12195 +                       ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data);
12196 +                       if (ret_val)
12197 +                               goto out;
12198 +               }
12199 +
12200 +               ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data);
12201 +               if (ret_val)
12202 +                       goto out;
12203 +
12204 +               /* load defaults for future use */
12205 +               phy->original_ms_type = (data & CR_1000T_MS_ENABLE) ?
12206 +                       ((data & CR_1000T_MS_VALUE) ?
12207 +                       e1000_ms_force_master :
12208 +                       e1000_ms_force_slave) :
12209 +                       e1000_ms_auto;
12210 +
12211 +               switch (phy->ms_type) {
12212 +               case e1000_ms_force_master:
12213 +                       data |= (CR_1000T_MS_ENABLE | CR_1000T_MS_VALUE);
12214 +                       break;
12215 +               case e1000_ms_force_slave:
12216 +                       data |= CR_1000T_MS_ENABLE;
12217 +                       data &= ~(CR_1000T_MS_VALUE);
12218 +                       break;
12219 +               case e1000_ms_auto:
12220 +                       data &= ~CR_1000T_MS_ENABLE;
12221 +               default:
12222 +                       break;
12223 +               }
12224 +               ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data);
12225 +               if (ret_val)
12226 +                       goto out;
12227 +       }
12228 +
12229 +out:
12230 +       return ret_val;
12231 +}
12232 +
12233 +/**
12234 + *  e1000_copper_link_autoneg - Setup/Enable autoneg for copper link
12235 + *  @hw: pointer to the HW structure
12236 + *
12237 + *  Performs initial bounds checking on autoneg advertisement parameter, then
12238 + *  configure to advertise the full capability.  Setup the PHY to autoneg
12239 + *  and restart the negotiation process between the link partner.  If
12240 + *  autoneg_wait_to_complete, then wait for autoneg to complete before exiting.
12241 + **/
12242 +s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
12243 +{
12244 +       struct e1000_phy_info *phy = &hw->phy;
12245 +       s32 ret_val;
12246 +       u16 phy_ctrl;
12247 +
12248 +       DEBUGFUNC("e1000_copper_link_autoneg");
12249 +
12250 +       /*
12251 +        * Perform some bounds checking on the autoneg advertisement
12252 +        * parameter.
12253 +        */
12254 +       phy->autoneg_advertised &= phy->autoneg_mask;
12255 +
12256 +       /*
12257 +        * If autoneg_advertised is zero, we assume it was not defaulted
12258 +        * by the calling code so we set to advertise full capability.
12259 +        */
12260 +       if (phy->autoneg_advertised == 0)
12261 +               phy->autoneg_advertised = phy->autoneg_mask;
12262 +
12263 +       DEBUGOUT("Reconfiguring auto-neg advertisement params\n");
12264 +       ret_val = e1000_phy_setup_autoneg(hw);
12265 +       if (ret_val) {
12266 +               DEBUGOUT("Error Setting up Auto-Negotiation\n");
12267 +               goto out;
12268 +       }
12269 +       DEBUGOUT("Restarting Auto-Neg\n");
12270 +
12271 +       /*
12272 +        * Restart auto-negotiation by setting the Auto Neg Enable bit and
12273 +        * the Auto Neg Restart bit in the PHY control register.
12274 +        */
12275 +       ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl);
12276 +       if (ret_val)
12277 +               goto out;
12278 +
12279 +       phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG);
12280 +       ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl);
12281 +       if (ret_val)
12282 +               goto out;
12283 +
12284 +       /*
12285 +        * Does the user want to wait for Auto-Neg to complete here, or
12286 +        * check at a later time (for example, callback routine).
12287 +        */
12288 +       if (phy->autoneg_wait_to_complete) {
12289 +               ret_val = hw->mac.ops.wait_autoneg(hw);
12290 +               if (ret_val) {
12291 +                       DEBUGOUT("Error while waiting for "
12292 +                                "autoneg to complete\n");
12293 +                       goto out;
12294 +               }
12295 +       }
12296 +
12297 +       hw->mac.get_link_status = true;
12298 +
12299 +out:
12300 +       return ret_val;
12301 +}
12302 +
12303 +/**
12304 + *  e1000_phy_setup_autoneg - Configure PHY for auto-negotiation
12305 + *  @hw: pointer to the HW structure
12306 + *
12307 + *  Reads the MII auto-neg advertisement register and/or the 1000T control
12308 + *  register and if the PHY is already setup for auto-negotiation, then
12309 + *  return successful.  Otherwise, setup advertisement and flow control to
12310 + *  the appropriate values for the wanted auto-negotiation.
12311 + **/
12312 +static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
12313 +{
12314 +       struct e1000_phy_info *phy = &hw->phy;
12315 +       s32 ret_val;
12316 +       u16 mii_autoneg_adv_reg;
12317 +       u16 mii_1000t_ctrl_reg = 0;
12318 +
12319 +       DEBUGFUNC("e1000_phy_setup_autoneg");
12320 +
12321 +       phy->autoneg_advertised &= phy->autoneg_mask;
12322 +
12323 +       /* Read the MII Auto-Neg Advertisement Register (Address 4). */
12324 +       ret_val = phy->ops.read_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg);
12325 +       if (ret_val)
12326 +               goto out;
12327 +
12328 +       if (phy->autoneg_mask & ADVERTISE_1000_FULL) {
12329 +               /* Read the MII 1000Base-T Control Register (Address 9). */
12330 +               ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL,
12331 +                                           &mii_1000t_ctrl_reg);
12332 +               if (ret_val)
12333 +                       goto out;
12334 +       }
12335 +
12336 +       /*
12337 +        * Need to parse both autoneg_advertised and fc and set up
12338 +        * the appropriate PHY registers.  First we will parse for
12339 +        * autoneg_advertised software override.  Since we can advertise
12340 +        * a plethora of combinations, we need to check each bit
12341 +        * individually.
12342 +        */
12343 +
12344 +       /*
12345 +        * First we clear all the 10/100 mb speed bits in the Auto-Neg
12346 +        * Advertisement Register (Address 4) and the 1000 mb speed bits in
12347 +        * the  1000Base-T Control Register (Address 9).
12348 +        */
12349 +       mii_autoneg_adv_reg &= ~(NWAY_AR_100TX_FD_CAPS |
12350 +                                NWAY_AR_100TX_HD_CAPS |
12351 +                                NWAY_AR_10T_FD_CAPS   |
12352 +                                NWAY_AR_10T_HD_CAPS);
12353 +       mii_1000t_ctrl_reg &= ~(CR_1000T_HD_CAPS | CR_1000T_FD_CAPS);
12354 +
12355 +       DEBUGOUT1("autoneg_advertised %x\n", phy->autoneg_advertised);
12356 +
12357 +       /* Do we want to advertise 10 Mb Half Duplex? */
12358 +       if (phy->autoneg_advertised & ADVERTISE_10_HALF) {
12359 +               DEBUGOUT("Advertise 10mb Half duplex\n");
12360 +               mii_autoneg_adv_reg |= NWAY_AR_10T_HD_CAPS;
12361 +       }
12362 +
12363 +       /* Do we want to advertise 10 Mb Full Duplex? */
12364 +       if (phy->autoneg_advertised & ADVERTISE_10_FULL) {
12365 +               DEBUGOUT("Advertise 10mb Full duplex\n");
12366 +               mii_autoneg_adv_reg |= NWAY_AR_10T_FD_CAPS;
12367 +       }
12368 +
12369 +       /* Do we want to advertise 100 Mb Half Duplex? */
12370 +       if (phy->autoneg_advertised & ADVERTISE_100_HALF) {
12371 +               DEBUGOUT("Advertise 100mb Half duplex\n");
12372 +               mii_autoneg_adv_reg |= NWAY_AR_100TX_HD_CAPS;
12373 +       }
12374 +
12375 +       /* Do we want to advertise 100 Mb Full Duplex? */
12376 +       if (phy->autoneg_advertised & ADVERTISE_100_FULL) {
12377 +               DEBUGOUT("Advertise 100mb Full duplex\n");
12378 +               mii_autoneg_adv_reg |= NWAY_AR_100TX_FD_CAPS;
12379 +       }
12380 +
12381 +       /* We do not allow the Phy to advertise 1000 Mb Half Duplex */
12382 +       if (phy->autoneg_advertised & ADVERTISE_1000_HALF)
12383 +               DEBUGOUT("Advertise 1000mb Half duplex request denied!\n");
12384 +
12385 +       /* Do we want to advertise 1000 Mb Full Duplex? */
12386 +       if (phy->autoneg_advertised & ADVERTISE_1000_FULL) {
12387 +               DEBUGOUT("Advertise 1000mb Full duplex\n");
12388 +               mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS;
12389 +       }
12390 +
12391 +       /*
12392 +        * Check for a software override of the flow control settings, and
12393 +        * setup the PHY advertisement registers accordingly.  If
12394 +        * auto-negotiation is enabled, then software will have to set the
12395 +        * "PAUSE" bits to the correct value in the Auto-Negotiation
12396 +        * Advertisement Register (PHY_AUTONEG_ADV) and re-start auto-
12397 +        * negotiation.
12398 +        *
12399 +        * The possible values of the "fc" parameter are:
12400 +        *      0:  Flow control is completely disabled
12401 +        *      1:  Rx flow control is enabled (we can receive pause frames
12402 +        *          but not send pause frames).
12403 +        *      2:  Tx flow control is enabled (we can send pause frames
12404 +        *          but we do not support receiving pause frames).
12405 +        *      3:  Both Rx and Tx flow control (symmetric) are enabled.
12406 +        *  other:  No software override.  The flow control configuration
12407 +        *          in the EEPROM is used.
12408 +        */
12409 +       switch (hw->fc.type) {
12410 +       case e1000_fc_none:
12411 +               /*
12412 +                * Flow control (Rx & Tx) is completely disabled by a
12413 +                * software over-ride.
12414 +                */
12415 +               mii_autoneg_adv_reg &= ~(NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
12416 +               break;
12417 +       case e1000_fc_rx_pause:
12418 +               /*
12419 +                * Rx Flow control is enabled, and Tx Flow control is
12420 +                * disabled, by a software over-ride.
12421 +                *
12422 +                * Since there really isn't a way to advertise that we are
12423 +                * capable of Rx Pause ONLY, we will advertise that we
12424 +                * support both symmetric and asymmetric Rx PAUSE.  Later
12425 +                * (in e1000_config_fc_after_link_up) we will disable the
12426 +                * hw's ability to send PAUSE frames.
12427 +                */
12428 +               mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
12429 +               break;
12430 +       case e1000_fc_tx_pause:
12431 +               /*
12432 +                * Tx Flow control is enabled, and Rx Flow control is
12433 +                * disabled, by a software over-ride.
12434 +                */
12435 +               mii_autoneg_adv_reg |= NWAY_AR_ASM_DIR;
12436 +               mii_autoneg_adv_reg &= ~NWAY_AR_PAUSE;
12437 +               break;
12438 +       case e1000_fc_full:
12439 +               /*
12440 +                * Flow control (both Rx and Tx) is enabled by a software
12441 +                * over-ride.
12442 +                */
12443 +               mii_autoneg_adv_reg |= (NWAY_AR_ASM_DIR | NWAY_AR_PAUSE);
12444 +               break;
12445 +       default:
12446 +               DEBUGOUT("Flow control param set incorrectly\n");
12447 +               ret_val = -E1000_ERR_CONFIG;
12448 +               goto out;
12449 +       }
12450 +
12451 +       ret_val = phy->ops.write_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg);
12452 +       if (ret_val)
12453 +               goto out;
12454 +
12455 +       DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
12456 +
12457 +       if (phy->autoneg_mask & ADVERTISE_1000_FULL) {
12458 +               ret_val = phy->ops.write_reg(hw,
12459 +                                             PHY_1000T_CTRL,
12460 +                                             mii_1000t_ctrl_reg);
12461 +               if (ret_val)
12462 +                       goto out;
12463 +       }
12464 +
12465 +out:
12466 +       return ret_val;
12467 +}
12468 +
12469 +/**
12470 + *  e1000_setup_copper_link_generic - Configure copper link settings
12471 + *  @hw: pointer to the HW structure
12472 + *
12473 + *  Calls the appropriate function to configure the link for auto-neg or forced
12474 + *  speed and duplex.  Then we check for link, once link is established calls
12475 + *  to configure collision distance and flow control are called.  If link is
12476 + *  not established, we return -E1000_ERR_PHY (-2).
12477 + **/
12478 +s32 e1000_setup_copper_link_generic(struct e1000_hw *hw)
12479 +{
12480 +       s32 ret_val;
12481 +       bool link;
12482 +
12483 +       DEBUGFUNC("e1000_setup_copper_link_generic");
12484 +
12485 +       if (hw->mac.autoneg) {
12486 +               /*
12487 +                * Setup autoneg and flow control advertisement and perform
12488 +                * autonegotiation.
12489 +                */
12490 +               ret_val = e1000_copper_link_autoneg(hw);
12491 +               if (ret_val)
12492 +                       goto out;
12493 +       } else {
12494 +               /*
12495 +                * PHY will be set to 10H, 10F, 100H or 100F
12496 +                * depending on user settings.
12497 +                */
12498 +               DEBUGOUT("Forcing Speed and Duplex\n");
12499 +               ret_val = hw->phy.ops.force_speed_duplex(hw);
12500 +               if (ret_val) {
12501 +                       DEBUGOUT("Error Forcing Speed and Duplex\n");
12502 +                       goto out;
12503 +               }
12504 +       }
12505 +
12506 +       /*
12507 +        * Check link status. Wait up to 100 microseconds for link to become
12508 +        * valid.
12509 +        */
12510 +       ret_val = e1000_phy_has_link_generic(hw,
12511 +                                            COPPER_LINK_UP_LIMIT,
12512 +                                            10,
12513 +                                            &link);
12514 +       if (ret_val)
12515 +               goto out;
12516 +
12517 +       if (link) {
12518 +               DEBUGOUT("Valid link established!!!\n");
12519 +               e1000_config_collision_dist_generic(hw);
12520 +               ret_val = e1000_config_fc_after_link_up_generic(hw);
12521 +       } else {
12522 +               DEBUGOUT("Unable to establish link!!!\n");
12523 +       }
12524 +
12525 +out:
12526 +       return ret_val;
12527 +}
12528 +
12529 +/**
12530 + *  e1000_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY
12531 + *  @hw: pointer to the HW structure
12532 + *
12533 + *  Calls the PHY setup function to force speed and duplex.  Clears the
12534 + *  auto-crossover to force MDI manually.  Waits for link and returns
12535 + *  successful if link up is successful, else -E1000_ERR_PHY (-2).
12536 + **/
12537 +s32 e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw)
12538 +{
12539 +       struct e1000_phy_info *phy = &hw->phy;
12540 +       s32 ret_val;
12541 +       u16 phy_data;
12542 +       bool link;
12543 +
12544 +       DEBUGFUNC("e1000_phy_force_speed_duplex_igp");
12545 +
12546 +       ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
12547 +       if (ret_val)
12548 +               goto out;
12549 +
12550 +       e1000_phy_force_speed_duplex_setup(hw, &phy_data);
12551 +
12552 +       ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data);
12553 +       if (ret_val)
12554 +               goto out;
12555 +
12556 +       /*
12557 +        * Clear Auto-Crossover to force MDI manually.  IGP requires MDI
12558 +        * forced whenever speed and duplex are forced.
12559 +        */
12560 +       ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data);
12561 +       if (ret_val)
12562 +               goto out;
12563 +
12564 +       phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX;
12565 +       phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX;
12566 +
12567 +       ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data);
12568 +       if (ret_val)
12569 +               goto out;
12570 +
12571 +       DEBUGOUT1("IGP PSCR: %X\n", phy_data);
12572 +
12573 +       usec_delay(1);
12574 +
12575 +       if (phy->autoneg_wait_to_complete) {
12576 +               DEBUGOUT("Waiting for forced speed/duplex link on IGP phy.\n");
12577 +
12578 +               ret_val = e1000_phy_has_link_generic(hw,
12579 +                                                    PHY_FORCE_LIMIT,
12580 +                                                    100000,
12581 +                                                    &link);
12582 +               if (ret_val)
12583 +                       goto out;
12584 +
12585 +               if (!link)
12586 +                       DEBUGOUT("Link taking longer than expected.\n");
12587 +
12588 +               /* Try once more */
12589 +               ret_val = e1000_phy_has_link_generic(hw,
12590 +                                                    PHY_FORCE_LIMIT,
12591 +                                                    100000,
12592 +                                                    &link);
12593 +               if (ret_val)
12594 +                       goto out;
12595 +       }
12596 +
12597 +out:
12598 +       return ret_val;
12599 +}
12600 +
12601 +/**
12602 + *  e1000_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY
12603 + *  @hw: pointer to the HW structure
12604 + *
12605 + *  Calls the PHY setup function to force speed and duplex.  Clears the
12606 + *  auto-crossover to force MDI manually.  Resets the PHY to commit the
12607 + *  changes.  If time expires while waiting for link up, we reset the DSP.
12608 + *  After reset, TX_CLK and CRS on Tx must be set.  Return successful upon
12609 + *  successful completion, else return corresponding error code.
12610 + **/
12611 +s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw)
12612 +{
12613 +       struct e1000_phy_info *phy = &hw->phy;
12614 +       s32 ret_val;
12615 +       u16 phy_data;
12616 +       bool link;
12617 +
12618 +       DEBUGFUNC("e1000_phy_force_speed_duplex_m88");
12619 +
12620 +       /*
12621 +        * Clear Auto-Crossover to force MDI manually.  M88E1000 requires MDI
12622 +        * forced whenever speed and duplex are forced.
12623 +        */
12624 +       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
12625 +       if (ret_val)
12626 +               goto out;
12627 +
12628 +       phy_data &= ~M88E1000_PSCR_AUTO_X_MODE;
12629 +       ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
12630 +       if (ret_val)
12631 +               goto out;
12632 +
12633 +       DEBUGOUT1("M88E1000 PSCR: %X\n", phy_data);
12634 +
12635 +       ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
12636 +       if (ret_val)
12637 +               goto out;
12638 +
12639 +       e1000_phy_force_speed_duplex_setup(hw, &phy_data);
12640 +
12641 +       ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data);
12642 +       if (ret_val)
12643 +               goto out;
12644 +
12645 +       /* Reset the phy to commit changes. */
12646 +       ret_val = hw->phy.ops.commit(hw);
12647 +       if (ret_val)
12648 +               goto out;
12649 +
12650 +       if (phy->autoneg_wait_to_complete) {
12651 +               DEBUGOUT("Waiting for forced speed/duplex link on M88 phy.\n");
12652 +
12653 +               ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
12654 +                                                    100000, &link);
12655 +               if (ret_val)
12656 +                       goto out;
12657 +
12658 +               if (!link) {
12659 +                       /*
12660 +                        * We didn't get link.
12661 +                        * Reset the DSP and cross our fingers.
12662 +                        */
12663 +                       ret_val = phy->ops.write_reg(hw,
12664 +                                                     M88E1000_PHY_PAGE_SELECT,
12665 +                                                     0x001d);
12666 +                       if (ret_val)
12667 +                               goto out;
12668 +                       ret_val = e1000_phy_reset_dsp_generic(hw);
12669 +                       if (ret_val)
12670 +                               goto out;
12671 +               }
12672 +
12673 +               /* Try once more */
12674 +               ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
12675 +                                                    100000, &link);
12676 +               if (ret_val)
12677 +                       goto out;
12678 +       }
12679 +
12680 +       ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
12681 +       if (ret_val)
12682 +               goto out;
12683 +
12684 +       /*
12685 +        * Resetting the phy means we need to re-force TX_CLK in the
12686 +        * Extended PHY Specific Control Register to 25MHz clock from
12687 +        * the reset value of 2.5MHz.
12688 +        */
12689 +       phy_data |= M88E1000_EPSCR_TX_CLK_25;
12690 +       ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data);
12691 +       if (ret_val)
12692 +               goto out;
12693 +
12694 +       /*
12695 +        * In addition, we must re-enable CRS on Tx for both half and full
12696 +        * duplex.
12697 +        */
12698 +       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
12699 +       if (ret_val)
12700 +               goto out;
12701 +
12702 +       phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
12703 +       ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
12704 +
12705 +out:
12706 +       return ret_val;
12707 +}
12708 +
12709 +/**
12710 + *  e1000_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex
12711 + *  @hw: pointer to the HW structure
12712 + *  @phy_ctrl: pointer to current value of PHY_CONTROL
12713 + *
12714 + *  Forces speed and duplex on the PHY by doing the following: disable flow
12715 + *  control, force speed/duplex on the MAC, disable auto speed detection,
12716 + *  disable auto-negotiation, configure duplex, configure speed, configure
12717 + *  the collision distance, write configuration to CTRL register.  The
12718 + *  caller must write to the PHY_CONTROL register for these settings to
12719 + *  take affect.
12720 + **/
12721 +void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl)
12722 +{
12723 +       struct e1000_mac_info *mac = &hw->mac;
12724 +       u32 ctrl;
12725 +
12726 +       DEBUGFUNC("e1000_phy_force_speed_duplex_setup");
12727 +
12728 +       /* Turn off flow control when forcing speed/duplex */
12729 +       hw->fc.type = e1000_fc_none;
12730 +
12731 +       /* Force speed/duplex on the mac */
12732 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
12733 +       ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
12734 +       ctrl &= ~E1000_CTRL_SPD_SEL;
12735 +
12736 +       /* Disable Auto Speed Detection */
12737 +       ctrl &= ~E1000_CTRL_ASDE;
12738 +
12739 +       /* Disable autoneg on the phy */
12740 +       *phy_ctrl &= ~MII_CR_AUTO_NEG_EN;
12741 +
12742 +       /* Forcing Full or Half Duplex? */
12743 +       if (mac->forced_speed_duplex & E1000_ALL_HALF_DUPLEX) {
12744 +               ctrl &= ~E1000_CTRL_FD;
12745 +               *phy_ctrl &= ~MII_CR_FULL_DUPLEX;
12746 +               DEBUGOUT("Half Duplex\n");
12747 +       } else {
12748 +               ctrl |= E1000_CTRL_FD;
12749 +               *phy_ctrl |= MII_CR_FULL_DUPLEX;
12750 +               DEBUGOUT("Full Duplex\n");
12751 +       }
12752 +
12753 +       /* Forcing 10mb or 100mb? */
12754 +       if (mac->forced_speed_duplex & E1000_ALL_100_SPEED) {
12755 +               ctrl |= E1000_CTRL_SPD_100;
12756 +               *phy_ctrl |= MII_CR_SPEED_100;
12757 +               *phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_10);
12758 +               DEBUGOUT("Forcing 100mb\n");
12759 +       } else {
12760 +               ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
12761 +               *phy_ctrl |= MII_CR_SPEED_10;
12762 +               *phy_ctrl &= ~(MII_CR_SPEED_1000 | MII_CR_SPEED_100);
12763 +               DEBUGOUT("Forcing 10mb\n");
12764 +       }
12765 +
12766 +       e1000_config_collision_dist_generic(hw);
12767 +
12768 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
12769 +}
12770 +
12771 +/**
12772 + *  e1000_set_d3_lplu_state_generic - Sets low power link up state for D3
12773 + *  @hw: pointer to the HW structure
12774 + *  @active: boolean used to enable/disable lplu
12775 + *
12776 + *  Success returns 0, Failure returns 1
12777 + *
12778 + *  The low power link up (lplu) state is set to the power management level D3
12779 + *  and SmartSpeed is disabled when active is true, else clear lplu for D3
12780 + *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
12781 + *  is used during Dx states where the power conservation is most important.
12782 + *  During driver activity, SmartSpeed should be enabled so performance is
12783 + *  maintained.
12784 + **/
12785 +s32 e1000_set_d3_lplu_state_generic(struct e1000_hw *hw, bool active)
12786 +{
12787 +       struct e1000_phy_info *phy = &hw->phy;
12788 +       s32 ret_val = E1000_SUCCESS;
12789 +       u16 data;
12790 +
12791 +       DEBUGFUNC("e1000_set_d3_lplu_state_generic");
12792 +
12793 +       if (!(hw->phy.ops.read_reg))
12794 +               goto out;
12795 +
12796 +       ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data);
12797 +       if (ret_val)
12798 +               goto out;
12799 +
12800 +       if (!active) {
12801 +               data &= ~IGP02E1000_PM_D3_LPLU;
12802 +               ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
12803 +                                            data);
12804 +               if (ret_val)
12805 +                       goto out;
12806 +               /*
12807 +                * LPLU and SmartSpeed are mutually exclusive.  LPLU is used
12808 +                * during Dx states where the power conservation is most
12809 +                * important.  During driver activity we should enable
12810 +                * SmartSpeed, so performance is maintained.
12811 +                */
12812 +               if (phy->smart_speed == e1000_smart_speed_on) {
12813 +                       ret_val = phy->ops.read_reg(hw,
12814 +                                                   IGP01E1000_PHY_PORT_CONFIG,
12815 +                                                   &data);
12816 +                       if (ret_val)
12817 +                               goto out;
12818 +
12819 +                       data |= IGP01E1000_PSCFR_SMART_SPEED;
12820 +                       ret_val = phy->ops.write_reg(hw,
12821 +                                                    IGP01E1000_PHY_PORT_CONFIG,
12822 +                                                    data);
12823 +                       if (ret_val)
12824 +                               goto out;
12825 +               } else if (phy->smart_speed == e1000_smart_speed_off) {
12826 +                       ret_val = phy->ops.read_reg(hw,
12827 +                                                    IGP01E1000_PHY_PORT_CONFIG,
12828 +                                                    &data);
12829 +                       if (ret_val)
12830 +                               goto out;
12831 +
12832 +                       data &= ~IGP01E1000_PSCFR_SMART_SPEED;
12833 +                       ret_val = phy->ops.write_reg(hw,
12834 +                                                    IGP01E1000_PHY_PORT_CONFIG,
12835 +                                                    data);
12836 +                       if (ret_val)
12837 +                               goto out;
12838 +               }
12839 +       } else if ((phy->autoneg_advertised == E1000_ALL_SPEED_DUPLEX) ||
12840 +                  (phy->autoneg_advertised == E1000_ALL_NOT_GIG) ||
12841 +                  (phy->autoneg_advertised == E1000_ALL_10_SPEED)) {
12842 +               data |= IGP02E1000_PM_D3_LPLU;
12843 +               ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
12844 +                                             data);
12845 +               if (ret_val)
12846 +                       goto out;
12847 +
12848 +               /* When LPLU is enabled, we should disable SmartSpeed */
12849 +               ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
12850 +                                            &data);
12851 +               if (ret_val)
12852 +                       goto out;
12853 +
12854 +               data &= ~IGP01E1000_PSCFR_SMART_SPEED;
12855 +               ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
12856 +                                             data);
12857 +       }
12858 +
12859 +out:
12860 +       return ret_val;
12861 +}
12862 +
12863 +/**
12864 + *  e1000_check_downshift_generic - Checks whether a downshift in speed occurred
12865 + *  @hw: pointer to the HW structure
12866 + *
12867 + *  Success returns 0, Failure returns 1
12868 + *
12869 + *  A downshift is detected by querying the PHY link health.
12870 + **/
12871 +s32 e1000_check_downshift_generic(struct e1000_hw *hw)
12872 +{
12873 +       struct e1000_phy_info *phy = &hw->phy;
12874 +       s32 ret_val;
12875 +       u16 phy_data, offset, mask;
12876 +
12877 +       DEBUGFUNC("e1000_check_downshift_generic");
12878 +
12879 +       switch (phy->type) {
12880 +       case e1000_phy_m88:
12881 +       case e1000_phy_gg82563:
12882 +               offset  = M88E1000_PHY_SPEC_STATUS;
12883 +               mask    = M88E1000_PSSR_DOWNSHIFT;
12884 +               break;
12885 +       case e1000_phy_igp_2:
12886 +       case e1000_phy_igp:
12887 +       case e1000_phy_igp_3:
12888 +               offset  = IGP01E1000_PHY_LINK_HEALTH;
12889 +               mask    = IGP01E1000_PLHR_SS_DOWNGRADE;
12890 +               break;
12891 +       default:
12892 +               /* speed downshift not supported */
12893 +               phy->speed_downgraded = false;
12894 +               ret_val = E1000_SUCCESS;
12895 +               goto out;
12896 +       }
12897 +
12898 +       ret_val = phy->ops.read_reg(hw, offset, &phy_data);
12899 +
12900 +       if (!ret_val)
12901 +               phy->speed_downgraded = (phy_data & mask) ? true : false;
12902 +
12903 +out:
12904 +       return ret_val;
12905 +}
12906 +
12907 +/**
12908 + *  e1000_check_polarity_m88 - Checks the polarity.
12909 + *  @hw: pointer to the HW structure
12910 + *
12911 + *  Success returns 0, Failure returns -E1000_ERR_PHY (-2)
12912 + *
12913 + *  Polarity is determined based on the PHY specific status register.
12914 + **/
12915 +s32 e1000_check_polarity_m88(struct e1000_hw *hw)
12916 +{
12917 +       struct e1000_phy_info *phy = &hw->phy;
12918 +       s32 ret_val;
12919 +       u16 data;
12920 +
12921 +       DEBUGFUNC("e1000_check_polarity_m88");
12922 +
12923 +       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &data);
12924 +
12925 +       if (!ret_val)
12926 +               phy->cable_polarity = (data & M88E1000_PSSR_REV_POLARITY)
12927 +                                     ? e1000_rev_polarity_reversed
12928 +                                     : e1000_rev_polarity_normal;
12929 +
12930 +       return ret_val;
12931 +}
12932 +
12933 +/**
12934 + *  e1000_check_polarity_igp - Checks the polarity.
12935 + *  @hw: pointer to the HW structure
12936 + *
12937 + *  Success returns 0, Failure returns -E1000_ERR_PHY (-2)
12938 + *
12939 + *  Polarity is determined based on the PHY port status register, and the
12940 + *  current speed (since there is no polarity at 100Mbps).
12941 + **/
12942 +s32 e1000_check_polarity_igp(struct e1000_hw *hw)
12943 +{
12944 +       struct e1000_phy_info *phy = &hw->phy;
12945 +       s32 ret_val;
12946 +       u16 data, offset, mask;
12947 +
12948 +       DEBUGFUNC("e1000_check_polarity_igp");
12949 +
12950 +       /*
12951 +        * Polarity is determined based on the speed of
12952 +        * our connection.
12953 +        */
12954 +       ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data);
12955 +       if (ret_val)
12956 +               goto out;
12957 +
12958 +       if ((data & IGP01E1000_PSSR_SPEED_MASK) ==
12959 +           IGP01E1000_PSSR_SPEED_1000MBPS) {
12960 +               offset  = IGP01E1000_PHY_PCS_INIT_REG;
12961 +               mask    = IGP01E1000_PHY_POLARITY_MASK;
12962 +       } else {
12963 +               /*
12964 +                * This really only applies to 10Mbps since
12965 +                * there is no polarity for 100Mbps (always 0).
12966 +                */
12967 +               offset  = IGP01E1000_PHY_PORT_STATUS;
12968 +               mask    = IGP01E1000_PSSR_POLARITY_REVERSED;
12969 +       }
12970 +
12971 +       ret_val = phy->ops.read_reg(hw, offset, &data);
12972 +
12973 +       if (!ret_val)
12974 +               phy->cable_polarity = (data & mask)
12975 +                                     ? e1000_rev_polarity_reversed
12976 +                                     : e1000_rev_polarity_normal;
12977 +
12978 +out:
12979 +       return ret_val;
12980 +}
12981 +
12982 +/**
12983 + *  e1000_wait_autoneg_generic - Wait for auto-neg completion
12984 + *  @hw: pointer to the HW structure
12985 + *
12986 + *  Waits for auto-negotiation to complete or for the auto-negotiation time
12987 + *  limit to expire, which ever happens first.
12988 + **/
12989 +s32 e1000_wait_autoneg_generic(struct e1000_hw *hw)
12990 +{
12991 +       s32 ret_val = E1000_SUCCESS;
12992 +       u16 i, phy_status;
12993 +
12994 +       DEBUGFUNC("e1000_wait_autoneg_generic");
12995 +
12996 +       if (!(hw->phy.ops.read_reg))
12997 +               return E1000_SUCCESS;
12998 +
12999 +       /* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */
13000 +       for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) {
13001 +               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
13002 +               if (ret_val)
13003 +                       break;
13004 +               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
13005 +               if (ret_val)
13006 +                       break;
13007 +               if (phy_status & MII_SR_AUTONEG_COMPLETE)
13008 +                       break;
13009 +               msec_delay(100);
13010 +       }
13011 +
13012 +       /*
13013 +        * PHY_AUTO_NEG_TIME expiration doesn't guarantee auto-negotiation
13014 +        * has completed.
13015 +        */
13016 +       return ret_val;
13017 +}
13018 +
13019 +/**
13020 + *  e1000_phy_has_link_generic - Polls PHY for link
13021 + *  @hw: pointer to the HW structure
13022 + *  @iterations: number of times to poll for link
13023 + *  @usec_interval: delay between polling attempts
13024 + *  @success: pointer to whether polling was successful or not
13025 + *
13026 + *  Polls the PHY status register for link, 'iterations' number of times.
13027 + **/
13028 +s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
13029 +                               u32 usec_interval, bool *success)
13030 +{
13031 +       s32 ret_val = E1000_SUCCESS;
13032 +       u16 i, phy_status;
13033 +
13034 +       DEBUGFUNC("e1000_phy_has_link_generic");
13035 +
13036 +       if (!(hw->phy.ops.read_reg))
13037 +               return E1000_SUCCESS;
13038 +
13039 +       for (i = 0; i < iterations; i++) {
13040 +               /*
13041 +                * Some PHYs require the PHY_STATUS register to be read
13042 +                * twice due to the link bit being sticky.  No harm doing
13043 +                * it across the board.
13044 +                */
13045 +               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
13046 +               if (ret_val)
13047 +                       break;
13048 +               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
13049 +               if (ret_val)
13050 +                       break;
13051 +               if (phy_status & MII_SR_LINK_STATUS)
13052 +                       break;
13053 +               if (usec_interval >= 1000)
13054 +                       msec_delay_irq(usec_interval/1000);
13055 +               else
13056 +                       usec_delay(usec_interval);
13057 +       }
13058 +
13059 +       *success = (i < iterations) ? true : false;
13060 +
13061 +       return ret_val;
13062 +}
13063 +
13064 +/**
13065 + *  e1000_get_cable_length_m88 - Determine cable length for m88 PHY
13066 + *  @hw: pointer to the HW structure
13067 + *
13068 + *  Reads the PHY specific status register to retrieve the cable length
13069 + *  information.  The cable length is determined by averaging the minimum and
13070 + *  maximum values to get the "average" cable length.  The m88 PHY has four
13071 + *  possible cable length values, which are:
13072 + *     Register Value          Cable Length
13073 + *     0                       < 50 meters
13074 + *     1                       50 - 80 meters
13075 + *     2                       80 - 110 meters
13076 + *     3                       110 - 140 meters
13077 + *     4                       > 140 meters
13078 + **/
13079 +s32 e1000_get_cable_length_m88(struct e1000_hw *hw)
13080 +{
13081 +       struct e1000_phy_info *phy = &hw->phy;
13082 +       s32 ret_val;
13083 +       u16 phy_data, index;
13084 +
13085 +       DEBUGFUNC("e1000_get_cable_length_m88");
13086 +
13087 +       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
13088 +       if (ret_val)
13089 +               goto out;
13090 +
13091 +       index = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >>
13092 +               M88E1000_PSSR_CABLE_LENGTH_SHIFT;
13093 +       phy->min_cable_length = e1000_m88_cable_length_table[index];
13094 +       phy->max_cable_length = e1000_m88_cable_length_table[index+1];
13095 +
13096 +       phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2;
13097 +
13098 +out:
13099 +       return ret_val;
13100 +}
13101 +
13102 +/**
13103 + *  e1000_get_cable_length_igp_2 - Determine cable length for igp2 PHY
13104 + *  @hw: pointer to the HW structure
13105 + *
13106 + *  The automatic gain control (agc) normalizes the amplitude of the
13107 + *  received signal, adjusting for the attenuation produced by the
13108 + *  cable.  By reading the AGC registers, which represent the
13109 + *  combination of coarse and fine gain value, the value can be put
13110 + *  into a lookup table to obtain the approximate cable length
13111 + *  for each channel.
13112 + **/
13113 +s32 e1000_get_cable_length_igp_2(struct e1000_hw *hw)
13114 +{
13115 +       struct e1000_phy_info *phy = &hw->phy;
13116 +       s32 ret_val = E1000_SUCCESS;
13117 +       u16 phy_data, i, agc_value = 0;
13118 +       u16 cur_agc_index, max_agc_index = 0;
13119 +       u16 min_agc_index = IGP02E1000_CABLE_LENGTH_TABLE_SIZE - 1;
13120 +       u16 agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] =
13121 +                                                        {IGP02E1000_PHY_AGC_A,
13122 +                                                         IGP02E1000_PHY_AGC_B,
13123 +                                                         IGP02E1000_PHY_AGC_C,
13124 +                                                         IGP02E1000_PHY_AGC_D};
13125 +
13126 +       DEBUGFUNC("e1000_get_cable_length_igp_2");
13127 +
13128 +       /* Read the AGC registers for all channels */
13129 +       for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) {
13130 +               ret_val = phy->ops.read_reg(hw, agc_reg_array[i], &phy_data);
13131 +               if (ret_val)
13132 +                       goto out;
13133 +
13134 +               /*
13135 +                * Getting bits 15:9, which represent the combination of
13136 +                * coarse and fine gain values.  The result is a number
13137 +                * that can be put into the lookup table to obtain the
13138 +                * approximate cable length.
13139 +                */
13140 +               cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) &
13141 +                               IGP02E1000_AGC_LENGTH_MASK;
13142 +
13143 +               /* Array index bound check. */
13144 +               if ((cur_agc_index >= IGP02E1000_CABLE_LENGTH_TABLE_SIZE) ||
13145 +                   (cur_agc_index == 0)) {
13146 +                       ret_val = -E1000_ERR_PHY;
13147 +                       goto out;
13148 +               }
13149 +
13150 +               /* Remove min & max AGC values from calculation. */
13151 +               if (e1000_igp_2_cable_length_table[min_agc_index] >
13152 +                   e1000_igp_2_cable_length_table[cur_agc_index])
13153 +                       min_agc_index = cur_agc_index;
13154 +               if (e1000_igp_2_cable_length_table[max_agc_index] <
13155 +                   e1000_igp_2_cable_length_table[cur_agc_index])
13156 +                       max_agc_index = cur_agc_index;
13157 +
13158 +               agc_value += e1000_igp_2_cable_length_table[cur_agc_index];
13159 +       }
13160 +
13161 +       agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] +
13162 +                     e1000_igp_2_cable_length_table[max_agc_index]);
13163 +       agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2);
13164 +
13165 +       /* Calculate cable length with the error range of +/- 10 meters. */
13166 +       phy->min_cable_length = ((agc_value - IGP02E1000_AGC_RANGE) > 0) ?
13167 +                                (agc_value - IGP02E1000_AGC_RANGE) : 0;
13168 +       phy->max_cable_length = agc_value + IGP02E1000_AGC_RANGE;
13169 +
13170 +       phy->cable_length = (phy->min_cable_length + phy->max_cable_length) / 2;
13171 +
13172 +out:
13173 +       return ret_val;
13174 +}
13175 +
13176 +/**
13177 + *  e1000_get_phy_info_m88 - Retrieve PHY information
13178 + *  @hw: pointer to the HW structure
13179 + *
13180 + *  Valid for only copper links.  Read the PHY status register (sticky read)
13181 + *  to verify that link is up.  Read the PHY special control register to
13182 + *  determine the polarity and 10base-T extended distance.  Read the PHY
13183 + *  special status register to determine MDI/MDIx and current speed.  If
13184 + *  speed is 1000, then determine cable length, local and remote receiver.
13185 + **/
13186 +s32 e1000_get_phy_info_m88(struct e1000_hw *hw)
13187 +{
13188 +       struct e1000_phy_info *phy = &hw->phy;
13189 +       s32  ret_val;
13190 +       u16 phy_data;
13191 +       bool link;
13192 +
13193 +       DEBUGFUNC("e1000_get_phy_info_m88");
13194 +
13195 +       if (hw->phy.media_type != e1000_media_type_copper) {
13196 +               DEBUGOUT("Phy info is only valid for copper media\n");
13197 +               ret_val = -E1000_ERR_CONFIG;
13198 +               goto out;
13199 +       }
13200 +
13201 +       ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
13202 +       if (ret_val)
13203 +               goto out;
13204 +
13205 +       if (!link) {
13206 +               DEBUGOUT("Phy info is only valid if link is up\n");
13207 +               ret_val = -E1000_ERR_CONFIG;
13208 +               goto out;
13209 +       }
13210 +
13211 +       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
13212 +       if (ret_val)
13213 +               goto out;
13214 +
13215 +       phy->polarity_correction = (phy_data & M88E1000_PSCR_POLARITY_REVERSAL)
13216 +                                  ? true : false;
13217 +
13218 +       ret_val = e1000_check_polarity_m88(hw);
13219 +       if (ret_val)
13220 +               goto out;
13221 +
13222 +       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
13223 +       if (ret_val)
13224 +               goto out;
13225 +
13226 +       phy->is_mdix = (phy_data & M88E1000_PSSR_MDIX) ? true : false;
13227 +
13228 +       if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) {
13229 +               ret_val = hw->phy.ops.get_cable_length(hw);
13230 +               if (ret_val)
13231 +                       goto out;
13232 +
13233 +               ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &phy_data);
13234 +               if (ret_val)
13235 +                       goto out;
13236 +
13237 +               phy->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS)
13238 +                               ? e1000_1000t_rx_status_ok
13239 +                               : e1000_1000t_rx_status_not_ok;
13240 +
13241 +               phy->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS)
13242 +                                ? e1000_1000t_rx_status_ok
13243 +                                : e1000_1000t_rx_status_not_ok;
13244 +       } else {
13245 +               /* Set values to "undefined" */
13246 +               phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED;
13247 +               phy->local_rx = e1000_1000t_rx_status_undefined;
13248 +               phy->remote_rx = e1000_1000t_rx_status_undefined;
13249 +       }
13250 +
13251 +out:
13252 +       return ret_val;
13253 +}
13254 +
13255 +/**
13256 + *  e1000_get_phy_info_igp - Retrieve igp PHY information
13257 + *  @hw: pointer to the HW structure
13258 + *
13259 + *  Read PHY status to determine if link is up.  If link is up, then
13260 + *  set/determine 10base-T extended distance and polarity correction.  Read
13261 + *  PHY port status to determine MDI/MDIx and speed.  Based on the speed,
13262 + *  determine on the cable length, local and remote receiver.
13263 + **/
13264 +s32 e1000_get_phy_info_igp(struct e1000_hw *hw)
13265 +{
13266 +       struct e1000_phy_info *phy = &hw->phy;
13267 +       s32 ret_val;
13268 +       u16 data;
13269 +       bool link;
13270 +
13271 +       DEBUGFUNC("e1000_get_phy_info_igp");
13272 +
13273 +       ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
13274 +       if (ret_val)
13275 +               goto out;
13276 +
13277 +       if (!link) {
13278 +               DEBUGOUT("Phy info is only valid if link is up\n");
13279 +               ret_val = -E1000_ERR_CONFIG;
13280 +               goto out;
13281 +       }
13282 +
13283 +       phy->polarity_correction = true;
13284 +
13285 +       ret_val = e1000_check_polarity_igp(hw);
13286 +       if (ret_val)
13287 +               goto out;
13288 +
13289 +       ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data);
13290 +       if (ret_val)
13291 +               goto out;
13292 +
13293 +       phy->is_mdix = (data & IGP01E1000_PSSR_MDIX) ? true : false;
13294 +
13295 +       if ((data & IGP01E1000_PSSR_SPEED_MASK) ==
13296 +           IGP01E1000_PSSR_SPEED_1000MBPS) {
13297 +               ret_val = hw->phy.ops.get_cable_length(hw);
13298 +               if (ret_val)
13299 +                       goto out;
13300 +
13301 +               ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data);
13302 +               if (ret_val)
13303 +                       goto out;
13304 +
13305 +               phy->local_rx = (data & SR_1000T_LOCAL_RX_STATUS)
13306 +                               ? e1000_1000t_rx_status_ok
13307 +                               : e1000_1000t_rx_status_not_ok;
13308 +
13309 +               phy->remote_rx = (data & SR_1000T_REMOTE_RX_STATUS)
13310 +                                ? e1000_1000t_rx_status_ok
13311 +                                : e1000_1000t_rx_status_not_ok;
13312 +       } else {
13313 +               phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED;
13314 +               phy->local_rx = e1000_1000t_rx_status_undefined;
13315 +               phy->remote_rx = e1000_1000t_rx_status_undefined;
13316 +       }
13317 +
13318 +out:
13319 +       return ret_val;
13320 +}
13321 +
13322 +/**
13323 + *  e1000_phy_sw_reset_generic - PHY software reset
13324 + *  @hw: pointer to the HW structure
13325 + *
13326 + *  Does a software reset of the PHY by reading the PHY control register and
13327 + *  setting/write the control register reset bit to the PHY.
13328 + **/
13329 +s32 e1000_phy_sw_reset_generic(struct e1000_hw *hw)
13330 +{
13331 +       s32 ret_val = E1000_SUCCESS;
13332 +       u16 phy_ctrl;
13333 +
13334 +       DEBUGFUNC("e1000_phy_sw_reset_generic");
13335 +
13336 +       if (!(hw->phy.ops.read_reg))
13337 +               goto out;
13338 +
13339 +       ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl);
13340 +       if (ret_val)
13341 +               goto out;
13342 +
13343 +       phy_ctrl |= MII_CR_RESET;
13344 +       ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl);
13345 +       if (ret_val)
13346 +               goto out;
13347 +
13348 +       usec_delay(1);
13349 +
13350 +out:
13351 +       return ret_val;
13352 +}
13353 +
13354 +/**
13355 + *  e1000_phy_hw_reset_generic - PHY hardware reset
13356 + *  @hw: pointer to the HW structure
13357 + *
13358 + *  Verify the reset block is not blocking us from resetting.  Acquire
13359 + *  semaphore (if necessary) and read/set/write the device control reset
13360 + *  bit in the PHY.  Wait the appropriate delay time for the device to
13361 + *  reset and release the semaphore (if necessary).
13362 + **/
13363 +s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw)
13364 +{
13365 +       struct e1000_phy_info *phy = &hw->phy;
13366 +       s32 ret_val = E1000_SUCCESS;
13367 +       u32 ctrl;
13368 +
13369 +       DEBUGFUNC("e1000_phy_hw_reset_generic");
13370 +
13371 +       ret_val = phy->ops.check_reset_block(hw);
13372 +       if (ret_val) {
13373 +               ret_val = E1000_SUCCESS;
13374 +               goto out;
13375 +       }
13376 +
13377 +       ret_val = phy->ops.acquire(hw);
13378 +       if (ret_val)
13379 +               goto out;
13380 +
13381 +       ctrl = E1000_READ_REG(hw, E1000_CTRL);
13382 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_PHY_RST);
13383 +       E1000_WRITE_FLUSH(hw);
13384 +
13385 +       usec_delay(phy->reset_delay_us);
13386 +
13387 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
13388 +       E1000_WRITE_FLUSH(hw);
13389 +
13390 +       usec_delay(150);
13391 +
13392 +       phy->ops.release(hw);
13393 +
13394 +       ret_val = phy->ops.get_cfg_done(hw);
13395 +
13396 +out:
13397 +       return ret_val;
13398 +}
13399 +
13400 +/**
13401 + *  e1000_get_cfg_done_generic - Generic configuration done
13402 + *  @hw: pointer to the HW structure
13403 + *
13404 + *  Generic function to wait 10 milli-seconds for configuration to complete
13405 + *  and return success.
13406 + **/
13407 +s32 e1000_get_cfg_done_generic(struct e1000_hw *hw)
13408 +{
13409 +       DEBUGFUNC("e1000_get_cfg_done_generic");
13410 +
13411 +       msec_delay_irq(10);
13412 +
13413 +       return E1000_SUCCESS;
13414 +}
13415 +
13416 +/**
13417 + *  e1000_phy_init_script_igp3 - Inits the IGP3 PHY
13418 + *  @hw: pointer to the HW structure
13419 + *
13420 + *  Initializes a Intel Gigabit PHY3 when an EEPROM is not present.
13421 + **/
13422 +s32 e1000_phy_init_script_igp3(struct e1000_hw *hw)
13423 +{
13424 +       DEBUGOUT("Running IGP 3 PHY init script\n");
13425 +
13426 +       /* PHY init IGP 3 */
13427 +       /* Enable rise/fall, 10-mode work in class-A */
13428 +       hw->phy.ops.write_reg(hw, 0x2F5B, 0x9018);
13429 +       /* Remove all caps from Replica path filter */
13430 +       hw->phy.ops.write_reg(hw, 0x2F52, 0x0000);
13431 +       /* Bias trimming for ADC, AFE and Driver (Default) */
13432 +       hw->phy.ops.write_reg(hw, 0x2FB1, 0x8B24);
13433 +       /* Increase Hybrid poly bias */
13434 +       hw->phy.ops.write_reg(hw, 0x2FB2, 0xF8F0);
13435 +       /* Add 4% to Tx amplitude in Gig mode */
13436 +       hw->phy.ops.write_reg(hw, 0x2010, 0x10B0);
13437 +       /* Disable trimming (TTT) */
13438 +       hw->phy.ops.write_reg(hw, 0x2011, 0x0000);
13439 +       /* Poly DC correction to 94.6% + 2% for all channels */
13440 +       hw->phy.ops.write_reg(hw, 0x20DD, 0x249A);
13441 +       /* ABS DC correction to 95.9% */
13442 +       hw->phy.ops.write_reg(hw, 0x20DE, 0x00D3);
13443 +       /* BG temp curve trim */
13444 +       hw->phy.ops.write_reg(hw, 0x28B4, 0x04CE);
13445 +       /* Increasing ADC OPAMP stage 1 currents to max */
13446 +       hw->phy.ops.write_reg(hw, 0x2F70, 0x29E4);
13447 +       /* Force 1000 ( required for enabling PHY regs configuration) */
13448 +       hw->phy.ops.write_reg(hw, 0x0000, 0x0140);
13449 +       /* Set upd_freq to 6 */
13450 +       hw->phy.ops.write_reg(hw, 0x1F30, 0x1606);
13451 +       /* Disable NPDFE */
13452 +       hw->phy.ops.write_reg(hw, 0x1F31, 0xB814);
13453 +       /* Disable adaptive fixed FFE (Default) */
13454 +       hw->phy.ops.write_reg(hw, 0x1F35, 0x002A);
13455 +       /* Enable FFE hysteresis */
13456 +       hw->phy.ops.write_reg(hw, 0x1F3E, 0x0067);
13457 +       /* Fixed FFE for short cable lengths */
13458 +       hw->phy.ops.write_reg(hw, 0x1F54, 0x0065);
13459 +       /* Fixed FFE for medium cable lengths */
13460 +       hw->phy.ops.write_reg(hw, 0x1F55, 0x002A);
13461 +       /* Fixed FFE for long cable lengths */
13462 +       hw->phy.ops.write_reg(hw, 0x1F56, 0x002A);
13463 +       /* Enable Adaptive Clip Threshold */
13464 +       hw->phy.ops.write_reg(hw, 0x1F72, 0x3FB0);
13465 +       /* AHT reset limit to 1 */
13466 +       hw->phy.ops.write_reg(hw, 0x1F76, 0xC0FF);
13467 +       /* Set AHT master delay to 127 msec */
13468 +       hw->phy.ops.write_reg(hw, 0x1F77, 0x1DEC);
13469 +       /* Set scan bits for AHT */
13470 +       hw->phy.ops.write_reg(hw, 0x1F78, 0xF9EF);
13471 +       /* Set AHT Preset bits */
13472 +       hw->phy.ops.write_reg(hw, 0x1F79, 0x0210);
13473 +       /* Change integ_factor of channel A to 3 */
13474 +       hw->phy.ops.write_reg(hw, 0x1895, 0x0003);
13475 +       /* Change prop_factor of channels BCD to 8 */
13476 +       hw->phy.ops.write_reg(hw, 0x1796, 0x0008);
13477 +       /* Change cg_icount + enable integbp for channels BCD */
13478 +       hw->phy.ops.write_reg(hw, 0x1798, 0xD008);
13479 +       /*
13480 +        * Change cg_icount + enable integbp + change prop_factor_master
13481 +        * to 8 for channel A
13482 +        */
13483 +       hw->phy.ops.write_reg(hw, 0x1898, 0xD918);
13484 +       /* Disable AHT in Slave mode on channel A */
13485 +       hw->phy.ops.write_reg(hw, 0x187A, 0x0800);
13486 +       /*
13487 +        * Enable LPLU and disable AN to 1000 in non-D0a states,
13488 +        * Enable SPD+B2B
13489 +        */
13490 +       hw->phy.ops.write_reg(hw, 0x0019, 0x008D);
13491 +       /* Enable restart AN on an1000_dis change */
13492 +       hw->phy.ops.write_reg(hw, 0x001B, 0x2080);
13493 +       /* Enable wh_fifo read clock in 10/100 modes */
13494 +       hw->phy.ops.write_reg(hw, 0x0014, 0x0045);
13495 +       /* Restart AN, Speed selection is 1000 */
13496 +       hw->phy.ops.write_reg(hw, 0x0000, 0x1340);
13497 +
13498 +       return E1000_SUCCESS;
13499 +}
13500 +
13501 +/**
13502 + *  e1000_get_phy_type_from_id - Get PHY type from id
13503 + *  @phy_id: phy_id read from the phy
13504 + *
13505 + *  Returns the phy type from the id.
13506 + **/
13507 +enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id)
13508 +{
13509 +       enum e1000_phy_type phy_type = e1000_phy_unknown;
13510 +
13511 +       switch (phy_id) {
13512 +       case M88E1000_I_PHY_ID:
13513 +       case M88E1000_E_PHY_ID:
13514 +       case M88E1111_I_PHY_ID:
13515 +       case M88E1011_I_PHY_ID:
13516 +               phy_type = e1000_phy_m88;
13517 +               break;
13518 +       case IGP01E1000_I_PHY_ID: /* IGP 1 & 2 share this */
13519 +               phy_type = e1000_phy_igp_2;
13520 +               break;
13521 +       case GG82563_E_PHY_ID:
13522 +               phy_type = e1000_phy_gg82563;
13523 +               break;
13524 +       case IGP03E1000_E_PHY_ID:
13525 +               phy_type = e1000_phy_igp_3;
13526 +               break;
13527 +       case IFE_E_PHY_ID:
13528 +       case IFE_PLUS_E_PHY_ID:
13529 +       case IFE_C_E_PHY_ID:
13530 +               phy_type = e1000_phy_ife;
13531 +               break;
13532 +       default:
13533 +               phy_type = e1000_phy_unknown;
13534 +               break;
13535 +       }
13536 +       return phy_type;
13537 +}
13538 +
13539 +/**
13540 + * e1000_power_up_phy_copper - Restore copper link in case of PHY power down
13541 + * @hw: pointer to the HW structure
13542 + *
13543 + * In the case of a PHY power down to save power, or to turn off link during a
13544 + * driver unload, or wake on lan is not enabled, restore the link to previous
13545 + * settings.
13546 + **/
13547 +void e1000_power_up_phy_copper(struct e1000_hw *hw)
13548 +{
13549 +       u16 mii_reg = 0;
13550 +
13551 +       /* The PHY will retain its settings across a power down/up cycle */
13552 +       hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg);
13553 +       mii_reg &= ~MII_CR_POWER_DOWN;
13554 +       hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg);
13555 +}
13556 +
13557 +/**
13558 + * e1000_power_down_phy_copper - Restore copper link in case of PHY power down
13559 + * @hw: pointer to the HW structure
13560 + *
13561 + * In the case of a PHY power down to save power, or to turn off link during a
13562 + * driver unload, or wake on lan is not enabled, restore the link to previous
13563 + * settings.
13564 + **/
13565 +void e1000_power_down_phy_copper(struct e1000_hw *hw)
13566 +{
13567 +       u16 mii_reg = 0;
13568 +
13569 +       /* The PHY will retain its settings across a power down/up cycle */
13570 +       hw->phy.ops.read_reg(hw, PHY_CONTROL, &mii_reg);
13571 +       mii_reg |= MII_CR_POWER_DOWN;
13572 +       hw->phy.ops.write_reg(hw, PHY_CONTROL, mii_reg);
13573 +       msec_delay(1);
13574 +}
13575 diff -Nru vanilla/drivers/net/igb/e1000_phy.h linux-i686-2.6.22/drivers/net/igb/e1000_phy.h
13576 --- vanilla/drivers/net/igb/e1000_phy.h 1969-12-31 19:00:00.000000000 -0500
13577 +++ linux-i686-2.6.22/drivers/net/igb/e1000_phy.h       2009-07-16 19:25:22.000000000 -0400
13578 @@ -0,0 +1,152 @@
13579 +/*******************************************************************************
13580 +
13581 +  Intel(R) Gigabit Ethernet Linux driver
13582 +  Copyright(c) 2007-2008 Intel Corporation.
13583 +
13584 +  This program is free software; you can redistribute it and/or modify it
13585 +  under the terms and conditions of the GNU General Public License,
13586 +  version 2, as published by the Free Software Foundation.
13587 +
13588 +  This program is distributed in the hope it will be useful, but WITHOUT
13589 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13590 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13591 +  more details.
13592 +
13593 +  You should have received a copy of the GNU General Public License along with
13594 +  this program; if not, write to the Free Software Foundation, Inc.,
13595 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
13596 +
13597 +  The full GNU General Public License is included in this distribution in
13598 +  the file called "COPYING".
13599 +
13600 +  Contact Information:
13601 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
13602 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
13603 +
13604 +*******************************************************************************/
13605 +
13606 +#ifndef _E1000_PHY_H_
13607 +#define _E1000_PHY_H_
13608 +
13609 +void e1000_init_phy_ops_generic(struct e1000_hw *hw);
13610 +s32  e1000_check_downshift_generic(struct e1000_hw *hw);
13611 +s32  e1000_check_polarity_m88(struct e1000_hw *hw);
13612 +s32  e1000_check_polarity_igp(struct e1000_hw *hw);
13613 +s32  e1000_check_reset_block_generic(struct e1000_hw *hw);
13614 +s32  e1000_copper_link_autoneg(struct e1000_hw *hw);
13615 +s32  e1000_copper_link_setup_igp(struct e1000_hw *hw);
13616 +s32  e1000_copper_link_setup_m88(struct e1000_hw *hw);
13617 +s32  e1000_phy_force_speed_duplex_igp(struct e1000_hw *hw);
13618 +s32  e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw);
13619 +s32  e1000_get_cable_length_m88(struct e1000_hw *hw);
13620 +s32  e1000_get_cable_length_igp_2(struct e1000_hw *hw);
13621 +s32  e1000_get_cfg_done_generic(struct e1000_hw *hw);
13622 +s32  e1000_get_phy_id(struct e1000_hw *hw);
13623 +s32  e1000_get_phy_info_igp(struct e1000_hw *hw);
13624 +s32  e1000_get_phy_info_m88(struct e1000_hw *hw);
13625 +s32  e1000_phy_sw_reset_generic(struct e1000_hw *hw);
13626 +void e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
13627 +s32  e1000_phy_hw_reset_generic(struct e1000_hw *hw);
13628 +s32  e1000_phy_reset_dsp_generic(struct e1000_hw *hw);
13629 +s32  e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data);
13630 +s32  e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
13631 +s32  e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
13632 +s32  e1000_set_d3_lplu_state_generic(struct e1000_hw *hw, bool active);
13633 +s32  e1000_setup_copper_link_generic(struct e1000_hw *hw);
13634 +s32  e1000_wait_autoneg_generic(struct e1000_hw *hw);
13635 +s32  e1000_write_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 data);
13636 +s32  e1000_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
13637 +s32  e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data);
13638 +s32  e1000_phy_reset_dsp(struct e1000_hw *hw);
13639 +s32  e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
13640 +                                u32 usec_interval, bool *success);
13641 +s32  e1000_phy_init_script_igp3(struct e1000_hw *hw);
13642 +enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id);
13643 +void e1000_power_up_phy_copper(struct e1000_hw *hw);
13644 +void e1000_power_down_phy_copper(struct e1000_hw *hw);
13645 +s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
13646 +s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
13647 +
13648 +#define E1000_MAX_PHY_ADDR                4
13649 +
13650 +/* IGP01E1000 Specific Registers */
13651 +#define IGP01E1000_PHY_PORT_CONFIG        0x10 /* Port Config */
13652 +#define IGP01E1000_PHY_PORT_STATUS        0x11 /* Status */
13653 +#define IGP01E1000_PHY_PORT_CTRL          0x12 /* Control */
13654 +#define IGP01E1000_PHY_LINK_HEALTH        0x13 /* PHY Link Health */
13655 +#define IGP01E1000_GMII_FIFO              0x14 /* GMII FIFO */
13656 +#define IGP01E1000_PHY_CHANNEL_QUALITY    0x15 /* PHY Channel Quality */
13657 +#define IGP02E1000_PHY_POWER_MGMT         0x19 /* Power Management */
13658 +#define IGP01E1000_PHY_PAGE_SELECT        0x1F /* Page Select */
13659 +#define BM_PHY_PAGE_SELECT                22   /* Page Select for BM */
13660 +#define IGP_PAGE_SHIFT                    5
13661 +#define PHY_REG_MASK                      0x1F
13662 +
13663 +#define IGP01E1000_PHY_PCS_INIT_REG       0x00B4
13664 +#define IGP01E1000_PHY_POLARITY_MASK      0x0078
13665 +
13666 +#define IGP01E1000_PSCR_AUTO_MDIX         0x1000
13667 +#define IGP01E1000_PSCR_FORCE_MDI_MDIX    0x2000 /* 0=MDI, 1=MDIX */
13668 +
13669 +#define IGP01E1000_PSCFR_SMART_SPEED      0x0080
13670 +
13671 +/* Enable flexible speed on link-up */
13672 +#define IGP01E1000_GMII_FLEX_SPD          0x0010
13673 +#define IGP01E1000_GMII_SPD               0x0020 /* Enable SPD */
13674 +
13675 +#define IGP02E1000_PM_SPD                 0x0001 /* Smart Power Down */
13676 +#define IGP02E1000_PM_D0_LPLU             0x0002 /* For D0a states */
13677 +#define IGP02E1000_PM_D3_LPLU             0x0004 /* For all other states */
13678 +
13679 +#define IGP01E1000_PLHR_SS_DOWNGRADE      0x8000
13680 +
13681 +#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002
13682 +#define IGP01E1000_PSSR_MDIX              0x0008
13683 +#define IGP01E1000_PSSR_SPEED_MASK        0xC000
13684 +#define IGP01E1000_PSSR_SPEED_1000MBPS    0xC000
13685 +
13686 +#define IGP02E1000_PHY_CHANNEL_NUM        4
13687 +#define IGP02E1000_PHY_AGC_A              0x11B1
13688 +#define IGP02E1000_PHY_AGC_B              0x12B1
13689 +#define IGP02E1000_PHY_AGC_C              0x14B1
13690 +#define IGP02E1000_PHY_AGC_D              0x18B1
13691 +
13692 +#define IGP02E1000_AGC_LENGTH_SHIFT       9   /* Course - 15:13, Fine - 12:9 */
13693 +#define IGP02E1000_AGC_LENGTH_MASK        0x7F
13694 +#define IGP02E1000_AGC_RANGE              15
13695 +
13696 +#define IGP03E1000_PHY_MISC_CTRL          0x1B
13697 +#define IGP03E1000_PHY_MISC_DUPLEX_MANUAL_SET  0x1000 /* Manually Set Duplex */
13698 +
13699 +#define E1000_CABLE_LENGTH_UNDEFINED      0xFF
13700 +
13701 +#define E1000_KMRNCTRLSTA_OFFSET          0x001F0000
13702 +#define E1000_KMRNCTRLSTA_OFFSET_SHIFT    16
13703 +#define E1000_KMRNCTRLSTA_REN             0x00200000
13704 +#define E1000_KMRNCTRLSTA_DIAG_OFFSET     0x3    /* Kumeran Diagnostic */
13705 +#define E1000_KMRNCTRLSTA_DIAG_NELPBK     0x1000 /* Nearend Loopback mode */
13706 +
13707 +#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10
13708 +#define IFE_PHY_SPECIAL_CONTROL     0x11 /* 100BaseTx PHY Special Control */
13709 +#define IFE_PHY_SPECIAL_CONTROL_LED 0x1B /* PHY Special and LED Control */
13710 +#define IFE_PHY_MDIX_CONTROL        0x1C /* MDI/MDI-X Control */
13711 +
13712 +/* IFE PHY Extended Status Control */
13713 +#define IFE_PESC_POLARITY_REVERSED    0x0100
13714 +
13715 +/* IFE PHY Special Control */
13716 +#define IFE_PSC_AUTO_POLARITY_DISABLE      0x0010
13717 +#define IFE_PSC_FORCE_POLARITY             0x0020
13718 +#define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100
13719 +
13720 +/* IFE PHY Special Control and LED Control */
13721 +#define IFE_PSCL_PROBE_MODE            0x0020
13722 +#define IFE_PSCL_PROBE_LEDS_OFF        0x0006 /* Force LEDs 0 and 2 off */
13723 +#define IFE_PSCL_PROBE_LEDS_ON         0x0007 /* Force LEDs 0 and 2 on */
13724 +
13725 +/* IFE PHY MDIX Control */
13726 +#define IFE_PMC_MDIX_STATUS      0x0020 /* 1=MDI-X, 0=MDI */
13727 +#define IFE_PMC_FORCE_MDIX       0x0040 /* 1=force MDI-X, 0=force MDI */
13728 +#define IFE_PMC_AUTO_MDIX        0x0080 /* 1=enable auto MDI/MDI-X, 0=disable */
13729 +
13730 +#endif
13731 Binary files vanilla/drivers/net/igb/e1000_phy.o and linux-i686-2.6.22/drivers/net/igb/e1000_phy.o differ
13732 diff -Nru vanilla/drivers/net/igb/.e1000_phy.o.cmd linux-i686-2.6.22/drivers/net/igb/.e1000_phy.o.cmd
13733 --- vanilla/drivers/net/igb/.e1000_phy.o.cmd    1969-12-31 19:00:00.000000000 -0500
13734 +++ linux-i686-2.6.22/drivers/net/igb/.e1000_phy.o.cmd  2009-07-16 19:53:43.000000000 -0400
13735 @@ -0,0 +1,549 @@
13736 +cmd_drivers/net/igb/e1000_phy.o := gcc -m32 -Wp,-MD,drivers/net/igb/.e1000_phy.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(e1000_phy)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_e1000_phy.o drivers/net/igb/e1000_phy.c
13737 +
13738 +deps_drivers/net/igb/e1000_phy.o := \
13739 +  drivers/net/igb/e1000_phy.c \
13740 +  drivers/net/igb/e1000_api.h \
13741 +  drivers/net/igb/e1000_hw.h \
13742 +  drivers/net/igb/e1000_osdep.h \
13743 +  include/linux/pci.h \
13744 +    $(wildcard include/config/pci/msi.h) \
13745 +    $(wildcard include/config/pci.h) \
13746 +    $(wildcard include/config/ht/irq.h) \
13747 +    $(wildcard include/config/pci/domains.h) \
13748 +  include/linux/pci_regs.h \
13749 +  include/linux/mod_devicetable.h \
13750 +  include/linux/types.h \
13751 +    $(wildcard include/config/uid16.h) \
13752 +    $(wildcard include/config/lbd.h) \
13753 +    $(wildcard include/config/lsf.h) \
13754 +    $(wildcard include/config/resources/64bit.h) \
13755 +  include/linux/posix_types.h \
13756 +  include/linux/stddef.h \
13757 +  include/linux/compiler.h \
13758 +    $(wildcard include/config/enable/must/check.h) \
13759 +  include/linux/compiler-gcc4.h \
13760 +    $(wildcard include/config/forced/inlining.h) \
13761 +  include/linux/compiler-gcc.h \
13762 +  include/asm/posix_types.h \
13763 +  include/asm/types.h \
13764 +    $(wildcard include/config/highmem64g.h) \
13765 +  include/linux/ioport.h \
13766 +  include/linux/list.h \
13767 +    $(wildcard include/config/debug/list.h) \
13768 +  include/linux/poison.h \
13769 +  include/linux/prefetch.h \
13770 +  include/asm/processor.h \
13771 +    $(wildcard include/config/smp.h) \
13772 +    $(wildcard include/config/x86/ht.h) \
13773 +    $(wildcard include/config/paravirt.h) \
13774 +    $(wildcard include/config/mk8.h) \
13775 +    $(wildcard include/config/mk7.h) \
13776 +  include/asm/vm86.h \
13777 +    $(wildcard include/config/vm86.h) \
13778 +  include/asm/ptrace.h \
13779 +  include/asm/ptrace-abi.h \
13780 +  include/asm/segment.h \
13781 +  include/asm/math_emu.h \
13782 +  include/asm/sigcontext.h \
13783 +  include/asm/page.h \
13784 +    $(wildcard include/config/x86/use/3dnow.h) \
13785 +    $(wildcard include/config/x86/pae.h) \
13786 +    $(wildcard include/config/hugetlb/page.h) \
13787 +    $(wildcard include/config/highmem4g.h) \
13788 +    $(wildcard include/config/page/offset.h) \
13789 +    $(wildcard include/config/flatmem.h) \
13790 +  include/asm-generic/pgtable-nopmd.h \
13791 +  include/asm-generic/pgtable-nopud.h \
13792 +  include/asm-generic/memory_model.h \
13793 +    $(wildcard include/config/discontigmem.h) \
13794 +    $(wildcard include/config/sparsemem.h) \
13795 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
13796 +  include/asm-generic/page.h \
13797 +  include/asm/cpufeature.h \
13798 +  include/linux/bitops.h \
13799 +  include/asm/bitops.h \
13800 +  include/asm/alternative.h \
13801 +  include/asm-generic/bitops/sched.h \
13802 +  include/asm-generic/bitops/hweight.h \
13803 +  include/asm-generic/bitops/fls64.h \
13804 +  include/asm-generic/bitops/ext2-non-atomic.h \
13805 +  include/asm-generic/bitops/le.h \
13806 +  include/asm/byteorder.h \
13807 +    $(wildcard include/config/x86/bswap.h) \
13808 +  include/linux/byteorder/little_endian.h \
13809 +  include/linux/byteorder/swab.h \
13810 +  include/linux/byteorder/generic.h \
13811 +  include/asm-generic/bitops/minix.h \
13812 +  include/asm/required-features.h \
13813 +    $(wildcard include/config/x86/minimum/cpu.h) \
13814 +    $(wildcard include/config/x86/cmov.h) \
13815 +    $(wildcard include/config/x86/cmpxchg64.h) \
13816 +  include/asm/msr.h \
13817 +  include/asm/msr-index.h \
13818 +  include/asm/errno.h \
13819 +  include/asm-generic/errno.h \
13820 +  include/asm-generic/errno-base.h \
13821 +  include/linux/errno.h \
13822 +  include/asm/system.h \
13823 +    $(wildcard include/config/x86/oostore.h) \
13824 +  include/linux/kernel.h \
13825 +    $(wildcard include/config/preempt/voluntary.h) \
13826 +    $(wildcard include/config/debug/spinlock/sleep.h) \
13827 +    $(wildcard include/config/printk.h) \
13828 +    $(wildcard include/config/numa.h) \
13829 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
13830 +  include/linux/linkage.h \
13831 +  include/asm/linkage.h \
13832 +    $(wildcard include/config/x86/alignment/16.h) \
13833 +  include/linux/log2.h \
13834 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
13835 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
13836 +  include/asm/bug.h \
13837 +    $(wildcard include/config/bug.h) \
13838 +    $(wildcard include/config/debug/bugverbose.h) \
13839 +  include/asm-generic/bug.h \
13840 +    $(wildcard include/config/generic/bug.h) \
13841 +  include/asm/cmpxchg.h \
13842 +    $(wildcard include/config/x86/cmpxchg.h) \
13843 +  include/linux/irqflags.h \
13844 +    $(wildcard include/config/trace/irqflags.h) \
13845 +    $(wildcard include/config/trace/irqflags/support.h) \
13846 +    $(wildcard include/config/x86.h) \
13847 +  include/asm/irqflags.h \
13848 +  include/asm/processor-flags.h \
13849 +  include/linux/cache.h \
13850 +  include/asm/cache.h \
13851 +    $(wildcard include/config/x86/l1/cache/shift.h) \
13852 +  include/linux/threads.h \
13853 +    $(wildcard include/config/nr/cpus.h) \
13854 +    $(wildcard include/config/base/small.h) \
13855 +  include/asm/percpu.h \
13856 +  include/linux/cpumask.h \
13857 +    $(wildcard include/config/hotplug/cpu.h) \
13858 +  include/linux/bitmap.h \
13859 +  include/linux/string.h \
13860 +  include/asm/string.h \
13861 +  include/linux/init.h \
13862 +    $(wildcard include/config/modules.h) \
13863 +    $(wildcard include/config/hotplug.h) \
13864 +    $(wildcard include/config/memory/hotplug.h) \
13865 +    $(wildcard include/config/acpi/hotplug/memory.h) \
13866 +  include/asm/atomic.h \
13867 +    $(wildcard include/config/m386.h) \
13868 +  include/asm-generic/atomic.h \
13869 +  include/linux/device.h \
13870 +    $(wildcard include/config/debug/devres.h) \
13871 +  include/linux/kobject.h \
13872 +  include/linux/sysfs.h \
13873 +    $(wildcard include/config/sysfs.h) \
13874 +  include/linux/spinlock.h \
13875 +    $(wildcard include/config/debug/spinlock.h) \
13876 +    $(wildcard include/config/preempt.h) \
13877 +    $(wildcard include/config/debug/lock/alloc.h) \
13878 +  include/linux/preempt.h \
13879 +    $(wildcard include/config/debug/preempt.h) \
13880 +  include/linux/thread_info.h \
13881 +  include/asm/thread_info.h \
13882 +    $(wildcard include/config/4kstacks.h) \
13883 +    $(wildcard include/config/debug/stack/usage.h) \
13884 +  include/linux/stringify.h \
13885 +  include/linux/bottom_half.h \
13886 +  include/linux/spinlock_types.h \
13887 +  include/linux/lockdep.h \
13888 +    $(wildcard include/config/lockdep.h) \
13889 +    $(wildcard include/config/generic/hardirqs.h) \
13890 +    $(wildcard include/config/prove/locking.h) \
13891 +  include/asm/spinlock_types.h \
13892 +  include/asm/spinlock.h \
13893 +    $(wildcard include/config/x86/ppro/fence.h) \
13894 +  include/asm/rwlock.h \
13895 +  include/linux/spinlock_api_smp.h \
13896 +  include/linux/kref.h \
13897 +  include/linux/wait.h \
13898 +  include/asm/current.h \
13899 +  include/linux/klist.h \
13900 +  include/linux/completion.h \
13901 +  include/linux/module.h \
13902 +    $(wildcard include/config/modversions.h) \
13903 +    $(wildcard include/config/unused/symbols.h) \
13904 +    $(wildcard include/config/module/unload.h) \
13905 +    $(wildcard include/config/kallsyms.h) \
13906 +  include/linux/stat.h \
13907 +  include/asm/stat.h \
13908 +  include/linux/time.h \
13909 +  include/linux/seqlock.h \
13910 +  include/linux/vs_time.h \
13911 +    $(wildcard include/config/vserver/vtime.h) \
13912 +  include/linux/kmod.h \
13913 +    $(wildcard include/config/kmod.h) \
13914 +  include/linux/elf.h \
13915 +  include/linux/auxvec.h \
13916 +  include/asm/auxvec.h \
13917 +  include/linux/elf-em.h \
13918 +  include/asm/elf.h \
13919 +  include/asm/user.h \
13920 +  include/asm/desc.h \
13921 +  include/asm/ldt.h \
13922 +  include/linux/smp.h \
13923 +  include/asm/smp.h \
13924 +    $(wildcard include/config/x86/local/apic.h) \
13925 +    $(wildcard include/config/x86/io/apic.h) \
13926 +  include/asm/mpspec.h \
13927 +    $(wildcard include/config/acpi.h) \
13928 +  include/asm/mpspec_def.h \
13929 +  include/asm-i386/mach-generic/mach_mpspec.h \
13930 +  include/asm/apic.h \
13931 +    $(wildcard include/config/x86/good/apic.h) \
13932 +  include/linux/pm.h \
13933 +    $(wildcard include/config/pm.h) \
13934 +  include/linux/delay.h \
13935 +  include/asm/delay.h \
13936 +  include/asm/fixmap.h \
13937 +    $(wildcard include/config/highmem.h) \
13938 +    $(wildcard include/config/x86/visws/apic.h) \
13939 +    $(wildcard include/config/x86/f00f/bug.h) \
13940 +    $(wildcard include/config/x86/cyclone/timer.h) \
13941 +    $(wildcard include/config/pci/mmconfig.h) \
13942 +  include/asm/acpi.h \
13943 +    $(wildcard include/config/acpi/sleep.h) \
13944 +  include/acpi/pdc_intel.h \
13945 +  include/asm/apicdef.h \
13946 +  include/asm/kmap_types.h \
13947 +    $(wildcard include/config/debug/highmem.h) \
13948 +  include/asm/io_apic.h \
13949 +  include/asm-i386/mach-generic/mach_apicdef.h \
13950 +  include/asm/genapic.h \
13951 +  include/linux/percpu.h \
13952 +  include/linux/slab.h \
13953 +    $(wildcard include/config/slab/debug.h) \
13954 +    $(wildcard include/config/slab.h) \
13955 +    $(wildcard include/config/slub.h) \
13956 +    $(wildcard include/config/debug/slab.h) \
13957 +  include/linux/gfp.h \
13958 +    $(wildcard include/config/zone/dma.h) \
13959 +    $(wildcard include/config/zone/dma32.h) \
13960 +  include/linux/mmzone.h \
13961 +    $(wildcard include/config/force/max/zoneorder.h) \
13962 +    $(wildcard include/config/arch/populates/node/map.h) \
13963 +    $(wildcard include/config/flat/node/mem/map.h) \
13964 +    $(wildcard include/config/have/memory/present.h) \
13965 +    $(wildcard include/config/need/node/memmap/size.h) \
13966 +    $(wildcard include/config/need/multiple/nodes.h) \
13967 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
13968 +    $(wildcard include/config/sparsemem/extreme.h) \
13969 +    $(wildcard include/config/nodes/span/other/nodes.h) \
13970 +    $(wildcard include/config/holes/in/zone.h) \
13971 +  include/linux/numa.h \
13972 +    $(wildcard include/config/nodes/shift.h) \
13973 +  include/linux/nodemask.h \
13974 +  include/linux/memory_hotplug.h \
13975 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
13976 +  include/linux/notifier.h \
13977 +  include/linux/mutex.h \
13978 +    $(wildcard include/config/debug/mutexes.h) \
13979 +    $(wildcard include/config/chopstix.h) \
13980 +  include/linux/rwsem.h \
13981 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
13982 +  include/asm/rwsem.h \
13983 +  include/linux/srcu.h \
13984 +  include/linux/topology.h \
13985 +    $(wildcard include/config/sched/smt.h) \
13986 +    $(wildcard include/config/sched/mc.h) \
13987 +  include/asm/topology.h \
13988 +  include/asm-generic/topology.h \
13989 +  include/linux/slab_def.h \
13990 +  include/linux/kmalloc_sizes.h \
13991 +  include/asm/mmu.h \
13992 +  include/asm/semaphore.h \
13993 +  include/linux/moduleparam.h \
13994 +  include/asm/local.h \
13995 +  include/asm/module.h \
13996 +    $(wildcard include/config/m486.h) \
13997 +    $(wildcard include/config/m586.h) \
13998 +    $(wildcard include/config/m586tsc.h) \
13999 +    $(wildcard include/config/m586mmx.h) \
14000 +    $(wildcard include/config/mcore2.h) \
14001 +    $(wildcard include/config/m686.h) \
14002 +    $(wildcard include/config/mpentiumii.h) \
14003 +    $(wildcard include/config/mpentiumiii.h) \
14004 +    $(wildcard include/config/mpentiumm.h) \
14005 +    $(wildcard include/config/mpentium4.h) \
14006 +    $(wildcard include/config/mk6.h) \
14007 +    $(wildcard include/config/x86/elan.h) \
14008 +    $(wildcard include/config/mcrusoe.h) \
14009 +    $(wildcard include/config/mefficeon.h) \
14010 +    $(wildcard include/config/mwinchipc6.h) \
14011 +    $(wildcard include/config/mwinchip2.h) \
14012 +    $(wildcard include/config/mwinchip3d.h) \
14013 +    $(wildcard include/config/mcyrixiii.h) \
14014 +    $(wildcard include/config/mviac3/2.h) \
14015 +    $(wildcard include/config/mviac7.h) \
14016 +    $(wildcard include/config/mgeodegx1.h) \
14017 +    $(wildcard include/config/mgeode/lx.h) \
14018 +  include/asm/device.h \
14019 +  include/linux/pci_ids.h \
14020 +  include/linux/dmapool.h \
14021 +  include/asm/io.h \
14022 +    $(wildcard include/config/x86/numaq.h) \
14023 +  include/asm-generic/iomap.h \
14024 +  include/linux/vmalloc.h \
14025 +  include/asm/scatterlist.h \
14026 +  include/asm/pci.h \
14027 +  include/linux/mm.h \
14028 +    $(wildcard include/config/sysctl.h) \
14029 +    $(wildcard include/config/mmu.h) \
14030 +    $(wildcard include/config/stack/growsup.h) \
14031 +    $(wildcard include/config/debug/vm.h) \
14032 +    $(wildcard include/config/shmem.h) \
14033 +    $(wildcard include/config/split/ptlock/cpus.h) \
14034 +    $(wildcard include/config/ia64.h) \
14035 +    $(wildcard include/config/proc/fs.h) \
14036 +    $(wildcard include/config/debug/pagealloc.h) \
14037 +  include/linux/capability.h \
14038 +  include/linux/rbtree.h \
14039 +  include/linux/prio_tree.h \
14040 +  include/linux/fs.h \
14041 +    $(wildcard include/config/dnotify.h) \
14042 +    $(wildcard include/config/vserver/cowbl.h) \
14043 +    $(wildcard include/config/quota.h) \
14044 +    $(wildcard include/config/inotify.h) \
14045 +    $(wildcard include/config/security.h) \
14046 +    $(wildcard include/config/epoll.h) \
14047 +    $(wildcard include/config/auditsyscall.h) \
14048 +    $(wildcard include/config/block.h) \
14049 +    $(wildcard include/config/fs/xip.h) \
14050 +    $(wildcard include/config/migration.h) \
14051 +  include/linux/limits.h \
14052 +  include/linux/ioctl.h \
14053 +  include/asm/ioctl.h \
14054 +  include/asm-generic/ioctl.h \
14055 +  include/linux/kdev_t.h \
14056 +  include/linux/dcache.h \
14057 +    $(wildcard include/config/profiling.h) \
14058 +  include/linux/rcupdate.h \
14059 +  include/linux/namei.h \
14060 +  include/linux/radix-tree.h \
14061 +  include/linux/pid.h \
14062 +  include/linux/quota.h \
14063 +  include/linux/dqblk_xfs.h \
14064 +  include/linux/dqblk_v1.h \
14065 +  include/linux/dqblk_v2.h \
14066 +  include/linux/nfs_fs_i.h \
14067 +  include/linux/nfs.h \
14068 +  include/linux/sunrpc/msg_prot.h \
14069 +  include/linux/fcntl.h \
14070 +  include/asm/fcntl.h \
14071 +  include/asm-generic/fcntl.h \
14072 +    $(wildcard include/config/64bit.h) \
14073 +  include/linux/err.h \
14074 +  include/linux/debug_locks.h \
14075 +    $(wildcard include/config/debug/locking/api/selftests.h) \
14076 +  include/linux/backing-dev.h \
14077 +  include/linux/mm_types.h \
14078 +  include/asm/pgtable.h \
14079 +    $(wildcard include/config/highpte.h) \
14080 +  include/asm/paravirt.h \
14081 +  include/asm/pgtable-2level-defs.h \
14082 +  include/asm/pgtable-2level.h \
14083 +  include/asm-generic/pgtable.h \
14084 +  include/linux/page-flags.h \
14085 +    $(wildcard include/config/s390.h) \
14086 +    $(wildcard include/config/swap.h) \
14087 +  include/linux/vmstat.h \
14088 +    $(wildcard include/config/vm/event/counters.h) \
14089 +  include/asm-generic/pci-dma-compat.h \
14090 +  include/linux/dma-mapping.h \
14091 +  include/asm/dma-mapping.h \
14092 +  include/asm-generic/pci.h \
14093 +  include/linux/interrupt.h \
14094 +    $(wildcard include/config/high/res/timers.h) \
14095 +    $(wildcard include/config/generic/irq/probe.h) \
14096 +  include/linux/irqreturn.h \
14097 +  include/linux/hardirq.h \
14098 +    $(wildcard include/config/preempt/bkl.h) \
14099 +    $(wildcard include/config/virt/cpu/accounting.h) \
14100 +  include/linux/smp_lock.h \
14101 +    $(wildcard include/config/lock/kernel.h) \
14102 +  include/linux/sched.h \
14103 +    $(wildcard include/config/no/hz.h) \
14104 +    $(wildcard include/config/detect/softlockup.h) \
14105 +    $(wildcard include/config/keys.h) \
14106 +    $(wildcard include/config/bsd/process/acct.h) \
14107 +    $(wildcard include/config/taskstats.h) \
14108 +    $(wildcard include/config/inotify/user.h) \
14109 +    $(wildcard include/config/schedstats.h) \
14110 +    $(wildcard include/config/task/delay/acct.h) \
14111 +    $(wildcard include/config/blk/dev/io/trace.h) \
14112 +    $(wildcard include/config/cc/stackprotector.h) \
14113 +    $(wildcard include/config/sysvipc.h) \
14114 +    $(wildcard include/config/rt/mutexes.h) \
14115 +    $(wildcard include/config/task/xacct.h) \
14116 +    $(wildcard include/config/cpusets.h) \
14117 +    $(wildcard include/config/compat.h) \
14118 +    $(wildcard include/config/fault/injection.h) \
14119 +  include/asm/param.h \
14120 +    $(wildcard include/config/hz.h) \
14121 +  include/linux/timex.h \
14122 +    $(wildcard include/config/time/interpolation.h) \
14123 +  include/asm/timex.h \
14124 +  include/asm/tsc.h \
14125 +    $(wildcard include/config/x86/tsc.h) \
14126 +    $(wildcard include/config/x86/generic.h) \
14127 +  include/linux/jiffies.h \
14128 +  include/linux/calc64.h \
14129 +  include/asm/div64.h \
14130 +  include/asm/cputime.h \
14131 +  include/asm-generic/cputime.h \
14132 +  include/linux/sem.h \
14133 +  include/linux/ipc.h \
14134 +    $(wildcard include/config/ipc/ns.h) \
14135 +  include/asm/ipcbuf.h \
14136 +  include/asm/sembuf.h \
14137 +  include/linux/signal.h \
14138 +  include/asm/signal.h \
14139 +  include/asm-generic/signal.h \
14140 +  include/asm/siginfo.h \
14141 +  include/asm-generic/siginfo.h \
14142 +  include/linux/securebits.h \
14143 +  include/linux/fs_struct.h \
14144 +  include/linux/seccomp.h \
14145 +    $(wildcard include/config/seccomp.h) \
14146 +  include/linux/futex.h \
14147 +    $(wildcard include/config/futex.h) \
14148 +  include/linux/rtmutex.h \
14149 +    $(wildcard include/config/debug/rt/mutexes.h) \
14150 +  include/linux/plist.h \
14151 +    $(wildcard include/config/debug/pi/list.h) \
14152 +  include/linux/param.h \
14153 +  include/linux/resource.h \
14154 +  include/asm/resource.h \
14155 +  include/asm-generic/resource.h \
14156 +  include/linux/timer.h \
14157 +    $(wildcard include/config/timer/stats.h) \
14158 +  include/linux/ktime.h \
14159 +    $(wildcard include/config/ktime/scalar.h) \
14160 +  include/linux/hrtimer.h \
14161 +  include/linux/task_io_accounting.h \
14162 +    $(wildcard include/config/task/io/accounting.h) \
14163 +  include/linux/aio.h \
14164 +  include/linux/workqueue.h \
14165 +  include/linux/aio_abi.h \
14166 +  include/linux/uio.h \
14167 +  include/asm/hardirq.h \
14168 +  include/linux/irq.h \
14169 +    $(wildcard include/config/irq/per/cpu.h) \
14170 +    $(wildcard include/config/irq/release/method.h) \
14171 +    $(wildcard include/config/generic/pending/irq.h) \
14172 +    $(wildcard include/config/irqbalance.h) \
14173 +    $(wildcard include/config/auto/irq/affinity.h) \
14174 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
14175 +  include/asm/irq.h \
14176 +  include/asm-i386/mach-default/irq_vectors.h \
14177 +  include/asm-i386/mach-default/irq_vectors_limits.h \
14178 +  include/asm/irq_regs.h \
14179 +  include/asm/hw_irq.h \
14180 +  include/linux/profile.h \
14181 +  include/asm/sections.h \
14182 +  include/asm-generic/sections.h \
14183 +  include/linux/irq_cpustat.h \
14184 +  include/linux/if_ether.h \
14185 +  include/linux/skbuff.h \
14186 +    $(wildcard include/config/nf/conntrack.h) \
14187 +    $(wildcard include/config/bridge/netfilter.h) \
14188 +    $(wildcard include/config/vlan/8021q.h) \
14189 +    $(wildcard include/config/net/sched.h) \
14190 +    $(wildcard include/config/net/cls/act.h) \
14191 +    $(wildcard include/config/net/dma.h) \
14192 +    $(wildcard include/config/network/secmark.h) \
14193 +  include/linux/net.h \
14194 +  include/asm/socket.h \
14195 +  include/asm/sockios.h \
14196 +  include/linux/random.h \
14197 +  include/linux/sysctl.h \
14198 +    $(wildcard include/config/icmp/ipod.h) \
14199 +    $(wildcard include/config/web100/net100.h) \
14200 +    $(wildcard include/config/web100/stats.h) \
14201 +  include/linux/textsearch.h \
14202 +  include/net/checksum.h \
14203 +  include/asm/uaccess.h \
14204 +    $(wildcard include/config/x86/intel/usercopy.h) \
14205 +    $(wildcard include/config/x86/wp/works/ok.h) \
14206 +  include/asm/checksum.h \
14207 +  include/linux/in6.h \
14208 +  include/linux/dmaengine.h \
14209 +    $(wildcard include/config/dma/engine.h) \
14210 +  drivers/net/igb/kcompat.h \
14211 +    $(wildcard include/config/e1000/napi.h) \
14212 +    $(wildcard include/config/e1000e/napi.h) \
14213 +    $(wildcard include/config/ixgb/napi.h) \
14214 +    $(wildcard include/config/e1000/disable/packet/split.h) \
14215 +    $(wildcard include/config/igb/disable/packet/split.h) \
14216 +    $(wildcard include/config/net/poll/controller.h) \
14217 +    $(wildcard include/config/space/len.h) \
14218 +    $(wildcard include/config/netpoll.h) \
14219 +    $(wildcard include/config/netdevices/multiqueue.h) \
14220 +  include/linux/version.h \
14221 +  include/linux/netdevice.h \
14222 +    $(wildcard include/config/ax25.h) \
14223 +    $(wildcard include/config/tr.h) \
14224 +    $(wildcard include/config/net/ipip.h) \
14225 +    $(wildcard include/config/net/ipgre.h) \
14226 +    $(wildcard include/config/ipv6/sit.h) \
14227 +    $(wildcard include/config/ipv6/tunnel.h) \
14228 +    $(wildcard include/config/wireless/ext.h) \
14229 +    $(wildcard include/config/netpoll/trap.h) \
14230 +  include/linux/if.h \
14231 +  include/linux/socket.h \
14232 +  include/linux/sockios.h \
14233 +  include/linux/hdlc/ioctl.h \
14234 +  include/linux/if_packet.h \
14235 +  include/linux/etherdevice.h \
14236 +  include/linux/in.h \
14237 +  include/linux/ip.h \
14238 +  include/linux/udp.h \
14239 +  include/net/inet_sock.h \
14240 +    $(wildcard include/config/ipv6.h) \
14241 +  include/linux/jhash.h \
14242 +  include/net/flow.h \
14243 +    $(wildcard include/config/ipv6/mip6.h) \
14244 +  include/net/sock.h \
14245 +    $(wildcard include/config/security/network.h) \
14246 +  include/linux/security.h \
14247 +    $(wildcard include/config/security/network/xfrm.h) \
14248 +  include/linux/binfmts.h \
14249 +  include/linux/shm.h \
14250 +  include/asm/shmparam.h \
14251 +  include/asm/shmbuf.h \
14252 +  include/linux/msg.h \
14253 +  include/asm/msgbuf.h \
14254 +  include/linux/key.h \
14255 +  include/linux/xfrm.h \
14256 +  include/linux/filter.h \
14257 +  include/net/dst.h \
14258 +    $(wildcard include/config/net/cls/route.h) \
14259 +    $(wildcard include/config/xfrm.h) \
14260 +  include/linux/rtnetlink.h \
14261 +  include/linux/netlink.h \
14262 +  include/linux/if_link.h \
14263 +  include/linux/if_addr.h \
14264 +  include/linux/neighbour.h \
14265 +  include/net/neighbour.h \
14266 +  include/linux/seq_file.h \
14267 +  include/net/rtnetlink.h \
14268 +  include/net/netlink.h \
14269 +  include/net/request_sock.h \
14270 +  include/linux/mii.h \
14271 +  include/linux/latency.h \
14272 +  drivers/net/igb/e1000_regs.h \
14273 +  drivers/net/igb/e1000_defines.h \
14274 +    $(wildcard include/config/res.h) \
14275 +    $(wildcard include/config/fault.h) \
14276 +  drivers/net/igb/e1000_mac.h \
14277 +  drivers/net/igb/e1000_phy.h \
14278 +  drivers/net/igb/e1000_nvm.h \
14279 +  drivers/net/igb/e1000_manage.h \
14280 +  drivers/net/igb/e1000_82575.h \
14281 +
14282 +drivers/net/igb/e1000_phy.o: $(deps_drivers/net/igb/e1000_phy.o)
14283 +
14284 +$(deps_drivers/net/igb/e1000_phy.o):
14285 diff -Nru vanilla/drivers/net/igb/e1000_regs.h linux-i686-2.6.22/drivers/net/igb/e1000_regs.h
14286 --- vanilla/drivers/net/igb/e1000_regs.h        1969-12-31 19:00:00.000000000 -0500
14287 +++ linux-i686-2.6.22/drivers/net/igb/e1000_regs.h      2009-07-16 19:25:22.000000000 -0400
14288 @@ -0,0 +1,441 @@
14289 +/*******************************************************************************
14290 +
14291 +  Intel(R) Gigabit Ethernet Linux driver
14292 +  Copyright(c) 2007-2008 Intel Corporation.
14293 +
14294 +  This program is free software; you can redistribute it and/or modify it
14295 +  under the terms and conditions of the GNU General Public License,
14296 +  version 2, as published by the Free Software Foundation.
14297 +
14298 +  This program is distributed in the hope it will be useful, but WITHOUT
14299 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14300 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14301 +  more details.
14302 +
14303 +  You should have received a copy of the GNU General Public License along with
14304 +  this program; if not, write to the Free Software Foundation, Inc.,
14305 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
14306 +
14307 +  The full GNU General Public License is included in this distribution in
14308 +  the file called "COPYING".
14309 +
14310 +  Contact Information:
14311 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
14312 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
14313 +
14314 +*******************************************************************************/
14315 +
14316 +#ifndef _E1000_REGS_H_
14317 +#define _E1000_REGS_H_
14318 +
14319 +#define E1000_CTRL     0x00000  /* Device Control - RW */
14320 +#define E1000_CTRL_DUP 0x00004  /* Device Control Duplicate (Shadow) - RW */
14321 +#define E1000_STATUS   0x00008  /* Device Status - RO */
14322 +#define E1000_EECD     0x00010  /* EEPROM/Flash Control - RW */
14323 +#define E1000_EERD     0x00014  /* EEPROM Read - RW */
14324 +#define E1000_CTRL_EXT 0x00018  /* Extended Device Control - RW */
14325 +#define E1000_FLA      0x0001C  /* Flash Access - RW */
14326 +#define E1000_MDIC     0x00020  /* MDI Control - RW */
14327 +#define E1000_SCTL     0x00024  /* SerDes Control - RW */
14328 +#define E1000_FCAL     0x00028  /* Flow Control Address Low - RW */
14329 +#define E1000_FCAH     0x0002C  /* Flow Control Address High -RW */
14330 +#define E1000_FEXTNVM  0x00028  /* Future Extended NVM - RW */
14331 +#define E1000_FCT      0x00030  /* Flow Control Type - RW */
14332 +#define E1000_CONNSW   0x00034  /* Copper/Fiber switch control - RW */
14333 +#define E1000_VET      0x00038  /* VLAN Ether Type - RW */
14334 +#define E1000_ICR      0x000C0  /* Interrupt Cause Read - R/clr */
14335 +#define E1000_ITR      0x000C4  /* Interrupt Throttling Rate - RW */
14336 +#define E1000_ICS      0x000C8  /* Interrupt Cause Set - WO */
14337 +#define E1000_IMS      0x000D0  /* Interrupt Mask Set - RW */
14338 +#define E1000_IMC      0x000D8  /* Interrupt Mask Clear - WO */
14339 +#define E1000_IAM      0x000E0  /* Interrupt Acknowledge Auto Mask */
14340 +#define E1000_RCTL     0x00100  /* Rx Control - RW */
14341 +#define E1000_FCTTV    0x00170  /* Flow Control Transmit Timer Value - RW */
14342 +#define E1000_TXCW     0x00178  /* Tx Configuration Word - RW */
14343 +#define E1000_RXCW     0x00180  /* Rx Configuration Word - RO */
14344 +#define E1000_EICR     0x01580  /* Ext. Interrupt Cause Read - R/clr */
14345 +#define E1000_EITR(_n) (0x01680 + (0x4 * (_n)))
14346 +#define E1000_EICS     0x01520  /* Ext. Interrupt Cause Set - W0 */
14347 +#define E1000_EIMS     0x01524  /* Ext. Interrupt Mask Set/Read - RW */
14348 +#define E1000_EIMC     0x01528  /* Ext. Interrupt Mask Clear - WO */
14349 +#define E1000_EIAC     0x0152C  /* Ext. Interrupt Auto Clear - RW */
14350 +#define E1000_EIAM     0x01530  /* Ext. Interrupt Ack Auto Clear Mask - RW */
14351 +#define E1000_GPIE     0x01514  /* General Purpose Interrupt Enable - RW */
14352 +#define E1000_IVAR0    0x01700  /* Interrupt Vector Allocation (array) - RW */
14353 +#define E1000_IVAR_MISC 0x01740 /* IVAR for "other" causes - RW */
14354 +#define E1000_TCTL     0x00400  /* Tx Control - RW */
14355 +#define E1000_TCTL_EXT 0x00404  /* Extended Tx Control - RW */
14356 +#define E1000_TIPG     0x00410  /* Tx Inter-packet gap -RW */
14357 +#define E1000_TBT      0x00448  /* Tx Burst Timer - RW */
14358 +#define E1000_AIT      0x00458  /* Adaptive Interframe Spacing Throttle - RW */
14359 +#define E1000_LEDCTL   0x00E00  /* LED Control - RW */
14360 +#define E1000_EXTCNF_CTRL  0x00F00  /* Extended Configuration Control */
14361 +#define E1000_EXTCNF_SIZE  0x00F08  /* Extended Configuration Size */
14362 +#define E1000_PHY_CTRL     0x00F10  /* PHY Control Register in CSR */
14363 +#define E1000_PBA      0x01000  /* Packet Buffer Allocation - RW */
14364 +#define E1000_PBS      0x01008  /* Packet Buffer Size */
14365 +#define E1000_EEMNGCTL 0x01010  /* MNG EEprom Control */
14366 +#define E1000_EEARBC   0x01024  /* EEPROM Auto Read Bus Control */
14367 +#define E1000_FLASHT   0x01028  /* FLASH Timer Register */
14368 +#define E1000_EEWR     0x0102C  /* EEPROM Write Register - RW */
14369 +#define E1000_FLSWCTL  0x01030  /* FLASH control register */
14370 +#define E1000_FLSWDATA 0x01034  /* FLASH data register */
14371 +#define E1000_FLSWCNT  0x01038  /* FLASH Access Counter */
14372 +#define E1000_FLOP     0x0103C  /* FLASH Opcode Register */
14373 +#define E1000_I2CCMD   0x01028  /* SFPI2C Command Register - RW */
14374 +#define E1000_I2CPARAMS 0x0102C /* SFPI2C Parameters Register - RW */
14375 +#define E1000_WDSTP    0x01040  /* Watchdog Setup - RW */
14376 +#define E1000_SWDSTS   0x01044  /* SW Device Status - RW */
14377 +#define E1000_FRTIMER  0x01048  /* Free Running Timer - RW */
14378 +#define E1000_TCPTIMER 0x0104C  /* TCP Timer - RW */
14379 +#define E1000_VPDDIAG  0x01060  /* VPD Diagnostic - RO */
14380 +#define E1000_ICR_V2   0x01500  /* Interrupt Cause - new location - RC */
14381 +#define E1000_ICS_V2   0x01504  /* Interrupt Cause Set - new location - WO */
14382 +#define E1000_IMS_V2   0x01508  /* Interrupt Mask Set/Read - new location - RW */
14383 +#define E1000_IMC_V2   0x0150C  /* Interrupt Mask Clear - new location - WO */
14384 +#define E1000_IAM_V2   0x01510  /* Interrupt Ack Auto Mask - new location - RW */
14385 +#define E1000_ERT      0x02008  /* Early Rx Threshold - RW */
14386 +#define E1000_FCRTL    0x02160  /* Flow Control Receive Threshold Low - RW */
14387 +#define E1000_FCRTH    0x02168  /* Flow Control Receive Threshold High - RW */
14388 +#define E1000_PSRCTL   0x02170  /* Packet Split Receive Control - RW */
14389 +#define E1000_RDFPCQ(_n)  (0x02430 + (0x4 * (_n)))
14390 +#define E1000_PBRTH    0x02458  /* PB Rx Arbitration Threshold - RW */
14391 +#define E1000_FCRTV    0x02460  /* Flow Control Refresh Timer Value - RW */
14392 +/* Split and Replication Rx Control - RW */
14393 +#define E1000_RDPUMB   0x025CC  /* DMA Rx Descriptor uC Mailbox - RW */
14394 +#define E1000_RDPUAD   0x025D0  /* DMA Rx Descriptor uC Addr Command - RW */
14395 +#define E1000_RDPUWD   0x025D4  /* DMA Rx Descriptor uC Data Write - RW */
14396 +#define E1000_RDPURD   0x025D8  /* DMA Rx Descriptor uC Data Read - RW */
14397 +#define E1000_RDPUCTL  0x025DC  /* DMA Rx Descriptor uC Control - RW */
14398 +#define E1000_PBDIAG   0x02458  /* Packet Buffer Diagnostic - RW */
14399 +#define E1000_RXPBS    0x02404  /* Rx Packet Buffer Size - RW */
14400 +#define E1000_RXCTL(_n)   (0x0C014 + (0x40 * (_n)))
14401 +#define E1000_RQDPC(_n)   (0x0C030 + (0x40 * (_n)))
14402 +#define E1000_TXCTL(_n)   (0x0E014 + (0x40 * (_n)))
14403 +#define E1000_RDTR     0x02820  /* Rx Delay Timer - RW */
14404 +#define E1000_RADV     0x0282C  /* Rx Interrupt Absolute Delay Timer - RW */
14405 +/*
14406 + * Convenience macros
14407 + *
14408 + * Note: "_n" is the queue number of the register to be written to.
14409 + *
14410 + * Example usage:
14411 + * E1000_RDBAL_REG(current_rx_queue)
14412 + */
14413 +#define E1000_RDBAL(_n)   ((_n) < 4 ? (0x02800 + ((_n) * 0x100)) : (0x0C000 + ((_n) * 0x40)))
14414 +#define E1000_RDBAH(_n)   ((_n) < 4 ? (0x02804 + ((_n) * 0x100)) : (0x0C004 + ((_n) * 0x40)))
14415 +#define E1000_RDLEN(_n)   ((_n) < 4 ? (0x02808 + ((_n) * 0x100)) : (0x0C008 + ((_n) * 0x40)))
14416 +#define E1000_SRRCTL(_n)  ((_n) < 4 ? (0x0280C + ((_n) * 0x100)) : (0x0C00C + ((_n) * 0x40)))
14417 +#define E1000_RDH(_n)     ((_n) < 4 ? (0x02810 + ((_n) * 0x100)) : (0x0C010 + ((_n) * 0x40)))
14418 +#define E1000_RDT(_n)     ((_n) < 4 ? (0x02818 + ((_n) * 0x100)) : (0x0C018 + ((_n) * 0x40)))
14419 +#define E1000_RXDCTL(_n)  ((_n) < 4 ? (0x02828 + ((_n) * 0x100)) : (0x0C028 + ((_n) * 0x40)))
14420 +#define E1000_TDBAL(_n)   ((_n) < 4 ? (0x03800 + ((_n) * 0x100)) : (0x0E000 + ((_n) * 0x40)))
14421 +#define E1000_TDBAH(_n)   ((_n) < 4 ? (0x03804 + ((_n) * 0x100)) : (0x0E004 + ((_n) * 0x40)))
14422 +#define E1000_TDLEN(_n)   ((_n) < 4 ? (0x03808 + ((_n) * 0x100)) : (0x0E008 + ((_n) * 0x40)))
14423 +#define E1000_TDH(_n)     ((_n) < 4 ? (0x03810 + ((_n) * 0x100)) : (0x0E010 + ((_n) * 0x40)))
14424 +#define E1000_TDT(_n)     ((_n) < 4 ? (0x03818 + ((_n) * 0x100)) : (0x0E018 + ((_n) * 0x40)))
14425 +#define E1000_TXDCTL(_n)  ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) : (0x0E028 + ((_n) * 0x40)))
14426 +#define E1000_TARC(_n)    (0x03840 + (_n << 8))
14427 +#define E1000_DCA_TXCTRL(_n) (0x03814 + (_n << 8))
14428 +#define E1000_DCA_RXCTRL(_n) (0x02814 + (_n << 8))
14429 +#define E1000_TDWBAL(_n)  ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) : (0x0E038 + ((_n) * 0x40)))
14430 +#define E1000_TDWBAH(_n)  ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) : (0x0E03C + ((_n) * 0x40)))
14431 +#define E1000_RSRPD    0x02C00  /* Rx Small Packet Detect - RW */
14432 +#define E1000_RAID     0x02C08  /* Receive Ack Interrupt Delay - RW */
14433 +#define E1000_TXDMAC   0x03000  /* Tx DMA Control - RW */
14434 +#define E1000_KABGTXD  0x03004  /* AFE Band Gap Transmit Ref Data */
14435 +#define E1000_PSRTYPE(_i)       (0x05480 + ((_i) * 4))
14436 +#define E1000_RAL(_i)  (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : (0x054E0 + ((_i - 16) * 8)))
14437 +#define E1000_RAH(_i)  (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : (0x054E4 + ((_i - 16) * 8)))
14438 +#define E1000_IP4AT_REG(_i)     (0x05840 + ((_i) * 8))
14439 +#define E1000_IP6AT_REG(_i)     (0x05880 + ((_i) * 4))
14440 +#define E1000_WUPM_REG(_i)      (0x05A00 + ((_i) * 4))
14441 +#define E1000_FFMT_REG(_i)      (0x09000 + ((_i) * 8))
14442 +#define E1000_FFVT_REG(_i)      (0x09800 + ((_i) * 8))
14443 +#define E1000_FFLT_REG(_i)      (0x05F00 + ((_i) * 8))
14444 +#define E1000_PBSLAC   0x03100  /* Packet Buffer Slave Access Control */
14445 +#define E1000_PBSLAD(_n)  (0x03110 + (0x4 * (_n)))  /* Packet Buffer DWORD (_n) */
14446 +#define E1000_TXPBS    0x03404  /* Tx Packet Buffer Size - RW */
14447 +#define E1000_TDFH     0x03410  /* Tx Data FIFO Head - RW */
14448 +#define E1000_TDFT     0x03418  /* Tx Data FIFO Tail - RW */
14449 +#define E1000_TDFHS    0x03420  /* Tx Data FIFO Head Saved - RW */
14450 +#define E1000_TDFTS    0x03428  /* Tx Data FIFO Tail Saved - RW */
14451 +#define E1000_TDFPC    0x03430  /* Tx Data FIFO Packet Count - RW */
14452 +#define E1000_TDPUMB   0x0357C  /* DMA Tx Descriptor uC Mail Box - RW */
14453 +#define E1000_TDPUAD   0x03580  /* DMA Tx Descriptor uC Addr Command - RW */
14454 +#define E1000_TDPUWD   0x03584  /* DMA Tx Descriptor uC Data Write - RW */
14455 +#define E1000_TDPURD   0x03588  /* DMA Tx Descriptor uC Data  Read  - RW */
14456 +#define E1000_TDPUCTL  0x0358C  /* DMA Tx Descriptor uC Control - RW */
14457 +#define E1000_DTXCTL   0x03590  /* DMA Tx Control - RW */
14458 +#define E1000_DTXTCPFLGL 0x0359C /* DMA Tx Control flag low - RW */
14459 +#define E1000_DTXTCPFLGH 0x035A0 /* DMA Tx Control flag high - RW */
14460 +#define E1000_DTXMXSZRQ  0x03540 /* DMA Tx Max Total Allow Size Requests - RW */
14461 +#define E1000_TIDV     0x03820  /* Tx Interrupt Delay Value - RW */
14462 +#define E1000_TADV     0x0382C  /* Tx Interrupt Absolute Delay Val - RW */
14463 +#define E1000_TSPMT    0x03830  /* TCP Segmentation PAD & Min Threshold - RW */
14464 +#define E1000_CRCERRS  0x04000  /* CRC Error Count - R/clr */
14465 +#define E1000_ALGNERRC 0x04004  /* Alignment Error Count - R/clr */
14466 +#define E1000_SYMERRS  0x04008  /* Symbol Error Count - R/clr */
14467 +#define E1000_RXERRC   0x0400C  /* Receive Error Count - R/clr */
14468 +#define E1000_MPC      0x04010  /* Missed Packet Count - R/clr */
14469 +#define E1000_SCC      0x04014  /* Single Collision Count - R/clr */
14470 +#define E1000_ECOL     0x04018  /* Excessive Collision Count - R/clr */
14471 +#define E1000_MCC      0x0401C  /* Multiple Collision Count - R/clr */
14472 +#define E1000_LATECOL  0x04020  /* Late Collision Count - R/clr */
14473 +#define E1000_COLC     0x04028  /* Collision Count - R/clr */
14474 +#define E1000_DC       0x04030  /* Defer Count - R/clr */
14475 +#define E1000_TNCRS    0x04034  /* Tx-No CRS - R/clr */
14476 +#define E1000_SEC      0x04038  /* Sequence Error Count - R/clr */
14477 +#define E1000_CEXTERR  0x0403C  /* Carrier Extension Error Count - R/clr */
14478 +#define E1000_RLEC     0x04040  /* Receive Length Error Count - R/clr */
14479 +#define E1000_XONRXC   0x04048  /* XON Rx Count - R/clr */
14480 +#define E1000_XONTXC   0x0404C  /* XON Tx Count - R/clr */
14481 +#define E1000_XOFFRXC  0x04050  /* XOFF Rx Count - R/clr */
14482 +#define E1000_XOFFTXC  0x04054  /* XOFF Tx Count - R/clr */
14483 +#define E1000_FCRUC    0x04058  /* Flow Control Rx Unsupported Count- R/clr */
14484 +#define E1000_PRC64    0x0405C  /* Packets Rx (64 bytes) - R/clr */
14485 +#define E1000_PRC127   0x04060  /* Packets Rx (65-127 bytes) - R/clr */
14486 +#define E1000_PRC255   0x04064  /* Packets Rx (128-255 bytes) - R/clr */
14487 +#define E1000_PRC511   0x04068  /* Packets Rx (255-511 bytes) - R/clr */
14488 +#define E1000_PRC1023  0x0406C  /* Packets Rx (512-1023 bytes) - R/clr */
14489 +#define E1000_PRC1522  0x04070  /* Packets Rx (1024-1522 bytes) - R/clr */
14490 +#define E1000_GPRC     0x04074  /* Good Packets Rx Count - R/clr */
14491 +#define E1000_BPRC     0x04078  /* Broadcast Packets Rx Count - R/clr */
14492 +#define E1000_MPRC     0x0407C  /* Multicast Packets Rx Count - R/clr */
14493 +#define E1000_GPTC     0x04080  /* Good Packets Tx Count - R/clr */
14494 +#define E1000_GORCL    0x04088  /* Good Octets Rx Count Low - R/clr */
14495 +#define E1000_GORCH    0x0408C  /* Good Octets Rx Count High - R/clr */
14496 +#define E1000_GOTCL    0x04090  /* Good Octets Tx Count Low - R/clr */
14497 +#define E1000_GOTCH    0x04094  /* Good Octets Tx Count High - R/clr */
14498 +#define E1000_RNBC     0x040A0  /* Rx No Buffers Count - R/clr */
14499 +#define E1000_RUC      0x040A4  /* Rx Undersize Count - R/clr */
14500 +#define E1000_RFC      0x040A8  /* Rx Fragment Count - R/clr */
14501 +#define E1000_ROC      0x040AC  /* Rx Oversize Count - R/clr */
14502 +#define E1000_RJC      0x040B0  /* Rx Jabber Count - R/clr */
14503 +#define E1000_MGTPRC   0x040B4  /* Management Packets Rx Count - R/clr */
14504 +#define E1000_MGTPDC   0x040B8  /* Management Packets Dropped Count - R/clr */
14505 +#define E1000_MGTPTC   0x040BC  /* Management Packets Tx Count - R/clr */
14506 +#define E1000_TORL     0x040C0  /* Total Octets Rx Low - R/clr */
14507 +#define E1000_TORH     0x040C4  /* Total Octets Rx High - R/clr */
14508 +#define E1000_TOTL     0x040C8  /* Total Octets Tx Low - R/clr */
14509 +#define E1000_TOTH     0x040CC  /* Total Octets Tx High - R/clr */
14510 +#define E1000_TPR      0x040D0  /* Total Packets Rx - R/clr */
14511 +#define E1000_TPT      0x040D4  /* Total Packets Tx - R/clr */
14512 +#define E1000_PTC64    0x040D8  /* Packets Tx (64 bytes) - R/clr */
14513 +#define E1000_PTC127   0x040DC  /* Packets Tx (65-127 bytes) - R/clr */
14514 +#define E1000_PTC255   0x040E0  /* Packets Tx (128-255 bytes) - R/clr */
14515 +#define E1000_PTC511   0x040E4  /* Packets Tx (256-511 bytes) - R/clr */
14516 +#define E1000_PTC1023  0x040E8  /* Packets Tx (512-1023 bytes) - R/clr */
14517 +#define E1000_PTC1522  0x040EC  /* Packets Tx (1024-1522 Bytes) - R/clr */
14518 +#define E1000_MPTC     0x040F0  /* Multicast Packets Tx Count - R/clr */
14519 +#define E1000_BPTC     0x040F4  /* Broadcast Packets Tx Count - R/clr */
14520 +#define E1000_TSCTC    0x040F8  /* TCP Segmentation Context Tx - R/clr */
14521 +#define E1000_TSCTFC   0x040FC  /* TCP Segmentation Context Tx Fail - R/clr */
14522 +#define E1000_IAC      0x04100  /* Interrupt Assertion Count */
14523 +#define E1000_ICRXPTC  0x04104  /* Interrupt Cause Rx Packet Timer Expire Count */
14524 +#define E1000_ICRXATC  0x04108  /* Interrupt Cause Rx Absolute Timer Expire Count */
14525 +#define E1000_ICTXPTC  0x0410C  /* Interrupt Cause Tx Packet Timer Expire Count */
14526 +#define E1000_ICTXATC  0x04110  /* Interrupt Cause Tx Absolute Timer Expire Count */
14527 +#define E1000_ICTXQEC  0x04118  /* Interrupt Cause Tx Queue Empty Count */
14528 +#define E1000_ICTXQMTC 0x0411C  /* Interrupt Cause Tx Queue Minimum Threshold Count */
14529 +#define E1000_ICRXDMTC 0x04120  /* Interrupt Cause Rx Descriptor Minimum Threshold Count */
14530 +#define E1000_ICRXOC   0x04124  /* Interrupt Cause Receiver Overrun Count */
14531 +
14532 +#define E1000_LSECTXUT        0x04300  /* LinkSec Tx Untagged Packet Count - OutPktsUntagged */
14533 +#define E1000_LSECTXPKTE      0x04304  /* LinkSec Encrypted Tx Packets Count - OutPktsEncrypted */
14534 +#define E1000_LSECTXPKTP      0x04308  /* LinkSec Protected Tx Packet Count - OutPktsProtected */
14535 +#define E1000_LSECTXOCTE      0x0430C  /* LinkSec Encrypted Tx Octets Count - OutOctetsEncrypted */
14536 +#define E1000_LSECTXOCTP      0x04310  /* LinkSec Protected Tx Octets Count - OutOctetsProtected */
14537 +#define E1000_LSECRXUT        0x04314  /* LinkSec Untagged non-Strict Rx Packet Count - InPktsUntagged/InPktsNoTag */
14538 +#define E1000_LSECRXOCTD      0x0431C  /* LinkSec Rx Octets Decrypted Count - InOctetsDecrypted */
14539 +#define E1000_LSECRXOCTV      0x04320  /* LinkSec Rx Octets Validated - InOctetsValidated */
14540 +#define E1000_LSECRXBAD       0x04324  /* LinkSec Rx Bad Tag - InPktsBadTag */
14541 +#define E1000_LSECRXNOSCI     0x04328  /* LinkSec Rx Packet No SCI Count - InPktsNoSci */
14542 +#define E1000_LSECRXUNSCI     0x0432C  /* LinkSec Rx Packet Unknown SCI Count - InPktsUnknownSci */
14543 +#define E1000_LSECRXUNCH      0x04330  /* LinkSec Rx Unchecked Packets Count - InPktsUnchecked */
14544 +#define E1000_LSECRXDELAY     0x04340  /* LinkSec Rx Delayed Packet Count - InPktsDelayed */
14545 +#define E1000_LSECRXLATE      0x04350  /* LinkSec Rx Late Packets Count - InPktsLate */
14546 +#define E1000_LSECRXOK(_n)    (0x04360 + (0x04 * (_n))) /* LinkSec Rx Packet OK Count - InPktsOk */
14547 +#define E1000_LSECRXINV(_n)   (0x04380 + (0x04 * (_n))) /* LinkSec Rx Invalid Count - InPktsInvalid */
14548 +#define E1000_LSECRXNV(_n)    (0x043A0 + (0x04 * (_n))) /* LinkSec Rx Not Valid Count - InPktsNotValid */
14549 +#define E1000_LSECRXUNSA      0x043C0  /* LinkSec Rx Unused SA Count - InPktsUnusedSa */
14550 +#define E1000_LSECRXNUSA      0x043D0  /* LinkSec Rx Not Using SA Count - InPktsNotUsingSa */
14551 +#define E1000_LSECTXCAP       0x0B000  /* LinkSec Tx Capabilities Register - RO */
14552 +#define E1000_LSECRXCAP       0x0B300  /* LinkSec Rx Capabilities Register - RO */
14553 +#define E1000_LSECTXCTRL      0x0B004  /* LinkSec Tx Control - RW */
14554 +#define E1000_LSECRXCTRL      0x0B304  /* LinkSec Rx Control - RW */
14555 +#define E1000_LSECTXSCL       0x0B008  /* LinkSec Tx SCI Low - RW */
14556 +#define E1000_LSECTXSCH       0x0B00C  /* LinkSec Tx SCI High - RW */
14557 +#define E1000_LSECTXSA        0x0B010  /* LinkSec Tx SA0 - RW */
14558 +#define E1000_LSECTXPN0       0x0B018  /* LinkSec Tx SA PN 0 - RW */
14559 +#define E1000_LSECTXPN1       0x0B01C  /* LinkSec Tx SA PN 1 - RW */
14560 +#define E1000_LSECRXSCL       0x0B3D0  /* LinkSec Rx SCI Low - RW */
14561 +#define E1000_LSECRXSCH       0x0B3E0  /* LinkSec Rx SCI High - RW */
14562 +#define E1000_LSECTXKEY0(_n)  (0x0B020 + (0x04 * (_n))) /* LinkSec Tx 128-bit Key 0 - WO */
14563 +#define E1000_LSECTXKEY1(_n)  (0x0B030 + (0x04 * (_n))) /* LinkSec Tx 128-bit Key 1 - WO */
14564 +#define E1000_LSECRXSA(_n)    (0x0B310 + (0x04 * (_n))) /* LinkSec Rx SAs - RW */
14565 +#define E1000_LSECRXPN(_n)    (0x0B330 + (0x04 * (_n))) /* LinkSec Rx SAs - RW */
14566 +/*
14567 + * LinkSec Rx Keys  - where _n is the SA no. and _m the 4 dwords of the 128 bit
14568 + * key - RW.
14569 + */
14570 +#define E1000_LSECRXKEY(_n, _m) (0x0B350 + (0x10 * (_n)) + (0x04 * (_m)))
14571 +
14572 +#define E1000_SSVPC             0x041A0  /* Switch Security Violation Packet Count */
14573 +#define E1000_IPSCTRL           0xB430   /* IpSec Control Register */
14574 +#define E1000_IPSRXCMD          0x0B408  /* IPSec Rx Command Register - RW */
14575 +#define E1000_IPSRXIDX          0x0B400  /* IPSec Rx Index - RW */
14576 +#define E1000_IPSRXIPADDR(_n)   (0x0B420+ (0x04 * (_n)))  /* IPSec Rx IPv4/v6 Address - RW */
14577 +#define E1000_IPSRXKEY(_n)      (0x0B410 + (0x04 * (_n))) /* IPSec Rx 128-bit Key - RW */
14578 +#define E1000_IPSRXSALT         0x0B404  /* IPSec Rx Salt - RW */
14579 +#define E1000_IPSRXSPI          0x0B40C  /* IPSec Rx SPI - RW */
14580 +#define E1000_IPSTXKEY(_n)      (0x0B460 + (0x04 * (_n))) /* IPSec Tx 128-bit Key - RW */
14581 +#define E1000_IPSTXSALT         0x0B454  /* IPSec Tx Salt - RW */
14582 +#define E1000_IPSTXIDX          0x0B450  /* IPSec Tx SA IDX - RW */
14583 +#define E1000_PCS_CFG0    0x04200  /* PCS Configuration 0 - RW */
14584 +#define E1000_PCS_LCTL    0x04208  /* PCS Link Control - RW */
14585 +#define E1000_PCS_LSTAT   0x0420C  /* PCS Link Status - RO */
14586 +#define E1000_CBTMPC      0x0402C  /* Circuit Breaker Tx Packet Count */
14587 +#define E1000_HTDPMC      0x0403C  /* Host Transmit Discarded Packets */
14588 +#define E1000_CBRDPC      0x04044  /* Circuit Breaker Rx Dropped Count */
14589 +#define E1000_CBRMPC      0x040FC  /* Circuit Breaker Rx Packet Count */
14590 +#define E1000_RPTHC       0x04104  /* Rx Packets To Host */
14591 +#define E1000_HGPTC       0x04118  /* Host Good Packets Tx Count */
14592 +#define E1000_HTCBDPC     0x04124  /* Host Tx Circuit Breaker Dropped Count */
14593 +#define E1000_HGORCL      0x04128  /* Host Good Octets Received Count Low */
14594 +#define E1000_HGORCH      0x0412C  /* Host Good Octets Received Count High */
14595 +#define E1000_HGOTCL      0x04130  /* Host Good Octets Transmit Count Low */
14596 +#define E1000_HGOTCH      0x04134  /* Host Good Octets Transmit Count High */
14597 +#define E1000_LENERRS     0x04138  /* Length Errors Count */
14598 +#define E1000_SCVPC       0x04228  /* SerDes/SGMII Code Violation Pkt Count */
14599 +#define E1000_HRMPC       0x0A018  /* Header Redirection Missed Packet Count */
14600 +#define E1000_PCS_ANADV   0x04218  /* AN advertisement - RW */
14601 +#define E1000_PCS_LPAB    0x0421C  /* Link Partner Ability - RW */
14602 +#define E1000_PCS_NPTX    0x04220  /* AN Next Page Transmit - RW */
14603 +#define E1000_PCS_LPABNP  0x04224  /* Link Partner Ability Next Page - RW */
14604 +#define E1000_1GSTAT_RCV  0x04228  /* 1GSTAT Code Violation Packet Count - RW */
14605 +#define E1000_RXCSUM   0x05000  /* Rx Checksum Control - RW */
14606 +#define E1000_RLPML    0x05004  /* Rx Long Packet Max Length */
14607 +#define E1000_RFCTL    0x05008  /* Receive Filter Control*/
14608 +#define E1000_MTA      0x05200  /* Multicast Table Array - RW Array */
14609 +#define E1000_RA       0x05400  /* Receive Address - RW Array */
14610 +#define E1000_RA2      0x054E0  /* 2nd half of receive address array - RW Array */
14611 +#define E1000_VFTA     0x05600  /* VLAN Filter Table Array - RW Array */
14612 +#define E1000_VT_CTL   0x0581C  /* VMDq Control - RW */
14613 +#define E1000_VFQA0    0x0B000  /* VLAN Filter Queue Array 0 - RW Array */
14614 +#define E1000_VFQA1    0x0B200  /* VLAN Filter Queue Array 1 - RW Array */
14615 +#define E1000_WUC      0x05800  /* Wakeup Control - RW */
14616 +#define E1000_WUFC     0x05808  /* Wakeup Filter Control - RW */
14617 +#define E1000_WUS      0x05810  /* Wakeup Status - RO */
14618 +#define E1000_MANC     0x05820  /* Management Control - RW */
14619 +#define E1000_IPAV     0x05838  /* IP Address Valid - RW */
14620 +#define E1000_IP4AT    0x05840  /* IPv4 Address Table - RW Array */
14621 +#define E1000_IP6AT    0x05880  /* IPv6 Address Table - RW Array */
14622 +#define E1000_WUPL     0x05900  /* Wakeup Packet Length - RW */
14623 +#define E1000_WUPM     0x05A00  /* Wakeup Packet Memory - RO A */
14624 +#define E1000_PBACL    0x05B68  /* MSIx PBA Clear - Read/Write 1's to clear */
14625 +#define E1000_FFLT     0x05F00  /* Flexible Filter Length Table - RW Array */
14626 +#define E1000_HOST_IF  0x08800  /* Host Interface */
14627 +#define E1000_FFMT     0x09000  /* Flexible Filter Mask Table - RW Array */
14628 +#define E1000_FFVT     0x09800  /* Flexible Filter Value Table - RW Array */
14629 +#define E1000_FHFT(_n)  (0x09000 + (_n * 0x100)) /* Flexible Host Filter Table */
14630 +#define E1000_FHFT_EXT(_n) (0x09A00 + (_n * 0x100)) /* Ext Flexible Host Filter Table */
14631 +
14632 +
14633 +#define E1000_KMRNCTRLSTA 0x00034 /* MAC-PHY interface - RW */
14634 +#define E1000_MDPHYA      0x0003C /* PHY address - RW */
14635 +#define E1000_MANC2H      0x05860 /* Management Control To Host - RW */
14636 +#define E1000_SW_FW_SYNC  0x05B5C /* Software-Firmware Synchronization - RW */
14637 +#define E1000_CCMCTL      0x05B48 /* CCM Control Register */
14638 +#define E1000_GIOCTL      0x05B44 /* GIO Analog Control Register */
14639 +#define E1000_SCCTL       0x05B4C /* PCIc PLL Configuration Register */
14640 +#define E1000_GCR         0x05B00 /* PCI-Ex Control */
14641 +#define E1000_GSCL_1    0x05B10 /* PCI-Ex Statistic Control #1 */
14642 +#define E1000_GSCL_2    0x05B14 /* PCI-Ex Statistic Control #2 */
14643 +#define E1000_GSCL_3    0x05B18 /* PCI-Ex Statistic Control #3 */
14644 +#define E1000_GSCL_4    0x05B1C /* PCI-Ex Statistic Control #4 */
14645 +#define E1000_FACTPS    0x05B30 /* Function Active and Power State to MNG */
14646 +#define E1000_SWSM      0x05B50 /* SW Semaphore */
14647 +#define E1000_FWSM      0x05B54 /* FW Semaphore */
14648 +#define E1000_DCA_ID    0x05B70 /* DCA Requester ID Information - RO */
14649 +#define E1000_DCA_CTRL  0x05B74 /* DCA Control - RW */
14650 +#define E1000_FFLT_DBG  0x05F04 /* Debug Register */
14651 +#define E1000_HICR      0x08F00 /* Host Interface Control */
14652 +
14653 +/* RSS registers */
14654 +#define E1000_CPUVEC    0x02C10 /* CPU Vector Register - RW */
14655 +#define E1000_MRQC      0x05818 /* Multiple Receive Control - RW */
14656 +#define E1000_IMIR(_i)      (0x05A80 + ((_i) * 4))  /* Immediate Interrupt */
14657 +#define E1000_IMIREXT(_i)   (0x05AA0 + ((_i) * 4))  /* Immediate Interrupt Ext*/
14658 +#define E1000_IMIRVP    0x05AC0 /* Immediate Interrupt Rx VLAN Priority - RW */
14659 +#define E1000_MSIXBM(_i)    (0x01600 + ((_i) * 4)) /* MSI-X Allocation Register (_i) - RW */
14660 +#define E1000_MSIXTADD(_i)  (0x0C000 + ((_i) * 0x10)) /* MSI-X Table entry addr low reg 0 - RW */
14661 +#define E1000_MSIXTUADD(_i) (0x0C004 + ((_i) * 0x10)) /* MSI-X Table entry addr upper reg 0 - RW */
14662 +#define E1000_MSIXTMSG(_i)  (0x0C008 + ((_i) * 0x10)) /* MSI-X Table entry message reg 0 - RW */
14663 +#define E1000_MSIXVCTRL(_i) (0x0C00C + ((_i) * 0x10)) /* MSI-X Table entry vector ctrl reg 0 - RW */
14664 +#define E1000_MSIXPBA    0x0E000 /* MSI-X Pending bit array */
14665 +#define E1000_RETA(_i)  (0x05C00 + ((_i) * 4)) /* Redirection Table - RW Array */
14666 +#define E1000_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* RSS Random Key - RW Array */
14667 +#define E1000_RSSIM     0x05864 /* RSS Interrupt Mask */
14668 +#define E1000_RSSIR     0x05868 /* RSS Interrupt Request */
14669 +/* VT Registers */
14670 +#define E1000_SWPBS     0x03004 /* Switch Packet Buffer Size - RW */
14671 +#define E1000_MBVFICR   0x00C80 /* Mailbox VF Cause - RWC */
14672 +#define E1000_MBVFIMR   0x00C84 /* Mailbox VF int Mask - RW */
14673 +#define E1000_VFLRE     0x00C88 /* VF Register Events - RWC */
14674 +#define E1000_VFRE      0x00C8C /* VF Receive Enables */
14675 +#define E1000_VFTE      0x00C90 /* VF Transmit Enables */
14676 +#define E1000_QDE       0x02408 /* Queue Drop Enable - RW */
14677 +#define E1000_DTXSWC    0x03500 /* DMA Tx Switch Control - RW */
14678 +#define E1000_VLVF      0x05D00 /* VLAN Virtual Machine Filter - RW */
14679 +#define E1000_RPLOLR    0x05AF0 /* Replication Offload - RW */
14680 +#define E1000_UTA       0x0A000 /* Unicast Table Array - RW */
14681 +#define E1000_IOVTCL    0x05BBC /* IOV Control Register */
14682 +#define E1000_VMRCTL    0X05D80 /* Virtual Mirror Rule Control */
14683 +/* These act per VF so an array friendly macro is used */
14684 +#define E1000_V2PMAILBOX(_n)   (0x00C40 + (4 * (_n)))
14685 +#define E1000_P2VMAILBOX(_n)   (0x00C00 + (4 * (_n)))
14686 +#define E1000_VMBMEM(_n)       (0x00800 + (64 * (_n)))
14687 +#define E1000_VFVMBMEM(_n)     (0x00800 + (_n))
14688 +#define E1000_VMOLR(_n)        (0x05AD0 + (4 * (_n)))
14689 +
14690 +/* Filtering Registers */
14691 +#define E1000_SAQF(_n)  (0x05980 + (4 * (_n))) /* Source Address Queue Fltr */
14692 +#define E1000_DAQF(_n)  (0x059A0 + (4 * (_n))) /* Dest Address Queue Fltr */
14693 +#define E1000_SPQF(_n)  (0x059C0 + (4 * (_n))) /* Source Port Queue Fltr */
14694 +#define E1000_FTQF(_n)  (0x059E0 + (4 * (_n))) /* 5-tuple Queue Fltr */
14695 +#define E1000_SYNQF(_n) (0x055FC + (4 * (_n))) /* SYN Packet Queue Fltr */
14696 +#define E1000_ETQF(_n)  (0x05CB0 + (4 * (_n))) /* EType Queue Fltr */
14697 +
14698 +#define E1000_RTTDCS            0x3600  /* Reedtown Tx Desc plane control and status */
14699 +#define E1000_RTTPCS            0x3474  /* Reedtown Tx Packet Plane control and status */
14700 +#define E1000_RTRPCS            0x2474  /* Rx packet plane control and status */
14701 +#define E1000_RTRUP2TC          0x05AC4 /* Rx User Priority to Traffic Class */
14702 +#define E1000_RTTUP2TC          0x0418  /* Transmit User Priority to Traffic Class */
14703 +#define E1000_RTTDTCRC(_n)      (0x3610 + ((_n) * 4)) /* Tx Desc plane TC Rate-scheduler config */
14704 +#define E1000_RTTPTCRC(_n)      (0x3480 + ((_n) * 4)) /* Tx Packet plane TC Rate-Scheduler Config */
14705 +#define E1000_RTRPTCRC(_n)      (0x2480 + ((_n) * 4)) /* Rx Packet plane TC Rate-Scheduler Config */
14706 +#define E1000_RTTDTCRS(_n)      (0x3630 + ((_n) * 4)) /* Tx Desc Plane TC Rate-Scheduler Status */
14707 +#define E1000_RTTDTCRM(_n)      (0x3650 + ((_n) * 4)) /* Tx Desc Plane TC Rate-Scheduler MMW */
14708 +#define E1000_RTTPTCRS(_n)      (0x34A0 + ((_n) * 4)) /* Tx Packet plane TC Rate-Scheduler Status */
14709 +#define E1000_RTTPTCRM(_n)      (0x34C0 + ((_n) * 4)) /* Tx Packet plane TC Rate-scheduler MMW */
14710 +#define E1000_RTRPTCRS(_n)      (0x24A0 + ((_n) * 4)) /* Rx Packet plane TC Rate-Scheduler Status */
14711 +#define E1000_RTRPTCRM(_n)      (0x24C0 + ((_n) * 4)) /* Rx Packet plane TC Rate-Scheduler MMW */
14712 +#define E1000_RTTDVMRM(_n)      (0x3670 + ((_n) * 4)) /* Tx Desc plane VM Rate-Scheduler MMW*/
14713 +#define E1000_RTTBCNRM(_n)      (0x3690 + ((_n) * 4)) /* Tx BCN Rate-Scheduler MMW */
14714 +#define E1000_RTTDQSEL          0x3604  /* Tx Desc Plane Queue Select */
14715 +#define E1000_RTTDVMRC          0x3608  /* Tx Desc Plane VM Rate-Scheduler Config */
14716 +#define E1000_RTTDVMRS          0x360C  /* Tx Desc Plane VM Rate-Scheduler Status */
14717 +#define E1000_RTTBCNRC          0x36B0  /* Tx BCN Rate-Scheduler Config */
14718 +#define E1000_RTTBCNRS          0x36B4  /* Tx BCN Rate-Scheduler Status */
14719 +#define E1000_RTTBCNCR          0xB200  /* Tx BCN Control Register */
14720 +#define E1000_RTTBCNTG          0x35A4  /* Tx BCN Tagging */
14721 +#define E1000_RTTBCNCP          0xB208  /* Tx BCN Congestion point */
14722 +#define E1000_RTRBCNCR          0xB20C  /* Rx BCN Control Register */
14723 +#define E1000_RTTBCNRD          0x36B8  /* Tx BCN Rate Drift */
14724 +#define E1000_PFCTOP            0x1080  /* Priority Flow Control Type and Opcode */
14725 +#define E1000_RTTBCNIDX         0xB204  /* Tx BCN Congestion Point */
14726 +#define E1000_RTTBCNACH         0x0B214 /* Tx BCN Control High */
14727 +#define E1000_RTTBCNACL         0x0B210 /* Tx BCN Control Low */
14728 +
14729 +#endif
14730 diff -Nru vanilla/drivers/net/igb/igb_ethtool.c linux-i686-2.6.22/drivers/net/igb/igb_ethtool.c
14731 --- vanilla/drivers/net/igb/igb_ethtool.c       1969-12-31 19:00:00.000000000 -0500
14732 +++ linux-i686-2.6.22/drivers/net/igb/igb_ethtool.c     2009-07-16 19:25:22.000000000 -0400
14733 @@ -0,0 +1,1965 @@
14734 +/*******************************************************************************
14735 +
14736 +  Intel(R) Gigabit Ethernet Linux driver
14737 +  Copyright(c) 2007-2008 Intel Corporation.
14738 +
14739 +  This program is free software; you can redistribute it and/or modify it
14740 +  under the terms and conditions of the GNU General Public License,
14741 +  version 2, as published by the Free Software Foundation.
14742 +
14743 +  This program is distributed in the hope it will be useful, but WITHOUT
14744 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14745 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14746 +  more details.
14747 +
14748 +  You should have received a copy of the GNU General Public License along with
14749 +  this program; if not, write to the Free Software Foundation, Inc.,
14750 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
14751 +
14752 +  The full GNU General Public License is included in this distribution in
14753 +  the file called "COPYING".
14754 +
14755 +  Contact Information:
14756 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
14757 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
14758 +
14759 +*******************************************************************************/
14760 +
14761 +/* ethtool support for igb */
14762 +
14763 +#include <linux/netdevice.h>
14764 +#include <linux/vmalloc.h>
14765 +
14766 +#ifdef SIOCETHTOOL
14767 +#include <linux/ethtool.h>
14768 +
14769 +#include "igb.h"
14770 +#include "igb_regtest.h"
14771 +#include <linux/if_vlan.h>
14772 +
14773 +#ifdef ETHTOOL_OPS_COMPAT
14774 +#include "kcompat_ethtool.c"
14775 +#endif
14776 +
14777 +#ifdef ETHTOOL_GSTATS
14778 +struct igb_stats {
14779 +       char stat_string[ETH_GSTRING_LEN];
14780 +       int sizeof_stat;
14781 +       int stat_offset;
14782 +};
14783 +
14784 +#define IGB_STAT(m) sizeof(((struct igb_adapter *)0)->m), \
14785 +                     offsetof(struct igb_adapter, m)
14786 +static const struct igb_stats igb_gstrings_stats[] = {
14787 +       { "rx_packets", IGB_STAT(stats.gprc) },
14788 +       { "tx_packets", IGB_STAT(stats.gptc) },
14789 +       { "rx_bytes", IGB_STAT(stats.gorc) },
14790 +       { "tx_bytes", IGB_STAT(stats.gotc) },
14791 +       { "rx_broadcast", IGB_STAT(stats.bprc) },
14792 +       { "tx_broadcast", IGB_STAT(stats.bptc) },
14793 +       { "rx_multicast", IGB_STAT(stats.mprc) },
14794 +       { "tx_multicast", IGB_STAT(stats.mptc) },
14795 +       { "rx_errors", IGB_STAT(net_stats.rx_errors) },
14796 +       { "tx_errors", IGB_STAT(net_stats.tx_errors) },
14797 +       { "tx_dropped", IGB_STAT(net_stats.tx_dropped) },
14798 +       { "multicast", IGB_STAT(stats.mprc) },
14799 +       { "collisions", IGB_STAT(stats.colc) },
14800 +       { "rx_length_errors", IGB_STAT(net_stats.rx_length_errors) },
14801 +       { "rx_over_errors", IGB_STAT(net_stats.rx_over_errors) },
14802 +       { "rx_crc_errors", IGB_STAT(stats.crcerrs) },
14803 +       { "rx_frame_errors", IGB_STAT(net_stats.rx_frame_errors) },
14804 +       { "rx_no_buffer_count", IGB_STAT(stats.rnbc) },
14805 +       { "rx_missed_errors", IGB_STAT(stats.mpc) },
14806 +       { "tx_aborted_errors", IGB_STAT(stats.ecol) },
14807 +       { "tx_carrier_errors", IGB_STAT(stats.tncrs) },
14808 +       { "tx_fifo_errors", IGB_STAT(net_stats.tx_fifo_errors) },
14809 +       { "tx_heartbeat_errors", IGB_STAT(net_stats.tx_heartbeat_errors) },
14810 +       { "tx_window_errors", IGB_STAT(stats.latecol) },
14811 +       { "tx_abort_late_coll", IGB_STAT(stats.latecol) },
14812 +       { "tx_deferred_ok", IGB_STAT(stats.dc) },
14813 +       { "tx_single_coll_ok", IGB_STAT(stats.scc) },
14814 +       { "tx_multi_coll_ok", IGB_STAT(stats.mcc) },
14815 +       { "tx_timeout_count", IGB_STAT(tx_timeout_count) },
14816 +       { "tx_restart_queue", IGB_STAT(restart_queue) },
14817 +       { "rx_long_length_errors", IGB_STAT(stats.roc) },
14818 +       { "rx_short_length_errors", IGB_STAT(stats.ruc) },
14819 +       { "rx_align_errors", IGB_STAT(stats.algnerrc) },
14820 +       { "tx_tcp_seg_good", IGB_STAT(stats.tsctc) },
14821 +       { "tx_tcp_seg_failed", IGB_STAT(stats.tsctfc) },
14822 +       { "rx_flow_control_xon", IGB_STAT(stats.xonrxc) },
14823 +       { "rx_flow_control_xoff", IGB_STAT(stats.xoffrxc) },
14824 +       { "tx_flow_control_xon", IGB_STAT(stats.xontxc) },
14825 +       { "tx_flow_control_xoff", IGB_STAT(stats.xofftxc) },
14826 +       { "rx_long_byte_count", IGB_STAT(stats.gorc) },
14827 +       { "rx_csum_offload_good", IGB_STAT(hw_csum_good) },
14828 +       { "rx_csum_offload_errors", IGB_STAT(hw_csum_err) },
14829 +       { "rx_header_split", IGB_STAT(rx_hdr_split) },
14830 +       { "low_latency_interrupt", IGB_STAT(lli_int)},
14831 +       { "alloc_rx_buff_failed", IGB_STAT(alloc_rx_buff_failed) },
14832 +       { "tx_smbus", IGB_STAT(stats.mgptc) },
14833 +       { "rx_smbus", IGB_STAT(stats.mgprc) },
14834 +       { "dropped_smbus", IGB_STAT(stats.mgpdc) },
14835 +#ifdef IGB_LRO
14836 +       { "lro_aggregated", IGB_STAT(lro_aggregated) },
14837 +       { "lro_flushed", IGB_STAT(lro_flushed) },
14838 +       { "lro_no_desc", IGB_STAT(lro_no_desc) },
14839 +#endif
14840 +};
14841 +
14842 +#define IGB_QUEUE_STATS_LEN \
14843 +        ((((struct igb_adapter *)netdev->priv)->num_rx_queues + \
14844 +         ((struct igb_adapter *)netdev->priv)->num_tx_queues) * \
14845 +       (sizeof(struct igb_queue_stats) / sizeof(u64)))
14846 +#define IGB_GLOBAL_STATS_LEN   \
14847 +       sizeof(igb_gstrings_stats) / sizeof(struct igb_stats)
14848 +#define IGB_STATS_LEN (IGB_GLOBAL_STATS_LEN + IGB_QUEUE_STATS_LEN)
14849 +#endif /* ETHTOOL_GSTATS */
14850 +#ifdef ETHTOOL_TEST
14851 +static const char igb_gstrings_test[][ETH_GSTRING_LEN] = {
14852 +       "Register test  (offline)", "Eeprom test    (offline)",
14853 +       "Interrupt test (offline)", "Loopback test  (offline)",
14854 +       "Link test   (on/offline)"
14855 +};
14856 +#define IGB_TEST_LEN sizeof(igb_gstrings_test) / ETH_GSTRING_LEN
14857 +#endif /* ETHTOOL_TEST */
14858 +
14859 +static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
14860 +{
14861 +       struct igb_adapter *adapter = netdev_priv(netdev);
14862 +       struct e1000_hw *hw = &adapter->hw;
14863 +       u32 status;
14864 +
14865 +       if (hw->phy.media_type == e1000_media_type_copper) {
14866 +
14867 +               ecmd->supported = (SUPPORTED_10baseT_Half |
14868 +                                  SUPPORTED_10baseT_Full |
14869 +                                  SUPPORTED_100baseT_Half |
14870 +                                  SUPPORTED_100baseT_Full |
14871 +                                  SUPPORTED_1000baseT_Full|
14872 +                                  SUPPORTED_Autoneg |
14873 +                                  SUPPORTED_TP);
14874 +               ecmd->advertising = ADVERTISED_TP;
14875 +
14876 +               if (hw->mac.autoneg == 1) {
14877 +                       ecmd->advertising |= ADVERTISED_Autoneg;
14878 +                       /* the e1000 autoneg seems to match ethtool nicely */
14879 +                       ecmd->advertising |= hw->phy.autoneg_advertised;
14880 +               }
14881 +
14882 +               ecmd->port = PORT_TP;
14883 +               ecmd->phy_address = hw->phy.addr;
14884 +       } else {
14885 +               ecmd->supported   = (SUPPORTED_1000baseT_Full |
14886 +                                    SUPPORTED_FIBRE |
14887 +                                    SUPPORTED_Autoneg);
14888 +
14889 +               ecmd->advertising = (ADVERTISED_1000baseT_Full |
14890 +                                    ADVERTISED_FIBRE |
14891 +                                    ADVERTISED_Autoneg);
14892 +
14893 +               ecmd->port = PORT_FIBRE;
14894 +       }
14895 +
14896 +       ecmd->transceiver = XCVR_INTERNAL;
14897 +
14898 +       status = E1000_READ_REG(hw, E1000_STATUS);
14899 +
14900 +       if (status & E1000_STATUS_LU) {
14901 +
14902 +               if ((status & E1000_STATUS_SPEED_1000) ||
14903 +                   hw->phy.media_type != e1000_media_type_copper)
14904 +                       ecmd->speed = SPEED_1000;
14905 +               else if (status & E1000_STATUS_SPEED_100)
14906 +                       ecmd->speed = SPEED_100;
14907 +               else
14908 +                       ecmd->speed = SPEED_10;
14909 +
14910 +               if ((status & E1000_STATUS_FD) ||
14911 +                   hw->phy.media_type != e1000_media_type_copper)
14912 +                       ecmd->duplex = DUPLEX_FULL;
14913 +               else
14914 +                       ecmd->duplex = DUPLEX_HALF;
14915 +       } else {
14916 +               ecmd->speed = -1;
14917 +               ecmd->duplex = -1;
14918 +       }
14919 +
14920 +       ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
14921 +                        hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
14922 +       return 0;
14923 +}
14924 +
14925 +static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
14926 +{
14927 +       struct igb_adapter *adapter = netdev_priv(netdev);
14928 +       struct e1000_hw *hw = &adapter->hw;
14929 +
14930 +       /* When SoL/IDER sessions are active, autoneg/speed/duplex
14931 +        * cannot be changed */
14932 +       if (e1000_check_reset_block(hw)) {
14933 +               DPRINTK(DRV, ERR, "Cannot change link characteristics "
14934 +                       "when SoL/IDER is active.\n");
14935 +               return -EINVAL;
14936 +       }
14937 +
14938 +       while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
14939 +               msleep(1);
14940 +
14941 +       if (ecmd->autoneg == AUTONEG_ENABLE) {
14942 +               hw->mac.autoneg = 1;
14943 +               if (hw->phy.media_type == e1000_media_type_fiber)
14944 +                       hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full |
14945 +                                                    ADVERTISED_FIBRE |
14946 +                                                    ADVERTISED_Autoneg;
14947 +               else
14948 +                       hw->phy.autoneg_advertised = ecmd->advertising |
14949 +                                                    ADVERTISED_TP |
14950 +                                                    ADVERTISED_Autoneg;
14951 +               ecmd->advertising = hw->phy.autoneg_advertised;
14952 +               if (adapter->fc_autoneg)
14953 +                       hw->fc.original_type = e1000_fc_default;
14954 +       } else {
14955 +               if (igb_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
14956 +                       clear_bit(__IGB_RESETTING, &adapter->state);
14957 +                       return -EINVAL;
14958 +               }
14959 +       }
14960 +
14961 +       /* reset the link */
14962 +       if (netif_running(adapter->netdev)) {
14963 +               igb_down(adapter);
14964 +               igb_up(adapter);
14965 +       } else
14966 +               igb_reset(adapter);
14967 +
14968 +       clear_bit(__IGB_RESETTING, &adapter->state);
14969 +       return 0;
14970 +}
14971 +
14972 +static void igb_get_pauseparam(struct net_device *netdev,
14973 +                               struct ethtool_pauseparam *pause)
14974 +{
14975 +       struct igb_adapter *adapter = netdev_priv(netdev);
14976 +       struct e1000_hw *hw = &adapter->hw;
14977 +
14978 +       pause->autoneg =
14979 +               (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
14980 +
14981 +       if (hw->fc.type == e1000_fc_rx_pause)
14982 +               pause->rx_pause = 1;
14983 +       else if (hw->fc.type == e1000_fc_tx_pause)
14984 +               pause->tx_pause = 1;
14985 +       else if (hw->fc.type == e1000_fc_full) {
14986 +               pause->rx_pause = 1;
14987 +               pause->tx_pause = 1;
14988 +       }
14989 +}
14990 +
14991 +static int igb_set_pauseparam(struct net_device *netdev,
14992 +                              struct ethtool_pauseparam *pause)
14993 +{
14994 +       struct igb_adapter *adapter = netdev_priv(netdev);
14995 +       struct e1000_hw *hw = &adapter->hw;
14996 +       int retval = 0;
14997 +
14998 +       adapter->fc_autoneg = pause->autoneg;
14999 +
15000 +       while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
15001 +               msleep(1);
15002 +
15003 +       if (pause->rx_pause && pause->tx_pause)
15004 +               hw->fc.type = e1000_fc_full;
15005 +       else if (pause->rx_pause && !pause->tx_pause)
15006 +               hw->fc.type = e1000_fc_rx_pause;
15007 +       else if (!pause->rx_pause && pause->tx_pause)
15008 +               hw->fc.type = e1000_fc_tx_pause;
15009 +       else if (!pause->rx_pause && !pause->tx_pause)
15010 +               hw->fc.type = e1000_fc_none;
15011 +
15012 +       hw->fc.original_type = hw->fc.type;
15013 +
15014 +       /* reset the adapter/link to have settings take effect immediately and
15015 +        * let our link partner know as well */
15016 +       if (netif_running(adapter->netdev)) {
15017 +               igb_down(adapter);
15018 +               igb_up(adapter);
15019 +       } else {
15020 +               igb_reset(adapter);
15021 +       }
15022 +
15023 +       clear_bit(__IGB_RESETTING, &adapter->state);
15024 +       return retval;
15025 +}
15026 +
15027 +static u32 igb_get_rx_csum(struct net_device *netdev)
15028 +{
15029 +       struct igb_adapter *adapter = netdev_priv(netdev);
15030 +       return adapter->rx_csum;
15031 +}
15032 +
15033 +static int igb_set_rx_csum(struct net_device *netdev, u32 data)
15034 +{
15035 +       struct igb_adapter *adapter = netdev_priv(netdev);
15036 +       adapter->rx_csum = data;
15037 +
15038 +       return 0;
15039 +}
15040 +
15041 +static u32 igb_get_tx_csum(struct net_device *netdev)
15042 +{
15043 +       return (netdev->features & NETIF_F_IP_CSUM) != 0;
15044 +}
15045 +
15046 +static int igb_set_tx_csum(struct net_device *netdev, u32 data)
15047 +{
15048 +       if (data)
15049 +#ifdef NETIF_F_IPV6_CSUM
15050 +               netdev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
15051 +       else
15052 +               netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
15053 +#else
15054 +               netdev->features |= NETIF_F_IP_CSUM;
15055 +       else
15056 +               netdev->features &= ~NETIF_F_IP_CSUM;
15057 +#endif
15058 +
15059 +       return 0;
15060 +}
15061 +
15062 +#ifdef NETIF_F_TSO
15063 +static int igb_set_tso(struct net_device *netdev, u32 data)
15064 +{
15065 +       struct igb_adapter *adapter = netdev_priv(netdev);
15066 +       int i;
15067 +       struct net_device *v_netdev;
15068 +
15069 +       if (data) {
15070 +               netdev->features |= NETIF_F_TSO;
15071 +#ifdef NETIF_F_TSO6
15072 +               netdev->features |= NETIF_F_TSO6;
15073 +#endif
15074 +       } else {
15075 +               netdev->features &= ~NETIF_F_TSO;
15076 +#ifdef NETIF_F_TSO6
15077 +               netdev->features &= ~NETIF_F_TSO6;
15078 +#endif
15079 +               /* disable TSO on all VLANs if they're present */
15080 +               if (!adapter->vlgrp)
15081 +                       goto tso_out;
15082 +               for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
15083 +                       v_netdev = vlan_group_get_device(adapter->vlgrp, i);
15084 +                       if (!v_netdev)
15085 +                               continue;
15086 +
15087 +                       v_netdev->features &= ~NETIF_F_TSO;
15088 +#ifdef NETIF_F_TSO6
15089 +                       v_netdev->features &= ~NETIF_F_TSO6;
15090 +#endif
15091 +                       vlan_group_set_device(adapter->vlgrp, i, v_netdev);
15092 +               }
15093 +       }
15094 +
15095 +tso_out:
15096 +       DPRINTK(PROBE, INFO, "TSO is %s\n", data ? "Enabled" : "Disabled");
15097 +       return 0;
15098 +}
15099 +#endif /* NETIF_F_TSO */
15100 +
15101 +static u32 igb_get_msglevel(struct net_device *netdev)
15102 +{
15103 +       struct igb_adapter *adapter = netdev_priv(netdev);
15104 +       return adapter->msg_enable;
15105 +}
15106 +
15107 +static void igb_set_msglevel(struct net_device *netdev, u32 data)
15108 +{
15109 +       struct igb_adapter *adapter = netdev_priv(netdev);
15110 +       adapter->msg_enable = data;
15111 +}
15112 +
15113 +static int igb_get_regs_len(struct net_device *netdev)
15114 +{
15115 +#define IGB_REGS_LEN 551
15116 +       return IGB_REGS_LEN * sizeof(u32);
15117 +}
15118 +
15119 +static void igb_get_regs(struct net_device *netdev,
15120 +                        struct ethtool_regs *regs, void *p)
15121 +{
15122 +       struct igb_adapter *adapter = netdev_priv(netdev);
15123 +       struct e1000_hw *hw = &adapter->hw;
15124 +       u32 *regs_buff = p;
15125 +       u8 i;
15126 +
15127 +       memset(p, 0, IGB_REGS_LEN * sizeof(u32));
15128 +
15129 +       regs->version = (1 << 24) | (hw->revision_id << 16) | hw->device_id;
15130 +
15131 +       /* General Registers */
15132 +       regs_buff[0] = E1000_READ_REG(hw, E1000_CTRL);
15133 +       regs_buff[1] = E1000_READ_REG(hw, E1000_STATUS);
15134 +       regs_buff[2] = E1000_READ_REG(hw, E1000_CTRL_EXT);
15135 +       regs_buff[3] = E1000_READ_REG(hw, E1000_MDIC);
15136 +       regs_buff[4] = E1000_READ_REG(hw, E1000_SCTL);
15137 +       regs_buff[5] = E1000_READ_REG(hw, E1000_CONNSW);
15138 +       regs_buff[6] = E1000_READ_REG(hw, E1000_VET);
15139 +       regs_buff[7] = E1000_READ_REG(hw, E1000_LEDCTL);
15140 +       regs_buff[8] = E1000_READ_REG(hw, E1000_PBA);
15141 +       regs_buff[9] = E1000_READ_REG(hw, E1000_PBS);
15142 +       regs_buff[10] = E1000_READ_REG(hw, E1000_FRTIMER);
15143 +       regs_buff[11] = E1000_READ_REG(hw, E1000_TCPTIMER);
15144 +
15145 +       /* NVM Register */
15146 +       regs_buff[12] = E1000_READ_REG(hw, E1000_EECD);
15147 +
15148 +       /* Interrupt */
15149 +       /* Reading EICS for EICR because they read the
15150 +        * same but EICS does not clear on read */
15151 +       regs_buff[13] = E1000_READ_REG(hw, E1000_EICS);
15152 +       regs_buff[14] = E1000_READ_REG(hw, E1000_EICS);
15153 +       regs_buff[15] = E1000_READ_REG(hw, E1000_EIMS);
15154 +       regs_buff[16] = E1000_READ_REG(hw, E1000_EIMC);
15155 +       regs_buff[17] = E1000_READ_REG(hw, E1000_EIAC);
15156 +       regs_buff[18] = E1000_READ_REG(hw, E1000_EIAM);
15157 +       /* Reading ICS for ICR because they read the
15158 +        * same but ICS does not clear on read */
15159 +       regs_buff[19] = E1000_READ_REG(hw, E1000_ICS);
15160 +       regs_buff[20] = E1000_READ_REG(hw, E1000_ICS);
15161 +       regs_buff[21] = E1000_READ_REG(hw, E1000_IMS);
15162 +       regs_buff[22] = E1000_READ_REG(hw, E1000_IMC);
15163 +       regs_buff[23] = E1000_READ_REG(hw, E1000_IAC);
15164 +       regs_buff[24] = E1000_READ_REG(hw, E1000_IAM);
15165 +       regs_buff[25] = E1000_READ_REG(hw, E1000_IMIRVP);
15166 +
15167 +       /* Flow Control */
15168 +       regs_buff[26] = E1000_READ_REG(hw, E1000_FCAL);
15169 +       regs_buff[27] = E1000_READ_REG(hw, E1000_FCAH);
15170 +       regs_buff[28] = E1000_READ_REG(hw, E1000_FCTTV);
15171 +       regs_buff[29] = E1000_READ_REG(hw, E1000_FCRTL);
15172 +       regs_buff[30] = E1000_READ_REG(hw, E1000_FCRTH);
15173 +       regs_buff[31] = E1000_READ_REG(hw, E1000_FCRTV);
15174 +
15175 +       /* Receive */
15176 +       regs_buff[32] = E1000_READ_REG(hw, E1000_RCTL);
15177 +       regs_buff[33] = E1000_READ_REG(hw, E1000_RXCSUM);
15178 +       regs_buff[34] = E1000_READ_REG(hw, E1000_RLPML);
15179 +       regs_buff[35] = E1000_READ_REG(hw, E1000_RFCTL);
15180 +       regs_buff[36] = E1000_READ_REG(hw, E1000_MRQC);
15181 +       regs_buff[37] = E1000_READ_REG(hw, E1000_VT_CTL);
15182 +
15183 +       /* Transmit */
15184 +       regs_buff[38] = E1000_READ_REG(hw, E1000_TCTL);
15185 +       regs_buff[39] = E1000_READ_REG(hw, E1000_TCTL_EXT);
15186 +       regs_buff[40] = E1000_READ_REG(hw, E1000_TIPG);
15187 +       regs_buff[41] = E1000_READ_REG(hw, E1000_DTXCTL);
15188 +
15189 +       /* Wake Up */
15190 +       regs_buff[42] = E1000_READ_REG(hw, E1000_WUC);
15191 +       regs_buff[43] = E1000_READ_REG(hw, E1000_WUFC);
15192 +       regs_buff[44] = E1000_READ_REG(hw, E1000_WUS);
15193 +       regs_buff[45] = E1000_READ_REG(hw, E1000_IPAV);
15194 +       regs_buff[46] = E1000_READ_REG(hw, E1000_WUPL);
15195 +
15196 +       /* MAC */
15197 +       regs_buff[47] = E1000_READ_REG(hw, E1000_PCS_CFG0);
15198 +       regs_buff[48] = E1000_READ_REG(hw, E1000_PCS_LCTL);
15199 +       regs_buff[49] = E1000_READ_REG(hw, E1000_PCS_LSTAT);
15200 +       regs_buff[50] = E1000_READ_REG(hw, E1000_PCS_ANADV);
15201 +       regs_buff[51] = E1000_READ_REG(hw, E1000_PCS_LPAB);
15202 +       regs_buff[52] = E1000_READ_REG(hw, E1000_PCS_NPTX);
15203 +       regs_buff[53] = E1000_READ_REG(hw, E1000_PCS_LPABNP);
15204 +
15205 +       /* Statistics */
15206 +       regs_buff[54] = adapter->stats.crcerrs;
15207 +       regs_buff[55] = adapter->stats.algnerrc;
15208 +       regs_buff[56] = adapter->stats.symerrs;
15209 +       regs_buff[57] = adapter->stats.rxerrc;
15210 +       regs_buff[58] = adapter->stats.mpc;
15211 +       regs_buff[59] = adapter->stats.scc;
15212 +       regs_buff[60] = adapter->stats.ecol;
15213 +       regs_buff[61] = adapter->stats.mcc;
15214 +       regs_buff[62] = adapter->stats.latecol;
15215 +       regs_buff[63] = adapter->stats.colc;
15216 +       regs_buff[64] = adapter->stats.dc;
15217 +       regs_buff[65] = adapter->stats.tncrs;
15218 +       regs_buff[66] = adapter->stats.sec;
15219 +       regs_buff[67] = adapter->stats.htdpmc;
15220 +       regs_buff[68] = adapter->stats.rlec;
15221 +       regs_buff[69] = adapter->stats.xonrxc;
15222 +       regs_buff[70] = adapter->stats.xontxc;
15223 +       regs_buff[71] = adapter->stats.xoffrxc;
15224 +       regs_buff[72] = adapter->stats.xofftxc;
15225 +       regs_buff[73] = adapter->stats.fcruc;
15226 +       regs_buff[74] = adapter->stats.prc64;
15227 +       regs_buff[75] = adapter->stats.prc127;
15228 +       regs_buff[76] = adapter->stats.prc255;
15229 +       regs_buff[77] = adapter->stats.prc511;
15230 +       regs_buff[78] = adapter->stats.prc1023;
15231 +       regs_buff[79] = adapter->stats.prc1522;
15232 +       regs_buff[80] = adapter->stats.gprc;
15233 +       regs_buff[81] = adapter->stats.bprc;
15234 +       regs_buff[82] = adapter->stats.mprc;
15235 +       regs_buff[83] = adapter->stats.gptc;
15236 +       regs_buff[84] = adapter->stats.gorc;
15237 +       regs_buff[86] = adapter->stats.gotc;
15238 +       regs_buff[88] = adapter->stats.rnbc;
15239 +       regs_buff[89] = adapter->stats.ruc;
15240 +       regs_buff[90] = adapter->stats.rfc;
15241 +       regs_buff[91] = adapter->stats.roc;
15242 +       regs_buff[92] = adapter->stats.rjc;
15243 +       regs_buff[93] = adapter->stats.mgprc;
15244 +       regs_buff[94] = adapter->stats.mgpdc;
15245 +       regs_buff[95] = adapter->stats.mgptc;
15246 +       regs_buff[96] = adapter->stats.tor;
15247 +       regs_buff[98] = adapter->stats.tot;
15248 +       regs_buff[100] = adapter->stats.tpr;
15249 +       regs_buff[101] = adapter->stats.tpt;
15250 +       regs_buff[102] = adapter->stats.ptc64;
15251 +       regs_buff[103] = adapter->stats.ptc127;
15252 +       regs_buff[104] = adapter->stats.ptc255;
15253 +       regs_buff[105] = adapter->stats.ptc511;
15254 +       regs_buff[106] = adapter->stats.ptc1023;
15255 +       regs_buff[107] = adapter->stats.ptc1522;
15256 +       regs_buff[108] = adapter->stats.mptc;
15257 +       regs_buff[109] = adapter->stats.bptc;
15258 +       regs_buff[110] = adapter->stats.tsctc;
15259 +       regs_buff[111] = adapter->stats.iac;
15260 +       regs_buff[112] = adapter->stats.rpthc;
15261 +       regs_buff[113] = adapter->stats.hgptc;
15262 +       regs_buff[114] = adapter->stats.hgorc;
15263 +       regs_buff[116] = adapter->stats.hgotc;
15264 +       regs_buff[118] = adapter->stats.lenerrs;
15265 +       regs_buff[119] = adapter->stats.scvpc;
15266 +       regs_buff[120] = adapter->stats.hrmpc;
15267 +
15268 +       for (i = 0; i < 4; i++)
15269 +               regs_buff[121 + i] = E1000_READ_REG(hw, E1000_SRRCTL(i));
15270 +       for (i = 0; i < 4; i++)
15271 +               regs_buff[125 + i] = E1000_READ_REG(hw, E1000_PSRTYPE(i));
15272 +       for (i = 0; i < 4; i++)
15273 +               regs_buff[129 + i] = E1000_READ_REG(hw, E1000_RDBAL(i));
15274 +       for (i = 0; i < 4; i++)
15275 +               regs_buff[133 + i] = E1000_READ_REG(hw, E1000_RDBAH(i));
15276 +       for (i = 0; i < 4; i++)
15277 +               regs_buff[137 + i] = E1000_READ_REG(hw, E1000_RDLEN(i));
15278 +       for (i = 0; i < 4; i++)
15279 +               regs_buff[141 + i] = E1000_READ_REG(hw, E1000_RDH(i));
15280 +       for (i = 0; i < 4; i++)
15281 +               regs_buff[145 + i] = E1000_READ_REG(hw, E1000_RDT(i));
15282 +       for (i = 0; i < 4; i++)
15283 +               regs_buff[149 + i] = E1000_READ_REG(hw, E1000_RXDCTL(i));
15284 +
15285 +       for (i = 0; i < 10; i++)
15286 +               regs_buff[153 + i] = E1000_READ_REG(hw, E1000_EITR(i));
15287 +       for (i = 0; i < 8; i++)
15288 +               regs_buff[163 + i] = E1000_READ_REG(hw, E1000_IMIR(i));
15289 +       for (i = 0; i < 8; i++)
15290 +               regs_buff[171 + i] = E1000_READ_REG(hw, E1000_IMIREXT(i));
15291 +       for (i = 0; i < 16; i++)
15292 +               regs_buff[179 + i] = E1000_READ_REG(hw, E1000_RAL(i));
15293 +       for (i = 0; i < 16; i++)
15294 +               regs_buff[195 + i] = E1000_READ_REG(hw, E1000_RAH(i));
15295 +
15296 +       for (i = 0; i < 4; i++)
15297 +               regs_buff[211 + i] = E1000_READ_REG(hw, E1000_TDBAL(i));
15298 +       for (i = 0; i < 4; i++)
15299 +               regs_buff[215 + i] = E1000_READ_REG(hw, E1000_TDBAH(i));
15300 +       for (i = 0; i < 4; i++)
15301 +               regs_buff[219 + i] = E1000_READ_REG(hw, E1000_TDLEN(i));
15302 +       for (i = 0; i < 4; i++)
15303 +               regs_buff[223 + i] = E1000_READ_REG(hw, E1000_TDH(i));
15304 +       for (i = 0; i < 4; i++)
15305 +               regs_buff[227 + i] = E1000_READ_REG(hw, E1000_TDT(i));
15306 +       for (i = 0; i < 4; i++)
15307 +               regs_buff[231 + i] = E1000_READ_REG(hw, E1000_TXDCTL(i));
15308 +       for (i = 0; i < 4; i++)
15309 +               regs_buff[235 + i] = E1000_READ_REG(hw, E1000_TDWBAL(i));
15310 +       for (i = 0; i < 4; i++)
15311 +               regs_buff[239 + i] = E1000_READ_REG(hw, E1000_TDWBAH(i));
15312 +       for (i = 0; i < 4; i++)
15313 +               regs_buff[243 + i] = E1000_READ_REG(hw, E1000_DCA_TXCTRL(i));
15314 +
15315 +       for (i = 0; i < 4; i++)
15316 +               regs_buff[247 + i] = E1000_READ_REG(hw, E1000_IP4AT_REG(i));
15317 +       for (i = 0; i < 4; i++)
15318 +               regs_buff[251 + i] = E1000_READ_REG(hw, E1000_IP6AT_REG(i));
15319 +       for (i = 0; i < 32; i++)
15320 +               regs_buff[255 + i] = E1000_READ_REG(hw, E1000_WUPM_REG(i));
15321 +       for (i = 0; i < 128; i++)
15322 +               regs_buff[287 + i] = E1000_READ_REG(hw, E1000_FFMT_REG(i));
15323 +       for (i = 0; i < 128; i++)
15324 +               regs_buff[415 + i] = E1000_READ_REG(hw, E1000_FFVT_REG(i));
15325 +       for (i = 0; i < 4; i++)
15326 +               regs_buff[543 + i] = E1000_READ_REG(hw, E1000_FFLT_REG(i));
15327 +
15328 +       regs_buff[547] = E1000_READ_REG(hw, E1000_TDFH);
15329 +       regs_buff[548] = E1000_READ_REG(hw, E1000_TDFT);
15330 +       regs_buff[549] = E1000_READ_REG(hw, E1000_TDFHS);
15331 +       regs_buff[550] = E1000_READ_REG(hw, E1000_TDFPC);
15332 +
15333 +}
15334 +
15335 +static int igb_get_eeprom_len(struct net_device *netdev)
15336 +{
15337 +       struct igb_adapter *adapter = netdev_priv(netdev);
15338 +       return adapter->hw.nvm.word_size * 2;
15339 +}
15340 +
15341 +static int igb_get_eeprom(struct net_device *netdev,
15342 +                          struct ethtool_eeprom *eeprom, u8 *bytes)
15343 +{
15344 +       struct igb_adapter *adapter = netdev_priv(netdev);
15345 +       struct e1000_hw *hw = &adapter->hw;
15346 +       u16 *eeprom_buff;
15347 +       int first_word, last_word;
15348 +       int ret_val = 0;
15349 +       u16 i;
15350 +
15351 +       if (eeprom->len == 0)
15352 +               return -EINVAL;
15353 +
15354 +       eeprom->magic = hw->vendor_id | (hw->device_id << 16);
15355 +
15356 +       first_word = eeprom->offset >> 1;
15357 +       last_word = (eeprom->offset + eeprom->len - 1) >> 1;
15358 +
15359 +       eeprom_buff = kmalloc(sizeof(u16) *
15360 +                       (last_word - first_word + 1), GFP_KERNEL);
15361 +       if (!eeprom_buff)
15362 +               return -ENOMEM;
15363 +
15364 +       if (hw->nvm.type == e1000_nvm_eeprom_spi)
15365 +               ret_val = e1000_read_nvm(hw, first_word,
15366 +                                        last_word - first_word + 1,
15367 +                                        eeprom_buff);
15368 +       else {
15369 +               for (i = 0; i < last_word - first_word + 1; i++) {
15370 +                       ret_val = e1000_read_nvm(hw, first_word + i, 1,
15371 +                                                     &eeprom_buff[i]);
15372 +                       if (ret_val)
15373 +                               break;
15374 +               }
15375 +       }
15376 +
15377 +       /* Device's eeprom is always little-endian, word addressable */
15378 +       for (i = 0; i < last_word - first_word + 1; i++)
15379 +               le16_to_cpus(&eeprom_buff[i]);
15380 +
15381 +       memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1),
15382 +                       eeprom->len);
15383 +       kfree(eeprom_buff);
15384 +
15385 +       return ret_val;
15386 +}
15387 +
15388 +static int igb_set_eeprom(struct net_device *netdev,
15389 +                          struct ethtool_eeprom *eeprom, u8 *bytes)
15390 +{
15391 +       struct igb_adapter *adapter = netdev_priv(netdev);
15392 +       struct e1000_hw *hw = &adapter->hw;
15393 +       u16 *eeprom_buff;
15394 +       void *ptr;
15395 +       int max_len, first_word, last_word, ret_val = 0;
15396 +       u16 i;
15397 +
15398 +       if (eeprom->len == 0)
15399 +               return -EOPNOTSUPP;
15400 +
15401 +       if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16)))
15402 +               return -EFAULT;
15403 +
15404 +       max_len = hw->nvm.word_size * 2;
15405 +
15406 +       first_word = eeprom->offset >> 1;
15407 +       last_word = (eeprom->offset + eeprom->len - 1) >> 1;
15408 +       eeprom_buff = kmalloc(max_len, GFP_KERNEL);
15409 +       if (!eeprom_buff)
15410 +               return -ENOMEM;
15411 +
15412 +       ptr = (void *)eeprom_buff;
15413 +
15414 +       if (eeprom->offset & 1) {
15415 +               /* need read/modify/write of first changed EEPROM word */
15416 +               /* only the second byte of the word is being modified */
15417 +               ret_val = e1000_read_nvm(hw, first_word, 1,
15418 +                                           &eeprom_buff[0]);
15419 +               ptr++;
15420 +       }
15421 +       if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) {
15422 +               /* need read/modify/write of last changed EEPROM word */
15423 +               /* only the first byte of the word is being modified */
15424 +               ret_val = e1000_read_nvm(hw, last_word, 1,
15425 +                                 &eeprom_buff[last_word - first_word]);
15426 +       }
15427 +
15428 +       /* Device's eeprom is always little-endian, word addressable */
15429 +       for (i = 0; i < last_word - first_word + 1; i++)
15430 +               le16_to_cpus(&eeprom_buff[i]);
15431 +
15432 +       memcpy(ptr, bytes, eeprom->len);
15433 +
15434 +       for (i = 0; i < last_word - first_word + 1; i++)
15435 +               eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]);
15436 +
15437 +       ret_val = e1000_write_nvm(hw, first_word,
15438 +                                 last_word - first_word + 1, eeprom_buff);
15439 +
15440 +       /* Update the checksum over the first part of the EEPROM if needed
15441 +        * and flush shadow RAM for 82573 controllers */
15442 +       if ((ret_val == 0) && ((first_word <= NVM_CHECKSUM_REG)))
15443 +               e1000_update_nvm_checksum(hw);
15444 +
15445 +       kfree(eeprom_buff);
15446 +       return ret_val;
15447 +}
15448 +
15449 +static void igb_get_drvinfo(struct net_device *netdev,
15450 +                            struct ethtool_drvinfo *drvinfo)
15451 +{
15452 +       struct igb_adapter *adapter = netdev_priv(netdev);
15453 +       char firmware_version[32];
15454 +       u16 eeprom_data;
15455 +
15456 +       strncpy(drvinfo->driver,  igb_driver_name, 32);
15457 +       strncpy(drvinfo->version, igb_driver_version, 32);
15458 +
15459 +       /* EEPROM image version # is reported as firmware version # for
15460 +        * 82575 controllers */
15461 +       e1000_read_nvm(&adapter->hw, 5, 1, &eeprom_data);
15462 +       sprintf(firmware_version, "%d.%d-%d",
15463 +               (eeprom_data & 0xF000) >> 12,
15464 +               (eeprom_data & 0x0FF0) >> 4,
15465 +               eeprom_data & 0x000F);
15466 +
15467 +       strncpy(drvinfo->fw_version, firmware_version, 32);
15468 +       strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
15469 +       drvinfo->n_stats = IGB_STATS_LEN;
15470 +       drvinfo->testinfo_len = IGB_TEST_LEN;
15471 +       drvinfo->regdump_len = igb_get_regs_len(netdev);
15472 +       drvinfo->eedump_len = igb_get_eeprom_len(netdev);
15473 +}
15474 +
15475 +static void igb_get_ringparam(struct net_device *netdev,
15476 +                              struct ethtool_ringparam *ring)
15477 +{
15478 +       struct igb_adapter *adapter = netdev_priv(netdev);
15479 +       struct igb_ring *tx_ring = adapter->tx_ring;
15480 +       struct igb_ring *rx_ring = adapter->rx_ring;
15481 +
15482 +       ring->rx_max_pending = IGB_MAX_RXD;
15483 +       ring->tx_max_pending = IGB_MAX_TXD;
15484 +       ring->rx_mini_max_pending = 0;
15485 +       ring->rx_jumbo_max_pending = 0;
15486 +       ring->rx_pending = rx_ring->count;
15487 +       ring->tx_pending = tx_ring->count;
15488 +       ring->rx_mini_pending = 0;
15489 +       ring->rx_jumbo_pending = 0;
15490 +}
15491 +
15492 +static int igb_set_ringparam(struct net_device *netdev,
15493 +                             struct ethtool_ringparam *ring)
15494 +{
15495 +       struct igb_adapter *adapter = netdev_priv(netdev);
15496 +       struct igb_ring *temp_ring;
15497 +       int i, err;
15498 +       u32 new_rx_count, new_tx_count;
15499 +
15500 +       if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
15501 +               return -EINVAL;
15502 +
15503 +       new_rx_count = max(ring->rx_pending, (u32)IGB_MIN_RXD);
15504 +       new_rx_count = min(new_rx_count, (u32)IGB_MAX_RXD);
15505 +       new_rx_count = ALIGN(new_rx_count, REQ_RX_DESCRIPTOR_MULTIPLE);
15506 +
15507 +       new_tx_count = max(ring->tx_pending, (u32)IGB_MIN_TXD);
15508 +       new_tx_count = min(new_tx_count, (u32)IGB_MAX_TXD);
15509 +       new_tx_count = ALIGN(new_tx_count, REQ_TX_DESCRIPTOR_MULTIPLE);
15510 +
15511 +       if ((new_tx_count == adapter->tx_ring_count) &&
15512 +           (new_rx_count == adapter->rx_ring_count)) {
15513 +               /* nothing to do */
15514 +               return 0;
15515 +       }
15516 +
15517 +       if (adapter->num_tx_queues > adapter->num_rx_queues)
15518 +               temp_ring = vmalloc(adapter->num_tx_queues * sizeof(struct igb_ring));
15519 +       else
15520 +               temp_ring = vmalloc(adapter->num_rx_queues * sizeof(struct igb_ring));
15521 +       if (!temp_ring)
15522 +               return -ENOMEM;
15523 +
15524 +       while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
15525 +               msleep(1);
15526 +
15527 +       if (netif_running(adapter->netdev))
15528 +               igb_down(adapter);
15529 +
15530 +       /*
15531 +        * We can't just free everything and then setup again,
15532 +        * because the ISRs in MSI-X mode get passed pointers
15533 +        * to the tx and rx ring structs.
15534 +        */
15535 +       if (new_tx_count != adapter->tx_ring_count) {
15536 +               memcpy(temp_ring, adapter->tx_ring,
15537 +                      adapter->num_tx_queues * sizeof(struct igb_ring));
15538 +
15539 +               for (i = 0; i < adapter->num_tx_queues; i++) {
15540 +                       temp_ring[i].count = new_tx_count;
15541 +                       err = igb_setup_tx_resources(adapter, &temp_ring[i]);
15542 +                       if (err) {
15543 +                               while (i) {
15544 +                                       i--;
15545 +                                       igb_free_tx_resources(&temp_ring[i]);
15546 +                               }
15547 +                               goto err_setup;
15548 +                       }
15549 +               }
15550 +
15551 +               for (i = 0; i < adapter->num_tx_queues; i++)
15552 +                       igb_free_tx_resources(&adapter->tx_ring[i]);
15553 +
15554 +               memcpy(adapter->tx_ring, temp_ring,
15555 +                      adapter->num_tx_queues * sizeof(struct igb_ring));
15556 +
15557 +               adapter->tx_ring_count = new_tx_count;
15558 +       }
15559 +
15560 +       if (new_rx_count != adapter->rx_ring->count) {
15561 +               memcpy(temp_ring, adapter->rx_ring,
15562 +                      adapter->num_rx_queues * sizeof(struct igb_ring));
15563 +
15564 +               for (i = 0; i < adapter->num_rx_queues; i++) {
15565 +                       temp_ring[i].count = new_rx_count;
15566 +                       err = igb_setup_rx_resources(adapter, &temp_ring[i]);
15567 +                       if (err) {
15568 +                               while (i) {
15569 +                                       i--;
15570 +                                       igb_free_rx_resources(&temp_ring[i]);
15571 +                               }
15572 +                               goto err_setup;
15573 +                       }
15574 +
15575 +               }
15576 +
15577 +               for (i = 0; i < adapter->num_rx_queues; i++)
15578 +                       igb_free_rx_resources(&adapter->rx_ring[i]);
15579 +
15580 +               memcpy(adapter->rx_ring, temp_ring,
15581 +                      adapter->num_rx_queues * sizeof(struct igb_ring));
15582 +
15583 +               adapter->rx_ring_count = new_rx_count;
15584 +       }
15585 +
15586 +       err = 0;
15587 +err_setup:
15588 +       if (netif_running(adapter->netdev))
15589 +               igb_up(adapter);
15590 +
15591 +       clear_bit(__IGB_RESETTING, &adapter->state);
15592 +       vfree(temp_ring);
15593 +       return err;
15594 +}
15595 +
15596 +static bool reg_pattern_test(struct igb_adapter *adapter, u64 *data,
15597 +                            int reg, u32 mask, u32 write)
15598 +{
15599 +       struct e1000_hw *hw = &adapter->hw;
15600 +       u32 pat, val;
15601 +       static const u32 _test[] =
15602 +               {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
15603 +       for (pat = 0; pat < ARRAY_SIZE(_test); pat++) {
15604 +               E1000_WRITE_REG(hw, reg, (_test[pat] & write));
15605 +               val = E1000_READ_REG(hw, reg);
15606 +               if (val != (_test[pat] & write & mask)) {
15607 +                       DPRINTK(DRV, ERR, "pattern test reg %04X failed: got "
15608 +                               "0x%08X expected 0x%08X\n",
15609 +                               E1000_REGISTER(hw, reg), val,
15610 +                               (_test[pat] & write & mask));
15611 +                       *data = E1000_REGISTER(hw, reg);
15612 +                       return 1;
15613 +               }
15614 +       }
15615 +
15616 +       return 0;
15617 +}
15618 +
15619 +static bool reg_set_and_check(struct igb_adapter *adapter, u64 *data,
15620 +                             int reg, u32 mask, u32 write)
15621 +{
15622 +       struct e1000_hw *hw = &adapter->hw;
15623 +       u32 val;
15624 +       E1000_WRITE_REG(hw, reg, write & mask);
15625 +       val = E1000_READ_REG(hw, reg);
15626 +       if ((write & mask) != (val & mask)) {
15627 +               DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "
15628 +                       "expected 0x%08X\n", reg, (val & mask), (write & mask));
15629 +               *data = E1000_REGISTER(hw, reg);
15630 +               return 1;
15631 +       }
15632 +
15633 +       return 0;
15634 +}
15635 +
15636 +#define REG_PATTERN_TEST(reg, mask, write)                                     \
15637 +       do {                                                                   \
15638 +               if (reg_pattern_test(adapter, data, reg, mask, write))         \
15639 +                       return 1;                                              \
15640 +       } while (0)
15641 +
15642 +#define REG_SET_AND_CHECK(reg, mask, write)                                    \
15643 +       do {                                                                   \
15644 +               if (reg_set_and_check(adapter, data, reg, mask, write))              \
15645 +                       return 1;                                              \
15646 +       } while (0)
15647 +
15648 +static int igb_reg_test(struct igb_adapter *adapter, u64 *data)
15649 +{
15650 +       struct e1000_hw *hw = &adapter->hw;
15651 +       struct igb_reg_test *test;
15652 +       u32 value, before, after;
15653 +       u32 i, toggle;
15654 +
15655 +       toggle = 0x7FFFF3FF;
15656 +
15657 +       switch (adapter->hw.mac.type) {
15658 +       case e1000_82576:
15659 +               test = reg_test_82576;
15660 +               break;
15661 +       default:
15662 +               test = reg_test_82575;
15663 +               break;
15664 +       }
15665 +
15666 +       /* Because the status register is such a special case,
15667 +        * we handle it separately from the rest of the register
15668 +        * tests.  Some bits are read-only, some toggle, and some
15669 +        * are writable on newer MACs.
15670 +        */
15671 +       before = E1000_READ_REG(hw, E1000_STATUS);
15672 +       value = (E1000_READ_REG(hw, E1000_STATUS) & toggle);
15673 +       E1000_WRITE_REG(hw, E1000_STATUS, toggle);
15674 +       after = E1000_READ_REG(hw, E1000_STATUS) & toggle;
15675 +       if (value != after) {
15676 +               DPRINTK(DRV, ERR, "failed STATUS register test got: "
15677 +                       "0x%08X expected: 0x%08X\n", after, value);
15678 +               *data = 1;
15679 +               return 1;
15680 +       }
15681 +       /* restore previous status */
15682 +       E1000_WRITE_REG(hw, E1000_STATUS, before);
15683 +
15684 +       /* Perform the remainder of the register test, looping through
15685 +        * the test table until we either fail or reach the null entry.
15686 +        */
15687 +       while (test->reg) {
15688 +               for (i = 0; i < test->array_len; i++) {
15689 +                       switch (test->test_type) {
15690 +                       case PATTERN_TEST:
15691 +                               REG_PATTERN_TEST(test->reg +
15692 +                                               (i * test->reg_offset),
15693 +                                               test->mask,
15694 +                                               test->write);
15695 +                               break;
15696 +                       case SET_READ_TEST:
15697 +                               REG_SET_AND_CHECK(test->reg +
15698 +                                               (i * test->reg_offset),
15699 +                                               test->mask,
15700 +                                               test->write);
15701 +                               break;
15702 +                       case WRITE_NO_TEST:
15703 +                               writel(test->write,
15704 +                                      (adapter->hw.hw_addr + test->reg)
15705 +                                       + (i * test->reg_offset));
15706 +                               break;
15707 +                       case TABLE32_TEST:
15708 +                               REG_PATTERN_TEST(test->reg + (i * 4),
15709 +                                               test->mask,
15710 +                                               test->write);
15711 +                               break;
15712 +                       case TABLE64_TEST_LO:
15713 +                               REG_PATTERN_TEST(test->reg + (i * 8),
15714 +                                               test->mask,
15715 +                                               test->write);
15716 +                               break;
15717 +                       case TABLE64_TEST_HI:
15718 +                               REG_PATTERN_TEST((test->reg + 4) + (i * 8),
15719 +                                               test->mask,
15720 +                                               test->write);
15721 +                               break;
15722 +                       }
15723 +               }
15724 +               test++;
15725 +       }
15726 +
15727 +       *data = 0;
15728 +       return 0;
15729 +}
15730 +
15731 +static int igb_eeprom_test(struct igb_adapter *adapter, u64 *data)
15732 +{
15733 +       u16 temp;
15734 +       u16 checksum = 0;
15735 +       u16 i;
15736 +
15737 +       *data = 0;
15738 +       /* Read and add up the contents of the EEPROM */
15739 +       for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
15740 +               if ((e1000_read_nvm(&adapter->hw, i, 1, &temp)) < 0) {
15741 +                       *data = 1;
15742 +                       break;
15743 +               }
15744 +               checksum += temp;
15745 +       }
15746 +
15747 +       /* If Checksum is not Correct return error else test passed */
15748 +       if ((checksum != (u16) NVM_SUM) && !(*data))
15749 +               *data = 2;
15750 +
15751 +       return *data;
15752 +}
15753 +
15754 +static irqreturn_t igb_test_intr(int irq, void *data)
15755 +{
15756 +       struct net_device *netdev = (struct net_device *) data;
15757 +       struct igb_adapter *adapter = netdev_priv(netdev);
15758 +       struct e1000_hw *hw = &adapter->hw;
15759 +
15760 +       adapter->test_icr |= E1000_READ_REG(hw, E1000_ICR);
15761 +
15762 +       return IRQ_HANDLED;
15763 +}
15764 +
15765 +static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
15766 +{
15767 +       struct e1000_hw *hw = &adapter->hw;
15768 +       struct net_device *netdev = adapter->netdev;
15769 +       u32 mask, i=0, shared_int = TRUE;
15770 +       u32 irq = adapter->pdev->irq;
15771 +
15772 +       *data = 0;
15773 +
15774 +       /* Hook up test interrupt handler just for this test */
15775 +       if (adapter->msix_entries) {
15776 +               /* NOTE: we don't test MSI-X interrupts here, yet */
15777 +               return 0;
15778 +       } else if (adapter->flags & IGB_FLAG_HAS_MSI) {
15779 +               shared_int = FALSE;
15780 +               if (request_irq(irq, &igb_test_intr, 0, netdev->name, netdev)) {
15781 +                       *data = 1;
15782 +                       return -1;
15783 +               }
15784 +       } else if (!request_irq(irq, &igb_test_intr, IRQF_PROBE_SHARED,
15785 +                               netdev->name, netdev)) {
15786 +               shared_int = FALSE;
15787 +       }
15788 +       else if (request_irq(irq, &igb_test_intr, IRQF_SHARED,
15789 +                netdev->name, netdev)) {
15790 +               *data = 1;
15791 +               return -1;
15792 +       }
15793 +       DPRINTK(HW, INFO, "testing %s interrupt\n",
15794 +               (shared_int ? "shared" : "unshared"));
15795 +
15796 +       /* Disable all the interrupts */
15797 +       E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
15798 +       msleep(10);
15799 +
15800 +       /* Test each interrupt */
15801 +       for (; i < 10; i++) {
15802 +               /* Interrupt to test */
15803 +               mask = 1 << i;
15804 +
15805 +               if (!shared_int) {
15806 +                       /* Disable the interrupt to be reported in
15807 +                        * the cause register and then force the same
15808 +                        * interrupt and see if one gets posted.  If
15809 +                        * an interrupt was posted to the bus, the
15810 +                        * test failed.
15811 +                        */
15812 +                       adapter->test_icr = 0;
15813 +                       E1000_WRITE_REG(hw, E1000_IMC, ~mask & 0x00007FFF);
15814 +                       E1000_WRITE_REG(hw, E1000_ICS, ~mask & 0x00007FFF);
15815 +                       msleep(10);
15816 +
15817 +                       if (adapter->test_icr & mask) {
15818 +                               *data = 3;
15819 +                               break;
15820 +                       }
15821 +               }
15822 +
15823 +               /* Enable the interrupt to be reported in
15824 +                * the cause register and then force the same
15825 +                * interrupt and see if one gets posted.  If
15826 +                * an interrupt was not posted to the bus, the
15827 +                * test failed.
15828 +                */
15829 +               adapter->test_icr = 0;
15830 +               E1000_WRITE_REG(hw, E1000_IMS, mask);
15831 +               E1000_WRITE_REG(hw, E1000_ICS, mask);
15832 +               msleep(10);
15833 +
15834 +               if (!(adapter->test_icr & mask)) {
15835 +                       *data = 4;
15836 +                       break;
15837 +               }
15838 +
15839 +               if (!shared_int) {
15840 +                       /* Disable the other interrupts to be reported in
15841 +                        * the cause register and then force the other
15842 +                        * interrupts and see if any get posted.  If
15843 +                        * an interrupt was posted to the bus, the
15844 +                        * test failed.
15845 +                        */
15846 +                       adapter->test_icr = 0;
15847 +                       E1000_WRITE_REG(hw, E1000_IMC, ~mask & 0x00007FFF);
15848 +                       E1000_WRITE_REG(hw, E1000_ICS, ~mask & 0x00007FFF);
15849 +                       msleep(10);
15850 +
15851 +                       if (adapter->test_icr) {
15852 +                               *data = 5;
15853 +                               break;
15854 +                       }
15855 +               }
15856 +       }
15857 +
15858 +       /* Disable all the interrupts */
15859 +       E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
15860 +       msleep(10);
15861 +
15862 +       /* Unhook test interrupt handler */
15863 +       free_irq(irq, netdev);
15864 +
15865 +       return *data;
15866 +}
15867 +
15868 +static void igb_free_desc_rings(struct igb_adapter *adapter)
15869 +{
15870 +       struct igb_ring *tx_ring = &adapter->test_tx_ring;
15871 +       struct igb_ring *rx_ring = &adapter->test_rx_ring;
15872 +       struct pci_dev *pdev = adapter->pdev;
15873 +       int i;
15874 +
15875 +       if (tx_ring->desc && tx_ring->buffer_info) {
15876 +               for (i = 0; i < tx_ring->count; i++) {
15877 +                       struct igb_buffer *buf = &(tx_ring->buffer_info[i]);
15878 +                       if (buf->dma)
15879 +                               pci_unmap_single(pdev, buf->dma, buf->length,
15880 +                                                PCI_DMA_TODEVICE);
15881 +                       if (buf->skb)
15882 +                               dev_kfree_skb(buf->skb);
15883 +               }
15884 +       }
15885 +
15886 +       if (rx_ring->desc && rx_ring->buffer_info) {
15887 +               for (i = 0; i < rx_ring->count; i++) {
15888 +                       struct igb_buffer *buf = &(rx_ring->buffer_info[i]);
15889 +                       if (buf->dma)
15890 +                               pci_unmap_single(pdev, buf->dma,
15891 +                                                IGB_RXBUFFER_2048,
15892 +                                                PCI_DMA_FROMDEVICE);
15893 +                       if (buf->skb)
15894 +                               dev_kfree_skb(buf->skb);
15895 +               }
15896 +       }
15897 +
15898 +       if (tx_ring->desc) {
15899 +               pci_free_consistent(pdev, tx_ring->size, tx_ring->desc,
15900 +                                   tx_ring->dma);
15901 +               tx_ring->desc = NULL;
15902 +       }
15903 +       if (rx_ring->desc) {
15904 +               pci_free_consistent(pdev, rx_ring->size, rx_ring->desc,
15905 +                                   rx_ring->dma);
15906 +               rx_ring->desc = NULL;
15907 +       }
15908 +
15909 +       kfree(tx_ring->buffer_info);
15910 +       tx_ring->buffer_info = NULL;
15911 +       kfree(rx_ring->buffer_info);
15912 +       rx_ring->buffer_info = NULL;
15913 +
15914 +       return;
15915 +}
15916 +
15917 +static int igb_setup_desc_rings(struct igb_adapter *adapter)
15918 +{
15919 +       struct e1000_hw *hw = &adapter->hw;
15920 +       struct igb_ring *tx_ring = &adapter->test_tx_ring;
15921 +       struct igb_ring *rx_ring = &adapter->test_rx_ring;
15922 +       struct pci_dev *pdev = adapter->pdev;
15923 +       u32 rctl;
15924 +       int i, ret_val;
15925 +
15926 +       /* Setup Tx descriptor ring and Tx buffers */
15927 +
15928 +       if (!tx_ring->count)
15929 +               tx_ring->count = IGB_DEFAULT_TXD;
15930 +
15931 +       if (!(tx_ring->buffer_info = kcalloc(tx_ring->count,
15932 +                                            sizeof(struct igb_buffer),
15933 +                                            GFP_KERNEL))) {
15934 +               ret_val = 1;
15935 +               goto err_nomem;
15936 +       }
15937 +
15938 +       tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc);
15939 +       tx_ring->size = ALIGN(tx_ring->size, 4096);
15940 +       if (!(tx_ring->desc = pci_alloc_consistent(pdev, tx_ring->size,
15941 +                                                  &tx_ring->dma))) {
15942 +               ret_val = 2;
15943 +               goto err_nomem;
15944 +       }
15945 +       tx_ring->next_to_use = tx_ring->next_to_clean = 0;
15946 +
15947 +       E1000_WRITE_REG(hw, E1000_TDBAL(0),
15948 +                       ((u64) tx_ring->dma & 0x00000000FFFFFFFF));
15949 +       E1000_WRITE_REG(hw, E1000_TDBAH(0), ((u64) tx_ring->dma >> 32));
15950 +       E1000_WRITE_REG(hw, E1000_TDLEN(0),
15951 +                       tx_ring->count * sizeof(struct e1000_tx_desc));
15952 +       E1000_WRITE_REG(hw, E1000_TDH(0), 0);
15953 +       E1000_WRITE_REG(hw, E1000_TDT(0), 0);
15954 +       E1000_WRITE_REG(hw, E1000_TCTL,
15955 +                       E1000_TCTL_PSP | E1000_TCTL_EN |
15956 +                       E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT |
15957 +                       E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT);
15958 +
15959 +       for (i = 0; i < tx_ring->count; i++) {
15960 +               struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i);
15961 +               struct sk_buff *skb;
15962 +               unsigned int size = 1024;
15963 +
15964 +               if (!(skb = alloc_skb(size, GFP_KERNEL))) {
15965 +                       ret_val = 3;
15966 +                       goto err_nomem;
15967 +               }
15968 +               skb_put(skb, size);
15969 +               tx_ring->buffer_info[i].skb = skb;
15970 +               tx_ring->buffer_info[i].length = skb->len;
15971 +               tx_ring->buffer_info[i].dma =
15972 +                       pci_map_single(pdev, skb->data, skb->len,
15973 +                                      PCI_DMA_TODEVICE);
15974 +               tx_desc->buffer_addr = cpu_to_le64(tx_ring->buffer_info[i].dma);
15975 +               tx_desc->lower.data = cpu_to_le32(skb->len);
15976 +               tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP |
15977 +                                                  E1000_TXD_CMD_IFCS |
15978 +                                                  E1000_TXD_CMD_RS);
15979 +               tx_desc->upper.data = 0;
15980 +       }
15981 +
15982 +       /* Setup Rx descriptor ring and Rx buffers */
15983 +
15984 +       if (!rx_ring->count)
15985 +               rx_ring->count = IGB_DEFAULT_RXD;
15986 +
15987 +       if (!(rx_ring->buffer_info = kcalloc(rx_ring->count,
15988 +                                            sizeof(struct igb_buffer),
15989 +                                            GFP_KERNEL))) {
15990 +               ret_val = 4;
15991 +               goto err_nomem;
15992 +       }
15993 +
15994 +       rx_ring->size = rx_ring->count * sizeof(struct e1000_rx_desc);
15995 +       if (!(rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size,
15996 +                                                  &rx_ring->dma))) {
15997 +               ret_val = 5;
15998 +               goto err_nomem;
15999 +       }
16000 +       rx_ring->next_to_use = rx_ring->next_to_clean = 0;
16001 +
16002 +       rctl = E1000_READ_REG(hw, E1000_RCTL);
16003 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN);
16004 +       E1000_WRITE_REG(hw, E1000_RDBAL(0),
16005 +                       ((u64) rx_ring->dma & 0xFFFFFFFF));
16006 +       E1000_WRITE_REG(hw, E1000_RDBAH(0), ((u64) rx_ring->dma >> 32));
16007 +       E1000_WRITE_REG(hw, E1000_RDLEN(0), rx_ring->size);
16008 +       E1000_WRITE_REG(hw, E1000_RDH(0), 0);
16009 +       E1000_WRITE_REG(hw, E1000_RDT(0), 0);
16010 +       rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 |
16011 +               E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
16012 +               (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
16013 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl);
16014 +       E1000_WRITE_REG(hw, E1000_SRRCTL(0), 0);
16015 +
16016 +       for (i = 0; i < rx_ring->count; i++) {
16017 +               struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i);
16018 +               struct sk_buff *skb;
16019 +
16020 +               skb = alloc_skb(IGB_RXBUFFER_2048 + NET_IP_ALIGN,
16021 +                               GFP_KERNEL);
16022 +               if (!skb) {
16023 +                       ret_val = 6;
16024 +                       goto err_nomem;
16025 +               }
16026 +               skb_reserve(skb, NET_IP_ALIGN);
16027 +               rx_ring->buffer_info[i].skb = skb;
16028 +               rx_ring->buffer_info[i].dma =
16029 +                       pci_map_single(pdev, skb->data, IGB_RXBUFFER_2048,
16030 +                                      PCI_DMA_FROMDEVICE);
16031 +               rx_desc->buffer_addr = cpu_to_le64(rx_ring->buffer_info[i].dma);
16032 +               memset(skb->data, 0x00, skb->len);
16033 +       }
16034 +
16035 +       return 0;
16036 +
16037 +err_nomem:
16038 +       igb_free_desc_rings(adapter);
16039 +       return ret_val;
16040 +}
16041 +
16042 +static void igb_phy_disable_receiver(struct igb_adapter *adapter)
16043 +{
16044 +       /* Write out to PHY registers 29 and 30 to disable the Receiver. */
16045 +       e1000_write_phy_reg(&adapter->hw, 29, 0x001F);
16046 +       e1000_write_phy_reg(&adapter->hw, 30, 0x8FFC);
16047 +       e1000_write_phy_reg(&adapter->hw, 29, 0x001A);
16048 +       e1000_write_phy_reg(&adapter->hw, 30, 0x8FF0);
16049 +}
16050 +
16051 +static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
16052 +{
16053 +       struct e1000_hw *hw = &adapter->hw;
16054 +       u32 ctrl_reg = 0;
16055 +       u32 stat_reg = 0;
16056 +
16057 +       hw->mac.autoneg = FALSE;
16058 +
16059 +       if (hw->phy.type == e1000_phy_m88) {
16060 +               /* Auto-MDI/MDIX Off */
16061 +               e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
16062 +               /* reset to update Auto-MDI/MDIX */
16063 +               e1000_write_phy_reg(hw, PHY_CONTROL, 0x9140);
16064 +               /* autoneg off */
16065 +               e1000_write_phy_reg(hw, PHY_CONTROL, 0x8140);
16066 +       }
16067 +
16068 +       ctrl_reg = E1000_READ_REG(hw, E1000_CTRL);
16069 +
16070 +       /* force 1000, set loopback */
16071 +       e1000_write_phy_reg(hw, PHY_CONTROL, 0x4140);
16072 +
16073 +       /* Now set up the MAC to the same speed/duplex as the PHY. */
16074 +       ctrl_reg = E1000_READ_REG(hw, E1000_CTRL);
16075 +       ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */
16076 +       ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */
16077 +                    E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */
16078 +                    E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */
16079 +                    E1000_CTRL_FD);     /* Force Duplex to FULL */
16080 +
16081 +       if (hw->phy.media_type == e1000_media_type_copper &&
16082 +           hw->phy.type == e1000_phy_m88)
16083 +               ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
16084 +       else {
16085 +               /* Set the ILOS bit on the fiber Nic if half duplex link is
16086 +                * detected. */
16087 +               stat_reg = E1000_READ_REG(hw, E1000_STATUS);
16088 +               if ((stat_reg & E1000_STATUS_FD) == 0)
16089 +                       ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU);
16090 +       }
16091 +
16092 +       E1000_WRITE_REG(hw, E1000_CTRL, ctrl_reg);
16093 +
16094 +       /* Disable the receiver on the PHY so when a cable is plugged in, the
16095 +        * PHY does not begin to autoneg when a cable is reconnected to the NIC.
16096 +        */
16097 +       if (hw->phy.type == e1000_phy_m88)
16098 +               igb_phy_disable_receiver(adapter);
16099 +
16100 +       udelay(500);
16101 +
16102 +       return 0;
16103 +}
16104 +
16105 +static int igb_set_phy_loopback(struct igb_adapter *adapter)
16106 +{
16107 +       return igb_integrated_phy_loopback(adapter);
16108 +}
16109 +
16110 +static int igb_setup_loopback_test(struct igb_adapter *adapter)
16111 +{
16112 +       struct e1000_hw *hw = &adapter->hw;
16113 +       u32 reg;
16114 +
16115 +       if (hw->phy.media_type == e1000_media_type_fiber ||
16116 +           hw->phy.media_type == e1000_media_type_internal_serdes) {
16117 +
16118 +               reg = E1000_READ_REG(hw, E1000_RCTL);
16119 +               reg |= E1000_RCTL_LBM_TCVR;
16120 +               E1000_WRITE_REG(hw, E1000_RCTL, reg);
16121 +
16122 +               E1000_WRITE_REG(hw, E1000_SCTL, E1000_ENABLE_SERDES_LOOPBACK);
16123 +
16124 +               reg = E1000_READ_REG(hw, E1000_CTRL);
16125 +               reg &= ~(E1000_CTRL_RFCE |
16126 +                        E1000_CTRL_TFCE |
16127 +                        E1000_CTRL_LRST);
16128 +               reg |= E1000_CTRL_SLU |
16129 +                      E1000_CTRL_FD;
16130 +               E1000_WRITE_REG(hw, E1000_CTRL, reg);
16131 +
16132 +               /* Unset switch control to serdes energy detect */
16133 +               reg = E1000_READ_REG(hw, E1000_CONNSW);
16134 +               reg &= ~E1000_CONNSW_ENRGSRC;
16135 +               E1000_WRITE_REG(hw, E1000_CONNSW, reg);
16136 +
16137 +               /* Set PCS register for forced speed */
16138 +               reg = E1000_READ_REG(hw, E1000_PCS_LCTL);
16139 +               reg &= ~E1000_PCS_LCTL_AN_ENABLE;     /* Disable Autoneg*/
16140 +               reg |= E1000_PCS_LCTL_FLV_LINK_UP |   /* Force link up */
16141 +                      E1000_PCS_LCTL_FSV_1000 |      /* Force 1000    */
16142 +                      E1000_PCS_LCTL_FDV_FULL |      /* SerDes Full duplex */
16143 +                      E1000_PCS_LCTL_FSD |           /* Force Speed */
16144 +                      E1000_PCS_LCTL_FORCE_LINK;     /* Force Link */
16145 +               E1000_WRITE_REG(hw, E1000_PCS_LCTL, reg);
16146 +
16147 +               return 0;
16148 +       } else if (hw->phy.media_type == e1000_media_type_copper) {
16149 +               return igb_set_phy_loopback(adapter);
16150 +       }
16151 +
16152 +       return 7;
16153 +}
16154 +
16155 +static void igb_loopback_cleanup(struct igb_adapter *adapter)
16156 +{
16157 +       struct e1000_hw *hw = &adapter->hw;
16158 +       u32 rctl;
16159 +       u16 phy_reg;
16160 +
16161 +       rctl = E1000_READ_REG(hw, E1000_RCTL);
16162 +       rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC);
16163 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl);
16164 +
16165 +       hw->mac.autoneg = TRUE;
16166 +       e1000_read_phy_reg(hw, PHY_CONTROL, &phy_reg);
16167 +       if (phy_reg & MII_CR_LOOPBACK) {
16168 +               phy_reg &= ~MII_CR_LOOPBACK;
16169 +               e1000_write_phy_reg(hw, PHY_CONTROL, phy_reg);
16170 +               e1000_phy_commit(hw);
16171 +       }
16172 +}
16173 +
16174 +static void igb_create_lbtest_frame(struct sk_buff *skb,
16175 +                                    unsigned int frame_size)
16176 +{
16177 +       memset(skb->data, 0xFF, frame_size);
16178 +       frame_size &= ~1;
16179 +       memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 - 1);
16180 +       memset(&skb->data[frame_size / 2 + 10], 0xBE, 1);
16181 +       memset(&skb->data[frame_size / 2 + 12], 0xAF, 1);
16182 +}
16183 +
16184 +static int igb_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size)
16185 +{
16186 +       frame_size &= ~1;
16187 +       if (*(skb->data + 3) == 0xFF) {
16188 +               if ((*(skb->data + frame_size / 2 + 10) == 0xBE) &&
16189 +                  (*(skb->data + frame_size / 2 + 12) == 0xAF)) {
16190 +                       return 0;
16191 +               }
16192 +       }
16193 +       return 13;
16194 +}
16195 +
16196 +static int igb_run_loopback_test(struct igb_adapter *adapter)
16197 +{
16198 +       struct e1000_hw *hw = &adapter->hw;
16199 +       struct igb_ring *tx_ring = &adapter->test_tx_ring;
16200 +       struct igb_ring *rx_ring = &adapter->test_rx_ring;
16201 +       struct pci_dev *pdev = adapter->pdev;
16202 +       int i, j, k, l, lc, good_cnt, ret_val=0;
16203 +       unsigned long time;
16204 +
16205 +       E1000_WRITE_REG(hw, E1000_RDT(0), rx_ring->count - 1);
16206 +
16207 +       /* Calculate the loop count based on the largest descriptor ring
16208 +        * The idea is to wrap the largest ring a number of times using 64
16209 +        * send/receive pairs during each loop
16210 +        */
16211 +
16212 +       if (rx_ring->count <= tx_ring->count)
16213 +               lc = ((tx_ring->count / 64) * 2) + 1;
16214 +       else
16215 +               lc = ((rx_ring->count / 64) * 2) + 1;
16216 +
16217 +       k = l = 0;
16218 +       for (j = 0; j <= lc; j++) { /* loop count loop */
16219 +               for (i = 0; i < 64; i++) { /* send the packets */
16220 +                       igb_create_lbtest_frame(tx_ring->buffer_info[k].skb,
16221 +                                               1024);
16222 +                       pci_dma_sync_single_for_device(pdev,
16223 +                               tx_ring->buffer_info[k].dma,
16224 +                               tx_ring->buffer_info[k].length,
16225 +                               PCI_DMA_TODEVICE);
16226 +                       if (unlikely(++k == tx_ring->count)) k = 0;
16227 +               }
16228 +               E1000_WRITE_REG(hw, E1000_TDT(0), k);
16229 +               msleep(200);
16230 +
16231 +               time = jiffies; /* set the start time for the receive */
16232 +               good_cnt = 0;
16233 +               do { /* receive the sent packets */
16234 +                       pci_dma_sync_single_for_cpu(pdev,
16235 +                                       rx_ring->buffer_info[l].dma,
16236 +                                       IGB_RXBUFFER_2048,
16237 +                                       PCI_DMA_FROMDEVICE);
16238 +
16239 +                       ret_val = igb_check_lbtest_frame(
16240 +                                            rx_ring->buffer_info[l].skb, 1024);
16241 +                       if (!ret_val)
16242 +                               good_cnt++;
16243 +                       if (unlikely(++l == rx_ring->count)) l = 0;
16244 +                       /* time + 20 msecs (200 msecs on 2.4) is more than
16245 +                        * enough time to complete the receives, if it's
16246 +                        * exceeded, break and error off
16247 +                        */
16248 +               } while (good_cnt < 64 && jiffies < (time + 20));
16249 +               if (good_cnt != 64) {
16250 +                       ret_val = 13; /* ret_val is the same as mis-compare */
16251 +                       break;
16252 +               }
16253 +               if (jiffies >= (time + 20)) {
16254 +                       ret_val = 14; /* error code for time out error */
16255 +                       break;
16256 +               }
16257 +       } /* end loop count loop */
16258 +       return ret_val;
16259 +}
16260 +
16261 +static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)
16262 +{
16263 +       /* PHY loopback cannot be performed if SoL/IDER
16264 +        * sessions are active */
16265 +       if (e1000_check_reset_block(&adapter->hw)) {
16266 +               DPRINTK(DRV, ERR, "Cannot do PHY loopback test "
16267 +                       "when SoL/IDER is active.\n");
16268 +               *data = 0;
16269 +               goto out;
16270 +       }
16271 +       *data = igb_setup_desc_rings(adapter);
16272 +       if (*data)
16273 +               goto out;
16274 +       *data = igb_setup_loopback_test(adapter);
16275 +       if (*data)
16276 +               goto err_loopback;
16277 +       *data = igb_run_loopback_test(adapter);
16278 +       igb_loopback_cleanup(adapter);
16279 +
16280 +err_loopback:
16281 +       igb_free_desc_rings(adapter);
16282 +out:
16283 +       return *data;
16284 +}
16285 +
16286 +static int igb_link_test(struct igb_adapter *adapter, u64 *data)
16287 +{
16288 +       struct e1000_hw *hw = &adapter->hw;
16289 +       *data = 0;
16290 +       if (adapter->hw.phy.media_type == e1000_media_type_internal_serdes) {
16291 +               int i = 0;
16292 +               adapter->hw.mac.serdes_has_link = FALSE;
16293 +
16294 +               /* On some blade server designs, link establishment
16295 +                * could take as long as 2-3 minutes */
16296 +               do {
16297 +                       e1000_check_for_link(&adapter->hw);
16298 +                       if (adapter->hw.mac.serdes_has_link)
16299 +                               return *data;
16300 +                       msleep(20);
16301 +               } while (i++ < 3750);
16302 +
16303 +               *data = 1;
16304 +       } else {
16305 +               e1000_check_for_link(&adapter->hw);
16306 +               if (adapter->hw.mac.autoneg)
16307 +                       msleep(4000);
16308 +
16309 +               if (!(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU))
16310 +                       *data = 1;
16311 +       }
16312 +       return *data;
16313 +}
16314 +
16315 +static int igb_diag_test_count(struct net_device *netdev)
16316 +{
16317 +       return IGB_TEST_LEN;
16318 +}
16319 +
16320 +static void igb_diag_test(struct net_device *netdev,
16321 +                          struct ethtool_test *eth_test, u64 *data)
16322 +{
16323 +       struct igb_adapter *adapter = netdev_priv(netdev);
16324 +       u16 autoneg_advertised;
16325 +       u8 forced_speed_duplex, autoneg;
16326 +       bool if_running = netif_running(netdev);
16327 +
16328 +       set_bit(__IGB_TESTING, &adapter->state);
16329 +       if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
16330 +               /* Offline tests */
16331 +
16332 +               /* save speed, duplex, autoneg settings */
16333 +               autoneg_advertised = adapter->hw.phy.autoneg_advertised;
16334 +               forced_speed_duplex = adapter->hw.mac.forced_speed_duplex;
16335 +               autoneg = adapter->hw.mac.autoneg;
16336 +
16337 +               DPRINTK(HW, INFO, "offline testing starting\n");
16338 +
16339 +               /* Link test performed before hardware reset so autoneg doesn't
16340 +                * interfere with test result */
16341 +               if (igb_link_test(adapter, &data[4]))
16342 +                       eth_test->flags |= ETH_TEST_FL_FAILED;
16343 +
16344 +               if (if_running)
16345 +                       /* indicate we're in test mode */
16346 +                       dev_close(netdev);
16347 +               else
16348 +                       igb_reset(adapter);
16349 +
16350 +               if (igb_reg_test(adapter, &data[0]))
16351 +                       eth_test->flags |= ETH_TEST_FL_FAILED;
16352 +
16353 +               igb_reset(adapter);
16354 +               if (igb_eeprom_test(adapter, &data[1]))
16355 +                       eth_test->flags |= ETH_TEST_FL_FAILED;
16356 +
16357 +               igb_reset(adapter);
16358 +               if (igb_intr_test(adapter, &data[2]))
16359 +                       eth_test->flags |= ETH_TEST_FL_FAILED;
16360 +
16361 +               igb_reset(adapter);
16362 +               if (igb_loopback_test(adapter, &data[3]))
16363 +                       eth_test->flags |= ETH_TEST_FL_FAILED;
16364 +
16365 +               /* restore speed, duplex, autoneg settings */
16366 +               adapter->hw.phy.autoneg_advertised = autoneg_advertised;
16367 +               adapter->hw.mac.forced_speed_duplex = forced_speed_duplex;
16368 +               adapter->hw.mac.autoneg = autoneg;
16369 +
16370 +               /* force this routine to wait until autoneg complete/timeout */
16371 +               adapter->hw.phy.autoneg_wait_to_complete = TRUE;
16372 +               igb_reset(adapter);
16373 +               adapter->hw.phy.autoneg_wait_to_complete = FALSE;
16374 +
16375 +               clear_bit(__IGB_TESTING, &adapter->state);
16376 +               if (if_running)
16377 +                       dev_open(netdev);
16378 +       } else {
16379 +               DPRINTK(HW, INFO, "online testing starting\n");
16380 +               /* Online tests */
16381 +               if (igb_link_test(adapter, &data[4]))
16382 +                       eth_test->flags |= ETH_TEST_FL_FAILED;
16383 +
16384 +               /* Online tests aren't run; pass by default */
16385 +               data[0] = 0;
16386 +               data[1] = 0;
16387 +               data[2] = 0;
16388 +               data[3] = 0;
16389 +
16390 +               clear_bit(__IGB_TESTING, &adapter->state);
16391 +       }
16392 +       msleep_interruptible(4 * 1000);
16393 +}
16394 +
16395 +static int igb_wol_exclusion(struct igb_adapter *adapter,
16396 +                             struct ethtool_wolinfo *wol)
16397 +{
16398 +       struct e1000_hw *hw = &adapter->hw;
16399 +       int retval = 1; /* fail by default */
16400 +
16401 +       switch (hw->device_id) {
16402 +       case E1000_DEV_ID_82575GB_QUAD_COPPER:
16403 +               /* WoL not supported */
16404 +               wol->supported = 0;
16405 +               break;
16406 +       case E1000_DEV_ID_82575EB_FIBER_SERDES:
16407 +       case E1000_DEV_ID_82576_FIBER:
16408 +       case E1000_DEV_ID_82576_SERDES:
16409 +               /* Wake events not supported on port B */
16410 +               if (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_FUNC_1) {
16411 +                       wol->supported = 0;
16412 +                       break;
16413 +               }
16414 +               /* return success for non excluded adapter ports */
16415 +               retval = 0;
16416 +               break;
16417 +       default:
16418 +               /* dual port cards only support WoL on port A from now on
16419 +                * unless it was enabled in the eeprom for port B
16420 +                * so exclude FUNC_1 ports from having WoL enabled */
16421 +               if (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_FUNC_1 &&
16422 +                   !adapter->eeprom_wol) {
16423 +                       wol->supported = 0;
16424 +                       break;
16425 +               }
16426 +
16427 +               retval = 0;
16428 +       }
16429 +
16430 +       return retval;
16431 +}
16432 +
16433 +static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
16434 +{
16435 +       struct igb_adapter *adapter = netdev_priv(netdev);
16436 +
16437 +       wol->supported = WAKE_UCAST | WAKE_MCAST |
16438 +                        WAKE_BCAST | WAKE_MAGIC;
16439 +       wol->wolopts = 0;
16440 +
16441 +       /* this function will set ->supported = 0 and return 1 if wol is not
16442 +        * supported by this hardware */
16443 +       if (igb_wol_exclusion(adapter, wol))
16444 +               return;
16445 +
16446 +       /* apply any specific unsupported masks here */
16447 +       switch (adapter->hw.device_id) {
16448 +       default:
16449 +               break;
16450 +       }
16451 +
16452 +       if (adapter->wol & E1000_WUFC_EX)
16453 +               wol->wolopts |= WAKE_UCAST;
16454 +       if (adapter->wol & E1000_WUFC_MC)
16455 +               wol->wolopts |= WAKE_MCAST;
16456 +       if (adapter->wol & E1000_WUFC_BC)
16457 +               wol->wolopts |= WAKE_BCAST;
16458 +       if (adapter->wol & E1000_WUFC_MAG)
16459 +               wol->wolopts |= WAKE_MAGIC;
16460 +
16461 +       return;
16462 +}
16463 +
16464 +static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
16465 +{
16466 +       struct igb_adapter *adapter = netdev_priv(netdev);
16467 +       struct e1000_hw *hw = &adapter->hw;
16468 +
16469 +       if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
16470 +               return -EOPNOTSUPP;
16471 +
16472 +       if (igb_wol_exclusion(adapter, wol))
16473 +               return wol->wolopts ? -EOPNOTSUPP : 0;
16474 +
16475 +       switch (hw->device_id) {
16476 +       default:
16477 +               break;
16478 +       }
16479 +
16480 +       /* these settings will always override what we currently have */
16481 +       adapter->wol = 0;
16482 +
16483 +       if (wol->wolopts & WAKE_UCAST)
16484 +               adapter->wol |= E1000_WUFC_EX;
16485 +       if (wol->wolopts & WAKE_MCAST)
16486 +               adapter->wol |= E1000_WUFC_MC;
16487 +       if (wol->wolopts & WAKE_BCAST)
16488 +               adapter->wol |= E1000_WUFC_BC;
16489 +       if (wol->wolopts & WAKE_MAGIC)
16490 +               adapter->wol |= E1000_WUFC_MAG;
16491 +
16492 +       return 0;
16493 +}
16494 +
16495 +/* toggle LED 4 times per second = 2 "blinks" per second */
16496 +#define IGB_ID_INTERVAL                (HZ/4)
16497 +
16498 +/* bit defines for adapter->led_status */
16499 +#define IGB_LED_ON             0
16500 +
16501 +static int igb_phys_id(struct net_device *netdev, u32 data)
16502 +{
16503 +       struct igb_adapter *adapter = netdev_priv(netdev);
16504 +       struct e1000_hw *hw = &adapter->hw;
16505 +
16506 +       if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
16507 +               data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
16508 +
16509 +       e1000_blink_led(hw);
16510 +       msleep_interruptible(data * 1000);
16511 +
16512 +       e1000_led_off(hw);
16513 +       clear_bit(IGB_LED_ON, &adapter->led_status);
16514 +       e1000_cleanup_led(hw);
16515 +
16516 +       return 0;
16517 +}
16518 +
16519 +static int igb_set_coalesce(struct net_device *netdev,
16520 +                           struct ethtool_coalesce *ec)
16521 +{
16522 +       struct igb_adapter *adapter = netdev_priv(netdev);
16523 +       struct e1000_hw *hw = &adapter->hw;
16524 +       int i;
16525 +
16526 +       if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) ||
16527 +           ((ec->rx_coalesce_usecs > 3) &&
16528 +            (ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) ||
16529 +           (ec->rx_coalesce_usecs == 2))
16530 +               return -EINVAL;
16531 +
16532 +       /* convert to rate of irq's per second */
16533 +       if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) {
16534 +               adapter->itr = IGB_START_ITR;
16535 +               adapter->itr_setting = ec->rx_coalesce_usecs;
16536 +       } else {
16537 +               adapter->itr = ec->rx_coalesce_usecs << 2;
16538 +               adapter->itr_setting = adapter->itr;
16539 +       }
16540 +
16541 +       for (i = 0; i < adapter->num_rx_queues; i++)
16542 +               writel(adapter->itr,
16543 +                      hw->hw_addr + adapter->rx_ring[i].itr_register);
16544 +
16545 +       return 0;
16546 +}
16547 +
16548 +static int igb_get_coalesce(struct net_device *netdev,
16549 +                           struct ethtool_coalesce *ec)
16550 +{
16551 +       struct igb_adapter *adapter = netdev_priv(netdev);
16552 +
16553 +       if (adapter->itr_setting <= 3)
16554 +               ec->rx_coalesce_usecs = adapter->itr_setting;
16555 +       else
16556 +               ec->rx_coalesce_usecs = adapter->itr_setting >> 2;
16557 +
16558 +       return 0;
16559 +}
16560 +
16561 +static int igb_nway_reset(struct net_device *netdev)
16562 +{
16563 +       struct igb_adapter *adapter = netdev_priv(netdev);
16564 +       if (netif_running(netdev))
16565 +               igb_reinit_locked(adapter);
16566 +       return 0;
16567 +}
16568 +
16569 +static int igb_get_stats_count(struct net_device *netdev)
16570 +{
16571 +       return IGB_STATS_LEN;
16572 +}
16573 +
16574 +static void igb_get_ethtool_stats(struct net_device *netdev,
16575 +                                  struct ethtool_stats *stats, u64 *data)
16576 +{
16577 +       struct igb_adapter *adapter = netdev_priv(netdev);
16578 +       u64 *queue_stat;
16579 +       int stat_count = sizeof(struct igb_queue_stats) / sizeof(u64);
16580 +       int j;
16581 +       int i;
16582 +#ifdef IGB_LRO
16583 +       int aggregated = 0, flushed = 0, no_desc = 0;
16584 +
16585 +       for (i = 0; i < adapter->num_rx_queues; i++) {
16586 +               aggregated += adapter->rx_ring[i].lro_mgr.stats.aggregated;
16587 +               flushed += adapter->rx_ring[i].lro_mgr.stats.flushed;
16588 +               no_desc += adapter->rx_ring[i].lro_mgr.stats.no_desc;
16589 +       }
16590 +       adapter->lro_aggregated = aggregated;
16591 +       adapter->lro_flushed = flushed;
16592 +       adapter->lro_no_desc = no_desc;
16593 +#endif
16594 +
16595 +       igb_update_stats(adapter);
16596 +
16597 +       for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) {
16598 +               char *p = (char *)adapter+igb_gstrings_stats[i].stat_offset;
16599 +               data[i] = (igb_gstrings_stats[i].sizeof_stat ==
16600 +                       sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
16601 +       }
16602 +       for (j = 0; j < adapter->num_tx_queues; j++) {
16603 +               int k;
16604 +               queue_stat = (u64 *)&adapter->tx_ring[j].tx_stats;
16605 +               for (k = 0; k < stat_count; k++)
16606 +                       data[i + k] = queue_stat[k];
16607 +               i += k;
16608 +       }
16609 +       for (j = 0; j < adapter->num_rx_queues; j++) {
16610 +               int k;
16611 +               queue_stat = (u64 *)&adapter->rx_ring[j].rx_stats;
16612 +               for (k = 0; k < stat_count; k++)
16613 +                       data[i + k] = queue_stat[k];
16614 +               i += k;
16615 +       }
16616 +}
16617 +
16618 +static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
16619 +{
16620 +       struct igb_adapter *adapter = netdev_priv(netdev);
16621 +       u8 *p = data;
16622 +       int i;
16623 +
16624 +       switch (stringset) {
16625 +       case ETH_SS_TEST:
16626 +               memcpy(data, *igb_gstrings_test,
16627 +                       IGB_TEST_LEN*ETH_GSTRING_LEN);
16628 +               break;
16629 +       case ETH_SS_STATS:
16630 +               for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) {
16631 +                       memcpy(p, igb_gstrings_stats[i].stat_string,
16632 +                              ETH_GSTRING_LEN);
16633 +                       p += ETH_GSTRING_LEN;
16634 +               }
16635 +               for (i = 0; i < adapter->num_tx_queues; i++) {
16636 +                       sprintf(p, "tx_queue_%u_packets", i);
16637 +                       p += ETH_GSTRING_LEN;
16638 +                       sprintf(p, "tx_queue_%u_bytes", i);
16639 +                       p += ETH_GSTRING_LEN;
16640 +               }
16641 +               for (i = 0; i < adapter->num_rx_queues; i++) {
16642 +                       sprintf(p, "rx_queue_%u_packets", i);
16643 +                       p += ETH_GSTRING_LEN;
16644 +                       sprintf(p, "rx_queue_%u_bytes", i);
16645 +                       p += ETH_GSTRING_LEN;
16646 +               }
16647 +/*             BUG_ON(p - data != IGB_STATS_LEN * ETH_GSTRING_LEN); */
16648 +               break;
16649 +       }
16650 +}
16651 +
16652 +static struct ethtool_ops igb_ethtool_ops = {
16653 +       .get_settings           = igb_get_settings,
16654 +       .set_settings           = igb_set_settings,
16655 +       .get_drvinfo            = igb_get_drvinfo,
16656 +       .get_regs_len           = igb_get_regs_len,
16657 +       .get_regs               = igb_get_regs,
16658 +       .get_wol                = igb_get_wol,
16659 +       .set_wol                = igb_set_wol,
16660 +       .get_msglevel           = igb_get_msglevel,
16661 +       .set_msglevel           = igb_set_msglevel,
16662 +       .nway_reset             = igb_nway_reset,
16663 +       .get_link               = ethtool_op_get_link,
16664 +       .get_eeprom_len         = igb_get_eeprom_len,
16665 +       .get_eeprom             = igb_get_eeprom,
16666 +       .set_eeprom             = igb_set_eeprom,
16667 +       .get_ringparam          = igb_get_ringparam,
16668 +       .set_ringparam          = igb_set_ringparam,
16669 +       .get_pauseparam         = igb_get_pauseparam,
16670 +       .set_pauseparam         = igb_set_pauseparam,
16671 +       .get_rx_csum            = igb_get_rx_csum,
16672 +       .set_rx_csum            = igb_set_rx_csum,
16673 +       .get_tx_csum            = igb_get_tx_csum,
16674 +       .set_tx_csum            = igb_set_tx_csum,
16675 +       .get_sg                 = ethtool_op_get_sg,
16676 +       .set_sg                 = ethtool_op_set_sg,
16677 +#ifdef NETIF_F_TSO
16678 +       .get_tso                = ethtool_op_get_tso,
16679 +       .set_tso                = igb_set_tso,
16680 +#endif
16681 +       .self_test_count        = igb_diag_test_count,
16682 +       .self_test              = igb_diag_test,
16683 +       .get_strings            = igb_get_strings,
16684 +       .phys_id                = igb_phys_id,
16685 +       .get_stats_count        = igb_get_stats_count,
16686 +       .get_ethtool_stats      = igb_get_ethtool_stats,
16687 +#ifdef ETHTOOL_GPERMADDR
16688 +       .get_perm_addr          = ethtool_op_get_perm_addr,
16689 +#endif
16690 +       .get_coalesce           = igb_get_coalesce,
16691 +       .set_coalesce           = igb_set_coalesce,
16692 +};
16693 +
16694 +void igb_set_ethtool_ops(struct net_device *netdev)
16695 +{
16696 +       SET_ETHTOOL_OPS(netdev, &igb_ethtool_ops);
16697 +}
16698 +#endif /* SIOCETHTOOL */
16699 Binary files vanilla/drivers/net/igb/igb_ethtool.o and linux-i686-2.6.22/drivers/net/igb/igb_ethtool.o differ
16700 diff -Nru vanilla/drivers/net/igb/.igb_ethtool.o.cmd linux-i686-2.6.22/drivers/net/igb/.igb_ethtool.o.cmd
16701 --- vanilla/drivers/net/igb/.igb_ethtool.o.cmd  1969-12-31 19:00:00.000000000 -0500
16702 +++ linux-i686-2.6.22/drivers/net/igb/.igb_ethtool.o.cmd        2009-07-16 19:53:44.000000000 -0400
16703 @@ -0,0 +1,556 @@
16704 +cmd_drivers/net/igb/igb_ethtool.o := gcc -m32 -Wp,-MD,drivers/net/igb/.igb_ethtool.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(igb_ethtool)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_igb_ethtool.o drivers/net/igb/igb_ethtool.c
16705 +
16706 +deps_drivers/net/igb/igb_ethtool.o := \
16707 +  drivers/net/igb/igb_ethtool.c \
16708 +  include/linux/netdevice.h \
16709 +    $(wildcard include/config/ax25.h) \
16710 +    $(wildcard include/config/tr.h) \
16711 +    $(wildcard include/config/net/ipip.h) \
16712 +    $(wildcard include/config/net/ipgre.h) \
16713 +    $(wildcard include/config/ipv6/sit.h) \
16714 +    $(wildcard include/config/ipv6/tunnel.h) \
16715 +    $(wildcard include/config/wireless/ext.h) \
16716 +    $(wildcard include/config/netpoll.h) \
16717 +    $(wildcard include/config/net/poll/controller.h) \
16718 +    $(wildcard include/config/netpoll/trap.h) \
16719 +    $(wildcard include/config/net/dma.h) \
16720 +    $(wildcard include/config/bug.h) \
16721 +    $(wildcard include/config/proc/fs.h) \
16722 +  include/linux/if.h \
16723 +  include/linux/types.h \
16724 +    $(wildcard include/config/uid16.h) \
16725 +    $(wildcard include/config/lbd.h) \
16726 +    $(wildcard include/config/lsf.h) \
16727 +    $(wildcard include/config/resources/64bit.h) \
16728 +  include/linux/posix_types.h \
16729 +  include/linux/stddef.h \
16730 +  include/linux/compiler.h \
16731 +    $(wildcard include/config/enable/must/check.h) \
16732 +  include/linux/compiler-gcc4.h \
16733 +    $(wildcard include/config/forced/inlining.h) \
16734 +  include/linux/compiler-gcc.h \
16735 +  include/asm/posix_types.h \
16736 +  include/asm/types.h \
16737 +    $(wildcard include/config/highmem64g.h) \
16738 +  include/linux/socket.h \
16739 +    $(wildcard include/config/compat.h) \
16740 +  include/asm/socket.h \
16741 +  include/asm/sockios.h \
16742 +  include/linux/sockios.h \
16743 +  include/linux/uio.h \
16744 +  include/linux/hdlc/ioctl.h \
16745 +  include/linux/if_ether.h \
16746 +    $(wildcard include/config/sysctl.h) \
16747 +  include/linux/skbuff.h \
16748 +    $(wildcard include/config/nf/conntrack.h) \
16749 +    $(wildcard include/config/bridge/netfilter.h) \
16750 +    $(wildcard include/config/vlan/8021q.h) \
16751 +    $(wildcard include/config/net/sched.h) \
16752 +    $(wildcard include/config/net/cls/act.h) \
16753 +    $(wildcard include/config/network/secmark.h) \
16754 +  include/linux/kernel.h \
16755 +    $(wildcard include/config/preempt/voluntary.h) \
16756 +    $(wildcard include/config/debug/spinlock/sleep.h) \
16757 +    $(wildcard include/config/printk.h) \
16758 +    $(wildcard include/config/numa.h) \
16759 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
16760 +  include/linux/linkage.h \
16761 +  include/asm/linkage.h \
16762 +    $(wildcard include/config/x86/alignment/16.h) \
16763 +  include/linux/bitops.h \
16764 +  include/asm/bitops.h \
16765 +  include/asm/alternative.h \
16766 +    $(wildcard include/config/smp.h) \
16767 +    $(wildcard include/config/paravirt.h) \
16768 +  include/asm-generic/bitops/sched.h \
16769 +  include/asm-generic/bitops/hweight.h \
16770 +  include/asm-generic/bitops/fls64.h \
16771 +  include/asm-generic/bitops/ext2-non-atomic.h \
16772 +  include/asm-generic/bitops/le.h \
16773 +  include/asm/byteorder.h \
16774 +    $(wildcard include/config/x86/bswap.h) \
16775 +  include/linux/byteorder/little_endian.h \
16776 +  include/linux/byteorder/swab.h \
16777 +  include/linux/byteorder/generic.h \
16778 +  include/asm-generic/bitops/minix.h \
16779 +  include/linux/log2.h \
16780 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
16781 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
16782 +  include/asm/bug.h \
16783 +    $(wildcard include/config/debug/bugverbose.h) \
16784 +  include/asm-generic/bug.h \
16785 +    $(wildcard include/config/generic/bug.h) \
16786 +  include/linux/time.h \
16787 +  include/linux/seqlock.h \
16788 +  include/linux/spinlock.h \
16789 +    $(wildcard include/config/debug/spinlock.h) \
16790 +    $(wildcard include/config/preempt.h) \
16791 +    $(wildcard include/config/debug/lock/alloc.h) \
16792 +  include/linux/preempt.h \
16793 +    $(wildcard include/config/debug/preempt.h) \
16794 +  include/linux/thread_info.h \
16795 +  include/asm/thread_info.h \
16796 +    $(wildcard include/config/4kstacks.h) \
16797 +    $(wildcard include/config/debug/stack/usage.h) \
16798 +  include/asm/page.h \
16799 +    $(wildcard include/config/x86/use/3dnow.h) \
16800 +    $(wildcard include/config/x86/pae.h) \
16801 +    $(wildcard include/config/hugetlb/page.h) \
16802 +    $(wildcard include/config/highmem4g.h) \
16803 +    $(wildcard include/config/page/offset.h) \
16804 +    $(wildcard include/config/flatmem.h) \
16805 +  include/asm-generic/pgtable-nopmd.h \
16806 +  include/asm-generic/pgtable-nopud.h \
16807 +  include/asm-generic/memory_model.h \
16808 +    $(wildcard include/config/discontigmem.h) \
16809 +    $(wildcard include/config/sparsemem.h) \
16810 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
16811 +  include/asm-generic/page.h \
16812 +  include/asm/processor.h \
16813 +    $(wildcard include/config/x86/ht.h) \
16814 +    $(wildcard include/config/mk8.h) \
16815 +    $(wildcard include/config/mk7.h) \
16816 +  include/asm/vm86.h \
16817 +    $(wildcard include/config/vm86.h) \
16818 +  include/asm/ptrace.h \
16819 +  include/asm/ptrace-abi.h \
16820 +  include/asm/segment.h \
16821 +  include/asm/math_emu.h \
16822 +  include/asm/sigcontext.h \
16823 +  include/asm/cpufeature.h \
16824 +  include/asm/required-features.h \
16825 +    $(wildcard include/config/x86/minimum/cpu.h) \
16826 +    $(wildcard include/config/x86/cmov.h) \
16827 +    $(wildcard include/config/x86/cmpxchg64.h) \
16828 +  include/asm/msr.h \
16829 +  include/asm/msr-index.h \
16830 +  include/asm/errno.h \
16831 +  include/asm-generic/errno.h \
16832 +  include/asm-generic/errno-base.h \
16833 +  include/linux/errno.h \
16834 +  include/asm/system.h \
16835 +    $(wildcard include/config/x86/oostore.h) \
16836 +  include/asm/cmpxchg.h \
16837 +    $(wildcard include/config/x86/cmpxchg.h) \
16838 +  include/linux/irqflags.h \
16839 +    $(wildcard include/config/trace/irqflags.h) \
16840 +    $(wildcard include/config/trace/irqflags/support.h) \
16841 +    $(wildcard include/config/x86.h) \
16842 +  include/asm/irqflags.h \
16843 +  include/asm/processor-flags.h \
16844 +  include/linux/cache.h \
16845 +  include/asm/cache.h \
16846 +    $(wildcard include/config/x86/l1/cache/shift.h) \
16847 +  include/linux/threads.h \
16848 +    $(wildcard include/config/nr/cpus.h) \
16849 +    $(wildcard include/config/base/small.h) \
16850 +  include/asm/percpu.h \
16851 +  include/linux/cpumask.h \
16852 +    $(wildcard include/config/hotplug/cpu.h) \
16853 +  include/linux/bitmap.h \
16854 +  include/linux/string.h \
16855 +  include/asm/string.h \
16856 +  include/linux/init.h \
16857 +    $(wildcard include/config/modules.h) \
16858 +    $(wildcard include/config/hotplug.h) \
16859 +    $(wildcard include/config/memory/hotplug.h) \
16860 +    $(wildcard include/config/acpi/hotplug/memory.h) \
16861 +  include/linux/stringify.h \
16862 +  include/linux/bottom_half.h \
16863 +  include/linux/spinlock_types.h \
16864 +  include/linux/lockdep.h \
16865 +    $(wildcard include/config/lockdep.h) \
16866 +    $(wildcard include/config/generic/hardirqs.h) \
16867 +    $(wildcard include/config/prove/locking.h) \
16868 +  include/asm/spinlock_types.h \
16869 +  include/asm/spinlock.h \
16870 +    $(wildcard include/config/x86/ppro/fence.h) \
16871 +  include/asm/atomic.h \
16872 +    $(wildcard include/config/m386.h) \
16873 +  include/asm-generic/atomic.h \
16874 +  include/asm/rwlock.h \
16875 +  include/linux/spinlock_api_smp.h \
16876 +  include/linux/vs_time.h \
16877 +    $(wildcard include/config/vserver/vtime.h) \
16878 +  include/linux/net.h \
16879 +  include/linux/wait.h \
16880 +  include/linux/list.h \
16881 +    $(wildcard include/config/debug/list.h) \
16882 +  include/linux/poison.h \
16883 +  include/linux/prefetch.h \
16884 +  include/asm/current.h \
16885 +  include/linux/random.h \
16886 +  include/linux/ioctl.h \
16887 +  include/asm/ioctl.h \
16888 +  include/asm-generic/ioctl.h \
16889 +  include/linux/sysctl.h \
16890 +    $(wildcard include/config/icmp/ipod.h) \
16891 +    $(wildcard include/config/web100/net100.h) \
16892 +    $(wildcard include/config/web100/stats.h) \
16893 +  include/linux/textsearch.h \
16894 +  include/linux/module.h \
16895 +    $(wildcard include/config/modversions.h) \
16896 +    $(wildcard include/config/unused/symbols.h) \
16897 +    $(wildcard include/config/module/unload.h) \
16898 +    $(wildcard include/config/kallsyms.h) \
16899 +    $(wildcard include/config/sysfs.h) \
16900 +  include/linux/stat.h \
16901 +  include/asm/stat.h \
16902 +  include/linux/kmod.h \
16903 +    $(wildcard include/config/kmod.h) \
16904 +  include/linux/elf.h \
16905 +  include/linux/auxvec.h \
16906 +  include/asm/auxvec.h \
16907 +  include/linux/elf-em.h \
16908 +  include/asm/elf.h \
16909 +  include/asm/user.h \
16910 +  include/asm/desc.h \
16911 +  include/asm/ldt.h \
16912 +  include/linux/smp.h \
16913 +  include/asm/smp.h \
16914 +    $(wildcard include/config/x86/local/apic.h) \
16915 +    $(wildcard include/config/x86/io/apic.h) \
16916 +  include/asm/mpspec.h \
16917 +    $(wildcard include/config/acpi.h) \
16918 +  include/asm/mpspec_def.h \
16919 +  include/asm-i386/mach-generic/mach_mpspec.h \
16920 +  include/asm/apic.h \
16921 +    $(wildcard include/config/x86/good/apic.h) \
16922 +  include/linux/pm.h \
16923 +    $(wildcard include/config/pm.h) \
16924 +  include/linux/delay.h \
16925 +  include/asm/delay.h \
16926 +  include/asm/fixmap.h \
16927 +    $(wildcard include/config/highmem.h) \
16928 +    $(wildcard include/config/x86/visws/apic.h) \
16929 +    $(wildcard include/config/x86/f00f/bug.h) \
16930 +    $(wildcard include/config/x86/cyclone/timer.h) \
16931 +    $(wildcard include/config/pci/mmconfig.h) \
16932 +  include/asm/acpi.h \
16933 +    $(wildcard include/config/acpi/sleep.h) \
16934 +  include/acpi/pdc_intel.h \
16935 +  include/asm/apicdef.h \
16936 +  include/asm/kmap_types.h \
16937 +    $(wildcard include/config/debug/highmem.h) \
16938 +  include/asm/io_apic.h \
16939 +  include/asm-i386/mach-generic/mach_apicdef.h \
16940 +  include/asm/genapic.h \
16941 +  include/linux/percpu.h \
16942 +  include/linux/slab.h \
16943 +    $(wildcard include/config/slab/debug.h) \
16944 +    $(wildcard include/config/slab.h) \
16945 +    $(wildcard include/config/slub.h) \
16946 +    $(wildcard include/config/debug/slab.h) \
16947 +  include/linux/gfp.h \
16948 +    $(wildcard include/config/zone/dma.h) \
16949 +    $(wildcard include/config/zone/dma32.h) \
16950 +  include/linux/mmzone.h \
16951 +    $(wildcard include/config/force/max/zoneorder.h) \
16952 +    $(wildcard include/config/arch/populates/node/map.h) \
16953 +    $(wildcard include/config/flat/node/mem/map.h) \
16954 +    $(wildcard include/config/have/memory/present.h) \
16955 +    $(wildcard include/config/need/node/memmap/size.h) \
16956 +    $(wildcard include/config/need/multiple/nodes.h) \
16957 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
16958 +    $(wildcard include/config/sparsemem/extreme.h) \
16959 +    $(wildcard include/config/nodes/span/other/nodes.h) \
16960 +    $(wildcard include/config/holes/in/zone.h) \
16961 +  include/linux/numa.h \
16962 +    $(wildcard include/config/nodes/shift.h) \
16963 +  include/linux/nodemask.h \
16964 +  include/linux/memory_hotplug.h \
16965 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
16966 +  include/linux/notifier.h \
16967 +  include/linux/mutex.h \
16968 +    $(wildcard include/config/debug/mutexes.h) \
16969 +    $(wildcard include/config/chopstix.h) \
16970 +  include/linux/rwsem.h \
16971 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
16972 +  include/asm/rwsem.h \
16973 +  include/linux/srcu.h \
16974 +  include/linux/topology.h \
16975 +    $(wildcard include/config/sched/smt.h) \
16976 +    $(wildcard include/config/sched/mc.h) \
16977 +  include/asm/topology.h \
16978 +  include/asm-generic/topology.h \
16979 +  include/linux/slab_def.h \
16980 +  include/linux/kmalloc_sizes.h \
16981 +  include/asm/mmu.h \
16982 +  include/asm/semaphore.h \
16983 +  include/linux/kobject.h \
16984 +  include/linux/sysfs.h \
16985 +  include/linux/kref.h \
16986 +  include/linux/moduleparam.h \
16987 +  include/asm/local.h \
16988 +  include/asm/module.h \
16989 +    $(wildcard include/config/m486.h) \
16990 +    $(wildcard include/config/m586.h) \
16991 +    $(wildcard include/config/m586tsc.h) \
16992 +    $(wildcard include/config/m586mmx.h) \
16993 +    $(wildcard include/config/mcore2.h) \
16994 +    $(wildcard include/config/m686.h) \
16995 +    $(wildcard include/config/mpentiumii.h) \
16996 +    $(wildcard include/config/mpentiumiii.h) \
16997 +    $(wildcard include/config/mpentiumm.h) \
16998 +    $(wildcard include/config/mpentium4.h) \
16999 +    $(wildcard include/config/mk6.h) \
17000 +    $(wildcard include/config/x86/elan.h) \
17001 +    $(wildcard include/config/mcrusoe.h) \
17002 +    $(wildcard include/config/mefficeon.h) \
17003 +    $(wildcard include/config/mwinchipc6.h) \
17004 +    $(wildcard include/config/mwinchip2.h) \
17005 +    $(wildcard include/config/mwinchip3d.h) \
17006 +    $(wildcard include/config/mcyrixiii.h) \
17007 +    $(wildcard include/config/mviac3/2.h) \
17008 +    $(wildcard include/config/mviac7.h) \
17009 +    $(wildcard include/config/mgeodegx1.h) \
17010 +    $(wildcard include/config/mgeode/lx.h) \
17011 +  include/linux/err.h \
17012 +  include/net/checksum.h \
17013 +  include/asm/uaccess.h \
17014 +    $(wildcard include/config/x86/intel/usercopy.h) \
17015 +    $(wildcard include/config/x86/wp/works/ok.h) \
17016 +  include/asm/checksum.h \
17017 +  include/linux/in6.h \
17018 +  include/linux/rcupdate.h \
17019 +  include/linux/dmaengine.h \
17020 +    $(wildcard include/config/dma/engine.h) \
17021 +  include/linux/device.h \
17022 +    $(wildcard include/config/debug/devres.h) \
17023 +  include/linux/ioport.h \
17024 +  include/linux/klist.h \
17025 +  include/linux/completion.h \
17026 +  include/asm/device.h \
17027 +  include/linux/hrtimer.h \
17028 +    $(wildcard include/config/high/res/timers.h) \
17029 +    $(wildcard include/config/timer/stats.h) \
17030 +  include/linux/rbtree.h \
17031 +  include/linux/ktime.h \
17032 +    $(wildcard include/config/ktime/scalar.h) \
17033 +  include/linux/jiffies.h \
17034 +  include/linux/calc64.h \
17035 +  include/asm/div64.h \
17036 +  include/linux/timex.h \
17037 +    $(wildcard include/config/time/interpolation.h) \
17038 +    $(wildcard include/config/no/hz.h) \
17039 +  include/asm/param.h \
17040 +    $(wildcard include/config/hz.h) \
17041 +  include/asm/timex.h \
17042 +  include/asm/tsc.h \
17043 +    $(wildcard include/config/x86/tsc.h) \
17044 +    $(wildcard include/config/x86/generic.h) \
17045 +  include/linux/if_packet.h \
17046 +  include/linux/timer.h \
17047 +  include/linux/interrupt.h \
17048 +    $(wildcard include/config/generic/irq/probe.h) \
17049 +  include/linux/irqreturn.h \
17050 +  include/linux/hardirq.h \
17051 +    $(wildcard include/config/preempt/bkl.h) \
17052 +    $(wildcard include/config/virt/cpu/accounting.h) \
17053 +  include/linux/smp_lock.h \
17054 +    $(wildcard include/config/lock/kernel.h) \
17055 +  include/linux/sched.h \
17056 +    $(wildcard include/config/detect/softlockup.h) \
17057 +    $(wildcard include/config/split/ptlock/cpus.h) \
17058 +    $(wildcard include/config/keys.h) \
17059 +    $(wildcard include/config/bsd/process/acct.h) \
17060 +    $(wildcard include/config/taskstats.h) \
17061 +    $(wildcard include/config/inotify/user.h) \
17062 +    $(wildcard include/config/schedstats.h) \
17063 +    $(wildcard include/config/task/delay/acct.h) \
17064 +    $(wildcard include/config/blk/dev/io/trace.h) \
17065 +    $(wildcard include/config/cc/stackprotector.h) \
17066 +    $(wildcard include/config/sysvipc.h) \
17067 +    $(wildcard include/config/rt/mutexes.h) \
17068 +    $(wildcard include/config/task/xacct.h) \
17069 +    $(wildcard include/config/cpusets.h) \
17070 +    $(wildcard include/config/fault/injection.h) \
17071 +  include/linux/capability.h \
17072 +  include/asm/cputime.h \
17073 +  include/asm-generic/cputime.h \
17074 +  include/linux/sem.h \
17075 +  include/linux/ipc.h \
17076 +    $(wildcard include/config/ipc/ns.h) \
17077 +  include/asm/ipcbuf.h \
17078 +  include/asm/sembuf.h \
17079 +  include/linux/signal.h \
17080 +  include/asm/signal.h \
17081 +  include/asm-generic/signal.h \
17082 +  include/asm/siginfo.h \
17083 +  include/asm-generic/siginfo.h \
17084 +  include/linux/securebits.h \
17085 +  include/linux/fs_struct.h \
17086 +  include/linux/pid.h \
17087 +  include/linux/seccomp.h \
17088 +    $(wildcard include/config/seccomp.h) \
17089 +  include/linux/futex.h \
17090 +    $(wildcard include/config/futex.h) \
17091 +  include/linux/rtmutex.h \
17092 +    $(wildcard include/config/debug/rt/mutexes.h) \
17093 +  include/linux/plist.h \
17094 +    $(wildcard include/config/debug/pi/list.h) \
17095 +  include/linux/param.h \
17096 +  include/linux/resource.h \
17097 +  include/asm/resource.h \
17098 +  include/asm-generic/resource.h \
17099 +  include/linux/task_io_accounting.h \
17100 +    $(wildcard include/config/task/io/accounting.h) \
17101 +  include/linux/aio.h \
17102 +  include/linux/workqueue.h \
17103 +  include/linux/aio_abi.h \
17104 +  include/asm/hardirq.h \
17105 +  include/linux/irq.h \
17106 +    $(wildcard include/config/s390.h) \
17107 +    $(wildcard include/config/irq/per/cpu.h) \
17108 +    $(wildcard include/config/irq/release/method.h) \
17109 +    $(wildcard include/config/generic/pending/irq.h) \
17110 +    $(wildcard include/config/irqbalance.h) \
17111 +    $(wildcard include/config/auto/irq/affinity.h) \
17112 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
17113 +  include/asm/irq.h \
17114 +  include/asm-i386/mach-default/irq_vectors.h \
17115 +  include/asm-i386/mach-default/irq_vectors_limits.h \
17116 +  include/asm/irq_regs.h \
17117 +  include/asm/hw_irq.h \
17118 +  include/linux/profile.h \
17119 +    $(wildcard include/config/profiling.h) \
17120 +  include/asm/sections.h \
17121 +  include/asm-generic/sections.h \
17122 +  include/linux/irq_cpustat.h \
17123 +  include/linux/vmalloc.h \
17124 +  include/linux/ethtool.h \
17125 +  drivers/net/igb/igb.h \
17126 +    $(wildcard include/config/dca.h) \
17127 +    $(wildcard include/config/inet/lro.h) \
17128 +    $(wildcard include/config/igb/separate/tx/handler.h) \
17129 +    $(wildcard include/config/igb/disable/packet/split.h) \
17130 +  include/linux/pci.h \
17131 +    $(wildcard include/config/pci/msi.h) \
17132 +    $(wildcard include/config/pci.h) \
17133 +    $(wildcard include/config/ht/irq.h) \
17134 +    $(wildcard include/config/pci/domains.h) \
17135 +  include/linux/pci_regs.h \
17136 +  include/linux/mod_devicetable.h \
17137 +  include/linux/pci_ids.h \
17138 +  include/linux/dmapool.h \
17139 +  include/asm/io.h \
17140 +    $(wildcard include/config/x86/numaq.h) \
17141 +  include/asm-generic/iomap.h \
17142 +  include/asm/scatterlist.h \
17143 +  include/asm/pci.h \
17144 +  include/linux/mm.h \
17145 +    $(wildcard include/config/mmu.h) \
17146 +    $(wildcard include/config/stack/growsup.h) \
17147 +    $(wildcard include/config/debug/vm.h) \
17148 +    $(wildcard include/config/shmem.h) \
17149 +    $(wildcard include/config/ia64.h) \
17150 +    $(wildcard include/config/debug/pagealloc.h) \
17151 +  include/linux/prio_tree.h \
17152 +  include/linux/fs.h \
17153 +    $(wildcard include/config/dnotify.h) \
17154 +    $(wildcard include/config/vserver/cowbl.h) \
17155 +    $(wildcard include/config/quota.h) \
17156 +    $(wildcard include/config/inotify.h) \
17157 +    $(wildcard include/config/security.h) \
17158 +    $(wildcard include/config/epoll.h) \
17159 +    $(wildcard include/config/auditsyscall.h) \
17160 +    $(wildcard include/config/block.h) \
17161 +    $(wildcard include/config/fs/xip.h) \
17162 +    $(wildcard include/config/migration.h) \
17163 +  include/linux/limits.h \
17164 +  include/linux/kdev_t.h \
17165 +  include/linux/dcache.h \
17166 +  include/linux/namei.h \
17167 +  include/linux/radix-tree.h \
17168 +  include/linux/quota.h \
17169 +  include/linux/dqblk_xfs.h \
17170 +  include/linux/dqblk_v1.h \
17171 +  include/linux/dqblk_v2.h \
17172 +  include/linux/nfs_fs_i.h \
17173 +  include/linux/nfs.h \
17174 +  include/linux/sunrpc/msg_prot.h \
17175 +  include/linux/fcntl.h \
17176 +  include/asm/fcntl.h \
17177 +  include/asm-generic/fcntl.h \
17178 +    $(wildcard include/config/64bit.h) \
17179 +  include/linux/debug_locks.h \
17180 +    $(wildcard include/config/debug/locking/api/selftests.h) \
17181 +  include/linux/backing-dev.h \
17182 +  include/linux/mm_types.h \
17183 +  include/asm/pgtable.h \
17184 +    $(wildcard include/config/highpte.h) \
17185 +  include/asm/paravirt.h \
17186 +  include/asm/pgtable-2level-defs.h \
17187 +  include/asm/pgtable-2level.h \
17188 +  include/asm-generic/pgtable.h \
17189 +  include/linux/page-flags.h \
17190 +    $(wildcard include/config/swap.h) \
17191 +  include/linux/vmstat.h \
17192 +    $(wildcard include/config/vm/event/counters.h) \
17193 +  include/asm-generic/pci-dma-compat.h \
17194 +  include/linux/dma-mapping.h \
17195 +  include/asm/dma-mapping.h \
17196 +  include/asm-generic/pci.h \
17197 +  drivers/net/igb/kcompat.h \
17198 +    $(wildcard include/config/e1000/napi.h) \
17199 +    $(wildcard include/config/e1000e/napi.h) \
17200 +    $(wildcard include/config/ixgb/napi.h) \
17201 +    $(wildcard include/config/e1000/disable/packet/split.h) \
17202 +    $(wildcard include/config/space/len.h) \
17203 +    $(wildcard include/config/netdevices/multiqueue.h) \
17204 +  include/linux/version.h \
17205 +  include/linux/etherdevice.h \
17206 +  include/linux/in.h \
17207 +  include/linux/ip.h \
17208 +  include/linux/udp.h \
17209 +  include/net/inet_sock.h \
17210 +    $(wildcard include/config/ipv6.h) \
17211 +  include/linux/jhash.h \
17212 +  include/net/flow.h \
17213 +    $(wildcard include/config/ipv6/mip6.h) \
17214 +  include/net/sock.h \
17215 +    $(wildcard include/config/security/network.h) \
17216 +  include/linux/security.h \
17217 +    $(wildcard include/config/security/network/xfrm.h) \
17218 +  include/linux/binfmts.h \
17219 +  include/linux/shm.h \
17220 +  include/asm/shmparam.h \
17221 +  include/asm/shmbuf.h \
17222 +  include/linux/msg.h \
17223 +  include/asm/msgbuf.h \
17224 +  include/linux/key.h \
17225 +  include/linux/xfrm.h \
17226 +  include/linux/filter.h \
17227 +  include/net/dst.h \
17228 +    $(wildcard include/config/net/cls/route.h) \
17229 +    $(wildcard include/config/xfrm.h) \
17230 +  include/linux/rtnetlink.h \
17231 +  include/linux/netlink.h \
17232 +  include/linux/if_link.h \
17233 +  include/linux/if_addr.h \
17234 +  include/linux/neighbour.h \
17235 +  include/net/neighbour.h \
17236 +  include/linux/seq_file.h \
17237 +  include/net/rtnetlink.h \
17238 +  include/net/netlink.h \
17239 +  include/net/request_sock.h \
17240 +  include/linux/mii.h \
17241 +  include/linux/latency.h \
17242 +  drivers/net/igb/e1000_api.h \
17243 +  drivers/net/igb/e1000_hw.h \
17244 +  drivers/net/igb/e1000_osdep.h \
17245 +  drivers/net/igb/e1000_regs.h \
17246 +  drivers/net/igb/e1000_defines.h \
17247 +    $(wildcard include/config/res.h) \
17248 +    $(wildcard include/config/fault.h) \
17249 +  drivers/net/igb/e1000_mac.h \
17250 +  drivers/net/igb/e1000_phy.h \
17251 +  drivers/net/igb/e1000_nvm.h \
17252 +  drivers/net/igb/e1000_manage.h \
17253 +  drivers/net/igb/e1000_82575.h \
17254 +  drivers/net/igb/igb_regtest.h \
17255 +  include/linux/if_vlan.h \
17256 +
17257 +drivers/net/igb/igb_ethtool.o: $(deps_drivers/net/igb/igb_ethtool.o)
17258 +
17259 +$(deps_drivers/net/igb/igb_ethtool.o):
17260 diff -Nru vanilla/drivers/net/igb/igb.h linux-i686-2.6.22/drivers/net/igb/igb.h
17261 --- vanilla/drivers/net/igb/igb.h       1969-12-31 19:00:00.000000000 -0500
17262 +++ linux-i686-2.6.22/drivers/net/igb/igb.h     2009-07-16 19:25:22.000000000 -0400
17263 @@ -0,0 +1,377 @@
17264 +/*******************************************************************************
17265 +
17266 +  Intel(R) Gigabit Ethernet Linux driver
17267 +  Copyright(c) 2007-2008 Intel Corporation.
17268 +
17269 +  This program is free software; you can redistribute it and/or modify it
17270 +  under the terms and conditions of the GNU General Public License,
17271 +  version 2, as published by the Free Software Foundation.
17272 +
17273 +  This program is distributed in the hope it will be useful, but WITHOUT
17274 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17275 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17276 +  more details.
17277 +
17278 +  You should have received a copy of the GNU General Public License along with
17279 +  this program; if not, write to the Free Software Foundation, Inc.,
17280 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17281 +
17282 +  The full GNU General Public License is included in this distribution in
17283 +  the file called "COPYING".
17284 +
17285 +  Contact Information:
17286 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
17287 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
17288 +
17289 +*******************************************************************************/
17290 +
17291 +
17292 +/* Linux PRO/1000 Ethernet Driver main header file */
17293 +
17294 +#ifndef _IGB_H_
17295 +#define _IGB_H_
17296 +
17297 +#include <linux/pci.h>
17298 +#include <linux/netdevice.h>
17299 +#include <linux/vmalloc.h>
17300 +
17301 +#ifdef SIOCETHTOOL
17302 +#include <linux/ethtool.h>
17303 +#endif
17304 +
17305 +struct igb_adapter;
17306 +
17307 +#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
17308 +#define IGB_DCA
17309 +#endif
17310 +#ifdef IGB_DCA
17311 +#include <linux/dca.h>
17312 +#endif
17313 +
17314 +#ifdef IGB_LRO
17315 +#undef IGB_LRO
17316 +#ifdef NETIF_F_LRO
17317 +#if defined(CONFIG_INET_LRO) || defined(CONFIG_INET_LRO_MODULE)
17318 +#include <linux/inet_lro.h>
17319 +#define MAX_LRO_DESCRIPTORS               8
17320 +#define IGB_LRO
17321 +#endif
17322 +#endif
17323 +#endif /* IGB_LRO */
17324 +
17325 +#include "kcompat.h"
17326 +
17327 +#include "e1000_api.h"
17328 +#include "e1000_82575.h"
17329 +
17330 +#define IGB_ERR(args...) printk(KERN_ERR "igb: " args)
17331 +
17332 +#define PFX "igb: "
17333 +#define DPRINTK(nlevel, klevel, fmt, args...) \
17334 +       (void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
17335 +       printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
17336 +               __FUNCTION__ , ## args))
17337 +
17338 +/* Interrupt defines */
17339 +#define IGB_START_ITR                    648 /* ~6000 ints/sec */
17340 +
17341 +/* Interrupt modes, as used by the IntMode paramter */
17342 +#define IGB_INT_MODE_LEGACY                0
17343 +#define IGB_INT_MODE_MSI                   1
17344 +#define IGB_INT_MODE_MSIX_1Q               2
17345 +#define IGB_INT_MODE_MSIX_MQ               3
17346 +
17347 +#define HW_PERF
17348 +/* TX/RX descriptor defines */
17349 +#define IGB_DEFAULT_TXD                  256
17350 +#define IGB_MIN_TXD                       80
17351 +#define IGB_MAX_TXD                     4096
17352 +
17353 +#define IGB_DEFAULT_RXD                  256
17354 +#define IGB_MIN_RXD                       80
17355 +#define IGB_MAX_RXD                     4096
17356 +
17357 +#define IGB_MIN_ITR_USECS                 10 /* 100k irq/sec */
17358 +#define IGB_MAX_ITR_USECS              10000 /* 100  irq/sec */
17359 +
17360 +/* Transmit and receive queues */
17361 +#ifndef CONFIG_IGB_SEPARATE_TX_HANDLER
17362 +#define IGB_MAX_RX_QUEUES                  (hw->mac.type > e1000_82575 ? 8 : 4)
17363 +#define IGB_MAX_TX_QUEUES                  (hw->mac.type > e1000_82575 ? 8 : 4)
17364 +#define IGB_ABS_MAX_TX_QUEUES              8
17365 +#else /* CONFIG_IGB_SEPARATE_TX_HANDLER */
17366 +#define IGB_MAX_RX_QUEUES                  4
17367 +#define IGB_MAX_TX_QUEUES                  4
17368 +#define IGB_ABS_MAX_TX_QUEUES              4
17369 +#endif  /* CONFIG_IGB_SEPARATE_TX_HANDLER */
17370 +
17371 +/* RX descriptor control thresholds.
17372 + * PTHRESH - MAC will consider prefetch if it has fewer than this number of
17373 + *           descriptors available in its onboard memory.
17374 + *           Setting this to 0 disables RX descriptor prefetch.
17375 + * HTHRESH - MAC will only prefetch if there are at least this many descriptors
17376 + *           available in host memory.
17377 + *           If PTHRESH is 0, this should also be 0.
17378 + * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back
17379 + *           descriptors until either it has this many to write back, or the
17380 + *           ITR timer expires.
17381 + */
17382 +#define IGB_RX_PTHRESH                    16
17383 +#define IGB_RX_HTHRESH                     8
17384 +#define IGB_RX_WTHRESH                     1
17385 +
17386 +/* this is the size past which hardware will drop packets when setting LPE=0 */
17387 +#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
17388 +
17389 +/* Supported Rx Buffer Sizes */
17390 +#define IGB_RXBUFFER_128   128    /* Used for packet split */
17391 +#define IGB_RXBUFFER_256   256    /* Used for packet split */
17392 +#define IGB_RXBUFFER_512   512
17393 +#define IGB_RXBUFFER_1024  1024
17394 +#define IGB_RXBUFFER_2048  2048
17395 +#define IGB_RXBUFFER_4096  4096
17396 +#define IGB_RXBUFFER_8192  8192
17397 +#define IGB_RXBUFFER_16384 16384
17398 +
17399 +/* Packet Buffer allocations */
17400 +#define IGB_PBA_BYTES_SHIFT 0xA
17401 +#define IGB_TX_HEAD_ADDR_SHIFT 7
17402 +#define IGB_PBA_TX_MASK 0xFFFF0000
17403 +
17404 +#define IGB_FC_PAUSE_TIME 0x0680 /* 858 usec */
17405 +
17406 +/* How many Tx Descriptors do we need to call netif_wake_queue ? */
17407 +#define IGB_TX_QUEUE_WAKE      32
17408 +/* How many Rx Buffers do we bundle into one write to the hardware ? */
17409 +#define IGB_RX_BUFFER_WRITE    16      /* Must be power of 2 */
17410 +
17411 +#define AUTO_ALL_MODES            0
17412 +#define IGB_EEPROM_APME         0x0400
17413 +
17414 +#ifndef IGB_MASTER_SLAVE
17415 +/* Switch to override PHY master/slave setting */
17416 +#define IGB_MASTER_SLAVE       e1000_ms_hw_default
17417 +#endif
17418 +
17419 +#define IGB_MNG_VLAN_NONE -1
17420 +
17421 +/* wrapper around a pointer to a socket buffer,
17422 + * so a DMA handle can be stored along with the buffer */
17423 +struct igb_buffer {
17424 +       struct sk_buff *skb;
17425 +       dma_addr_t dma;
17426 +       union {
17427 +               /* TX */
17428 +               struct {
17429 +                       unsigned long time_stamp;
17430 +                       u32 length;
17431 +               };
17432 +
17433 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
17434 +               /* RX */
17435 +               struct {
17436 +                       struct page *page;
17437 +                       u64 page_dma;
17438 +                       unsigned int page_offset;
17439 +               };
17440 +#endif
17441 +       };
17442 +};
17443 +
17444 +struct igb_queue_stats {
17445 +       u64 packets;
17446 +       u64 bytes;
17447 +};
17448 +
17449 +struct igb_ring {
17450 +       struct igb_adapter *adapter; /* backlink */
17451 +       void *desc;                  /* descriptor ring memory */
17452 +       dma_addr_t dma;              /* phys address of the ring */
17453 +       unsigned int size;           /* length of desc. ring in bytes */
17454 +       unsigned int count;          /* number of desc. in the ring */
17455 +       u16 next_to_use;
17456 +       u16 next_to_clean;
17457 +       u16 head;
17458 +       u16 tail;
17459 +       struct igb_buffer *buffer_info; /* array of buffer info structs */
17460 +
17461 +       u32 eims_value;
17462 +       u32 itr_val;
17463 +       u16 itr_register;
17464 +       u16 cpu;
17465 +
17466 +       int queue_index;
17467 +       unsigned int total_bytes;
17468 +       unsigned int total_packets;
17469 +
17470 +       char name[IFNAMSIZ + 5];
17471 +       union {
17472 +               /* TX */
17473 +               struct {
17474 +                       struct igb_queue_stats tx_stats;
17475 +                       bool detect_tx_hung;
17476 +               };
17477 +               /* RX */
17478 +               struct {
17479 +                       struct igb_queue_stats rx_stats;
17480 +                       struct napi_struct napi;
17481 +                       int set_itr;
17482 +                       struct igb_ring *buddy;
17483 +#ifdef IGB_LRO
17484 +                       struct net_lro_mgr lro_mgr;
17485 +                       bool lro_used;
17486 +#endif
17487 +               };
17488 +       };
17489 +};
17490 +
17491 +
17492 +#define IGB_DESC_UNUSED(R) \
17493 +       ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
17494 +       (R)->next_to_clean - (R)->next_to_use - 1)
17495 +
17496 +#define E1000_RX_DESC_ADV(R, i)            \
17497 +       (&(((union e1000_adv_rx_desc *)((R).desc))[i]))
17498 +#define E1000_TX_DESC_ADV(R, i)            \
17499 +       (&(((union e1000_adv_tx_desc *)((R).desc))[i]))
17500 +#define E1000_TX_CTXTDESC_ADV(R, i)        \
17501 +       (&(((struct e1000_adv_tx_context_desc *)((R).desc))[i]))
17502 +#define E1000_GET_DESC(R, i, type)     (&(((struct type *)((R).desc))[i]))
17503 +#define E1000_TX_DESC(R, i)            E1000_GET_DESC(R, i, e1000_tx_desc)
17504 +#define E1000_RX_DESC(R, i)            E1000_GET_DESC(R, i, e1000_rx_desc)
17505 +
17506 +#define MAX_MSIX_COUNT 10
17507 +/* board specific private data structure */
17508 +
17509 +struct igb_adapter {
17510 +       struct timer_list watchdog_timer;
17511 +       struct timer_list phy_info_timer;
17512 +       struct vlan_group *vlgrp;
17513 +       u16 mng_vlan_id;
17514 +       u32 bd_number;
17515 +       u32 rx_buffer_len;
17516 +       u32 wol;
17517 +       u32 en_mng_pt;
17518 +       u16 link_speed;
17519 +       u16 link_duplex;
17520 +
17521 +       unsigned int total_tx_bytes;
17522 +       unsigned int total_tx_packets;
17523 +       unsigned int total_rx_bytes;
17524 +       unsigned int total_rx_packets;
17525 +       /* Interrupt Throttle Rate */
17526 +       u32 itr;
17527 +       u32 itr_setting;
17528 +       u16 tx_itr;
17529 +       u16 rx_itr;
17530 +
17531 +       struct work_struct reset_task;
17532 +       struct work_struct watchdog_task;
17533 +       bool fc_autoneg;
17534 +       u8  tx_timeout_factor;
17535 +#ifdef ETHTOOL_PHYS_ID
17536 +       struct timer_list blink_timer;
17537 +       unsigned long led_status;
17538 +#endif
17539 +
17540 +       /* TX */
17541 +       struct igb_ring *tx_ring;      /* One per active queue */
17542 +       unsigned int restart_queue;
17543 +       unsigned long tx_queue_len;
17544 +       u32 txd_cmd;
17545 +       u32 tx_timeout_count;
17546 +
17547 +       /* RX */
17548 +       struct igb_ring *rx_ring;      /* One per active queue */
17549 +       int num_tx_queues;
17550 +       int num_rx_queues;
17551 +
17552 +       u64 hw_csum_err;
17553 +       u64 hw_csum_good;
17554 +       u64 rx_hdr_split;
17555 +       u32 alloc_rx_buff_failed;
17556 +       bool rx_csum;
17557 +       u16 rx_ps_hdr_size;
17558 +       u32 max_frame_size;
17559 +       u32 min_frame_size;
17560 +
17561 +
17562 +       /* OS defined structs */
17563 +       struct net_device *netdev;
17564 +       struct pci_dev *pdev;
17565 +       struct net_device_stats net_stats;
17566 +
17567 +       /* structs defined in e1000_hw.h */
17568 +       struct e1000_hw hw;
17569 +       struct e1000_hw_stats stats;
17570 +       struct e1000_phy_info phy_info;
17571 +       struct e1000_phy_stats phy_stats;
17572 +
17573 +#ifdef ETHTOOL_TEST
17574 +       u32 test_icr;
17575 +       struct igb_ring test_tx_ring;
17576 +       struct igb_ring test_rx_ring;
17577 +#endif
17578 +
17579 +
17580 +       int msg_enable;
17581 +       struct msix_entry *msix_entries;
17582 +       int int_mode;
17583 +       u32 eims_enable_mask;
17584 +       u32 eims_other;
17585 +       u32 lli_port;
17586 +       u32 lli_size;
17587 +       u64 lli_int;
17588 +       unsigned long state;
17589 +       unsigned int flags;
17590 +       u32 eeprom_wol;
17591 +       u32 *config_space;
17592 +#ifdef HAVE_TX_MQ
17593 +       struct igb_ring *multi_tx_table[IGB_ABS_MAX_TX_QUEUES];
17594 +#endif /* HAVE_TX_MQ */
17595 +#ifdef IGB_LRO
17596 +       unsigned int lro_max_aggr;
17597 +       unsigned int lro_aggregated;
17598 +       unsigned int lro_flushed;
17599 +       unsigned int lro_no_desc;
17600 +#endif
17601 +       unsigned int tx_ring_count;
17602 +       unsigned int rx_ring_count;
17603 +};
17604 +
17605 +
17606 +#define IGB_FLAG_HAS_MSI           (1 << 0)
17607 +#define IGB_FLAG_MSI_ENABLE        (1 << 1)
17608 +#define IGB_FLAG_HAS_DCA           (1 << 2)
17609 +#define IGB_FLAG_DCA_ENABLED       (1 << 3)
17610 +#define IGB_FLAG_LLI_PUSH          (1 << 4)
17611 +#define IGB_FLAG_IN_NETPOLL        (1 << 5)
17612 +#define IGB_FLAG_QUAD_PORT_A       (1 << 6)
17613 +#define IGB_FLAG_NEED_CTX_IDX      (1 << 7)
17614 +
17615 +enum e1000_state_t {
17616 +       __IGB_TESTING,
17617 +       __IGB_RESETTING,
17618 +       __IGB_DOWN
17619 +};
17620 +
17621 +extern char igb_driver_name[];
17622 +extern char igb_driver_version[];
17623 +
17624 +extern int igb_up(struct igb_adapter *);
17625 +extern void igb_down(struct igb_adapter *);
17626 +extern void igb_reinit_locked(struct igb_adapter *);
17627 +extern void igb_reset(struct igb_adapter *);
17628 +extern int igb_set_spd_dplx(struct igb_adapter *, u16);
17629 +extern int igb_setup_tx_resources(struct igb_adapter *, struct igb_ring *);
17630 +extern int igb_setup_rx_resources(struct igb_adapter *, struct igb_ring *);
17631 +extern void igb_free_tx_resources(struct igb_ring *);
17632 +extern void igb_free_rx_resources(struct igb_ring *);
17633 +extern void igb_update_stats(struct igb_adapter *);
17634 +extern void igb_set_ethtool_ops(struct net_device *);
17635 +extern void igb_check_options(struct igb_adapter *);
17636 +#ifdef ETHTOOL_OPS_COMPAT
17637 +extern int ethtool_ioctl(struct ifreq *);
17638 +#endif
17639 +
17640 +#endif /* _IGB_H_ */
17641 diff -Nru vanilla/drivers/net/igb/igb_main.c linux-i686-2.6.22/drivers/net/igb/igb_main.c
17642 --- vanilla/drivers/net/igb/igb_main.c  1969-12-31 19:00:00.000000000 -0500
17643 +++ linux-i686-2.6.22/drivers/net/igb/igb_main.c        2009-07-16 19:25:22.000000000 -0400
17644 @@ -0,0 +1,4844 @@
17645 +/*******************************************************************************
17646 +
17647 +  Intel(R) Gigabit Ethernet Linux driver
17648 +  Copyright(c) 2007-2008 Intel Corporation.
17649 +
17650 +  This program is free software; you can redistribute it and/or modify it
17651 +  under the terms and conditions of the GNU General Public License,
17652 +  version 2, as published by the Free Software Foundation.
17653 +
17654 +  This program is distributed in the hope it will be useful, but WITHOUT
17655 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17656 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17657 +  more details.
17658 +
17659 +  You should have received a copy of the GNU General Public License along with
17660 +  this program; if not, write to the Free Software Foundation, Inc.,
17661 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17662 +
17663 +  The full GNU General Public License is included in this distribution in
17664 +  the file called "COPYING".
17665 +
17666 +  Contact Information:
17667 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
17668 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
17669 +
17670 +*******************************************************************************/
17671 +
17672 +#include <linux/module.h>
17673 +#include <linux/types.h>
17674 +#include <linux/init.h>
17675 +#include <linux/vmalloc.h>
17676 +#include <linux/pagemap.h>
17677 +#include <linux/netdevice.h>
17678 +#include <linux/tcp.h>
17679 +#ifdef NETIF_F_TSO
17680 +#include <net/checksum.h>
17681 +#ifdef NETIF_F_TSO6
17682 +#include <linux/ipv6.h>
17683 +#include <net/ip6_checksum.h>
17684 +#endif
17685 +#endif
17686 +#ifdef SIOCGMIIPHY
17687 +#include <linux/mii.h>
17688 +#endif
17689 +#ifdef SIOCETHTOOL
17690 +#include <linux/ethtool.h>
17691 +#endif
17692 +#include <linux/if_vlan.h>
17693 +
17694 +#include "igb.h"
17695 +
17696 +
17697 +#if defined(DEBUG) || defined (DEBUG_DUMP) || defined (DEBUG_ICR) || \
17698 +    defined(DEBUG_ITR)
17699 +#define DRV_DEBUG "_debug"
17700 +#else
17701 +#define DRV_DEBUG
17702 +#endif
17703 +#define DRV_HW_PERF
17704 +
17705 +#define DRV_VERSION "1.3.8.6" DRV_DEBUG DRV_HW_PERF
17706 +
17707 +char igb_driver_name[] = "igb";
17708 +char igb_driver_version[] = DRV_VERSION;
17709 +static const char igb_driver_string[] =
17710 +                                "Intel(R) Gigabit Ethernet Network Driver";
17711 +static const char igb_copyright[] = "Copyright (c) 2007-2008 Intel Corporation.";
17712 +
17713 +static struct pci_device_id igb_pci_tbl[] = {
17714 +       { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576) },
17715 +       { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER) },
17716 +       { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES) },
17717 +       { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER) },
17718 +       { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES) },
17719 +       { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER) },
17720 +       /* required last entry */
17721 +       {0, }
17722 +};
17723 +
17724 +MODULE_DEVICE_TABLE(pci, igb_pci_tbl);
17725 +
17726 +void igb_reset(struct igb_adapter *);
17727 +static int igb_setup_all_tx_resources(struct igb_adapter *);
17728 +static int igb_setup_all_rx_resources(struct igb_adapter *);
17729 +static void igb_free_all_tx_resources(struct igb_adapter *);
17730 +static void igb_free_all_rx_resources(struct igb_adapter *);
17731 +void igb_update_stats(struct igb_adapter *);
17732 +static int igb_probe(struct pci_dev *, const struct pci_device_id *);
17733 +static void __devexit igb_remove(struct pci_dev *pdev);
17734 +static int igb_sw_init(struct igb_adapter *);
17735 +static int igb_open(struct net_device *);
17736 +static int igb_close(struct net_device *);
17737 +static void igb_configure_tx(struct igb_adapter *);
17738 +static void igb_configure_rx(struct igb_adapter *);
17739 +static void igb_setup_rctl(struct igb_adapter *);
17740 +static void igb_clean_all_tx_rings(struct igb_adapter *);
17741 +static void igb_clean_all_rx_rings(struct igb_adapter *);
17742 +static void igb_clean_tx_ring(struct igb_ring *);
17743 +static void igb_clean_rx_ring(struct igb_ring *);
17744 +static void igb_set_multi(struct net_device *);
17745 +static void igb_update_phy_info(unsigned long);
17746 +static void igb_watchdog(unsigned long);
17747 +static void igb_watchdog_task(struct work_struct *);
17748 +static int igb_xmit_frame_ring_adv(struct sk_buff *, struct net_device *,
17749 +                                 struct igb_ring *);
17750 +static int igb_xmit_frame_adv(struct sk_buff *skb, struct net_device *);
17751 +static struct net_device_stats * igb_get_stats(struct net_device *);
17752 +static int igb_change_mtu(struct net_device *, int);
17753 +static int igb_set_mac(struct net_device *, void *);
17754 +static irqreturn_t igb_intr(int irq, void *);
17755 +static irqreturn_t igb_intr_msi(int irq, void *);
17756 +static irqreturn_t igb_msix_other(int irq, void *);
17757 +static irqreturn_t igb_msix_rx(int irq, void *);
17758 +#ifdef CONFIG_IGB_SEPARATE_TX_HANDLER
17759 +static irqreturn_t igb_msix_tx(int irq, void *);
17760 +#endif
17761 +static int igb_clean_rx_ring_msix(struct napi_struct *, int);
17762 +#ifdef IGB_DCA
17763 +static void igb_update_rx_dca(struct igb_ring *);
17764 +static void igb_update_tx_dca(struct igb_ring *);
17765 +static void igb_setup_dca(struct igb_adapter *);
17766 +#endif /* IGB_DCA */
17767 +static bool igb_clean_tx_irq(struct igb_ring *);
17768 +static int igb_poll(struct napi_struct *, int);
17769 +static bool igb_clean_rx_irq_adv(struct igb_ring *, int *, int);
17770 +static void igb_alloc_rx_buffers_adv(struct igb_ring *, int);
17771 +#ifdef IGB_LRO
17772 +static int igb_get_skb_hdr(struct sk_buff *skb, void **, void **, u64 *, void *);
17773 +#endif
17774 +static int igb_ioctl(struct net_device *, struct ifreq *, int cmd);
17775 +static void igb_tx_timeout(struct net_device *);
17776 +static void igb_reset_task(struct work_struct *);
17777 +static void igb_vlan_rx_register(struct net_device *, struct vlan_group *);
17778 +static void igb_vlan_rx_add_vid(struct net_device *, u16);
17779 +static void igb_vlan_rx_kill_vid(struct net_device *, u16);
17780 +static void igb_restore_vlan(struct igb_adapter *);
17781 +
17782 +static int igb_suspend(struct pci_dev *, pm_message_t);
17783 +#ifdef CONFIG_PM
17784 +static int igb_resume(struct pci_dev *);
17785 +#endif
17786 +#ifndef USE_REBOOT_NOTIFIER
17787 +static void igb_shutdown(struct pci_dev *);
17788 +#else
17789 +static int igb_notify_reboot(struct notifier_block *, unsigned long, void *);
17790 +static struct notifier_block igb_notifier_reboot = {
17791 +       .notifier_call  = igb_notify_reboot,
17792 +       .next           = NULL,
17793 +       .priority       = 0
17794 +};
17795 +#endif
17796 +#ifdef IGB_DCA
17797 +static int igb_notify_dca(struct notifier_block *, unsigned long, void *);
17798 +static struct notifier_block dca_notifier = {
17799 +       .notifier_call  = igb_notify_dca,
17800 +       .next           = NULL,
17801 +       .priority       = 0
17802 +};
17803 +#endif
17804 +
17805 +#ifdef CONFIG_NET_POLL_CONTROLLER
17806 +/* for netdump / net console */
17807 +static void igb_netpoll (struct net_device *);
17808 +#endif
17809 +
17810 +#ifdef HAVE_PCI_ERS
17811 +static pci_ers_result_t igb_io_error_detected(struct pci_dev *,
17812 +                     pci_channel_state_t);
17813 +static pci_ers_result_t igb_io_slot_reset(struct pci_dev *);
17814 +static void igb_io_resume(struct pci_dev *);
17815 +
17816 +static struct pci_error_handlers igb_err_handler = {
17817 +       .error_detected = igb_io_error_detected,
17818 +       .slot_reset = igb_io_slot_reset,
17819 +       .resume = igb_io_resume,
17820 +};
17821 +#endif
17822 +
17823 +
17824 +static struct pci_driver igb_driver = {
17825 +       .name     = igb_driver_name,
17826 +       .id_table = igb_pci_tbl,
17827 +       .probe    = igb_probe,
17828 +       .remove   = __devexit_p(igb_remove),
17829 +#ifdef CONFIG_PM
17830 +       /* Power Managment Hooks */
17831 +       .suspend  = igb_suspend,
17832 +       .resume   = igb_resume,
17833 +#endif
17834 +#ifndef USE_REBOOT_NOTIFIER
17835 +       .shutdown = igb_shutdown,
17836 +#endif
17837 +#ifdef HAVE_PCI_ERS
17838 +       .err_handler = &igb_err_handler
17839 +#endif
17840 +};
17841 +
17842 +MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>");
17843 +MODULE_DESCRIPTION("Intel(R) Gigabit Ethernet Network Driver");
17844 +MODULE_LICENSE("GPL");
17845 +MODULE_VERSION(DRV_VERSION);
17846 +
17847 +static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE;
17848 +module_param(debug, int, 0);
17849 +MODULE_PARM_DESC(debug, "Debug level (0=none, ..., 16=all)");
17850 +
17851 +/**
17852 + * igb_init_module - Driver Registration Routine
17853 + *
17854 + * igb_init_module is the first routine called when the driver is
17855 + * loaded. All it does is register with the PCI subsystem.
17856 + **/
17857 +
17858 +static int __init igb_init_module(void)
17859 +{
17860 +       int ret;
17861 +
17862 +
17863 +       printk(KERN_INFO "%s - version %s\n",
17864 +              igb_driver_string, igb_driver_version);
17865 +
17866 +       printk(KERN_INFO "%s\n", igb_copyright);
17867 +
17868 +       ret = pci_register_driver(&igb_driver);
17869 +#ifdef USE_REBOOT_NOTIFIER
17870 +       if (ret >= 0) {
17871 +               register_reboot_notifier(&igb_notifier_reboot);
17872 +       }
17873 +#endif
17874 +#ifdef IGB_DCA
17875 +       dca_register_notify(&dca_notifier);
17876 +#endif
17877 +       return ret;
17878 +}
17879 +
17880 +module_init(igb_init_module);
17881 +
17882 +/**
17883 + * igb_exit_module - Driver Exit Cleanup Routine
17884 + *
17885 + * igb_exit_module is called just before the driver is removed
17886 + * from memory.
17887 + **/
17888 +
17889 +static void __exit igb_exit_module(void)
17890 +{
17891 +#ifdef IGB_DCA
17892 +       dca_unregister_notify(&dca_notifier);
17893 +#endif
17894 +#ifdef USE_REBOOT_NOTIFIER
17895 +       unregister_reboot_notifier(&igb_notifier_reboot);
17896 +#endif
17897 +       pci_unregister_driver(&igb_driver);
17898 +}
17899 +
17900 +module_exit(igb_exit_module);
17901 +
17902 +/**
17903 + * igb_alloc_queues - Allocate memory for all rings
17904 + * @adapter: board private structure to initialize
17905 + *
17906 + * We allocate one ring per queue at run-time since we don't know the
17907 + * number of queues at compile-time.
17908 + **/
17909 +
17910 +static int igb_alloc_queues(struct igb_adapter *adapter)
17911 +{
17912 +       int i;
17913 +
17914 +       adapter->tx_ring = kcalloc(adapter->num_tx_queues,
17915 +                                  sizeof(struct igb_ring), GFP_KERNEL);
17916 +       if (!adapter->tx_ring)
17917 +               goto err;
17918 +
17919 +       adapter->rx_ring = kcalloc(adapter->num_rx_queues,
17920 +                                  sizeof(struct igb_ring), GFP_KERNEL);
17921 +       if (!adapter->rx_ring)
17922 +               goto err;
17923 +
17924 +       adapter->rx_ring->buddy = adapter->tx_ring;
17925 +
17926 +       for (i = 0; i < adapter->num_tx_queues; i++) {
17927 +               struct igb_ring *ring = &(adapter->tx_ring[i]);
17928 +               ring->count = adapter->tx_ring_count;
17929 +               ring->adapter = adapter;
17930 +               ring->queue_index = i;
17931 +       }
17932 +       for (i = 0; i < adapter->num_rx_queues; i++) {
17933 +               struct igb_ring *ring = &(adapter->rx_ring[i]);
17934 +               ring->count = adapter->rx_ring_count;
17935 +               ring->adapter = adapter;
17936 +               ring->queue_index = i;
17937 +               ring->itr_register = E1000_ITR;
17938 +               /* set a default napi handler for each rx_ring */
17939 +               netif_napi_add(adapter->netdev, &ring->napi, igb_poll, 64);
17940 +       }
17941 +       return E1000_SUCCESS;
17942 +
17943 +err:
17944 +       kfree(adapter->tx_ring);
17945 +       kfree(adapter->rx_ring);
17946 +       return -ENOMEM;
17947 +}
17948 +
17949 +static void igb_free_queues(struct igb_adapter *adapter)
17950 +{
17951 +       int i;
17952 +
17953 +       for (i = 0; i < adapter->num_rx_queues; i++)
17954 +               netif_napi_del(&adapter->rx_ring[i].napi);
17955 +
17956 +       kfree(adapter->tx_ring);
17957 +       kfree(adapter->rx_ring);
17958 +}
17959 +
17960 +static void igb_configure_lli(struct igb_adapter *adapter)
17961 +{
17962 +       struct e1000_hw *hw = &adapter->hw;
17963 +       u16 port;
17964 +
17965 +       /* LLI should only be enabled for MSI-X or MSI interrupts */
17966 +       if (!adapter->msix_entries && !(adapter->flags & IGB_FLAG_HAS_MSI))
17967 +               return;
17968 +
17969 +       if (adapter->lli_port) {
17970 +               /* use filter 0 for port */
17971 +               port = ntohs((u16)adapter->lli_port);
17972 +               E1000_WRITE_REG(hw, E1000_IMIR(0),
17973 +                       (port | E1000_IMIR_PORT_IM_EN));
17974 +               E1000_WRITE_REG(hw, E1000_IMIREXT(0),
17975 +                       (E1000_IMIREXT_SIZE_BP | E1000_IMIREXT_CTRL_BP));
17976 +       }
17977 +
17978 +       if (adapter->flags & IGB_FLAG_LLI_PUSH) {
17979 +               /* use filter 1 for push flag */
17980 +               E1000_WRITE_REG(hw, E1000_IMIR(1),
17981 +                       (E1000_IMIR_PORT_BP | E1000_IMIR_PORT_IM_EN));
17982 +               E1000_WRITE_REG(hw, E1000_IMIREXT(1),
17983 +                       (E1000_IMIREXT_SIZE_BP | E1000_IMIREXT_CTRL_PSH));
17984 +       }
17985 +
17986 +       if (adapter->lli_size) {
17987 +               /* use filter 2 for size */
17988 +               E1000_WRITE_REG(hw, E1000_IMIR(2),
17989 +                       (E1000_IMIR_PORT_BP | E1000_IMIR_PORT_IM_EN));
17990 +               E1000_WRITE_REG(hw, E1000_IMIREXT(2),
17991 +                       (adapter->lli_size | E1000_IMIREXT_CTRL_BP));
17992 +       }
17993 +
17994 +}
17995 +
17996 +#define IGB_N0_QUEUE -1
17997 +
17998 +static void igb_assign_vector(struct igb_adapter *adapter, int rx_queue,
17999 +                              int tx_queue, int msix_vector)
18000 +{
18001 +       u32 msixbm = 0;
18002 +       struct e1000_hw *hw = &adapter->hw;
18003 +       u32 ivar, index;
18004 +
18005 +       switch (hw->mac.type) {
18006 +       case e1000_82575:
18007 +               /* The 82575 assigns vectors using a bitmask, which matches the
18008 +                  bitmask for the EICR/EIMS/EIMC registers.  To assign one
18009 +                  or more queues to a vector, we write the appropriate bits
18010 +                  into the MSIXBM register for that vector. */
18011 +               if (rx_queue > IGB_N0_QUEUE) {
18012 +                       msixbm = E1000_EICR_RX_QUEUE0 << rx_queue;
18013 +                       adapter->rx_ring[rx_queue].eims_value = msixbm;
18014 +               }
18015 +               if (tx_queue > IGB_N0_QUEUE) {
18016 +                       msixbm |= E1000_EICR_TX_QUEUE0 << tx_queue;
18017 +                       adapter->tx_ring[tx_queue].eims_value =
18018 +                                 E1000_EICR_TX_QUEUE0 << tx_queue;
18019 +               }
18020 +               E1000_WRITE_REG_ARRAY(hw, E1000_MSIXBM(0), msix_vector, msixbm);
18021 +               break;
18022 +       case e1000_82576:
18023 +               /* 82576 uses a table-based method for assigning vectors.
18024 +                  Each queue has a single entry in the table to which we write
18025 +                  a vector number along with a "valid" bit.  Sadly, the layout
18026 +                  of the table is somewhat counterintuitive. */
18027 +               if (rx_queue > IGB_N0_QUEUE) {
18028 +                       index = (rx_queue & 0x7);
18029 +                       ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index);
18030 +                       if (rx_queue < 8) {
18031 +                               /* vector goes into low byte of register */
18032 +                               ivar = ivar & 0xFFFFFF00;
18033 +                               ivar |= msix_vector | E1000_IVAR_VALID;
18034 +                       } else {
18035 +                               /* vector goes into third byte of register */
18036 +                               ivar = ivar & 0xFF00FFFF;
18037 +                               ivar |= (msix_vector | E1000_IVAR_VALID) << 16;
18038 +                       }
18039 +                       adapter->rx_ring[rx_queue].eims_value= 1 << msix_vector;
18040 +                       E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar);
18041 +               }
18042 +               if (tx_queue > IGB_N0_QUEUE) {
18043 +                       index = (tx_queue & 0x7);
18044 +                       ivar = E1000_READ_REG_ARRAY(hw, E1000_IVAR0, index);
18045 +                       if (tx_queue < 8) {
18046 +                               /* vector goes into second byte of register */
18047 +                               ivar = ivar & 0xFFFF00FF;
18048 +                               ivar |= (msix_vector | E1000_IVAR_VALID) << 8;
18049 +                       } else {
18050 +                               /* vector goes into high byte of register */
18051 +                               ivar = ivar & 0x00FFFFFF;
18052 +                               ivar |= (msix_vector | E1000_IVAR_VALID) << 24;
18053 +                       }
18054 +                       adapter->tx_ring[tx_queue].eims_value= 1 << msix_vector;
18055 +                       E1000_WRITE_REG_ARRAY(hw, E1000_IVAR0, index, ivar);
18056 +               }
18057 +               break;
18058 +       default:
18059 +               BUG();
18060 +               break;
18061 +       }
18062 +}
18063 +
18064 +/**
18065 + * igb_configure_msix - Configure MSI-X hardware
18066 + *
18067 + * igb_configure_msix sets up the hardware to properly
18068 + * generate MSI-X interrupts.
18069 + **/
18070 +static void igb_configure_msix(struct igb_adapter *adapter)
18071 +{
18072 +       u32 tmp;
18073 +       int i, vector = 0;
18074 +       struct e1000_hw *hw = &adapter->hw;
18075 +
18076 +       adapter->eims_enable_mask = 0;
18077 +       if (hw->mac.type == e1000_82576)
18078 +               /* Turn on MSI-X capability first, or our settings
18079 +                * won't stick.  And it will take days to debug. */
18080 +               E1000_WRITE_REG(hw, E1000_GPIE, E1000_GPIE_MSIX_MODE |
18081 +                                  E1000_GPIE_PBA | E1000_GPIE_EIAME |
18082 +                                  E1000_GPIE_NSICR);
18083 +
18084 +#ifdef CONFIG_IGB_SEPARATE_TX_HANDLER
18085 +       for (i = 0; i < adapter->num_tx_queues; i++) {
18086 +               struct igb_ring *tx_ring = &adapter->tx_ring[i];
18087 +               igb_assign_vector(adapter, IGB_N0_QUEUE, i, vector++);
18088 +               adapter->eims_enable_mask |= tx_ring->eims_value;
18089 +               if (tx_ring->itr_val)
18090 +                       writel(tx_ring->itr_val,
18091 +                              hw->hw_addr + tx_ring->itr_register);
18092 +               else
18093 +                       writel(1, hw->hw_addr + tx_ring->itr_register);
18094 +       }
18095 +
18096 +       for (i = 0; i < adapter->num_rx_queues; i++) {
18097 +               struct igb_ring *rx_ring = &adapter->rx_ring[i];
18098 +               rx_ring->buddy = NULL;
18099 +               igb_assign_vector(adapter, i, IGB_N0_QUEUE, vector++);
18100 +               adapter->eims_enable_mask |= rx_ring->eims_value;
18101 +               if (rx_ring->itr_val)
18102 +                       writel(rx_ring->itr_val,
18103 +                              hw->hw_addr + rx_ring->itr_register);
18104 +               else
18105 +                       writel(1, hw->hw_addr + rx_ring->itr_register);
18106 +       }
18107 +
18108 +#else
18109 +       for (i = 0; i < adapter->num_rx_queues; i++) {
18110 +               struct igb_ring *rx_ring = &adapter->rx_ring[i];
18111 +               if (i < adapter->num_tx_queues) {
18112 +                       igb_assign_vector(adapter, i, i, vector++);
18113 +                       rx_ring->buddy = &adapter->tx_ring[i];
18114 +                       rx_ring->eims_value |= adapter->tx_ring[i].eims_value;
18115 +               } else {
18116 +                       igb_assign_vector(adapter, i, IGB_N0_QUEUE, vector++);
18117 +               }
18118 +               adapter->eims_enable_mask |= rx_ring->eims_value;
18119 +               if (rx_ring->itr_val)
18120 +                       writel(rx_ring->itr_val,
18121 +                              hw->hw_addr + rx_ring->itr_register);
18122 +               else
18123 +                       writel(1, hw->hw_addr + rx_ring->itr_register);
18124 +       }
18125 +
18126 +#endif
18127 +
18128 +       /* set vector for other causes, i.e. link changes */
18129 +
18130 +       switch (hw->mac.type) {
18131 +       case e1000_82575:
18132 +               E1000_WRITE_REG_ARRAY(hw, E1000_MSIXBM(0), vector++,
18133 +                                     E1000_EIMS_OTHER);
18134 +
18135 +               tmp = E1000_READ_REG(hw, E1000_CTRL_EXT);
18136 +               /* enable MSI-X PBA support*/
18137 +               tmp |= E1000_CTRL_EXT_PBA_CLR;
18138 +
18139 +               /* Auto-Mask interrupts upon ICR read. */
18140 +               tmp |= E1000_CTRL_EXT_EIAME;
18141 +               tmp |= E1000_CTRL_EXT_IRCA;
18142 +
18143 +               E1000_WRITE_REG(hw, E1000_CTRL_EXT, tmp);
18144 +               adapter->eims_enable_mask |= E1000_EIMS_OTHER;
18145 +               adapter->eims_other = E1000_EIMS_OTHER;
18146 +
18147 +               break;
18148 +
18149 +       case e1000_82576:
18150 +               tmp = (vector++ | E1000_IVAR_VALID) << 8;
18151 +               E1000_WRITE_REG(hw, E1000_IVAR_MISC, tmp);
18152 +
18153 +               adapter->eims_enable_mask = (1 << (vector)) - 1;
18154 +               adapter->eims_other = 1 << (vector - 1);
18155 +               break;
18156 +       default:
18157 +               /* do nothing, since nothing else supports MSI-X */
18158 +               break;
18159 +       } /* switch (hw->mac.type) */
18160 +       E1000_WRITE_FLUSH(hw);
18161 +}
18162 +
18163 +/**
18164 + * igb_request_msix - Initialize MSI-X interrupts
18165 + *
18166 + * igb_request_msix allocates MSI-X vectors and requests interrupts from the
18167 + * kernel.
18168 + **/
18169 +static int igb_request_msix(struct igb_adapter *adapter)
18170 +{
18171 +       struct net_device *netdev = adapter->netdev;
18172 +       int i, err = 0, vector = 0;
18173 +
18174 +       vector = 0;
18175 +
18176 +#ifdef CONFIG_IGB_SEPARATE_TX_HANDLER
18177 +       for (i = 0; i < adapter->num_tx_queues; i++) {
18178 +               struct igb_ring *ring = &(adapter->tx_ring[i]);
18179 +               sprintf(ring->name, "%s-tx%d", netdev->name, i);
18180 +               err = request_irq(adapter->msix_entries[vector].vector,
18181 +                                 &igb_msix_tx, 0, ring->name,
18182 +                                 &(adapter->tx_ring[i]));
18183 +               if (err)
18184 +                       goto out;
18185 +               ring->itr_register = E1000_EITR(0) + (vector << 2);
18186 +               ring->itr_val = 1952; /* ~2000 ints/sec */
18187 +               vector++;
18188 +       }
18189 +#endif
18190 +       for (i = 0; i < adapter->num_rx_queues; i++) {
18191 +               struct igb_ring *ring = &(adapter->rx_ring[i]);
18192 +               if (strlen(netdev->name) < (IFNAMSIZ - 5))
18193 +#ifdef CONFIG_IGB_SEPARATE_TX_HANDLER
18194 +                       sprintf(ring->name, "%s-rx%d", netdev->name, i);
18195 +#else
18196 +                       sprintf(ring->name, "%s-Q%d", netdev->name, i);
18197 +#endif
18198 +               else
18199 +                       memcpy(ring->name, netdev->name, IFNAMSIZ);
18200 +               err = request_irq(adapter->msix_entries[vector].vector,
18201 +                                 &igb_msix_rx, 0, ring->name,
18202 +                                 &(adapter->rx_ring[i]));
18203 +               if (err)
18204 +                       goto out;
18205 +               ring->itr_register = E1000_EITR(0) + (vector << 2);
18206 +               ring->itr_val = adapter->itr;
18207 +               /* overwrite the poll routine for MSIX, we've already done
18208 +                * netif_napi_add */
18209 +               ring->napi.poll = &igb_clean_rx_ring_msix;
18210 +               vector++;
18211 +       }
18212 +
18213 +       err = request_irq(adapter->msix_entries[vector].vector,
18214 +                         &igb_msix_other, 0, netdev->name, netdev);
18215 +       if (err)
18216 +               goto out;
18217 +
18218 +
18219 +       igb_configure_msix(adapter);
18220 +       return 0;
18221 +out:
18222 +       return err;
18223 +}
18224 +
18225 +static void igb_reset_interrupt_capability(struct igb_adapter *adapter)
18226 +{
18227 +       if (adapter->msix_entries) {
18228 +               pci_disable_msix(adapter->pdev);
18229 +               kfree(adapter->msix_entries);
18230 +               adapter->msix_entries = NULL;
18231 +       } else if (adapter->flags & IGB_FLAG_HAS_MSI)
18232 +               pci_disable_msi(adapter->pdev);
18233 +
18234 +       return;
18235 +}
18236 +
18237 +
18238 +/**
18239 + * igb_set_interrupt_capability - set MSI or MSI-X if supported
18240 + *
18241 + * Attempt to configure interrupts using the best available
18242 + * capabilities of the hardware and kernel.
18243 + **/
18244 +static void igb_set_interrupt_capability(struct igb_adapter *adapter)
18245 +{
18246 +       int err;
18247 +       int numvecs, i;
18248 +
18249 +
18250 +       switch (adapter->int_mode) {
18251 +       case IGB_INT_MODE_MSIX_1Q:
18252 +               adapter->num_rx_queues = 1;
18253 +               adapter->num_tx_queues = 1;
18254 +       case IGB_INT_MODE_MSIX_MQ:
18255 +#ifdef CONFIG_IGB_SEPARATE_TX_HANDLER
18256 +               numvecs = adapter->num_tx_queues + adapter->num_rx_queues + 1;
18257 +#else
18258 +               numvecs = adapter->num_rx_queues + 1;
18259 +#endif
18260 +               adapter->msix_entries = kcalloc(numvecs,
18261 +                                               sizeof(struct msix_entry),
18262 +                                               GFP_KERNEL);
18263 +               if (adapter->msix_entries) {
18264 +                       for (i=0; i < numvecs; i++)
18265 +                               adapter->msix_entries[i].entry = i;
18266 +
18267 +                       err = pci_enable_msix(adapter->pdev,
18268 +                                             adapter->msix_entries, numvecs);
18269 +                       if (err == 0)
18270 +                               break;
18271 +               }
18272 +               /* MSI-X failed, so fall through and try MSI */
18273 +               DPRINTK(PROBE, WARNING, "Failed to initialize MSI-X interrupts."
18274 +                       "  Falling back to MSI interrupts.\n");
18275 +               igb_reset_interrupt_capability(adapter);
18276 +       case IGB_INT_MODE_MSI:
18277 +               if (!pci_enable_msi(adapter->pdev))
18278 +                       adapter->flags |= IGB_FLAG_HAS_MSI;
18279 +               else
18280 +                       DPRINTK(PROBE, WARNING, "Failed to initialize MSI "
18281 +                               "interrupts. Falling back to legacy interrupts.\n");
18282 +               /* Fall through */
18283 +       case IGB_INT_MODE_LEGACY:
18284 +               adapter->num_rx_queues = 1;
18285 +               adapter->num_tx_queues = 1;
18286 +               /* Don't do anything; this is system default */
18287 +               break;
18288 +       }
18289 +
18290 +#ifdef HAVE_TX_MQ
18291 +       /* Notify the stack of the (possibly) reduced Tx Queue count. */
18292 +#ifdef CONFIG_NETDEVICES_MULTIQUEUE
18293 +       adapter->netdev->egress_subqueue_count = adapter->num_tx_queues;
18294 +#else
18295 +       adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
18296 +#endif 
18297 +#endif
18298 +
18299 +       return;
18300 +}
18301 +
18302 +/**
18303 + * igb_request_irq - initialize interrupts
18304 + *
18305 + * Attempts to configure interrupts using the best available
18306 + * capabilities of the hardware and kernel.
18307 + **/
18308 +static int igb_request_irq(struct igb_adapter *adapter)
18309 +{
18310 +       struct net_device *netdev = adapter->netdev;
18311 +       struct e1000_hw *hw = &adapter->hw;
18312 +       int err = 0;
18313 +
18314 +       if (adapter->msix_entries) {
18315 +               err = igb_request_msix(adapter);
18316 +               if (!err)
18317 +                       goto request_done;
18318 +               /* fall back to MSI */
18319 +               igb_reset_interrupt_capability(adapter);
18320 +               if (!pci_enable_msi(adapter->pdev))
18321 +                       adapter->flags |= IGB_FLAG_HAS_MSI;
18322 +               igb_free_all_tx_resources(adapter);
18323 +               igb_free_all_rx_resources(adapter);
18324 +               adapter->num_rx_queues = 1;
18325 +               igb_alloc_queues(adapter);
18326 +       } else {
18327 +               switch (hw->mac.type) {
18328 +               case e1000_82575:
18329 +                       E1000_WRITE_REG(hw, E1000_MSIXBM(0),
18330 +                                       (E1000_EICR_RX_QUEUE0 |
18331 +                                        E1000_EIMS_OTHER));
18332 +                       break;
18333 +               case e1000_82576:
18334 +                       E1000_WRITE_REG(hw, E1000_IVAR0, E1000_IVAR_VALID);
18335 +                       break;
18336 +               default:
18337 +                       break;
18338 +               }
18339 +       }
18340 +       if (adapter->flags & IGB_FLAG_HAS_MSI) {
18341 +               err = request_irq(adapter->pdev->irq, &igb_intr_msi, 0,
18342 +                                 netdev->name, netdev);
18343 +               if (!err)
18344 +                       goto request_done;
18345 +
18346 +               /* fall back to legacy interrupts */
18347 +               igb_reset_interrupt_capability(adapter);
18348 +               adapter->flags &= ~IGB_FLAG_HAS_MSI;
18349 +       }
18350 +
18351 +       err = request_irq(adapter->pdev->irq, &igb_intr, IRQF_SHARED,
18352 +                         netdev->name, netdev);
18353 +
18354 +       if (err) {
18355 +               DPRINTK(PROBE, ERR, "Error %d getting interrupt\n", err);
18356 +               goto request_done;
18357 +       }
18358 +
18359 +request_done:
18360 +       return err;
18361 +}
18362 +
18363 +static void igb_free_irq(struct igb_adapter *adapter)
18364 +{
18365 +       struct net_device *netdev = adapter->netdev;
18366 +
18367 +       if (adapter->msix_entries) {
18368 +               int vector = 0, i;
18369 +
18370 +#ifdef CONFIG_IGB_SEPARATE_TX_HANDLER
18371 +               for (i = 0; i < adapter->num_tx_queues; i++)
18372 +                       free_irq(adapter->msix_entries[vector++].vector,
18373 +                               &(adapter->tx_ring[i]));
18374 +#endif
18375 +               for (i = 0; i < adapter->num_rx_queues; i++)
18376 +                       free_irq(adapter->msix_entries[vector++].vector,
18377 +                               &(adapter->rx_ring[i]));
18378 +
18379 +               free_irq(adapter->msix_entries[vector++].vector, netdev);
18380 +               return;
18381 +       }
18382 +
18383 +       free_irq(adapter->pdev->irq, netdev);
18384 +}
18385 +
18386 +/**
18387 + * igb_irq_disable - Mask off interrupt generation on the NIC
18388 + * @adapter: board private structure
18389 + **/
18390 +
18391 +static void igb_irq_disable(struct igb_adapter *adapter)
18392 +{
18393 +       struct e1000_hw *hw = &adapter->hw;
18394 +
18395 +       if (adapter->msix_entries) {
18396 +               E1000_WRITE_REG(hw, E1000_EIAM, 0);
18397 +               E1000_WRITE_REG(hw, E1000_EIMC, ~0);
18398 +               E1000_WRITE_REG(hw, E1000_EIAC, 0);
18399 +       }
18400 +
18401 +       E1000_WRITE_REG(hw, E1000_IAM, 0);
18402 +       E1000_WRITE_REG(hw, E1000_IMC, ~0);
18403 +       E1000_WRITE_FLUSH(hw);
18404 +
18405 +       synchronize_irq(adapter->pdev->irq);
18406 +}
18407 +
18408 +/**
18409 + * igb_irq_enable - Enable default interrupt generation settings
18410 + * @adapter: board private structure
18411 + **/
18412 +
18413 +static void igb_irq_enable(struct igb_adapter *adapter)
18414 +{
18415 +       struct e1000_hw *hw = &adapter->hw;
18416 +
18417 +       if (adapter->msix_entries) {
18418 +               E1000_WRITE_REG(hw, E1000_EIAC, adapter->eims_enable_mask);
18419 +               E1000_WRITE_REG(hw, E1000_EIAM, adapter->eims_enable_mask);
18420 +               E1000_WRITE_REG(hw, E1000_EIMS, adapter->eims_enable_mask);
18421 +               E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_LSC);
18422 +       } else {
18423 +               E1000_WRITE_REG(hw, E1000_IMS, IMS_ENABLE_MASK);
18424 +               E1000_WRITE_REG(hw, E1000_IAM, IMS_ENABLE_MASK);
18425 +       }
18426 +}
18427 +
18428 +static void igb_update_mng_vlan(struct igb_adapter *adapter)
18429 +{
18430 +       struct net_device *netdev = adapter->netdev;
18431 +       u16 vid = adapter->hw.mng_cookie.vlan_id;
18432 +       u16 old_vid = adapter->mng_vlan_id;
18433 +       if (adapter->vlgrp) {
18434 +               if (!vlan_group_get_device(adapter->vlgrp, vid)) {
18435 +                       if (adapter->hw.mng_cookie.status &
18436 +                               E1000_MNG_DHCP_COOKIE_STATUS_VLAN) {
18437 +                               igb_vlan_rx_add_vid(netdev, vid);
18438 +                               adapter->mng_vlan_id = vid;
18439 +                       } else
18440 +                               adapter->mng_vlan_id = IGB_MNG_VLAN_NONE;
18441 +
18442 +                       if ((old_vid != (u16)IGB_MNG_VLAN_NONE) &&
18443 +                                       (vid != old_vid) &&
18444 +                           !vlan_group_get_device(adapter->vlgrp, old_vid))
18445 +                               igb_vlan_rx_kill_vid(netdev, old_vid);
18446 +               } else
18447 +                       adapter->mng_vlan_id = vid;
18448 +       }
18449 +}
18450 +
18451 +/**
18452 + * igb_release_hw_control - release control of the h/w to f/w
18453 + * @adapter: address of board private structure
18454 + *
18455 + * igb_release_hw_control resets CTRL_EXT:DRV_LOAD bit.
18456 + * For ASF and Pass Through versions of f/w this means that the
18457 + * driver is no longer loaded.
18458 + *
18459 + **/
18460 +
18461 +static void igb_release_hw_control(struct igb_adapter *adapter)
18462 +{
18463 +       struct e1000_hw *hw = &adapter->hw;
18464 +       u32 ctrl_ext;
18465 +
18466 +       /* Let firmware take over control of h/w */
18467 +       ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT);
18468 +       E1000_WRITE_REG(hw, E1000_CTRL_EXT,
18469 +                       ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
18470 +}
18471 +
18472 +
18473 +/**
18474 + * igb_get_hw_control - get control of the h/w from f/w
18475 + * @adapter: address of board private structure
18476 + *
18477 + * igb_get_hw_control sets CTRL_EXT:DRV_LOAD bit.
18478 + * For ASF and Pass Through versions of f/w this means that
18479 + * the driver is loaded.
18480 + *
18481 + **/
18482 +
18483 +static void igb_get_hw_control(struct igb_adapter *adapter)
18484 +{
18485 +       struct e1000_hw *hw = &adapter->hw;
18486 +       u32 ctrl_ext;
18487 +
18488 +       /* Let firmware know the driver has taken over */
18489 +       ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT);
18490 +       E1000_WRITE_REG(hw, E1000_CTRL_EXT,
18491 +                       ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
18492 +}
18493 +
18494 +/**
18495 + * igb_configure - configure the hardware for RX and TX
18496 + * @adapter: private board structure
18497 + **/
18498 +static void igb_configure(struct igb_adapter *adapter)
18499 +{
18500 +       struct net_device *netdev = adapter->netdev;
18501 +       int i;
18502 +
18503 +       igb_get_hw_control(adapter);
18504 +       igb_set_multi(netdev);
18505 +
18506 +       igb_restore_vlan(adapter);
18507 +
18508 +       igb_configure_tx(adapter);
18509 +       igb_setup_rctl(adapter);
18510 +       igb_configure_rx(adapter);
18511 +
18512 +       e1000_rx_fifo_flush_82575(&adapter->hw);
18513 +#ifdef CONFIG_NETDEVICES_MULTIQUEUE
18514 +       if (adapter->num_tx_queues > 1)
18515 +               netdev->features |= NETIF_F_MULTI_QUEUE;
18516 +       else
18517 +               netdev->features &= ~NETIF_F_MULTI_QUEUE;
18518 +
18519 +#endif
18520 +       /* call IGB_DESC_UNUSED which always leaves
18521 +        * at least 1 descriptor unused to make sure
18522 +        * next_to_use != next_to_clean */
18523 +       for (i = 0; i < adapter->num_rx_queues; i++) {
18524 +               struct igb_ring *ring = &adapter->rx_ring[i];
18525 +               igb_alloc_rx_buffers_adv(ring, IGB_DESC_UNUSED(ring));
18526 +       }
18527 +
18528 +       adapter->tx_queue_len = netdev->tx_queue_len;
18529 +}
18530 +
18531 +
18532 +/**
18533 + * igb_up - Open the interface and prepare it to handle traffic
18534 + * @adapter: board private structure
18535 + **/
18536 +
18537 +int igb_up(struct igb_adapter *adapter)
18538 +{
18539 +       struct e1000_hw *hw = &adapter->hw;
18540 +       int i;
18541 +
18542 +       /* hardware has been reset, we need to reload some things */
18543 +       igb_configure(adapter);
18544 +
18545 +       clear_bit(__IGB_DOWN, &adapter->state);
18546 +
18547 +       for (i = 0; i < adapter->num_rx_queues; i++)
18548 +               napi_enable(&adapter->rx_ring[i].napi);
18549 +       if (adapter->msix_entries)
18550 +               igb_configure_msix(adapter);
18551 +
18552 +       igb_configure_lli(adapter);
18553 +
18554 +       /* Clear any pending interrupts. */
18555 +       E1000_READ_REG(hw, E1000_ICR);
18556 +       igb_irq_enable(adapter);
18557 +
18558 +       /* Fire a link change interrupt to start the watchdog. */
18559 +       E1000_WRITE_REG(hw, E1000_ICS, E1000_ICS_LSC);
18560 +       return 0;
18561 +}
18562 +
18563 +void igb_down(struct igb_adapter *adapter)
18564 +{
18565 +       struct net_device *netdev = adapter->netdev;
18566 +       struct e1000_hw *hw = &adapter->hw;
18567 +       u32 tctl, rctl;
18568 +       int i;
18569 +
18570 +       /* signal that we're down so the interrupt handler does not
18571 +        * reschedule our watchdog timer */
18572 +       set_bit(__IGB_DOWN, &adapter->state);
18573 +
18574 +       /* disable receives in the hardware */
18575 +       rctl = E1000_READ_REG(hw, E1000_RCTL);
18576 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN);
18577 +       /* flush and sleep below */
18578 +
18579 +       netif_tx_stop_all_queues(netdev);
18580 +
18581 +       /* disable transmits in the hardware */
18582 +       tctl = E1000_READ_REG(hw, E1000_TCTL);
18583 +       tctl &= ~E1000_TCTL_EN;
18584 +       E1000_WRITE_REG(hw, E1000_TCTL, tctl);
18585 +       /* flush both disables and wait for them to finish */
18586 +       E1000_WRITE_FLUSH(hw);
18587 +       msleep(10);
18588 +
18589 +       for (i = 0; i < adapter->num_rx_queues; i++)
18590 +               napi_disable(&adapter->rx_ring[i].napi);
18591 +
18592 +       igb_irq_disable(adapter);
18593 +
18594 +       del_timer_sync(&adapter->watchdog_timer);
18595 +       del_timer_sync(&adapter->phy_info_timer);
18596 +
18597 +       netdev->tx_queue_len = adapter->tx_queue_len;
18598 +       netif_carrier_off(netdev);
18599 +
18600 +       /* record the stats before reset*/
18601 +       igb_update_stats(adapter);
18602 +
18603 +       adapter->link_speed = 0;
18604 +       adapter->link_duplex = 0;
18605 +
18606 +#ifdef HAVE_PCI_ERS
18607 +       if (!pci_channel_offline(adapter->pdev))
18608 +               igb_reset(adapter);
18609 +#else
18610 +       igb_reset(adapter);
18611 +#endif
18612 +       igb_clean_all_tx_rings(adapter);
18613 +       igb_clean_all_rx_rings(adapter);
18614 +}
18615 +
18616 +void igb_reinit_locked(struct igb_adapter *adapter)
18617 +{
18618 +       WARN_ON(in_interrupt());
18619 +       while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
18620 +               msleep(1);
18621 +
18622 +       igb_down(adapter);
18623 +       igb_up(adapter);
18624 +       clear_bit(__IGB_RESETTING, &adapter->state);
18625 +}
18626 +
18627 +void igb_reset(struct igb_adapter *adapter)
18628 +{
18629 +       struct e1000_hw *hw = &adapter->hw;
18630 +       struct e1000_mac_info *mac = &hw->mac;
18631 +       struct e1000_fc_info *fc = &hw->fc;
18632 +       u32 pba = 0, tx_space, min_tx_space, min_rx_space;
18633 +       u16 hwm;
18634 +
18635 +       /* Repartition Pba for greater than 9k mtu
18636 +        * To take effect CTRL.RST is required.
18637 +        */
18638 +       if (mac->type != e1000_82576) {
18639 +               pba = E1000_PBA_34K;
18640 +       }
18641 +       else {
18642 +               pba = E1000_PBA_64K;
18643 +       }
18644 +
18645 +       if ((adapter->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN) &&
18646 +           (mac->type < e1000_82576)) {
18647 +               /* adjust PBA for jumbo frames */
18648 +               E1000_WRITE_REG(hw, E1000_PBA, pba);
18649 +
18650 +               /* To maintain wire speed transmits, the Tx FIFO should be
18651 +                * large enough to accommodate two full transmit packets,
18652 +                * rounded up to the next 1KB and expressed in KB.  Likewise,
18653 +                * the Rx FIFO should be large enough to accommodate at least
18654 +                * one full receive packet and is similarly rounded up and
18655 +                * expressed in KB. */
18656 +               pba = E1000_READ_REG(hw, E1000_PBA);
18657 +               /* upper 16 bits has Tx packet buffer allocation size in KB */
18658 +               tx_space = pba >> 16;
18659 +               /* lower 16 bits has Rx packet buffer allocation size in KB */
18660 +               pba &= 0xffff;
18661 +               /* the tx fifo also stores 16 bytes of information about the tx
18662 +                * but don't include ethernet FCS because hardware appends it */
18663 +               min_tx_space = (adapter->max_frame_size +
18664 +                               sizeof(struct e1000_tx_desc) -
18665 +                               ETH_FCS_LEN) * 2;
18666 +               min_tx_space = ALIGN(min_tx_space, 1024);
18667 +               min_tx_space >>= 10;
18668 +               /* software strips receive CRC, so leave room for it */
18669 +               min_rx_space = adapter->max_frame_size;
18670 +               min_rx_space = ALIGN(min_rx_space, 1024);
18671 +               min_rx_space >>= 10;
18672 +
18673 +               /* If current Tx allocation is less than the min Tx FIFO size,
18674 +                * and the min Tx FIFO size is less than the current Rx FIFO
18675 +                * allocation, take space away from current Rx allocation */
18676 +               if (tx_space < min_tx_space &&
18677 +                   ((min_tx_space - tx_space) < pba)) {
18678 +                       pba = pba - (min_tx_space - tx_space);
18679 +
18680 +                       /* if short on rx space, rx wins and must trump tx
18681 +                        * adjustment */
18682 +                       if (pba < min_rx_space)
18683 +                               pba = min_rx_space;
18684 +               }
18685 +               E1000_WRITE_REG(hw, E1000_PBA, pba);
18686 +       }
18687 +
18688 +       /* flow control settings */
18689 +       /* The high water mark must be low enough to fit one full frame
18690 +        * (or the size used for early receive) above it in the Rx FIFO.
18691 +        * Set it to the lower of:
18692 +        * - 90% of the Rx FIFO size, or
18693 +        * - the full Rx FIFO size minus one full frame */
18694 +       hwm = min(((pba << 10) * 9 / 10),
18695 +                       ((pba << 10) - 2 * adapter->max_frame_size));
18696 +
18697 +       if (mac->type < e1000_82576) {
18698 +               fc->high_water = hwm & 0xFFF8;  /* 8-byte granularity */
18699 +               fc->low_water = fc->high_water - 8;
18700 +       } else {
18701 +               fc->high_water = hwm & 0xFFF0;  /* 16-byte granularity */
18702 +               fc->low_water = fc->high_water - 16;
18703 +       }
18704 +       fc->pause_time = 0xFFFF;
18705 +       fc->send_xon = 1;
18706 +       fc->type = fc->original_type;
18707 +
18708 +       /* Allow time for pending master requests to run */
18709 +       e1000_reset_hw(hw);
18710 +       E1000_WRITE_REG(hw, E1000_WUC, 0);
18711 +
18712 +       if (e1000_init_hw(hw))
18713 +               DPRINTK(PROBE, ERR, "Hardware Error\n");
18714 +       igb_update_mng_vlan(adapter);
18715 +
18716 +       /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
18717 +       E1000_WRITE_REG(hw, E1000_VET, ETHERNET_IEEE_VLAN_TYPE);
18718 +
18719 +       e1000_get_phy_info(hw);
18720 +}
18721 +
18722 +/**
18723 + * igb_probe - Device Initialization Routine
18724 + * @pdev: PCI device information struct
18725 + * @ent: entry in igb_pci_tbl
18726 + *
18727 + * Returns 0 on success, negative on failure
18728 + *
18729 + * igb_probe initializes an adapter identified by a pci_dev structure.
18730 + * The OS initialization, configuring of the adapter private structure,
18731 + * and a hardware reset occur.
18732 + **/
18733 +
18734 +static int __devinit igb_probe(struct pci_dev *pdev,
18735 +                               const struct pci_device_id *ent)
18736 +{
18737 +       struct net_device *netdev;
18738 +       struct igb_adapter *adapter;
18739 +       struct e1000_hw *hw;
18740 +       struct pci_dev *us_dev;
18741 +
18742 +       static int cards_found = 0;
18743 +       int i, err, pci_using_dac, pos;
18744 +       u16 eeprom_data = 0, state = 0;
18745 +       u16 eeprom_apme_mask = IGB_EEPROM_APME;
18746 +       err = pci_enable_device(pdev);
18747 +       if (err)
18748 +               return err;
18749 +
18750 +       pci_using_dac = 0;
18751 +       err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
18752 +       if (!err) {
18753 +               err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
18754 +               if (!err)
18755 +                       pci_using_dac = 1;
18756 +       } else {
18757 +               err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
18758 +               if (err) {
18759 +                       err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
18760 +                       if (err) {
18761 +                               IGB_ERR("No usable DMA configuration, "
18762 +                                       "aborting\n");
18763 +                               goto err_dma;
18764 +                       }
18765 +               }
18766 +       }
18767 +
18768 +       /* 82575 requires that the pci-e link partner disable the L0s state */
18769 +       switch (pdev->device) {
18770 +       case E1000_DEV_ID_82575EB_COPPER:
18771 +       case E1000_DEV_ID_82575EB_FIBER_SERDES:
18772 +       case E1000_DEV_ID_82575GB_QUAD_COPPER:
18773 +               us_dev = pdev->bus->self;
18774 +               pos = pci_find_capability(us_dev, PCI_CAP_ID_EXP);
18775 +               if (pos) {
18776 +                       pci_read_config_word(us_dev, pos + PCI_EXP_LNKCTL, &state);
18777 +                       state &= ~PCIE_LINK_STATE_L0S;
18778 +                       pci_write_config_word(us_dev, pos + PCI_EXP_LNKCTL, state);
18779 +                       printk(KERN_INFO "Disabling ASPM L0s upstream switch "
18780 +                              "port %x:%x.%x\n", us_dev->bus->number,
18781 +                              PCI_SLOT(us_dev->devfn), PCI_FUNC(us_dev->devfn));
18782 +               }
18783 +       default:
18784 +               break;
18785 +       }
18786 +
18787 +       err = pci_request_selected_regions(pdev,
18788 +                                          pci_select_bars(pdev,
18789 +                                                           IORESOURCE_MEM),
18790 +                                          igb_driver_name);
18791 +       if (err)
18792 +               goto err_pci_reg;
18793 +
18794 +       pci_set_master(pdev);
18795 +
18796 +       err = -ENOMEM;
18797 +#ifdef HAVE_TX_MQ
18798 +       netdev = alloc_etherdev_mq(sizeof(struct igb_adapter), IGB_ABS_MAX_TX_QUEUES);
18799 +#else
18800 +       netdev = alloc_etherdev(sizeof(struct igb_adapter));
18801 +#endif /* HAVE_TX_MQ */
18802 +       if (!netdev)
18803 +               goto err_alloc_etherdev;
18804 +
18805 +       SET_MODULE_OWNER(netdev);
18806 +       SET_NETDEV_DEV(netdev, &pdev->dev);
18807 +
18808 +       pci_set_drvdata(pdev, netdev);
18809 +       adapter = netdev_priv(netdev);
18810 +       adapter->netdev = netdev;
18811 +       adapter->pdev = pdev;
18812 +       hw = &adapter->hw;
18813 +       hw->back = adapter;
18814 +       adapter->msg_enable = (1 << debug) - 1;
18815 +
18816 +#ifdef HAVE_PCI_ERS
18817 +       err = pci_save_state(pdev);
18818 +       if (err)
18819 +               goto err_ioremap;
18820 +#endif
18821 +       err = -EIO;
18822 +       hw->hw_addr = ioremap(pci_resource_start(pdev, 0),
18823 +                             pci_resource_len(pdev, 0));
18824 +       if (!hw->hw_addr)
18825 +               goto err_ioremap;
18826 +
18827 +       netdev->open = &igb_open;
18828 +       netdev->stop = &igb_close;
18829 +       netdev->get_stats = &igb_get_stats;
18830 +       netdev->set_multicast_list = &igb_set_multi;
18831 +       netdev->set_mac_address = &igb_set_mac;
18832 +       netdev->change_mtu = &igb_change_mtu;
18833 +       netdev->do_ioctl = &igb_ioctl;
18834 +       igb_set_ethtool_ops(netdev);
18835 +#ifdef HAVE_TX_TIMEOUT
18836 +       netdev->tx_timeout = &igb_tx_timeout;
18837 +       netdev->watchdog_timeo = 5 * HZ;
18838 +#endif
18839 +       netdev->vlan_rx_register = igb_vlan_rx_register;
18840 +       netdev->vlan_rx_add_vid = igb_vlan_rx_add_vid;
18841 +       netdev->vlan_rx_kill_vid = igb_vlan_rx_kill_vid;
18842 +#ifdef CONFIG_NET_POLL_CONTROLLER
18843 +       netdev->poll_controller = igb_netpoll;
18844 +#endif
18845 +       netdev->hard_start_xmit = &igb_xmit_frame_adv;
18846 +
18847 +       strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
18848 +
18849 +       adapter->bd_number = cards_found;
18850 +
18851 +       igb_check_options(adapter);
18852 +
18853 +       /* setup the private structure */
18854 +       err = igb_sw_init(adapter);
18855 +       if (err)
18856 +               goto err_sw_init;
18857 +
18858 +       e1000_get_bus_info(hw);
18859 +
18860 +       /* Set flags */
18861 +       switch (hw->mac.type) {
18862 +               case e1000_82576:
18863 +               /* Fall through */
18864 +               case e1000_82575:
18865 +                       adapter->flags |= IGB_FLAG_HAS_DCA;
18866 +                       adapter->flags |= IGB_FLAG_NEED_CTX_IDX;
18867 +                       break;
18868 +               default:
18869 +                       break;
18870 +       }
18871 +
18872 +       hw->phy.autoneg_wait_to_complete = FALSE;
18873 +       hw->mac.adaptive_ifs = FALSE;
18874 +
18875 +       /* Copper options */
18876 +       if (hw->phy.media_type == e1000_media_type_copper) {
18877 +               hw->phy.mdix = AUTO_ALL_MODES;
18878 +               hw->phy.disable_polarity_correction = FALSE;
18879 +               hw->phy.ms_type = e1000_ms_hw_default;
18880 +       }
18881 +
18882 +       if (e1000_check_reset_block(hw))
18883 +               DPRINTK(PROBE, INFO,
18884 +                       "PHY reset is blocked due to SOL/IDER session.\n");
18885 +
18886 +       netdev->features = NETIF_F_SG |
18887 +                          NETIF_F_IP_CSUM |
18888 +                          NETIF_F_HW_VLAN_TX |
18889 +                          NETIF_F_HW_VLAN_RX |
18890 +                          NETIF_F_HW_VLAN_FILTER;
18891 +
18892 +#ifdef NETIF_F_IPV6_CSUM
18893 +       netdev->features |= NETIF_F_IPV6_CSUM;
18894 +#endif
18895 +
18896 +#ifdef NETIF_F_TSO
18897 +       netdev->features |= NETIF_F_TSO;
18898 +
18899 +#ifdef NETIF_F_TSO6
18900 +       netdev->features |= NETIF_F_TSO6;
18901 +#endif
18902 +#endif /* NETIF_F_TSO */
18903 +
18904 +#ifdef IGB_LRO
18905 +       netdev->features |= NETIF_F_LRO;
18906 +#endif /* IGB_LRO */
18907 +
18908 +       if (pci_using_dac)
18909 +               netdev->features |= NETIF_F_HIGHDMA;
18910 +
18911 +       adapter->en_mng_pt = e1000_enable_mng_pass_thru(hw);
18912 +
18913 +       /* before reading the NVM, reset the controller to put the device in a
18914 +        * known good starting state */
18915 +       e1000_reset_hw(hw);
18916 +
18917 +       /* make sure the NVM is good */
18918 +       if (e1000_validate_nvm_checksum(hw) < 0) {
18919 +               DPRINTK(PROBE, ERR, "The NVM Checksum Is Not Valid\n");
18920 +               err = -EIO;
18921 +               goto err_eeprom;
18922 +       }
18923 +
18924 +       /* copy the MAC address out of the NVM */
18925 +       if (e1000_read_mac_addr(hw))
18926 +               DPRINTK(PROBE, ERR, "NVM Read Error\n");
18927 +       memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);
18928 +#ifdef ETHTOOL_GPERMADDR
18929 +       memcpy(netdev->perm_addr, hw->mac.addr, netdev->addr_len);
18930 +
18931 +       if (!is_valid_ether_addr(netdev->perm_addr)) {
18932 +#else
18933 +       if (!is_valid_ether_addr(netdev->dev_addr)) {
18934 +#endif
18935 +               DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
18936 +               err = -EIO;
18937 +               goto err_eeprom;
18938 +       }
18939 +
18940 +       init_timer(&adapter->watchdog_timer);
18941 +       adapter->watchdog_timer.function = &igb_watchdog;
18942 +       adapter->watchdog_timer.data = (unsigned long) adapter;
18943 +
18944 +       init_timer(&adapter->phy_info_timer);
18945 +       adapter->phy_info_timer.function = &igb_update_phy_info;
18946 +       adapter->phy_info_timer.data = (unsigned long) adapter;
18947 +
18948 +       INIT_WORK(&adapter->reset_task, igb_reset_task);
18949 +       INIT_WORK(&adapter->watchdog_task, igb_watchdog_task);
18950 +
18951 +       /* Initialize link properties that are user-changeable */
18952 +       adapter->fc_autoneg = true;
18953 +       hw->mac.autoneg = true;
18954 +       hw->phy.autoneg_advertised = 0x2f;
18955 +
18956 +       hw->fc.original_type = e1000_fc_default;
18957 +       hw->fc.type = e1000_fc_default;
18958 +
18959 +       e1000_validate_mdi_setting(hw);
18960 +
18961 +       adapter->rx_csum = 1;
18962 +
18963 +       /* Initial Wake on LAN setting If APM wake is enabled in the EEPROM,
18964 +        * enable the ACPI Magic Packet filter
18965 +        */
18966 +
18967 +       if (hw->bus.func == 0)
18968 +               e1000_read_nvm(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
18969 +       else if(hw->bus.func == 1)
18970 +               e1000_read_nvm(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
18971 +
18972 +       if (eeprom_data & eeprom_apme_mask)
18973 +               adapter->eeprom_wol |= E1000_WUFC_MAG;
18974 +
18975 +       /* now that we have the eeprom settings, apply the special cases where
18976 +        * the eeprom may be wrong or the board simply won't support wake on
18977 +        * lan on a particular port */
18978 +       switch (pdev->device) {
18979 +       case E1000_DEV_ID_82575GB_QUAD_COPPER:
18980 +               adapter->eeprom_wol = 0;
18981 +               break;
18982 +       case E1000_DEV_ID_82575EB_FIBER_SERDES:
18983 +       case E1000_DEV_ID_82576_FIBER:
18984 +       case E1000_DEV_ID_82576_SERDES:
18985 +               /* Wake events only supported on port A for dual fiber
18986 +                * regardless of eeprom setting */
18987 +               if (E1000_READ_REG(hw, E1000_STATUS) &
18988 +                   E1000_STATUS_FUNC_1)
18989 +                       adapter->eeprom_wol = 0;
18990 +               break;
18991 +       }
18992 +
18993 +       /* initialize the wol settings based on the eeprom settings */
18994 +       adapter->wol = adapter->eeprom_wol;
18995 +
18996 +       /* reset the hardware with the new settings */
18997 +       igb_reset(adapter);
18998 +
18999 +       /* let the f/w know that the h/w is now under the control of the
19000 +        * driver. */
19001 +       igb_get_hw_control(adapter);
19002 +
19003 +       /* tell the stack to leave us alone until igb_open() is called */
19004 +       netif_carrier_off(netdev);
19005 +       netif_tx_stop_all_queues(netdev);
19006 +
19007 +       strcpy(netdev->name, "eth%d");
19008 +       err = register_netdev(netdev);
19009 +       if (err)
19010 +               goto err_register;
19011 +
19012 +#ifdef IGB_DCA
19013 +       if (adapter->flags & IGB_FLAG_HAS_DCA) {
19014 +               if (dca_add_requester(&pdev->dev) == E1000_SUCCESS) {
19015 +                       adapter->flags |= IGB_FLAG_DCA_ENABLED;
19016 +                       DPRINTK(PROBE, INFO, "DCA enabled\n");
19017 +                       /* Always use CB2 mode, difference is masked
19018 +                        * in the CB driver. */
19019 +                       E1000_WRITE_REG(hw, E1000_DCA_CTRL, 2);
19020 +                       igb_setup_dca(adapter);
19021 +               }
19022 +       }
19023 +#endif
19024 +
19025 +       DPRINTK(PROBE, INFO, "Intel(R) Gigabit Ethernet Network Connection\n");
19026 +       /* print bus type/speed/width info */
19027 +       DPRINTK(PROBE, INFO, "(PCIe:%s:%s) ",
19028 +             ((hw->bus.speed == e1000_bus_speed_2500) ? "2.5Gb/s" : "unknown"),
19029 +             ((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" :
19030 +              (hw->bus.width == e1000_bus_width_pcie_x1) ? "Width x1" :
19031 +               "unknown"));
19032 +
19033 +       for (i = 0; i < 6; i++)
19034 +               printk("%2.2x%c", netdev->dev_addr[i], i == 5 ? '\n' : ':');
19035 +
19036 +       DPRINTK(PROBE, INFO,
19037 +               "Using %s interrupts. %d rx queue(s), %d tx queue(s)\n",
19038 +               adapter->msix_entries ? "MSI-X" :
19039 +               adapter->flags & IGB_FLAG_HAS_MSI ? "MSI" :
19040 +               "legacy",
19041 +               adapter->num_rx_queues, adapter->num_tx_queues);
19042 +
19043 +       cards_found++;
19044 +       return 0;
19045 +
19046 +err_register:
19047 +       igb_release_hw_control(adapter);
19048 +err_eeprom:
19049 +       if (!e1000_check_reset_block(hw))
19050 +               e1000_phy_hw_reset(hw);
19051 +
19052 +       if (hw->flash_address)
19053 +               iounmap(hw->flash_address);
19054 +
19055 +       igb_free_queues(adapter);
19056 +err_sw_init:
19057 +       iounmap(hw->hw_addr);
19058 +err_ioremap:
19059 +       free_netdev(netdev);
19060 +err_alloc_etherdev:
19061 +       pci_release_selected_regions(pdev,
19062 +                                    pci_select_bars(pdev, IORESOURCE_MEM));
19063 +err_pci_reg:
19064 +err_dma:
19065 +       pci_disable_device(pdev);
19066 +       return err;
19067 +}
19068 +
19069 +/**
19070 + * igb_remove - Device Removal Routine
19071 + * @pdev: PCI device information struct
19072 + *
19073 + * igb_remove is called by the PCI subsystem to alert the driver
19074 + * that it should release a PCI device.  The could be caused by a
19075 + * Hot-Plug event, or because the driver is going to be removed from
19076 + * memory.
19077 + **/
19078 +
19079 +static void __devexit igb_remove(struct pci_dev *pdev)
19080 +{
19081 +       struct net_device *netdev = pci_get_drvdata(pdev);
19082 +       struct igb_adapter *adapter = netdev_priv(netdev);
19083 +       struct e1000_hw *hw = &adapter->hw;
19084 +
19085 +       /* flush_scheduled work may reschedule our watchdog task, so
19086 +        * explicitly disable watchdog tasks from being rescheduled  */
19087 +       set_bit(__IGB_DOWN, &adapter->state);
19088 +       del_timer_sync(&adapter->watchdog_timer);
19089 +       del_timer_sync(&adapter->phy_info_timer);
19090 +
19091 +       flush_scheduled_work();
19092 +
19093 +#ifdef IGB_DCA
19094 +       if (adapter->flags & IGB_FLAG_DCA_ENABLED) {
19095 +               DPRINTK(PROBE, INFO, "DCA disabled\n");
19096 +               dca_remove_requester(&pdev->dev);
19097 +               adapter->flags &= ~IGB_FLAG_DCA_ENABLED;
19098 +               E1000_WRITE_REG(hw, E1000_DCA_CTRL, 1);
19099 +       }
19100 +#endif
19101 +
19102 +       /* Release control of h/w to f/w.  If f/w is AMT enabled, this
19103 +        * would have already happened in close and is redundant. */
19104 +       igb_release_hw_control(adapter);
19105 +
19106 +       unregister_netdev(netdev);
19107 +
19108 +       if (!e1000_check_reset_block(hw))
19109 +               e1000_phy_hw_reset(hw);
19110 +
19111 +       igb_reset_interrupt_capability(adapter);
19112 +
19113 +       igb_free_queues(adapter);
19114 +
19115 +       iounmap(hw->hw_addr);
19116 +       if (hw->flash_address)
19117 +               iounmap(adapter->hw.flash_address);
19118 +       pci_release_selected_regions(pdev,
19119 +                                    pci_select_bars(pdev, IORESOURCE_MEM));
19120 +
19121 +       free_netdev(netdev);
19122 +
19123 +       pci_disable_device(pdev);
19124 +}
19125 +
19126 +/**
19127 + * igb_sw_init - Initialize general software structures (struct igb_adapter)
19128 + * @adapter: board private structure to initialize
19129 + *
19130 + * igb_sw_init initializes the Adapter private data structure.
19131 + * Fields are initialized based on PCI device information and
19132 + * OS network device settings (MTU size).
19133 + **/
19134 +
19135 +static int __devinit igb_sw_init(struct igb_adapter *adapter)
19136 +{
19137 +       struct e1000_hw *hw = &adapter->hw;
19138 +       struct net_device *netdev = adapter->netdev;
19139 +       struct pci_dev *pdev = adapter->pdev;
19140 +
19141 +       /* PCI config space info */
19142 +
19143 +       hw->vendor_id = pdev->vendor;
19144 +       hw->device_id = pdev->device;
19145 +       hw->subsystem_vendor_id = pdev->subsystem_vendor;
19146 +       hw->subsystem_device_id = pdev->subsystem_device;
19147 +
19148 +       pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
19149 +
19150 +       pci_read_config_word(pdev, PCI_COMMAND, &hw->bus.pci_cmd_word);
19151 +
19152 +       adapter->tx_ring_count = IGB_DEFAULT_TXD;
19153 +       adapter->rx_ring_count = IGB_DEFAULT_RXD;
19154 +       adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
19155 +       adapter->rx_ps_hdr_size = 0; /* disable packet split */
19156 +       adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
19157 +       adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
19158 +
19159 +       /* Initialize the hardware-specific values */
19160 +       if (e1000_setup_init_funcs(hw, TRUE)) {
19161 +               DPRINTK(PROBE, ERR, "Hardware Initialization Failure\n");
19162 +               return -EIO;
19163 +       }
19164 +
19165 +       /* Number of supported queues. */
19166 +       /* Having more queues than CPUs doesn't make sense. */
19167 +       adapter->num_rx_queues = min((u32)IGB_MAX_RX_QUEUES, (u32)num_online_cpus());
19168 +#ifdef HAVE_TX_MQ
19169 +       adapter->num_tx_queues = min(IGB_MAX_TX_QUEUES, num_online_cpus());
19170 +#else
19171 +       adapter->num_tx_queues = 1;
19172 +#endif
19173 +
19174 +
19175 +       /* This call may decrease the number of queues depending on
19176 +        * interrupt mode. */
19177 +       igb_set_interrupt_capability(adapter);
19178 +
19179 +       if (igb_alloc_queues(adapter)) {
19180 +               DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n");
19181 +               return -ENOMEM;
19182 +       }
19183 +
19184 +       /* Explicitly disable IRQ since the NIC can be in any state. */
19185 +       igb_irq_disable(adapter);
19186 +
19187 +       set_bit(__IGB_DOWN, &adapter->state);
19188 +       return 0;
19189 +}
19190 +
19191 +
19192 +/**
19193 + * igb_open - Called when a network interface is made active
19194 + * @netdev: network interface device structure
19195 + *
19196 + * Returns 0 on success, negative value on failure
19197 + *
19198 + * The open entry point is called when a network interface is made
19199 + * active by the system (IFF_UP).  At this point all resources needed
19200 + * for transmit and receive operations are allocated, the interrupt
19201 + * handler is registered with the OS, the watchdog timer is started,
19202 + * and the stack is notified that the interface is ready.
19203 + **/
19204 +
19205 +static int igb_open(struct net_device *netdev)
19206 +{
19207 +       struct igb_adapter *adapter = netdev_priv(netdev);
19208 +       struct e1000_hw *hw = &adapter->hw;
19209 +       int err;
19210 +       int i;
19211 +
19212 +       /* disallow open during test */
19213 +       if (test_bit(__IGB_TESTING, &adapter->state))
19214 +               return -EBUSY;
19215 +
19216 +       /* allocate transmit descriptors */
19217 +       err = igb_setup_all_tx_resources(adapter);
19218 +       if (err)
19219 +               goto err_setup_tx;
19220 +
19221 +       /* allocate receive descriptors */
19222 +       err = igb_setup_all_rx_resources(adapter);
19223 +       if (err)
19224 +               goto err_setup_rx;
19225 +
19226 +       /* e1000_power_up_phy(adapter); */
19227 +
19228 +       adapter->mng_vlan_id = IGB_MNG_VLAN_NONE;
19229 +       if ((adapter->hw.mng_cookie.status &
19230 +            E1000_MNG_DHCP_COOKIE_STATUS_VLAN)) {
19231 +               igb_update_mng_vlan(adapter);
19232 +       }
19233 +
19234 +       /* before we allocate an interrupt, we must be ready to handle it.
19235 +        * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
19236 +        * as soon as we call pci_request_irq, so we have to setup our
19237 +        * clean_rx handler before we do so.  */
19238 +       igb_configure(adapter);
19239 +
19240 +       err = igb_request_irq(adapter);
19241 +       if (err)
19242 +               goto err_req_irq;
19243 +
19244 +       /* From here on the code is the same as igb_up() */
19245 +       clear_bit(__IGB_DOWN, &adapter->state);
19246 +
19247 +       for (i = 0; i < adapter->num_rx_queues; i++)
19248 +               napi_enable(&adapter->rx_ring[i].napi);
19249 +       igb_configure_lli(adapter);
19250 +
19251 +       /* Clear any pending interrupts. */
19252 +       E1000_READ_REG(hw, E1000_ICR);
19253 +
19254 +       igb_irq_enable(adapter);
19255 +
19256 +       netif_tx_start_all_queues(netdev);
19257 +
19258 +       /* Fire a link status change interrupt to start the watchdog. */
19259 +       E1000_WRITE_REG(hw, E1000_ICS, E1000_ICS_LSC);
19260 +
19261 +       return E1000_SUCCESS;
19262 +
19263 +err_req_irq:
19264 +       igb_release_hw_control(adapter);
19265 +       /* e1000_power_down_phy(adapter); */
19266 +       igb_free_all_rx_resources(adapter);
19267 +err_setup_rx:
19268 +       igb_free_all_tx_resources(adapter);
19269 +err_setup_tx:
19270 +       igb_reset(adapter);
19271 +       return err;
19272 +}
19273 +
19274 +/**
19275 + * igb_close - Disables a network interface
19276 + * @netdev: network interface device structure
19277 + *
19278 + * Returns 0, this is not allowed to fail
19279 + *
19280 + * The close entry point is called when an interface is de-activated
19281 + * by the OS.  The hardware is still under the driver's control, but
19282 + * needs to be disabled.  A global MAC reset is issued to stop the
19283 + * hardware, and all transmit and receive resources are freed.
19284 + **/
19285 +
19286 +static int igb_close(struct net_device *netdev)
19287 +{
19288 +       struct igb_adapter *adapter = netdev_priv(netdev);
19289 +
19290 +       WARN_ON(test_bit(__IGB_RESETTING, &adapter->state));
19291 +       igb_down(adapter);
19292 +
19293 +       igb_free_irq(adapter);
19294 +
19295 +       igb_free_all_tx_resources(adapter);
19296 +       igb_free_all_rx_resources(adapter);
19297 +
19298 +       /* kill manageability vlan ID if supported, but not if a vlan with
19299 +        * the same ID is registered on the host OS (let 8021q kill it) */
19300 +       if ((adapter->hw.mng_cookie.status &
19301 +                         E1000_MNG_DHCP_COOKIE_STATUS_VLAN) &&
19302 +            !(adapter->vlgrp &&
19303 +              vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id)))
19304 +               igb_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
19305 +
19306 +       return 0;
19307 +}
19308 +
19309 +/**
19310 + * igb_setup_tx_resources - allocate Tx resources (Descriptors)
19311 + * @adapter: board private structure
19312 + * @tx_ring: tx descriptor ring (for a specific queue) to setup
19313 + *
19314 + * Return 0 on success, negative on failure
19315 + **/
19316 +
19317 +int igb_setup_tx_resources(struct igb_adapter *adapter,
19318 +                           struct igb_ring *tx_ring)
19319 +{
19320 +       struct pci_dev *pdev = adapter->pdev;
19321 +       int size;
19322 +
19323 +       size = sizeof(struct igb_buffer) * tx_ring->count;
19324 +       tx_ring->buffer_info = vmalloc(size);
19325 +       if (!tx_ring->buffer_info)
19326 +               goto err;
19327 +       memset(tx_ring->buffer_info, 0, size);
19328 +
19329 +       /* round up to nearest 4K */
19330 +       tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc)
19331 +                       + sizeof(u32);
19332 +       tx_ring->size = ALIGN(tx_ring->size, 4096);
19333 +
19334 +       tx_ring->desc = pci_alloc_consistent(pdev, tx_ring->size,
19335 +                                            &tx_ring->dma);
19336 +
19337 +       if (!tx_ring->desc)
19338 +               goto err;
19339 +
19340 +       tx_ring->adapter = adapter;
19341 +       tx_ring->next_to_use = 0;
19342 +       tx_ring->next_to_clean = 0;
19343 +       return 0;
19344 +
19345 +err:
19346 +       vfree(tx_ring->buffer_info);
19347 +       DPRINTK(PROBE, ERR, "Unable to allocate memory for the transmit "
19348 +               "descriptor ring\n");
19349 +       return -ENOMEM;
19350 +}
19351 +
19352 +/**
19353 + * igb_setup_all_tx_resources - wrapper to allocate Tx resources
19354 + *                               (Descriptors) for all queues
19355 + * @adapter: board private structure
19356 + *
19357 + * Return 0 on success, negative on failure
19358 + **/
19359 +
19360 +static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
19361 +{
19362 +       int i, err = 0;
19363 +#ifdef HAVE_TX_MQ
19364 +       int r_idx;
19365 +#endif
19366 +
19367 +       for (i = 0; i < adapter->num_tx_queues; i++) {
19368 +               err = igb_setup_tx_resources(adapter, &adapter->tx_ring[i]);
19369 +               if (err) {
19370 +                       DPRINTK(PROBE, ERR,
19371 +                               "Allocation for Tx Queue %u failed\n", i);
19372 +                       for (i--; i >= 0; i--)
19373 +                               igb_free_tx_resources(&adapter->tx_ring[i]);
19374 +                       break;
19375 +               }
19376 +       }
19377 +
19378 +#ifdef HAVE_TX_MQ
19379 +       for (i = 0; i < IGB_ABS_MAX_TX_QUEUES; i++) {
19380 +               r_idx = i % adapter->num_tx_queues;
19381 +               adapter->multi_tx_table[i] = &adapter->tx_ring[r_idx];
19382 +       }
19383 +#endif
19384 +       return err;
19385 +}
19386 +
19387 +/**
19388 + * igb_configure_tx - Configure transmit Unit after Reset
19389 + * @adapter: board private structure
19390 + *
19391 + * Configure the Tx unit of the MAC after a reset.
19392 + **/
19393 +
19394 +static void igb_configure_tx(struct igb_adapter *adapter)
19395 +{
19396 +       u64 tdba, tdwba;
19397 +       struct e1000_hw *hw = &adapter->hw;
19398 +       u32 tctl;
19399 +       u32 txdctl, txctrl;
19400 +       int i;
19401 +
19402 +       for (i = 0; i < adapter->num_tx_queues; i++) {
19403 +               struct igb_ring *ring = &(adapter->tx_ring[i]);
19404 +
19405 +               E1000_WRITE_REG(hw, E1000_TDLEN(i),
19406 +                               ring->count * sizeof(struct e1000_tx_desc));
19407 +               tdba = ring->dma;
19408 +               E1000_WRITE_REG(hw, E1000_TDBAL(i),
19409 +                               tdba & 0x00000000ffffffffULL);
19410 +               E1000_WRITE_REG(hw, E1000_TDBAH(i), tdba >> 32);
19411 +
19412 +               tdwba = ring->dma + ring->count * sizeof(struct e1000_tx_desc);
19413 +               tdwba |= 1; /* enable head wb */
19414 +               E1000_WRITE_REG(hw, E1000_TDWBAL(i),
19415 +                               tdwba & 0x00000000ffffffffULL);
19416 +               E1000_WRITE_REG(hw, E1000_TDWBAH(i), tdwba >> 32);
19417 +
19418 +               ring->head = E1000_TDH(i);
19419 +               ring->tail = E1000_TDT(i);
19420 +               writel(0, hw->hw_addr + ring->tail);
19421 +               writel(0, hw->hw_addr + ring->head);
19422 +               txdctl = E1000_READ_REG(hw, E1000_TXDCTL(i));
19423 +               txdctl |= E1000_TXDCTL_QUEUE_ENABLE;
19424 +               E1000_WRITE_REG(hw, E1000_TXDCTL(i), txdctl);
19425 +
19426 +               /* Turn off Relaxed Ordering on head write-backs.  The writebacks
19427 +                * MUST be delivered in order or it will completely screw up
19428 +                * our bookeeping.
19429 +                */
19430 +               txctrl = E1000_READ_REG(hw, E1000_DCA_TXCTRL(i));
19431 +               txctrl &= ~E1000_DCA_TXCTRL_TX_WB_RO_EN;
19432 +               E1000_WRITE_REG(hw, E1000_DCA_TXCTRL(i), txctrl);
19433 +       }
19434 +
19435 +       /* Use the default values for the Tx Inter Packet Gap (IPG) timer */
19436 +
19437 +       /* Program the Transmit Control Register */
19438 +
19439 +       tctl = E1000_READ_REG(hw, E1000_TCTL);
19440 +       tctl &= ~E1000_TCTL_CT;
19441 +       tctl |= E1000_TCTL_PSP | E1000_TCTL_RTLC |
19442 +               (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT);
19443 +
19444 +       e1000_config_collision_dist(hw);
19445 +
19446 +       /* Setup Transmit Descriptor Settings for eop descriptor */
19447 +       adapter->txd_cmd = E1000_TXD_CMD_EOP | E1000_TXD_CMD_RS;
19448 +
19449 +       /* Enable transmits */
19450 +       tctl |= E1000_TCTL_EN;
19451 +
19452 +       E1000_WRITE_REG(hw, E1000_TCTL, tctl);
19453 +}
19454 +
19455 +/**
19456 + * igb_setup_rx_resources - allocate Rx resources (Descriptors)
19457 + * @adapter: board private structure
19458 + * @rx_ring:    rx descriptor ring (for a specific queue) to setup
19459 + *
19460 + * Returns 0 on success, negative on failure
19461 + **/
19462 +
19463 +int igb_setup_rx_resources(struct igb_adapter *adapter,
19464 +                           struct igb_ring *rx_ring)
19465 +{
19466 +       struct pci_dev *pdev = adapter->pdev;
19467 +       int size, desc_len;
19468 +
19469 +#ifdef IGB_LRO
19470 +       size = sizeof(struct net_lro_desc) * MAX_LRO_DESCRIPTORS;
19471 +       rx_ring->lro_mgr.lro_arr = vmalloc(size);
19472 +       if (!rx_ring->lro_mgr.lro_arr)
19473 +               goto err;
19474 +       memset(rx_ring->lro_mgr.lro_arr, 0, size);
19475 +
19476 +#endif /* IGB_LRO */
19477 +       size = sizeof(struct igb_buffer) * rx_ring->count;
19478 +       rx_ring->buffer_info = vmalloc(size);
19479 +       if (!rx_ring->buffer_info)
19480 +               goto err;
19481 +       memset(rx_ring->buffer_info, 0, size);
19482 +
19483 +       desc_len = sizeof(union e1000_adv_rx_desc);
19484 +
19485 +       /* Round up to nearest 4K */
19486 +       rx_ring->size = rx_ring->count * desc_len;
19487 +       rx_ring->size = ALIGN(rx_ring->size, 4096);
19488 +
19489 +       rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size,
19490 +                                            &rx_ring->dma);
19491 +
19492 +       if (!rx_ring->desc)
19493 +               goto err;
19494 +
19495 +       rx_ring->next_to_clean = 0;
19496 +       rx_ring->next_to_use = 0;
19497 +
19498 +       rx_ring->adapter = adapter;
19499 +       return 0;
19500 +
19501 +err:
19502 +#ifdef IGB_LRO
19503 +       vfree(rx_ring->lro_mgr.lro_arr);
19504 +       rx_ring->lro_mgr.lro_arr = NULL;
19505 +#endif
19506 +       vfree(rx_ring->buffer_info);
19507 +       rx_ring->buffer_info = NULL;
19508 +       DPRINTK(PROBE, ERR, "Unable to allocate memory for the receive "
19509 +               "descriptor ring\n");
19510 +       return -ENOMEM;
19511 +}
19512 +
19513 +/**
19514 + * igb_setup_all_rx_resources - wrapper to allocate Rx resources
19515 + *                               (Descriptors) for all queues
19516 + * @adapter: board private structure
19517 + *
19518 + * Return 0 on success, negative on failure
19519 + **/
19520 +
19521 +static int igb_setup_all_rx_resources(struct igb_adapter *adapter)
19522 +{
19523 +       int i, err = 0;
19524 +
19525 +       for (i = 0; i < adapter->num_rx_queues; i++) {
19526 +               err = igb_setup_rx_resources(adapter, &adapter->rx_ring[i]);
19527 +               if (err) {
19528 +                       DPRINTK(PROBE, ERR,
19529 +                               "Allocation for Rx Queue %u failed\n", i);
19530 +                       for (i--; i >= 0; i--)
19531 +                               igb_free_rx_resources(&adapter->rx_ring[i]);
19532 +                       break;
19533 +               }
19534 +       }
19535 +
19536 +       return err;
19537 +}
19538 +
19539 +/**
19540 + * igb_setup_rctl - configure the receive control registers
19541 + * @adapter: Board private structure
19542 + **/
19543 +static void igb_setup_rctl(struct igb_adapter *adapter)
19544 +{
19545 +       struct e1000_hw *hw = &adapter->hw;
19546 +       u32 rctl;
19547 +       u32 srrctl = 0;
19548 +       int i;
19549 +
19550 +       rctl = E1000_READ_REG(hw, E1000_RCTL);
19551 +
19552 +       rctl &= ~(3 << E1000_RCTL_MO_SHIFT);
19553 +
19554 +       rctl |= E1000_RCTL_EN | E1000_RCTL_BAM |
19555 +               E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
19556 +               (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
19557 +
19558 +       /*
19559 +        * enable stripping of CRC. It's unlikely this will break BMC
19560 +        * redirection as it did with e1000. Newer features require
19561 +        * that the HW strips the CRC.
19562 +        */
19563 +       rctl |= E1000_RCTL_SECRC;
19564 +
19565 +       rctl &= ~E1000_RCTL_SBP;
19566 +
19567 +       if (adapter->netdev->mtu <= ETH_DATA_LEN)
19568 +               rctl &= ~E1000_RCTL_LPE;
19569 +       else
19570 +               rctl |= E1000_RCTL_LPE;
19571 +
19572 +       if (adapter->rx_buffer_len <= IGB_RXBUFFER_2048) {
19573 +               /* Setup buffer sizes */
19574 +               rctl &= ~E1000_RCTL_SZ_4096;
19575 +               rctl |= E1000_RCTL_BSEX;
19576 +               switch (adapter->rx_buffer_len) {
19577 +                       case IGB_RXBUFFER_256:
19578 +                               rctl |= E1000_RCTL_SZ_256;
19579 +                               rctl &= ~E1000_RCTL_BSEX;
19580 +                               break;
19581 +                       case IGB_RXBUFFER_512:
19582 +                               rctl |= E1000_RCTL_SZ_512;
19583 +                               rctl &= ~E1000_RCTL_BSEX;
19584 +                               break;
19585 +                       case IGB_RXBUFFER_1024:
19586 +                               rctl |= E1000_RCTL_SZ_1024;
19587 +                               rctl &= ~E1000_RCTL_BSEX;
19588 +                               break;
19589 +                       case IGB_RXBUFFER_2048:
19590 +                       default:
19591 +                               rctl |= E1000_RCTL_SZ_2048;
19592 +                               rctl &= ~E1000_RCTL_BSEX;
19593 +                               break;
19594 +               }
19595 +       } else {
19596 +               rctl &= ~E1000_RCTL_BSEX;
19597 +               srrctl = adapter->rx_buffer_len >> E1000_SRRCTL_BSIZEPKT_SHIFT;
19598 +       }
19599 +
19600 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
19601 +       /* 82575 and greater support packet-split where the protocol
19602 +        * header is placed in skb->data and the packet data is
19603 +        * placed in pages hanging off of skb_shinfo(skb)->nr_frags.
19604 +        * In the case of a non-split, skb->data is linearly filled,
19605 +        * followed by the page buffers.  Therefore, skb->data is
19606 +        * sized to hold the largest protocol header.
19607 +        */
19608 +       /* allocations using alloc_page take too long for regular MTU
19609 +        * so only enable packet split for jumbo frames */
19610 +       if (rctl & E1000_RCTL_LPE) {
19611 +               adapter->rx_ps_hdr_size = IGB_RXBUFFER_128;
19612 +               srrctl |= adapter->rx_ps_hdr_size <<
19613 +                        E1000_SRRCTL_BSIZEHDRSIZE_SHIFT;
19614 +               srrctl |= E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
19615 +       } else {
19616 +#endif /* CONFIG_IGB_DISABLE_PACKET_SPLIT */
19617 +               adapter->rx_ps_hdr_size = 0;
19618 +               srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF;
19619 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
19620 +       }
19621 +#endif /* CONFIG_IGB_DISABLE_PACKET_SPLIT */
19622 +
19623 +       for (i = 0; i < adapter->num_rx_queues; i++) {
19624 +               E1000_WRITE_REG(hw, E1000_SRRCTL(i), srrctl);
19625 +       }
19626 +
19627 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl);
19628 +}
19629 +
19630 +/**
19631 + * igb_configure_rx - Configure receive Unit after Reset
19632 + * @adapter: board private structure
19633 + *
19634 + * Configure the Rx unit of the MAC after a reset.
19635 + **/
19636 +
19637 +static void igb_configure_rx(struct igb_adapter *adapter)
19638 +{
19639 +       u64 rdba;
19640 +       struct e1000_hw *hw = &adapter->hw;
19641 +       u32 rctl, rxcsum;
19642 +       u32 rxdctl;
19643 +       int i;
19644 +
19645 +       /* disable receives while setting up the descriptors */
19646 +       rctl = E1000_READ_REG(hw, E1000_RCTL);
19647 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN);
19648 +       E1000_WRITE_FLUSH(hw);
19649 +       mdelay(10);
19650 +
19651 +       if (adapter->itr_setting > 3) {
19652 +               E1000_WRITE_REG(hw, E1000_ITR, adapter->itr);
19653 +       }
19654 +       /* Setup the HW Rx Head and Tail Descriptor Pointers and
19655 +        * the Base and Length of the Rx Descriptor Ring */
19656 +       for (i = 0; i < adapter->num_rx_queues; i++) {
19657 +               struct igb_ring *ring = &(adapter->rx_ring[i]);
19658 +               rdba = ring->dma;
19659 +               E1000_WRITE_REG(hw, E1000_RDBAL(i),
19660 +                               rdba & 0x00000000ffffffffULL);
19661 +               E1000_WRITE_REG(hw, E1000_RDBAH(i), rdba >> 32);
19662 +               E1000_WRITE_REG(hw, E1000_RDLEN(i),
19663 +                              ring->count * sizeof(union e1000_adv_rx_desc));
19664 +
19665 +               ring->head = E1000_RDH(i);
19666 +               ring->tail = E1000_RDT(i);
19667 +               writel(0, hw->hw_addr + ring->tail);
19668 +               writel(0, hw->hw_addr + ring->head);
19669 +
19670 +               rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(i));
19671 +               rxdctl |= E1000_RXDCTL_QUEUE_ENABLE;
19672 +               rxdctl &= 0xFFF00000;
19673 +               rxdctl |= IGB_RX_PTHRESH;
19674 +               rxdctl |= IGB_RX_HTHRESH << 8;
19675 +               rxdctl |= IGB_RX_WTHRESH << 16;
19676 +               E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl);
19677 +#ifdef IGB_LRO
19678 +               /* Intitial LRO Settings */
19679 +               ring->lro_mgr.max_aggr = adapter->lro_max_aggr;
19680 +               ring->lro_mgr.max_desc = MAX_LRO_DESCRIPTORS;
19681 +               ring->lro_mgr.get_skb_header = igb_get_skb_hdr;
19682 +               ring->lro_mgr.features = LRO_F_NAPI | LRO_F_EXTRACT_VLAN_ID;
19683 +               ring->lro_mgr.dev = adapter->netdev;
19684 +               ring->lro_mgr.ip_summed = CHECKSUM_UNNECESSARY;
19685 +               ring->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
19686 +#endif
19687 +
19688 +       }
19689 +
19690 +       if (adapter->num_rx_queues > 1) {
19691 +               u32 random[10];
19692 +               u32 mrqc;
19693 +               u32 j, shift;
19694 +               union e1000_reta {
19695 +                       u32 dword;
19696 +                       u8  bytes[4];
19697 +               } reta;
19698 +
19699 +               /* ugh, using random bytes here means we'll never put the same
19700 +                * flow in the same rx queue */
19701 +               get_random_bytes(&random[0], 40);
19702 +
19703 +               if (hw->mac.type >= e1000_82576)
19704 +                       shift = 0;
19705 +               else
19706 +                       shift = 6;
19707 +               for (j = 0; j < (32 * 4); j++) {
19708 +                       reta.bytes[j & 3] =
19709 +                               (j % adapter->num_rx_queues) << shift;
19710 +                       if ((j & 3) == 3) {
19711 +                               writel(reta.dword,
19712 +                                      hw->hw_addr + E1000_RETA(0) + (j & ~3));
19713 +                       }
19714 +               }
19715 +               mrqc = E1000_MRQC_ENABLE_RSS_4Q;
19716 +
19717 +               /* Fill out hash function seeds */
19718 +               for (j = 0; j < 10; j++)
19719 +                       E1000_WRITE_REG_ARRAY(hw, E1000_RSSRK(0), j, random[j]);
19720 +
19721 +               mrqc |= (E1000_MRQC_RSS_FIELD_IPV4 |
19722 +                        E1000_MRQC_RSS_FIELD_IPV4_TCP);
19723 +               mrqc |= (E1000_MRQC_RSS_FIELD_IPV6 |
19724 +                        E1000_MRQC_RSS_FIELD_IPV6_TCP);
19725 +               mrqc |=( E1000_MRQC_RSS_FIELD_IPV4_UDP |
19726 +                       E1000_MRQC_RSS_FIELD_IPV6_UDP);
19727 +               mrqc |=( E1000_MRQC_RSS_FIELD_IPV6_UDP_EX |
19728 +                       E1000_MRQC_RSS_FIELD_IPV6_TCP_EX);
19729 +
19730 +
19731 +               E1000_WRITE_REG(hw, E1000_MRQC, mrqc);
19732 +
19733 +               /* Multiqueue and raw packet checksumming are mutually
19734 +                * exclusive.  Note that this not the same as TCP/IP
19735 +                * checksumming, which works fine. */
19736 +               rxcsum = E1000_READ_REG(hw, E1000_RXCSUM);
19737 +               rxcsum |= E1000_RXCSUM_PCSD;
19738 +               E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum);
19739 +       } else {
19740 +               /* Enable Receive Checksum Offload for TCP and UDP */
19741 +               rxcsum = E1000_READ_REG(hw, E1000_RXCSUM);
19742 +               if (adapter->rx_csum)
19743 +                       rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPPCSE;
19744 +               else
19745 +                       rxcsum &= ~E1000_RXCSUM_TUOFL;
19746 +                       /* don't need to clear IPPCSE as it defaults to 0 */
19747 +               E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum);
19748 +       }
19749 +
19750 +       if (adapter->vlgrp)
19751 +               E1000_WRITE_REG(hw, E1000_RLPML,
19752 +                               adapter->max_frame_size + VLAN_TAG_SIZE);
19753 +       else
19754 +               E1000_WRITE_REG(hw, E1000_RLPML, adapter->max_frame_size);
19755 +
19756 +       /* Enable Receives */
19757 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl);
19758 +}
19759 +
19760 +/**
19761 + * igb_free_tx_resources - Free Tx Resources per Queue
19762 + * @adapter: board private structure
19763 + * @tx_ring: Tx descriptor ring for a specific queue
19764 + *
19765 + * Free all transmit software resources
19766 + **/
19767 +
19768 +void igb_free_tx_resources(struct igb_ring *tx_ring)
19769 +{
19770 +       struct pci_dev *pdev = tx_ring->adapter->pdev;
19771 +
19772 +       igb_clean_tx_ring(tx_ring);
19773 +
19774 +       vfree(tx_ring->buffer_info);
19775 +       tx_ring->buffer_info = NULL;
19776 +
19777 +       pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma);
19778 +
19779 +       tx_ring->desc = NULL;
19780 +}
19781 +
19782 +/**
19783 + * igb_free_all_tx_resources - Free Tx Resources for All Queues
19784 + * @adapter: board private structure
19785 + *
19786 + * Free all transmit software resources
19787 + **/
19788 +
19789 +static void igb_free_all_tx_resources(struct igb_adapter *adapter)
19790 +{
19791 +       int i;
19792 +
19793 +       for (i = 0; i < adapter->num_tx_queues; i++)
19794 +               igb_free_tx_resources(&adapter->tx_ring[i]);
19795 +}
19796 +
19797 +static void igb_unmap_and_free_tx_resource(struct igb_adapter *adapter,
19798 +                                           struct igb_buffer *buffer_info)
19799 +{
19800 +       if (buffer_info->dma) {
19801 +               pci_unmap_page(adapter->pdev,
19802 +                               buffer_info->dma,
19803 +                               buffer_info->length,
19804 +                               PCI_DMA_TODEVICE);
19805 +               buffer_info->dma = 0;
19806 +       }
19807 +       if (buffer_info->skb) {
19808 +               dev_kfree_skb_any(buffer_info->skb);
19809 +               buffer_info->skb = NULL;
19810 +       }
19811 +       buffer_info->time_stamp = 0;
19812 +       /* buffer_info must be completely set up in the transmit path */
19813 +}
19814 +
19815 +/**
19816 + * igb_clean_tx_ring - Free Tx Buffers
19817 + * @adapter: board private structure
19818 + * @tx_ring: ring to be cleaned
19819 + **/
19820 +
19821 +static void igb_clean_tx_ring(struct igb_ring *tx_ring)
19822 +{
19823 +       struct igb_adapter *adapter = tx_ring->adapter;
19824 +       struct igb_buffer *buffer_info;
19825 +       unsigned long size;
19826 +       unsigned int i;
19827 +
19828 +       if (!tx_ring->buffer_info)
19829 +               return;
19830 +       /* Free all the Tx ring sk_buffs */
19831 +
19832 +       for (i = 0; i < tx_ring->count; i++) {
19833 +               buffer_info = &tx_ring->buffer_info[i];
19834 +               igb_unmap_and_free_tx_resource(adapter, buffer_info);
19835 +       }
19836 +
19837 +       size = sizeof(struct igb_buffer) * tx_ring->count;
19838 +       memset(tx_ring->buffer_info, 0, size);
19839 +
19840 +       /* Zero out the descriptor ring */
19841 +
19842 +       memset(tx_ring->desc, 0, tx_ring->size);
19843 +
19844 +       tx_ring->next_to_use = 0;
19845 +       tx_ring->next_to_clean = 0;
19846 +
19847 +       writel(0, adapter->hw.hw_addr + tx_ring->head);
19848 +       writel(0, adapter->hw.hw_addr + tx_ring->tail);
19849 +}
19850 +
19851 +/**
19852 + * igb_clean_all_tx_rings - Free Tx Buffers for all queues
19853 + * @adapter: board private structure
19854 + **/
19855 +
19856 +static void igb_clean_all_tx_rings(struct igb_adapter *adapter)
19857 +{
19858 +       int i;
19859 +
19860 +       for (i = 0; i < adapter->num_tx_queues; i++)
19861 +               igb_clean_tx_ring(&adapter->tx_ring[i]);
19862 +}
19863 +
19864 +/**
19865 + * igb_free_rx_resources - Free Rx Resources
19866 + * @adapter: board private structure
19867 + * @rx_ring: ring to clean the resources from
19868 + *
19869 + * Free all receive software resources
19870 + **/
19871 +
19872 +void igb_free_rx_resources(struct igb_ring *rx_ring)
19873 +{
19874 +       struct pci_dev *pdev = rx_ring->adapter->pdev;
19875 +
19876 +       igb_clean_rx_ring(rx_ring);
19877 +
19878 +       vfree(rx_ring->buffer_info);
19879 +       rx_ring->buffer_info = NULL;
19880 +
19881 +#ifdef IGB_LRO
19882 +       vfree(rx_ring->lro_mgr.lro_arr);
19883 +       rx_ring->lro_mgr.lro_arr = NULL;
19884 +#endif /* IGB_LRO */
19885 +
19886 +       pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);
19887 +
19888 +       rx_ring->desc = NULL;
19889 +}
19890 +
19891 +/**
19892 + * igb_free_all_rx_resources - Free Rx Resources for All Queues
19893 + * @adapter: board private structure
19894 + *
19895 + * Free all receive software resources
19896 + **/
19897 +
19898 +static void igb_free_all_rx_resources(struct igb_adapter *adapter)
19899 +{
19900 +       int i;
19901 +
19902 +       for (i = 0; i < adapter->num_rx_queues; i++)
19903 +               igb_free_rx_resources(&adapter->rx_ring[i]);
19904 +}
19905 +
19906 +/**
19907 + * igb_clean_rx_ring - Free Rx Buffers per Queue
19908 + * @adapter: board private structure
19909 + * @rx_ring: ring to free buffers from
19910 + **/
19911 +
19912 +static void igb_clean_rx_ring(struct igb_ring *rx_ring)
19913 +{
19914 +       struct igb_adapter *adapter = rx_ring->adapter;
19915 +       struct igb_buffer *buffer_info;
19916 +       struct pci_dev *pdev = adapter->pdev;
19917 +       unsigned long size;
19918 +       unsigned int i;
19919 +
19920 +       if (!rx_ring->buffer_info)
19921 +               return;
19922 +       /* Free all the Rx ring sk_buffs */
19923 +       for (i = 0; i < rx_ring->count; i++) {
19924 +               buffer_info = &rx_ring->buffer_info[i];
19925 +               if (buffer_info->dma) {
19926 +                       if (adapter->rx_ps_hdr_size){
19927 +                               pci_unmap_single(pdev, buffer_info->dma,
19928 +                                                adapter->rx_ps_hdr_size,
19929 +                                                PCI_DMA_FROMDEVICE);
19930 +                       } else {
19931 +                               pci_unmap_single(pdev, buffer_info->dma,
19932 +                                                adapter->rx_buffer_len,
19933 +                                                PCI_DMA_FROMDEVICE);
19934 +                       }
19935 +                       buffer_info->dma = 0;
19936 +               }
19937 +
19938 +               if (buffer_info->skb) {
19939 +                       dev_kfree_skb(buffer_info->skb);
19940 +                       buffer_info->skb = NULL;
19941 +               }
19942 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
19943 +               if (buffer_info->page) {
19944 +                       if (buffer_info->page_dma)
19945 +                               pci_unmap_page(pdev, buffer_info->page_dma,
19946 +                                              PAGE_SIZE / 2,
19947 +                                              PCI_DMA_FROMDEVICE);
19948 +                       put_page(buffer_info->page);
19949 +                       buffer_info->page = NULL;
19950 +                       buffer_info->page_dma = 0;
19951 +                       buffer_info->page_offset = 0;
19952 +               }
19953 +#endif
19954 +       }
19955 +
19956 +       size = sizeof(struct igb_buffer) * rx_ring->count;
19957 +       memset(rx_ring->buffer_info, 0, size);
19958 +
19959 +       /* Zero out the descriptor ring */
19960 +       memset(rx_ring->desc, 0, rx_ring->size);
19961 +
19962 +       rx_ring->next_to_clean = 0;
19963 +       rx_ring->next_to_use = 0;
19964 +
19965 +       writel(0, adapter->hw.hw_addr + rx_ring->head);
19966 +       writel(0, adapter->hw.hw_addr + rx_ring->tail);
19967 +}
19968 +
19969 +/**
19970 + * igb_clean_all_rx_rings - Free Rx Buffers for all queues
19971 + * @adapter: board private structure
19972 + **/
19973 +
19974 +static void igb_clean_all_rx_rings(struct igb_adapter *adapter)
19975 +{
19976 +       int i;
19977 +
19978 +       for (i = 0; i < adapter->num_rx_queues; i++)
19979 +               igb_clean_rx_ring(&adapter->rx_ring[i]);
19980 +}
19981 +
19982 +/**
19983 + * igb_set_mac - Change the Ethernet Address of the NIC
19984 + * @netdev: network interface device structure
19985 + * @p: pointer to an address structure
19986 + *
19987 + * Returns 0 on success, negative on failure
19988 + **/
19989 +
19990 +static int igb_set_mac(struct net_device *netdev, void *p)
19991 +{
19992 +       struct igb_adapter *adapter = netdev_priv(netdev);
19993 +       struct e1000_hw *hw = &adapter->hw;
19994 +       struct sockaddr *addr = p;
19995 +
19996 +       if (!is_valid_ether_addr(addr->sa_data))
19997 +               return -EADDRNOTAVAIL;
19998 +
19999 +       memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
20000 +       memcpy(hw->mac.addr, addr->sa_data, netdev->addr_len);
20001 +
20002 +       e1000_rar_set(hw, hw->mac.addr, 0);
20003 +
20004 +       return 0;
20005 +}
20006 +
20007 +/**
20008 + * igb_set_multi - Multicast and Promiscuous mode set
20009 + * @netdev: network interface device structure
20010 + *
20011 + * The set_multi entry point is called whenever the multicast address
20012 + * list or the network interface flags are updated.  This routine is
20013 + * responsible for configuring the hardware for proper multicast,
20014 + * promiscuous mode, and all-multi behavior.
20015 + **/
20016 +
20017 +static void igb_set_multi(struct net_device *netdev)
20018 +{
20019 +       struct igb_adapter *adapter = netdev_priv(netdev);
20020 +       struct e1000_hw *hw = &adapter->hw;
20021 +       struct e1000_mac_info *mac = &hw->mac;
20022 +       struct dev_mc_list *mc_ptr;
20023 +       u8  *mta_list;
20024 +       u32 rctl;
20025 +       int i;
20026 +
20027 +       /* Check for Promiscuous and All Multicast modes */
20028 +
20029 +       rctl = E1000_READ_REG(hw, E1000_RCTL);
20030 +
20031 +       if (netdev->flags & IFF_PROMISC) {
20032 +               rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
20033 +               rctl &= ~E1000_RCTL_VFE;
20034 +       } else {
20035 +               if (netdev->flags & IFF_ALLMULTI) {
20036 +                       rctl |= E1000_RCTL_MPE;
20037 +                       rctl &= ~E1000_RCTL_UPE;
20038 +               } else
20039 +                       rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
20040 +               rctl |= E1000_RCTL_VFE;
20041 +       }
20042 +       E1000_WRITE_REG(hw, E1000_RCTL, rctl);
20043 +
20044 +       if (!netdev->mc_count) {
20045 +               /* nothing to program, so clear mc list */
20046 +               e1000_update_mc_addr_list(hw, NULL, 0, 1,
20047 +                                         mac->rar_entry_count);
20048 +               return;
20049 +       }
20050 +
20051 +       mta_list = kzalloc(netdev->mc_count * 6, GFP_ATOMIC);
20052 +       if (!mta_list)
20053 +               return;
20054 +
20055 +       /* The shared function expects a packed array of only addresses. */
20056 +       mc_ptr = netdev->mc_list;
20057 +
20058 +       for (i = 0; i < netdev->mc_count; i++) {
20059 +               if (!mc_ptr)
20060 +                       break;
20061 +               memcpy(mta_list + (i*ETH_ALEN), mc_ptr->dmi_addr, ETH_ALEN);
20062 +               mc_ptr = mc_ptr->next;
20063 +       }
20064 +       e1000_update_mc_addr_list(hw, mta_list, i, 1, mac->rar_entry_count);
20065 +       kfree(mta_list);
20066 +}
20067 +
20068 +/* Need to wait a few seconds after link up to get diagnostic information from
20069 + * the phy */
20070 +
20071 +static void igb_update_phy_info(unsigned long data)
20072 +{
20073 +       struct igb_adapter *adapter = (struct igb_adapter *) data;
20074 +       e1000_get_phy_info(&adapter->hw);
20075 +}
20076 +
20077 +/**
20078 + * igb_has_link - check shared code for link and determine up/down
20079 + * @adapter: pointer to driver private info
20080 + **/
20081 +static bool igb_has_link(struct igb_adapter *adapter)
20082 +{
20083 +       struct e1000_hw *hw = &adapter->hw;
20084 +       bool link_active = FALSE;
20085 +       s32 ret_val = 0;
20086 +
20087 +       /* get_link_status is set on LSC (link status) interrupt or
20088 +        * rx sequence error interrupt.  get_link_status will stay
20089 +        * false until the e1000_check_for_link establishes link
20090 +        * for copper adapters ONLY
20091 +        */
20092 +       switch (hw->phy.media_type) {
20093 +       case e1000_media_type_copper:
20094 +               if (hw->mac.get_link_status) {
20095 +                       ret_val = e1000_check_for_link(hw);
20096 +                       link_active = !hw->mac.get_link_status;
20097 +               } else {
20098 +                       link_active = TRUE;
20099 +               }
20100 +               break;
20101 +       case e1000_media_type_fiber:
20102 +               ret_val = e1000_check_for_link(hw);
20103 +               link_active = !!(E1000_READ_REG(hw, E1000_STATUS) &
20104 +                                E1000_STATUS_LU);
20105 +               break;
20106 +       case e1000_media_type_internal_serdes:
20107 +               ret_val = e1000_check_for_link(hw);
20108 +               link_active = adapter->hw.mac.serdes_has_link;
20109 +               break;
20110 +       default:
20111 +       case e1000_media_type_unknown:
20112 +               break;
20113 +       }
20114 +
20115 +       return link_active;
20116 +}
20117 +
20118 +/**
20119 + * igb_watchdog - Timer Call-back
20120 + * @data: pointer to adapter cast into an unsigned long
20121 + **/
20122 +static void igb_watchdog(unsigned long data)
20123 +{
20124 +       struct igb_adapter *adapter = (struct igb_adapter *)data;
20125 +       /* Do the rest outside of interrupt context */
20126 +       schedule_work(&adapter->watchdog_task);
20127 +}
20128 +
20129 +static void igb_watchdog_task(struct work_struct *work)
20130 +{
20131 +       struct igb_adapter *adapter = container_of(work,
20132 +                                       struct igb_adapter, watchdog_task);
20133 +       struct e1000_hw *hw = &adapter->hw;
20134 +       struct igb_ring *tx_ring = adapter->tx_ring;
20135 +       struct net_device *netdev = adapter->netdev;
20136 +       u32 link;
20137 +       u32 eics = 0;
20138 +       int i;
20139 +
20140 +       link = igb_has_link(adapter);
20141 +       if ((netif_carrier_ok(netdev)) && link)
20142 +               goto link_up;
20143 +
20144 +       if (link) {
20145 +               if (!netif_carrier_ok(netdev)) {
20146 +                       u32 ctrl;
20147 +                       e1000_get_speed_and_duplex(hw, &adapter->link_speed,
20148 +                                                  &adapter->link_duplex);
20149 +
20150 +                       ctrl = E1000_READ_REG(hw, E1000_CTRL);
20151 +                       DPRINTK(LINK, INFO, "NIC Link is Up %d Mbps %s, "
20152 +                               "Flow Control: %s\n",
20153 +                               adapter->link_speed,
20154 +                               adapter->link_duplex == FULL_DUPLEX ?
20155 +                               "Full Duplex" : "Half Duplex",
20156 +                               ((ctrl & E1000_CTRL_TFCE) && (ctrl &
20157 +                               E1000_CTRL_RFCE)) ? "RX/TX" : ((ctrl &
20158 +                               E1000_CTRL_RFCE) ? "RX" : ((ctrl &
20159 +                               E1000_CTRL_TFCE) ? "TX" : "None")));
20160 +
20161 +                       /* tweak tx_queue_len according to speed/duplex and
20162 +                        * adjust the timeout factor */
20163 +                       netdev->tx_queue_len = adapter->tx_queue_len;
20164 +                       adapter->tx_timeout_factor = 1;
20165 +                       switch (adapter->link_speed) {
20166 +                       case SPEED_10:
20167 +                               netdev->tx_queue_len = 10;
20168 +                               adapter->tx_timeout_factor = 14;
20169 +                               break;
20170 +                       case SPEED_100:
20171 +                               netdev->tx_queue_len = 100;
20172 +                               /* maybe add some timeout factor ? */
20173 +                               break;
20174 +                       }
20175 +
20176 +                       netif_carrier_on(netdev);
20177 +                       netif_tx_wake_all_queues(netdev);
20178 +               }
20179 +       } else {
20180 +               if (netif_carrier_ok(netdev)) {
20181 +                       adapter->link_speed = 0;
20182 +                       adapter->link_duplex = 0;
20183 +                       DPRINTK(LINK, INFO, "NIC Link is Down\n");
20184 +                       netif_carrier_off(netdev);
20185 +                       netif_tx_stop_all_queues(netdev);
20186 +               }
20187 +       }
20188 +
20189 +link_up:
20190 +       igb_update_stats(adapter);
20191 +
20192 +       if (!netif_carrier_ok(netdev)) {
20193 +               if (IGB_DESC_UNUSED(tx_ring) + 1 < tx_ring->count) {
20194 +                       /* We've lost link, so the controller stops DMA,
20195 +                        * but we've got queued Tx work that's never going
20196 +                        * to get done, so reset controller to flush Tx.
20197 +                        * (Do the reset outside of interrupt context). */
20198 +                       adapter->tx_timeout_count++;
20199 +                       schedule_work(&adapter->reset_task);
20200 +               }
20201 +       }
20202 +
20203 +       /* Cause software interrupt to ensure rx ring is cleaned */
20204 +       if (adapter->msix_entries) {
20205 +               for (i = 0; i < adapter->num_rx_queues; i++)
20206 +                       eics |= adapter->rx_ring[i].eims_value;
20207 +               E1000_WRITE_REG(hw, E1000_EICS, eics);
20208 +       } else {
20209 +               E1000_WRITE_REG(hw, E1000_ICS, E1000_ICS_RXDMT0);
20210 +       }
20211 +
20212 +       /* Force detection of hung controller every watchdog period */
20213 +       tx_ring->detect_tx_hung = TRUE;
20214 +
20215 +       /* Reset the timer */
20216 +       if (!test_bit(__IGB_DOWN, &adapter->state))
20217 +               mod_timer(&adapter->watchdog_timer,
20218 +                         round_jiffies(jiffies + 2 * HZ));
20219 +}
20220 +
20221 +enum latency_range {
20222 +       lowest_latency = 0,
20223 +       low_latency = 1,
20224 +       bulk_latency = 2,
20225 +       latency_invalid = 255
20226 +};
20227 +
20228 +
20229 +/**
20230 + * igb_update_ring_itr - update the dynamic ITR value based on packet size
20231 + *
20232 + *      Stores a new ITR value based on strictly on packet size.  This
20233 + *      algorithm is less sophisticated than that used in igb_update_itr,
20234 + *      due to the difficulty of synchronizing statistics across multiple
20235 + *      receive rings.  The divisors and thresholds used by this fuction
20236 + *      were determined based on theoretical maximum wire speed and testing
20237 + *      data, in order to minimize response time while increasing bulk
20238 + *      throughput.
20239 + *      This functionality is controlled by the InterruptThrottleRate module
20240 + *      parameter (see igb_param.c)
20241 + *      NOTE:  This function is called only when operating in a multiqueue
20242 + *             receive environment.
20243 + * @rx_ring: pointer to ring
20244 + **/
20245 +static void igb_update_ring_itr(struct igb_ring *rx_ring)
20246 +{
20247 +       int new_val = rx_ring->itr_val;
20248 +       int avg_wire_size = 0;
20249 +       struct igb_adapter *adapter = rx_ring->adapter;
20250 +
20251 +       if (!rx_ring->total_packets)
20252 +               goto clear_counts; /* no packets, so don't do anything */
20253 +
20254 +       /* For non-gigabit speeds, just fix the interrupt rate at 4000
20255 +        * ints/sec - ITR timer value of 120 ticks.
20256 +        */
20257 +       if (adapter->link_speed != SPEED_1000) {
20258 +               new_val = 120;
20259 +               goto set_itr_val;
20260 +       }
20261 +       avg_wire_size = rx_ring->total_bytes / rx_ring->total_packets;
20262 +       if (rx_ring->buddy && rx_ring->buddy->total_packets)
20263 +               avg_wire_size = max(avg_wire_size,
20264 +                                   (int)(rx_ring->buddy->total_bytes /
20265 +                                         rx_ring->buddy->total_packets));
20266 +       /* Add 24 bytes to size to account for CRC, preamble, and gap */
20267 +       avg_wire_size += 24;
20268 +
20269 +       /* Don't starve jumbo frames */
20270 +       avg_wire_size = min(avg_wire_size, 3000);
20271 +
20272 +       /* Give a little boost to mid-size frames */
20273 +       if ((avg_wire_size > 300) && (avg_wire_size < 1200))
20274 +               new_val = avg_wire_size / 3;
20275 +       else
20276 +               new_val = avg_wire_size / 2;
20277 +
20278 +set_itr_val:
20279 +       if (new_val != rx_ring->itr_val) {
20280 +               rx_ring->itr_val = new_val;
20281 +               rx_ring->set_itr = 1;
20282 +       }
20283 +clear_counts:
20284 +       rx_ring->total_bytes = 0;
20285 +       rx_ring->total_packets = 0;
20286 +       if (rx_ring->buddy) {
20287 +               rx_ring->buddy->total_bytes = 0;
20288 +               rx_ring->buddy->total_packets = 0;
20289 +       }
20290 +}
20291 +
20292 +/**
20293 + * igb_update_itr - update the dynamic ITR value based on statistics
20294 + *      Stores a new ITR value based on packets and byte
20295 + *      counts during the last interrupt.  The advantage of per interrupt
20296 + *      computation is faster updates and more accurate ITR for the current
20297 + *      traffic pattern.  Constants in this function were computed
20298 + *      based on theoretical maximum wire speed and thresholds were set based
20299 + *      on testing data as well as attempting to minimize response time
20300 + *      while increasing bulk throughput.
20301 + *      this functionality is controlled by the InterruptThrottleRate module
20302 + *      parameter (see igb_param.c)
20303 + *      NOTE:  These calculations are only valid when operating in a single-
20304 + *             queue environment.
20305 + * @adapter: pointer to adapter
20306 + * @itr_setting: current adapter->itr
20307 + * @packets: the number of packets during this measurement interval
20308 + * @bytes: the number of bytes during this measurement interval
20309 + **/
20310 +static unsigned int igb_update_itr(struct igb_adapter *adapter, u16 itr_setting,
20311 +                                   int packets, int bytes)
20312 +{
20313 +       unsigned int retval = itr_setting;
20314 +
20315 +       if (packets == 0)
20316 +               goto update_itr_done;
20317 +
20318 +       switch (itr_setting) {
20319 +       case lowest_latency:
20320 +               /* handle TSO and jumbo frames */
20321 +               if (bytes/packets > 8000)
20322 +                       retval = bulk_latency;
20323 +               else if ((packets < 5) && (bytes > 512)) {
20324 +                       retval = low_latency;
20325 +               }
20326 +               break;
20327 +       case low_latency:  /* 50 usec aka 20000 ints/s */
20328 +               if (bytes > 10000) {
20329 +                       /* this if handles the TSO accounting */
20330 +                       if (bytes/packets > 8000) {
20331 +                               retval = bulk_latency;
20332 +                       } else if ((packets < 10) || ((bytes/packets) > 1200)) {
20333 +                               retval = bulk_latency;
20334 +                       } else if ((packets > 35)) {
20335 +                               retval = lowest_latency;
20336 +                       }
20337 +               } else if (bytes/packets > 2000) {
20338 +                       retval = bulk_latency;
20339 +               } else if (packets <= 2 && bytes < 512) {
20340 +                       retval = lowest_latency;
20341 +               }
20342 +               break;
20343 +       case bulk_latency: /* 250 usec aka 4000 ints/s */
20344 +               if (bytes > 25000) {
20345 +                       if (packets > 35) {
20346 +                               retval = low_latency;
20347 +                       }
20348 +               } else if (bytes < 1500) {
20349 +                       retval = low_latency;
20350 +               }
20351 +               break;
20352 +       }
20353 +
20354 +update_itr_done:
20355 +       return retval;
20356 +}
20357 +
20358 +static void igb_set_itr(struct igb_adapter *adapter)
20359 +{
20360 +       u16 current_itr;
20361 +       u32 new_itr = adapter->itr;
20362 +
20363 +       /* for non-gigabit speeds, just fix the interrupt rate at 4000 */
20364 +       if (adapter->link_speed != SPEED_1000) {
20365 +               current_itr = 0;
20366 +               new_itr = 4000;
20367 +               goto set_itr_now;
20368 +       }
20369 +
20370 +       adapter->rx_itr = igb_update_itr(adapter,
20371 +                                   adapter->rx_itr,
20372 +                                   adapter->rx_ring->total_packets,
20373 +                                   adapter->rx_ring->total_bytes);
20374 +
20375 +       if (adapter->rx_ring->buddy) {
20376 +               adapter->tx_itr = igb_update_itr(adapter,
20377 +                                           adapter->tx_itr,
20378 +                                           adapter->tx_ring->total_packets,
20379 +                                           adapter->tx_ring->total_bytes);
20380 +               current_itr = max(adapter->rx_itr, adapter->tx_itr);
20381 +       } else {
20382 +               current_itr = adapter->rx_itr;
20383 +       }
20384 +
20385 +       /* conservative mode (itr 3) eliminates the lowest_latency setting */
20386 +       if (adapter->itr_setting == 3 && current_itr == lowest_latency)
20387 +               current_itr = low_latency;
20388 +
20389 +       switch (current_itr) {
20390 +       /* counts and packets in update_itr are dependent on these numbers */
20391 +       case lowest_latency:
20392 +               new_itr = 70000;
20393 +               break;
20394 +       case low_latency:
20395 +               new_itr = 20000; /* aka hwitr = ~200 */
20396 +               break;
20397 +       case bulk_latency:
20398 +               new_itr = 4000;
20399 +               break;
20400 +       default:
20401 +               break;
20402 +       }
20403 +
20404 +set_itr_now:
20405 +       adapter->rx_ring->total_bytes = 0;
20406 +       adapter->rx_ring->total_packets = 0;
20407 +       if (adapter->rx_ring->buddy) {
20408 +               adapter->rx_ring->buddy->total_bytes = 0;
20409 +               adapter->rx_ring->buddy->total_packets = 0;
20410 +       }
20411 +
20412 +       if (new_itr != adapter->itr) {
20413 +               /* this attempts to bias the interrupt rate towards Bulk
20414 +                * by adding intermediate steps when interrupt rate is
20415 +                * increasing */
20416 +               new_itr = new_itr > adapter->itr ?
20417 +                            min(adapter->itr + (new_itr >> 2), new_itr) :
20418 +                            new_itr;
20419 +               /* Don't write the value here; it resets the adapter's
20420 +                * internal timer, and causes us to delay far longer than
20421 +                * we should between interrupts.  Instead, we write the ITR
20422 +                * value at the beginning of the next interrupt so the timing
20423 +                * ends up being correct.
20424 +                */
20425 +               adapter->itr = new_itr;
20426 +               adapter->rx_ring->itr_val = 1000000000 / (new_itr * 256);
20427 +               adapter->rx_ring->set_itr = 1;
20428 +       }
20429 +
20430 +       return;
20431 +}
20432 +
20433 +
20434 +#define IGB_TX_FLAGS_CSUM              0x00000001
20435 +#define IGB_TX_FLAGS_VLAN              0x00000002
20436 +#define IGB_TX_FLAGS_TSO               0x00000004
20437 +#define IGB_TX_FLAGS_IPV4              0x00000008
20438 +#define IGB_TX_FLAGS_VLAN_MASK         0xffff0000
20439 +#define IGB_TX_FLAGS_VLAN_SHIFT                16
20440 +
20441 +static inline int igb_tso_adv(struct igb_adapter *adapter,
20442 +                              struct igb_ring *tx_ring,
20443 +                              struct sk_buff *skb, u32 tx_flags, u8 *hdr_len)
20444 +{
20445 +#ifdef NETIF_F_TSO
20446 +       struct e1000_adv_tx_context_desc *context_desc;
20447 +       unsigned int i;
20448 +       int err;
20449 +       struct igb_buffer *buffer_info;
20450 +       u32 info = 0, tu_cmd = 0;
20451 +       u32 mss_l4len_idx, l4len;
20452 +       *hdr_len = 0;
20453 +
20454 +       if (skb_header_cloned(skb)) {
20455 +               err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
20456 +               if (err)
20457 +                       return err;
20458 +       }
20459 +
20460 +       l4len = tcp_hdrlen(skb);
20461 +       *hdr_len += l4len;
20462 +
20463 +       if (skb->protocol == htons(ETH_P_IP)) {
20464 +               struct iphdr *iph = ip_hdr(skb);
20465 +               iph->tot_len = 0;
20466 +               iph->check = 0;
20467 +               tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
20468 +                                                        iph->daddr, 0,
20469 +                                                        IPPROTO_TCP,
20470 +                                                        0);
20471 +#ifdef NETIF_F_TSO6
20472 +       } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) {
20473 +               ipv6_hdr(skb)->payload_len = 0;
20474 +               tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
20475 +                                                      &ipv6_hdr(skb)->daddr,
20476 +                                                      0, IPPROTO_TCP, 0);
20477 +#endif
20478 +       }
20479 +
20480 +       i = tx_ring->next_to_use;
20481 +
20482 +       buffer_info = &tx_ring->buffer_info[i];
20483 +       context_desc = E1000_TX_CTXTDESC_ADV(*tx_ring, i);
20484 +       /* VLAN MACLEN IPLEN */
20485 +       if (tx_flags & IGB_TX_FLAGS_VLAN)
20486 +               info |= (tx_flags & IGB_TX_FLAGS_VLAN_MASK);
20487 +       info |= (skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT);
20488 +       *hdr_len += skb_network_offset(skb);
20489 +       info |= (skb_transport_header(skb) - skb_network_header(skb));
20490 +       *hdr_len += (skb_transport_header(skb) - skb_network_header(skb));
20491 +       context_desc->vlan_macip_lens = cpu_to_le32(info);
20492 +
20493 +       /* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
20494 +       tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
20495 +
20496 +       if (skb->protocol == htons(ETH_P_IP))
20497 +               tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
20498 +       tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
20499 +
20500 +       context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd);
20501 +
20502 +       /* MSS L4LEN IDX */
20503 +       mss_l4len_idx = (skb_shinfo(skb)->gso_size << E1000_ADVTXD_MSS_SHIFT);
20504 +       mss_l4len_idx |= (l4len << E1000_ADVTXD_L4LEN_SHIFT);
20505 +
20506 +       /* For 82575, context index must be unique per ring. */
20507 +       if (adapter->flags & IGB_FLAG_NEED_CTX_IDX)
20508 +               mss_l4len_idx |= tx_ring->queue_index << 4;
20509 +
20510 +       context_desc->mss_l4len_idx = cpu_to_le32(mss_l4len_idx);
20511 +       context_desc->seqnum_seed = 0;
20512 +
20513 +       buffer_info->time_stamp = jiffies;
20514 +       buffer_info->dma = 0;
20515 +       i++;
20516 +       if (i == tx_ring->count)
20517 +               i = 0;
20518 +
20519 +       tx_ring->next_to_use = i;
20520 +
20521 +       return TRUE;
20522 +#else
20523 +       return FALSE;
20524 +#endif  /* NETIF_F_TSO */
20525 +}
20526 +
20527 +static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
20528 +                                   struct igb_ring *tx_ring,
20529 +                                   struct sk_buff *skb, u32 tx_flags)
20530 +{
20531 +       struct e1000_adv_tx_context_desc *context_desc;
20532 +       unsigned int i;
20533 +       struct igb_buffer *buffer_info;
20534 +       u32 info = 0, tu_cmd = 0;
20535 +
20536 +       if ((skb->ip_summed == CHECKSUM_PARTIAL) ||
20537 +           (tx_flags & IGB_TX_FLAGS_VLAN)) {
20538 +               i = tx_ring->next_to_use;
20539 +               buffer_info = &tx_ring->buffer_info[i];
20540 +               context_desc = E1000_TX_CTXTDESC_ADV(*tx_ring, i);
20541 +
20542 +               if (tx_flags & IGB_TX_FLAGS_VLAN)
20543 +                       info |= (tx_flags & IGB_TX_FLAGS_VLAN_MASK);
20544 +
20545 +               info |= (skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT);
20546 +               if (skb->ip_summed == CHECKSUM_PARTIAL)
20547 +                       info |= (skb_transport_header(skb) -
20548 +                                skb_network_header(skb));
20549 +
20550 +
20551 +               context_desc->vlan_macip_lens = cpu_to_le32(info);
20552 +
20553 +               tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT);
20554 +
20555 +               if (skb->ip_summed == CHECKSUM_PARTIAL) {
20556 +                       switch (skb->protocol) {
20557 +                       case __constant_htons(ETH_P_IP):
20558 +                               tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
20559 +                               if (ip_hdr(skb)->protocol == IPPROTO_TCP)
20560 +                                       tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
20561 +                               break;
20562 +#ifdef NETIF_F_IPV6_CSUM
20563 +                       case __constant_htons(ETH_P_IPV6):
20564 +                               /* XXX what about other V6 headers?? */
20565 +                               if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
20566 +                                       tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
20567 +                               break;
20568 +#endif
20569 +                       default:
20570 +                               if (unlikely(net_ratelimit())) {
20571 +                                       DPRINTK(PROBE, WARNING,
20572 +                                        "partial checksum but proto=%x!\n",
20573 +                                        skb->protocol);
20574 +                               }
20575 +                               break;
20576 +                       }
20577 +               }
20578 +
20579 +               context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd);
20580 +               context_desc->seqnum_seed = 0;
20581 +               if (adapter->flags & IGB_FLAG_NEED_CTX_IDX)
20582 +                       context_desc->mss_l4len_idx =
20583 +                               cpu_to_le32(tx_ring->queue_index << 4);
20584 +               else
20585 +                       context_desc->mss_l4len_idx = 0;
20586 +
20587 +               buffer_info->time_stamp = jiffies;
20588 +               buffer_info->dma = 0;
20589 +
20590 +               i++;
20591 +               if (i == tx_ring->count)
20592 +                       i = 0;
20593 +               tx_ring->next_to_use = i;
20594 +
20595 +               return TRUE;
20596 +       }
20597 +
20598 +
20599 +       return FALSE;
20600 +}
20601 +
20602 +#define IGB_MAX_TXD_PWR        16
20603 +#define IGB_MAX_DATA_PER_TXD   (1<<IGB_MAX_TXD_PWR)
20604 +
20605 +static inline int igb_tx_map_adv(struct igb_adapter *adapter,
20606 +                                 struct igb_ring *tx_ring,
20607 +                                 struct sk_buff *skb)
20608 +{
20609 +       struct igb_buffer *buffer_info;
20610 +       unsigned int len = skb_headlen(skb);
20611 +       unsigned int count = 0, i;
20612 +       unsigned int f;
20613 +
20614 +       i = tx_ring->next_to_use;
20615 +
20616 +       buffer_info = &tx_ring->buffer_info[i];
20617 +       BUG_ON(len >= IGB_MAX_DATA_PER_TXD);
20618 +       buffer_info->length = len;
20619 +       /* set time_stamp *before* dma to help avoid a possible race */
20620 +       buffer_info->time_stamp = jiffies;
20621 +
20622 +       buffer_info->dma =
20623 +               pci_map_single(adapter->pdev, skb->data, len,
20624 +                                         PCI_DMA_TODEVICE);
20625 +
20626 +       count++;
20627 +       i++;
20628 +       if (i == tx_ring->count)
20629 +               i = 0;
20630 +
20631 +       for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) {
20632 +               struct skb_frag_struct *frag;
20633 +
20634 +               frag = &skb_shinfo(skb)->frags[f];
20635 +               len = frag->size;
20636 +
20637 +               buffer_info = &tx_ring->buffer_info[i];
20638 +               BUG_ON(len >= IGB_MAX_DATA_PER_TXD);
20639 +               buffer_info->length = len;
20640 +               buffer_info->time_stamp = jiffies;
20641 +               buffer_info->dma =
20642 +                       pci_map_page(adapter->pdev,
20643 +                                               frag->page,
20644 +                                               frag->page_offset,
20645 +                                               len,
20646 +                                               PCI_DMA_TODEVICE);
20647 +
20648 +               count++;
20649 +               i++;
20650 +               if (i == tx_ring->count)
20651 +                       i = 0;
20652 +       }
20653 +
20654 +       i = (i == 0) ? tx_ring->count - 1 : i - 1;
20655 +       tx_ring->buffer_info[i].skb = skb;
20656 +
20657 +       return count;
20658 +}
20659 +
20660 +static inline void igb_tx_queue_adv(struct igb_adapter *adapter,
20661 +                                    struct igb_ring *tx_ring,
20662 +                                    int tx_flags, int count, u32 paylen,
20663 +                                    u8 hdr_len)
20664 +{
20665 +       union e1000_adv_tx_desc *tx_desc = NULL;
20666 +       struct igb_buffer *buffer_info;
20667 +       u32 olinfo_status = 0, cmd_type_len;
20668 +       unsigned int i;
20669 +
20670 +       cmd_type_len = (E1000_ADVTXD_DTYP_DATA | E1000_ADVTXD_DCMD_IFCS |
20671 +                       E1000_ADVTXD_DCMD_DEXT);
20672 +
20673 +       if (tx_flags & IGB_TX_FLAGS_VLAN)
20674 +               cmd_type_len |= E1000_ADVTXD_DCMD_VLE;
20675 +
20676 +       if (tx_flags & IGB_TX_FLAGS_TSO) {
20677 +               cmd_type_len |= E1000_ADVTXD_DCMD_TSE;
20678 +
20679 +               /* insert tcp checksum */
20680 +               olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
20681 +
20682 +               /* insert ip checksum */
20683 +               if (tx_flags & IGB_TX_FLAGS_IPV4)
20684 +                       olinfo_status |= E1000_TXD_POPTS_IXSM << 8;
20685 +
20686 +       } else if (tx_flags & IGB_TX_FLAGS_CSUM) {
20687 +               olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
20688 +       }
20689 +
20690 +       if ((adapter->flags & IGB_FLAG_NEED_CTX_IDX) &&
20691 +           (tx_flags & (IGB_TX_FLAGS_CSUM |
20692 +                        IGB_TX_FLAGS_TSO | IGB_TX_FLAGS_VLAN)))
20693 +               olinfo_status |= tx_ring->queue_index << 4;
20694 +
20695 +       olinfo_status |= ((paylen - hdr_len) << E1000_ADVTXD_PAYLEN_SHIFT);
20696 +
20697 +       i = tx_ring->next_to_use;
20698 +       while (count--) {
20699 +               buffer_info = &tx_ring->buffer_info[i];
20700 +               tx_desc = E1000_TX_DESC_ADV(*tx_ring, i);
20701 +               tx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma);
20702 +               tx_desc->read.cmd_type_len =
20703 +                       cpu_to_le32(cmd_type_len | buffer_info->length);
20704 +               tx_desc->read.olinfo_status = cpu_to_le32(olinfo_status);
20705 +               i++;
20706 +               if (i == tx_ring->count)
20707 +                       i = 0;
20708 +       }
20709 +
20710 +       tx_desc->read.cmd_type_len |= cpu_to_le32(adapter->txd_cmd);
20711 +       /* Force memory writes to complete before letting h/w
20712 +        * know there are new descriptors to fetch.  (Only
20713 +        * applicable for weak-ordered memory model archs,
20714 +        * such as IA-64). */
20715 +       wmb();
20716 +
20717 +       tx_ring->next_to_use = i;
20718 +       writel(i, adapter->hw.hw_addr + tx_ring->tail);
20719 +       /* we need this if more than one processor can write to our tail
20720 +        * at a time, it syncronizes IO on IA64/Altix systems */
20721 +       mmiowb();
20722 +}
20723 +
20724 +static int __igb_maybe_stop_tx(struct net_device *netdev,
20725 +                               struct igb_ring *tx_ring, int size)
20726 +{
20727 +       struct igb_adapter *adapter = netdev_priv(netdev);
20728 +
20729 +       if (netif_is_multiqueue(netdev))
20730 +               netif_stop_subqueue(netdev, tx_ring->queue_index);
20731 +       else
20732 +               netif_stop_queue(netdev);
20733 +
20734 +       /* Herbert's original patch had:
20735 +        *  smp_mb__after_netif_stop_queue();
20736 +        * but since that doesn't exist yet, just open code it. */
20737 +       smp_mb();
20738 +
20739 +       /* We need to check again in a case another CPU has just
20740 +        * made room available. */
20741 +       if (IGB_DESC_UNUSED(tx_ring) < size)
20742 +               return -EBUSY;
20743 +
20744 +       /* A reprieve! */
20745 +       if (netif_is_multiqueue(netdev))
20746 +               netif_wake_subqueue(netdev, tx_ring->queue_index);
20747 +       else
20748 +               netif_wake_queue(netdev);
20749 +       ++adapter->restart_queue;
20750 +       return 0;
20751 +}
20752 +
20753 +static int igb_maybe_stop_tx(struct net_device *netdev,
20754 +                             struct igb_ring *tx_ring, int size)
20755 +{
20756 +       if (IGB_DESC_UNUSED(tx_ring) >= size)
20757 +               return 0;
20758 +       return __igb_maybe_stop_tx(netdev, tx_ring, size);
20759 +}
20760 +
20761 +#define TXD_USE_COUNT(S) (((S) >> (IGB_MAX_TXD_PWR)) + 1)
20762 +
20763 +static int igb_xmit_frame_ring_adv(struct sk_buff *skb,
20764 +                                   struct net_device *netdev,
20765 +                                   struct igb_ring *tx_ring)
20766 +{
20767 +       struct igb_adapter *adapter = netdev_priv(netdev);
20768 +       unsigned int tx_flags = 0;
20769 +       unsigned int len;
20770 +       u8 hdr_len = 0;
20771 +       int tso = 0;
20772 +
20773 +       len = skb_headlen(skb);
20774 +
20775 +       if (test_bit(__IGB_DOWN, &adapter->state)) {
20776 +               dev_kfree_skb_any(skb);
20777 +               return NETDEV_TX_OK;
20778 +       }
20779 +
20780 +       if (skb->len <= 0) {
20781 +               dev_kfree_skb_any(skb);
20782 +               return NETDEV_TX_OK;
20783 +       }
20784 +
20785 +       /* need: 1 descriptor per page,
20786 +         *       + 2 desc gap to keep tail from touching head,
20787 +         *       + 1 desc for skb->data,
20788 +         *       + 1 desc for context descriptor,
20789 +         * otherwise try next time */
20790 +       if (igb_maybe_stop_tx(netdev, tx_ring, skb_shinfo(skb)->nr_frags + 4)) {
20791 +               /* this is a hard error */
20792 +               return NETDEV_TX_BUSY;
20793 +       }
20794 +       skb_orphan(skb);
20795 +
20796 +       if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
20797 +               tx_flags |= IGB_TX_FLAGS_VLAN;
20798 +               tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
20799 +       }
20800 +
20801 +       if (skb->protocol == htons(ETH_P_IP))
20802 +               tx_flags |= IGB_TX_FLAGS_IPV4;
20803 +
20804 +#ifdef NETIF_F_TSO
20805 +       tso = skb_is_gso(skb) ? igb_tso_adv(adapter, tx_ring, skb, tx_flags,
20806 +                                             &hdr_len) : 0;
20807 +#endif
20808 +
20809 +       if (tso < 0) {
20810 +               dev_kfree_skb_any(skb);
20811 +               return NETDEV_TX_OK;
20812 +       }
20813 +
20814 +       if (tso) {
20815 +               tx_flags |= IGB_TX_FLAGS_TSO;
20816 +       } else if (igb_tx_csum_adv(adapter, tx_ring, skb, tx_flags))
20817 +                       if (skb->ip_summed == CHECKSUM_PARTIAL)
20818 +                               tx_flags |= IGB_TX_FLAGS_CSUM;
20819 +
20820 +       igb_tx_queue_adv(adapter, tx_ring, tx_flags,
20821 +                        igb_tx_map_adv(adapter, tx_ring, skb),
20822 +                        skb->len, hdr_len);
20823 +
20824 +       netdev->trans_start = jiffies;
20825 +
20826 +       /* Make sure there is space in the ring for the next send. */
20827 +       igb_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 4);
20828 +
20829 +       return NETDEV_TX_OK;
20830 +}
20831 +
20832 +static int igb_xmit_frame_adv(struct sk_buff *skb, struct net_device *netdev)
20833 +{
20834 +       struct igb_adapter *adapter = netdev_priv(netdev);
20835 +       struct igb_ring *tx_ring;
20836 +
20837 +#ifdef HAVE_TX_MQ
20838 +       int r_idx = 0;
20839 +       r_idx = skb->queue_mapping & (IGB_ABS_MAX_TX_QUEUES - 1);
20840 +       tx_ring = adapter->multi_tx_table[r_idx];
20841 +#else
20842 +       tx_ring = &adapter->tx_ring[0];
20843 +#endif
20844 +
20845 +
20846 +       /* This goes back to the question of how to logically map a tx queue
20847 +        * to a flow.  Right now, performance is impacted slightly negatively
20848 +        * if using multiple tx queues.  If the stack breaks away from a
20849 +        * single qdisc implementation, we can look at this again. */
20850 +       return (igb_xmit_frame_ring_adv(skb, netdev, tx_ring));
20851 +}
20852 +
20853 +
20854 +/**
20855 + * igb_tx_timeout - Respond to a Tx Hang
20856 + * @netdev: network interface device structure
20857 + **/
20858 +
20859 +static void igb_tx_timeout(struct net_device *netdev)
20860 +{
20861 +       struct igb_adapter *adapter = netdev_priv(netdev);
20862 +       struct e1000_hw *hw = &adapter->hw;
20863 +
20864 +       /* Do the reset outside of interrupt context */
20865 +       adapter->tx_timeout_count++;
20866 +       schedule_work(&adapter->reset_task);
20867 +       E1000_WRITE_REG(hw, E1000_EICS, adapter->eims_enable_mask &
20868 +                       ~(E1000_EIMS_TCP_TIMER | E1000_EIMS_OTHER));
20869 +}
20870 +
20871 +static void igb_reset_task(struct work_struct *work)
20872 +{
20873 +       struct igb_adapter *adapter;
20874 +       adapter = container_of(work, struct igb_adapter, reset_task);
20875 +
20876 +       igb_reinit_locked(adapter);
20877 +}
20878 +
20879 +/**
20880 + * igb_get_stats - Get System Network Statistics
20881 + * @netdev: network interface device structure
20882 + *
20883 + * Returns the address of the device statistics structure.
20884 + * The statistics are actually updated from the timer callback.
20885 + **/
20886 +
20887 +static struct net_device_stats *
20888 +igb_get_stats(struct net_device *netdev)
20889 +{
20890 +       struct igb_adapter *adapter = netdev_priv(netdev);
20891 +
20892 +       /* only return the current stats */
20893 +       return &adapter->net_stats;
20894 +}
20895 +
20896 +/**
20897 + * igb_change_mtu - Change the Maximum Transfer Unit
20898 + * @netdev: network interface device structure
20899 + * @new_mtu: new value for maximum frame size
20900 + *
20901 + * Returns 0 on success, negative on failure
20902 + **/
20903 +
20904 +static int igb_change_mtu(struct net_device *netdev, int new_mtu)
20905 +{
20906 +       struct igb_adapter *adapter = netdev_priv(netdev);
20907 +       int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
20908 +
20909 +       if ((new_mtu < 68) || (max_frame > MAX_JUMBO_FRAME_SIZE)) {
20910 +               DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
20911 +               return -EINVAL;
20912 +       }
20913 +
20914 +#define MAX_STD_JUMBO_FRAME_SIZE 9234
20915 +       if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
20916 +               DPRINTK(PROBE, ERR, "MTU > 9216 not supported.\n");
20917 +               return -EINVAL;
20918 +       }
20919 +
20920 +       while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
20921 +               msleep(1);
20922 +
20923 +       /* igb_down has a dependency on max_frame_size */
20924 +       adapter->max_frame_size = max_frame;
20925 +       if (netif_running(netdev))
20926 +               igb_down(adapter);
20927 +
20928 +       /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
20929 +        * means we reserve 2 more, this pushes us to allocate from the next
20930 +        * larger slab size.
20931 +        * i.e. RXBUFFER_2048 --> size-4096 slab
20932 +        */
20933 +
20934 +       if (max_frame <= IGB_RXBUFFER_256)
20935 +               adapter->rx_buffer_len = IGB_RXBUFFER_256;
20936 +       else if (max_frame <= IGB_RXBUFFER_512)
20937 +               adapter->rx_buffer_len = IGB_RXBUFFER_512;
20938 +       else if (max_frame <= IGB_RXBUFFER_1024)
20939 +               adapter->rx_buffer_len = IGB_RXBUFFER_1024;
20940 +       else if (max_frame <= IGB_RXBUFFER_2048)
20941 +               adapter->rx_buffer_len = IGB_RXBUFFER_2048;
20942 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
20943 +       else
20944 +#if (PAGE_SIZE / 2) > IGB_RXBUFFER_16384
20945 +               adapter->rx_buffer_len = IGB_RXBUFFER_16384;
20946 +#else
20947 +               adapter->rx_buffer_len = PAGE_SIZE / 2;
20948 +#endif
20949 +#else
20950 +       else if (max_frame <= IGB_RXBUFFER_4096)
20951 +               adapter->rx_buffer_len = IGB_RXBUFFER_4096;
20952 +       else if (max_frame <= IGB_RXBUFFER_8192)
20953 +               adapter->rx_buffer_len = IGB_RXBUFFER_8192;
20954 +       else if (max_frame <= IGB_RXBUFFER_16384)
20955 +               adapter->rx_buffer_len = IGB_RXBUFFER_16384;
20956 +#endif
20957 +       /* adjust allocation if LPE protects us, and we aren't using SBP */
20958 +       if ((max_frame == ETH_FRAME_LEN + ETH_FCS_LEN) ||
20959 +            (max_frame == MAXIMUM_ETHERNET_VLAN_SIZE))
20960 +               adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
20961 +
20962 +       DPRINTK(PROBE, INFO, "changing MTU from %d to %d\n",
20963 +               netdev->mtu, new_mtu);
20964 +       netdev->mtu = new_mtu;
20965 +
20966 +       if (netif_running(netdev))
20967 +               igb_up(adapter);
20968 +       else
20969 +               igb_reset(adapter);
20970 +
20971 +       clear_bit(__IGB_RESETTING, &adapter->state);
20972 +
20973 +       return 0;
20974 +}
20975 +
20976 +/**
20977 + * igb_update_stats - Update the board statistics counters
20978 + * @adapter: board private structure
20979 + **/
20980 +
20981 +void igb_update_stats(struct igb_adapter *adapter)
20982 +{
20983 +       struct e1000_hw *hw = &adapter->hw;
20984 +#ifdef HAVE_PCI_ERS
20985 +       struct pci_dev *pdev = adapter->pdev;
20986 +#endif
20987 +       u16 phy_tmp;
20988 +
20989 +#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
20990 +
20991 +       /*
20992 +        * Prevent stats update while adapter is being reset, or if the pci
20993 +        * connection is down.
20994 +        */
20995 +       if (adapter->link_speed == 0)
20996 +               return;
20997 +#ifdef HAVE_PCI_ERS
20998 +       if (pci_channel_offline(pdev))
20999 +               return;
21000 +#endif
21001 +
21002 +       adapter->stats.crcerrs += E1000_READ_REG(hw, E1000_CRCERRS);
21003 +       adapter->stats.gprc += E1000_READ_REG(hw, E1000_GPRC);
21004 +       adapter->stats.gorc += E1000_READ_REG(hw, E1000_GORCL);
21005 +       E1000_READ_REG(hw, E1000_GORCH); /* clear GORCL */
21006 +       adapter->stats.bprc += E1000_READ_REG(hw, E1000_BPRC);
21007 +       adapter->stats.mprc += E1000_READ_REG(hw, E1000_MPRC);
21008 +       adapter->stats.roc += E1000_READ_REG(hw, E1000_ROC);
21009 +
21010 +       adapter->stats.prc64 += E1000_READ_REG(hw, E1000_PRC64);
21011 +       adapter->stats.prc127 += E1000_READ_REG(hw, E1000_PRC127);
21012 +       adapter->stats.prc255 += E1000_READ_REG(hw, E1000_PRC255);
21013 +       adapter->stats.prc511 += E1000_READ_REG(hw, E1000_PRC511);
21014 +       adapter->stats.prc1023 += E1000_READ_REG(hw, E1000_PRC1023);
21015 +       adapter->stats.prc1522 += E1000_READ_REG(hw, E1000_PRC1522);
21016 +       adapter->stats.symerrs += E1000_READ_REG(hw, E1000_SYMERRS);
21017 +       adapter->stats.sec += E1000_READ_REG(hw, E1000_SEC);
21018 +
21019 +       adapter->stats.mpc += E1000_READ_REG(hw, E1000_MPC);
21020 +       adapter->stats.scc += E1000_READ_REG(hw, E1000_SCC);
21021 +       adapter->stats.ecol += E1000_READ_REG(hw, E1000_ECOL);
21022 +       adapter->stats.mcc += E1000_READ_REG(hw, E1000_MCC);
21023 +       adapter->stats.latecol += E1000_READ_REG(hw, E1000_LATECOL);
21024 +       adapter->stats.dc += E1000_READ_REG(hw, E1000_DC);
21025 +       adapter->stats.rlec += E1000_READ_REG(hw, E1000_RLEC);
21026 +       adapter->stats.xonrxc += E1000_READ_REG(hw, E1000_XONRXC);
21027 +       adapter->stats.xontxc += E1000_READ_REG(hw, E1000_XONTXC);
21028 +       adapter->stats.xoffrxc += E1000_READ_REG(hw, E1000_XOFFRXC);
21029 +       adapter->stats.xofftxc += E1000_READ_REG(hw, E1000_XOFFTXC);
21030 +       adapter->stats.fcruc += E1000_READ_REG(hw, E1000_FCRUC);
21031 +       adapter->stats.gptc += E1000_READ_REG(hw, E1000_GPTC);
21032 +       adapter->stats.gotc += E1000_READ_REG(hw, E1000_GOTCL);
21033 +       E1000_READ_REG(hw, E1000_GOTCH); /* clear GOTCL */
21034 +       adapter->stats.rnbc += E1000_READ_REG(hw, E1000_RNBC);
21035 +       adapter->stats.ruc += E1000_READ_REG(hw, E1000_RUC);
21036 +       adapter->stats.rfc += E1000_READ_REG(hw, E1000_RFC);
21037 +       adapter->stats.rjc += E1000_READ_REG(hw, E1000_RJC);
21038 +       adapter->stats.tor += E1000_READ_REG(hw, E1000_TORH);
21039 +       adapter->stats.tot += E1000_READ_REG(hw, E1000_TOTH);
21040 +       adapter->stats.tpr += E1000_READ_REG(hw, E1000_TPR);
21041 +
21042 +       adapter->stats.ptc64 += E1000_READ_REG(hw, E1000_PTC64);
21043 +       adapter->stats.ptc127 += E1000_READ_REG(hw, E1000_PTC127);
21044 +       adapter->stats.ptc255 += E1000_READ_REG(hw, E1000_PTC255);
21045 +       adapter->stats.ptc511 += E1000_READ_REG(hw, E1000_PTC511);
21046 +       adapter->stats.ptc1023 += E1000_READ_REG(hw, E1000_PTC1023);
21047 +       adapter->stats.ptc1522 += E1000_READ_REG(hw, E1000_PTC1522);
21048 +
21049 +       adapter->stats.mptc += E1000_READ_REG(hw, E1000_MPTC);
21050 +       adapter->stats.bptc += E1000_READ_REG(hw, E1000_BPTC);
21051 +
21052 +       adapter->stats.tpt += E1000_READ_REG(hw, E1000_TPT);
21053 +       adapter->stats.colc += E1000_READ_REG(hw, E1000_COLC);
21054 +
21055 +       adapter->stats.algnerrc += E1000_READ_REG(hw, E1000_ALGNERRC);
21056 +       adapter->stats.rxerrc += E1000_READ_REG(hw, E1000_RXERRC);
21057 +       adapter->stats.tncrs += E1000_READ_REG(hw, E1000_TNCRS);
21058 +       adapter->stats.tsctc += E1000_READ_REG(hw, E1000_TSCTC);
21059 +       adapter->stats.tsctfc += E1000_READ_REG(hw, E1000_TSCTFC);
21060 +
21061 +       adapter->stats.iac += E1000_READ_REG(hw, E1000_IAC);
21062 +       adapter->stats.icrxoc += E1000_READ_REG(hw, E1000_ICRXOC);
21063 +       adapter->stats.icrxptc += E1000_READ_REG(hw, E1000_ICRXPTC);
21064 +       adapter->stats.icrxatc += E1000_READ_REG(hw, E1000_ICRXATC);
21065 +       adapter->stats.ictxptc += E1000_READ_REG(hw, E1000_ICTXPTC);
21066 +       adapter->stats.ictxatc += E1000_READ_REG(hw, E1000_ICTXATC);
21067 +       adapter->stats.ictxqec += E1000_READ_REG(hw, E1000_ICTXQEC);
21068 +       adapter->stats.ictxqmtc += E1000_READ_REG(hw, E1000_ICTXQMTC);
21069 +       adapter->stats.icrxdmtc += E1000_READ_REG(hw, E1000_ICRXDMTC);
21070 +
21071 +       /* Fill out the OS statistics structure */
21072 +       adapter->net_stats.multicast = adapter->stats.mprc;
21073 +       adapter->net_stats.collisions = adapter->stats.colc;
21074 +
21075 +       /* Rx Errors */
21076 +
21077 +       /* RLEC on some newer hardware can be incorrect so build
21078 +       * our own version based on RUC and ROC */
21079 +       adapter->net_stats.rx_errors = adapter->stats.rxerrc +
21080 +               adapter->stats.crcerrs + adapter->stats.algnerrc +
21081 +               adapter->stats.ruc + adapter->stats.roc +
21082 +               adapter->stats.cexterr;
21083 +       adapter->net_stats.rx_length_errors = adapter->stats.ruc +
21084 +                                             adapter->stats.roc;
21085 +       adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
21086 +       adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc;
21087 +       adapter->net_stats.rx_missed_errors = adapter->stats.mpc;
21088 +
21089 +       /* Tx Errors */
21090 +       adapter->net_stats.tx_errors = adapter->stats.ecol +
21091 +                                      adapter->stats.latecol;
21092 +       adapter->net_stats.tx_aborted_errors = adapter->stats.ecol;
21093 +       adapter->net_stats.tx_window_errors = adapter->stats.latecol;
21094 +       adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;
21095 +
21096 +       /* Tx Dropped needs to be maintained elsewhere */
21097 +
21098 +       /* Phy Stats */
21099 +       if (hw->phy.media_type == e1000_media_type_copper) {
21100 +               if ((adapter->link_speed == SPEED_1000) &&
21101 +                  (!e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) {
21102 +                       phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
21103 +                       adapter->phy_stats.idle_errors += phy_tmp;
21104 +               }
21105 +       }
21106 +
21107 +       /* Management Stats */
21108 +       adapter->stats.mgptc += E1000_READ_REG(hw, E1000_MGTPTC);
21109 +       adapter->stats.mgprc += E1000_READ_REG(hw, E1000_MGTPRC);
21110 +       adapter->stats.mgpdc += E1000_READ_REG(hw, E1000_MGTPDC);
21111 +}
21112 +
21113 +static irqreturn_t igb_msix_other(int irq, void *data)
21114 +{
21115 +       struct net_device *netdev = data;
21116 +       struct igb_adapter *adapter = netdev_priv(netdev);
21117 +       struct e1000_hw *hw = &adapter->hw;
21118 +
21119 +       u32 icr = E1000_READ_REG(hw, E1000_ICR);
21120 +       /* reading ICR causes bit 31 of EICR to be cleared */
21121 +       if (!(icr & E1000_ICR_LSC))
21122 +               goto no_link_interrupt;
21123 +       hw->mac.get_link_status = 1;
21124 +       /* guard against interrupt when we're going down */
21125 +       if (!test_bit(__IGB_DOWN, &adapter->state))
21126 +               mod_timer(&adapter->watchdog_timer, jiffies + 1);
21127 +
21128 +no_link_interrupt:
21129 +       E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_LSC);
21130 +       E1000_WRITE_REG(hw, E1000_EIMS, adapter->eims_other);
21131 +
21132 +       return IRQ_HANDLED;
21133 +}
21134 +
21135 +
21136 +#ifdef CONFIG_IGB_SEPARATE_TX_HANDLER
21137 +static irqreturn_t igb_msix_tx(int irq, void *data)
21138 +{
21139 +       struct igb_ring *tx_ring = data;
21140 +       struct igb_adapter *adapter = tx_ring->adapter;
21141 +       struct e1000_hw *hw = &adapter->hw;
21142 +
21143 +#ifdef IGB_DCA
21144 +       if (adapter->flags & IGB_FLAG_DCA_ENABLED)
21145 +               igb_update_tx_dca(tx_ring);
21146 +#endif
21147 +
21148 +       tx_ring->total_bytes = 0;
21149 +       tx_ring->total_packets = 0;
21150 +
21151 +       /* auto mask will automatically reenable the interrupt when we write
21152 +        * EICS */
21153 +       if (!igb_clean_tx_irq(tx_ring))
21154 +               /* Ring was not completely cleaned, so fire another interrupt */
21155 +               E1000_WRITE_REG(hw, E1000_EICS, tx_ring->eims_value);
21156 +       else
21157 +               E1000_WRITE_REG(hw, E1000_EIMS, tx_ring->eims_value);
21158 +
21159 +       return IRQ_HANDLED;
21160 +}
21161 +#endif  /* CONFIG_IGB_SEPARATE_TX_HANDLER */
21162 +
21163 +static void igb_write_itr(struct igb_ring *ring)
21164 +{
21165 +       struct e1000_hw *hw = &ring->adapter->hw;
21166 +       if (ring->set_itr) {
21167 +               switch(hw->mac.type) {
21168 +                       case e1000_82576:
21169 +                               E1000_WRITE_REG(hw, ring->itr_register,
21170 +                                               ring->itr_val |
21171 +                                               0x80000000);
21172 +                               break;
21173 +                       default:
21174 +                               E1000_WRITE_REG(hw, ring->itr_register,
21175 +                                               ring->itr_val |
21176 +                                               (ring->itr_val << 16));
21177 +                               break;
21178 +               }
21179 +               ring->set_itr = 0;
21180 +       }
21181 +}
21182 +
21183 +static irqreturn_t igb_msix_rx(int irq, void *data)
21184 +{
21185 +       struct igb_ring *rx_ring = data;
21186 +       struct igb_adapter *adapter = rx_ring->adapter;
21187 +
21188 +       igb_write_itr(rx_ring);
21189 +       if (netif_rx_schedule_prep(adapter->netdev, &rx_ring->napi)) {
21190 +               __netif_rx_schedule(adapter->netdev, &rx_ring->napi);
21191 +
21192 +#ifdef IGB_DCA
21193 +               if (adapter->flags & IGB_FLAG_DCA_ENABLED)
21194 +                       igb_update_rx_dca(rx_ring);
21195 +#endif
21196 +       }
21197 +       return IRQ_HANDLED;
21198 +}
21199 +
21200 +#ifdef IGB_DCA
21201 +static void igb_update_rx_dca(struct igb_ring *rx_ring)
21202 +{
21203 +       u32 dca_rxctrl;
21204 +       struct igb_adapter *adapter = rx_ring->adapter;
21205 +       struct e1000_hw *hw = &adapter->hw;
21206 +       int cpu = get_cpu();
21207 +       int q = rx_ring->queue_index;
21208 +
21209 +       if (rx_ring->cpu != cpu) {
21210 +               dca_rxctrl = E1000_READ_REG(hw, E1000_DCA_RXCTRL(q));
21211 +               if (hw->mac.type == e1000_82576) {
21212 +                       dca_rxctrl &= ~E1000_DCA_RXCTRL_CPUID_MASK_82576;
21213 +                       dca_rxctrl |= dca3_get_tag(&adapter->pdev->dev, cpu) <<
21214 +                                     E1000_DCA_RXCTRL_CPUID_SHIFT;
21215 +               } else {
21216 +                       dca_rxctrl &= ~E1000_DCA_RXCTRL_CPUID_MASK;
21217 +                       dca_rxctrl |= dca3_get_tag(&adapter->pdev->dev, cpu);
21218 +               }
21219 +               dca_rxctrl |= E1000_DCA_RXCTRL_DESC_DCA_EN;
21220 +               dca_rxctrl |= E1000_DCA_RXCTRL_HEAD_DCA_EN;
21221 +               dca_rxctrl |= E1000_DCA_RXCTRL_DATA_DCA_EN;
21222 +               E1000_WRITE_REG(hw, E1000_DCA_RXCTRL(q), dca_rxctrl);
21223 +               rx_ring->cpu = cpu;
21224 +       }
21225 +       put_cpu();
21226 +}
21227 +
21228 +static void igb_update_tx_dca(struct igb_ring *tx_ring)
21229 +{
21230 +       u32 dca_txctrl;
21231 +       struct igb_adapter *adapter = tx_ring->adapter;
21232 +       struct e1000_hw *hw = &adapter->hw;
21233 +       int cpu = get_cpu();
21234 +       int q = tx_ring->queue_index;
21235 +
21236 +       if (tx_ring->cpu != cpu) {
21237 +               dca_txctrl = E1000_READ_REG(hw, E1000_DCA_TXCTRL(q));
21238 +               if (hw->mac.type == e1000_82576) {
21239 +                       dca_txctrl &= ~E1000_DCA_TXCTRL_CPUID_MASK_82576;
21240 +                       dca_txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu) <<
21241 +                                     E1000_DCA_TXCTRL_CPUID_SHIFT;
21242 +               } else {
21243 +                       dca_txctrl &= ~E1000_DCA_TXCTRL_CPUID_MASK;
21244 +                       dca_txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu);
21245 +               }
21246 +               dca_txctrl |= E1000_DCA_TXCTRL_DESC_DCA_EN;
21247 +               E1000_WRITE_REG(hw, E1000_DCA_TXCTRL(q), dca_txctrl);
21248 +               tx_ring->cpu = cpu;
21249 +       }
21250 +       put_cpu();
21251 +}
21252 +
21253 +static void igb_setup_dca(struct igb_adapter *adapter)
21254 +{
21255 +       int i;
21256 +
21257 +       if (!(adapter->flags & IGB_FLAG_DCA_ENABLED))
21258 +               return;
21259 +
21260 +       for (i = 0; i < adapter->num_tx_queues; i++) {
21261 +               adapter->tx_ring[i].cpu = -1;
21262 +               igb_update_tx_dca(&adapter->tx_ring[i]);
21263 +       }
21264 +       for (i = 0; i < adapter->num_rx_queues; i++) {
21265 +               adapter->rx_ring[i].cpu = -1;
21266 +               igb_update_rx_dca(&adapter->rx_ring[i]);
21267 +       }
21268 +}
21269 +
21270 +static int __igb_notify_dca(struct device *dev, void *data)
21271 +{
21272 +       struct net_device *netdev = dev_get_drvdata(dev);
21273 +       struct igb_adapter *adapter = netdev_priv(netdev);
21274 +       struct e1000_hw *hw = &adapter->hw;
21275 +       unsigned long event = *(unsigned long *)data;
21276 +
21277 +       if (!(adapter->flags & IGB_FLAG_HAS_DCA))
21278 +               goto out;
21279 +
21280 +       switch (event) {
21281 +       case DCA_PROVIDER_ADD:
21282 +               /* if we're already enabled, don't do it again */
21283 +               if (adapter->flags & IGB_FLAG_DCA_ENABLED)
21284 +                       break;
21285 +               adapter->flags |= IGB_FLAG_DCA_ENABLED;
21286 +               /* Always use CB2 mode, difference is masked
21287 +                * in the CB driver. */
21288 +               E1000_WRITE_REG(hw, E1000_DCA_CTRL, 2);
21289 +               if (dca_add_requester(dev) == E1000_SUCCESS) {
21290 +                       DPRINTK(PROBE, INFO, "DCA enabled\n");
21291 +                       igb_setup_dca(adapter);
21292 +                       break;
21293 +               }
21294 +               /* Fall Through since DCA is disabled. */
21295 +       case DCA_PROVIDER_REMOVE:
21296 +               if (adapter->flags & IGB_FLAG_DCA_ENABLED) {
21297 +                       /* without this a class_device is left
21298 +                        * hanging around in the sysfs model */
21299 +                       dca_remove_requester(dev);
21300 +                       DPRINTK(PROBE, INFO, "DCA disabled\n");
21301 +                       adapter->flags &= ~IGB_FLAG_DCA_ENABLED;
21302 +                       E1000_WRITE_REG(hw, E1000_DCA_CTRL, 1);
21303 +               }
21304 +               break;
21305 +       }
21306 +
21307 +out:
21308 +       return E1000_SUCCESS;
21309 +}
21310 +
21311 +static int igb_notify_dca(struct notifier_block *nb, unsigned long event,
21312 +                          void *p)
21313 +{
21314 +       int ret_val;
21315 +
21316 +       ret_val = driver_for_each_device(&igb_driver.driver, NULL, &event,
21317 +                                        __igb_notify_dca);
21318 +
21319 +       return ret_val ? NOTIFY_BAD : NOTIFY_DONE;
21320 +}
21321 +#endif /* IGB_DCA */
21322 +
21323 +/**
21324 + * igb_intr_msi - Interrupt Handler
21325 + * @irq: interrupt number
21326 + * @data: pointer to a network interface device structure
21327 + **/
21328 +static irqreturn_t igb_intr_msi(int irq, void *data)
21329 +{
21330 +       struct net_device *netdev = data;
21331 +       struct igb_adapter *adapter = netdev_priv(netdev);
21332 +       struct e1000_hw *hw = &adapter->hw;
21333 +       /* read ICR disables interrupts using IAM */
21334 +       u32 icr = E1000_READ_REG(hw, E1000_ICR);
21335 +
21336 +       igb_write_itr(adapter->rx_ring);
21337 +
21338 +       if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
21339 +               hw->mac.get_link_status = 1;
21340 +               if (!test_bit(__IGB_DOWN, &adapter->state))
21341 +                       mod_timer(&adapter->watchdog_timer, jiffies + 1);
21342 +       }
21343 +
21344 +       netif_rx_schedule(netdev, &adapter->rx_ring[0].napi);
21345 +
21346 +       return IRQ_HANDLED;
21347 +}
21348 +
21349 +/**
21350 + * igb_intr - Legacy Interrupt Handler
21351 + * @irq: interrupt number
21352 + * @data: pointer to a network interface device structure
21353 + **/
21354 +
21355 +static irqreturn_t igb_intr(int irq, void *data)
21356 +{
21357 +       struct net_device *netdev = data;
21358 +       struct igb_adapter *adapter = netdev_priv(netdev);
21359 +       struct e1000_hw *hw = &adapter->hw;
21360 +       /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked.  No
21361 +        * need for the IMC write */
21362 +       u32 icr = E1000_READ_REG(hw, E1000_ICR);
21363 +       u32 eicr = 0;
21364 +       if (!icr)
21365 +               return IRQ_NONE;  /* Not our interrupt */
21366 +
21367 +       igb_write_itr(adapter->rx_ring);
21368 +
21369 +       /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
21370 +        * not set, then the adapter didn't send an interrupt */
21371 +       if (!(icr & E1000_ICR_INT_ASSERTED))
21372 +               return IRQ_NONE;
21373 +
21374 +       eicr = E1000_READ_REG(hw, E1000_EICR);
21375 +
21376 +       if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
21377 +               hw->mac.get_link_status = 1;
21378 +               /* guard against interrupt when we're going down */
21379 +               if (!test_bit(__IGB_DOWN, &adapter->state))
21380 +                       mod_timer(&adapter->watchdog_timer, jiffies + 1);
21381 +       }
21382 +
21383 +       netif_rx_schedule(netdev, &adapter->rx_ring[0].napi);
21384 +
21385 +
21386 +       return IRQ_HANDLED;
21387 +}
21388 +
21389 +/**
21390 + * igb_poll - NAPI Rx polling callback
21391 + * @napi: napi polling structure
21392 + * @budget: count of how many packets we should handle
21393 + **/
21394 +
21395 +static int igb_poll(struct napi_struct *napi, int budget)
21396 +{
21397 +       struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi);
21398 +       struct igb_adapter *adapter = rx_ring->adapter;
21399 +       struct net_device *netdev = adapter->netdev;
21400 +       int tx_clean_complete, work_done = 0;
21401 +
21402 +       /* this poll routine only supports one tx and one rx queue */
21403 +#ifdef IGB_DCA
21404 +       if (adapter->flags & IGB_FLAG_DCA_ENABLED)
21405 +               igb_update_tx_dca(&adapter->tx_ring[0]);
21406 +#endif
21407 +       tx_clean_complete = igb_clean_tx_irq(&adapter->tx_ring[0]);
21408 +
21409 +#ifdef IGB_DCA
21410 +       if (adapter->flags & IGB_FLAG_DCA_ENABLED)
21411 +               igb_update_rx_dca(&adapter->rx_ring[0]);
21412 +#endif
21413 +       igb_clean_rx_irq_adv(&adapter->rx_ring[0], &work_done, budget);
21414 +
21415 +       /* If no Tx and not enough Rx work done, exit the polling mode */
21416 +       if ((tx_clean_complete && (work_done == 0)) || !netif_running(netdev)) {
21417 +               netif_rx_complete(netdev, napi);
21418 +               if (adapter->itr_setting & 3)
21419 +                       igb_set_itr(adapter);
21420 +               if (!test_bit(__IGB_DOWN, &adapter->state))
21421 +                       igb_irq_enable(adapter);
21422 +               return 0;
21423 +       }
21424 +
21425 +       if (!tx_clean_complete)
21426 +               work_done = budget;
21427 +
21428 +       return work_done;
21429 +}
21430 +
21431 +static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget)
21432 +{
21433 +       struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi);
21434 +       struct igb_adapter *adapter = rx_ring->adapter;
21435 +       struct e1000_hw *hw = &adapter->hw;
21436 +       struct net_device *netdev = adapter->netdev;
21437 +       int tx_clean_complete = 1;
21438 +       int work_done = 0;
21439 +
21440 +#ifdef IGB_DCA
21441 +       if (adapter->flags & IGB_FLAG_DCA_ENABLED)
21442 +               igb_update_rx_dca(rx_ring);
21443 +#endif
21444 +       igb_clean_rx_irq_adv(rx_ring, &work_done, budget);
21445 +
21446 +       if (rx_ring->buddy) {
21447 +#ifdef IGB_DCA
21448 +               if (adapter->flags & IGB_FLAG_DCA_ENABLED)
21449 +                       igb_update_tx_dca(rx_ring->buddy);
21450 +#endif
21451 +               tx_clean_complete = igb_clean_tx_irq(rx_ring->buddy);
21452 +       }
21453 +
21454 +       /* If not enough Rx work done, exit the polling mode */
21455 +       if ((tx_clean_complete && (work_done == 0)) || !netif_running(netdev)) {
21456 +               netif_rx_complete(netdev, napi);
21457 +               if (adapter->itr_setting & 3) {
21458 +                       if (adapter->num_rx_queues == 1)
21459 +                               igb_set_itr(adapter);
21460 +                       else
21461 +                               igb_update_ring_itr(rx_ring);
21462 +               }
21463 +               if (!test_bit(__IGB_DOWN, &adapter->state))
21464 +                       E1000_WRITE_REG(hw, E1000_EIMS, rx_ring->eims_value);
21465 +
21466 +               return 0;
21467 +       }
21468 +
21469 +       if (!tx_clean_complete)
21470 +               work_done = budget;
21471 +
21472 +       return work_done;
21473 +}
21474 +
21475 +static inline u32 get_head(struct igb_ring *tx_ring)
21476 +{
21477 +       void *end = (struct e1000_tx_desc *)tx_ring->desc + tx_ring->count;
21478 +       return le32_to_cpu(*(volatile __le32 *)end);
21479 +}
21480 +
21481 +/**
21482 + * igb_clean_tx_irq - Reclaim resources after transmit completes
21483 + * @adapter: board private structure
21484 + * returns TRUE if ring is completely cleaned
21485 + **/
21486 +static bool igb_clean_tx_irq(struct igb_ring *tx_ring)
21487 +{
21488 +       struct igb_adapter *adapter = tx_ring->adapter;
21489 +       struct e1000_hw *hw = &adapter->hw;
21490 +       struct net_device *netdev = adapter->netdev;
21491 +       struct e1000_tx_desc *tx_desc;
21492 +       struct igb_buffer *buffer_info;
21493 +       struct sk_buff *skb;
21494 +       unsigned int i;
21495 +       u32 head, oldhead;
21496 +       unsigned int count = 0;
21497 +       unsigned int total_bytes = 0, total_packets = 0;
21498 +       bool retval = TRUE;
21499 +
21500 +       rmb();
21501 +       head = get_head(tx_ring);
21502 +       i = tx_ring->next_to_clean;
21503 +       while (1) {
21504 +               while (i != head) {
21505 +                       tx_desc = E1000_TX_DESC(*tx_ring, i);
21506 +                       buffer_info = &tx_ring->buffer_info[i];
21507 +                       skb = buffer_info->skb;
21508 +
21509 +                       if (skb) {
21510 +#ifdef NETIF_F_TSO
21511 +                               unsigned int segs, bytecount;
21512 +
21513 +                               /* gso_segs is currently only valid for tcp */
21514 +                               segs = skb_shinfo(skb)->gso_segs ?: 1;
21515 +                               /* multiply data chunks by size of headers */
21516 +                               bytecount = ((segs - 1) * skb_headlen(skb)) +
21517 +                                           skb->len;
21518 +                               total_packets += segs;
21519 +                               total_bytes += bytecount;
21520 +#else
21521 +                               total_packets++;
21522 +                               total_bytes += skb->len;
21523 +#endif
21524 +                       }
21525 +
21526 +                       igb_unmap_and_free_tx_resource(adapter, buffer_info);
21527 +
21528 +                       i++;
21529 +                       if (i == tx_ring->count)
21530 +                               i = 0;
21531 +
21532 +                       count++;
21533 +                       if (count == tx_ring->count) {
21534 +                               retval = FALSE;
21535 +                               goto done_cleaning;
21536 +                       }
21537 +               }
21538 +               oldhead = head;
21539 +               rmb();
21540 +               head = get_head(tx_ring);
21541 +               if (head == oldhead)
21542 +                       goto done_cleaning;
21543 +       }  /* while (1) */
21544 +
21545 +done_cleaning:
21546 +       tx_ring->next_to_clean = i;
21547 +
21548 +       if (unlikely(count &&
21549 +                    netif_carrier_ok(netdev) &&
21550 +                    IGB_DESC_UNUSED(tx_ring) >= IGB_TX_QUEUE_WAKE)) {
21551 +               /* Make sure that anybody stopping the queue after this
21552 +                * sees the new next_to_clean.
21553 +                */
21554 +               smp_mb();
21555 +#ifdef HAVE_TX_MQ
21556 +               if (__netif_subqueue_stopped(netdev, tx_ring->queue_index) &&
21557 +                   !(test_bit(__IGB_DOWN, &adapter->state))) {
21558 +                       netif_wake_subqueue(netdev, tx_ring->queue_index);
21559 +                       ++adapter->restart_queue;
21560 +               }
21561 +#endif
21562 +               if (netif_queue_stopped(netdev) &&
21563 +                   !(test_bit(__IGB_DOWN, &adapter->state))) {
21564 +                       netif_wake_queue(netdev);
21565 +                       ++adapter->restart_queue;
21566 +               }
21567 +       }
21568 +       if (tx_ring->detect_tx_hung) {
21569 +               /* Detect a transmit hang in hardware, this serializes the
21570 +                * check with the clearing of time_stamp and movement of i */
21571 +               tx_ring->detect_tx_hung = FALSE;
21572 +               if (tx_ring->buffer_info[i].time_stamp &&
21573 +                   time_after(jiffies, tx_ring->buffer_info[i].time_stamp +
21574 +                              (adapter->tx_timeout_factor * HZ))
21575 +                   && !(E1000_READ_REG(hw, E1000_STATUS) &
21576 +                        E1000_STATUS_TXOFF)) {
21577 +
21578 +                       tx_desc = E1000_TX_DESC(*tx_ring, i);
21579 +                       /* detected Tx unit hang */
21580 +                       DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
21581 +                                       "  Tx Queue             <%lu>\n"
21582 +                                       "  TDH                  <%x>\n"
21583 +                                       "  TDT                  <%x>\n"
21584 +                                       "  next_to_use          <%x>\n"
21585 +                                       "  next_to_clean        <%x>\n"
21586 +                                       "  head (WB)            <%x>\n"
21587 +                                       "buffer_info[next_to_clean]\n"
21588 +                                       "  time_stamp           <%lx>\n"
21589 +                                       "  jiffies              <%lx>\n"
21590 +                                       "  desc.status          <%x>\n",
21591 +                               (unsigned long)((tx_ring->queue_index) /
21592 +                                       sizeof(struct igb_ring)),
21593 +                               readl(hw->hw_addr + tx_ring->head),
21594 +                               readl(hw->hw_addr + tx_ring->tail),
21595 +                               tx_ring->next_to_use,
21596 +                               tx_ring->next_to_clean,
21597 +                               head,
21598 +                               tx_ring->buffer_info[i].time_stamp,
21599 +                               jiffies,
21600 +                               tx_desc->upper.fields.status);
21601 +                       if (netif_is_multiqueue(netdev))
21602 +                               netif_stop_subqueue(netdev,
21603 +                                                   tx_ring->queue_index);
21604 +                       else
21605 +                               netif_stop_queue(netdev);
21606 +               }
21607 +       }
21608 +       tx_ring->total_bytes += total_bytes;
21609 +       tx_ring->total_packets += total_packets;
21610 +       tx_ring->tx_stats.packets += total_packets;
21611 +       tx_ring->tx_stats.bytes += total_bytes;
21612 +       adapter->net_stats.tx_bytes += total_bytes;
21613 +       adapter->net_stats.tx_packets += total_packets;
21614 +       return retval;
21615 +}
21616 +
21617 +#ifdef IGB_LRO
21618 + /**
21619 + * igb_get_skb_hdr - helper function for LRO header processing
21620 + * @skb: pointer to sk_buff to be added to LRO packet
21621 + * @iphdr: pointer to ip header structure
21622 + * @tcph: pointer to tcp header structure
21623 + * @hdr_flags: pointer to header flags
21624 + * @priv: pointer to the receive descriptor for the current sk_buff
21625 + **/
21626 +static int igb_get_skb_hdr(struct sk_buff *skb, void **iphdr, void **tcph,
21627 +                           u64 *hdr_flags, void *priv)
21628 +{
21629 +       union e1000_adv_rx_desc *rx_desc = priv;
21630 +       u16 pkt_type = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info &
21631 +                      (E1000_RXDADV_PKTTYPE_IPV4 | E1000_RXDADV_PKTTYPE_TCP);
21632 +
21633 +       /* Verify that this is a valid IPv4 TCP packet */
21634 +       if (pkt_type != (E1000_RXDADV_PKTTYPE_IPV4 |
21635 +                         E1000_RXDADV_PKTTYPE_TCP))
21636 +               return -1;
21637 +
21638 +       /* Set network headers */
21639 +       skb_reset_network_header(skb);
21640 +       skb_set_transport_header(skb, ip_hdrlen(skb));
21641 +       *iphdr = ip_hdr(skb);
21642 +       *tcph = tcp_hdr(skb);
21643 +       *hdr_flags = LRO_IPV4 | LRO_TCP;
21644 +
21645 +       return 0;
21646 +
21647 +}
21648 +#endif /* IGB_LRO */
21649 +
21650 +/**
21651 + * igb_receive_skb - helper function to handle rx indications
21652 + * @adapter: board private structure
21653 + * @status: descriptor status field as written by hardware
21654 + * @rx_desc: receive descriptor containing vlan and type information.
21655 + * @skb: pointer to sk_buff to be indicated to stack
21656 + **/
21657 +static void igb_receive_skb(struct igb_ring *ring, u8 status,
21658 +                            union e1000_adv_rx_desc * rx_desc,
21659 +                            struct sk_buff *skb)
21660 +{
21661 +       struct igb_adapter * adapter = ring->adapter;
21662 +       bool vlan_extracted = (adapter->vlgrp && (status & E1000_RXD_STAT_VP));
21663 +
21664 +#ifdef IGB_LRO
21665 +       if (adapter->netdev->features & NETIF_F_LRO &&
21666 +           skb->ip_summed == CHECKSUM_UNNECESSARY) {
21667 +               if (vlan_extracted)
21668 +                       lro_vlan_hwaccel_receive_skb(&ring->lro_mgr, skb,
21669 +                                                    adapter->vlgrp,
21670 +                                                    le16_to_cpu(rx_desc->wb.upper.vlan),
21671 +                                                    rx_desc);
21672 +               else
21673 +                       lro_receive_skb(&ring->lro_mgr,skb, rx_desc);
21674 +               ring->lro_used = TRUE;
21675 +       } else {
21676 +#endif
21677 +               if (vlan_extracted)
21678 +                       vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
21679 +                                                le16_to_cpu(rx_desc->wb.upper.vlan));
21680 +               else
21681 +
21682 +                       netif_receive_skb(skb);
21683 +#ifdef IGB_LRO
21684 +       }
21685 +#endif
21686 +}
21687 +
21688 +
21689 +static inline void igb_rx_checksum_adv(struct igb_adapter *adapter,
21690 +                                       u32 status_err, struct sk_buff *skb)
21691 +{
21692 +       skb->ip_summed = CHECKSUM_NONE;
21693 +
21694 +       /* Ignore Checksum bit is set or checksum is disabled through ethtool */
21695 +       if ((status_err & E1000_RXD_STAT_IXSM) || !adapter->rx_csum)
21696 +               return;
21697 +       /* TCP/UDP checksum error bit is set */
21698 +       if (status_err &
21699 +           (E1000_RXDEXT_STATERR_TCPE | E1000_RXDEXT_STATERR_IPE)) {
21700 +               /* let the stack verify checksum errors */
21701 +               adapter->hw_csum_err++;
21702 +               return;
21703 +       }
21704 +       /* It must be a TCP or UDP packet with a valid checksum */
21705 +       if (status_err & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))
21706 +               skb->ip_summed = CHECKSUM_UNNECESSARY;
21707 +
21708 +       adapter->hw_csum_good++;
21709 +}
21710 +
21711 +static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
21712 +                                 int *work_done, int work_to_do)
21713 +{
21714 +       struct igb_adapter *adapter = rx_ring->adapter;
21715 +       struct net_device *netdev = adapter->netdev;
21716 +       struct pci_dev *pdev = adapter->pdev;
21717 +       union e1000_adv_rx_desc *rx_desc , *next_rxd;
21718 +       struct igb_buffer *buffer_info , *next_buffer;
21719 +       struct sk_buff *skb;
21720 +       bool cleaned = FALSE;
21721 +       int cleaned_count = 0;
21722 +       unsigned int total_bytes = 0, total_packets = 0;
21723 +       unsigned int i;
21724 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
21725 +       u32 length, hlen, staterr;
21726 +#else
21727 +       u32 length, staterr;
21728 +#endif
21729 +
21730 +       i = rx_ring->next_to_clean;
21731 +       rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
21732 +       staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
21733 +
21734 +       while (staterr & E1000_RXD_STAT_DD) {
21735 +
21736 +               if (*work_done >= work_to_do)
21737 +                       break;
21738 +               (*work_done)++;
21739 +
21740 +               buffer_info = &rx_ring->buffer_info[i];
21741 +
21742 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
21743 +               /* HW will not DMA in data larger than the given buffer, even
21744 +                * if it parses the (NFS, of course) header to be larger.  In
21745 +                * that case, it fills the header buffer and spills the rest
21746 +                * into the page.
21747 +                */
21748 +               hlen = (le16_to_cpu(rx_desc->wb.lower.lo_dword.hs_rss.hdr_info) &
21749 +                 E1000_RXDADV_HDRBUFLEN_MASK) >> E1000_RXDADV_HDRBUFLEN_SHIFT;
21750 +               if (hlen > adapter->rx_ps_hdr_size)
21751 +                       hlen = adapter->rx_ps_hdr_size;
21752 +
21753 +#endif /* CONFIG_IGB_DISABLE_PACKET_SPLIT */
21754 +               if (staterr & E1000_RXD_STAT_DYNINT)
21755 +                       adapter->lli_int++;
21756 +
21757 +               length = le16_to_cpu(rx_desc->wb.upper.length);
21758 +               cleaned = TRUE;
21759 +               cleaned_count++;
21760 +
21761 +#ifdef CONFIG_IGB_DISABLE_PACKET_SPLIT
21762 +               skb = buffer_info->skb;
21763 +               prefetch(skb->data - NET_IP_ALIGN);
21764 +               buffer_info->skb = NULL;
21765 +               pci_unmap_single(pdev, buffer_info->dma,
21766 +                                adapter->rx_buffer_len +
21767 +                                NET_IP_ALIGN,
21768 +                                PCI_DMA_FROMDEVICE);
21769 +               skb_put(skb, length);
21770 +#else
21771 +               skb = buffer_info->skb;
21772 +               prefetch(skb->data - NET_IP_ALIGN);
21773 +               buffer_info->skb = NULL;
21774 +               if (!adapter->rx_ps_hdr_size) {
21775 +                       pci_unmap_single(pdev, buffer_info->dma,
21776 +                                        adapter->rx_buffer_len +
21777 +                                          NET_IP_ALIGN,
21778 +                                        PCI_DMA_FROMDEVICE);
21779 +                       skb_put(skb, length);
21780 +                       goto send_up;
21781 +               }
21782 +
21783 +               if (!skb_shinfo(skb)->nr_frags) {
21784 +                       pci_unmap_single(pdev, buffer_info->dma,
21785 +                                        adapter->rx_ps_hdr_size + NET_IP_ALIGN,
21786 +                                        PCI_DMA_FROMDEVICE);
21787 +                       skb_put(skb, hlen);
21788 +               }
21789 +
21790 +               if (length) {
21791 +                       pci_unmap_page(pdev, buffer_info->page_dma,
21792 +                                      PAGE_SIZE / 2,
21793 +                                      PCI_DMA_FROMDEVICE);
21794 +                       buffer_info->page_dma = 0;
21795 +
21796 +                       skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags++,
21797 +                                          buffer_info->page,
21798 +                                          buffer_info->page_offset,
21799 +                                          length);
21800 +
21801 +                       if ((adapter->rx_buffer_len > (PAGE_SIZE / 2)) ||
21802 +                           (page_count(buffer_info->page) != 1))
21803 +                               buffer_info->page = NULL;
21804 +                       else
21805 +                               get_page(buffer_info->page);
21806 +
21807 +                       skb->len += length;
21808 +                       skb->data_len += length;
21809 +
21810 +                       skb->truesize += length;
21811 +               }
21812 +send_up:
21813 +#endif /* CONFIG_IGB_DISABLE_PACKET_SPLIT */
21814 +               i++;
21815 +               if (i == rx_ring->count)
21816 +                       i = 0;
21817 +               next_rxd = E1000_RX_DESC_ADV(*rx_ring, i);
21818 +               prefetch(next_rxd);
21819 +               next_buffer = &rx_ring->buffer_info[i];
21820 +
21821 +               if (!(staterr & E1000_RXD_STAT_EOP)) {
21822 +                       buffer_info->skb = next_buffer->skb;
21823 +                       buffer_info->dma = next_buffer->dma;
21824 +                       next_buffer->skb = skb;
21825 +                       next_buffer->dma = 0;
21826 +                       goto next_desc;
21827 +               }
21828 +
21829 +               if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) {
21830 +                       dev_kfree_skb_irq(skb);
21831 +                       goto next_desc;
21832 +               }
21833 +
21834 +               total_bytes += skb->len;
21835 +               total_packets++;
21836 +
21837 +               igb_rx_checksum_adv(adapter, staterr, skb);
21838 +
21839 +               skb->protocol = eth_type_trans(skb, netdev);
21840 +
21841 +               igb_receive_skb(rx_ring, staterr, rx_desc, skb);
21842 +
21843 +               netdev->last_rx = jiffies;
21844 +
21845 +next_desc:
21846 +               rx_desc->wb.upper.status_error = 0;
21847 +
21848 +               /* return some buffers to hardware, one at a time is too slow */
21849 +               if (cleaned_count >= IGB_RX_BUFFER_WRITE) {
21850 +                       igb_alloc_rx_buffers_adv(rx_ring, cleaned_count);
21851 +                       cleaned_count = 0;
21852 +               }
21853 +
21854 +               /* use prefetched values */
21855 +               rx_desc = next_rxd;
21856 +               buffer_info = next_buffer;
21857 +
21858 +               staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
21859 +       }
21860 +
21861 +       rx_ring->next_to_clean = i;
21862 +       cleaned_count = IGB_DESC_UNUSED(rx_ring);
21863 +
21864 +#ifdef IGB_LRO
21865 +       if (rx_ring->lro_used) {
21866 +               lro_flush_all(&rx_ring->lro_mgr);
21867 +               rx_ring->lro_used = FALSE;
21868 +       }
21869 +#endif
21870 +
21871 +       if (cleaned_count)
21872 +               igb_alloc_rx_buffers_adv(rx_ring, cleaned_count);
21873 +
21874 +       rx_ring->total_packets += total_packets;
21875 +       rx_ring->total_bytes += total_bytes;
21876 +       rx_ring->rx_stats.packets += total_packets;
21877 +       rx_ring->rx_stats.bytes += total_bytes;
21878 +       adapter->net_stats.rx_bytes += total_bytes;
21879 +       adapter->net_stats.rx_packets += total_packets;
21880 +       return cleaned;
21881 +}
21882 +
21883 +
21884 +/**
21885 + * igb_alloc_rx_buffers_adv - Replace used receive buffers; packet split
21886 + * @adapter: address of board private structure
21887 + **/
21888 +
21889 +static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
21890 +                                     int cleaned_count)
21891 +{
21892 +       struct igb_adapter *adapter = rx_ring->adapter;
21893 +       struct net_device *netdev = adapter->netdev;
21894 +       struct pci_dev *pdev = adapter->pdev;
21895 +       union e1000_adv_rx_desc *rx_desc;
21896 +       struct igb_buffer *buffer_info;
21897 +       struct sk_buff *skb;
21898 +       unsigned int i;
21899 +       int bufsz;
21900 +
21901 +       i = rx_ring->next_to_use;
21902 +       buffer_info = &rx_ring->buffer_info[i];
21903 +
21904 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
21905 +       if (adapter->rx_ps_hdr_size)
21906 +               bufsz = adapter->rx_ps_hdr_size;
21907 +       else
21908 +               bufsz = adapter->rx_buffer_len;
21909 +       bufsz += NET_IP_ALIGN;
21910 +#else
21911 +       bufsz = adapter->rx_buffer_len + NET_IP_ALIGN;
21912 +#endif /* CONFIG_IGB_DISABLE_PACKET_SPLIT */
21913 +
21914 +       while (cleaned_count--) {
21915 +               rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
21916 +
21917 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
21918 +               if (adapter->rx_ps_hdr_size && !buffer_info->page_dma) {
21919 +                       if (!buffer_info->page) {
21920 +                               buffer_info->page = alloc_page(GFP_ATOMIC);
21921 +                               if (!buffer_info->page) {
21922 +                                       adapter->alloc_rx_buff_failed++;
21923 +                                       goto no_buffers;
21924 +                               }
21925 +                               buffer_info->page_offset = 0;
21926 +                       } else {
21927 +                               buffer_info->page_offset ^= PAGE_SIZE / 2;
21928 +                       }
21929 +                       buffer_info->page_dma =
21930 +                               pci_map_page(pdev, buffer_info->page,
21931 +                                            buffer_info->page_offset,
21932 +                                            PAGE_SIZE / 2,
21933 +                                            PCI_DMA_FROMDEVICE);
21934 +               }
21935 +#endif /* CONFIG_IGB_DISABLE_PACKET_SPLIT */
21936 +
21937 +               if (!buffer_info->skb) {
21938 +                       skb = netdev_alloc_skb(netdev, bufsz);
21939 +                       if (!skb) {
21940 +                               adapter->alloc_rx_buff_failed++;
21941 +                               goto no_buffers;
21942 +                       }
21943 +
21944 +                       /* Make buffer alignment 2 beyond a 16 byte boundary
21945 +                        * this will result in a 16 byte aligned IP header after
21946 +                        * the 14 byte MAC header is removed
21947 +                        */
21948 +                       skb_reserve(skb, NET_IP_ALIGN);
21949 +
21950 +                       buffer_info->skb = skb;
21951 +                       buffer_info->dma = pci_map_single(pdev, skb->data,
21952 +                                                         bufsz,
21953 +                                                         PCI_DMA_FROMDEVICE);
21954 +               }
21955 +               /* Refresh the desc even if buffer_addrs didn't change because
21956 +                * each write-back erases this info. */
21957 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
21958 +               if (adapter->rx_ps_hdr_size) {
21959 +                       rx_desc->read.pkt_addr =
21960 +                            cpu_to_le64(buffer_info->page_dma);
21961 +                       rx_desc->read.hdr_addr = cpu_to_le64(buffer_info->dma);
21962 +               } else {
21963 +#else
21964 +               {
21965 +#endif /* CONFIG_IGB_DISABLE_PACKET_SPLIT */
21966 +                       rx_desc->read.pkt_addr =
21967 +                            cpu_to_le64(buffer_info->dma);
21968 +                       rx_desc->read.hdr_addr = 0;
21969 +               }
21970 +
21971 +               i++;
21972 +               if (i == rx_ring->count)
21973 +                       i = 0;
21974 +               buffer_info = &rx_ring->buffer_info[i];
21975 +       }
21976 +
21977 +no_buffers:
21978 +       if (rx_ring->next_to_use != i) {
21979 +               rx_ring->next_to_use = i;
21980 +               if (i == 0)
21981 +                       i = (rx_ring->count - 1);
21982 +               else
21983 +                       i--;
21984 +
21985 +               /* Force memory writes to complete before letting h/w
21986 +                * know there are new descriptors to fetch.  (Only
21987 +                * applicable for weak-ordered memory model archs,
21988 +                * such as IA-64). */
21989 +               wmb();
21990 +               writel(i, adapter->hw.hw_addr + rx_ring->tail);
21991 +       }
21992 +}
21993 +
21994 +#ifdef SIOCGMIIPHY
21995 +/**
21996 + * igb_mii_ioctl -
21997 + * @netdev:
21998 + * @ifreq:
21999 + * @cmd:
22000 + **/
22001 +
22002 +static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
22003 +{
22004 +       struct igb_adapter *adapter = netdev_priv(netdev);
22005 +       struct mii_ioctl_data *data = if_mii(ifr);
22006 +
22007 +       if (adapter->hw.phy.media_type != e1000_media_type_copper)
22008 +               return -EOPNOTSUPP;
22009 +
22010 +       switch (cmd) {
22011 +       case SIOCGMIIPHY:
22012 +               data->phy_id = adapter->hw.phy.addr;
22013 +               break;
22014 +       case SIOCGMIIREG:
22015 +               if (!capable(CAP_NET_ADMIN))
22016 +                       return -EPERM;
22017 +               if (e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
22018 +                                  &data->val_out))
22019 +                       return -EIO;
22020 +               break;
22021 +       case SIOCSMIIREG:
22022 +       default:
22023 +               return -EOPNOTSUPP;
22024 +       }
22025 +       return E1000_SUCCESS;
22026 +}
22027 +#endif
22028 +
22029 +/**
22030 + * igb_ioctl -
22031 + * @netdev:
22032 + * @ifreq:
22033 + * @cmd:
22034 + **/
22035 +
22036 +static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
22037 +{
22038 +       switch (cmd) {
22039 +#ifdef SIOCGMIIPHY
22040 +       case SIOCGMIIPHY:
22041 +       case SIOCGMIIREG:
22042 +       case SIOCSMIIREG:
22043 +               return igb_mii_ioctl(netdev, ifr, cmd);
22044 +#endif
22045 +#ifdef ETHTOOL_OPS_COMPAT
22046 +       case SIOCETHTOOL:
22047 +               return ethtool_ioctl(ifr);
22048 +#endif
22049 +       default:
22050 +               return -EOPNOTSUPP;
22051 +       }
22052 +}
22053 +
22054 +void e1000_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
22055 +{
22056 +       struct igb_adapter *adapter = hw->back;
22057 +
22058 +       pci_read_config_word(adapter->pdev, reg, value);
22059 +}
22060 +
22061 +
22062 +s32 e1000_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
22063 +{
22064 +       struct igb_adapter *adapter = hw->back;
22065 +       u16 cap_offset;
22066 +
22067 +       cap_offset = pci_find_capability(adapter->pdev, PCI_CAP_ID_EXP);
22068 +       if (!cap_offset)
22069 +               return -E1000_ERR_CONFIG;
22070 +
22071 +       pci_read_config_word(adapter->pdev, cap_offset + reg, value);
22072 +
22073 +       return E1000_SUCCESS;
22074 +}
22075 +
22076 +static void igb_vlan_rx_register(struct net_device *netdev,
22077 +                                 struct vlan_group *grp)
22078 +{
22079 +       struct igb_adapter *adapter = netdev_priv(netdev);
22080 +       struct e1000_hw *hw = &adapter->hw;
22081 +       u32 ctrl, rctl;
22082 +
22083 +       igb_irq_disable(adapter);
22084 +       adapter->vlgrp = grp;
22085 +
22086 +       if (grp) {
22087 +               /* enable VLAN tag insert/strip */
22088 +               ctrl = E1000_READ_REG(hw, E1000_CTRL);
22089 +               ctrl |= E1000_CTRL_VME;
22090 +               E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
22091 +
22092 +               /* Disable CFI check */
22093 +               rctl = E1000_READ_REG(hw, E1000_RCTL);
22094 +               rctl &= ~E1000_RCTL_CFIEN;
22095 +               E1000_WRITE_REG(hw, E1000_RCTL, rctl);
22096 +               igb_update_mng_vlan(adapter);
22097 +               E1000_WRITE_REG(hw, E1000_RLPML,
22098 +                               adapter->max_frame_size + VLAN_TAG_SIZE);
22099 +       } else {
22100 +               /* disable VLAN tag insert/strip */
22101 +               ctrl = E1000_READ_REG(hw, E1000_CTRL);
22102 +               ctrl &= ~E1000_CTRL_VME;
22103 +               E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
22104 +
22105 +               if (adapter->mng_vlan_id != (u16)IGB_MNG_VLAN_NONE) {
22106 +                       igb_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
22107 +                       adapter->mng_vlan_id = IGB_MNG_VLAN_NONE;
22108 +               }
22109 +               E1000_WRITE_REG(hw, E1000_RLPML,
22110 +                               adapter->max_frame_size);
22111 +       }
22112 +
22113 +       if (!test_bit(__IGB_DOWN, &adapter->state))
22114 +               igb_irq_enable(adapter);
22115 +}
22116 +
22117 +static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
22118 +{
22119 +       struct igb_adapter *adapter = netdev_priv(netdev);
22120 +       struct e1000_hw *hw = &adapter->hw;
22121 +       u32 vfta, index;
22122 +       struct net_device *v_netdev;
22123 +
22124 +       if ((hw->mng_cookie.status &
22125 +            E1000_MNG_DHCP_COOKIE_STATUS_VLAN) &&
22126 +           (vid == adapter->mng_vlan_id))
22127 +               return;
22128 +       /* add VID to filter table */
22129 +       index = (vid >> 5) & 0x7F;
22130 +       vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index);
22131 +       vfta |= (1 << (vid & 0x1F));
22132 +       e1000_write_vfta(hw, index, vfta);
22133 +       /* Copy feature flags from netdev to the vlan netdev for this vid.
22134 +        * This allows things like TSO to bubble down to our vlan device.
22135 +        */
22136 +       v_netdev = vlan_group_get_device(adapter->vlgrp, vid);
22137 +       v_netdev->features |= adapter->netdev->features;
22138 +       vlan_group_set_device(adapter->vlgrp, vid, v_netdev);
22139 +}
22140 +
22141 +static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
22142 +{
22143 +       struct igb_adapter *adapter = netdev_priv(netdev);
22144 +       struct e1000_hw *hw = &adapter->hw;
22145 +       u32 vfta, index;
22146 +
22147 +       igb_irq_disable(adapter);
22148 +       vlan_group_set_device(adapter->vlgrp, vid, NULL);
22149 +
22150 +       if (!test_bit(__IGB_DOWN, &adapter->state))
22151 +               igb_irq_enable(adapter);
22152 +
22153 +       if ((adapter->hw.mng_cookie.status &
22154 +            E1000_MNG_DHCP_COOKIE_STATUS_VLAN) &&
22155 +           (vid == adapter->mng_vlan_id)) {
22156 +               /* release control to f/w */
22157 +               igb_release_hw_control(adapter);
22158 +               return;
22159 +       }
22160 +
22161 +       /* remove VID from filter table */
22162 +       index = (vid >> 5) & 0x7F;
22163 +       vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index);
22164 +       vfta &= ~(1 << (vid & 0x1F));
22165 +       e1000_write_vfta(hw, index, vfta);
22166 +}
22167 +
22168 +static void igb_restore_vlan(struct igb_adapter *adapter)
22169 +{
22170 +       igb_vlan_rx_register(adapter->netdev, adapter->vlgrp);
22171 +
22172 +       if (adapter->vlgrp) {
22173 +               u16 vid;
22174 +               for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
22175 +                       if (!vlan_group_get_device(adapter->vlgrp, vid))
22176 +                               continue;
22177 +                       igb_vlan_rx_add_vid(adapter->netdev, vid);
22178 +               }
22179 +       }
22180 +}
22181 +
22182 +int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx)
22183 +{
22184 +       struct e1000_mac_info *mac = &adapter->hw.mac;
22185 +
22186 +       mac->autoneg = 0;
22187 +
22188 +       /* Fiber NICs only allow 1000 gbps Full duplex */
22189 +       if ((adapter->hw.phy.media_type == e1000_media_type_fiber) &&
22190 +               spddplx != (SPEED_1000 + DUPLEX_FULL)) {
22191 +               DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
22192 +               return -EINVAL;
22193 +       }
22194 +
22195 +       switch (spddplx) {
22196 +       case SPEED_10 + DUPLEX_HALF:
22197 +               mac->forced_speed_duplex = ADVERTISE_10_HALF;
22198 +               break;
22199 +       case SPEED_10 + DUPLEX_FULL:
22200 +               mac->forced_speed_duplex = ADVERTISE_10_FULL;
22201 +               break;
22202 +       case SPEED_100 + DUPLEX_HALF:
22203 +               mac->forced_speed_duplex = ADVERTISE_100_HALF;
22204 +               break;
22205 +       case SPEED_100 + DUPLEX_FULL:
22206 +               mac->forced_speed_duplex = ADVERTISE_100_FULL;
22207 +               break;
22208 +       case SPEED_1000 + DUPLEX_FULL:
22209 +               mac->autoneg = 1;
22210 +               adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
22211 +               break;
22212 +       case SPEED_1000 + DUPLEX_HALF: /* not supported */
22213 +       default:
22214 +               DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
22215 +               return -EINVAL;
22216 +       }
22217 +       return 0;
22218 +}
22219 +
22220 +#ifdef USE_REBOOT_NOTIFIER
22221 +/* only want to do this for 2.4 kernels? */
22222 +static int igb_notify_reboot(struct notifier_block *nb, unsigned long event,
22223 +                             void *p)
22224 +{
22225 +       struct pci_dev *pdev = NULL;
22226 +
22227 +       switch (event) {
22228 +       case SYS_DOWN:
22229 +       case SYS_HALT:
22230 +       case SYS_POWER_OFF:
22231 +               while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
22232 +                       if (pci_dev_driver(pdev) == &igb_driver)
22233 +                               igb_suspend(pdev, PMSG_SUSPEND);
22234 +               }
22235 +       }
22236 +       return NOTIFY_DONE;
22237 +}
22238 +#endif
22239 +
22240 +static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
22241 +{
22242 +       struct net_device *netdev = pci_get_drvdata(pdev);
22243 +       struct igb_adapter *adapter = netdev_priv(netdev);
22244 +       struct e1000_hw *hw = &adapter->hw;
22245 +       u32 ctrl, rctl, status;
22246 +       u32 wufc = adapter->wol;
22247 +#ifdef CONFIG_PM
22248 +       int retval = 0;
22249 +#endif
22250 +
22251 +       netif_device_detach(netdev);
22252 +
22253 +       if (netif_running(netdev))
22254 +               igb_close(netdev);
22255 +
22256 +       igb_reset_interrupt_capability(adapter);
22257 +
22258 +       igb_free_queues(adapter);
22259 +
22260 +#ifdef CONFIG_PM
22261 +       retval = pci_save_state(pdev);
22262 +       if (retval)
22263 +               return retval;
22264 +#endif
22265 +
22266 +       status = E1000_READ_REG(hw, E1000_STATUS);
22267 +       if (status & E1000_STATUS_LU)
22268 +               wufc &= ~E1000_WUFC_LNKC;
22269 +
22270 +       if (wufc) {
22271 +               igb_setup_rctl(adapter);
22272 +               igb_set_multi(netdev);
22273 +
22274 +               /* turn on all-multi mode if wake on multicast is enabled */
22275 +               if (wufc & E1000_WUFC_MC) {
22276 +                       rctl = E1000_READ_REG(hw, E1000_RCTL);
22277 +                       rctl |= E1000_RCTL_MPE;
22278 +                       E1000_WRITE_REG(hw, E1000_RCTL, rctl);
22279 +               }
22280 +
22281 +               ctrl = E1000_READ_REG(hw, E1000_CTRL);
22282 +               /* advertise wake from D3Cold */
22283 +               #define E1000_CTRL_ADVD3WUC 0x00100000
22284 +               /* phy power management enable */
22285 +               #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000
22286 +               ctrl |= E1000_CTRL_ADVD3WUC;
22287 +               E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
22288 +
22289 +               /* Allow time for pending master requests to run */
22290 +               e1000_disable_pcie_master(hw);
22291 +
22292 +               E1000_WRITE_REG(hw, E1000_WUC, E1000_WUC_PME_EN);
22293 +               E1000_WRITE_REG(hw, E1000_WUFC, wufc);
22294 +       } else {
22295 +               E1000_WRITE_REG(hw, E1000_WUC, 0);
22296 +               E1000_WRITE_REG(hw, E1000_WUFC, 0);
22297 +       }
22298 +
22299 +       /* make sure adapter isn't asleep if manageability/wol is enabled */
22300 +       if (wufc || adapter->en_mng_pt) {
22301 +               pci_enable_wake(pdev, PCI_D3hot, 1);
22302 +               pci_enable_wake(pdev, PCI_D3cold, 1);
22303 +       } else {
22304 +               e1000_shutdown_fiber_serdes_link(hw);
22305 +               pci_enable_wake(pdev, PCI_D3hot, 0);
22306 +               pci_enable_wake(pdev, PCI_D3cold, 0);
22307 +       }
22308 +
22309 +       /* Release control of h/w to f/w.  If f/w is AMT enabled, this
22310 +        * would have already happened in close and is redundant. */
22311 +       igb_release_hw_control(adapter);
22312 +
22313 +       pci_disable_device(pdev);
22314 +
22315 +       pci_set_power_state(pdev, pci_choose_state(pdev, state));
22316 +
22317 +       return 0;
22318 +}
22319 +
22320 +#ifdef CONFIG_PM
22321 +static int igb_resume(struct pci_dev *pdev)
22322 +{
22323 +       struct net_device *netdev = pci_get_drvdata(pdev);
22324 +       struct igb_adapter *adapter = netdev_priv(netdev);
22325 +       struct e1000_hw *hw = &adapter->hw;
22326 +       u32 err;
22327 +
22328 +       pci_set_power_state(pdev, PCI_D0);
22329 +       pci_restore_state(pdev);
22330 +       err = pci_enable_device(pdev);
22331 +       if (err) {
22332 +               dev_err(&pdev->dev, "igb: Cannot enable PCI device "
22333 +                       "from suspend\n");
22334 +               return err;
22335 +       }
22336 +       pci_set_master(pdev);
22337 +
22338 +       pci_enable_wake(pdev, PCI_D3hot, 0);
22339 +       pci_enable_wake(pdev, PCI_D3cold, 0);
22340 +
22341 +       igb_set_interrupt_capability(adapter);
22342 +
22343 +       if (igb_alloc_queues(adapter)) {
22344 +               DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n");
22345 +               return -ENOMEM;
22346 +       }
22347 +
22348 +       /* e1000_power_up_phy(adapter); */
22349 +
22350 +       igb_reset(adapter);
22351 +       E1000_WRITE_REG(hw, E1000_WUS, ~0);
22352 +
22353 +       if (netif_running(netdev)) {
22354 +               err = igb_open(netdev);
22355 +               if (err)
22356 +                       return err;
22357 +       }
22358 +
22359 +       netif_device_attach(netdev);
22360 +
22361 +       return 0;
22362 +}
22363 +#endif
22364 +
22365 +#ifndef USE_REBOOT_NOTIFIER
22366 +static void igb_shutdown(struct pci_dev *pdev)
22367 +{
22368 +       igb_suspend(pdev, PMSG_SUSPEND);
22369 +}
22370 +#endif
22371 +
22372 +#ifdef CONFIG_NET_POLL_CONTROLLER
22373 +/*
22374 + * Polling 'interrupt' - used by things like netconsole to send skbs
22375 + * without having to re-enable interrupts. It's not called while
22376 + * the interrupt routine is executing.
22377 + */
22378 +static void igb_netpoll(struct net_device *netdev)
22379 +{
22380 +       struct igb_adapter *adapter = netdev_priv(netdev);
22381 +       int i;
22382 +       int work_done = 0;
22383 +
22384 +       igb_irq_disable(adapter);
22385 +       adapter->flags |= IGB_FLAG_IN_NETPOLL;
22386 +
22387 +#ifndef CONFIG_IGB_SEPARATE_TX_HANDLER
22388 +       for (i = 0; i < adapter->num_tx_queues; i++) {
22389 +               igb_clean_tx_irq(&adapter->tx_ring[i]);
22390 +       }
22391 +#endif
22392 +
22393 +       for (i = 0; i < adapter->num_rx_queues; i++) {
22394 +               igb_clean_rx_irq_adv(&adapter->rx_ring[i],
22395 +                                    &work_done,
22396 +                                    adapter->rx_ring[i].napi.weight);
22397 +       }
22398 +       adapter->flags &= ~IGB_FLAG_IN_NETPOLL;
22399 +       igb_irq_enable(adapter);
22400 +}
22401 +#endif /* CONFIG_NET_POLL_CONTROLLER */
22402 +
22403 +#ifdef HAVE_PCI_ERS
22404 +/**
22405 + * igb_io_error_detected - called when PCI error is detected
22406 + * @pdev: Pointer to PCI device
22407 + * @state: The current pci connection state
22408 + *
22409 + * This function is called after a PCI bus error affecting
22410 + * this device has been detected.
22411 + */
22412 +static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
22413 +                                              pci_channel_state_t state)
22414 +{
22415 +       struct net_device *netdev = pci_get_drvdata(pdev);
22416 +       struct igb_adapter *adapter = netdev_priv(netdev);
22417 +
22418 +       netif_device_detach(netdev);
22419 +
22420 +       if (netif_running(netdev))
22421 +               igb_down(adapter);
22422 +       pci_disable_device(pdev);
22423 +
22424 +       /* Request a slot slot reset. */
22425 +       return PCI_ERS_RESULT_NEED_RESET;
22426 +}
22427 +
22428 +/**
22429 + * igb_io_slot_reset - called after the pci bus has been reset.
22430 + * @pdev: Pointer to PCI device
22431 + *
22432 + * Restart the card from scratch, as if from a cold-boot. Implementation
22433 + * resembles the first-half of the igb_resume routine.
22434 + */
22435 +static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
22436 +{
22437 +       struct net_device *netdev = pci_get_drvdata(pdev);
22438 +       struct igb_adapter *adapter = netdev_priv(netdev);
22439 +       struct e1000_hw *hw = &adapter->hw;
22440 +
22441 +       if (pci_enable_device(pdev)) {
22442 +               dev_err(&pdev->dev,
22443 +                       "Cannot re-enable PCI device after reset.\n");
22444 +               return PCI_ERS_RESULT_DISCONNECT;
22445 +       }
22446 +       pci_set_master(pdev);
22447 +       pci_restore_state(pdev);
22448 +
22449 +       pci_enable_wake(pdev, PCI_D3hot, 0);
22450 +       pci_enable_wake(pdev, PCI_D3cold, 0);
22451 +
22452 +       igb_reset(adapter);
22453 +       E1000_WRITE_REG(hw, E1000_WUS, ~0);
22454 +
22455 +       return PCI_ERS_RESULT_RECOVERED;
22456 +}
22457 +
22458 +/**
22459 + * igb_io_resume - called when traffic can start flowing again.
22460 + * @pdev: Pointer to PCI device
22461 + *
22462 + * This callback is called when the error recovery driver tells us that
22463 + * its OK to resume normal operation. Implementation resembles the
22464 + * second-half of the igb_resume routine.
22465 + */
22466 +static void igb_io_resume(struct pci_dev *pdev)
22467 +{
22468 +       struct net_device *netdev = pci_get_drvdata(pdev);
22469 +       struct igb_adapter *adapter = netdev_priv(netdev);
22470 +
22471 +       if (netif_running(netdev)) {
22472 +               if (igb_up(adapter)) {
22473 +                       dev_err(&pdev->dev, "igb_up failed after reset\n");
22474 +                       return;
22475 +               }
22476 +       }
22477 +
22478 +       netif_device_attach(netdev);
22479 +
22480 +       /* let the f/w know that the h/w is now under the control of the
22481 +        * driver. */
22482 +       igb_get_hw_control(adapter);
22483 +
22484 +}
22485 +#endif /* HAVE_PCI_ERS */
22486 +
22487 +
22488 +/* igb_main.c */
22489 Binary files vanilla/drivers/net/igb/igb_main.o and linux-i686-2.6.22/drivers/net/igb/igb_main.o differ
22490 diff -Nru vanilla/drivers/net/igb/.igb_main.o.cmd linux-i686-2.6.22/drivers/net/igb/.igb_main.o.cmd
22491 --- vanilla/drivers/net/igb/.igb_main.o.cmd     1969-12-31 19:00:00.000000000 -0500
22492 +++ linux-i686-2.6.22/drivers/net/igb/.igb_main.o.cmd   2009-07-16 19:52:20.000000000 -0400
22493 @@ -0,0 +1,585 @@
22494 +cmd_drivers/net/igb/igb_main.o := gcc -m32 -Wp,-MD,drivers/net/igb/.igb_main.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(igb_main)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_igb_main.o drivers/net/igb/igb_main.c
22495 +
22496 +deps_drivers/net/igb/igb_main.o := \
22497 +  drivers/net/igb/igb_main.c \
22498 +    $(wildcard include/config/igb/separate/tx/handler.h) \
22499 +    $(wildcard include/config/pm.h) \
22500 +    $(wildcard include/config/net/poll/controller.h) \
22501 +    $(wildcard include/config/netdevices/multiqueue.h) \
22502 +    $(wildcard include/config/igb/disable/packet/split.h) \
22503 +  include/linux/module.h \
22504 +    $(wildcard include/config/modules.h) \
22505 +    $(wildcard include/config/modversions.h) \
22506 +    $(wildcard include/config/unused/symbols.h) \
22507 +    $(wildcard include/config/generic/bug.h) \
22508 +    $(wildcard include/config/module/unload.h) \
22509 +    $(wildcard include/config/kallsyms.h) \
22510 +    $(wildcard include/config/sysfs.h) \
22511 +  include/linux/spinlock.h \
22512 +    $(wildcard include/config/smp.h) \
22513 +    $(wildcard include/config/debug/spinlock.h) \
22514 +    $(wildcard include/config/preempt.h) \
22515 +    $(wildcard include/config/debug/lock/alloc.h) \
22516 +  include/linux/preempt.h \
22517 +    $(wildcard include/config/debug/preempt.h) \
22518 +  include/linux/thread_info.h \
22519 +  include/linux/types.h \
22520 +    $(wildcard include/config/uid16.h) \
22521 +    $(wildcard include/config/lbd.h) \
22522 +    $(wildcard include/config/lsf.h) \
22523 +    $(wildcard include/config/resources/64bit.h) \
22524 +  include/linux/posix_types.h \
22525 +  include/linux/stddef.h \
22526 +  include/linux/compiler.h \
22527 +    $(wildcard include/config/enable/must/check.h) \
22528 +  include/linux/compiler-gcc4.h \
22529 +    $(wildcard include/config/forced/inlining.h) \
22530 +  include/linux/compiler-gcc.h \
22531 +  include/asm/posix_types.h \
22532 +  include/asm/types.h \
22533 +    $(wildcard include/config/highmem64g.h) \
22534 +  include/linux/bitops.h \
22535 +  include/asm/bitops.h \
22536 +  include/asm/alternative.h \
22537 +    $(wildcard include/config/paravirt.h) \
22538 +  include/asm-generic/bitops/sched.h \
22539 +  include/asm-generic/bitops/hweight.h \
22540 +  include/asm-generic/bitops/fls64.h \
22541 +  include/asm-generic/bitops/ext2-non-atomic.h \
22542 +  include/asm-generic/bitops/le.h \
22543 +  include/asm/byteorder.h \
22544 +    $(wildcard include/config/x86/bswap.h) \
22545 +  include/linux/byteorder/little_endian.h \
22546 +  include/linux/byteorder/swab.h \
22547 +  include/linux/byteorder/generic.h \
22548 +  include/asm-generic/bitops/minix.h \
22549 +  include/asm/thread_info.h \
22550 +    $(wildcard include/config/4kstacks.h) \
22551 +    $(wildcard include/config/debug/stack/usage.h) \
22552 +  include/asm/page.h \
22553 +    $(wildcard include/config/x86/use/3dnow.h) \
22554 +    $(wildcard include/config/x86/pae.h) \
22555 +    $(wildcard include/config/hugetlb/page.h) \
22556 +    $(wildcard include/config/highmem4g.h) \
22557 +    $(wildcard include/config/page/offset.h) \
22558 +    $(wildcard include/config/flatmem.h) \
22559 +  include/asm-generic/pgtable-nopmd.h \
22560 +  include/asm-generic/pgtable-nopud.h \
22561 +  include/asm-generic/memory_model.h \
22562 +    $(wildcard include/config/discontigmem.h) \
22563 +    $(wildcard include/config/sparsemem.h) \
22564 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
22565 +  include/asm-generic/page.h \
22566 +  include/asm/processor.h \
22567 +    $(wildcard include/config/x86/ht.h) \
22568 +    $(wildcard include/config/mk8.h) \
22569 +    $(wildcard include/config/mk7.h) \
22570 +  include/asm/vm86.h \
22571 +    $(wildcard include/config/vm86.h) \
22572 +  include/asm/ptrace.h \
22573 +  include/asm/ptrace-abi.h \
22574 +  include/asm/segment.h \
22575 +  include/asm/math_emu.h \
22576 +  include/asm/sigcontext.h \
22577 +  include/asm/cpufeature.h \
22578 +  include/asm/required-features.h \
22579 +    $(wildcard include/config/x86/minimum/cpu.h) \
22580 +    $(wildcard include/config/x86/cmov.h) \
22581 +    $(wildcard include/config/x86/cmpxchg64.h) \
22582 +  include/asm/msr.h \
22583 +  include/asm/msr-index.h \
22584 +  include/asm/errno.h \
22585 +  include/asm-generic/errno.h \
22586 +  include/asm-generic/errno-base.h \
22587 +  include/linux/errno.h \
22588 +  include/asm/system.h \
22589 +    $(wildcard include/config/x86/oostore.h) \
22590 +  include/linux/kernel.h \
22591 +    $(wildcard include/config/preempt/voluntary.h) \
22592 +    $(wildcard include/config/debug/spinlock/sleep.h) \
22593 +    $(wildcard include/config/printk.h) \
22594 +    $(wildcard include/config/numa.h) \
22595 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
22596 +  include/linux/linkage.h \
22597 +  include/asm/linkage.h \
22598 +    $(wildcard include/config/x86/alignment/16.h) \
22599 +  include/linux/log2.h \
22600 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
22601 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
22602 +  include/asm/bug.h \
22603 +    $(wildcard include/config/bug.h) \
22604 +    $(wildcard include/config/debug/bugverbose.h) \
22605 +  include/asm-generic/bug.h \
22606 +  include/asm/cmpxchg.h \
22607 +    $(wildcard include/config/x86/cmpxchg.h) \
22608 +  include/linux/irqflags.h \
22609 +    $(wildcard include/config/trace/irqflags.h) \
22610 +    $(wildcard include/config/trace/irqflags/support.h) \
22611 +    $(wildcard include/config/x86.h) \
22612 +  include/asm/irqflags.h \
22613 +  include/asm/processor-flags.h \
22614 +  include/linux/cache.h \
22615 +  include/asm/cache.h \
22616 +    $(wildcard include/config/x86/l1/cache/shift.h) \
22617 +  include/linux/threads.h \
22618 +    $(wildcard include/config/nr/cpus.h) \
22619 +    $(wildcard include/config/base/small.h) \
22620 +  include/asm/percpu.h \
22621 +  include/linux/cpumask.h \
22622 +    $(wildcard include/config/hotplug/cpu.h) \
22623 +  include/linux/bitmap.h \
22624 +  include/linux/string.h \
22625 +  include/asm/string.h \
22626 +  include/linux/init.h \
22627 +    $(wildcard include/config/hotplug.h) \
22628 +    $(wildcard include/config/memory/hotplug.h) \
22629 +    $(wildcard include/config/acpi/hotplug/memory.h) \
22630 +  include/linux/stringify.h \
22631 +  include/linux/bottom_half.h \
22632 +  include/linux/spinlock_types.h \
22633 +  include/linux/lockdep.h \
22634 +    $(wildcard include/config/lockdep.h) \
22635 +    $(wildcard include/config/generic/hardirqs.h) \
22636 +    $(wildcard include/config/prove/locking.h) \
22637 +  include/asm/spinlock_types.h \
22638 +  include/asm/spinlock.h \
22639 +    $(wildcard include/config/x86/ppro/fence.h) \
22640 +  include/asm/atomic.h \
22641 +    $(wildcard include/config/m386.h) \
22642 +  include/asm-generic/atomic.h \
22643 +  include/asm/rwlock.h \
22644 +  include/linux/spinlock_api_smp.h \
22645 +  include/linux/list.h \
22646 +    $(wildcard include/config/debug/list.h) \
22647 +  include/linux/poison.h \
22648 +  include/linux/prefetch.h \
22649 +  include/linux/stat.h \
22650 +  include/asm/stat.h \
22651 +  include/linux/time.h \
22652 +  include/linux/seqlock.h \
22653 +  include/linux/vs_time.h \
22654 +    $(wildcard include/config/vserver/vtime.h) \
22655 +  include/linux/kmod.h \
22656 +    $(wildcard include/config/kmod.h) \
22657 +  include/linux/elf.h \
22658 +  include/linux/auxvec.h \
22659 +  include/asm/auxvec.h \
22660 +  include/linux/elf-em.h \
22661 +  include/asm/elf.h \
22662 +  include/asm/user.h \
22663 +  include/asm/desc.h \
22664 +  include/asm/ldt.h \
22665 +  include/linux/smp.h \
22666 +  include/asm/smp.h \
22667 +    $(wildcard include/config/x86/local/apic.h) \
22668 +    $(wildcard include/config/x86/io/apic.h) \
22669 +  include/asm/mpspec.h \
22670 +    $(wildcard include/config/acpi.h) \
22671 +  include/asm/mpspec_def.h \
22672 +  include/asm-i386/mach-generic/mach_mpspec.h \
22673 +  include/asm/apic.h \
22674 +    $(wildcard include/config/x86/good/apic.h) \
22675 +  include/linux/pm.h \
22676 +  include/linux/delay.h \
22677 +  include/asm/delay.h \
22678 +  include/asm/fixmap.h \
22679 +    $(wildcard include/config/highmem.h) \
22680 +    $(wildcard include/config/x86/visws/apic.h) \
22681 +    $(wildcard include/config/x86/f00f/bug.h) \
22682 +    $(wildcard include/config/x86/cyclone/timer.h) \
22683 +    $(wildcard include/config/pci/mmconfig.h) \
22684 +  include/asm/acpi.h \
22685 +    $(wildcard include/config/acpi/sleep.h) \
22686 +  include/acpi/pdc_intel.h \
22687 +  include/asm/apicdef.h \
22688 +  include/asm/kmap_types.h \
22689 +    $(wildcard include/config/debug/highmem.h) \
22690 +  include/asm/io_apic.h \
22691 +  include/asm-i386/mach-generic/mach_apicdef.h \
22692 +  include/asm/genapic.h \
22693 +  include/linux/percpu.h \
22694 +  include/linux/slab.h \
22695 +    $(wildcard include/config/slab/debug.h) \
22696 +    $(wildcard include/config/slab.h) \
22697 +    $(wildcard include/config/slub.h) \
22698 +    $(wildcard include/config/debug/slab.h) \
22699 +  include/linux/gfp.h \
22700 +    $(wildcard include/config/zone/dma.h) \
22701 +    $(wildcard include/config/zone/dma32.h) \
22702 +  include/linux/mmzone.h \
22703 +    $(wildcard include/config/force/max/zoneorder.h) \
22704 +    $(wildcard include/config/arch/populates/node/map.h) \
22705 +    $(wildcard include/config/flat/node/mem/map.h) \
22706 +    $(wildcard include/config/have/memory/present.h) \
22707 +    $(wildcard include/config/need/node/memmap/size.h) \
22708 +    $(wildcard include/config/need/multiple/nodes.h) \
22709 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
22710 +    $(wildcard include/config/sparsemem/extreme.h) \
22711 +    $(wildcard include/config/nodes/span/other/nodes.h) \
22712 +    $(wildcard include/config/holes/in/zone.h) \
22713 +  include/linux/wait.h \
22714 +  include/asm/current.h \
22715 +  include/linux/numa.h \
22716 +    $(wildcard include/config/nodes/shift.h) \
22717 +  include/linux/nodemask.h \
22718 +  include/linux/memory_hotplug.h \
22719 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
22720 +  include/linux/notifier.h \
22721 +  include/linux/mutex.h \
22722 +    $(wildcard include/config/debug/mutexes.h) \
22723 +    $(wildcard include/config/chopstix.h) \
22724 +  include/linux/rwsem.h \
22725 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
22726 +  include/asm/rwsem.h \
22727 +  include/linux/srcu.h \
22728 +  include/linux/topology.h \
22729 +    $(wildcard include/config/sched/smt.h) \
22730 +    $(wildcard include/config/sched/mc.h) \
22731 +  include/asm/topology.h \
22732 +  include/asm-generic/topology.h \
22733 +  include/linux/slab_def.h \
22734 +  include/linux/kmalloc_sizes.h \
22735 +  include/asm/mmu.h \
22736 +  include/asm/semaphore.h \
22737 +  include/linux/kobject.h \
22738 +  include/linux/sysfs.h \
22739 +  include/linux/kref.h \
22740 +  include/linux/moduleparam.h \
22741 +  include/asm/local.h \
22742 +  include/asm/module.h \
22743 +    $(wildcard include/config/m486.h) \
22744 +    $(wildcard include/config/m586.h) \
22745 +    $(wildcard include/config/m586tsc.h) \
22746 +    $(wildcard include/config/m586mmx.h) \
22747 +    $(wildcard include/config/mcore2.h) \
22748 +    $(wildcard include/config/m686.h) \
22749 +    $(wildcard include/config/mpentiumii.h) \
22750 +    $(wildcard include/config/mpentiumiii.h) \
22751 +    $(wildcard include/config/mpentiumm.h) \
22752 +    $(wildcard include/config/mpentium4.h) \
22753 +    $(wildcard include/config/mk6.h) \
22754 +    $(wildcard include/config/x86/elan.h) \
22755 +    $(wildcard include/config/mcrusoe.h) \
22756 +    $(wildcard include/config/mefficeon.h) \
22757 +    $(wildcard include/config/mwinchipc6.h) \
22758 +    $(wildcard include/config/mwinchip2.h) \
22759 +    $(wildcard include/config/mwinchip3d.h) \
22760 +    $(wildcard include/config/mcyrixiii.h) \
22761 +    $(wildcard include/config/mviac3/2.h) \
22762 +    $(wildcard include/config/mviac7.h) \
22763 +    $(wildcard include/config/mgeodegx1.h) \
22764 +    $(wildcard include/config/mgeode/lx.h) \
22765 +  include/linux/vmalloc.h \
22766 +  include/linux/pagemap.h \
22767 +  include/linux/mm.h \
22768 +    $(wildcard include/config/sysctl.h) \
22769 +    $(wildcard include/config/mmu.h) \
22770 +    $(wildcard include/config/stack/growsup.h) \
22771 +    $(wildcard include/config/debug/vm.h) \
22772 +    $(wildcard include/config/shmem.h) \
22773 +    $(wildcard include/config/split/ptlock/cpus.h) \
22774 +    $(wildcard include/config/ia64.h) \
22775 +    $(wildcard include/config/proc/fs.h) \
22776 +    $(wildcard include/config/debug/pagealloc.h) \
22777 +  include/linux/capability.h \
22778 +  include/linux/rbtree.h \
22779 +  include/linux/prio_tree.h \
22780 +  include/linux/fs.h \
22781 +    $(wildcard include/config/dnotify.h) \
22782 +    $(wildcard include/config/vserver/cowbl.h) \
22783 +    $(wildcard include/config/quota.h) \
22784 +    $(wildcard include/config/inotify.h) \
22785 +    $(wildcard include/config/security.h) \
22786 +    $(wildcard include/config/epoll.h) \
22787 +    $(wildcard include/config/auditsyscall.h) \
22788 +    $(wildcard include/config/block.h) \
22789 +    $(wildcard include/config/fs/xip.h) \
22790 +    $(wildcard include/config/migration.h) \
22791 +  include/linux/limits.h \
22792 +  include/linux/ioctl.h \
22793 +  include/asm/ioctl.h \
22794 +  include/asm-generic/ioctl.h \
22795 +  include/linux/kdev_t.h \
22796 +  include/linux/dcache.h \
22797 +    $(wildcard include/config/profiling.h) \
22798 +  include/linux/rcupdate.h \
22799 +  include/linux/namei.h \
22800 +  include/linux/radix-tree.h \
22801 +  include/linux/pid.h \
22802 +  include/linux/quota.h \
22803 +  include/linux/dqblk_xfs.h \
22804 +  include/linux/dqblk_v1.h \
22805 +  include/linux/dqblk_v2.h \
22806 +  include/linux/nfs_fs_i.h \
22807 +  include/linux/nfs.h \
22808 +  include/linux/sunrpc/msg_prot.h \
22809 +  include/linux/fcntl.h \
22810 +  include/asm/fcntl.h \
22811 +  include/asm-generic/fcntl.h \
22812 +    $(wildcard include/config/64bit.h) \
22813 +  include/linux/err.h \
22814 +  include/linux/debug_locks.h \
22815 +    $(wildcard include/config/debug/locking/api/selftests.h) \
22816 +  include/linux/backing-dev.h \
22817 +  include/linux/mm_types.h \
22818 +  include/asm/pgtable.h \
22819 +    $(wildcard include/config/highpte.h) \
22820 +  include/asm/paravirt.h \
22821 +  include/asm/pgtable-2level-defs.h \
22822 +  include/asm/pgtable-2level.h \
22823 +  include/asm-generic/pgtable.h \
22824 +  include/linux/page-flags.h \
22825 +    $(wildcard include/config/s390.h) \
22826 +    $(wildcard include/config/swap.h) \
22827 +  include/linux/vmstat.h \
22828 +    $(wildcard include/config/vm/event/counters.h) \
22829 +  include/linux/highmem.h \
22830 +  include/linux/uaccess.h \
22831 +  include/asm/uaccess.h \
22832 +    $(wildcard include/config/x86/intel/usercopy.h) \
22833 +    $(wildcard include/config/x86/wp/works/ok.h) \
22834 +  include/asm/cacheflush.h \
22835 +    $(wildcard include/config/debug/rodata.h) \
22836 +  include/asm/highmem.h \
22837 +  include/linux/interrupt.h \
22838 +    $(wildcard include/config/high/res/timers.h) \
22839 +    $(wildcard include/config/generic/irq/probe.h) \
22840 +  include/linux/irqreturn.h \
22841 +  include/linux/hardirq.h \
22842 +    $(wildcard include/config/preempt/bkl.h) \
22843 +    $(wildcard include/config/virt/cpu/accounting.h) \
22844 +  include/linux/smp_lock.h \
22845 +    $(wildcard include/config/lock/kernel.h) \
22846 +  include/linux/sched.h \
22847 +    $(wildcard include/config/no/hz.h) \
22848 +    $(wildcard include/config/detect/softlockup.h) \
22849 +    $(wildcard include/config/keys.h) \
22850 +    $(wildcard include/config/bsd/process/acct.h) \
22851 +    $(wildcard include/config/taskstats.h) \
22852 +    $(wildcard include/config/inotify/user.h) \
22853 +    $(wildcard include/config/schedstats.h) \
22854 +    $(wildcard include/config/task/delay/acct.h) \
22855 +    $(wildcard include/config/blk/dev/io/trace.h) \
22856 +    $(wildcard include/config/cc/stackprotector.h) \
22857 +    $(wildcard include/config/sysvipc.h) \
22858 +    $(wildcard include/config/rt/mutexes.h) \
22859 +    $(wildcard include/config/task/xacct.h) \
22860 +    $(wildcard include/config/cpusets.h) \
22861 +    $(wildcard include/config/compat.h) \
22862 +    $(wildcard include/config/fault/injection.h) \
22863 +  include/asm/param.h \
22864 +    $(wildcard include/config/hz.h) \
22865 +  include/linux/timex.h \
22866 +    $(wildcard include/config/time/interpolation.h) \
22867 +  include/asm/timex.h \
22868 +  include/asm/tsc.h \
22869 +    $(wildcard include/config/x86/tsc.h) \
22870 +    $(wildcard include/config/x86/generic.h) \
22871 +  include/linux/jiffies.h \
22872 +  include/linux/calc64.h \
22873 +  include/asm/div64.h \
22874 +  include/asm/cputime.h \
22875 +  include/asm-generic/cputime.h \
22876 +  include/linux/sem.h \
22877 +  include/linux/ipc.h \
22878 +    $(wildcard include/config/ipc/ns.h) \
22879 +  include/asm/ipcbuf.h \
22880 +  include/asm/sembuf.h \
22881 +  include/linux/signal.h \
22882 +  include/asm/signal.h \
22883 +  include/asm-generic/signal.h \
22884 +  include/asm/siginfo.h \
22885 +  include/asm-generic/siginfo.h \
22886 +  include/linux/securebits.h \
22887 +  include/linux/fs_struct.h \
22888 +  include/linux/completion.h \
22889 +  include/linux/seccomp.h \
22890 +    $(wildcard include/config/seccomp.h) \
22891 +  include/linux/futex.h \
22892 +    $(wildcard include/config/futex.h) \
22893 +  include/linux/rtmutex.h \
22894 +    $(wildcard include/config/debug/rt/mutexes.h) \
22895 +  include/linux/plist.h \
22896 +    $(wildcard include/config/debug/pi/list.h) \
22897 +  include/linux/param.h \
22898 +  include/linux/resource.h \
22899 +  include/asm/resource.h \
22900 +  include/asm-generic/resource.h \
22901 +  include/linux/timer.h \
22902 +    $(wildcard include/config/timer/stats.h) \
22903 +  include/linux/ktime.h \
22904 +    $(wildcard include/config/ktime/scalar.h) \
22905 +  include/linux/hrtimer.h \
22906 +  include/linux/task_io_accounting.h \
22907 +    $(wildcard include/config/task/io/accounting.h) \
22908 +  include/linux/aio.h \
22909 +  include/linux/workqueue.h \
22910 +  include/linux/aio_abi.h \
22911 +  include/linux/uio.h \
22912 +  include/asm/hardirq.h \
22913 +  include/linux/irq.h \
22914 +    $(wildcard include/config/irq/per/cpu.h) \
22915 +    $(wildcard include/config/irq/release/method.h) \
22916 +    $(wildcard include/config/generic/pending/irq.h) \
22917 +    $(wildcard include/config/irqbalance.h) \
22918 +    $(wildcard include/config/auto/irq/affinity.h) \
22919 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
22920 +  include/asm/irq.h \
22921 +  include/asm-i386/mach-default/irq_vectors.h \
22922 +  include/asm-i386/mach-default/irq_vectors_limits.h \
22923 +  include/asm/irq_regs.h \
22924 +  include/asm/hw_irq.h \
22925 +  include/linux/profile.h \
22926 +  include/asm/sections.h \
22927 +  include/asm-generic/sections.h \
22928 +  include/linux/irq_cpustat.h \
22929 +  include/linux/device.h \
22930 +    $(wildcard include/config/debug/devres.h) \
22931 +  include/linux/ioport.h \
22932 +  include/linux/klist.h \
22933 +  include/asm/device.h \
22934 +  include/asm/tlbflush.h \
22935 +    $(wildcard include/config/x86/invlpg.h) \
22936 +  include/linux/netdevice.h \
22937 +    $(wildcard include/config/ax25.h) \
22938 +    $(wildcard include/config/tr.h) \
22939 +    $(wildcard include/config/net/ipip.h) \
22940 +    $(wildcard include/config/net/ipgre.h) \
22941 +    $(wildcard include/config/ipv6/sit.h) \
22942 +    $(wildcard include/config/ipv6/tunnel.h) \
22943 +    $(wildcard include/config/wireless/ext.h) \
22944 +    $(wildcard include/config/netpoll.h) \
22945 +    $(wildcard include/config/netpoll/trap.h) \
22946 +    $(wildcard include/config/net/dma.h) \
22947 +  include/linux/if.h \
22948 +  include/linux/socket.h \
22949 +  include/asm/socket.h \
22950 +  include/asm/sockios.h \
22951 +  include/linux/sockios.h \
22952 +  include/linux/hdlc/ioctl.h \
22953 +  include/linux/if_ether.h \
22954 +  include/linux/skbuff.h \
22955 +    $(wildcard include/config/nf/conntrack.h) \
22956 +    $(wildcard include/config/bridge/netfilter.h) \
22957 +    $(wildcard include/config/vlan/8021q.h) \
22958 +    $(wildcard include/config/net/sched.h) \
22959 +    $(wildcard include/config/net/cls/act.h) \
22960 +    $(wildcard include/config/network/secmark.h) \
22961 +  include/linux/net.h \
22962 +  include/linux/random.h \
22963 +  include/linux/sysctl.h \
22964 +    $(wildcard include/config/icmp/ipod.h) \
22965 +    $(wildcard include/config/web100/net100.h) \
22966 +    $(wildcard include/config/web100/stats.h) \
22967 +  include/linux/textsearch.h \
22968 +  include/net/checksum.h \
22969 +  include/asm/checksum.h \
22970 +  include/linux/in6.h \
22971 +  include/linux/dmaengine.h \
22972 +    $(wildcard include/config/dma/engine.h) \
22973 +  include/linux/if_packet.h \
22974 +  include/linux/tcp.h \
22975 +    $(wildcard include/config/tcp/md5sig.h) \
22976 +  include/net/sock.h \
22977 +    $(wildcard include/config/security/network.h) \
22978 +  include/linux/security.h \
22979 +    $(wildcard include/config/security/network/xfrm.h) \
22980 +  include/linux/binfmts.h \
22981 +  include/linux/shm.h \
22982 +  include/asm/shmparam.h \
22983 +  include/asm/shmbuf.h \
22984 +  include/linux/msg.h \
22985 +  include/asm/msgbuf.h \
22986 +  include/linux/key.h \
22987 +  include/linux/xfrm.h \
22988 +  include/net/flow.h \
22989 +    $(wildcard include/config/ipv6/mip6.h) \
22990 +  include/linux/filter.h \
22991 +  include/net/dst.h \
22992 +    $(wildcard include/config/net/cls/route.h) \
22993 +    $(wildcard include/config/xfrm.h) \
22994 +  include/linux/rtnetlink.h \
22995 +  include/linux/netlink.h \
22996 +  include/linux/if_link.h \
22997 +  include/linux/if_addr.h \
22998 +  include/linux/neighbour.h \
22999 +  include/net/neighbour.h \
23000 +  include/linux/seq_file.h \
23001 +  include/net/rtnetlink.h \
23002 +  include/net/netlink.h \
23003 +  include/net/inet_connection_sock.h \
23004 +  include/linux/poll.h \
23005 +  include/asm/poll.h \
23006 +  include/asm-generic/poll.h \
23007 +  include/net/inet_sock.h \
23008 +    $(wildcard include/config/ipv6.h) \
23009 +  include/linux/jhash.h \
23010 +  include/net/request_sock.h \
23011 +  include/net/inet_timewait_sock.h \
23012 +  include/net/tcp_states.h \
23013 +  include/net/timewait_sock.h \
23014 +  include/linux/ipv6.h \
23015 +    $(wildcard include/config/ipv6/privacy.h) \
23016 +    $(wildcard include/config/ipv6/router/pref.h) \
23017 +    $(wildcard include/config/ipv6/route/info.h) \
23018 +    $(wildcard include/config/ipv6/optimistic/dad.h) \
23019 +    $(wildcard include/config/ipv6/subtrees.h) \
23020 +  include/linux/icmpv6.h \
23021 +  include/linux/udp.h \
23022 +  include/net/if_inet6.h \
23023 +  include/net/snmp.h \
23024 +  include/linux/snmp.h \
23025 +  include/net/ip6_checksum.h \
23026 +  include/net/ip.h \
23027 +    $(wildcard include/config/inet.h) \
23028 +  include/linux/ip.h \
23029 +  include/linux/in.h \
23030 +  include/linux/mii.h \
23031 +  include/linux/ethtool.h \
23032 +  include/linux/if_vlan.h \
23033 +  include/linux/etherdevice.h \
23034 +  drivers/net/igb/igb.h \
23035 +    $(wildcard include/config/dca.h) \
23036 +    $(wildcard include/config/inet/lro.h) \
23037 +  include/linux/pci.h \
23038 +    $(wildcard include/config/pci/msi.h) \
23039 +    $(wildcard include/config/pci.h) \
23040 +    $(wildcard include/config/ht/irq.h) \
23041 +    $(wildcard include/config/pci/domains.h) \
23042 +  include/linux/pci_regs.h \
23043 +  include/linux/mod_devicetable.h \
23044 +  include/linux/pci_ids.h \
23045 +  include/linux/dmapool.h \
23046 +  include/asm/io.h \
23047 +    $(wildcard include/config/x86/numaq.h) \
23048 +  include/asm-generic/iomap.h \
23049 +  include/asm/scatterlist.h \
23050 +  include/asm/pci.h \
23051 +  include/asm-generic/pci-dma-compat.h \
23052 +  include/linux/dma-mapping.h \
23053 +  include/asm/dma-mapping.h \
23054 +  include/asm-generic/pci.h \
23055 +  drivers/net/igb/kcompat.h \
23056 +    $(wildcard include/config/e1000/napi.h) \
23057 +    $(wildcard include/config/e1000e/napi.h) \
23058 +    $(wildcard include/config/ixgb/napi.h) \
23059 +    $(wildcard include/config/e1000/disable/packet/split.h) \
23060 +    $(wildcard include/config/space/len.h) \
23061 +  include/linux/version.h \
23062 +  include/linux/latency.h \
23063 +  drivers/net/igb/e1000_api.h \
23064 +  drivers/net/igb/e1000_hw.h \
23065 +  drivers/net/igb/e1000_osdep.h \
23066 +  drivers/net/igb/e1000_regs.h \
23067 +  drivers/net/igb/e1000_defines.h \
23068 +    $(wildcard include/config/res.h) \
23069 +    $(wildcard include/config/fault.h) \
23070 +  drivers/net/igb/e1000_mac.h \
23071 +  drivers/net/igb/e1000_phy.h \
23072 +  drivers/net/igb/e1000_nvm.h \
23073 +  drivers/net/igb/e1000_manage.h \
23074 +  drivers/net/igb/e1000_82575.h \
23075 +
23076 +drivers/net/igb/igb_main.o: $(deps_drivers/net/igb/igb_main.o)
23077 +
23078 +$(deps_drivers/net/igb/igb_main.o):
23079 Binary files vanilla/drivers/net/igb/igb.o and linux-i686-2.6.22/drivers/net/igb/igb.o differ
23080 diff -Nru vanilla/drivers/net/igb/.igb.o.cmd linux-i686-2.6.22/drivers/net/igb/.igb.o.cmd
23081 --- vanilla/drivers/net/igb/.igb.o.cmd  1969-12-31 19:00:00.000000000 -0500
23082 +++ linux-i686-2.6.22/drivers/net/igb/.igb.o.cmd        2009-07-16 19:53:45.000000000 -0400
23083 @@ -0,0 +1 @@
23084 +cmd_drivers/net/igb/igb.o := ld -m elf_i386 -m elf_i386  -r -o drivers/net/igb/igb.o drivers/net/igb/e1000_82575.o drivers/net/igb/igb_main.o drivers/net/igb/e1000_mac.o drivers/net/igb/e1000_nvm.o drivers/net/igb/e1000_phy.o drivers/net/igb/e1000_manage.o drivers/net/igb/igb_param.o drivers/net/igb/igb_ethtool.o drivers/net/igb/kcompat.o drivers/net/igb/e1000_api.o
23085 diff -Nru vanilla/drivers/net/igb/igb_param.c linux-i686-2.6.22/drivers/net/igb/igb_param.c
23086 --- vanilla/drivers/net/igb/igb_param.c 1969-12-31 19:00:00.000000000 -0500
23087 +++ linux-i686-2.6.22/drivers/net/igb/igb_param.c       2009-07-16 19:25:22.000000000 -0400
23088 @@ -0,0 +1,408 @@
23089 +/*******************************************************************************
23090 +
23091 +  Intel(R) Gigabit Ethernet Linux driver
23092 +  Copyright(c) 2007-2008 Intel Corporation.
23093 +
23094 +  This program is free software; you can redistribute it and/or modify it
23095 +  under the terms and conditions of the GNU General Public License,
23096 +  version 2, as published by the Free Software Foundation.
23097 +
23098 +  This program is distributed in the hope it will be useful, but WITHOUT
23099 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23100 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
23101 +  more details.
23102 +
23103 +  You should have received a copy of the GNU General Public License along with
23104 +  this program; if not, write to the Free Software Foundation, Inc.,
23105 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23106 +
23107 +  The full GNU General Public License is included in this distribution in
23108 +  the file called "COPYING".
23109 +
23110 +  Contact Information:
23111 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
23112 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
23113 +
23114 +*******************************************************************************/
23115 +
23116 +
23117 +#include <linux/netdevice.h>
23118 +
23119 +#include "igb.h"
23120 +
23121 +/* This is the only thing that needs to be changed to adjust the
23122 + * maximum number of ports that the driver can manage.
23123 + */
23124 +
23125 +#define IGB_MAX_NIC 32
23126 +
23127 +#define OPTION_UNSET   -1
23128 +#define OPTION_DISABLED 0
23129 +#define OPTION_ENABLED  1
23130 +
23131 +/* All parameters are treated the same, as an integer array of values.
23132 + * This macro just reduces the need to repeat the same declaration code
23133 + * over and over (plus this helps to avoid typo bugs).
23134 + */
23135 +
23136 +#define IGB_PARAM_INIT { [0 ... IGB_MAX_NIC] = OPTION_UNSET }
23137 +#ifndef module_param_array
23138 +/* Module Parameters are always initialized to -1, so that the driver
23139 + * can tell the difference between no user specified value or the
23140 + * user asking for the default value.
23141 + * The true default values are loaded in when igb_check_options is called.
23142 + *
23143 + * This is a GCC extension to ANSI C.
23144 + * See the item "Labeled Elements in Initializers" in the section
23145 + * "Extensions to the C Language Family" of the GCC documentation.
23146 + */
23147 +
23148 +#define IGB_PARAM(X, desc) \
23149 +       static const int __devinitdata X[IGB_MAX_NIC+1] = IGB_PARAM_INIT; \
23150 +       MODULE_PARM(X, "1-" __MODULE_STRING(IGB_MAX_NIC) "i"); \
23151 +       MODULE_PARM_DESC(X, desc);
23152 +#else
23153 +#define IGB_PARAM(X, desc) \
23154 +       static int __devinitdata X[IGB_MAX_NIC+1] = IGB_PARAM_INIT; \
23155 +       static unsigned int num_##X = 0; \
23156 +       module_param_array_named(X, X, int, &num_##X, 0); \
23157 +       MODULE_PARM_DESC(X, desc);
23158 +#endif
23159 +
23160 +/* Interrupt Throttle Rate (interrupts/sec)
23161 + *
23162 + * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
23163 + */
23164 +IGB_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
23165 +#define DEFAULT_ITR                    3
23166 +#define MAX_ITR                   100000
23167 +#define MIN_ITR                      120
23168 +/* IntMode (Interrupt Mode)
23169 + *
23170 + * Valid Range: 0 - 3
23171 + *
23172 + * Default Value: 2 (MSI-X single queue)
23173 + */
23174 +IGB_PARAM(IntMode, "Interrupt Mode");
23175 +#define MAX_INTMODE                    3
23176 +#define MIN_INTMODE                    0
23177 +
23178 +/* LLIPort (Low Latency Interrupt TCP Port)
23179 + *
23180 + * Valid Range: 0 - 65535
23181 + *
23182 + * Default Value: 0 (disabled)
23183 + */
23184 +IGB_PARAM(LLIPort, "Low Latency Interrupt TCP Port");
23185 +
23186 +#define DEFAULT_LLIPORT                0
23187 +#define MAX_LLIPORT               0xFFFF
23188 +#define MIN_LLIPORT                    0
23189 +
23190 +/* LLIPush (Low Latency Interrupt on TCP Push flag)
23191 + *
23192 + * Valid Range: 0, 1
23193 + *
23194 + * Default Value: 0 (disabled)
23195 + */
23196 +IGB_PARAM(LLIPush, "Low Latency Interrupt on TCP Push flag");
23197 +
23198 +#define DEFAULT_LLIPUSH                0
23199 +#define MAX_LLIPUSH                    1
23200 +#define MIN_LLIPUSH                    0
23201 +
23202 +/* LLISize (Low Latency Interrupt on Packet Size)
23203 + *
23204 + * Valid Range: 0 - 1500
23205 + *
23206 + * Default Value: 0 (disabled)
23207 + */
23208 +IGB_PARAM(LLISize, "Low Latency Interrupt on Packet Size");
23209 +
23210 +#define DEFAULT_LLISIZE                0
23211 +#define MAX_LLISIZE                 1500
23212 +#define MIN_LLISIZE                    0
23213 +
23214 +#ifdef IGB_LRO
23215 +/* LROAggr (Large Receive Offload)
23216 + *
23217 + * Valid Range: 2 - 44
23218 + *
23219 + * Default Value:  32
23220 + */
23221 +IGB_PARAM(LROAggr, "LRO - Maximum packets to aggregate");
23222 +
23223 +#define DEFAULT_LRO_AGGR              32
23224 +#define MAX_LRO_AGGR                  44
23225 +#define MIN_LRO_AGGR                   2
23226 +#endif
23227 +
23228 +struct igb_option {
23229 +       enum { enable_option, range_option, list_option } type;
23230 +       const char *name;
23231 +       const char *err;
23232 +       int def;
23233 +       union {
23234 +               struct { /* range_option info */
23235 +                       int min;
23236 +                       int max;
23237 +               } r;
23238 +               struct { /* list_option info */
23239 +                       int nr;
23240 +                       struct igb_opt_list { int i; char *str; } *p;
23241 +               } l;
23242 +       } arg;
23243 +};
23244 +
23245 +static int __devinit igb_validate_option(unsigned int *value,
23246 +                                         struct igb_option *opt,
23247 +                                         struct igb_adapter *adapter)
23248 +{
23249 +       if (*value == OPTION_UNSET) {
23250 +               *value = opt->def;
23251 +               return 0;
23252 +       }
23253 +
23254 +       switch (opt->type) {
23255 +       case enable_option:
23256 +               switch (*value) {
23257 +               case OPTION_ENABLED:
23258 +                       DPRINTK(PROBE, INFO, "%s Enabled\n", opt->name);
23259 +                       return 0;
23260 +               case OPTION_DISABLED:
23261 +                       DPRINTK(PROBE, INFO, "%s Disabled\n", opt->name);
23262 +                       return 0;
23263 +               }
23264 +               break;
23265 +       case range_option:
23266 +               if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
23267 +                       DPRINTK(PROBE, INFO,
23268 +                                       "%s set to %d\n", opt->name, *value);
23269 +                       return 0;
23270 +               }
23271 +               break;
23272 +       case list_option: {
23273 +               int i;
23274 +               struct igb_opt_list *ent;
23275 +
23276 +               for (i = 0; i < opt->arg.l.nr; i++) {
23277 +                       ent = &opt->arg.l.p[i];
23278 +                       if (*value == ent->i) {
23279 +                               if (ent->str[0] != '\0')
23280 +                                       DPRINTK(PROBE, INFO, "%s\n", ent->str);
23281 +                               return 0;
23282 +                       }
23283 +               }
23284 +       }
23285 +               break;
23286 +       default:
23287 +               BUG();
23288 +       }
23289 +
23290 +       DPRINTK(PROBE, INFO, "Invalid %s value specified (%d) %s\n",
23291 +              opt->name, *value, opt->err);
23292 +       *value = opt->def;
23293 +       return -1;
23294 +}
23295 +
23296 +/**
23297 + * igb_check_options - Range Checking for Command Line Parameters
23298 + * @adapter: board private structure
23299 + *
23300 + * This routine checks all command line parameters for valid user
23301 + * input.  If an invalid value is given, or if no user specified
23302 + * value exists, a default value is used.  The final value is stored
23303 + * in a variable in the adapter structure.
23304 + **/
23305 +
23306 +void __devinit igb_check_options(struct igb_adapter *adapter)
23307 +{
23308 +       int bd = adapter->bd_number;
23309 +
23310 +       if (bd >= IGB_MAX_NIC) {
23311 +               DPRINTK(PROBE, NOTICE,
23312 +                      "Warning: no configuration for board #%d\n", bd);
23313 +               DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
23314 +#ifndef module_param_array
23315 +               bd = IGB_MAX_NIC;
23316 +#endif
23317 +       }
23318 +
23319 +       { /* Interrupt Throttling Rate */
23320 +               struct igb_option opt = {
23321 +                       .type = range_option,
23322 +                       .name = "Interrupt Throttling Rate (ints/sec)",
23323 +                       .err  = "using default of " __MODULE_STRING(DEFAULT_ITR),
23324 +                       .def  = DEFAULT_ITR,
23325 +                       .arg  = { .r = { .min = MIN_ITR,
23326 +                                        .max = MAX_ITR }}
23327 +               };
23328 +
23329 +#ifdef module_param_array
23330 +               if (num_InterruptThrottleRate > bd) {
23331 +#endif
23332 +                       adapter->itr = InterruptThrottleRate[bd];
23333 +                       switch (adapter->itr) {
23334 +                       case 0:
23335 +                               DPRINTK(PROBE, INFO, "%s turned off\n",
23336 +                                       opt.name);
23337 +                               break;
23338 +                       case 1:
23339 +                               DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
23340 +                                       opt.name);
23341 +                               adapter->itr_setting = adapter->itr;
23342 +                               adapter->itr = IGB_START_ITR;
23343 +                               break;
23344 +                       case 3:
23345 +                               DPRINTK(PROBE, INFO,
23346 +                                       "%s set to dynamic conservative mode\n",
23347 +                                       opt.name);
23348 +                               adapter->itr_setting = adapter->itr;
23349 +                               adapter->itr = IGB_START_ITR;
23350 +                               break;
23351 +                       default:
23352 +                               igb_validate_option(&adapter->itr, &opt,
23353 +                                       adapter);
23354 +                               /* save the setting, because the dynamic bits change itr */
23355 +                               /* in case of invalid user value, default to conservative mode,
23356 +                                * else need to clear the lower two bits because they are
23357 +                                * used as control */
23358 +                               if (adapter->itr == 3) {
23359 +                                       adapter->itr_setting = adapter->itr;
23360 +                                       adapter->itr = IGB_START_ITR;
23361 +                               }
23362 +                               else {
23363 +                                       adapter->itr = 1000000000 / (adapter->itr * 256);
23364 +                                       adapter->itr_setting = adapter->itr & ~3;
23365 +                               }
23366 +                               break;
23367 +                       }
23368 +#ifdef module_param_array
23369 +               } else {
23370 +                       adapter->itr_setting = opt.def;
23371 +                       adapter->itr = 8000;
23372 +               }
23373 +#endif
23374 +       }
23375 +       { /* Interrupt Mode */
23376 +               struct igb_option opt = {
23377 +                       .type = range_option,
23378 +                       .name = "Interrupt Mode",
23379 +                       .err  = "defaulting to 2 (MSI-X single queue)",
23380 +                       .def  = IGB_INT_MODE_MSIX_1Q,
23381 +                       .arg  = { .r = { .min = MIN_INTMODE,
23382 +                                        .max = MAX_INTMODE }}
23383 +               };
23384 +
23385 +#ifdef module_param_array
23386 +               if (num_IntMode > bd) {
23387 +#endif
23388 +                       unsigned int int_mode = IntMode[bd];
23389 +                       igb_validate_option(&int_mode, &opt, adapter);
23390 +                       adapter->int_mode = int_mode;
23391 +#ifdef module_param_array
23392 +               } else {
23393 +                       adapter->int_mode = opt.def;
23394 +               }
23395 +#endif
23396 +       }
23397 +       { /* Low Latency Interrupt TCP Port */
23398 +               struct igb_option opt = {
23399 +                       .type = range_option,
23400 +                       .name = "Low Latency Interrupt TCP Port",
23401 +                       .err  = "using default of " __MODULE_STRING(DEFAULT_LLIPORT),
23402 +                       .def  = DEFAULT_LLIPORT,
23403 +                       .arg  = { .r = { .min = MIN_LLIPORT,
23404 +                                        .max = MAX_LLIPORT }}
23405 +               };
23406 +
23407 +#ifdef module_param_array
23408 +               if (num_LLIPort > bd) {
23409 +#endif
23410 +                       adapter->lli_port = LLIPort[bd];
23411 +                       if (adapter->lli_port) {
23412 +                               igb_validate_option(&adapter->lli_port, &opt,
23413 +                                       adapter);
23414 +                       } else {
23415 +                               DPRINTK(PROBE, INFO, "%s turned off\n",
23416 +                                       opt.name);
23417 +                       }
23418 +#ifdef module_param_array
23419 +               } else {
23420 +                       adapter->lli_port = opt.def;
23421 +               }
23422 +#endif
23423 +       }
23424 +       { /* Low Latency Interrupt on Packet Size */
23425 +               struct igb_option opt = {
23426 +                       .type = range_option,
23427 +                       .name = "Low Latency Interrupt on Packet Size",
23428 +                       .err  = "using default of " __MODULE_STRING(DEFAULT_LLISIZE),
23429 +                       .def  = DEFAULT_LLISIZE,
23430 +                       .arg  = { .r = { .min = MIN_LLISIZE,
23431 +                                        .max = MAX_LLISIZE }}
23432 +               };
23433 +
23434 +#ifdef module_param_array
23435 +               if (num_LLISize > bd) {
23436 +#endif
23437 +                       adapter->lli_size = LLISize[bd];
23438 +                       if (adapter->lli_size) {
23439 +                               igb_validate_option(&adapter->lli_size, &opt,
23440 +                                       adapter);
23441 +                       } else {
23442 +                               DPRINTK(PROBE, INFO, "%s turned off\n",
23443 +                                       opt.name);
23444 +                       }
23445 +#ifdef module_param_array
23446 +               } else {
23447 +                       adapter->lli_size = opt.def;
23448 +               }
23449 +#endif
23450 +       }
23451 +       { /* Low Latency Interrupt on TCP Push flag */
23452 +               struct igb_option opt = {
23453 +                       .type = enable_option,
23454 +                       .name = "Low Latency Interrupt on TCP Push flag",
23455 +                       .err  = "defaulting to Disabled",
23456 +                       .def  = OPTION_DISABLED
23457 +               };
23458 +
23459 +#ifdef module_param_array
23460 +               if (num_LLIPush > bd) {
23461 +#endif
23462 +                       unsigned int lli_push = LLIPush[bd];
23463 +                       igb_validate_option(&lli_push, &opt, adapter);
23464 +                       adapter->flags |= lli_push ? IGB_FLAG_LLI_PUSH : 0;
23465 +#ifdef module_param_array
23466 +               } else {
23467 +                       adapter->flags |= opt.def ? IGB_FLAG_LLI_PUSH : 0;
23468 +               }
23469 +#endif
23470 +       }
23471 +#ifdef IGB_LRO
23472 +       { /* Large Receive Offload - Maximum packets to aggregate */
23473 +               struct igb_option opt = {
23474 +                       .type = range_option,
23475 +                       .name = "LRO - Maximum packets to aggregate",
23476 +                       .err  = "using default of " __MODULE_STRING(DEFAULT_LRO_AGGR),
23477 +                       .def  = DEFAULT_LRO_AGGR,
23478 +                       .arg  = { .r = { .min = MIN_LRO_AGGR,
23479 +                                        .max = MAX_LRO_AGGR }}
23480 +               };
23481 +
23482 +#ifdef module_param_array
23483 +               if (num_LROAggr > bd) {
23484 +#endif
23485 +                       adapter->lro_max_aggr = LROAggr[bd];
23486 +                       igb_validate_option(&adapter->lro_max_aggr, &opt, adapter);
23487 +
23488 +#ifdef module_param_array
23489 +               } else {
23490 +                       adapter->lro_max_aggr = opt.def;
23491 +               }
23492 +#endif
23493 +       }
23494 +#endif /* IGB_LRO */
23495 +}
23496 +
23497 Binary files vanilla/drivers/net/igb/igb_param.o and linux-i686-2.6.22/drivers/net/igb/igb_param.o differ
23498 diff -Nru vanilla/drivers/net/igb/.igb_param.o.cmd linux-i686-2.6.22/drivers/net/igb/.igb_param.o.cmd
23499 --- vanilla/drivers/net/igb/.igb_param.o.cmd    1969-12-31 19:00:00.000000000 -0500
23500 +++ linux-i686-2.6.22/drivers/net/igb/.igb_param.o.cmd  2009-07-16 19:53:43.000000000 -0400
23501 @@ -0,0 +1,554 @@
23502 +cmd_drivers/net/igb/igb_param.o := gcc -m32 -Wp,-MD,drivers/net/igb/.igb_param.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(igb_param)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_igb_param.o drivers/net/igb/igb_param.c
23503 +
23504 +deps_drivers/net/igb/igb_param.o := \
23505 +  drivers/net/igb/igb_param.c \
23506 +  include/linux/netdevice.h \
23507 +    $(wildcard include/config/ax25.h) \
23508 +    $(wildcard include/config/tr.h) \
23509 +    $(wildcard include/config/net/ipip.h) \
23510 +    $(wildcard include/config/net/ipgre.h) \
23511 +    $(wildcard include/config/ipv6/sit.h) \
23512 +    $(wildcard include/config/ipv6/tunnel.h) \
23513 +    $(wildcard include/config/wireless/ext.h) \
23514 +    $(wildcard include/config/netpoll.h) \
23515 +    $(wildcard include/config/net/poll/controller.h) \
23516 +    $(wildcard include/config/netpoll/trap.h) \
23517 +    $(wildcard include/config/net/dma.h) \
23518 +    $(wildcard include/config/bug.h) \
23519 +    $(wildcard include/config/proc/fs.h) \
23520 +  include/linux/if.h \
23521 +  include/linux/types.h \
23522 +    $(wildcard include/config/uid16.h) \
23523 +    $(wildcard include/config/lbd.h) \
23524 +    $(wildcard include/config/lsf.h) \
23525 +    $(wildcard include/config/resources/64bit.h) \
23526 +  include/linux/posix_types.h \
23527 +  include/linux/stddef.h \
23528 +  include/linux/compiler.h \
23529 +    $(wildcard include/config/enable/must/check.h) \
23530 +  include/linux/compiler-gcc4.h \
23531 +    $(wildcard include/config/forced/inlining.h) \
23532 +  include/linux/compiler-gcc.h \
23533 +  include/asm/posix_types.h \
23534 +  include/asm/types.h \
23535 +    $(wildcard include/config/highmem64g.h) \
23536 +  include/linux/socket.h \
23537 +    $(wildcard include/config/compat.h) \
23538 +  include/asm/socket.h \
23539 +  include/asm/sockios.h \
23540 +  include/linux/sockios.h \
23541 +  include/linux/uio.h \
23542 +  include/linux/hdlc/ioctl.h \
23543 +  include/linux/if_ether.h \
23544 +    $(wildcard include/config/sysctl.h) \
23545 +  include/linux/skbuff.h \
23546 +    $(wildcard include/config/nf/conntrack.h) \
23547 +    $(wildcard include/config/bridge/netfilter.h) \
23548 +    $(wildcard include/config/vlan/8021q.h) \
23549 +    $(wildcard include/config/net/sched.h) \
23550 +    $(wildcard include/config/net/cls/act.h) \
23551 +    $(wildcard include/config/network/secmark.h) \
23552 +  include/linux/kernel.h \
23553 +    $(wildcard include/config/preempt/voluntary.h) \
23554 +    $(wildcard include/config/debug/spinlock/sleep.h) \
23555 +    $(wildcard include/config/printk.h) \
23556 +    $(wildcard include/config/numa.h) \
23557 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
23558 +  include/linux/linkage.h \
23559 +  include/asm/linkage.h \
23560 +    $(wildcard include/config/x86/alignment/16.h) \
23561 +  include/linux/bitops.h \
23562 +  include/asm/bitops.h \
23563 +  include/asm/alternative.h \
23564 +    $(wildcard include/config/smp.h) \
23565 +    $(wildcard include/config/paravirt.h) \
23566 +  include/asm-generic/bitops/sched.h \
23567 +  include/asm-generic/bitops/hweight.h \
23568 +  include/asm-generic/bitops/fls64.h \
23569 +  include/asm-generic/bitops/ext2-non-atomic.h \
23570 +  include/asm-generic/bitops/le.h \
23571 +  include/asm/byteorder.h \
23572 +    $(wildcard include/config/x86/bswap.h) \
23573 +  include/linux/byteorder/little_endian.h \
23574 +  include/linux/byteorder/swab.h \
23575 +  include/linux/byteorder/generic.h \
23576 +  include/asm-generic/bitops/minix.h \
23577 +  include/linux/log2.h \
23578 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
23579 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
23580 +  include/asm/bug.h \
23581 +    $(wildcard include/config/debug/bugverbose.h) \
23582 +  include/asm-generic/bug.h \
23583 +    $(wildcard include/config/generic/bug.h) \
23584 +  include/linux/time.h \
23585 +  include/linux/seqlock.h \
23586 +  include/linux/spinlock.h \
23587 +    $(wildcard include/config/debug/spinlock.h) \
23588 +    $(wildcard include/config/preempt.h) \
23589 +    $(wildcard include/config/debug/lock/alloc.h) \
23590 +  include/linux/preempt.h \
23591 +    $(wildcard include/config/debug/preempt.h) \
23592 +  include/linux/thread_info.h \
23593 +  include/asm/thread_info.h \
23594 +    $(wildcard include/config/4kstacks.h) \
23595 +    $(wildcard include/config/debug/stack/usage.h) \
23596 +  include/asm/page.h \
23597 +    $(wildcard include/config/x86/use/3dnow.h) \
23598 +    $(wildcard include/config/x86/pae.h) \
23599 +    $(wildcard include/config/hugetlb/page.h) \
23600 +    $(wildcard include/config/highmem4g.h) \
23601 +    $(wildcard include/config/page/offset.h) \
23602 +    $(wildcard include/config/flatmem.h) \
23603 +  include/asm-generic/pgtable-nopmd.h \
23604 +  include/asm-generic/pgtable-nopud.h \
23605 +  include/asm-generic/memory_model.h \
23606 +    $(wildcard include/config/discontigmem.h) \
23607 +    $(wildcard include/config/sparsemem.h) \
23608 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
23609 +  include/asm-generic/page.h \
23610 +  include/asm/processor.h \
23611 +    $(wildcard include/config/x86/ht.h) \
23612 +    $(wildcard include/config/mk8.h) \
23613 +    $(wildcard include/config/mk7.h) \
23614 +  include/asm/vm86.h \
23615 +    $(wildcard include/config/vm86.h) \
23616 +  include/asm/ptrace.h \
23617 +  include/asm/ptrace-abi.h \
23618 +  include/asm/segment.h \
23619 +  include/asm/math_emu.h \
23620 +  include/asm/sigcontext.h \
23621 +  include/asm/cpufeature.h \
23622 +  include/asm/required-features.h \
23623 +    $(wildcard include/config/x86/minimum/cpu.h) \
23624 +    $(wildcard include/config/x86/cmov.h) \
23625 +    $(wildcard include/config/x86/cmpxchg64.h) \
23626 +  include/asm/msr.h \
23627 +  include/asm/msr-index.h \
23628 +  include/asm/errno.h \
23629 +  include/asm-generic/errno.h \
23630 +  include/asm-generic/errno-base.h \
23631 +  include/linux/errno.h \
23632 +  include/asm/system.h \
23633 +    $(wildcard include/config/x86/oostore.h) \
23634 +  include/asm/cmpxchg.h \
23635 +    $(wildcard include/config/x86/cmpxchg.h) \
23636 +  include/linux/irqflags.h \
23637 +    $(wildcard include/config/trace/irqflags.h) \
23638 +    $(wildcard include/config/trace/irqflags/support.h) \
23639 +    $(wildcard include/config/x86.h) \
23640 +  include/asm/irqflags.h \
23641 +  include/asm/processor-flags.h \
23642 +  include/linux/cache.h \
23643 +  include/asm/cache.h \
23644 +    $(wildcard include/config/x86/l1/cache/shift.h) \
23645 +  include/linux/threads.h \
23646 +    $(wildcard include/config/nr/cpus.h) \
23647 +    $(wildcard include/config/base/small.h) \
23648 +  include/asm/percpu.h \
23649 +  include/linux/cpumask.h \
23650 +    $(wildcard include/config/hotplug/cpu.h) \
23651 +  include/linux/bitmap.h \
23652 +  include/linux/string.h \
23653 +  include/asm/string.h \
23654 +  include/linux/init.h \
23655 +    $(wildcard include/config/modules.h) \
23656 +    $(wildcard include/config/hotplug.h) \
23657 +    $(wildcard include/config/memory/hotplug.h) \
23658 +    $(wildcard include/config/acpi/hotplug/memory.h) \
23659 +  include/linux/stringify.h \
23660 +  include/linux/bottom_half.h \
23661 +  include/linux/spinlock_types.h \
23662 +  include/linux/lockdep.h \
23663 +    $(wildcard include/config/lockdep.h) \
23664 +    $(wildcard include/config/generic/hardirqs.h) \
23665 +    $(wildcard include/config/prove/locking.h) \
23666 +  include/asm/spinlock_types.h \
23667 +  include/asm/spinlock.h \
23668 +    $(wildcard include/config/x86/ppro/fence.h) \
23669 +  include/asm/atomic.h \
23670 +    $(wildcard include/config/m386.h) \
23671 +  include/asm-generic/atomic.h \
23672 +  include/asm/rwlock.h \
23673 +  include/linux/spinlock_api_smp.h \
23674 +  include/linux/vs_time.h \
23675 +    $(wildcard include/config/vserver/vtime.h) \
23676 +  include/linux/net.h \
23677 +  include/linux/wait.h \
23678 +  include/linux/list.h \
23679 +    $(wildcard include/config/debug/list.h) \
23680 +  include/linux/poison.h \
23681 +  include/linux/prefetch.h \
23682 +  include/asm/current.h \
23683 +  include/linux/random.h \
23684 +  include/linux/ioctl.h \
23685 +  include/asm/ioctl.h \
23686 +  include/asm-generic/ioctl.h \
23687 +  include/linux/sysctl.h \
23688 +    $(wildcard include/config/icmp/ipod.h) \
23689 +    $(wildcard include/config/web100/net100.h) \
23690 +    $(wildcard include/config/web100/stats.h) \
23691 +  include/linux/textsearch.h \
23692 +  include/linux/module.h \
23693 +    $(wildcard include/config/modversions.h) \
23694 +    $(wildcard include/config/unused/symbols.h) \
23695 +    $(wildcard include/config/module/unload.h) \
23696 +    $(wildcard include/config/kallsyms.h) \
23697 +    $(wildcard include/config/sysfs.h) \
23698 +  include/linux/stat.h \
23699 +  include/asm/stat.h \
23700 +  include/linux/kmod.h \
23701 +    $(wildcard include/config/kmod.h) \
23702 +  include/linux/elf.h \
23703 +  include/linux/auxvec.h \
23704 +  include/asm/auxvec.h \
23705 +  include/linux/elf-em.h \
23706 +  include/asm/elf.h \
23707 +  include/asm/user.h \
23708 +  include/asm/desc.h \
23709 +  include/asm/ldt.h \
23710 +  include/linux/smp.h \
23711 +  include/asm/smp.h \
23712 +    $(wildcard include/config/x86/local/apic.h) \
23713 +    $(wildcard include/config/x86/io/apic.h) \
23714 +  include/asm/mpspec.h \
23715 +    $(wildcard include/config/acpi.h) \
23716 +  include/asm/mpspec_def.h \
23717 +  include/asm-i386/mach-generic/mach_mpspec.h \
23718 +  include/asm/apic.h \
23719 +    $(wildcard include/config/x86/good/apic.h) \
23720 +  include/linux/pm.h \
23721 +    $(wildcard include/config/pm.h) \
23722 +  include/linux/delay.h \
23723 +  include/asm/delay.h \
23724 +  include/asm/fixmap.h \
23725 +    $(wildcard include/config/highmem.h) \
23726 +    $(wildcard include/config/x86/visws/apic.h) \
23727 +    $(wildcard include/config/x86/f00f/bug.h) \
23728 +    $(wildcard include/config/x86/cyclone/timer.h) \
23729 +    $(wildcard include/config/pci/mmconfig.h) \
23730 +  include/asm/acpi.h \
23731 +    $(wildcard include/config/acpi/sleep.h) \
23732 +  include/acpi/pdc_intel.h \
23733 +  include/asm/apicdef.h \
23734 +  include/asm/kmap_types.h \
23735 +    $(wildcard include/config/debug/highmem.h) \
23736 +  include/asm/io_apic.h \
23737 +  include/asm-i386/mach-generic/mach_apicdef.h \
23738 +  include/asm/genapic.h \
23739 +  include/linux/percpu.h \
23740 +  include/linux/slab.h \
23741 +    $(wildcard include/config/slab/debug.h) \
23742 +    $(wildcard include/config/slab.h) \
23743 +    $(wildcard include/config/slub.h) \
23744 +    $(wildcard include/config/debug/slab.h) \
23745 +  include/linux/gfp.h \
23746 +    $(wildcard include/config/zone/dma.h) \
23747 +    $(wildcard include/config/zone/dma32.h) \
23748 +  include/linux/mmzone.h \
23749 +    $(wildcard include/config/force/max/zoneorder.h) \
23750 +    $(wildcard include/config/arch/populates/node/map.h) \
23751 +    $(wildcard include/config/flat/node/mem/map.h) \
23752 +    $(wildcard include/config/have/memory/present.h) \
23753 +    $(wildcard include/config/need/node/memmap/size.h) \
23754 +    $(wildcard include/config/need/multiple/nodes.h) \
23755 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
23756 +    $(wildcard include/config/sparsemem/extreme.h) \
23757 +    $(wildcard include/config/nodes/span/other/nodes.h) \
23758 +    $(wildcard include/config/holes/in/zone.h) \
23759 +  include/linux/numa.h \
23760 +    $(wildcard include/config/nodes/shift.h) \
23761 +  include/linux/nodemask.h \
23762 +  include/linux/memory_hotplug.h \
23763 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
23764 +  include/linux/notifier.h \
23765 +  include/linux/mutex.h \
23766 +    $(wildcard include/config/debug/mutexes.h) \
23767 +    $(wildcard include/config/chopstix.h) \
23768 +  include/linux/rwsem.h \
23769 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
23770 +  include/asm/rwsem.h \
23771 +  include/linux/srcu.h \
23772 +  include/linux/topology.h \
23773 +    $(wildcard include/config/sched/smt.h) \
23774 +    $(wildcard include/config/sched/mc.h) \
23775 +  include/asm/topology.h \
23776 +  include/asm-generic/topology.h \
23777 +  include/linux/slab_def.h \
23778 +  include/linux/kmalloc_sizes.h \
23779 +  include/asm/mmu.h \
23780 +  include/asm/semaphore.h \
23781 +  include/linux/kobject.h \
23782 +  include/linux/sysfs.h \
23783 +  include/linux/kref.h \
23784 +  include/linux/moduleparam.h \
23785 +  include/asm/local.h \
23786 +  include/asm/module.h \
23787 +    $(wildcard include/config/m486.h) \
23788 +    $(wildcard include/config/m586.h) \
23789 +    $(wildcard include/config/m586tsc.h) \
23790 +    $(wildcard include/config/m586mmx.h) \
23791 +    $(wildcard include/config/mcore2.h) \
23792 +    $(wildcard include/config/m686.h) \
23793 +    $(wildcard include/config/mpentiumii.h) \
23794 +    $(wildcard include/config/mpentiumiii.h) \
23795 +    $(wildcard include/config/mpentiumm.h) \
23796 +    $(wildcard include/config/mpentium4.h) \
23797 +    $(wildcard include/config/mk6.h) \
23798 +    $(wildcard include/config/x86/elan.h) \
23799 +    $(wildcard include/config/mcrusoe.h) \
23800 +    $(wildcard include/config/mefficeon.h) \
23801 +    $(wildcard include/config/mwinchipc6.h) \
23802 +    $(wildcard include/config/mwinchip2.h) \
23803 +    $(wildcard include/config/mwinchip3d.h) \
23804 +    $(wildcard include/config/mcyrixiii.h) \
23805 +    $(wildcard include/config/mviac3/2.h) \
23806 +    $(wildcard include/config/mviac7.h) \
23807 +    $(wildcard include/config/mgeodegx1.h) \
23808 +    $(wildcard include/config/mgeode/lx.h) \
23809 +  include/linux/err.h \
23810 +  include/net/checksum.h \
23811 +  include/asm/uaccess.h \
23812 +    $(wildcard include/config/x86/intel/usercopy.h) \
23813 +    $(wildcard include/config/x86/wp/works/ok.h) \
23814 +  include/asm/checksum.h \
23815 +  include/linux/in6.h \
23816 +  include/linux/rcupdate.h \
23817 +  include/linux/dmaengine.h \
23818 +    $(wildcard include/config/dma/engine.h) \
23819 +  include/linux/device.h \
23820 +    $(wildcard include/config/debug/devres.h) \
23821 +  include/linux/ioport.h \
23822 +  include/linux/klist.h \
23823 +  include/linux/completion.h \
23824 +  include/asm/device.h \
23825 +  include/linux/hrtimer.h \
23826 +    $(wildcard include/config/high/res/timers.h) \
23827 +    $(wildcard include/config/timer/stats.h) \
23828 +  include/linux/rbtree.h \
23829 +  include/linux/ktime.h \
23830 +    $(wildcard include/config/ktime/scalar.h) \
23831 +  include/linux/jiffies.h \
23832 +  include/linux/calc64.h \
23833 +  include/asm/div64.h \
23834 +  include/linux/timex.h \
23835 +    $(wildcard include/config/time/interpolation.h) \
23836 +    $(wildcard include/config/no/hz.h) \
23837 +  include/asm/param.h \
23838 +    $(wildcard include/config/hz.h) \
23839 +  include/asm/timex.h \
23840 +  include/asm/tsc.h \
23841 +    $(wildcard include/config/x86/tsc.h) \
23842 +    $(wildcard include/config/x86/generic.h) \
23843 +  include/linux/if_packet.h \
23844 +  include/linux/timer.h \
23845 +  include/linux/interrupt.h \
23846 +    $(wildcard include/config/generic/irq/probe.h) \
23847 +  include/linux/irqreturn.h \
23848 +  include/linux/hardirq.h \
23849 +    $(wildcard include/config/preempt/bkl.h) \
23850 +    $(wildcard include/config/virt/cpu/accounting.h) \
23851 +  include/linux/smp_lock.h \
23852 +    $(wildcard include/config/lock/kernel.h) \
23853 +  include/linux/sched.h \
23854 +    $(wildcard include/config/detect/softlockup.h) \
23855 +    $(wildcard include/config/split/ptlock/cpus.h) \
23856 +    $(wildcard include/config/keys.h) \
23857 +    $(wildcard include/config/bsd/process/acct.h) \
23858 +    $(wildcard include/config/taskstats.h) \
23859 +    $(wildcard include/config/inotify/user.h) \
23860 +    $(wildcard include/config/schedstats.h) \
23861 +    $(wildcard include/config/task/delay/acct.h) \
23862 +    $(wildcard include/config/blk/dev/io/trace.h) \
23863 +    $(wildcard include/config/cc/stackprotector.h) \
23864 +    $(wildcard include/config/sysvipc.h) \
23865 +    $(wildcard include/config/rt/mutexes.h) \
23866 +    $(wildcard include/config/task/xacct.h) \
23867 +    $(wildcard include/config/cpusets.h) \
23868 +    $(wildcard include/config/fault/injection.h) \
23869 +  include/linux/capability.h \
23870 +  include/asm/cputime.h \
23871 +  include/asm-generic/cputime.h \
23872 +  include/linux/sem.h \
23873 +  include/linux/ipc.h \
23874 +    $(wildcard include/config/ipc/ns.h) \
23875 +  include/asm/ipcbuf.h \
23876 +  include/asm/sembuf.h \
23877 +  include/linux/signal.h \
23878 +  include/asm/signal.h \
23879 +  include/asm-generic/signal.h \
23880 +  include/asm/siginfo.h \
23881 +  include/asm-generic/siginfo.h \
23882 +  include/linux/securebits.h \
23883 +  include/linux/fs_struct.h \
23884 +  include/linux/pid.h \
23885 +  include/linux/seccomp.h \
23886 +    $(wildcard include/config/seccomp.h) \
23887 +  include/linux/futex.h \
23888 +    $(wildcard include/config/futex.h) \
23889 +  include/linux/rtmutex.h \
23890 +    $(wildcard include/config/debug/rt/mutexes.h) \
23891 +  include/linux/plist.h \
23892 +    $(wildcard include/config/debug/pi/list.h) \
23893 +  include/linux/param.h \
23894 +  include/linux/resource.h \
23895 +  include/asm/resource.h \
23896 +  include/asm-generic/resource.h \
23897 +  include/linux/task_io_accounting.h \
23898 +    $(wildcard include/config/task/io/accounting.h) \
23899 +  include/linux/aio.h \
23900 +  include/linux/workqueue.h \
23901 +  include/linux/aio_abi.h \
23902 +  include/asm/hardirq.h \
23903 +  include/linux/irq.h \
23904 +    $(wildcard include/config/s390.h) \
23905 +    $(wildcard include/config/irq/per/cpu.h) \
23906 +    $(wildcard include/config/irq/release/method.h) \
23907 +    $(wildcard include/config/generic/pending/irq.h) \
23908 +    $(wildcard include/config/irqbalance.h) \
23909 +    $(wildcard include/config/auto/irq/affinity.h) \
23910 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
23911 +  include/asm/irq.h \
23912 +  include/asm-i386/mach-default/irq_vectors.h \
23913 +  include/asm-i386/mach-default/irq_vectors_limits.h \
23914 +  include/asm/irq_regs.h \
23915 +  include/asm/hw_irq.h \
23916 +  include/linux/profile.h \
23917 +    $(wildcard include/config/profiling.h) \
23918 +  include/asm/sections.h \
23919 +  include/asm-generic/sections.h \
23920 +  include/linux/irq_cpustat.h \
23921 +  drivers/net/igb/igb.h \
23922 +    $(wildcard include/config/dca.h) \
23923 +    $(wildcard include/config/inet/lro.h) \
23924 +    $(wildcard include/config/igb/separate/tx/handler.h) \
23925 +    $(wildcard include/config/igb/disable/packet/split.h) \
23926 +  include/linux/pci.h \
23927 +    $(wildcard include/config/pci/msi.h) \
23928 +    $(wildcard include/config/pci.h) \
23929 +    $(wildcard include/config/ht/irq.h) \
23930 +    $(wildcard include/config/pci/domains.h) \
23931 +  include/linux/pci_regs.h \
23932 +  include/linux/mod_devicetable.h \
23933 +  include/linux/pci_ids.h \
23934 +  include/linux/dmapool.h \
23935 +  include/asm/io.h \
23936 +    $(wildcard include/config/x86/numaq.h) \
23937 +  include/asm-generic/iomap.h \
23938 +  include/linux/vmalloc.h \
23939 +  include/asm/scatterlist.h \
23940 +  include/asm/pci.h \
23941 +  include/linux/mm.h \
23942 +    $(wildcard include/config/mmu.h) \
23943 +    $(wildcard include/config/stack/growsup.h) \
23944 +    $(wildcard include/config/debug/vm.h) \
23945 +    $(wildcard include/config/shmem.h) \
23946 +    $(wildcard include/config/ia64.h) \
23947 +    $(wildcard include/config/debug/pagealloc.h) \
23948 +  include/linux/prio_tree.h \
23949 +  include/linux/fs.h \
23950 +    $(wildcard include/config/dnotify.h) \
23951 +    $(wildcard include/config/vserver/cowbl.h) \
23952 +    $(wildcard include/config/quota.h) \
23953 +    $(wildcard include/config/inotify.h) \
23954 +    $(wildcard include/config/security.h) \
23955 +    $(wildcard include/config/epoll.h) \
23956 +    $(wildcard include/config/auditsyscall.h) \
23957 +    $(wildcard include/config/block.h) \
23958 +    $(wildcard include/config/fs/xip.h) \
23959 +    $(wildcard include/config/migration.h) \
23960 +  include/linux/limits.h \
23961 +  include/linux/kdev_t.h \
23962 +  include/linux/dcache.h \
23963 +  include/linux/namei.h \
23964 +  include/linux/radix-tree.h \
23965 +  include/linux/quota.h \
23966 +  include/linux/dqblk_xfs.h \
23967 +  include/linux/dqblk_v1.h \
23968 +  include/linux/dqblk_v2.h \
23969 +  include/linux/nfs_fs_i.h \
23970 +  include/linux/nfs.h \
23971 +  include/linux/sunrpc/msg_prot.h \
23972 +  include/linux/fcntl.h \
23973 +  include/asm/fcntl.h \
23974 +  include/asm-generic/fcntl.h \
23975 +    $(wildcard include/config/64bit.h) \
23976 +  include/linux/debug_locks.h \
23977 +    $(wildcard include/config/debug/locking/api/selftests.h) \
23978 +  include/linux/backing-dev.h \
23979 +  include/linux/mm_types.h \
23980 +  include/asm/pgtable.h \
23981 +    $(wildcard include/config/highpte.h) \
23982 +  include/asm/paravirt.h \
23983 +  include/asm/pgtable-2level-defs.h \
23984 +  include/asm/pgtable-2level.h \
23985 +  include/asm-generic/pgtable.h \
23986 +  include/linux/page-flags.h \
23987 +    $(wildcard include/config/swap.h) \
23988 +  include/linux/vmstat.h \
23989 +    $(wildcard include/config/vm/event/counters.h) \
23990 +  include/asm-generic/pci-dma-compat.h \
23991 +  include/linux/dma-mapping.h \
23992 +  include/asm/dma-mapping.h \
23993 +  include/asm-generic/pci.h \
23994 +  include/linux/ethtool.h \
23995 +  drivers/net/igb/kcompat.h \
23996 +    $(wildcard include/config/e1000/napi.h) \
23997 +    $(wildcard include/config/e1000e/napi.h) \
23998 +    $(wildcard include/config/ixgb/napi.h) \
23999 +    $(wildcard include/config/e1000/disable/packet/split.h) \
24000 +    $(wildcard include/config/space/len.h) \
24001 +    $(wildcard include/config/netdevices/multiqueue.h) \
24002 +  include/linux/version.h \
24003 +  include/linux/etherdevice.h \
24004 +  include/linux/in.h \
24005 +  include/linux/ip.h \
24006 +  include/linux/udp.h \
24007 +  include/net/inet_sock.h \
24008 +    $(wildcard include/config/ipv6.h) \
24009 +  include/linux/jhash.h \
24010 +  include/net/flow.h \
24011 +    $(wildcard include/config/ipv6/mip6.h) \
24012 +  include/net/sock.h \
24013 +    $(wildcard include/config/security/network.h) \
24014 +  include/linux/security.h \
24015 +    $(wildcard include/config/security/network/xfrm.h) \
24016 +  include/linux/binfmts.h \
24017 +  include/linux/shm.h \
24018 +  include/asm/shmparam.h \
24019 +  include/asm/shmbuf.h \
24020 +  include/linux/msg.h \
24021 +  include/asm/msgbuf.h \
24022 +  include/linux/key.h \
24023 +  include/linux/xfrm.h \
24024 +  include/linux/filter.h \
24025 +  include/net/dst.h \
24026 +    $(wildcard include/config/net/cls/route.h) \
24027 +    $(wildcard include/config/xfrm.h) \
24028 +  include/linux/rtnetlink.h \
24029 +  include/linux/netlink.h \
24030 +  include/linux/if_link.h \
24031 +  include/linux/if_addr.h \
24032 +  include/linux/neighbour.h \
24033 +  include/net/neighbour.h \
24034 +  include/linux/seq_file.h \
24035 +  include/net/rtnetlink.h \
24036 +  include/net/netlink.h \
24037 +  include/net/request_sock.h \
24038 +  include/linux/mii.h \
24039 +  include/linux/latency.h \
24040 +  drivers/net/igb/e1000_api.h \
24041 +  drivers/net/igb/e1000_hw.h \
24042 +  drivers/net/igb/e1000_osdep.h \
24043 +  drivers/net/igb/e1000_regs.h \
24044 +  drivers/net/igb/e1000_defines.h \
24045 +    $(wildcard include/config/res.h) \
24046 +    $(wildcard include/config/fault.h) \
24047 +  drivers/net/igb/e1000_mac.h \
24048 +  drivers/net/igb/e1000_phy.h \
24049 +  drivers/net/igb/e1000_nvm.h \
24050 +  drivers/net/igb/e1000_manage.h \
24051 +  drivers/net/igb/e1000_82575.h \
24052 +
24053 +drivers/net/igb/igb_param.o: $(deps_drivers/net/igb/igb_param.o)
24054 +
24055 +$(deps_drivers/net/igb/igb_param.o):
24056 diff -Nru vanilla/drivers/net/igb/igb_regtest.h linux-i686-2.6.22/drivers/net/igb/igb_regtest.h
24057 --- vanilla/drivers/net/igb/igb_regtest.h       1969-12-31 19:00:00.000000000 -0500
24058 +++ linux-i686-2.6.22/drivers/net/igb/igb_regtest.h     2009-07-16 19:25:22.000000000 -0400
24059 @@ -0,0 +1,133 @@
24060 +/*******************************************************************************
24061 +
24062 +  Intel(R) Gigabit Ethernet Linux driver
24063 +  Copyright(c) 2007-2008 Intel Corporation.
24064 +
24065 +  This program is free software; you can redistribute it and/or modify it
24066 +  under the terms and conditions of the GNU General Public License,
24067 +  version 2, as published by the Free Software Foundation.
24068 +
24069 +  This program is distributed in the hope it will be useful, but WITHOUT
24070 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24071 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
24072 +  more details.
24073 +
24074 +  You should have received a copy of the GNU General Public License along with
24075 +  this program; if not, write to the Free Software Foundation, Inc.,
24076 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24077 +
24078 +  The full GNU General Public License is included in this distribution in
24079 +  the file called "COPYING".
24080 +
24081 +  Contact Information:
24082 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24083 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24084 +
24085 +*******************************************************************************/
24086 +
24087 +/* ethtool register test data */
24088 +struct igb_reg_test {
24089 +       u16 reg;
24090 +       u16 reg_offset;
24091 +       u16 array_len;
24092 +       u16 test_type;
24093 +       u32 mask;
24094 +       u32 write;
24095 +};
24096 +
24097 +/* In the hardware, registers are laid out either singly, in arrays
24098 + * spaced 0x100 bytes apart, or in contiguous tables.  We assume
24099 + * most tests take place on arrays or single registers (handled
24100 + * as a single-element array) and special-case the tables.
24101 + * Table tests are always pattern tests.
24102 + *
24103 + * We also make provision for some required setup steps by specifying
24104 + * registers to be written without any read-back testing.
24105 + */
24106 +
24107 +#define PATTERN_TEST   1
24108 +#define SET_READ_TEST  2
24109 +#define WRITE_NO_TEST  3
24110 +#define TABLE32_TEST   4
24111 +#define TABLE64_TEST_LO        5
24112 +#define TABLE64_TEST_HI        6
24113 +
24114 +/* 82576 reg test */
24115 +static struct igb_reg_test reg_test_82576[] = {
24116 +       { E1000_FCAL,      0x100, 1,  PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24117 +       { E1000_FCAH,      0x100, 1,  PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF },
24118 +       { E1000_FCT,       0x100, 1,  PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF },
24119 +       { E1000_VET,       0x100, 1,  PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24120 +       { E1000_RDBAL(0),  0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
24121 +       { E1000_RDBAH(0),  0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24122 +       { E1000_RDLEN(0),  0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
24123 +       { E1000_RDBAL(4),  0x40,  8, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
24124 +       { E1000_RDBAH(4),  0x40,  8, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24125 +       { E1000_RDLEN(4),  0x40,  8, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
24126 +       /* Enable all four RX queues before testing. */
24127 +       { E1000_RXDCTL(0), 0x100, 1,  WRITE_NO_TEST, 0, E1000_RXDCTL_QUEUE_ENABLE },
24128 +       /* RDH is read-only for 82576, only test RDT. */
24129 +       { E1000_RDT(0),    0x100, 4,  PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
24130 +       { E1000_RXDCTL(0), 0x100, 4,  WRITE_NO_TEST, 0, 0 },
24131 +       { E1000_FCRTH,     0x100, 1,  PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 },
24132 +       { E1000_FCTTV,     0x100, 1,  PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
24133 +       { E1000_TIPG,      0x100, 1,  PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF },
24134 +       { E1000_TDBAL(0),  0x100, 4,  PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
24135 +       { E1000_TDBAH(0),  0x100, 4,  PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24136 +       { E1000_TDLEN(0),  0x100, 4,  PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
24137 +       { E1000_TDBAL(4),  0x40, 8,  PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
24138 +       { E1000_TDBAH(4),  0x40, 8,  PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24139 +       { E1000_TDLEN(4),  0x40, 8,  PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
24140 +       { E1000_RCTL,      0x100, 1,  SET_READ_TEST, 0xFFFFFFFF, 0x00000000 },
24141 +       { E1000_RCTL,      0x100, 1,  SET_READ_TEST, 0x04CFB0FE, 0x003FFFFB },
24142 +       { E1000_RCTL,      0x100, 1,  SET_READ_TEST, 0x04CFB0FE, 0xFFFFFFFF },
24143 +       { E1000_TCTL,      0x100, 1,  SET_READ_TEST, 0xFFFFFFFF, 0x00000000 },
24144 +       { E1000_RA,        0, 16, TABLE64_TEST_LO,
24145 +                                               0xFFFFFFFF, 0xFFFFFFFF },
24146 +       { E1000_RA,        0, 16, TABLE64_TEST_HI,
24147 +                                               0x83FFFFFF, 0xFFFFFFFF },
24148 +       { E1000_RA2,       0, 8, TABLE64_TEST_LO,
24149 +                                               0xFFFFFFFF, 0xFFFFFFFF },
24150 +       { E1000_RA2,       0, 8, TABLE64_TEST_HI,
24151 +                                               0x83FFFFFF, 0xFFFFFFFF },
24152 +       { E1000_MTA,       0, 128,TABLE32_TEST,
24153 +                                               0xFFFFFFFF, 0xFFFFFFFF },
24154 +       { 0, 0, 0, 0 }
24155 +};
24156 +
24157 +
24158 +/* 82575 register test */
24159 +static struct igb_reg_test reg_test_82575[] = {
24160 +       { E1000_FCAL,   0x100,  1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24161 +       { E1000_FCAH,   0x100,  1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF },
24162 +       { E1000_FCT,    0x100,  1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF },
24163 +       { E1000_VET,    0x100,  1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24164 +       { E1000_RDBAL(0),       0x100,  4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
24165 +       { E1000_RDBAH(0),       0x100,  4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24166 +       { E1000_RDLEN(0),       0x100,  4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF },
24167 +       /* Enable all four RX queues before testing. */
24168 +       { E1000_RXDCTL(0),      0x100,  4, WRITE_NO_TEST, 0, E1000_RXDCTL_QUEUE_ENABLE },
24169 +       /* RDH is read-only for 82575, only test RDT. */
24170 +       { E1000_RDT(0), 0x100,  4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
24171 +       { E1000_RXDCTL(0),      0x100,  4, WRITE_NO_TEST, 0, 0 },
24172 +       { E1000_FCRTH,  0x100,  1, PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 },
24173 +       { E1000_FCTTV,  0x100,  1, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
24174 +       { E1000_TIPG,   0x100,  1, PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF },
24175 +       { E1000_TDBAL(0),       0x100,  4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
24176 +       { E1000_TDBAH(0),       0x100,  4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
24177 +       { E1000_TDLEN(0),       0x100,  4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF },
24178 +       { E1000_RCTL,   0x100,  1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 },
24179 +       { E1000_RCTL,   0x100,  1, SET_READ_TEST, 0x04CFB3FE, 0x003FFFFB },
24180 +       { E1000_RCTL,   0x100,  1, SET_READ_TEST, 0x04CFB3FE, 0xFFFFFFFF },
24181 +       { E1000_TCTL,   0x100,  1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 },
24182 +       { E1000_TXCW,   0x100,  1, PATTERN_TEST, 0xC000FFFF, 0x0000FFFF },
24183 +       { E1000_RA,     0,      16, TABLE64_TEST_LO,
24184 +                                               0xFFFFFFFF, 0xFFFFFFFF },
24185 +       { E1000_RA,     0,      16, TABLE64_TEST_HI,
24186 +                                               0x800FFFFF, 0xFFFFFFFF },
24187 +       { E1000_MTA,    0,      128, TABLE32_TEST,
24188 +                                               0xFFFFFFFF, 0xFFFFFFFF },
24189 +       { 0, 0, 0, 0 }
24190 +};
24191 +
24192 +
24193 diff -Nru vanilla/drivers/net/igb/kcompat.c linux-i686-2.6.22/drivers/net/igb/kcompat.c
24194 --- vanilla/drivers/net/igb/kcompat.c   1969-12-31 19:00:00.000000000 -0500
24195 +++ linux-i686-2.6.22/drivers/net/igb/kcompat.c 2009-07-16 19:25:22.000000000 -0400
24196 @@ -0,0 +1,413 @@
24197 +/*******************************************************************************
24198 +
24199 +  Intel(R) Gigabit Ethernet Linux driver
24200 +  Copyright(c) 2007-2008 Intel Corporation.
24201 +
24202 +  This program is free software; you can redistribute it and/or modify it
24203 +  under the terms and conditions of the GNU General Public License,
24204 +  version 2, as published by the Free Software Foundation.
24205 +
24206 +  This program is distributed in the hope it will be useful, but WITHOUT
24207 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24208 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
24209 +  more details.
24210 +
24211 +  You should have received a copy of the GNU General Public License along with
24212 +  this program; if not, write to the Free Software Foundation, Inc.,
24213 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24214 +
24215 +  The full GNU General Public License is included in this distribution in
24216 +  the file called "COPYING".
24217 +
24218 +  Contact Information:
24219 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24220 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24221 +
24222 +*******************************************************************************/
24223 +
24224 +
24225 +
24226 +
24227 +#include "igb.h"
24228 +
24229 +
24230 +
24231 +#include "kcompat.h"
24232 +
24233 +/*****************************************************************************/
24234 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,13) )
24235 +
24236 +/**************************************/
24237 +/* PCI DMA MAPPING */
24238 +
24239 +#if defined(CONFIG_HIGHMEM)
24240 +
24241 +#ifndef PCI_DRAM_OFFSET
24242 +#define PCI_DRAM_OFFSET 0
24243 +#endif
24244 +
24245 +u64
24246 +_kc_pci_map_page(struct pci_dev *dev, struct page *page, unsigned long offset,
24247 +                 size_t size, int direction)
24248 +{
24249 +       return (((u64) (page - mem_map) << PAGE_SHIFT) + offset +
24250 +               PCI_DRAM_OFFSET);
24251 +}
24252 +
24253 +#else /* CONFIG_HIGHMEM */
24254 +
24255 +u64
24256 +_kc_pci_map_page(struct pci_dev *dev, struct page *page, unsigned long offset,
24257 +                 size_t size, int direction)
24258 +{
24259 +       return pci_map_single(dev, (void *)page_address(page) + offset, size,
24260 +                             direction);
24261 +}
24262 +
24263 +#endif /* CONFIG_HIGHMEM */
24264 +
24265 +void
24266 +_kc_pci_unmap_page(struct pci_dev *dev, u64 dma_addr, size_t size,
24267 +                   int direction)
24268 +{
24269 +       return pci_unmap_single(dev, dma_addr, size, direction);
24270 +}
24271 +
24272 +#endif /* 2.4.13 => 2.4.3 */
24273 +
24274 +/*****************************************************************************/
24275 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) )
24276 +
24277 +/**************************************/
24278 +/* PCI DRIVER API */
24279 +
24280 +int
24281 +_kc_pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask)
24282 +{
24283 +       if (!pci_dma_supported(dev, mask))
24284 +               return -EIO;
24285 +       dev->dma_mask = mask;
24286 +       return 0;
24287 +}
24288 +
24289 +int
24290 +_kc_pci_request_regions(struct pci_dev *dev, char *res_name)
24291 +{
24292 +       int i;
24293 +
24294 +       for (i = 0; i < 6; i++) {
24295 +               if (pci_resource_len(dev, i) == 0)
24296 +                       continue;
24297 +
24298 +               if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
24299 +                       if (!request_region(pci_resource_start(dev, i), pci_resource_len(dev, i), res_name)) {
24300 +                               pci_release_regions(dev);
24301 +                               return -EBUSY;
24302 +                       }
24303 +               } else if (pci_resource_flags(dev, i) & IORESOURCE_MEM) {
24304 +                       if (!request_mem_region(pci_resource_start(dev, i), pci_resource_len(dev, i), res_name)) {
24305 +                               pci_release_regions(dev);
24306 +                               return -EBUSY;
24307 +                       }
24308 +               }
24309 +       }
24310 +       return 0;
24311 +}
24312 +
24313 +void
24314 +_kc_pci_release_regions(struct pci_dev *dev)
24315 +{
24316 +       int i;
24317 +
24318 +       for (i = 0; i < 6; i++) {
24319 +               if (pci_resource_len(dev, i) == 0)
24320 +                       continue;
24321 +
24322 +               if (pci_resource_flags(dev, i) & IORESOURCE_IO)
24323 +                       release_region(pci_resource_start(dev, i), pci_resource_len(dev, i));
24324 +
24325 +               else if (pci_resource_flags(dev, i) & IORESOURCE_MEM)
24326 +                       release_mem_region(pci_resource_start(dev, i), pci_resource_len(dev, i));
24327 +       }
24328 +}
24329 +
24330 +/**************************************/
24331 +/* NETWORK DRIVER API */
24332 +
24333 +struct net_device *
24334 +_kc_alloc_etherdev(int sizeof_priv)
24335 +{
24336 +       struct net_device *dev;
24337 +       int alloc_size;
24338 +
24339 +       alloc_size = sizeof(*dev) + sizeof_priv + IFNAMSIZ + 31;
24340 +       dev = kmalloc(alloc_size, GFP_KERNEL);
24341 +       if (!dev)
24342 +               return NULL;
24343 +       memset(dev, 0, alloc_size);
24344 +
24345 +       if (sizeof_priv)
24346 +               dev->priv = (void *) (((unsigned long)(dev + 1) + 31) & ~31);
24347 +       dev->name[0] = '\0';
24348 +       ether_setup(dev);
24349 +
24350 +       return dev;
24351 +}
24352 +
24353 +int
24354 +_kc_is_valid_ether_addr(u8 *addr)
24355 +{
24356 +       const char zaddr[6] = { 0, };
24357 +
24358 +       return !(addr[0] & 1) && memcmp(addr, zaddr, 6);
24359 +}
24360 +
24361 +#endif /* 2.4.3 => 2.4.0 */
24362 +
24363 +/*****************************************************************************/
24364 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6) )
24365 +
24366 +int
24367 +_kc_pci_set_power_state(struct pci_dev *dev, int state)
24368 +{
24369 +       return 0;
24370 +}
24371 +
24372 +int
24373 +_kc_pci_enable_wake(struct pci_dev *pdev, u32 state, int enable)
24374 +{
24375 +       return 0;
24376 +}
24377 +
24378 +#endif /* 2.4.6 => 2.4.3 */
24379 +
24380 +/*****************************************************************************/
24381 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) )
24382 +void _kc_skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page,
24383 +                            int off, int size)
24384 +{
24385 +       skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
24386 +       frag->page = page;
24387 +       frag->page_offset = off;
24388 +       frag->size = size;
24389 +       skb_shinfo(skb)->nr_frags = i + 1;
24390 +}
24391 +
24392 +/*
24393 + * Original Copyright:
24394 + * find_next_bit.c: fallback find next bit implementation
24395 + *
24396 + * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
24397 + * Written by David Howells (dhowells@redhat.com)
24398 + */
24399 +
24400 +/**
24401 + * find_next_bit - find the next set bit in a memory region
24402 + * @addr: The address to base the search on
24403 + * @offset: The bitnumber to start searching at
24404 + * @size: The maximum size to search
24405 + */
24406 +unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
24407 +                            unsigned long offset)
24408 +{
24409 +       const unsigned long *p = addr + BITOP_WORD(offset);
24410 +       unsigned long result = offset & ~(BITS_PER_LONG-1);
24411 +       unsigned long tmp;
24412 +
24413 +       if (offset >= size)
24414 +               return size;
24415 +       size -= result;
24416 +       offset %= BITS_PER_LONG;
24417 +       if (offset) {
24418 +               tmp = *(p++);
24419 +               tmp &= (~0UL << offset);
24420 +               if (size < BITS_PER_LONG)
24421 +                       goto found_first;
24422 +               if (tmp)
24423 +                       goto found_middle;
24424 +               size -= BITS_PER_LONG;
24425 +               result += BITS_PER_LONG;
24426 +       }
24427 +       while (size & ~(BITS_PER_LONG-1)) {
24428 +               if ((tmp = *(p++)))
24429 +                       goto found_middle;
24430 +               result += BITS_PER_LONG;
24431 +               size -= BITS_PER_LONG;
24432 +       }
24433 +       if (!size)
24434 +               return result;
24435 +       tmp = *p;
24436 +
24437 +found_first:
24438 +       tmp &= (~0UL >> (BITS_PER_LONG - size));
24439 +       if (tmp == 0UL)         /* Are any bits set? */
24440 +               return result + size;   /* Nope. */
24441 +found_middle:
24442 +       return result + ffs(tmp);
24443 +}
24444 +
24445 +#endif /* 2.6.0 => 2.4.6 */
24446 +
24447 +/*****************************************************************************/
24448 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) )
24449 +void *_kc_kzalloc(size_t size, int flags)
24450 +{
24451 +       void *ret = kmalloc(size, flags);
24452 +       if (ret)
24453 +               memset(ret, 0, size);
24454 +       return ret;
24455 +}
24456 +#endif /* <= 2.6.13 */
24457 +
24458 +/*****************************************************************************/
24459 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) )
24460 +struct sk_buff *_kc_netdev_alloc_skb(struct net_device *dev,
24461 +                                     unsigned int length)
24462 +{
24463 +       /* 16 == NET_PAD_SKB */
24464 +       struct sk_buff *skb;
24465 +       skb = alloc_skb(length + 16, GFP_ATOMIC);
24466 +       if (likely(skb != NULL)) {
24467 +               skb_reserve(skb, 16);
24468 +               skb->dev = dev;
24469 +       }
24470 +       return skb;
24471 +}
24472 +#endif /* <= 2.6.17 */
24473 +
24474 +/*****************************************************************************/
24475 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) )
24476 +int _kc_pci_save_state(struct pci_dev *pdev)
24477 +{ 
24478 +       struct net_device *netdev = pci_get_drvdata(pdev);
24479 +       struct adapter_struct *adapter = netdev_priv(netdev);
24480 +       int size = PCI_CONFIG_SPACE_LEN, i;
24481 +       u16 pcie_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_EXP);
24482 +       u16 pcie_link_status;
24483 +
24484 +       if (pcie_cap_offset) {
24485 +               if (!pci_read_config_word(pdev,
24486 +                                         pcie_cap_offset + PCIE_LINK_STATUS,
24487 +                                         &pcie_link_status))
24488 +               size = PCIE_CONFIG_SPACE_LEN;
24489 +       }
24490 +       pci_config_space_ich8lan();
24491 +#ifdef HAVE_PCI_ERS 
24492 +       if (adapter->config_space == NULL)
24493 +#else
24494 +       WARN_ON(adapter->config_space != NULL);
24495 +#endif
24496 +               adapter->config_space = kmalloc(size, GFP_KERNEL);
24497 +       if (!adapter->config_space) {
24498 +               printk(KERN_ERR "Out of memory in pci_save_state\n");
24499 +               return -ENOMEM;
24500 +       }
24501 +       for (i = 0; i < (size / 4); i++)
24502 +               pci_read_config_dword(pdev, i * 4, &adapter->config_space[i]);
24503 +       return 0;
24504 +}
24505 +
24506 +void _kc_pci_restore_state(struct pci_dev * pdev)
24507 +{
24508 +       struct net_device *netdev = pci_get_drvdata(pdev);
24509 +       struct adapter_struct *adapter = netdev_priv(netdev);
24510 +       int size = PCI_CONFIG_SPACE_LEN, i;
24511 +       u16 pcie_cap_offset;
24512 +       u16 pcie_link_status;
24513 +
24514 +       if (adapter->config_space != NULL) {
24515 +               pcie_cap_offset = pci_find_capability(pdev, PCI_CAP_ID_EXP);
24516 +               if (pcie_cap_offset && 
24517 +                   !pci_read_config_word(pdev,
24518 +                                         pcie_cap_offset + PCIE_LINK_STATUS,
24519 +                                         &pcie_link_status))
24520 +                       size = PCIE_CONFIG_SPACE_LEN;
24521 +       
24522 +               pci_config_space_ich8lan();
24523 +               for (i = 0; i < (size / 4); i++)
24524 +               pci_write_config_dword(pdev, i * 4, adapter->config_space[i]);
24525 +#ifndef HAVE_PCI_ERS
24526 +               kfree(adapter->config_space);
24527 +               adapter->config_space = NULL;
24528 +#endif
24529 +       }
24530 +}
24531 +
24532 +#ifdef HAVE_PCI_ERS
24533 +void _kc_free_netdev(struct net_device *netdev)
24534 +{
24535 +       struct adapter_struct *adapter = netdev_priv(netdev);
24536 +
24537 +       if (adapter->config_space != NULL)
24538 +               kfree(adapter->config_space);
24539 +#ifdef CONFIG_SYSFS
24540 +       if (netdev->reg_state == NETREG_UNINITIALIZED) {
24541 +               kfree((char *)netdev - netdev->padded);
24542 +       } else {
24543 +               BUG_ON(netdev->reg_state != NETREG_UNREGISTERED);
24544 +               netdev->reg_state = NETREG_RELEASED;
24545 +               class_device_put(&netdev->class_dev);
24546 +       }
24547 +#else
24548 +       kfree((char *)netdev - netdev->padded);
24549 +#endif
24550 +}
24551 +#endif
24552 +#endif /* <= 2.6.18 */
24553 +
24554 +/*****************************************************************************/
24555 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) )
24556 +#endif /* < 2.6.23 */
24557 +
24558 +/*****************************************************************************/
24559 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) )
24560 +#ifdef NAPI
24561 +int __kc_adapter_clean(struct net_device *netdev, int *budget)
24562 +{
24563 +       int work_done;
24564 +       int work_to_do = min(*budget, netdev->quota);
24565 +       /* kcompat.h netif_napi_add puts napi struct in "fake netdev->priv" */
24566 +       struct napi_struct *napi = netdev->priv;
24567 +       work_done = napi->poll(napi, work_to_do);
24568 +       *budget -= work_done;
24569 +       netdev->quota -= work_done;
24570 +       return work_done ? 1 : 0;
24571 +}
24572 +#endif /* NAPI */
24573 +#endif /* <= 2.6.24 */
24574 +
24575 +/*****************************************************************************/
24576 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) )
24577 +#ifdef HAVE_TX_MQ
24578 +void _kc_netif_tx_stop_all_queues(struct net_device *netdev)
24579 +{
24580 +       struct adapter_struct *adapter = netdev_priv(netdev);
24581 +       int i;
24582 +
24583 +       netif_stop_queue(netdev);
24584 +       if (netif_is_multiqueue(netdev))
24585 +               for (i = 0; i < adapter->num_tx_queues; i++)
24586 +                       netif_stop_subqueue(netdev, i);
24587 +}
24588 +void _kc_netif_tx_wake_all_queues(struct net_device *netdev)
24589 +{
24590 +       struct adapter_struct *adapter = netdev_priv(netdev);
24591 +       int i;
24592 +
24593 +       netif_wake_queue(netdev);
24594 +       if (netif_is_multiqueue(netdev))
24595 +               for (i = 0; i < adapter->num_tx_queues; i++)
24596 +                       netif_wake_subqueue(netdev, i);
24597 +}
24598 +void _kc_netif_tx_start_all_queues(struct net_device *netdev)
24599 +{
24600 +       struct adapter_struct *adapter = netdev_priv(netdev);
24601 +       int i;
24602 +
24603 +       netif_start_queue(netdev);
24604 +       if (netif_is_multiqueue(netdev))
24605 +               for (i = 0; i < adapter->num_tx_queues; i++)
24606 +                       netif_start_subqueue(netdev, i);
24607 +}
24608 +#endif /* HAVE_TX_MQ */
24609 +#endif /* <= 2.6.27 */
24610 diff -Nru vanilla/drivers/net/igb/kcompat_ethtool.c linux-i686-2.6.22/drivers/net/igb/kcompat_ethtool.c
24611 --- vanilla/drivers/net/igb/kcompat_ethtool.c   1969-12-31 19:00:00.000000000 -0500
24612 +++ linux-i686-2.6.22/drivers/net/igb/kcompat_ethtool.c 2009-07-16 19:25:22.000000000 -0400
24613 @@ -0,0 +1,1168 @@
24614 +/*******************************************************************************
24615 +
24616 +  Intel(R) Gigabit Ethernet Linux driver
24617 +  Copyright(c) 2007-2008 Intel Corporation.
24618 +
24619 +  This program is free software; you can redistribute it and/or modify it
24620 +  under the terms and conditions of the GNU General Public License,
24621 +  version 2, as published by the Free Software Foundation.
24622 +
24623 +  This program is distributed in the hope it will be useful, but WITHOUT
24624 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24625 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
24626 +  more details.
24627 +
24628 +  You should have received a copy of the GNU General Public License along with
24629 +  this program; if not, write to the Free Software Foundation, Inc.,
24630 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24631 +
24632 +  The full GNU General Public License is included in this distribution in
24633 +  the file called "COPYING".
24634 +
24635 +  Contact Information:
24636 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24637 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24638 +
24639 +*******************************************************************************/
24640 +
24641 +/*
24642 + * net/core/ethtool.c - Ethtool ioctl handler
24643 + * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
24644 + *
24645 + * This file is where we call all the ethtool_ops commands to get
24646 + * the information ethtool needs.  We fall back to calling do_ioctl()
24647 + * for drivers which haven't been converted to ethtool_ops yet.
24648 + *
24649 + * It's GPL, stupid.
24650 + *
24651 + * Modification by sfeldma@pobox.com to work as backward compat
24652 + * solution for pre-ethtool_ops kernels.
24653 + *     - copied struct ethtool_ops from ethtool.h
24654 + *     - defined SET_ETHTOOL_OPS
24655 + *     - put in some #ifndef NETIF_F_xxx wrappers
24656 + *     - changes refs to dev->ethtool_ops to ethtool_ops
24657 + *     - changed dev_ethtool to ethtool_ioctl
24658 + *      - remove EXPORT_SYMBOL()s
24659 + *      - added _kc_ prefix in built-in ethtool_op_xxx ops.
24660 + */
24661 +
24662 +#include <linux/module.h>
24663 +#include <linux/types.h>
24664 +#include <linux/errno.h>
24665 +#include <linux/mii.h>
24666 +#include <linux/ethtool.h>
24667 +#include <linux/netdevice.h>
24668 +#include <asm/uaccess.h>
24669 +
24670 +#include "kcompat.h"
24671 +
24672 +#undef SUPPORTED_10000baseT_Full
24673 +#define SUPPORTED_10000baseT_Full      (1 << 12)
24674 +#undef ADVERTISED_10000baseT_Full
24675 +#define ADVERTISED_10000baseT_Full     (1 << 12)
24676 +#undef SPEED_10000
24677 +#define SPEED_10000            10000
24678 +
24679 +#undef ethtool_ops
24680 +#define ethtool_ops _kc_ethtool_ops
24681 +
24682 +struct _kc_ethtool_ops {
24683 +       int  (*get_settings)(struct net_device *, struct ethtool_cmd *);
24684 +       int  (*set_settings)(struct net_device *, struct ethtool_cmd *);
24685 +       void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
24686 +       int  (*get_regs_len)(struct net_device *);
24687 +       void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
24688 +       void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
24689 +       int  (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
24690 +       u32  (*get_msglevel)(struct net_device *);
24691 +       void (*set_msglevel)(struct net_device *, u32);
24692 +       int  (*nway_reset)(struct net_device *);
24693 +       u32  (*get_link)(struct net_device *);
24694 +       int  (*get_eeprom_len)(struct net_device *);
24695 +       int  (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
24696 +       int  (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
24697 +       int  (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
24698 +       int  (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
24699 +       void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
24700 +       int  (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
24701 +       void (*get_pauseparam)(struct net_device *,
24702 +                              struct ethtool_pauseparam*);
24703 +       int  (*set_pauseparam)(struct net_device *,
24704 +                              struct ethtool_pauseparam*);
24705 +       u32  (*get_rx_csum)(struct net_device *);
24706 +       int  (*set_rx_csum)(struct net_device *, u32);
24707 +       u32  (*get_tx_csum)(struct net_device *);
24708 +       int  (*set_tx_csum)(struct net_device *, u32);
24709 +       u32  (*get_sg)(struct net_device *);
24710 +       int  (*set_sg)(struct net_device *, u32);
24711 +       u32  (*get_tso)(struct net_device *);
24712 +       int  (*set_tso)(struct net_device *, u32);
24713 +       int  (*self_test_count)(struct net_device *);
24714 +       void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
24715 +       void (*get_strings)(struct net_device *, u32 stringset, u8 *);
24716 +       int  (*phys_id)(struct net_device *, u32);
24717 +       int  (*get_stats_count)(struct net_device *);
24718 +       void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *,
24719 +                                 u64 *);
24720 +} *ethtool_ops = NULL;
24721 +
24722 +#undef SET_ETHTOOL_OPS
24723 +#define SET_ETHTOOL_OPS(netdev, ops) (ethtool_ops = (ops))
24724 +
24725 +/*
24726 + * Some useful ethtool_ops methods that are device independent. If we find that
24727 + * all drivers want to do the same thing here, we can turn these into dev_()
24728 + * function calls.
24729 + */
24730 +
24731 +#undef ethtool_op_get_link
24732 +#define ethtool_op_get_link _kc_ethtool_op_get_link
24733 +u32 _kc_ethtool_op_get_link(struct net_device *dev)
24734 +{
24735 +       return netif_carrier_ok(dev) ? 1 : 0;
24736 +}
24737 +
24738 +#undef ethtool_op_get_tx_csum
24739 +#define ethtool_op_get_tx_csum _kc_ethtool_op_get_tx_csum
24740 +u32 _kc_ethtool_op_get_tx_csum(struct net_device *dev)
24741 +{
24742 +#ifdef NETIF_F_IP_CSUM
24743 +       return (dev->features & NETIF_F_IP_CSUM) != 0;
24744 +#else
24745 +       return 0;
24746 +#endif
24747 +}
24748 +
24749 +#undef ethtool_op_set_tx_csum
24750 +#define ethtool_op_set_tx_csum _kc_ethtool_op_set_tx_csum
24751 +int _kc_ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
24752 +{
24753 +#ifdef NETIF_F_IP_CSUM
24754 +       if (data)
24755 +#ifdef NETIF_F_IPV6_CSUM
24756 +               dev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
24757 +       else
24758 +               dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
24759 +#else
24760 +               dev->features |= NETIF_F_IP_CSUM;
24761 +       else
24762 +               dev->features &= ~NETIF_F_IP_CSUM;
24763 +#endif
24764 +#endif
24765 +
24766 +       return 0;
24767 +}
24768 +
24769 +#undef ethtool_op_get_sg
24770 +#define ethtool_op_get_sg _kc_ethtool_op_get_sg
24771 +u32 _kc_ethtool_op_get_sg(struct net_device *dev)
24772 +{
24773 +#ifdef NETIF_F_SG
24774 +       return (dev->features & NETIF_F_SG) != 0;
24775 +#else
24776 +       return 0;
24777 +#endif
24778 +}
24779 +
24780 +#undef ethtool_op_set_sg
24781 +#define ethtool_op_set_sg _kc_ethtool_op_set_sg
24782 +int _kc_ethtool_op_set_sg(struct net_device *dev, u32 data)
24783 +{
24784 +#ifdef NETIF_F_SG
24785 +       if (data)
24786 +               dev->features |= NETIF_F_SG;
24787 +       else
24788 +               dev->features &= ~NETIF_F_SG;
24789 +#endif
24790 +
24791 +       return 0;
24792 +}
24793 +
24794 +#undef ethtool_op_get_tso
24795 +#define ethtool_op_get_tso _kc_ethtool_op_get_tso
24796 +u32 _kc_ethtool_op_get_tso(struct net_device *dev)
24797 +{
24798 +#ifdef NETIF_F_TSO
24799 +       return (dev->features & NETIF_F_TSO) != 0;
24800 +#else
24801 +       return 0;
24802 +#endif
24803 +}
24804 +
24805 +#undef ethtool_op_set_tso
24806 +#define ethtool_op_set_tso _kc_ethtool_op_set_tso
24807 +int _kc_ethtool_op_set_tso(struct net_device *dev, u32 data)
24808 +{
24809 +#ifdef NETIF_F_TSO
24810 +       if (data)
24811 +               dev->features |= NETIF_F_TSO;
24812 +       else
24813 +               dev->features &= ~NETIF_F_TSO;
24814 +#endif
24815 +
24816 +       return 0;
24817 +}
24818 +
24819 +/* Handlers for each ethtool command */
24820 +
24821 +static int ethtool_get_settings(struct net_device *dev, void *useraddr)
24822 +{
24823 +       struct ethtool_cmd cmd = { ETHTOOL_GSET };
24824 +       int err;
24825 +
24826 +       if (!ethtool_ops->get_settings)
24827 +               return -EOPNOTSUPP;
24828 +
24829 +       err = ethtool_ops->get_settings(dev, &cmd);
24830 +       if (err < 0)
24831 +               return err;
24832 +
24833 +       if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
24834 +               return -EFAULT;
24835 +       return 0;
24836 +}
24837 +
24838 +static int ethtool_set_settings(struct net_device *dev, void *useraddr)
24839 +{
24840 +       struct ethtool_cmd cmd;
24841 +
24842 +       if (!ethtool_ops->set_settings)
24843 +               return -EOPNOTSUPP;
24844 +
24845 +       if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
24846 +               return -EFAULT;
24847 +
24848 +       return ethtool_ops->set_settings(dev, &cmd);
24849 +}
24850 +
24851 +static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr)
24852 +{
24853 +       struct ethtool_drvinfo info;
24854 +       struct ethtool_ops *ops = ethtool_ops;
24855 +
24856 +       if (!ops->get_drvinfo)
24857 +               return -EOPNOTSUPP;
24858 +
24859 +       memset(&info, 0, sizeof(info));
24860 +       info.cmd = ETHTOOL_GDRVINFO;
24861 +       ops->get_drvinfo(dev, &info);
24862 +
24863 +       if (ops->self_test_count)
24864 +               info.testinfo_len = ops->self_test_count(dev);
24865 +       if (ops->get_stats_count)
24866 +               info.n_stats = ops->get_stats_count(dev);
24867 +       if (ops->get_regs_len)
24868 +               info.regdump_len = ops->get_regs_len(dev);
24869 +       if (ops->get_eeprom_len)
24870 +               info.eedump_len = ops->get_eeprom_len(dev);
24871 +
24872 +       if (copy_to_user(useraddr, &info, sizeof(info)))
24873 +               return -EFAULT;
24874 +       return 0;
24875 +}
24876 +
24877 +static int ethtool_get_regs(struct net_device *dev, char *useraddr)
24878 +{
24879 +       struct ethtool_regs regs;
24880 +       struct ethtool_ops *ops = ethtool_ops;
24881 +       void *regbuf;
24882 +       int reglen, ret;
24883 +
24884 +       if (!ops->get_regs || !ops->get_regs_len)
24885 +               return -EOPNOTSUPP;
24886 +
24887 +       if (copy_from_user(&regs, useraddr, sizeof(regs)))
24888 +               return -EFAULT;
24889 +
24890 +       reglen = ops->get_regs_len(dev);
24891 +       if (regs.len > reglen)
24892 +               regs.len = reglen;
24893 +
24894 +       regbuf = kmalloc(reglen, GFP_USER);
24895 +       if (!regbuf)
24896 +               return -ENOMEM;
24897 +
24898 +       ops->get_regs(dev, &regs, regbuf);
24899 +
24900 +       ret = -EFAULT;
24901 +       if (copy_to_user(useraddr, &regs, sizeof(regs)))
24902 +               goto out;
24903 +       useraddr += offsetof(struct ethtool_regs, data);
24904 +       if (copy_to_user(useraddr, regbuf, reglen))
24905 +               goto out;
24906 +       ret = 0;
24907 +
24908 +out:
24909 +       kfree(regbuf);
24910 +       return ret;
24911 +}
24912 +
24913 +static int ethtool_get_wol(struct net_device *dev, char *useraddr)
24914 +{
24915 +       struct ethtool_wolinfo wol = { ETHTOOL_GWOL };
24916 +
24917 +       if (!ethtool_ops->get_wol)
24918 +               return -EOPNOTSUPP;
24919 +
24920 +       ethtool_ops->get_wol(dev, &wol);
24921 +
24922 +       if (copy_to_user(useraddr, &wol, sizeof(wol)))
24923 +               return -EFAULT;
24924 +       return 0;
24925 +}
24926 +
24927 +static int ethtool_set_wol(struct net_device *dev, char *useraddr)
24928 +{
24929 +       struct ethtool_wolinfo wol;
24930 +
24931 +       if (!ethtool_ops->set_wol)
24932 +               return -EOPNOTSUPP;
24933 +
24934 +       if (copy_from_user(&wol, useraddr, sizeof(wol)))
24935 +               return -EFAULT;
24936 +
24937 +       return ethtool_ops->set_wol(dev, &wol);
24938 +}
24939 +
24940 +static int ethtool_get_msglevel(struct net_device *dev, char *useraddr)
24941 +{
24942 +       struct ethtool_value edata = { ETHTOOL_GMSGLVL };
24943 +
24944 +       if (!ethtool_ops->get_msglevel)
24945 +               return -EOPNOTSUPP;
24946 +
24947 +       edata.data = ethtool_ops->get_msglevel(dev);
24948 +
24949 +       if (copy_to_user(useraddr, &edata, sizeof(edata)))
24950 +               return -EFAULT;
24951 +       return 0;
24952 +}
24953 +
24954 +static int ethtool_set_msglevel(struct net_device *dev, char *useraddr)
24955 +{
24956 +       struct ethtool_value edata;
24957 +
24958 +       if (!ethtool_ops->set_msglevel)
24959 +               return -EOPNOTSUPP;
24960 +
24961 +       if (copy_from_user(&edata, useraddr, sizeof(edata)))
24962 +               return -EFAULT;
24963 +
24964 +       ethtool_ops->set_msglevel(dev, edata.data);
24965 +       return 0;
24966 +}
24967 +
24968 +static int ethtool_nway_reset(struct net_device *dev)
24969 +{
24970 +       if (!ethtool_ops->nway_reset)
24971 +               return -EOPNOTSUPP;
24972 +
24973 +       return ethtool_ops->nway_reset(dev);
24974 +}
24975 +
24976 +static int ethtool_get_link(struct net_device *dev, void *useraddr)
24977 +{
24978 +       struct ethtool_value edata = { ETHTOOL_GLINK };
24979 +
24980 +       if (!ethtool_ops->get_link)
24981 +               return -EOPNOTSUPP;
24982 +
24983 +       edata.data = ethtool_ops->get_link(dev);
24984 +
24985 +       if (copy_to_user(useraddr, &edata, sizeof(edata)))
24986 +               return -EFAULT;
24987 +       return 0;
24988 +}
24989 +
24990 +static int ethtool_get_eeprom(struct net_device *dev, void *useraddr)
24991 +{
24992 +       struct ethtool_eeprom eeprom;
24993 +       struct ethtool_ops *ops = ethtool_ops;
24994 +       u8 *data;
24995 +       int ret;
24996 +
24997 +       if (!ops->get_eeprom || !ops->get_eeprom_len)
24998 +               return -EOPNOTSUPP;
24999 +
25000 +       if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
25001 +               return -EFAULT;
25002 +
25003 +       /* Check for wrap and zero */
25004 +       if (eeprom.offset + eeprom.len <= eeprom.offset)
25005 +               return -EINVAL;
25006 +
25007 +       /* Check for exceeding total eeprom len */
25008 +       if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
25009 +               return -EINVAL;
25010 +
25011 +       data = kmalloc(eeprom.len, GFP_USER);
25012 +       if (!data)
25013 +               return -ENOMEM;
25014 +
25015 +       ret = -EFAULT;
25016 +       if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
25017 +               goto out;
25018 +
25019 +       ret = ops->get_eeprom(dev, &eeprom, data);
25020 +       if (ret)
25021 +               goto out;
25022 +
25023 +       ret = -EFAULT;
25024 +       if (copy_to_user(useraddr, &eeprom, sizeof(eeprom)))
25025 +               goto out;
25026 +       if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
25027 +               goto out;
25028 +       ret = 0;
25029 +
25030 +out:
25031 +       kfree(data);
25032 +       return ret;
25033 +}
25034 +
25035 +static int ethtool_set_eeprom(struct net_device *dev, void *useraddr)
25036 +{
25037 +       struct ethtool_eeprom eeprom;
25038 +       struct ethtool_ops *ops = ethtool_ops;
25039 +       u8 *data;
25040 +       int ret;
25041 +
25042 +       if (!ops->set_eeprom || !ops->get_eeprom_len)
25043 +               return -EOPNOTSUPP;
25044 +
25045 +       if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
25046 +               return -EFAULT;
25047 +
25048 +       /* Check for wrap and zero */
25049 +       if (eeprom.offset + eeprom.len <= eeprom.offset)
25050 +               return -EINVAL;
25051 +
25052 +       /* Check for exceeding total eeprom len */
25053 +       if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
25054 +               return -EINVAL;
25055 +
25056 +       data = kmalloc(eeprom.len, GFP_USER);
25057 +       if (!data)
25058 +               return -ENOMEM;
25059 +
25060 +       ret = -EFAULT;
25061 +       if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
25062 +               goto out;
25063 +
25064 +       ret = ops->set_eeprom(dev, &eeprom, data);
25065 +       if (ret)
25066 +               goto out;
25067 +
25068 +       if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
25069 +               ret = -EFAULT;
25070 +
25071 +out:
25072 +       kfree(data);
25073 +       return ret;
25074 +}
25075 +
25076 +static int ethtool_get_coalesce(struct net_device *dev, void *useraddr)
25077 +{
25078 +       struct ethtool_coalesce coalesce = { ETHTOOL_GCOALESCE };
25079 +
25080 +       if (!ethtool_ops->get_coalesce)
25081 +               return -EOPNOTSUPP;
25082 +
25083 +       ethtool_ops->get_coalesce(dev, &coalesce);
25084 +
25085 +       if (copy_to_user(useraddr, &coalesce, sizeof(coalesce)))
25086 +               return -EFAULT;
25087 +       return 0;
25088 +}
25089 +
25090 +static int ethtool_set_coalesce(struct net_device *dev, void *useraddr)
25091 +{
25092 +       struct ethtool_coalesce coalesce;
25093 +
25094 +       if (!ethtool_ops->get_coalesce)
25095 +               return -EOPNOTSUPP;
25096 +
25097 +       if (copy_from_user(&coalesce, useraddr, sizeof(coalesce)))
25098 +               return -EFAULT;
25099 +
25100 +       return ethtool_ops->set_coalesce(dev, &coalesce);
25101 +}
25102 +
25103 +static int ethtool_get_ringparam(struct net_device *dev, void *useraddr)
25104 +{
25105 +       struct ethtool_ringparam ringparam = { ETHTOOL_GRINGPARAM };
25106 +
25107 +       if (!ethtool_ops->get_ringparam)
25108 +               return -EOPNOTSUPP;
25109 +
25110 +       ethtool_ops->get_ringparam(dev, &ringparam);
25111 +
25112 +       if (copy_to_user(useraddr, &ringparam, sizeof(ringparam)))
25113 +               return -EFAULT;
25114 +       return 0;
25115 +}
25116 +
25117 +static int ethtool_set_ringparam(struct net_device *dev, void *useraddr)
25118 +{
25119 +       struct ethtool_ringparam ringparam;
25120 +
25121 +       if (!ethtool_ops->get_ringparam)
25122 +               return -EOPNOTSUPP;
25123 +
25124 +       if (copy_from_user(&ringparam, useraddr, sizeof(ringparam)))
25125 +               return -EFAULT;
25126 +
25127 +       return ethtool_ops->set_ringparam(dev, &ringparam);
25128 +}
25129 +
25130 +static int ethtool_get_pauseparam(struct net_device *dev, void *useraddr)
25131 +{
25132 +       struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM };
25133 +
25134 +       if (!ethtool_ops->get_pauseparam)
25135 +               return -EOPNOTSUPP;
25136 +
25137 +       ethtool_ops->get_pauseparam(dev, &pauseparam);
25138 +
25139 +       if (copy_to_user(useraddr, &pauseparam, sizeof(pauseparam)))
25140 +               return -EFAULT;
25141 +       return 0;
25142 +}
25143 +
25144 +static int ethtool_set_pauseparam(struct net_device *dev, void *useraddr)
25145 +{
25146 +       struct ethtool_pauseparam pauseparam;
25147 +
25148 +       if (!ethtool_ops->get_pauseparam)
25149 +               return -EOPNOTSUPP;
25150 +
25151 +       if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam)))
25152 +               return -EFAULT;
25153 +
25154 +       return ethtool_ops->set_pauseparam(dev, &pauseparam);
25155 +}
25156 +
25157 +static int ethtool_get_rx_csum(struct net_device *dev, char *useraddr)
25158 +{
25159 +       struct ethtool_value edata = { ETHTOOL_GRXCSUM };
25160 +
25161 +       if (!ethtool_ops->get_rx_csum)
25162 +               return -EOPNOTSUPP;
25163 +
25164 +       edata.data = ethtool_ops->get_rx_csum(dev);
25165 +
25166 +       if (copy_to_user(useraddr, &edata, sizeof(edata)))
25167 +               return -EFAULT;
25168 +       return 0;
25169 +}
25170 +
25171 +static int ethtool_set_rx_csum(struct net_device *dev, char *useraddr)
25172 +{
25173 +       struct ethtool_value edata;
25174 +
25175 +       if (!ethtool_ops->set_rx_csum)
25176 +               return -EOPNOTSUPP;
25177 +
25178 +       if (copy_from_user(&edata, useraddr, sizeof(edata)))
25179 +               return -EFAULT;
25180 +
25181 +       ethtool_ops->set_rx_csum(dev, edata.data);
25182 +       return 0;
25183 +}
25184 +
25185 +static int ethtool_get_tx_csum(struct net_device *dev, char *useraddr)
25186 +{
25187 +       struct ethtool_value edata = { ETHTOOL_GTXCSUM };
25188 +
25189 +       if (!ethtool_ops->get_tx_csum)
25190 +               return -EOPNOTSUPP;
25191 +
25192 +       edata.data = ethtool_ops->get_tx_csum(dev);
25193 +
25194 +       if (copy_to_user(useraddr, &edata, sizeof(edata)))
25195 +               return -EFAULT;
25196 +       return 0;
25197 +}
25198 +
25199 +static int ethtool_set_tx_csum(struct net_device *dev, char *useraddr)
25200 +{
25201 +       struct ethtool_value edata;
25202 +
25203 +       if (!ethtool_ops->set_tx_csum)
25204 +               return -EOPNOTSUPP;
25205 +
25206 +       if (copy_from_user(&edata, useraddr, sizeof(edata)))
25207 +               return -EFAULT;
25208 +
25209 +       return ethtool_ops->set_tx_csum(dev, edata.data);
25210 +}
25211 +
25212 +static int ethtool_get_sg(struct net_device *dev, char *useraddr)
25213 +{
25214 +       struct ethtool_value edata = { ETHTOOL_GSG };
25215 +
25216 +       if (!ethtool_ops->get_sg)
25217 +               return -EOPNOTSUPP;
25218 +
25219 +       edata.data = ethtool_ops->get_sg(dev);
25220 +
25221 +       if (copy_to_user(useraddr, &edata, sizeof(edata)))
25222 +               return -EFAULT;
25223 +       return 0;
25224 +}
25225 +
25226 +static int ethtool_set_sg(struct net_device *dev, char *useraddr)
25227 +{
25228 +       struct ethtool_value edata;
25229 +
25230 +       if (!ethtool_ops->set_sg)
25231 +               return -EOPNOTSUPP;
25232 +
25233 +       if (copy_from_user(&edata, useraddr, sizeof(edata)))
25234 +               return -EFAULT;
25235 +
25236 +       return ethtool_ops->set_sg(dev, edata.data);
25237 +}
25238 +
25239 +static int ethtool_get_tso(struct net_device *dev, char *useraddr)
25240 +{
25241 +       struct ethtool_value edata = { ETHTOOL_GTSO };
25242 +
25243 +       if (!ethtool_ops->get_tso)
25244 +               return -EOPNOTSUPP;
25245 +
25246 +       edata.data = ethtool_ops->get_tso(dev);
25247 +
25248 +       if (copy_to_user(useraddr, &edata, sizeof(edata)))
25249 +               return -EFAULT;
25250 +       return 0;
25251 +}
25252 +
25253 +static int ethtool_set_tso(struct net_device *dev, char *useraddr)
25254 +{
25255 +       struct ethtool_value edata;
25256 +
25257 +       if (!ethtool_ops->set_tso)
25258 +               return -EOPNOTSUPP;
25259 +
25260 +       if (copy_from_user(&edata, useraddr, sizeof(edata)))
25261 +               return -EFAULT;
25262 +
25263 +       return ethtool_ops->set_tso(dev, edata.data);
25264 +}
25265 +
25266 +static int ethtool_self_test(struct net_device *dev, char *useraddr)
25267 +{
25268 +       struct ethtool_test test;
25269 +       struct ethtool_ops *ops = ethtool_ops;
25270 +       u64 *data;
25271 +       int ret;
25272 +
25273 +       if (!ops->self_test || !ops->self_test_count)
25274 +               return -EOPNOTSUPP;
25275 +
25276 +       if (copy_from_user(&test, useraddr, sizeof(test)))
25277 +               return -EFAULT;
25278 +
25279 +       test.len = ops->self_test_count(dev);
25280 +       data = kmalloc(test.len * sizeof(u64), GFP_USER);
25281 +       if (!data)
25282 +               return -ENOMEM;
25283 +
25284 +       ops->self_test(dev, &test, data);
25285 +
25286 +       ret = -EFAULT;
25287 +       if (copy_to_user(useraddr, &test, sizeof(test)))
25288 +               goto out;
25289 +       useraddr += sizeof(test);
25290 +       if (copy_to_user(useraddr, data, test.len * sizeof(u64)))
25291 +               goto out;
25292 +       ret = 0;
25293 +
25294 +out:
25295 +       kfree(data);
25296 +       return ret;
25297 +}
25298 +
25299 +static int ethtool_get_strings(struct net_device *dev, void *useraddr)
25300 +{
25301 +       struct ethtool_gstrings gstrings;
25302 +       struct ethtool_ops *ops = ethtool_ops;
25303 +       u8 *data;
25304 +       int ret;
25305 +
25306 +       if (!ops->get_strings)
25307 +               return -EOPNOTSUPP;
25308 +
25309 +       if (copy_from_user(&gstrings, useraddr, sizeof(gstrings)))
25310 +               return -EFAULT;
25311 +
25312 +       switch (gstrings.string_set) {
25313 +       case ETH_SS_TEST:
25314 +               if (!ops->self_test_count)
25315 +                       return -EOPNOTSUPP;
25316 +               gstrings.len = ops->self_test_count(dev);
25317 +               break;
25318 +       case ETH_SS_STATS:
25319 +               if (!ops->get_stats_count)
25320 +                       return -EOPNOTSUPP;
25321 +               gstrings.len = ops->get_stats_count(dev);
25322 +               break;
25323 +       default:
25324 +               return -EINVAL;
25325 +       }
25326 +
25327 +       data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER);
25328 +       if (!data)
25329 +               return -ENOMEM;
25330 +
25331 +       ops->get_strings(dev, gstrings.string_set, data);
25332 +
25333 +       ret = -EFAULT;
25334 +       if (copy_to_user(useraddr, &gstrings, sizeof(gstrings)))
25335 +               goto out;
25336 +       useraddr += sizeof(gstrings);
25337 +       if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
25338 +               goto out;
25339 +       ret = 0;
25340 +
25341 +out:
25342 +       kfree(data);
25343 +       return ret;
25344 +}
25345 +
25346 +static int ethtool_phys_id(struct net_device *dev, void *useraddr)
25347 +{
25348 +       struct ethtool_value id;
25349 +
25350 +       if (!ethtool_ops->phys_id)
25351 +               return -EOPNOTSUPP;
25352 +
25353 +       if (copy_from_user(&id, useraddr, sizeof(id)))
25354 +               return -EFAULT;
25355 +
25356 +       return ethtool_ops->phys_id(dev, id.data);
25357 +}
25358 +
25359 +static int ethtool_get_stats(struct net_device *dev, void *useraddr)
25360 +{
25361 +       struct ethtool_stats stats;
25362 +       struct ethtool_ops *ops = ethtool_ops;
25363 +       u64 *data;
25364 +       int ret;
25365 +
25366 +       if (!ops->get_ethtool_stats || !ops->get_stats_count)
25367 +               return -EOPNOTSUPP;
25368 +
25369 +       if (copy_from_user(&stats, useraddr, sizeof(stats)))
25370 +               return -EFAULT;
25371 +
25372 +       stats.n_stats = ops->get_stats_count(dev);
25373 +       data = kmalloc(stats.n_stats * sizeof(u64), GFP_USER);
25374 +       if (!data)
25375 +               return -ENOMEM;
25376 +
25377 +       ops->get_ethtool_stats(dev, &stats, data);
25378 +
25379 +       ret = -EFAULT;
25380 +       if (copy_to_user(useraddr, &stats, sizeof(stats)))
25381 +               goto out;
25382 +       useraddr += sizeof(stats);
25383 +       if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64)))
25384 +               goto out;
25385 +       ret = 0;
25386 +
25387 +out:
25388 +       kfree(data);
25389 +       return ret;
25390 +}
25391 +
25392 +/* The main entry point in this file.  Called from net/core/dev.c */
25393 +
25394 +#define ETHTOOL_OPS_COMPAT
25395 +int ethtool_ioctl(struct ifreq *ifr)
25396 +{
25397 +       struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
25398 +       void *useraddr = (void *) ifr->ifr_data;
25399 +       u32 ethcmd;
25400 +
25401 +       /*
25402 +        * XXX: This can be pushed down into the ethtool_* handlers that
25403 +        * need it.  Keep existing behavior for the moment.
25404 +        */
25405 +       if (!capable(CAP_NET_ADMIN))
25406 +               return -EPERM;
25407 +
25408 +       if (!dev || !netif_device_present(dev))
25409 +               return -ENODEV;
25410 +
25411 +       if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
25412 +               return -EFAULT;
25413 +
25414 +       switch (ethcmd) {
25415 +       case ETHTOOL_GSET:
25416 +               return ethtool_get_settings(dev, useraddr);
25417 +       case ETHTOOL_SSET:
25418 +               return ethtool_set_settings(dev, useraddr);
25419 +       case ETHTOOL_GDRVINFO:
25420 +               return ethtool_get_drvinfo(dev, useraddr);
25421 +       case ETHTOOL_GREGS:
25422 +               return ethtool_get_regs(dev, useraddr);
25423 +       case ETHTOOL_GWOL:
25424 +               return ethtool_get_wol(dev, useraddr);
25425 +       case ETHTOOL_SWOL:
25426 +               return ethtool_set_wol(dev, useraddr);
25427 +       case ETHTOOL_GMSGLVL:
25428 +               return ethtool_get_msglevel(dev, useraddr);
25429 +       case ETHTOOL_SMSGLVL:
25430 +               return ethtool_set_msglevel(dev, useraddr);
25431 +       case ETHTOOL_NWAY_RST:
25432 +               return ethtool_nway_reset(dev);
25433 +       case ETHTOOL_GLINK:
25434 +               return ethtool_get_link(dev, useraddr);
25435 +       case ETHTOOL_GEEPROM:
25436 +               return ethtool_get_eeprom(dev, useraddr);
25437 +       case ETHTOOL_SEEPROM:
25438 +               return ethtool_set_eeprom(dev, useraddr);
25439 +       case ETHTOOL_GCOALESCE:
25440 +               return ethtool_get_coalesce(dev, useraddr);
25441 +       case ETHTOOL_SCOALESCE:
25442 +               return ethtool_set_coalesce(dev, useraddr);
25443 +       case ETHTOOL_GRINGPARAM:
25444 +               return ethtool_get_ringparam(dev, useraddr);
25445 +       case ETHTOOL_SRINGPARAM:
25446 +               return ethtool_set_ringparam(dev, useraddr);
25447 +       case ETHTOOL_GPAUSEPARAM:
25448 +               return ethtool_get_pauseparam(dev, useraddr);
25449 +       case ETHTOOL_SPAUSEPARAM:
25450 +               return ethtool_set_pauseparam(dev, useraddr);
25451 +       case ETHTOOL_GRXCSUM:
25452 +               return ethtool_get_rx_csum(dev, useraddr);
25453 +       case ETHTOOL_SRXCSUM:
25454 +               return ethtool_set_rx_csum(dev, useraddr);
25455 +       case ETHTOOL_GTXCSUM:
25456 +               return ethtool_get_tx_csum(dev, useraddr);
25457 +       case ETHTOOL_STXCSUM:
25458 +               return ethtool_set_tx_csum(dev, useraddr);
25459 +       case ETHTOOL_GSG:
25460 +               return ethtool_get_sg(dev, useraddr);
25461 +       case ETHTOOL_SSG:
25462 +               return ethtool_set_sg(dev, useraddr);
25463 +       case ETHTOOL_GTSO:
25464 +               return ethtool_get_tso(dev, useraddr);
25465 +       case ETHTOOL_STSO:
25466 +               return ethtool_set_tso(dev, useraddr);
25467 +       case ETHTOOL_TEST:
25468 +               return ethtool_self_test(dev, useraddr);
25469 +       case ETHTOOL_GSTRINGS:
25470 +               return ethtool_get_strings(dev, useraddr);
25471 +       case ETHTOOL_PHYS_ID:
25472 +               return ethtool_phys_id(dev, useraddr);
25473 +       case ETHTOOL_GSTATS:
25474 +               return ethtool_get_stats(dev, useraddr);
25475 +       default:
25476 +               return -EOPNOTSUPP;
25477 +       }
25478 +
25479 +       return -EOPNOTSUPP;
25480 +}
25481 +
25482 +#define mii_if_info _kc_mii_if_info
25483 +struct _kc_mii_if_info {
25484 +       int phy_id;
25485 +       int advertising;
25486 +       int phy_id_mask;
25487 +       int reg_num_mask;
25488 +
25489 +       unsigned int full_duplex : 1;   /* is full duplex? */
25490 +       unsigned int force_media : 1;   /* is autoneg. disabled? */
25491 +
25492 +       struct net_device *dev;
25493 +       int (*mdio_read) (struct net_device *dev, int phy_id, int location);
25494 +       void (*mdio_write) (struct net_device *dev, int phy_id, int location, int val);
25495 +};
25496 +
25497 +struct ethtool_cmd;
25498 +struct mii_ioctl_data;
25499 +
25500 +#undef mii_link_ok
25501 +#define mii_link_ok _kc_mii_link_ok
25502 +#undef mii_nway_restart
25503 +#define mii_nway_restart _kc_mii_nway_restart
25504 +#undef mii_ethtool_gset
25505 +#define mii_ethtool_gset _kc_mii_ethtool_gset
25506 +#undef mii_ethtool_sset
25507 +#define mii_ethtool_sset _kc_mii_ethtool_sset
25508 +#undef mii_check_link
25509 +#define mii_check_link _kc_mii_check_link
25510 +#undef generic_mii_ioctl
25511 +#define generic_mii_ioctl _kc_generic_mii_ioctl
25512 +extern int _kc_mii_link_ok (struct mii_if_info *mii);
25513 +extern int _kc_mii_nway_restart (struct mii_if_info *mii);
25514 +extern int _kc_mii_ethtool_gset(struct mii_if_info *mii,
25515 +                                struct ethtool_cmd *ecmd);
25516 +extern int _kc_mii_ethtool_sset(struct mii_if_info *mii,
25517 +                                struct ethtool_cmd *ecmd);
25518 +extern void _kc_mii_check_link (struct mii_if_info *mii);
25519 +extern int _kc_generic_mii_ioctl(struct mii_if_info *mii_if,
25520 +                                 struct mii_ioctl_data *mii_data, int cmd,
25521 +                                 unsigned int *duplex_changed);
25522 +
25523 +
25524 +struct _kc_pci_dev_ext {
25525 +       struct pci_dev *dev;
25526 +       void *pci_drvdata;
25527 +       struct pci_driver *driver;
25528 +};
25529 +
25530 +struct _kc_net_dev_ext {
25531 +       struct net_device *dev;
25532 +       unsigned int carrier;
25533 +};
25534 +
25535 +
25536 +/**************************************/
25537 +/* mii support */
25538 +
25539 +int _kc_mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
25540 +{
25541 +       struct net_device *dev = mii->dev;
25542 +       u32 advert, bmcr, lpa, nego;
25543 +
25544 +       ecmd->supported =
25545 +           (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
25546 +            SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
25547 +            SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII);
25548 +
25549 +       /* only supports twisted-pair */
25550 +       ecmd->port = PORT_MII;
25551 +
25552 +       /* only supports internal transceiver */
25553 +       ecmd->transceiver = XCVR_INTERNAL;
25554 +
25555 +       /* this isn't fully supported at higher layers */
25556 +       ecmd->phy_address = mii->phy_id;
25557 +
25558 +       ecmd->advertising = ADVERTISED_TP | ADVERTISED_MII;
25559 +       advert = mii->mdio_read(dev, mii->phy_id, MII_ADVERTISE);
25560 +       if (advert & ADVERTISE_10HALF)
25561 +               ecmd->advertising |= ADVERTISED_10baseT_Half;
25562 +       if (advert & ADVERTISE_10FULL)
25563 +               ecmd->advertising |= ADVERTISED_10baseT_Full;
25564 +       if (advert & ADVERTISE_100HALF)
25565 +               ecmd->advertising |= ADVERTISED_100baseT_Half;
25566 +       if (advert & ADVERTISE_100FULL)
25567 +               ecmd->advertising |= ADVERTISED_100baseT_Full;
25568 +
25569 +       bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR);
25570 +       lpa = mii->mdio_read(dev, mii->phy_id, MII_LPA);
25571 +       if (bmcr & BMCR_ANENABLE) {
25572 +               ecmd->advertising |= ADVERTISED_Autoneg;
25573 +               ecmd->autoneg = AUTONEG_ENABLE;
25574 +               
25575 +               nego = mii_nway_result(advert & lpa);
25576 +               if (nego == LPA_100FULL || nego == LPA_100HALF)
25577 +                       ecmd->speed = SPEED_100;
25578 +               else
25579 +                       ecmd->speed = SPEED_10;
25580 +               if (nego == LPA_100FULL || nego == LPA_10FULL) {
25581 +                       ecmd->duplex = DUPLEX_FULL;
25582 +                       mii->full_duplex = 1;
25583 +               } else {
25584 +                       ecmd->duplex = DUPLEX_HALF;
25585 +                       mii->full_duplex = 0;
25586 +               }
25587 +       } else {
25588 +               ecmd->autoneg = AUTONEG_DISABLE;
25589 +
25590 +               ecmd->speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
25591 +               ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;
25592 +       }
25593 +
25594 +       /* ignore maxtxpkt, maxrxpkt for now */
25595 +
25596 +       return 0;
25597 +}
25598 +
25599 +int _kc_mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
25600 +{
25601 +       struct net_device *dev = mii->dev;
25602 +
25603 +       if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100)
25604 +               return -EINVAL;
25605 +       if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
25606 +               return -EINVAL;
25607 +       if (ecmd->port != PORT_MII)
25608 +               return -EINVAL;
25609 +       if (ecmd->transceiver != XCVR_INTERNAL)
25610 +               return -EINVAL;
25611 +       if (ecmd->phy_address != mii->phy_id)
25612 +               return -EINVAL;
25613 +       if (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE)
25614 +               return -EINVAL;
25615 +                                 
25616 +       /* ignore supported, maxtxpkt, maxrxpkt */
25617 +       
25618 +       if (ecmd->autoneg == AUTONEG_ENABLE) {
25619 +               u32 bmcr, advert, tmp;
25620 +
25621 +               if ((ecmd->advertising & (ADVERTISED_10baseT_Half |
25622 +                                         ADVERTISED_10baseT_Full |
25623 +                                         ADVERTISED_100baseT_Half |
25624 +                                         ADVERTISED_100baseT_Full)) == 0)
25625 +                       return -EINVAL;
25626 +
25627 +               /* advertise only what has been requested */
25628 +               advert = mii->mdio_read(dev, mii->phy_id, MII_ADVERTISE);
25629 +               tmp = advert & ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
25630 +               if (ADVERTISED_10baseT_Half)
25631 +                       tmp |= ADVERTISE_10HALF;
25632 +               if (ADVERTISED_10baseT_Full)
25633 +                       tmp |= ADVERTISE_10FULL;
25634 +               if (ADVERTISED_100baseT_Half)
25635 +                       tmp |= ADVERTISE_100HALF;
25636 +               if (ADVERTISED_100baseT_Full)
25637 +                       tmp |= ADVERTISE_100FULL;
25638 +               if (advert != tmp) {
25639 +                       mii->mdio_write(dev, mii->phy_id, MII_ADVERTISE, tmp);
25640 +                       mii->advertising = tmp;
25641 +               }
25642 +               
25643 +               /* turn on autonegotiation, and force a renegotiate */
25644 +               bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR);
25645 +               bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
25646 +               mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr);
25647 +
25648 +               mii->force_media = 0;
25649 +       } else {
25650 +               u32 bmcr, tmp;
25651 +
25652 +               /* turn off auto negotiation, set speed and duplexity */
25653 +               bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR);
25654 +               tmp = bmcr & ~(BMCR_ANENABLE | BMCR_SPEED100 | BMCR_FULLDPLX);
25655 +               if (ecmd->speed == SPEED_100)
25656 +                       tmp |= BMCR_SPEED100;
25657 +               if (ecmd->duplex == DUPLEX_FULL) {
25658 +                       tmp |= BMCR_FULLDPLX;
25659 +                       mii->full_duplex = 1;
25660 +               } else
25661 +                       mii->full_duplex = 0;
25662 +               if (bmcr != tmp)
25663 +                       mii->mdio_write(dev, mii->phy_id, MII_BMCR, tmp);
25664 +
25665 +               mii->force_media = 1;
25666 +       }
25667 +       return 0;
25668 +}
25669 +
25670 +int _kc_mii_link_ok (struct mii_if_info *mii)
25671 +{
25672 +       /* first, a dummy read, needed to latch some MII phys */
25673 +       mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR);
25674 +       if (mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR) & BMSR_LSTATUS)
25675 +               return 1;
25676 +       return 0;
25677 +}
25678 +
25679 +int _kc_mii_nway_restart (struct mii_if_info *mii)
25680 +{
25681 +       int bmcr;
25682 +       int r = -EINVAL;
25683 +
25684 +       /* if autoneg is off, it's an error */
25685 +       bmcr = mii->mdio_read(mii->dev, mii->phy_id, MII_BMCR);
25686 +
25687 +       if (bmcr & BMCR_ANENABLE) {
25688 +               bmcr |= BMCR_ANRESTART;
25689 +               mii->mdio_write(mii->dev, mii->phy_id, MII_BMCR, bmcr);
25690 +               r = 0;
25691 +       }
25692 +
25693 +       return r;
25694 +}
25695 +
25696 +void _kc_mii_check_link (struct mii_if_info *mii)
25697 +{
25698 +       int cur_link = mii_link_ok(mii);
25699 +       int prev_link = netif_carrier_ok(mii->dev);
25700 +
25701 +       if (cur_link && !prev_link)
25702 +               netif_carrier_on(mii->dev);
25703 +       else if (prev_link && !cur_link)
25704 +               netif_carrier_off(mii->dev);
25705 +}
25706 +
25707 +int _kc_generic_mii_ioctl(struct mii_if_info *mii_if,
25708 +                          struct mii_ioctl_data *mii_data, int cmd,
25709 +                          unsigned int *duplex_chg_out)
25710 +{
25711 +       int rc = 0;
25712 +       unsigned int duplex_changed = 0;
25713 +
25714 +       if (duplex_chg_out)
25715 +               *duplex_chg_out = 0;
25716 +
25717 +       mii_data->phy_id &= mii_if->phy_id_mask;
25718 +       mii_data->reg_num &= mii_if->reg_num_mask;
25719 +
25720 +       switch(cmd) {
25721 +       case SIOCDEVPRIVATE:    /* binary compat, remove in 2.5 */
25722 +       case SIOCGMIIPHY:
25723 +               mii_data->phy_id = mii_if->phy_id;
25724 +               /* fall through */
25725 +
25726 +       case SIOCDEVPRIVATE + 1:/* binary compat, remove in 2.5 */
25727 +       case SIOCGMIIREG:
25728 +               mii_data->val_out =
25729 +                       mii_if->mdio_read(mii_if->dev, mii_data->phy_id,
25730 +                                         mii_data->reg_num);
25731 +               break;
25732 +
25733 +       case SIOCDEVPRIVATE + 2:/* binary compat, remove in 2.5 */
25734 +       case SIOCSMIIREG: {
25735 +               u16 val = mii_data->val_in;
25736 +
25737 +               if (!capable(CAP_NET_ADMIN))
25738 +                       return -EPERM;
25739 +
25740 +               if (mii_data->phy_id == mii_if->phy_id) {
25741 +                       switch(mii_data->reg_num) {
25742 +                       case MII_BMCR: {
25743 +                               unsigned int new_duplex = 0;
25744 +                               if (val & (BMCR_RESET|BMCR_ANENABLE))
25745 +                                       mii_if->force_media = 0;
25746 +                               else
25747 +                                       mii_if->force_media = 1;
25748 +                               if (mii_if->force_media &&
25749 +                                   (val & BMCR_FULLDPLX))
25750 +                                       new_duplex = 1;
25751 +                               if (mii_if->full_duplex != new_duplex) {
25752 +                                       duplex_changed = 1;
25753 +                                       mii_if->full_duplex = new_duplex;
25754 +                               }
25755 +                               break;
25756 +                       }
25757 +                       case MII_ADVERTISE:
25758 +                               mii_if->advertising = val;
25759 +                               break;
25760 +                       default:
25761 +                               /* do nothing */
25762 +                               break;
25763 +                       }
25764 +               }
25765 +
25766 +               mii_if->mdio_write(mii_if->dev, mii_data->phy_id,
25767 +                                  mii_data->reg_num, val);
25768 +               break;
25769 +       }
25770 +
25771 +       default:
25772 +               rc = -EOPNOTSUPP;
25773 +               break;
25774 +       }
25775 +
25776 +       if ((rc == 0) && (duplex_chg_out) && (duplex_changed))
25777 +               *duplex_chg_out = 1;
25778 +
25779 +       return rc;
25780 +}
25781 +
25782 diff -Nru vanilla/drivers/net/igb/kcompat.h linux-i686-2.6.22/drivers/net/igb/kcompat.h
25783 --- vanilla/drivers/net/igb/kcompat.h   1969-12-31 19:00:00.000000000 -0500
25784 +++ linux-i686-2.6.22/drivers/net/igb/kcompat.h 2009-07-16 19:25:22.000000000 -0400
25785 @@ -0,0 +1,1637 @@
25786 +/*******************************************************************************
25787 +
25788 +  Intel(R) Gigabit Ethernet Linux driver
25789 +  Copyright(c) 2007-2008 Intel Corporation.
25790 +
25791 +  This program is free software; you can redistribute it and/or modify it
25792 +  under the terms and conditions of the GNU General Public License,
25793 +  version 2, as published by the Free Software Foundation.
25794 +
25795 +  This program is distributed in the hope it will be useful, but WITHOUT
25796 +  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25797 +  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
25798 +  more details.
25799 +
25800 +  You should have received a copy of the GNU General Public License along with
25801 +  this program; if not, write to the Free Software Foundation, Inc.,
25802 +  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
25803 +
25804 +  The full GNU General Public License is included in this distribution in
25805 +  the file called "COPYING".
25806 +
25807 +  Contact Information:
25808 +  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25809 +  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25810 +
25811 +*******************************************************************************/
25812 +
25813 +#ifndef _KCOMPAT_H_
25814 +#define _KCOMPAT_H_
25815 +
25816 +#include <linux/version.h>
25817 +#include <linux/init.h>
25818 +#include <linux/types.h>
25819 +#include <linux/errno.h>
25820 +#include <linux/module.h>
25821 +#include <linux/pci.h>
25822 +#include <linux/netdevice.h>
25823 +#include <linux/etherdevice.h>
25824 +#include <linux/skbuff.h>
25825 +#include <linux/ioport.h>
25826 +#include <linux/slab.h>
25827 +#include <linux/list.h>
25828 +#include <linux/delay.h>
25829 +#include <linux/sched.h>
25830 +#include <linux/in.h>
25831 +#include <linux/ip.h>
25832 +#include <linux/udp.h>
25833 +#include <linux/mii.h>
25834 +#include <asm/io.h>
25835 +
25836 +/* NAPI enable/disable flags here */
25837 +
25838 +
25839 +#ifdef _E1000_H_
25840 +#ifdef CONFIG_E1000_NAPI
25841 +#define NAPI
25842 +#endif
25843 +#ifdef E1000_NAPI
25844 +#undef NAPI
25845 +#define NAPI
25846 +#endif
25847 +#ifdef E1000E_NAPI
25848 +#undef NAPI
25849 +#define NAPI
25850 +#endif
25851 +#ifdef E1000_NO_NAPI
25852 +#undef NAPI
25853 +#endif
25854 +#ifdef E1000E_NO_NAPI
25855 +#undef NAPI
25856 +#endif
25857 +#endif
25858 +
25859 +#ifdef _IGB_H_
25860 +#define NAPI
25861 +#endif
25862 +
25863 +
25864 +
25865 +
25866 +
25867 +
25868 +
25869 +#define adapter_struct igb_adapter
25870 +#define NAPI
25871 +
25872 +
25873 +
25874 +/* and finally set defines so that the code sees the changes */
25875 +#ifdef NAPI
25876 +#ifndef CONFIG_E1000_NAPI
25877 +#define CONFIG_E1000_NAPI
25878 +#endif
25879 +#ifndef CONFIG_E1000E_NAPI
25880 +#define CONFIG_E1000E_NAPI
25881 +#endif
25882 +#else
25883 +#undef CONFIG_E1000_NAPI
25884 +#undef CONFIG_E1000E_NAPI
25885 +#undef CONFIG_IXGB_NAPI
25886 +#endif
25887 +
25888 +/* packet split disable/enable */
25889 +#ifdef DISABLE_PACKET_SPLIT
25890 +#undef CONFIG_E1000_DISABLE_PACKET_SPLIT
25891 +#define CONFIG_E1000_DISABLE_PACKET_SPLIT
25892 +#undef CONFIG_IGB_DISABLE_PACKET_SPLIT
25893 +#define CONFIG_IGB_DISABLE_PACKET_SPLIT
25894 +#endif
25895 +
25896 +/* MSI compatibility code for all kernels and drivers */
25897 +#ifdef DISABLE_PCI_MSI
25898 +#undef CONFIG_PCI_MSI
25899 +#endif
25900 +#ifndef CONFIG_PCI_MSI
25901 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) )
25902 +struct msix_entry {
25903 +       u16 vector; /* kernel uses to write allocated vector */
25904 +       u16 entry;  /* driver uses to specify entry, OS writes */
25905 +};
25906 +#endif
25907 +#define pci_enable_msi(a) -ENOTSUPP
25908 +#define pci_disable_msi(a) do {} while (0)
25909 +#define pci_enable_msix(a, b, c) -ENOTSUPP
25910 +#define pci_disable_msix(a) do {} while (0)
25911 +#define msi_remove_pci_irq_vectors(a) do {} while (0)
25912 +#endif /* CONFIG_PCI_MSI */
25913 +#ifdef DISABLE_PM
25914 +#undef CONFIG_PM
25915 +#endif
25916 +
25917 +#ifdef DISABLE_NET_POLL_CONTROLLER
25918 +#undef CONFIG_NET_POLL_CONTROLLER
25919 +#endif
25920 +
25921 +#ifndef PMSG_SUSPEND
25922 +#define PMSG_SUSPEND 3
25923 +#endif
25924 +
25925 +/* generic boolean compatibility */
25926 +#undef TRUE
25927 +#undef FALSE
25928 +#define TRUE true
25929 +#define FALSE false
25930 +#ifdef GCC_VERSION
25931 +#if ( GCC_VERSION < 3000 )
25932 +#define _Bool char
25933 +#endif
25934 +#endif
25935 +#ifndef bool
25936 +#define bool _Bool
25937 +#define true 1
25938 +#define false 0
25939 +#endif
25940 +
25941 +
25942 +#ifndef module_param
25943 +#define module_param(v,t,p) MODULE_PARM(v, "i");
25944 +#endif
25945 +
25946 +#ifndef DMA_64BIT_MASK
25947 +#define DMA_64BIT_MASK  0xffffffffffffffffULL
25948 +#endif
25949 +
25950 +#ifndef DMA_32BIT_MASK
25951 +#define DMA_32BIT_MASK  0x00000000ffffffffULL
25952 +#endif
25953 +
25954 +#ifndef PCI_CAP_ID_EXP
25955 +#define PCI_CAP_ID_EXP 0x10
25956 +#endif
25957 +
25958 +#ifndef mmiowb
25959 +#ifdef CONFIG_IA64
25960 +#define mmiowb() asm volatile ("mf.a" ::: "memory")
25961 +#else
25962 +#define mmiowb()
25963 +#endif
25964 +#endif
25965 +
25966 +#ifndef IRQ_HANDLED
25967 +#define irqreturn_t void
25968 +#define IRQ_HANDLED
25969 +#define IRQ_NONE
25970 +#endif
25971 +
25972 +#ifndef SET_NETDEV_DEV
25973 +#define SET_NETDEV_DEV(net, pdev)
25974 +#endif
25975 +
25976 +#ifndef HAVE_FREE_NETDEV
25977 +#define free_netdev(x) kfree(x)
25978 +#endif
25979 +
25980 +#ifdef HAVE_POLL_CONTROLLER
25981 +#define CONFIG_NET_POLL_CONTROLLER
25982 +#endif
25983 +
25984 +#ifndef NETDEV_TX_OK
25985 +#define NETDEV_TX_OK 0
25986 +#endif
25987 +
25988 +#ifndef NETDEV_TX_BUSY
25989 +#define NETDEV_TX_BUSY 1
25990 +#endif
25991 +
25992 +#ifndef NETDEV_TX_LOCKED
25993 +#define NETDEV_TX_LOCKED -1
25994 +#endif
25995 +
25996 +#ifndef SKB_DATAREF_SHIFT
25997 +/* if we do not have the infrastructure to detect if skb_header is cloned
25998 +   just return false in all cases */
25999 +#define skb_header_cloned(x) 0
26000 +#endif
26001 +
26002 +#ifndef NETIF_F_GSO
26003 +#define gso_size tso_size
26004 +#define gso_segs tso_segs
26005 +#endif
26006 +
26007 +#ifndef CHECKSUM_PARTIAL
26008 +#define CHECKSUM_PARTIAL CHECKSUM_HW
26009 +#define CHECKSUM_COMPLETE CHECKSUM_HW
26010 +#endif
26011 +
26012 +#ifndef __read_mostly
26013 +#define __read_mostly
26014 +#endif
26015 +
26016 +#ifndef HAVE_NETIF_MSG
26017 +#define HAVE_NETIF_MSG 1
26018 +enum {
26019 +       NETIF_MSG_DRV           = 0x0001,
26020 +       NETIF_MSG_PROBE         = 0x0002,
26021 +       NETIF_MSG_LINK          = 0x0004,
26022 +       NETIF_MSG_TIMER         = 0x0008,
26023 +       NETIF_MSG_IFDOWN        = 0x0010,
26024 +       NETIF_MSG_IFUP          = 0x0020,
26025 +       NETIF_MSG_RX_ERR        = 0x0040,
26026 +       NETIF_MSG_TX_ERR        = 0x0080,
26027 +       NETIF_MSG_TX_QUEUED     = 0x0100,
26028 +       NETIF_MSG_INTR          = 0x0200,
26029 +       NETIF_MSG_TX_DONE       = 0x0400,
26030 +       NETIF_MSG_RX_STATUS     = 0x0800,
26031 +       NETIF_MSG_PKTDATA       = 0x1000,
26032 +       NETIF_MSG_HW            = 0x2000,
26033 +       NETIF_MSG_WOL           = 0x4000,
26034 +};
26035 +
26036 +#else
26037 +#define NETIF_MSG_HW   0x2000
26038 +#define NETIF_MSG_WOL  0x4000
26039 +#endif /* HAVE_NETIF_MSG */
26040 +
26041 +#ifndef MII_RESV1
26042 +#define MII_RESV1              0x17            /* Reserved...          */
26043 +#endif
26044 +
26045 +#ifndef unlikely
26046 +#define unlikely(_x) _x
26047 +#define likely(_x) _x
26048 +#endif
26049 +
26050 +#ifndef WARN_ON
26051 +#define WARN_ON(x)
26052 +#endif
26053 +
26054 +#ifndef PCI_DEVICE
26055 +#define PCI_DEVICE(vend,dev) \
26056 +       .vendor = (vend), .device = (dev), \
26057 +       .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
26058 +#endif
26059 +
26060 +#ifndef num_online_cpus
26061 +#define num_online_cpus() smp_num_cpus
26062 +#endif
26063 +
26064 +#ifndef _LINUX_RANDOM_H
26065 +#include <linux/random.h>
26066 +#endif
26067 +
26068 +#ifndef DECLARE_BITMAP
26069 +#ifndef BITS_TO_LONGS
26070 +#define BITS_TO_LONGS(bits) (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
26071 +#endif
26072 +#define DECLARE_BITMAP(name,bits) long name[BITS_TO_LONGS(bits)]
26073 +#endif
26074 +
26075 +#ifndef VLAN_HLEN
26076 +#define VLAN_HLEN 4
26077 +#endif
26078 +
26079 +#ifndef VLAN_ETH_HLEN
26080 +#define VLAN_ETH_HLEN 18
26081 +#endif
26082 +
26083 +#ifndef VLAN_ETH_FRAME_LEN
26084 +#define VLAN_ETH_FRAME_LEN 1518
26085 +#endif
26086 +
26087 +#ifndef DCA_GET_TAG_TWO_ARGS
26088 +#define dca3_get_tag(a,b) dca_get_tag(b)
26089 +#endif
26090 +
26091 +
26092 +/*****************************************************************************/
26093 +/* Installations with ethtool version without eeprom, adapter id, or statistics
26094 + * support */
26095 +
26096 +#ifndef ETH_GSTRING_LEN
26097 +#define ETH_GSTRING_LEN 32
26098 +#endif
26099 +
26100 +#ifndef ETHTOOL_GSTATS
26101 +#define ETHTOOL_GSTATS 0x1d
26102 +#undef ethtool_drvinfo
26103 +#define ethtool_drvinfo k_ethtool_drvinfo
26104 +struct k_ethtool_drvinfo {
26105 +       u32 cmd;
26106 +       char driver[32];
26107 +       char version[32];
26108 +       char fw_version[32];
26109 +       char bus_info[32];
26110 +       char reserved1[32];
26111 +       char reserved2[16];
26112 +       u32 n_stats;
26113 +       u32 testinfo_len;
26114 +       u32 eedump_len;
26115 +       u32 regdump_len;
26116 +};
26117 +
26118 +struct ethtool_stats {
26119 +       u32 cmd;
26120 +       u32 n_stats;
26121 +       u64 data[0];
26122 +};
26123 +#endif /* ETHTOOL_GSTATS */
26124 +
26125 +#ifndef ETHTOOL_PHYS_ID
26126 +#define ETHTOOL_PHYS_ID 0x1c
26127 +#endif /* ETHTOOL_PHYS_ID */
26128 +
26129 +#ifndef ETHTOOL_GSTRINGS
26130 +#define ETHTOOL_GSTRINGS 0x1b
26131 +enum ethtool_stringset {
26132 +       ETH_SS_TEST             = 0,
26133 +       ETH_SS_STATS,
26134 +};
26135 +struct ethtool_gstrings {
26136 +       u32 cmd;            /* ETHTOOL_GSTRINGS */
26137 +       u32 string_set;     /* string set id e.c. ETH_SS_TEST, etc*/
26138 +       u32 len;            /* number of strings in the string set */
26139 +       u8 data[0];
26140 +};
26141 +#endif /* ETHTOOL_GSTRINGS */
26142 +
26143 +#ifndef ETHTOOL_TEST
26144 +#define ETHTOOL_TEST 0x1a
26145 +enum ethtool_test_flags {
26146 +       ETH_TEST_FL_OFFLINE     = (1 << 0),
26147 +       ETH_TEST_FL_FAILED      = (1 << 1),
26148 +};
26149 +struct ethtool_test {
26150 +       u32 cmd;
26151 +       u32 flags;
26152 +       u32 reserved;
26153 +       u32 len;
26154 +       u64 data[0];
26155 +};
26156 +#endif /* ETHTOOL_TEST */
26157 +
26158 +#ifndef ETHTOOL_GEEPROM
26159 +#define ETHTOOL_GEEPROM 0xb
26160 +#undef ETHTOOL_GREGS
26161 +struct ethtool_eeprom {
26162 +       u32 cmd;
26163 +       u32 magic;
26164 +       u32 offset;
26165 +       u32 len;
26166 +       u8 data[0];
26167 +};
26168 +
26169 +struct ethtool_value {
26170 +       u32 cmd;
26171 +       u32 data;
26172 +};
26173 +#endif /* ETHTOOL_GEEPROM */
26174 +
26175 +#ifndef ETHTOOL_GLINK
26176 +#define ETHTOOL_GLINK 0xa
26177 +#endif /* ETHTOOL_GLINK */
26178 +
26179 +#ifndef ETHTOOL_GREGS
26180 +#define ETHTOOL_GREGS          0x00000004 /* Get NIC registers */
26181 +#define ethtool_regs _kc_ethtool_regs
26182 +/* for passing big chunks of data */
26183 +struct _kc_ethtool_regs {
26184 +       u32 cmd;
26185 +       u32 version; /* driver-specific, indicates different chips/revs */
26186 +       u32 len; /* bytes */
26187 +       u8 data[0];
26188 +};
26189 +#endif /* ETHTOOL_GREGS */
26190 +
26191 +#ifndef ETHTOOL_GMSGLVL
26192 +#define ETHTOOL_GMSGLVL                0x00000007 /* Get driver message level */
26193 +#endif
26194 +#ifndef ETHTOOL_SMSGLVL
26195 +#define ETHTOOL_SMSGLVL                0x00000008 /* Set driver msg level, priv. */
26196 +#endif
26197 +#ifndef ETHTOOL_NWAY_RST
26198 +#define ETHTOOL_NWAY_RST       0x00000009 /* Restart autonegotiation, priv */
26199 +#endif
26200 +#ifndef ETHTOOL_GLINK
26201 +#define ETHTOOL_GLINK          0x0000000a /* Get link status */
26202 +#endif
26203 +#ifndef ETHTOOL_GEEPROM
26204 +#define ETHTOOL_GEEPROM                0x0000000b /* Get EEPROM data */
26205 +#endif
26206 +#ifndef ETHTOOL_SEEPROM
26207 +#define ETHTOOL_SEEPROM                0x0000000c /* Set EEPROM data */
26208 +#endif
26209 +#ifndef ETHTOOL_GCOALESCE
26210 +#define ETHTOOL_GCOALESCE      0x0000000e /* Get coalesce config */
26211 +/* for configuring coalescing parameters of chip */
26212 +#define ethtool_coalesce _kc_ethtool_coalesce
26213 +struct _kc_ethtool_coalesce {
26214 +       u32     cmd;    /* ETHTOOL_{G,S}COALESCE */
26215 +
26216 +       /* How many usecs to delay an RX interrupt after
26217 +        * a packet arrives.  If 0, only rx_max_coalesced_frames
26218 +        * is used.
26219 +        */
26220 +       u32     rx_coalesce_usecs;
26221 +
26222 +       /* How many packets to delay an RX interrupt after
26223 +        * a packet arrives.  If 0, only rx_coalesce_usecs is
26224 +        * used.  It is illegal to set both usecs and max frames
26225 +        * to zero as this would cause RX interrupts to never be
26226 +        * generated.
26227 +        */
26228 +       u32     rx_max_coalesced_frames;
26229 +
26230 +       /* Same as above two parameters, except that these values
26231 +        * apply while an IRQ is being serviced by the host.  Not
26232 +        * all cards support this feature and the values are ignored
26233 +        * in that case.
26234 +        */
26235 +       u32     rx_coalesce_usecs_irq;
26236 +       u32     rx_max_coalesced_frames_irq;
26237 +
26238 +       /* How many usecs to delay a TX interrupt after
26239 +        * a packet is sent.  If 0, only tx_max_coalesced_frames
26240 +        * is used.
26241 +        */
26242 +       u32     tx_coalesce_usecs;
26243 +
26244 +       /* How many packets to delay a TX interrupt after
26245 +        * a packet is sent.  If 0, only tx_coalesce_usecs is
26246 +        * used.  It is illegal to set both usecs and max frames
26247 +        * to zero as this would cause TX interrupts to never be
26248 +        * generated.
26249 +        */
26250 +       u32     tx_max_coalesced_frames;
26251 +
26252 +       /* Same as above two parameters, except that these values
26253 +        * apply while an IRQ is being serviced by the host.  Not
26254 +        * all cards support this feature and the values are ignored
26255 +        * in that case.
26256 +        */
26257 +       u32     tx_coalesce_usecs_irq;
26258 +       u32     tx_max_coalesced_frames_irq;
26259 +
26260 +       /* How many usecs to delay in-memory statistics
26261 +        * block updates.  Some drivers do not have an in-memory
26262 +        * statistic block, and in such cases this value is ignored.
26263 +        * This value must not be zero.
26264 +        */
26265 +       u32     stats_block_coalesce_usecs;
26266 +
26267 +       /* Adaptive RX/TX coalescing is an algorithm implemented by
26268 +        * some drivers to improve latency under low packet rates and
26269 +        * improve throughput under high packet rates.  Some drivers
26270 +        * only implement one of RX or TX adaptive coalescing.  Anything
26271 +        * not implemented by the driver causes these values to be
26272 +        * silently ignored.
26273 +        */
26274 +       u32     use_adaptive_rx_coalesce;
26275 +       u32     use_adaptive_tx_coalesce;
26276 +
26277 +       /* When the packet rate (measured in packets per second)
26278 +        * is below pkt_rate_low, the {rx,tx}_*_low parameters are
26279 +        * used.
26280 +        */
26281 +       u32     pkt_rate_low;
26282 +       u32     rx_coalesce_usecs_low;
26283 +       u32     rx_max_coalesced_frames_low;
26284 +       u32     tx_coalesce_usecs_low;
26285 +       u32     tx_max_coalesced_frames_low;
26286 +
26287 +       /* When the packet rate is below pkt_rate_high but above
26288 +        * pkt_rate_low (both measured in packets per second) the
26289 +        * normal {rx,tx}_* coalescing parameters are used.
26290 +        */
26291 +
26292 +       /* When the packet rate is (measured in packets per second)
26293 +        * is above pkt_rate_high, the {rx,tx}_*_high parameters are
26294 +        * used.
26295 +        */
26296 +       u32     pkt_rate_high;
26297 +       u32     rx_coalesce_usecs_high;
26298 +       u32     rx_max_coalesced_frames_high;
26299 +       u32     tx_coalesce_usecs_high;
26300 +       u32     tx_max_coalesced_frames_high;
26301 +
26302 +       /* How often to do adaptive coalescing packet rate sampling,
26303 +        * measured in seconds.  Must not be zero.
26304 +        */
26305 +       u32     rate_sample_interval;
26306 +};
26307 +#endif /* ETHTOOL_GCOALESCE */
26308 +
26309 +#ifndef ETHTOOL_SCOALESCE
26310 +#define ETHTOOL_SCOALESCE      0x0000000f /* Set coalesce config. */
26311 +#endif
26312 +#ifndef ETHTOOL_GRINGPARAM
26313 +#define ETHTOOL_GRINGPARAM     0x00000010 /* Get ring parameters */
26314 +/* for configuring RX/TX ring parameters */
26315 +#define ethtool_ringparam _kc_ethtool_ringparam
26316 +struct _kc_ethtool_ringparam {
26317 +       u32     cmd;    /* ETHTOOL_{G,S}RINGPARAM */
26318 +
26319 +       /* Read only attributes.  These indicate the maximum number
26320 +        * of pending RX/TX ring entries the driver will allow the
26321 +        * user to set.
26322 +        */
26323 +       u32     rx_max_pending;
26324 +       u32     rx_mini_max_pending;
26325 +       u32     rx_jumbo_max_pending;
26326 +       u32     tx_max_pending;
26327 +
26328 +       /* Values changeable by the user.  The valid values are
26329 +        * in the range 1 to the "*_max_pending" counterpart above.
26330 +        */
26331 +       u32     rx_pending;
26332 +       u32     rx_mini_pending;
26333 +       u32     rx_jumbo_pending;
26334 +       u32     tx_pending;
26335 +};
26336 +#endif /* ETHTOOL_GRINGPARAM */
26337 +
26338 +#ifndef ETHTOOL_SRINGPARAM
26339 +#define ETHTOOL_SRINGPARAM     0x00000011 /* Set ring parameters, priv. */
26340 +#endif
26341 +#ifndef ETHTOOL_GPAUSEPARAM
26342 +#define ETHTOOL_GPAUSEPARAM    0x00000012 /* Get pause parameters */
26343 +/* for configuring link flow control parameters */
26344 +#define ethtool_pauseparam _kc_ethtool_pauseparam
26345 +struct _kc_ethtool_pauseparam {
26346 +       u32     cmd;    /* ETHTOOL_{G,S}PAUSEPARAM */
26347 +
26348 +       /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
26349 +        * being true) the user may set 'autoneg' here non-zero to have the
26350 +        * pause parameters be auto-negotiated too.  In such a case, the
26351 +        * {rx,tx}_pause values below determine what capabilities are
26352 +        * advertised.
26353 +        *
26354 +        * If 'autoneg' is zero or the link is not being auto-negotiated,
26355 +        * then {rx,tx}_pause force the driver to use/not-use pause
26356 +        * flow control.
26357 +        */
26358 +       u32     autoneg;
26359 +       u32     rx_pause;
26360 +       u32     tx_pause;
26361 +};
26362 +#endif /* ETHTOOL_GPAUSEPARAM */
26363 +
26364 +#ifndef ETHTOOL_SPAUSEPARAM
26365 +#define ETHTOOL_SPAUSEPARAM    0x00000013 /* Set pause parameters. */
26366 +#endif
26367 +#ifndef ETHTOOL_GRXCSUM
26368 +#define ETHTOOL_GRXCSUM                0x00000014 /* Get RX hw csum enable (ethtool_value) */
26369 +#endif
26370 +#ifndef ETHTOOL_SRXCSUM
26371 +#define ETHTOOL_SRXCSUM                0x00000015 /* Set RX hw csum enable (ethtool_value) */
26372 +#endif
26373 +#ifndef ETHTOOL_GTXCSUM
26374 +#define ETHTOOL_GTXCSUM                0x00000016 /* Get TX hw csum enable (ethtool_value) */
26375 +#endif
26376 +#ifndef ETHTOOL_STXCSUM
26377 +#define ETHTOOL_STXCSUM                0x00000017 /* Set TX hw csum enable (ethtool_value) */
26378 +#endif
26379 +#ifndef ETHTOOL_GSG
26380 +#define ETHTOOL_GSG            0x00000018 /* Get scatter-gather enable
26381 +                                           * (ethtool_value) */
26382 +#endif
26383 +#ifndef ETHTOOL_SSG
26384 +#define ETHTOOL_SSG            0x00000019 /* Set scatter-gather enable
26385 +                                           * (ethtool_value). */
26386 +#endif
26387 +#ifndef ETHTOOL_TEST
26388 +#define ETHTOOL_TEST           0x0000001a /* execute NIC self-test, priv. */
26389 +#endif
26390 +#ifndef ETHTOOL_GSTRINGS
26391 +#define ETHTOOL_GSTRINGS       0x0000001b /* get specified string set */
26392 +#endif
26393 +#ifndef ETHTOOL_PHYS_ID
26394 +#define ETHTOOL_PHYS_ID                0x0000001c /* identify the NIC */
26395 +#endif
26396 +#ifndef ETHTOOL_GSTATS
26397 +#define ETHTOOL_GSTATS         0x0000001d /* get NIC-specific statistics */
26398 +#endif
26399 +#ifndef ETHTOOL_GTSO
26400 +#define ETHTOOL_GTSO           0x0000001e /* Get TSO enable (ethtool_value) */
26401 +#endif
26402 +#ifndef ETHTOOL_STSO
26403 +#define ETHTOOL_STSO           0x0000001f /* Set TSO enable (ethtool_value) */
26404 +#endif
26405 +
26406 +#ifndef ETHTOOL_BUSINFO_LEN
26407 +#define ETHTOOL_BUSINFO_LEN    32
26408 +#endif
26409 +
26410 +/*****************************************************************************/
26411 +/* 2.4.3 => 2.4.0 */
26412 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) )
26413 +
26414 +/**************************************/
26415 +/* PCI DRIVER API */
26416 +
26417 +#ifndef pci_set_dma_mask
26418 +#define pci_set_dma_mask _kc_pci_set_dma_mask
26419 +extern int _kc_pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask);
26420 +#endif
26421 +
26422 +#ifndef pci_request_regions
26423 +#define pci_request_regions _kc_pci_request_regions
26424 +extern int _kc_pci_request_regions(struct pci_dev *pdev, char *res_name);
26425 +#endif
26426 +
26427 +#ifndef pci_release_regions
26428 +#define pci_release_regions _kc_pci_release_regions
26429 +extern void _kc_pci_release_regions(struct pci_dev *pdev);
26430 +#endif
26431 +
26432 +/**************************************/
26433 +/* NETWORK DRIVER API */
26434 +
26435 +#ifndef alloc_etherdev
26436 +#define alloc_etherdev _kc_alloc_etherdev
26437 +extern struct net_device * _kc_alloc_etherdev(int sizeof_priv);
26438 +#endif
26439 +
26440 +#ifndef is_valid_ether_addr
26441 +#define is_valid_ether_addr _kc_is_valid_ether_addr
26442 +extern int _kc_is_valid_ether_addr(u8 *addr);
26443 +#endif
26444 +
26445 +/**************************************/
26446 +/* MISCELLANEOUS */
26447 +
26448 +#ifndef INIT_TQUEUE
26449 +#define INIT_TQUEUE(_tq, _routine, _data)              \
26450 +       do {                                            \
26451 +               INIT_LIST_HEAD(&(_tq)->list);           \
26452 +               (_tq)->sync = 0;                        \
26453 +               (_tq)->routine = _routine;              \
26454 +               (_tq)->data = _data;                    \
26455 +       } while (0)
26456 +#endif
26457 +
26458 +#endif /* 2.4.3 => 2.4.0 */
26459 +
26460 +/*****************************************************************************/
26461 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5) )
26462 +/* Generic MII registers. */
26463 +#define MII_BMCR            0x00        /* Basic mode control register */
26464 +#define MII_BMSR            0x01        /* Basic mode status register  */
26465 +#define MII_PHYSID1         0x02        /* PHYS ID 1                   */
26466 +#define MII_PHYSID2         0x03        /* PHYS ID 2                   */
26467 +#define MII_ADVERTISE       0x04        /* Advertisement control reg   */
26468 +#define MII_LPA             0x05        /* Link partner ability reg    */
26469 +#define MII_EXPANSION       0x06        /* Expansion register          */
26470 +/* Basic mode control register. */
26471 +#define BMCR_FULLDPLX           0x0100  /* Full duplex                 */
26472 +#define BMCR_ANENABLE           0x1000  /* Enable auto negotiation     */
26473 +/* Basic mode status register. */
26474 +#define BMSR_ERCAP              0x0001  /* Ext-reg capability          */
26475 +#define BMSR_ANEGCAPABLE        0x0008  /* Able to do auto-negotiation */
26476 +#define BMSR_10HALF             0x0800  /* Can do 10mbps, half-duplex  */
26477 +#define BMSR_10FULL             0x1000  /* Can do 10mbps, full-duplex  */
26478 +#define BMSR_100HALF            0x2000  /* Can do 100mbps, half-duplex */
26479 +#define BMSR_100FULL            0x4000  /* Can do 100mbps, full-duplex */
26480 +/* Advertisement control register. */
26481 +#define ADVERTISE_CSMA          0x0001  /* Only selector supported     */
26482 +#define ADVERTISE_10HALF        0x0020  /* Try for 10mbps half-duplex  */
26483 +#define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
26484 +#define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */
26485 +#define ADVERTISE_100FULL       0x0100  /* Try for 100mbps full-duplex */
26486 +#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
26487 +                       ADVERTISE_100HALF | ADVERTISE_100FULL)
26488 +/* Expansion register for auto-negotiation. */
26489 +#define EXPANSION_ENABLENPAGE   0x0004  /* This enables npage words    */
26490 +#endif
26491 +
26492 +/*****************************************************************************/
26493 +/* 2.4.6 => 2.4.3 */
26494 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6) )
26495 +
26496 +#ifndef pci_set_power_state
26497 +#define pci_set_power_state _kc_pci_set_power_state
26498 +extern int _kc_pci_set_power_state(struct pci_dev *dev, int state);
26499 +#endif
26500 +
26501 +#ifndef pci_enable_wake
26502 +#define pci_enable_wake _kc_pci_enable_wake
26503 +extern int _kc_pci_enable_wake(struct pci_dev *pdev, u32 state, int enable);
26504 +#endif
26505 +
26506 +#ifndef pci_disable_device
26507 +#define pci_disable_device _kc_pci_disable_device
26508 +extern void _kc_pci_disable_device(struct pci_dev *pdev);
26509 +#endif
26510 +
26511 +/* PCI PM entry point syntax changed, so don't support suspend/resume */
26512 +#undef CONFIG_PM
26513 +
26514 +#endif /* 2.4.6 => 2.4.3 */
26515 +
26516 +#ifndef HAVE_PCI_SET_MWI
26517 +#define pci_set_mwi(X) pci_write_config_word(X, \
26518 +                              PCI_COMMAND, adapter->hw.bus.pci_cmd_word | \
26519 +                              PCI_COMMAND_INVALIDATE);
26520 +#define pci_clear_mwi(X) pci_write_config_word(X, \
26521 +                              PCI_COMMAND, adapter->hw.bus.pci_cmd_word & \
26522 +                              ~PCI_COMMAND_INVALIDATE);
26523 +#endif
26524 +
26525 +/*****************************************************************************/
26526 +/* 2.4.10 => 2.4.9 */
26527 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10) )
26528 +
26529 +/**************************************/
26530 +/* MODULE API */
26531 +
26532 +#ifndef MODULE_LICENSE
26533 +       #define MODULE_LICENSE(X)
26534 +#endif
26535 +
26536 +/**************************************/
26537 +/* OTHER */
26538 +
26539 +#undef min
26540 +#define min(x,y) ({ \
26541 +       const typeof(x) _x = (x);       \
26542 +       const typeof(y) _y = (y);       \
26543 +       (void) (&_x == &_y);            \
26544 +       _x < _y ? _x : _y; })
26545 +
26546 +#undef max
26547 +#define max(x,y) ({ \
26548 +       const typeof(x) _x = (x);       \
26549 +       const typeof(y) _y = (y);       \
26550 +       (void) (&_x == &_y);            \
26551 +       _x > _y ? _x : _y; })
26552 +
26553 +#ifndef list_for_each_safe
26554 +#define list_for_each_safe(pos, n, head) \
26555 +       for (pos = (head)->next, n = pos->next; pos != (head); \
26556 +               pos = n, n = pos->next)
26557 +#endif
26558 +
26559 +#endif /* 2.4.10 -> 2.4.6 */
26560 +
26561 +
26562 +/*****************************************************************************/
26563 +/* 2.4.13 => 2.4.10 */
26564 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,13) )
26565 +
26566 +/**************************************/
26567 +/* PCI DMA MAPPING */
26568 +
26569 +#ifndef virt_to_page
26570 +       #define virt_to_page(v) (mem_map + (virt_to_phys(v) >> PAGE_SHIFT))
26571 +#endif
26572 +
26573 +#ifndef pci_map_page
26574 +#define pci_map_page _kc_pci_map_page
26575 +extern u64 _kc_pci_map_page(struct pci_dev *dev, struct page *page, unsigned long offset, size_t size, int direction);
26576 +#endif
26577 +
26578 +#ifndef pci_unmap_page
26579 +#define pci_unmap_page _kc_pci_unmap_page
26580 +extern void _kc_pci_unmap_page(struct pci_dev *dev, u64 dma_addr, size_t size, int direction);
26581 +#endif
26582 +
26583 +/* pci_set_dma_mask takes dma_addr_t, which is only 32-bits prior to 2.4.13 */
26584 +
26585 +#undef DMA_32BIT_MASK
26586 +#define DMA_32BIT_MASK 0xffffffff
26587 +#undef DMA_64BIT_MASK
26588 +#define DMA_64BIT_MASK 0xffffffff
26589 +
26590 +/**************************************/
26591 +/* OTHER */
26592 +
26593 +#ifndef cpu_relax
26594 +#define cpu_relax()    rep_nop()
26595 +#endif
26596 +
26597 +#endif /* 2.4.13 => 2.4.10 */
26598 +
26599 +/*****************************************************************************/
26600 +/* 2.4.17 => 2.4.12 */
26601 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,17) )
26602 +
26603 +#ifndef __devexit_p
26604 +       #define __devexit_p(x) &(x)
26605 +#endif
26606 +
26607 +#endif /* 2.4.17 => 2.4.13 */
26608 +
26609 +/*****************************************************************************/
26610 +/* 2.4.20 => 2.4.19 */
26611 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20) )
26612 +
26613 +/* we won't support NAPI on less than 2.4.20 */
26614 +#ifdef NAPI
26615 +#undef CONFIG_E1000_NAPI
26616 +#undef CONFIG_E1000E_NAPI
26617 +#undef CONFIG_IXGB_NAPI
26618 +#endif
26619 +
26620 +#endif /* 2.4.20 => 2.4.19 */
26621 +/*****************************************************************************/
26622 +/* 2.4.22 => 2.4.17 */
26623 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) )
26624 +#define pci_name(x)    ((x)->slot_name)
26625 +#endif
26626 +
26627 +/*****************************************************************************/
26628 +/* 2.4.22 => 2.4.17 */
26629 +
26630 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) )
26631 +#endif
26632 +
26633 +/*****************************************************************************/
26634 +/*****************************************************************************/
26635 +/* 2.4.23 => 2.4.22 */
26636 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) )
26637 +/*****************************************************************************/
26638 +#ifdef NAPI
26639 +#ifndef netif_poll_disable
26640 +#define netif_poll_disable(x) _kc_netif_poll_disable(x)
26641 +static inline void _kc_netif_poll_disable(struct net_device *netdev)
26642 +{
26643 +       while (test_and_set_bit(__LINK_STATE_RX_SCHED, &netdev->state)) {
26644 +               /* No hurry */
26645 +               current->state = TASK_INTERRUPTIBLE;
26646 +               schedule_timeout(1);
26647 +       }
26648 +}
26649 +#endif
26650 +
26651 +#ifndef netif_poll_enable
26652 +#define netif_poll_enable(x) _kc_netif_poll_enable(x)
26653 +static inline void _kc_netif_poll_enable(struct net_device *netdev)
26654 +{
26655 +       clear_bit(__LINK_STATE_RX_SCHED, &netdev->state);
26656 +}
26657 +#endif
26658 +#endif /* NAPI */
26659 +#ifndef netif_tx_disable
26660 +#define netif_tx_disable(x) _kc_netif_tx_disable(x)
26661 +static inline void _kc_netif_tx_disable(struct net_device *dev)
26662 +{
26663 +       spin_lock_bh(&dev->xmit_lock);
26664 +       netif_stop_queue(dev);
26665 +       spin_unlock_bh(&dev->xmit_lock);
26666 +}
26667 +#endif
26668 +#endif /* 2.4.23 => 2.4.22 */
26669 +
26670 +/*****************************************************************************/
26671 +/* 2.6.4 => 2.6.0 */
26672 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25) || \
26673 +    ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && \
26674 +      LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) ) )
26675 +#define ETHTOOL_OPS_COMPAT
26676 +#endif /* 2.6.4 => 2.6.0 */
26677 +
26678 +/*****************************************************************************/
26679 +/* 2.5.71 => 2.4.x */
26680 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71) )
26681 +#include <net/sock.h>
26682 +#define sk_protocol protocol
26683 +
26684 +#define pci_get_device pci_find_device
26685 +#endif /* 2.5.70 => 2.4.x */
26686 +
26687 +/*****************************************************************************/
26688 +/* < 2.4.27 or 2.6.0 <= 2.6.5 */
26689 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) || \
26690 +    ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && \
26691 +      LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) ) )
26692 +
26693 +#ifndef netif_msg_init
26694 +#define netif_msg_init _kc_netif_msg_init
26695 +static inline u32 _kc_netif_msg_init(int debug_value, int default_msg_enable_bits)
26696 +{
26697 +       /* use default */
26698 +       if (debug_value < 0 || debug_value >= (sizeof(u32) * 8))
26699 +               return default_msg_enable_bits;
26700 +       if (debug_value == 0) /* no output */
26701 +               return 0;
26702 +       /* set low N bits */
26703 +       return (1 << debug_value) -1;
26704 +}
26705 +#endif
26706 +
26707 +#endif /* < 2.4.27 or 2.6.0 <= 2.6.5 */
26708 +/*****************************************************************************/
26709 +#if (( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) ) || \
26710 +     (( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ) && \
26711 +      ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) )))
26712 +#define netdev_priv(x) x->priv
26713 +#endif
26714 +
26715 +/*****************************************************************************/
26716 +/* <= 2.5.0 */
26717 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) )
26718 +#undef pci_register_driver
26719 +#define pci_register_driver pci_module_init
26720 +
26721 +#define dev_err(__unused_dev, format, arg...)            \
26722 +       printk(KERN_ERR "%s: " format, pci_name(adapter->pdev) , ## arg)
26723 +#define dev_warn(__unused_dev, format, arg...)            \
26724 +       printk(KERN_WARNING "%s: " format, pci_name(pdev) , ## arg)
26725 +
26726 +/* hlist_* code - double linked lists */
26727 +struct hlist_head {
26728 +       struct hlist_node *first;
26729 +};
26730 +
26731 +struct hlist_node {
26732 +       struct hlist_node *next, **pprev;
26733 +};
26734 +
26735 +static inline void __hlist_del(struct hlist_node *n)
26736 +{
26737 +       struct hlist_node *next = n->next;
26738 +       struct hlist_node **pprev = n->pprev;
26739 +       *pprev = next;
26740 +       if (next)
26741 +       next->pprev = pprev;
26742 +}
26743 +
26744 +static inline void hlist_del(struct hlist_node *n)
26745 +{
26746 +       __hlist_del(n);
26747 +       n->next = NULL;
26748 +       n->pprev = NULL;
26749 +}
26750 +
26751 +static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
26752 +{
26753 +       struct hlist_node *first = h->first;
26754 +       n->next = first;
26755 +       if (first)
26756 +               first->pprev = &n->next;
26757 +       h->first = n;
26758 +       n->pprev = &h->first;
26759 +}
26760 +
26761 +static inline int hlist_empty(const struct hlist_head *h)
26762 +{
26763 +       return !h->first;
26764 +}
26765 +#define HLIST_HEAD_INIT { .first = NULL }
26766 +#define HLIST_HEAD(name) struct hlist_head name = {  .first = NULL }
26767 +#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
26768 +static inline void INIT_HLIST_NODE(struct hlist_node *h)
26769 +{
26770 +       h->next = NULL;
26771 +       h->pprev = NULL;
26772 +}
26773 +#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
26774 +
26775 +#define hlist_for_each_entry(tpos, pos, head, member)                    \
26776 +       for (pos = (head)->first;                                        \
26777 +            pos && ({ prefetch(pos->next); 1;}) &&                      \
26778 +               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
26779 +            pos = pos->next)
26780 +
26781 +#define hlist_for_each_entry_safe(tpos, pos, n, head, member)            \
26782 +       for (pos = (head)->first;                                        \
26783 +            pos && ({ n = pos->next; 1; }) &&                           \
26784 +               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
26785 +            pos = n)
26786 +
26787 +/* we ignore GFP here */
26788 +#define dma_alloc_coherent(dv, sz, dma, gfp) \
26789 +       pci_alloc_consistent(pdev, (sz), (dma))
26790 +#define dma_free_coherent(dv, sz, addr, dma_addr) \
26791 +       pci_free_consistent(pdev, (sz), (addr), (dma_addr))
26792 +
26793 +#ifndef might_sleep
26794 +#define might_sleep()
26795 +#endif
26796 +
26797 +#ifndef NETREG_REGISTERED
26798 +#define NETREG_REGISTERED 1
26799 +#define reg_state deadbeaf
26800 +#endif
26801 +#endif /* <= 2.5.0 */
26802 +
26803 +/*****************************************************************************/
26804 +/* 2.5.28 => 2.4.23 */
26805 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) )
26806 +
26807 +static inline void _kc_synchronize_irq(void)
26808 +{
26809 +       synchronize_irq();
26810 +}
26811 +#undef synchronize_irq
26812 +#define synchronize_irq(X) _kc_synchronize_irq()
26813 +
26814 +#include <linux/tqueue.h>
26815 +#define work_struct tq_struct
26816 +#undef INIT_WORK
26817 +#define INIT_WORK(a,b) INIT_TQUEUE(a,(void (*)(void *))b,a)
26818 +#undef container_of
26819 +#define container_of list_entry
26820 +#define schedule_work schedule_task
26821 +#define flush_scheduled_work flush_scheduled_tasks
26822 +#define cancel_work_sync(x) flush_scheduled_work()
26823 +
26824 +#endif /* 2.5.28 => 2.4.17 */
26825 +
26826 +/*****************************************************************************/
26827 +/* 2.6.0 => 2.5.28 */
26828 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) )
26829 +#define MODULE_INFO(version, _version)
26830 +#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
26831 +#define CONFIG_E1000_DISABLE_PACKET_SPLIT 1
26832 +#endif
26833 +#ifndef CONFIG_IGB_DISABLE_PACKET_SPLIT
26834 +#define CONFIG_IGB_DISABLE_PACKET_SPLIT 1
26835 +#endif
26836 +
26837 +#define pci_set_consistent_dma_mask(dev,mask) 1
26838 +
26839 +#undef dev_put
26840 +#define dev_put(dev) __dev_put(dev)
26841 +
26842 +#ifndef skb_fill_page_desc
26843 +#define skb_fill_page_desc _kc_skb_fill_page_desc
26844 +extern void _kc_skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size);
26845 +#endif
26846 +
26847 +#undef ALIGN
26848 +#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
26849 +
26850 +#ifndef page_count
26851 +#define page_count(p) atomic_read(&(p)->count)
26852 +#endif
26853 +
26854 +/* find_first_bit and find_next bit are not defined for most
26855 + * 2.4 kernels (except for the redhat 2.4.21 kernels
26856 + */
26857 +#include <linux/bitops.h>
26858 +#define BITOP_WORD(nr)          ((nr) / BITS_PER_LONG)
26859 +#undef find_next_bit
26860 +#define find_next_bit _kc_find_next_bit
26861 +extern unsigned long _kc_find_next_bit(const unsigned long *addr,
26862 +                                       unsigned long size,
26863 +                                       unsigned long offset);
26864 +#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
26865 +
26866 +#endif /* 2.6.0 => 2.5.28 */
26867 +
26868 +/*****************************************************************************/
26869 +/* 2.6.4 => 2.6.0 */
26870 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) )
26871 +#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
26872 +#endif /* 2.6.4 => 2.6.0 */
26873 +
26874 +/*****************************************************************************/
26875 +/* 2.6.5 => 2.6.0 */
26876 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) )
26877 +#define pci_dma_sync_single_for_cpu    pci_dma_sync_single
26878 +#define pci_dma_sync_single_for_device pci_dma_sync_single_for_cpu
26879 +#endif /* 2.6.5 => 2.6.0 */
26880 +
26881 +/*****************************************************************************/
26882 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,6) )
26883 +/* taken from 2.6 include/linux/bitmap.h */
26884 +#undef bitmap_zero
26885 +#define bitmap_zero _kc_bitmap_zero
26886 +static inline void _kc_bitmap_zero(unsigned long *dst, int nbits)
26887 +{
26888 +        if (nbits <= BITS_PER_LONG)
26889 +                *dst = 0UL;
26890 +        else {
26891 +                int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
26892 +                memset(dst, 0, len);
26893 +        }
26894 +}
26895 +#endif /* < 2.6.6 */
26896 +
26897 +/*****************************************************************************/
26898 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) )
26899 +#undef if_mii
26900 +#define if_mii _kc_if_mii
26901 +static inline struct mii_ioctl_data *_kc_if_mii(struct ifreq *rq)
26902 +{
26903 +       return (struct mii_ioctl_data *) &rq->ifr_ifru;
26904 +}
26905 +#endif /* < 2.6.7 */
26906 +
26907 +/*****************************************************************************/
26908 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) )
26909 +#define msleep(x)      do { set_current_state(TASK_UNINTERRUPTIBLE); \
26910 +                               schedule_timeout((x * HZ)/1000 + 2); \
26911 +                       } while (0)
26912 +
26913 +#endif /* < 2.6.8 */
26914 +
26915 +/*****************************************************************************/
26916 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
26917 +#include <net/dsfield.h>
26918 +#define __iomem
26919 +
26920 +#ifndef kcalloc
26921 +#define kcalloc(n, size, flags) _kc_kzalloc(((n) * (size)), flags)
26922 +extern void *_kc_kzalloc(size_t size, int flags);
26923 +#endif
26924 +#define MSEC_PER_SEC    1000L
26925 +static inline unsigned int _kc_jiffies_to_msecs(const unsigned long j)
26926 +{
26927 +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
26928 +       return (MSEC_PER_SEC / HZ) * j;
26929 +#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
26930 +       return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
26931 +#else
26932 +       return (j * MSEC_PER_SEC) / HZ;
26933 +#endif
26934 +}
26935 +static inline unsigned long _kc_msecs_to_jiffies(const unsigned int m)
26936 +{
26937 +       if (m > _kc_jiffies_to_msecs(MAX_JIFFY_OFFSET))
26938 +               return MAX_JIFFY_OFFSET;
26939 +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
26940 +       return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
26941 +#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
26942 +       return m * (HZ / MSEC_PER_SEC);
26943 +#else
26944 +       return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC;
26945 +#endif
26946 +}
26947 +
26948 +#define msleep_interruptible _kc_msleep_interruptible
26949 +static inline unsigned long _kc_msleep_interruptible(unsigned int msecs)
26950 +{
26951 +       unsigned long timeout = _kc_msecs_to_jiffies(msecs) + 1;
26952 +
26953 +       while (timeout && !signal_pending(current)) {
26954 +               __set_current_state(TASK_INTERRUPTIBLE);
26955 +               timeout = schedule_timeout(timeout);
26956 +       }
26957 +       return _kc_jiffies_to_msecs(timeout);
26958 +}
26959 +
26960 +/* Basic mode control register. */
26961 +#define BMCR_SPEED1000         0x0040  /* MSB of Speed (1000)         */
26962 +
26963 +#ifndef __le16
26964 +#define __le16 u16
26965 +#endif
26966 +#ifndef __le32
26967 +#define __le32 u32
26968 +#endif
26969 +#ifndef __le64
26970 +#define __le64 u64
26971 +#endif
26972 +#endif /* < 2.6.9 */
26973 +
26974 +/*****************************************************************************/
26975 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) )
26976 +#ifdef module_param_array_named
26977 +#undef module_param_array_named
26978 +#define module_param_array_named(name, array, type, nump, perm)          \
26979 +       static struct kparam_array __param_arr_##name                    \
26980 +       = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type, \
26981 +           sizeof(array[0]), array };                                   \
26982 +       module_param_call(name, param_array_set, param_array_get,        \
26983 +                         &__param_arr_##name, perm)
26984 +#endif /* module_param_array_named */
26985 +#endif /* < 2.6.10 */
26986 +
26987 +/*****************************************************************************/
26988 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) )
26989 +#define PCI_D0      0
26990 +#define PCI_D1      1
26991 +#define PCI_D2      2
26992 +#define PCI_D3hot   3
26993 +#define PCI_D3cold  4
26994 +#define pci_choose_state(pdev,state) state
26995 +#define PMSG_SUSPEND 3
26996 +#define PCI_EXP_LNKCTL 16
26997 +
26998 +#undef NETIF_F_LLTX
26999 +
27000 +#ifndef ARCH_HAS_PREFETCH
27001 +#define prefetch(X)
27002 +#endif
27003 +
27004 +#ifndef NET_IP_ALIGN
27005 +#define NET_IP_ALIGN 2
27006 +#endif
27007 +
27008 +#define KC_USEC_PER_SEC        1000000L
27009 +#define usecs_to_jiffies _kc_usecs_to_jiffies
27010 +static inline unsigned int _kc_jiffies_to_usecs(const unsigned long j)
27011 +{
27012 +#if HZ <= KC_USEC_PER_SEC && !(KC_USEC_PER_SEC % HZ)
27013 +       return (KC_USEC_PER_SEC / HZ) * j;
27014 +#elif HZ > KC_USEC_PER_SEC && !(HZ % KC_USEC_PER_SEC)
27015 +       return (j + (HZ / KC_USEC_PER_SEC) - 1)/(HZ / KC_USEC_PER_SEC);
27016 +#else
27017 +       return (j * KC_USEC_PER_SEC) / HZ;
27018 +#endif
27019 +}
27020 +static inline unsigned long _kc_usecs_to_jiffies(const unsigned int m)
27021 +{
27022 +       if (m > _kc_jiffies_to_usecs(MAX_JIFFY_OFFSET))
27023 +               return MAX_JIFFY_OFFSET;
27024 +#if HZ <= KC_USEC_PER_SEC && !(KC_USEC_PER_SEC % HZ)
27025 +       return (m + (KC_USEC_PER_SEC / HZ) - 1) / (KC_USEC_PER_SEC / HZ);
27026 +#elif HZ > KC_USEC_PER_SEC && !(HZ % KC_USEC_PER_SEC)
27027 +       return m * (HZ / KC_USEC_PER_SEC);
27028 +#else
27029 +       return (m * HZ + KC_USEC_PER_SEC - 1) / KC_USEC_PER_SEC;
27030 +#endif
27031 +}
27032 +#endif /* < 2.6.11 */
27033 +
27034 +/*****************************************************************************/
27035 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12) )
27036 +#include <linux/reboot.h>
27037 +#define USE_REBOOT_NOTIFIER
27038 +
27039 +/* Generic MII registers. */
27040 +#define MII_CTRL1000        0x09        /* 1000BASE-T control          */
27041 +#define MII_STAT1000        0x0a        /* 1000BASE-T status           */
27042 +/* Advertisement control register. */
27043 +#define ADVERTISE_PAUSE_CAP     0x0400  /* Try for pause               */
27044 +#define ADVERTISE_PAUSE_ASYM    0x0800  /* Try for asymmetric pause     */
27045 +/* 1000BASE-T Control register */
27046 +#define ADVERTISE_1000FULL      0x0200  /* Advertise 1000BASE-T full duplex */
27047 +#endif
27048 +
27049 +/*****************************************************************************/
27050 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) )
27051 +#define pm_message_t u32
27052 +#ifndef kzalloc
27053 +#define kzalloc _kc_kzalloc
27054 +extern void *_kc_kzalloc(size_t size, int flags);
27055 +#endif
27056 +
27057 +/* Generic MII registers. */
27058 +#define MII_ESTATUS        0x0f        /* Extended Status */
27059 +/* Basic mode status register. */
27060 +#define BMSR_ESTATEN           0x0100  /* Extended Status in R15 */
27061 +/* Extended status register. */
27062 +#define ESTATUS_1000_TFULL     0x2000  /* Can do 1000BT Full */
27063 +#define ESTATUS_1000_THALF     0x1000  /* Can do 1000BT Half */
27064 +#endif
27065 +
27066 +/*****************************************************************************/
27067 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) )
27068 +#undef HAVE_PCI_ERS
27069 +#else /* 2.6.16 and above */
27070 +#undef HAVE_PCI_ERS
27071 +#define HAVE_PCI_ERS
27072 +#endif
27073 +
27074 +/*****************************************************************************/
27075 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) )
27076 +
27077 +#ifndef IRQF_PROBE_SHARED
27078 +#ifdef SA_PROBEIRQ
27079 +#define IRQF_PROBE_SHARED SA_PROBEIRQ
27080 +#else
27081 +#define IRQF_PROBE_SHARED 0
27082 +#endif
27083 +#endif
27084 +
27085 +#ifndef IRQF_SHARED
27086 +#define IRQF_SHARED SA_SHIRQ
27087 +#endif
27088 +
27089 +#ifndef ARRAY_SIZE
27090 +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
27091 +#endif
27092 +
27093 +#ifndef netdev_alloc_skb
27094 +#define netdev_alloc_skb _kc_netdev_alloc_skb
27095 +extern struct sk_buff *_kc_netdev_alloc_skb(struct net_device *dev,
27096 +                                            unsigned int length);
27097 +#endif
27098 +
27099 +#ifndef skb_is_gso
27100 +#ifdef NETIF_F_TSO
27101 +#define skb_is_gso _kc_skb_is_gso
27102 +static inline int _kc_skb_is_gso(const struct sk_buff *skb)
27103 +{
27104 +       return skb_shinfo(skb)->gso_size;
27105 +}
27106 +#else
27107 +#define skb_is_gso(a) 0
27108 +#endif
27109 +#endif
27110 +
27111 +#endif /* < 2.6.18 */
27112 +
27113 +/*****************************************************************************/
27114 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) )
27115 +
27116 +#ifndef DIV_ROUND_UP
27117 +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
27118 +#endif
27119 +
27120 +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) )
27121 +#ifndef RHEL_RELEASE_CODE
27122 +#define RHEL_RELEASE_CODE 0
27123 +#endif
27124 +#ifndef RHEL_RELEASE_VERSION
27125 +#define RHEL_RELEASE_VERSION(a,b) 0
27126 +#endif
27127 +#ifndef AX_RELEASE_CODE
27128 +#define AX_RELEASE_CODE 0
27129 +#endif
27130 +#ifndef AX_RELEASE_VERSION
27131 +#define AX_RELEASE_VERSION(a,b) 0
27132 +#endif
27133 +#if (!(( RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(4,4) ) && ( RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,0) ) || ( RHEL_RELEASE_CODE > RHEL_RELEASE_VERSION(5,0) ) || (AX_RELEASE_CODE > AX_RELEASE_VERSION(3,0))))
27134 +typedef irqreturn_t (*irq_handler_t)(int, void*, struct pt_regs *);
27135 +#endif
27136 +typedef irqreturn_t (*new_handler_t)(int, void*);
27137 +static inline irqreturn_t _kc_request_irq(unsigned int irq, new_handler_t handler, unsigned long flags, const char *devname, void *dev_id)
27138 +#else /* 2.4.x */
27139 +typedef void (*irq_handler_t)(int, void*, struct pt_regs *);
27140 +typedef void (*new_handler_t)(int, void*);
27141 +static inline int _kc_request_irq(unsigned int irq, new_handler_t handler, unsigned long flags, const char *devname, void *dev_id)
27142 +#endif
27143 +{
27144 +       irq_handler_t new_handler = (irq_handler_t) handler;
27145 +       return request_irq(irq, new_handler, flags, devname, dev_id);
27146 +}
27147 +
27148 +#undef request_irq
27149 +#define request_irq(irq, handler, flags, devname, dev_id) _kc_request_irq((irq), (handler), (flags), (devname), (dev_id))
27150 +
27151 +#define irq_handler_t new_handler_t
27152 +
27153 +/* pci_restore_state and pci_save_state handles MSI/PCIE from 2.6.19 */
27154 +#define PCIE_CONFIG_SPACE_LEN 256
27155 +#define PCI_CONFIG_SPACE_LEN 64
27156 +#define PCIE_LINK_STATUS 0x12
27157 +#define pci_config_space_ich8lan() do {} while (0)
27158 +#undef pci_save_state
27159 +extern int _kc_pci_save_state(struct pci_dev *);
27160 +#define pci_save_state(pdev) _kc_pci_save_state(pdev)
27161 +#undef pci_restore_state
27162 +extern void _kc_pci_restore_state(struct pci_dev *);
27163 +#define pci_restore_state(pdev) _kc_pci_restore_state(pdev)
27164 +#ifdef HAVE_PCI_ERS
27165 +#undef free_netdev
27166 +extern void _kc_free_netdev(struct net_device *);
27167 +#define free_netdev(netdev) _kc_free_netdev(netdev)
27168 +#endif
27169 +
27170 +#endif /* < 2.6.19 */
27171 +/*****************************************************************************/
27172 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) )
27173 +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28) )
27174 +#undef INIT_WORK
27175 +#define INIT_WORK(_work, _func) \
27176 +do { \
27177 +       INIT_LIST_HEAD(&(_work)->entry); \
27178 +       (_work)->pending = 0; \
27179 +       (_work)->func = (void (*)(void *))_func; \
27180 +       (_work)->data = _work; \
27181 +       init_timer(&(_work)->timer); \
27182 +} while (0)
27183 +#endif
27184 +
27185 +#ifndef PCI_VDEVICE
27186 +#define PCI_VDEVICE(ven, dev)        \
27187 +       PCI_VENDOR_ID_##ven, (dev),  \
27188 +       PCI_ANY_ID, PCI_ANY_ID, 0, 0
27189 +#endif
27190 +
27191 +#ifndef round_jiffies
27192 +#define round_jiffies(x) x
27193 +#endif
27194 +
27195 +#define csum_offset csum
27196 +
27197 +#endif /* < 2.6.20 */
27198 +
27199 +/*****************************************************************************/
27200 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) )
27201 +#define vlan_group_get_device(vg, id) (vg->vlan_devices[id])
27202 +#define vlan_group_set_device(vg, id, dev) if (vg) vg->vlan_devices[id] = dev;
27203 +#define pci_channel_offline(pdev) (pdev->error_state && \
27204 +       pdev->error_state != pci_channel_io_normal)
27205 +#define pci_request_selected_regions(pdev, bars, name) \
27206 +        pci_request_regions(pdev, name)
27207 +#define pci_release_selected_regions(pdev, bars) pci_release_regions(pdev);
27208 +#endif /* < 2.6.21 */
27209 +
27210 +/*****************************************************************************/
27211 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) )
27212 +#define tcp_hdr(skb) (skb->h.th)
27213 +#define tcp_hdrlen(skb) (skb->h.th->doff << 2)
27214 +#define skb_transport_offset(skb) (skb->h.raw - skb->data)
27215 +#define skb_transport_header(skb) (skb->h.raw)
27216 +#define ipv6_hdr(skb) (skb->nh.ipv6h)
27217 +#define ip_hdr(skb) (skb->nh.iph)
27218 +#define skb_network_offset(skb) (skb->nh.raw - skb->data)
27219 +#define skb_network_header(skb) (skb->nh.raw)
27220 +#define skb_tail_pointer(skb) skb->tail
27221 +#define skb_copy_to_linear_data_offset(skb, offset, from, len) \
27222 +                                 memcpy(skb->data + offset, from, len)
27223 +#define skb_network_header_len(skb) (skb->h.raw - skb->nh.raw)
27224 +#define pci_register_driver pci_module_init
27225 +#define skb_mac_header(skb) skb->mac.raw
27226 +
27227 +#ifdef NETIF_F_MULTI_QUEUE
27228 +#ifndef alloc_etherdev_mq
27229 +#define alloc_etherdev_mq(_a, _b) alloc_etherdev(_a)
27230 +#endif
27231 +#endif /* NETIF_F_MULTI_QUEUE */
27232 +
27233 +#ifndef ETH_FCS_LEN
27234 +#define ETH_FCS_LEN 4
27235 +#endif
27236 +#define cancel_work_sync(x) flush_scheduled_work()
27237 +#endif /* < 2.6.22 */
27238 +
27239 +/*****************************************************************************/
27240 +#if ( LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22) )
27241 +#undef ETHTOOL_GPERMADDR
27242 +#undef SET_MODULE_OWNER
27243 +#define SET_MODULE_OWNER(dev) do { } while (0)
27244 +#endif /* > 2.6.22 */
27245 +
27246 +/*****************************************************************************/
27247 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) )
27248 +/* NAPI API changes in 2.6.24 break everything */
27249 +struct napi_struct {
27250 +       /* used to look up the real NAPI polling routine */
27251 +       int (*poll)(struct napi_struct *, int);
27252 +       struct net_device poll_dev;
27253 +       int weight;
27254 +};
27255 +#ifdef NAPI
27256 +extern int __kc_adapter_clean(struct net_device *, int *);
27257 +#if defined(DRIVER_IGB) || defined(DRIVER_IXGBE)
27258 +#define netif_rx_complete(_netdev, napi) netif_rx_complete(&(napi)->poll_dev)
27259 +#define netif_rx_schedule_prep(_netdev, napi) \
27260 +       (netif_running(_netdev) && netif_rx_schedule_prep(&(napi)->poll_dev))
27261 +#define netif_rx_schedule(_netdev, napi) netif_rx_schedule(&(napi)->poll_dev)
27262 +#define __netif_rx_schedule(_netdev, napi) __netif_rx_schedule(&(napi)->poll_dev)
27263 +#define napi_enable(napi) do { \
27264 +       /* abuse if_port as a counter */ \
27265 +       if (!adapter->netdev->if_port) { \
27266 +               netif_poll_enable(adapter->netdev); \
27267 +       } \
27268 +       ++adapter->netdev->if_port; \
27269 +       netif_poll_enable(&(napi)->poll_dev); \
27270 +       } while (0)
27271 +#define napi_disable(_napi) do { \
27272 +       netif_poll_disable(&(_napi)->poll_dev); \
27273 +       --adapter->netdev->if_port; \
27274 +       if (!adapter->netdev->if_port) \
27275 +               netif_poll_disable(adapter->netdev); \
27276 +       } while (0)
27277 +
27278 +#define netif_napi_add(_netdev, _napi, _poll, _weight) \
27279 +       do { \
27280 +               struct napi_struct *__napi = (_napi); \
27281 +               __napi->poll_dev.poll = &(__kc_adapter_clean); \
27282 +               __napi->poll_dev.priv = (_napi); \
27283 +               __napi->poll_dev.weight = (_weight); \
27284 +               dev_hold(&__napi->poll_dev); \
27285 +               set_bit(__LINK_STATE_START, &__napi->poll_dev.state);\
27286 +               _netdev->poll = &(__kc_adapter_clean); \
27287 +               _netdev->weight = (_weight); \
27288 +               __napi->poll = &(_poll); \
27289 +               __napi->weight = (_weight); \
27290 +               set_bit(__LINK_STATE_RX_SCHED, &(_netdev)->state); \
27291 +               set_bit(__LINK_STATE_RX_SCHED, &__napi->poll_dev.state); \
27292 +       } while (0)
27293 +#define netif_napi_del(_napi) \
27294 +       do { \
27295 +               WARN_ON(!test_bit(__LINK_STATE_RX_SCHED, &(_napi)->poll_dev.state)); \
27296 +               dev_put(&(_napi)->poll_dev); \
27297 +               memset(&(_napi)->poll_dev, 0, sizeof(struct napi_struct));\
27298 +       } while (0)
27299 +#else /* DRIVER_IGB || DRIVER_IXGBE */
27300 +#define netif_rx_complete(netdev, napi) netif_rx_complete(netdev)
27301 +#define netif_rx_schedule_prep(netdev, napi) netif_rx_schedule_prep(netdev)
27302 +#define netif_rx_schedule(netdev, napi) netif_rx_schedule(netdev)
27303 +#define __netif_rx_schedule(netdev, napi) __netif_rx_schedule(netdev)
27304 +#define napi_enable(napi) netif_poll_enable(adapter->netdev)
27305 +#define napi_disable(napi) netif_poll_disable(adapter->netdev)
27306 +#define netif_napi_add(_netdev, _napi, _poll, _weight) \
27307 +       do { \
27308 +               struct napi_struct *__napi = (_napi); \
27309 +               _netdev->poll = &(__kc_adapter_clean); \
27310 +               _netdev->weight = (_weight); \
27311 +               __napi->poll = &(_poll); \
27312 +               __napi->weight = (_weight); \
27313 +               netif_poll_disable(_netdev); \
27314 +       } while (0)
27315 +#define netif_napi_del(_a) do {} while (0)
27316 +#endif /* DRIVER_IGB || DRIVER_IXGBE */
27317 +#else /* NAPI */
27318 +#define netif_napi_add(_netdev, _napi, _poll, _weight) \
27319 +       do { \
27320 +               struct napi_struct *__napi = _napi; \
27321 +               _netdev->poll = &(_poll); \
27322 +               _netdev->weight = (_weight); \
27323 +               __napi->poll = &(_poll); \
27324 +               __napi->weight = (_weight); \
27325 +       } while (0)
27326 +#define netif_napi_del(_a) do {} while (0)
27327 +#endif /* NAPI */
27328 +
27329 +#undef dev_get_by_name
27330 +#define dev_get_by_name(_a, _b) dev_get_by_name(_b)
27331 +#define __netif_subqueue_stopped(_a, _b) netif_subqueue_stopped(_a, _b)
27332 +#else
27333 +#define netif_napi_del(_a) do {} while (0)
27334 +#endif /* < 2.6.24 */
27335 +
27336 +/*****************************************************************************/
27337 +#if ( LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24) )
27338 +#include <linux/pm_qos_params.h>
27339 +#endif /* > 2.6.24 */
27340 +
27341 +/*****************************************************************************/
27342 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) )
27343 +#define PM_QOS_CPU_DMA_LATENCY 1
27344 +
27345 +#if ( LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) )
27346 +#include <linux/latency.h>
27347 +#define PM_QOS_DEFAULT_VALUE   INFINITE_LATENCY
27348 +#define pm_qos_add_requirement(pm_qos_class, name, value) \
27349 +               set_acceptable_latency(name, value)
27350 +#define pm_qos_remove_requirement(pm_qos_class, name) \
27351 +               remove_acceptable_latency(name)
27352 +#define pm_qos_update_requirement(pm_qos_class, name, value) \
27353 +               modify_acceptable_latency(name, value)
27354 +#else
27355 +#define PM_QOS_DEFAULT_VALUE   -1
27356 +#define pm_qos_add_requirement(pm_qos_class, name, value)
27357 +#define pm_qos_remove_requirement(pm_qos_class, name)
27358 +#define pm_qos_update_requirement(pm_qos_class, name, value) { \
27359 +       if (value != PM_QOS_DEFAULT_VALUE) { \
27360 +               printk(KERN_WARNING "%s: unable to set PM QoS requirement\n", \
27361 +                       pci_name(adapter->pdev)); \
27362 +       } \
27363 +}
27364 +#endif /* > 2.6.18 */
27365 +
27366 +#define pci_enable_device_mem(pdev) pci_enable_device(pdev)
27367 +
27368 +#endif /* < 2.6.25 */
27369 +
27370 +/*****************************************************************************/
27371 +#ifndef PCIE_LINK_STATE_L0S
27372 +#define PCIE_LINK_STATE_L0S 1
27373 +#endif 
27374 +
27375 +/*****************************************************************************/
27376 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) )
27377 +#ifndef netif_napi_del
27378 +#define netif_napi_del(_a) do {} while (0)
27379 +#ifdef NAPI
27380 +#ifdef CONFIG_NETPOLL
27381 +#undef netif_napi_del
27382 +#define netif_napi_del(_a) list_del(&(_a)->dev_list);
27383 +#endif
27384 +#endif
27385 +#endif /* netif_napi_del */
27386 +#ifndef pci_dma_mapping_error
27387 +#define pci_dma_mapping_error _kc_pci_dma_mapping_error
27388 +static inline int _kc_pci_dma_mapping_error(struct pci_dev *pdev,
27389 +                                            dma_addr_t dma_addr)
27390 +{
27391 +       return dma_addr == 0;
27392 +}
27393 +#endif
27394 +
27395 +#ifdef CONFIG_NETDEVICES_MULTIQUEUE
27396 +#define HAVE_TX_MQ
27397 +#endif
27398 +
27399 +#ifdef HAVE_TX_MQ
27400 +extern void _kc_netif_tx_stop_all_queues(struct net_device *);
27401 +extern void _kc_netif_tx_wake_all_queues(struct net_device *);
27402 +extern void _kc_netif_tx_start_all_queues(struct net_device *);
27403 +#define netif_tx_stop_all_queues(a) _kc_netif_tx_stop_all_queues(a)
27404 +#define netif_tx_wake_all_queues(a) _kc_netif_tx_wake_all_queues(a)
27405 +#define netif_tx_start_all_queues(a) _kc_netif_tx_start_all_queues(a)
27406 +#else /* CONFIG_NETDEVICES_MULTIQUEUE */
27407 +#define netif_tx_stop_all_queues(a) netif_stop_queue(a)
27408 +#define netif_tx_wake_all_queues(a) netif_wake_queue(a)
27409 +#define netif_tx_start_all_queues(a) netif_start_queue(a)
27410 +#endif /* CONFIG_NETDEVICES_MULTIQUEUE */
27411 +#ifndef NETIF_F_MULTI_QUEUE
27412 +#define NETIF_F_MULTI_QUEUE 0
27413 +#define netif_is_multiqueue(a) 0
27414 +#define netif_stop_subqueue(a, b)
27415 +#define netif_wake_subqueue(a, b)
27416 +#define netif_start_subqueue(a, b)
27417 +#endif /* NETIF_F_MULTI_QUEUE */
27418 +#else /* < 2.6.27 */
27419 +#define HAVE_TX_MQ
27420 +#endif /* < 2.6.27 */
27421 +
27422 +#endif /* _KCOMPAT_H_ */
27423 Binary files vanilla/drivers/net/igb/kcompat.o and linux-i686-2.6.22/drivers/net/igb/kcompat.o differ
27424 diff -Nru vanilla/drivers/net/igb/.kcompat.o.cmd linux-i686-2.6.22/drivers/net/igb/.kcompat.o.cmd
27425 --- vanilla/drivers/net/igb/.kcompat.o.cmd      1969-12-31 19:00:00.000000000 -0500
27426 +++ linux-i686-2.6.22/drivers/net/igb/.kcompat.o.cmd    2009-07-16 19:53:45.000000000 -0400
27427 @@ -0,0 +1,554 @@
27428 +cmd_drivers/net/igb/kcompat.o := gcc -m32 -Wp,-MD,drivers/net/igb/.kcompat.o.d  -nostdinc -isystem /usr/lib/gcc/i386-redhat-linux/4.1.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -pipe -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-generic -Iinclude/asm-i386/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -g  -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(kcompat)"  -D"KBUILD_MODNAME=KBUILD_STR(igb)" -c -o drivers/net/igb/.tmp_kcompat.o drivers/net/igb/kcompat.c
27429 +
27430 +deps_drivers/net/igb/kcompat.o := \
27431 +  drivers/net/igb/kcompat.c \
27432 +    $(wildcard include/config/highmem.h) \
27433 +    $(wildcard include/config/space/len.h) \
27434 +    $(wildcard include/config/sysfs.h) \
27435 +  drivers/net/igb/igb.h \
27436 +    $(wildcard include/config/dca.h) \
27437 +    $(wildcard include/config/inet/lro.h) \
27438 +    $(wildcard include/config/igb/separate/tx/handler.h) \
27439 +    $(wildcard include/config/igb/disable/packet/split.h) \
27440 +  include/linux/pci.h \
27441 +    $(wildcard include/config/pci/msi.h) \
27442 +    $(wildcard include/config/pci.h) \
27443 +    $(wildcard include/config/ht/irq.h) \
27444 +    $(wildcard include/config/pci/domains.h) \
27445 +  include/linux/pci_regs.h \
27446 +  include/linux/mod_devicetable.h \
27447 +  include/linux/types.h \
27448 +    $(wildcard include/config/uid16.h) \
27449 +    $(wildcard include/config/lbd.h) \
27450 +    $(wildcard include/config/lsf.h) \
27451 +    $(wildcard include/config/resources/64bit.h) \
27452 +  include/linux/posix_types.h \
27453 +  include/linux/stddef.h \
27454 +  include/linux/compiler.h \
27455 +    $(wildcard include/config/enable/must/check.h) \
27456 +  include/linux/compiler-gcc4.h \
27457 +    $(wildcard include/config/forced/inlining.h) \
27458 +  include/linux/compiler-gcc.h \
27459 +  include/asm/posix_types.h \
27460 +  include/asm/types.h \
27461 +    $(wildcard include/config/highmem64g.h) \
27462 +  include/linux/ioport.h \
27463 +  include/linux/list.h \
27464 +    $(wildcard include/config/debug/list.h) \
27465 +  include/linux/poison.h \
27466 +  include/linux/prefetch.h \
27467 +  include/asm/processor.h \
27468 +    $(wildcard include/config/smp.h) \
27469 +    $(wildcard include/config/x86/ht.h) \
27470 +    $(wildcard include/config/paravirt.h) \
27471 +    $(wildcard include/config/mk8.h) \
27472 +    $(wildcard include/config/mk7.h) \
27473 +  include/asm/vm86.h \
27474 +    $(wildcard include/config/vm86.h) \
27475 +  include/asm/ptrace.h \
27476 +  include/asm/ptrace-abi.h \
27477 +  include/asm/segment.h \
27478 +  include/asm/math_emu.h \
27479 +  include/asm/sigcontext.h \
27480 +  include/asm/page.h \
27481 +    $(wildcard include/config/x86/use/3dnow.h) \
27482 +    $(wildcard include/config/x86/pae.h) \
27483 +    $(wildcard include/config/hugetlb/page.h) \
27484 +    $(wildcard include/config/highmem4g.h) \
27485 +    $(wildcard include/config/page/offset.h) \
27486 +    $(wildcard include/config/flatmem.h) \
27487 +  include/asm-generic/pgtable-nopmd.h \
27488 +  include/asm-generic/pgtable-nopud.h \
27489 +  include/asm-generic/memory_model.h \
27490 +    $(wildcard include/config/discontigmem.h) \
27491 +    $(wildcard include/config/sparsemem.h) \
27492 +    $(wildcard include/config/out/of/line/pfn/to/page.h) \
27493 +  include/asm-generic/page.h \
27494 +  include/asm/cpufeature.h \
27495 +  include/linux/bitops.h \
27496 +  include/asm/bitops.h \
27497 +  include/asm/alternative.h \
27498 +  include/asm-generic/bitops/sched.h \
27499 +  include/asm-generic/bitops/hweight.h \
27500 +  include/asm-generic/bitops/fls64.h \
27501 +  include/asm-generic/bitops/ext2-non-atomic.h \
27502 +  include/asm-generic/bitops/le.h \
27503 +  include/asm/byteorder.h \
27504 +    $(wildcard include/config/x86/bswap.h) \
27505 +  include/linux/byteorder/little_endian.h \
27506 +  include/linux/byteorder/swab.h \
27507 +  include/linux/byteorder/generic.h \
27508 +  include/asm-generic/bitops/minix.h \
27509 +  include/asm/required-features.h \
27510 +    $(wildcard include/config/x86/minimum/cpu.h) \
27511 +    $(wildcard include/config/x86/cmov.h) \
27512 +    $(wildcard include/config/x86/cmpxchg64.h) \
27513 +  include/asm/msr.h \
27514 +  include/asm/msr-index.h \
27515 +  include/asm/errno.h \
27516 +  include/asm-generic/errno.h \
27517 +  include/asm-generic/errno-base.h \
27518 +  include/linux/errno.h \
27519 +  include/asm/system.h \
27520 +    $(wildcard include/config/x86/oostore.h) \
27521 +  include/linux/kernel.h \
27522 +    $(wildcard include/config/preempt/voluntary.h) \
27523 +    $(wildcard include/config/debug/spinlock/sleep.h) \
27524 +    $(wildcard include/config/printk.h) \
27525 +    $(wildcard include/config/numa.h) \
27526 +  /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \
27527 +  include/linux/linkage.h \
27528 +  include/asm/linkage.h \
27529 +    $(wildcard include/config/x86/alignment/16.h) \
27530 +  include/linux/log2.h \
27531 +    $(wildcard include/config/arch/has/ilog2/u32.h) \
27532 +    $(wildcard include/config/arch/has/ilog2/u64.h) \
27533 +  include/asm/bug.h \
27534 +    $(wildcard include/config/bug.h) \
27535 +    $(wildcard include/config/debug/bugverbose.h) \
27536 +  include/asm-generic/bug.h \
27537 +    $(wildcard include/config/generic/bug.h) \
27538 +  include/asm/cmpxchg.h \
27539 +    $(wildcard include/config/x86/cmpxchg.h) \
27540 +  include/linux/irqflags.h \
27541 +    $(wildcard include/config/trace/irqflags.h) \
27542 +    $(wildcard include/config/trace/irqflags/support.h) \
27543 +    $(wildcard include/config/x86.h) \
27544 +  include/asm/irqflags.h \
27545 +  include/asm/processor-flags.h \
27546 +  include/linux/cache.h \
27547 +  include/asm/cache.h \
27548 +    $(wildcard include/config/x86/l1/cache/shift.h) \
27549 +  include/linux/threads.h \
27550 +    $(wildcard include/config/nr/cpus.h) \
27551 +    $(wildcard include/config/base/small.h) \
27552 +  include/asm/percpu.h \
27553 +  include/linux/cpumask.h \
27554 +    $(wildcard include/config/hotplug/cpu.h) \
27555 +  include/linux/bitmap.h \
27556 +  include/linux/string.h \
27557 +  include/asm/string.h \
27558 +  include/linux/init.h \
27559 +    $(wildcard include/config/modules.h) \
27560 +    $(wildcard include/config/hotplug.h) \
27561 +    $(wildcard include/config/memory/hotplug.h) \
27562 +    $(wildcard include/config/acpi/hotplug/memory.h) \
27563 +  include/asm/atomic.h \
27564 +    $(wildcard include/config/m386.h) \
27565 +  include/asm-generic/atomic.h \
27566 +  include/linux/device.h \
27567 +    $(wildcard include/config/debug/devres.h) \
27568 +  include/linux/kobject.h \
27569 +  include/linux/sysfs.h \
27570 +  include/linux/spinlock.h \
27571 +    $(wildcard include/config/debug/spinlock.h) \
27572 +    $(wildcard include/config/preempt.h) \
27573 +    $(wildcard include/config/debug/lock/alloc.h) \
27574 +  include/linux/preempt.h \
27575 +    $(wildcard include/config/debug/preempt.h) \
27576 +  include/linux/thread_info.h \
27577 +  include/asm/thread_info.h \
27578 +    $(wildcard include/config/4kstacks.h) \
27579 +    $(wildcard include/config/debug/stack/usage.h) \
27580 +  include/linux/stringify.h \
27581 +  include/linux/bottom_half.h \
27582 +  include/linux/spinlock_types.h \
27583 +  include/linux/lockdep.h \
27584 +    $(wildcard include/config/lockdep.h) \
27585 +    $(wildcard include/config/generic/hardirqs.h) \
27586 +    $(wildcard include/config/prove/locking.h) \
27587 +  include/asm/spinlock_types.h \
27588 +  include/asm/spinlock.h \
27589 +    $(wildcard include/config/x86/ppro/fence.h) \
27590 +  include/asm/rwlock.h \
27591 +  include/linux/spinlock_api_smp.h \
27592 +  include/linux/kref.h \
27593 +  include/linux/wait.h \
27594 +  include/asm/current.h \
27595 +  include/linux/klist.h \
27596 +  include/linux/completion.h \
27597 +  include/linux/module.h \
27598 +    $(wildcard include/config/modversions.h) \
27599 +    $(wildcard include/config/unused/symbols.h) \
27600 +    $(wildcard include/config/module/unload.h) \
27601 +    $(wildcard include/config/kallsyms.h) \
27602 +  include/linux/stat.h \
27603 +  include/asm/stat.h \
27604 +  include/linux/time.h \
27605 +  include/linux/seqlock.h \
27606 +  include/linux/vs_time.h \
27607 +    $(wildcard include/config/vserver/vtime.h) \
27608 +  include/linux/kmod.h \
27609 +    $(wildcard include/config/kmod.h) \
27610 +  include/linux/elf.h \
27611 +  include/linux/auxvec.h \
27612 +  include/asm/auxvec.h \
27613 +  include/linux/elf-em.h \
27614 +  include/asm/elf.h \
27615 +  include/asm/user.h \
27616 +  include/asm/desc.h \
27617 +  include/asm/ldt.h \
27618 +  include/linux/smp.h \
27619 +  include/asm/smp.h \
27620 +    $(wildcard include/config/x86/local/apic.h) \
27621 +    $(wildcard include/config/x86/io/apic.h) \
27622 +  include/asm/mpspec.h \
27623 +    $(wildcard include/config/acpi.h) \
27624 +  include/asm/mpspec_def.h \
27625 +  include/asm-i386/mach-generic/mach_mpspec.h \
27626 +  include/asm/apic.h \
27627 +    $(wildcard include/config/x86/good/apic.h) \
27628 +  include/linux/pm.h \
27629 +    $(wildcard include/config/pm.h) \
27630 +  include/linux/delay.h \
27631 +  include/asm/delay.h \
27632 +  include/asm/fixmap.h \
27633 +    $(wildcard include/config/x86/visws/apic.h) \
27634 +    $(wildcard include/config/x86/f00f/bug.h) \
27635 +    $(wildcard include/config/x86/cyclone/timer.h) \
27636 +    $(wildcard include/config/pci/mmconfig.h) \
27637 +  include/asm/acpi.h \
27638 +    $(wildcard include/config/acpi/sleep.h) \
27639 +  include/acpi/pdc_intel.h \
27640 +  include/asm/apicdef.h \
27641 +  include/asm/kmap_types.h \
27642 +    $(wildcard include/config/debug/highmem.h) \
27643 +  include/asm/io_apic.h \
27644 +  include/asm-i386/mach-generic/mach_apicdef.h \
27645 +  include/asm/genapic.h \
27646 +  include/linux/percpu.h \
27647 +  include/linux/slab.h \
27648 +    $(wildcard include/config/slab/debug.h) \
27649 +    $(wildcard include/config/slab.h) \
27650 +    $(wildcard include/config/slub.h) \
27651 +    $(wildcard include/config/debug/slab.h) \
27652 +  include/linux/gfp.h \
27653 +    $(wildcard include/config/zone/dma.h) \
27654 +    $(wildcard include/config/zone/dma32.h) \
27655 +  include/linux/mmzone.h \
27656 +    $(wildcard include/config/force/max/zoneorder.h) \
27657 +    $(wildcard include/config/arch/populates/node/map.h) \
27658 +    $(wildcard include/config/flat/node/mem/map.h) \
27659 +    $(wildcard include/config/have/memory/present.h) \
27660 +    $(wildcard include/config/need/node/memmap/size.h) \
27661 +    $(wildcard include/config/need/multiple/nodes.h) \
27662 +    $(wildcard include/config/have/arch/early/pfn/to/nid.h) \
27663 +    $(wildcard include/config/sparsemem/extreme.h) \
27664 +    $(wildcard include/config/nodes/span/other/nodes.h) \
27665 +    $(wildcard include/config/holes/in/zone.h) \
27666 +  include/linux/numa.h \
27667 +    $(wildcard include/config/nodes/shift.h) \
27668 +  include/linux/nodemask.h \
27669 +  include/linux/memory_hotplug.h \
27670 +    $(wildcard include/config/have/arch/nodedata/extension.h) \
27671 +  include/linux/notifier.h \
27672 +  include/linux/mutex.h \
27673 +    $(wildcard include/config/debug/mutexes.h) \
27674 +    $(wildcard include/config/chopstix.h) \
27675 +  include/linux/rwsem.h \
27676 +    $(wildcard include/config/rwsem/generic/spinlock.h) \
27677 +  include/asm/rwsem.h \
27678 +  include/linux/srcu.h \
27679 +  include/linux/topology.h \
27680 +    $(wildcard include/config/sched/smt.h) \
27681 +    $(wildcard include/config/sched/mc.h) \
27682 +  include/asm/topology.h \
27683 +  include/asm-generic/topology.h \
27684 +  include/linux/slab_def.h \
27685 +  include/linux/kmalloc_sizes.h \
27686 +  include/asm/mmu.h \
27687 +  include/asm/semaphore.h \
27688 +  include/linux/moduleparam.h \
27689 +  include/asm/local.h \
27690 +  include/asm/module.h \
27691 +    $(wildcard include/config/m486.h) \
27692 +    $(wildcard include/config/m586.h) \
27693 +    $(wildcard include/config/m586tsc.h) \
27694 +    $(wildcard include/config/m586mmx.h) \
27695 +    $(wildcard include/config/mcore2.h) \
27696 +    $(wildcard include/config/m686.h) \
27697 +    $(wildcard include/config/mpentiumii.h) \
27698 +    $(wildcard include/config/mpentiumiii.h) \
27699 +    $(wildcard include/config/mpentiumm.h) \
27700 +    $(wildcard include/config/mpentium4.h) \
27701 +    $(wildcard include/config/mk6.h) \
27702 +    $(wildcard include/config/x86/elan.h) \
27703 +    $(wildcard include/config/mcrusoe.h) \
27704 +    $(wildcard include/config/mefficeon.h) \
27705 +    $(wildcard include/config/mwinchipc6.h) \
27706 +    $(wildcard include/config/mwinchip2.h) \
27707 +    $(wildcard include/config/mwinchip3d.h) \
27708 +    $(wildcard include/config/mcyrixiii.h) \
27709 +    $(wildcard include/config/mviac3/2.h) \
27710 +    $(wildcard include/config/mviac7.h) \
27711 +    $(wildcard include/config/mgeodegx1.h) \
27712 +    $(wildcard include/config/mgeode/lx.h) \
27713 +  include/asm/device.h \
27714 +  include/linux/pci_ids.h \
27715 +  include/linux/dmapool.h \
27716 +  include/asm/io.h \
27717 +    $(wildcard include/config/x86/numaq.h) \
27718 +  include/asm-generic/iomap.h \
27719 +  include/linux/vmalloc.h \
27720 +  include/asm/scatterlist.h \
27721 +  include/asm/pci.h \
27722 +  include/linux/mm.h \
27723 +    $(wildcard include/config/sysctl.h) \
27724 +    $(wildcard include/config/mmu.h) \
27725 +    $(wildcard include/config/stack/growsup.h) \
27726 +    $(wildcard include/config/debug/vm.h) \
27727 +    $(wildcard include/config/shmem.h) \
27728 +    $(wildcard include/config/split/ptlock/cpus.h) \
27729 +    $(wildcard include/config/ia64.h) \
27730 +    $(wildcard include/config/proc/fs.h) \
27731 +    $(wildcard include/config/debug/pagealloc.h) \
27732 +  include/linux/capability.h \
27733 +  include/linux/rbtree.h \
27734 +  include/linux/prio_tree.h \
27735 +  include/linux/fs.h \
27736 +    $(wildcard include/config/dnotify.h) \
27737 +    $(wildcard include/config/vserver/cowbl.h) \
27738 +    $(wildcard include/config/quota.h) \
27739 +    $(wildcard include/config/inotify.h) \
27740 +    $(wildcard include/config/security.h) \
27741 +    $(wildcard include/config/epoll.h) \
27742 +    $(wildcard include/config/auditsyscall.h) \
27743 +    $(wildcard include/config/block.h) \
27744 +    $(wildcard include/config/fs/xip.h) \
27745 +    $(wildcard include/config/migration.h) \
27746 +  include/linux/limits.h \
27747 +  include/linux/ioctl.h \
27748 +  include/asm/ioctl.h \
27749 +  include/asm-generic/ioctl.h \
27750 +  include/linux/kdev_t.h \
27751 +  include/linux/dcache.h \
27752 +    $(wildcard include/config/profiling.h) \
27753 +  include/linux/rcupdate.h \
27754 +  include/linux/namei.h \
27755 +  include/linux/radix-tree.h \
27756 +  include/linux/pid.h \
27757 +  include/linux/quota.h \
27758 +  include/linux/dqblk_xfs.h \
27759 +  include/linux/dqblk_v1.h \
27760 +  include/linux/dqblk_v2.h \
27761 +  include/linux/nfs_fs_i.h \
27762 +  include/linux/nfs.h \
27763 +  include/linux/sunrpc/msg_prot.h \
27764 +  include/linux/fcntl.h \
27765 +  include/asm/fcntl.h \
27766 +  include/asm-generic/fcntl.h \
27767 +    $(wildcard include/config/64bit.h) \
27768 +  include/linux/err.h \
27769 +  include/linux/debug_locks.h \
27770 +    $(wildcard include/config/debug/locking/api/selftests.h) \
27771 +  include/linux/backing-dev.h \
27772 +  include/linux/mm_types.h \
27773 +  include/asm/pgtable.h \
27774 +    $(wildcard include/config/highpte.h) \
27775 +  include/asm/paravirt.h \
27776 +  include/asm/pgtable-2level-defs.h \
27777 +  include/asm/pgtable-2level.h \
27778 +  include/asm-generic/pgtable.h \
27779 +  include/linux/page-flags.h \
27780 +    $(wildcard include/config/s390.h) \
27781 +    $(wildcard include/config/swap.h) \
27782 +  include/linux/vmstat.h \
27783 +    $(wildcard include/config/vm/event/counters.h) \
27784 +  include/asm-generic/pci-dma-compat.h \
27785 +  include/linux/dma-mapping.h \
27786 +  include/asm/dma-mapping.h \
27787 +  include/asm-generic/pci.h \
27788 +  include/linux/netdevice.h \
27789 +    $(wildcard include/config/ax25.h) \
27790 +    $(wildcard include/config/tr.h) \
27791 +    $(wildcard include/config/net/ipip.h) \
27792 +    $(wildcard include/config/net/ipgre.h) \
27793 +    $(wildcard include/config/ipv6/sit.h) \
27794 +    $(wildcard include/config/ipv6/tunnel.h) \
27795 +    $(wildcard include/config/wireless/ext.h) \
27796 +    $(wildcard include/config/netpoll.h) \
27797 +    $(wildcard include/config/net/poll/controller.h) \
27798 +    $(wildcard include/config/netpoll/trap.h) \
27799 +    $(wildcard include/config/net/dma.h) \
27800 +  include/linux/if.h \
27801 +  include/linux/socket.h \
27802 +    $(wildcard include/config/compat.h) \
27803 +  include/asm/socket.h \
27804 +  include/asm/sockios.h \
27805 +  include/linux/sockios.h \
27806 +  include/linux/uio.h \
27807 +  include/linux/hdlc/ioctl.h \
27808 +  include/linux/if_ether.h \
27809 +  include/linux/skbuff.h \
27810 +    $(wildcard include/config/nf/conntrack.h) \
27811 +    $(wildcard include/config/bridge/netfilter.h) \
27812 +    $(wildcard include/config/vlan/8021q.h) \
27813 +    $(wildcard include/config/net/sched.h) \
27814 +    $(wildcard include/config/net/cls/act.h) \
27815 +    $(wildcard include/config/network/secmark.h) \
27816 +  include/linux/net.h \
27817 +  include/linux/random.h \
27818 +  include/linux/sysctl.h \
27819 +    $(wildcard include/config/icmp/ipod.h) \
27820 +    $(wildcard include/config/web100/net100.h) \
27821 +    $(wildcard include/config/web100/stats.h) \
27822 +  include/linux/textsearch.h \
27823 +  include/net/checksum.h \
27824 +  include/asm/uaccess.h \
27825 +    $(wildcard include/config/x86/intel/usercopy.h) \
27826 +    $(wildcard include/config/x86/wp/works/ok.h) \
27827 +  include/asm/checksum.h \
27828 +  include/linux/in6.h \
27829 +  include/linux/dmaengine.h \
27830 +    $(wildcard include/config/dma/engine.h) \
27831 +  include/linux/hrtimer.h \
27832 +    $(wildcard include/config/high/res/timers.h) \
27833 +    $(wildcard include/config/timer/stats.h) \
27834 +  include/linux/ktime.h \
27835 +    $(wildcard include/config/ktime/scalar.h) \
27836 +  include/linux/jiffies.h \
27837 +  include/linux/calc64.h \
27838 +  include/asm/div64.h \
27839 +  include/linux/timex.h \
27840 +    $(wildcard include/config/time/interpolation.h) \
27841 +    $(wildcard include/config/no/hz.h) \
27842 +  include/asm/param.h \
27843 +    $(wildcard include/config/hz.h) \
27844 +  include/asm/timex.h \
27845 +  include/asm/tsc.h \
27846 +    $(wildcard include/config/x86/tsc.h) \
27847 +    $(wildcard include/config/x86/generic.h) \
27848 +  include/linux/if_packet.h \
27849 +  include/linux/timer.h \
27850 +  include/linux/interrupt.h \
27851 +    $(wildcard include/config/generic/irq/probe.h) \
27852 +  include/linux/irqreturn.h \
27853 +  include/linux/hardirq.h \
27854 +    $(wildcard include/config/preempt/bkl.h) \
27855 +    $(wildcard include/config/virt/cpu/accounting.h) \
27856 +  include/linux/smp_lock.h \
27857 +    $(wildcard include/config/lock/kernel.h) \
27858 +  include/linux/sched.h \
27859 +    $(wildcard include/config/detect/softlockup.h) \
27860 +    $(wildcard include/config/keys.h) \
27861 +    $(wildcard include/config/bsd/process/acct.h) \
27862 +    $(wildcard include/config/taskstats.h) \
27863 +    $(wildcard include/config/inotify/user.h) \
27864 +    $(wildcard include/config/schedstats.h) \
27865 +    $(wildcard include/config/task/delay/acct.h) \
27866 +    $(wildcard include/config/blk/dev/io/trace.h) \
27867 +    $(wildcard include/config/cc/stackprotector.h) \
27868 +    $(wildcard include/config/sysvipc.h) \
27869 +    $(wildcard include/config/rt/mutexes.h) \
27870 +    $(wildcard include/config/task/xacct.h) \
27871 +    $(wildcard include/config/cpusets.h) \
27872 +    $(wildcard include/config/fault/injection.h) \
27873 +  include/asm/cputime.h \
27874 +  include/asm-generic/cputime.h \
27875 +  include/linux/sem.h \
27876 +  include/linux/ipc.h \
27877 +    $(wildcard include/config/ipc/ns.h) \
27878 +  include/asm/ipcbuf.h \
27879 +  include/asm/sembuf.h \
27880 +  include/linux/signal.h \
27881 +  include/asm/signal.h \
27882 +  include/asm-generic/signal.h \
27883 +  include/asm/siginfo.h \
27884 +  include/asm-generic/siginfo.h \
27885 +  include/linux/securebits.h \
27886 +  include/linux/fs_struct.h \
27887 +  include/linux/seccomp.h \
27888 +    $(wildcard include/config/seccomp.h) \
27889 +  include/linux/futex.h \
27890 +    $(wildcard include/config/futex.h) \
27891 +  include/linux/rtmutex.h \
27892 +    $(wildcard include/config/debug/rt/mutexes.h) \
27893 +  include/linux/plist.h \
27894 +    $(wildcard include/config/debug/pi/list.h) \
27895 +  include/linux/param.h \
27896 +  include/linux/resource.h \
27897 +  include/asm/resource.h \
27898 +  include/asm-generic/resource.h \
27899 +  include/linux/task_io_accounting.h \
27900 +    $(wildcard include/config/task/io/accounting.h) \
27901 +  include/linux/aio.h \
27902 +  include/linux/workqueue.h \
27903 +  include/linux/aio_abi.h \
27904 +  include/asm/hardirq.h \
27905 +  include/linux/irq.h \
27906 +    $(wildcard include/config/irq/per/cpu.h) \
27907 +    $(wildcard include/config/irq/release/method.h) \
27908 +    $(wildcard include/config/generic/pending/irq.h) \
27909 +    $(wildcard include/config/irqbalance.h) \
27910 +    $(wildcard include/config/auto/irq/affinity.h) \
27911 +    $(wildcard include/config/generic/hardirqs/no//do/irq.h) \
27912 +  include/asm/irq.h \
27913 +  include/asm-i386/mach-default/irq_vectors.h \
27914 +  include/asm-i386/mach-default/irq_vectors_limits.h \
27915 +  include/asm/irq_regs.h \
27916 +  include/asm/hw_irq.h \
27917 +  include/linux/profile.h \
27918 +  include/asm/sections.h \
27919 +  include/asm-generic/sections.h \
27920 +  include/linux/irq_cpustat.h \
27921 +  include/linux/ethtool.h \
27922 +  drivers/net/igb/kcompat.h \
27923 +    $(wildcard include/config/e1000/napi.h) \
27924 +    $(wildcard include/config/e1000e/napi.h) \
27925 +    $(wildcard include/config/ixgb/napi.h) \
27926 +    $(wildcard include/config/e1000/disable/packet/split.h) \
27927 +    $(wildcard include/config/netdevices/multiqueue.h) \
27928 +  include/linux/version.h \
27929 +  include/linux/etherdevice.h \
27930 +  include/linux/in.h \
27931 +  include/linux/ip.h \
27932 +  include/linux/udp.h \
27933 +  include/net/inet_sock.h \
27934 +    $(wildcard include/config/ipv6.h) \
27935 +  include/linux/jhash.h \
27936 +  include/net/flow.h \
27937 +    $(wildcard include/config/ipv6/mip6.h) \
27938 +  include/net/sock.h \
27939 +    $(wildcard include/config/security/network.h) \
27940 +  include/linux/security.h \
27941 +    $(wildcard include/config/security/network/xfrm.h) \
27942 +  include/linux/binfmts.h \
27943 +  include/linux/shm.h \
27944 +  include/asm/shmparam.h \
27945 +  include/asm/shmbuf.h \
27946 +  include/linux/msg.h \
27947 +  include/asm/msgbuf.h \
27948 +  include/linux/key.h \
27949 +  include/linux/xfrm.h \
27950 +  include/linux/filter.h \
27951 +  include/net/dst.h \
27952 +    $(wildcard include/config/net/cls/route.h) \
27953 +    $(wildcard include/config/xfrm.h) \
27954 +  include/linux/rtnetlink.h \
27955 +  include/linux/netlink.h \
27956 +  include/linux/if_link.h \
27957 +  include/linux/if_addr.h \
27958 +  include/linux/neighbour.h \
27959 +  include/net/neighbour.h \
27960 +  include/linux/seq_file.h \
27961 +  include/net/rtnetlink.h \
27962 +  include/net/netlink.h \
27963 +  include/net/request_sock.h \
27964 +  include/linux/mii.h \
27965 +  include/linux/latency.h \
27966 +  drivers/net/igb/e1000_api.h \
27967 +  drivers/net/igb/e1000_hw.h \
27968 +  drivers/net/igb/e1000_osdep.h \
27969 +  drivers/net/igb/e1000_regs.h \
27970 +  drivers/net/igb/e1000_defines.h \
27971 +    $(wildcard include/config/res.h) \
27972 +    $(wildcard include/config/fault.h) \
27973 +  drivers/net/igb/e1000_mac.h \
27974 +  drivers/net/igb/e1000_phy.h \
27975 +  drivers/net/igb/e1000_nvm.h \
27976 +  drivers/net/igb/e1000_manage.h \
27977 +  drivers/net/igb/e1000_82575.h \
27978 +
27979 +drivers/net/igb/kcompat.o: $(deps_drivers/net/igb/kcompat.o)
27980 +
27981 +$(deps_drivers/net/igb/kcompat.o):
27982 diff -Nru vanilla/drivers/net/igb/Makefile linux-i686-2.6.22/drivers/net/igb/Makefile
27983 --- vanilla/drivers/net/igb/Makefile    1969-12-31 19:00:00.000000000 -0500
27984 +++ linux-i686-2.6.22/drivers/net/igb/Makefile  2009-07-16 19:53:34.000000000 -0400
27985 @@ -0,0 +1,32 @@
27986 +################################################################################
27987 +#
27988 +# Intel(R) Gigabit Ethernet Linux driver
27989 +# Copyright(c) 2007-2008 Intel Corporation.
27990 +#
27991 +# This program is free software; you can redistribute it and/or modify it
27992 +# under the terms and conditions of the GNU General Public License,
27993 +# version 2, as published by the Free Software Foundation.
27994 +#
27995 +# This program is distributed in the hope it will be useful, but WITHOUT
27996 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
27997 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
27998 +# more details.
27999 +#
28000 +# You should have received a copy of the GNU General Public License along with
28001 +# this program; if not, write to the Free Software Foundation, Inc.,
28002 +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
28003 +#
28004 +# The full GNU General Public License is included in this distribution in
28005 +# the file called "COPYING".
28006 +#
28007 +# Contact Information:
28008 +# e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
28009 +# Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
28010 +#
28011 +################################################################################
28012 +
28013 +###########################################################################
28014 +
28015 +obj-$(CONFIG_IGB) += igb.o
28016 +
28017 +igb-objs := e1000_82575.o igb_main.o e1000_mac.o e1000_nvm.o e1000_phy.o e1000_manage.o igb_param.o igb_ethtool.o kcompat.o e1000_api.o
28018 diff -Nru vanilla/drivers/net/igb/Makefile~ linux-i686-2.6.22/drivers/net/igb/Makefile~
28019 --- vanilla/drivers/net/igb/Makefile~   1969-12-31 19:00:00.000000000 -0500
28020 +++ linux-i686-2.6.22/drivers/net/igb/Makefile~ 2009-07-16 19:29:30.000000000 -0400
28021 @@ -0,0 +1,32 @@
28022 +################################################################################
28023 +#
28024 +# Intel(R) Gigabit Ethernet Linux driver
28025 +# Copyright(c) 2007-2008 Intel Corporation.
28026 +#
28027 +# This program is free software; you can redistribute it and/or modify it
28028 +# under the terms and conditions of the GNU General Public License,
28029 +# version 2, as published by the Free Software Foundation.
28030 +#
28031 +# This program is distributed in the hope it will be useful, but WITHOUT
28032 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28033 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
28034 +# more details.
28035 +#
28036 +# You should have received a copy of the GNU General Public License along with
28037 +# this program; if not, write to the Free Software Foundation, Inc.,
28038 +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
28039 +#
28040 +# The full GNU General Public License is included in this distribution in
28041 +# the file called "COPYING".
28042 +#
28043 +# Contact Information:
28044 +# e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
28045 +# Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
28046 +#
28047 +################################################################################
28048 +
28049 +###########################################################################
28050 +
28051 +obj-$(CONFIG_IGB) += igb.o
28052 +
28053 +igb-objs := e1000_82575.o igb_main.o e1000_mac.0 e1000_nvm.o e1000_phy.o e1000_manage.o igb_param.o igb_ethtool.o kcompat.o e1000_api.o
28054 --- linux-2.6.22-710/drivers/net/Kconfig        2009-07-16 19:36:18.000000000 -0400
28055 +++ linux-i686-2.6.22/drivers/net/Kconfig       2009-07-16 19:56:54.000000000 -0400
28056 @@ -1905,6 +1905,12 @@
28057  
28058  if NETDEV_1000
28059  
28060 +config IGB
28061 +       tristate "Intel(R) IGB Ethernet support"
28062 +       depends on PCI
28063 +       ---help---
28064 +         Marc's port of the IGB driver.
28065 +
28066  config ACENIC
28067         tristate "Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support"
28068         depends on PCI
28069 --- linux-a/drivers/net/Makefile        2009-07-17 00:29:08.000000000 -0400
28070 +++ linux-b/drivers/net/Makefile        2009-07-17 00:29:37.000000000 -0400
28071 @@ -2,6 +2,7 @@
28072  # Makefile for the Linux network (ethercard) device drivers.
28073  #
28074  obj-m += vnet_tun.o
28075 +obj-$(CONFIG_IGB) += igb/
28076  obj-$(CONFIG_E1000) += e1000/
28077  obj-$(CONFIG_E1000E) += e1000e/
28078  obj-$(CONFIG_IBM_EMAC) += ibm_emac/
28079