diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-07-05 14:32:39 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-07-05 14:32:39 -0400 |
commit | c0bc8721b8d0380ec69fa97578c91201201b05a9 (patch) | |
tree | b027c9aa8e0d601ebe6c86bddc181c4d4ecc7cda /drivers/net/e1000/e1000_main.c | |
parent | bce305f4fe779f29d99d414685243f5da0803254 (diff) | |
parent | e4ac9773be2ea01b707da0496ab1527ec6cdda4e (diff) |
Merge branch 'upstream' of git://lost.foo-projects.org/~ahkok/git/netdev-2.6 into upstream
Conflicts:
drivers/net/e1000/e1000_main.c
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 378 |
1 files changed, 265 insertions, 113 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index f77624f5f17b..f06b281c8f6e 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -36,7 +36,7 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
36 | #else | 36 | #else |
37 | #define DRIVERNAPI "-NAPI" | 37 | #define DRIVERNAPI "-NAPI" |
38 | #endif | 38 | #endif |
39 | #define DRV_VERSION "7.0.38-k4"DRIVERNAPI | 39 | #define DRV_VERSION "7.1.9-k2"DRIVERNAPI |
40 | char e1000_driver_version[] = DRV_VERSION; | 40 | char e1000_driver_version[] = DRV_VERSION; |
41 | static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 41 | static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
42 | 42 | ||
@@ -73,6 +73,11 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
73 | INTEL_E1000_ETHERNET_DEVICE(0x1026), | 73 | INTEL_E1000_ETHERNET_DEVICE(0x1026), |
74 | INTEL_E1000_ETHERNET_DEVICE(0x1027), | 74 | INTEL_E1000_ETHERNET_DEVICE(0x1027), |
75 | INTEL_E1000_ETHERNET_DEVICE(0x1028), | 75 | INTEL_E1000_ETHERNET_DEVICE(0x1028), |
76 | INTEL_E1000_ETHERNET_DEVICE(0x1049), | ||
77 | INTEL_E1000_ETHERNET_DEVICE(0x104A), | ||
78 | INTEL_E1000_ETHERNET_DEVICE(0x104B), | ||
79 | INTEL_E1000_ETHERNET_DEVICE(0x104C), | ||
80 | INTEL_E1000_ETHERNET_DEVICE(0x104D), | ||
76 | INTEL_E1000_ETHERNET_DEVICE(0x105E), | 81 | INTEL_E1000_ETHERNET_DEVICE(0x105E), |
77 | INTEL_E1000_ETHERNET_DEVICE(0x105F), | 82 | INTEL_E1000_ETHERNET_DEVICE(0x105F), |
78 | INTEL_E1000_ETHERNET_DEVICE(0x1060), | 83 | INTEL_E1000_ETHERNET_DEVICE(0x1060), |
@@ -96,6 +101,8 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
96 | INTEL_E1000_ETHERNET_DEVICE(0x109A), | 101 | INTEL_E1000_ETHERNET_DEVICE(0x109A), |
97 | INTEL_E1000_ETHERNET_DEVICE(0x10B5), | 102 | INTEL_E1000_ETHERNET_DEVICE(0x10B5), |
98 | INTEL_E1000_ETHERNET_DEVICE(0x10B9), | 103 | INTEL_E1000_ETHERNET_DEVICE(0x10B9), |
104 | INTEL_E1000_ETHERNET_DEVICE(0x10BA), | ||
105 | INTEL_E1000_ETHERNET_DEVICE(0x10BB), | ||
99 | /* required last entry */ | 106 | /* required last entry */ |
100 | {0,} | 107 | {0,} |
101 | }; | 108 | }; |
@@ -133,7 +140,6 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter, | |||
133 | static void e1000_set_multi(struct net_device *netdev); | 140 | static void e1000_set_multi(struct net_device *netdev); |
134 | static void e1000_update_phy_info(unsigned long data); | 141 | static void e1000_update_phy_info(unsigned long data); |
135 | static void e1000_watchdog(unsigned long data); | 142 | static void e1000_watchdog(unsigned long data); |
136 | static void e1000_watchdog_task(struct e1000_adapter *adapter); | ||
137 | static void e1000_82547_tx_fifo_stall(unsigned long data); | 143 | static void e1000_82547_tx_fifo_stall(unsigned long data); |
138 | static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev); | 144 | static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev); |
139 | static struct net_device_stats * e1000_get_stats(struct net_device *netdev); | 145 | static struct net_device_stats * e1000_get_stats(struct net_device *netdev); |
@@ -178,8 +184,8 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); | |||
178 | static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); | 184 | static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); |
179 | static void e1000_restore_vlan(struct e1000_adapter *adapter); | 185 | static void e1000_restore_vlan(struct e1000_adapter *adapter); |
180 | 186 | ||
181 | #ifdef CONFIG_PM | ||
182 | static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); | 187 | static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); |
188 | #ifdef CONFIG_PM | ||
183 | static int e1000_resume(struct pci_dev *pdev); | 189 | static int e1000_resume(struct pci_dev *pdev); |
184 | #endif | 190 | #endif |
185 | static void e1000_shutdown(struct pci_dev *pdev); | 191 | static void e1000_shutdown(struct pci_dev *pdev); |
@@ -206,8 +212,8 @@ static struct pci_driver e1000_driver = { | |||
206 | .probe = e1000_probe, | 212 | .probe = e1000_probe, |
207 | .remove = __devexit_p(e1000_remove), | 213 | .remove = __devexit_p(e1000_remove), |
208 | /* Power Managment Hooks */ | 214 | /* Power Managment Hooks */ |
209 | #ifdef CONFIG_PM | ||
210 | .suspend = e1000_suspend, | 215 | .suspend = e1000_suspend, |
216 | #ifdef CONFIG_PM | ||
211 | .resume = e1000_resume, | 217 | .resume = e1000_resume, |
212 | #endif | 218 | #endif |
213 | .shutdown = e1000_shutdown, | 219 | .shutdown = e1000_shutdown, |
@@ -261,6 +267,44 @@ e1000_exit_module(void) | |||
261 | 267 | ||
262 | module_exit(e1000_exit_module); | 268 | module_exit(e1000_exit_module); |
263 | 269 | ||
270 | static int e1000_request_irq(struct e1000_adapter *adapter) | ||
271 | { | ||
272 | struct net_device *netdev = adapter->netdev; | ||
273 | int flags, err = 0; | ||
274 | |||
275 | flags = IRQF_SHARED; | ||
276 | #ifdef CONFIG_PCI_MSI | ||
277 | if (adapter->hw.mac_type > e1000_82547_rev_2) { | ||
278 | adapter->have_msi = TRUE; | ||
279 | if ((err = pci_enable_msi(adapter->pdev))) { | ||
280 | DPRINTK(PROBE, ERR, | ||
281 | "Unable to allocate MSI interrupt Error: %d\n", err); | ||
282 | adapter->have_msi = FALSE; | ||
283 | } | ||
284 | } | ||
285 | if (adapter->have_msi) | ||
286 | flags &= ~SA_SHIRQ; | ||
287 | #endif | ||
288 | if ((err = request_irq(adapter->pdev->irq, &e1000_intr, flags, | ||
289 | netdev->name, netdev))) | ||
290 | DPRINTK(PROBE, ERR, | ||
291 | "Unable to allocate interrupt Error: %d\n", err); | ||
292 | |||
293 | return err; | ||
294 | } | ||
295 | |||
296 | static void e1000_free_irq(struct e1000_adapter *adapter) | ||
297 | { | ||
298 | struct net_device *netdev = adapter->netdev; | ||
299 | |||
300 | free_irq(adapter->pdev->irq, netdev); | ||
301 | |||
302 | #ifdef CONFIG_PCI_MSI | ||
303 | if (adapter->have_msi) | ||
304 | pci_disable_msi(adapter->pdev); | ||
305 | #endif | ||
306 | } | ||
307 | |||
264 | /** | 308 | /** |
265 | * e1000_irq_disable - Mask off interrupt generation on the NIC | 309 | * e1000_irq_disable - Mask off interrupt generation on the NIC |
266 | * @adapter: board private structure | 310 | * @adapter: board private structure |
@@ -329,6 +373,7 @@ e1000_release_hw_control(struct e1000_adapter *adapter) | |||
329 | { | 373 | { |
330 | uint32_t ctrl_ext; | 374 | uint32_t ctrl_ext; |
331 | uint32_t swsm; | 375 | uint32_t swsm; |
376 | uint32_t extcnf; | ||
332 | 377 | ||
333 | /* Let firmware taken over control of h/w */ | 378 | /* Let firmware taken over control of h/w */ |
334 | switch (adapter->hw.mac_type) { | 379 | switch (adapter->hw.mac_type) { |
@@ -343,6 +388,11 @@ e1000_release_hw_control(struct e1000_adapter *adapter) | |||
343 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 388 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
344 | E1000_WRITE_REG(&adapter->hw, SWSM, | 389 | E1000_WRITE_REG(&adapter->hw, SWSM, |
345 | swsm & ~E1000_SWSM_DRV_LOAD); | 390 | swsm & ~E1000_SWSM_DRV_LOAD); |
391 | case e1000_ich8lan: | ||
392 | extcnf = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
393 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
394 | extcnf & ~E1000_CTRL_EXT_DRV_LOAD); | ||
395 | break; | ||
346 | default: | 396 | default: |
347 | break; | 397 | break; |
348 | } | 398 | } |
@@ -364,6 +414,7 @@ e1000_get_hw_control(struct e1000_adapter *adapter) | |||
364 | { | 414 | { |
365 | uint32_t ctrl_ext; | 415 | uint32_t ctrl_ext; |
366 | uint32_t swsm; | 416 | uint32_t swsm; |
417 | uint32_t extcnf; | ||
367 | /* Let firmware know the driver has taken over */ | 418 | /* Let firmware know the driver has taken over */ |
368 | switch (adapter->hw.mac_type) { | 419 | switch (adapter->hw.mac_type) { |
369 | case e1000_82571: | 420 | case e1000_82571: |
@@ -378,6 +429,11 @@ e1000_get_hw_control(struct e1000_adapter *adapter) | |||
378 | E1000_WRITE_REG(&adapter->hw, SWSM, | 429 | E1000_WRITE_REG(&adapter->hw, SWSM, |
379 | swsm | E1000_SWSM_DRV_LOAD); | 430 | swsm | E1000_SWSM_DRV_LOAD); |
380 | break; | 431 | break; |
432 | case e1000_ich8lan: | ||
433 | extcnf = E1000_READ_REG(&adapter->hw, EXTCNF_CTRL); | ||
434 | E1000_WRITE_REG(&adapter->hw, EXTCNF_CTRL, | ||
435 | extcnf | E1000_EXTCNF_CTRL_SWFLAG); | ||
436 | break; | ||
381 | default: | 437 | default: |
382 | break; | 438 | break; |
383 | } | 439 | } |
@@ -387,18 +443,10 @@ int | |||
387 | e1000_up(struct e1000_adapter *adapter) | 443 | e1000_up(struct e1000_adapter *adapter) |
388 | { | 444 | { |
389 | struct net_device *netdev = adapter->netdev; | 445 | struct net_device *netdev = adapter->netdev; |
390 | int i, err; | 446 | int i; |
391 | 447 | ||
392 | /* hardware has been reset, we need to reload some things */ | 448 | /* hardware has been reset, we need to reload some things */ |
393 | 449 | ||
394 | /* Reset the PHY if it was previously powered down */ | ||
395 | if (adapter->hw.media_type == e1000_media_type_copper) { | ||
396 | uint16_t mii_reg; | ||
397 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | ||
398 | if (mii_reg & MII_CR_POWER_DOWN) | ||
399 | e1000_phy_hw_reset(&adapter->hw); | ||
400 | } | ||
401 | |||
402 | e1000_set_multi(netdev); | 450 | e1000_set_multi(netdev); |
403 | 451 | ||
404 | e1000_restore_vlan(adapter); | 452 | e1000_restore_vlan(adapter); |
@@ -415,24 +463,6 @@ e1000_up(struct e1000_adapter *adapter) | |||
415 | E1000_DESC_UNUSED(ring)); | 463 | E1000_DESC_UNUSED(ring)); |
416 | } | 464 | } |
417 | 465 | ||
418 | #ifdef CONFIG_PCI_MSI | ||
419 | if (adapter->hw.mac_type > e1000_82547_rev_2) { | ||
420 | adapter->have_msi = TRUE; | ||
421 | if ((err = pci_enable_msi(adapter->pdev))) { | ||
422 | DPRINTK(PROBE, ERR, | ||
423 | "Unable to allocate MSI interrupt Error: %d\n", err); | ||
424 | adapter->have_msi = FALSE; | ||
425 | } | ||
426 | } | ||
427 | #endif | ||
428 | if ((err = request_irq(adapter->pdev->irq, &e1000_intr, | ||
429 | IRQF_SHARED | IRQF_SAMPLE_RANDOM, | ||
430 | netdev->name, netdev))) { | ||
431 | DPRINTK(PROBE, ERR, | ||
432 | "Unable to allocate interrupt Error: %d\n", err); | ||
433 | return err; | ||
434 | } | ||
435 | |||
436 | adapter->tx_queue_len = netdev->tx_queue_len; | 466 | adapter->tx_queue_len = netdev->tx_queue_len; |
437 | 467 | ||
438 | mod_timer(&adapter->watchdog_timer, jiffies); | 468 | mod_timer(&adapter->watchdog_timer, jiffies); |
@@ -445,21 +475,60 @@ e1000_up(struct e1000_adapter *adapter) | |||
445 | return 0; | 475 | return 0; |
446 | } | 476 | } |
447 | 477 | ||
478 | /** | ||
479 | * e1000_power_up_phy - restore link in case the phy was powered down | ||
480 | * @adapter: address of board private structure | ||
481 | * | ||
482 | * The phy may be powered down to save power and turn off link when the | ||
483 | * driver is unloaded and wake on lan is not enabled (among others) | ||
484 | * *** this routine MUST be followed by a call to e1000_reset *** | ||
485 | * | ||
486 | **/ | ||
487 | |||
488 | static void e1000_power_up_phy(struct e1000_adapter *adapter) | ||
489 | { | ||
490 | uint16_t mii_reg = 0; | ||
491 | |||
492 | /* Just clear the power down bit to wake the phy back up */ | ||
493 | if (adapter->hw.media_type == e1000_media_type_copper) { | ||
494 | /* according to the manual, the phy will retain its | ||
495 | * settings across a power-down/up cycle */ | ||
496 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | ||
497 | mii_reg &= ~MII_CR_POWER_DOWN; | ||
498 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg); | ||
499 | } | ||
500 | } | ||
501 | |||
502 | static void e1000_power_down_phy(struct e1000_adapter *adapter) | ||
503 | { | ||
504 | boolean_t mng_mode_enabled = (adapter->hw.mac_type >= e1000_82571) && | ||
505 | e1000_check_mng_mode(&adapter->hw); | ||
506 | /* Power down the PHY so no link is implied when interface is down | ||
507 | * The PHY cannot be powered down if any of the following is TRUE | ||
508 | * (a) WoL is enabled | ||
509 | * (b) AMT is active | ||
510 | * (c) SoL/IDER session is active */ | ||
511 | if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 && | ||
512 | adapter->hw.mac_type != e1000_ich8lan && | ||
513 | adapter->hw.media_type == e1000_media_type_copper && | ||
514 | !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) && | ||
515 | !mng_mode_enabled && | ||
516 | !e1000_check_phy_reset_block(&adapter->hw)) { | ||
517 | uint16_t mii_reg = 0; | ||
518 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | ||
519 | mii_reg |= MII_CR_POWER_DOWN; | ||
520 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg); | ||
521 | mdelay(1); | ||
522 | } | ||
523 | } | ||
524 | |||
448 | void | 525 | void |
449 | e1000_down(struct e1000_adapter *adapter) | 526 | e1000_down(struct e1000_adapter *adapter) |
450 | { | 527 | { |
451 | struct net_device *netdev = adapter->netdev; | 528 | struct net_device *netdev = adapter->netdev; |
452 | boolean_t mng_mode_enabled = (adapter->hw.mac_type >= e1000_82571) && | ||
453 | e1000_check_mng_mode(&adapter->hw); | ||
454 | 529 | ||
455 | e1000_irq_disable(adapter); | 530 | e1000_irq_disable(adapter); |
456 | 531 | ||
457 | free_irq(adapter->pdev->irq, netdev); | ||
458 | #ifdef CONFIG_PCI_MSI | ||
459 | if (adapter->hw.mac_type > e1000_82547_rev_2 && | ||
460 | adapter->have_msi == TRUE) | ||
461 | pci_disable_msi(adapter->pdev); | ||
462 | #endif | ||
463 | del_timer_sync(&adapter->tx_fifo_stall_timer); | 532 | del_timer_sync(&adapter->tx_fifo_stall_timer); |
464 | del_timer_sync(&adapter->watchdog_timer); | 533 | del_timer_sync(&adapter->watchdog_timer); |
465 | del_timer_sync(&adapter->phy_info_timer); | 534 | del_timer_sync(&adapter->phy_info_timer); |
@@ -476,23 +545,17 @@ e1000_down(struct e1000_adapter *adapter) | |||
476 | e1000_reset(adapter); | 545 | e1000_reset(adapter); |
477 | e1000_clean_all_tx_rings(adapter); | 546 | e1000_clean_all_tx_rings(adapter); |
478 | e1000_clean_all_rx_rings(adapter); | 547 | e1000_clean_all_rx_rings(adapter); |
548 | } | ||
479 | 549 | ||
480 | /* Power down the PHY so no link is implied when interface is down * | 550 | void |
481 | * The PHY cannot be powered down if any of the following is TRUE * | 551 | e1000_reinit_locked(struct e1000_adapter *adapter) |
482 | * (a) WoL is enabled | 552 | { |
483 | * (b) AMT is active | 553 | WARN_ON(in_interrupt()); |
484 | * (c) SoL/IDER session is active */ | 554 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) |
485 | if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 && | 555 | msleep(1); |
486 | adapter->hw.media_type == e1000_media_type_copper && | 556 | e1000_down(adapter); |
487 | !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) && | 557 | e1000_up(adapter); |
488 | !mng_mode_enabled && | 558 | clear_bit(__E1000_RESETTING, &adapter->flags); |
489 | !e1000_check_phy_reset_block(&adapter->hw)) { | ||
490 | uint16_t mii_reg; | ||
491 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | ||
492 | mii_reg |= MII_CR_POWER_DOWN; | ||
493 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg); | ||
494 | mdelay(1); | ||
495 | } | ||
496 | } | 559 | } |
497 | 560 | ||
498 | void | 561 | void |
@@ -518,6 +581,9 @@ e1000_reset(struct e1000_adapter *adapter) | |||
518 | case e1000_82573: | 581 | case e1000_82573: |
519 | pba = E1000_PBA_12K; | 582 | pba = E1000_PBA_12K; |
520 | break; | 583 | break; |
584 | case e1000_ich8lan: | ||
585 | pba = E1000_PBA_8K; | ||
586 | break; | ||
521 | default: | 587 | default: |
522 | pba = E1000_PBA_48K; | 588 | pba = E1000_PBA_48K; |
523 | break; | 589 | break; |
@@ -542,6 +608,12 @@ e1000_reset(struct e1000_adapter *adapter) | |||
542 | /* Set the FC high water mark to 90% of the FIFO size. | 608 | /* Set the FC high water mark to 90% of the FIFO size. |
543 | * Required to clear last 3 LSB */ | 609 | * Required to clear last 3 LSB */ |
544 | fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8; | 610 | fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8; |
611 | /* We can't use 90% on small FIFOs because the remainder | ||
612 | * would be less than 1 full frame. In this case, we size | ||
613 | * it to allow at least a full frame above the high water | ||
614 | * mark. */ | ||
615 | if (pba < E1000_PBA_16K) | ||
616 | fc_high_water_mark = (pba * 1024) - 1600; | ||
545 | 617 | ||
546 | adapter->hw.fc_high_water = fc_high_water_mark; | 618 | adapter->hw.fc_high_water = fc_high_water_mark; |
547 | adapter->hw.fc_low_water = fc_high_water_mark - 8; | 619 | adapter->hw.fc_low_water = fc_high_water_mark - 8; |
@@ -564,6 +636,23 @@ e1000_reset(struct e1000_adapter *adapter) | |||
564 | 636 | ||
565 | e1000_reset_adaptive(&adapter->hw); | 637 | e1000_reset_adaptive(&adapter->hw); |
566 | e1000_phy_get_info(&adapter->hw, &adapter->phy_info); | 638 | e1000_phy_get_info(&adapter->hw, &adapter->phy_info); |
639 | |||
640 | if (!adapter->smart_power_down && | ||
641 | (adapter->hw.mac_type == e1000_82571 || | ||
642 | adapter->hw.mac_type == e1000_82572)) { | ||
643 | uint16_t phy_data = 0; | ||
644 | /* speed up time to link by disabling smart power down, ignore | ||
645 | * the return value of this function because there is nothing | ||
646 | * different we would do if it failed */ | ||
647 | e1000_read_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT, | ||
648 | &phy_data); | ||
649 | phy_data &= ~IGP02E1000_PM_SPD; | ||
650 | e1000_write_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT, | ||
651 | phy_data); | ||
652 | } | ||
653 | |||
654 | if (adapter->hw.mac_type < e1000_ich8lan) | ||
655 | /* FIXME: this code is duplicate and wrong for PCI Express */ | ||
567 | if (adapter->en_mng_pt) { | 656 | if (adapter->en_mng_pt) { |
568 | manc = E1000_READ_REG(&adapter->hw, MANC); | 657 | manc = E1000_READ_REG(&adapter->hw, MANC); |
569 | manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST); | 658 | manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST); |
@@ -590,6 +679,7 @@ e1000_probe(struct pci_dev *pdev, | |||
590 | struct net_device *netdev; | 679 | struct net_device *netdev; |
591 | struct e1000_adapter *adapter; | 680 | struct e1000_adapter *adapter; |
592 | unsigned long mmio_start, mmio_len; | 681 | unsigned long mmio_start, mmio_len; |
682 | unsigned long flash_start, flash_len; | ||
593 | 683 | ||
594 | static int cards_found = 0; | 684 | static int cards_found = 0; |
595 | static int e1000_ksp3_port_a = 0; /* global ksp3 port a indication */ | 685 | static int e1000_ksp3_port_a = 0; /* global ksp3 port a indication */ |
@@ -599,10 +689,12 @@ e1000_probe(struct pci_dev *pdev, | |||
599 | if ((err = pci_enable_device(pdev))) | 689 | if ((err = pci_enable_device(pdev))) |
600 | return err; | 690 | return err; |
601 | 691 | ||
602 | if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { | 692 | if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK)) && |
693 | !(err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))) { | ||
603 | pci_using_dac = 1; | 694 | pci_using_dac = 1; |
604 | } else { | 695 | } else { |
605 | if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { | 696 | if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) && |
697 | (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { | ||
606 | E1000_ERR("No usable DMA configuration, aborting\n"); | 698 | E1000_ERR("No usable DMA configuration, aborting\n"); |
607 | return err; | 699 | return err; |
608 | } | 700 | } |
@@ -682,6 +774,19 @@ e1000_probe(struct pci_dev *pdev, | |||
682 | if ((err = e1000_sw_init(adapter))) | 774 | if ((err = e1000_sw_init(adapter))) |
683 | goto err_sw_init; | 775 | goto err_sw_init; |
684 | 776 | ||
777 | /* Flash BAR mapping must happen after e1000_sw_init | ||
778 | * because it depends on mac_type */ | ||
779 | if ((adapter->hw.mac_type == e1000_ich8lan) && | ||
780 | (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { | ||
781 | flash_start = pci_resource_start(pdev, 1); | ||
782 | flash_len = pci_resource_len(pdev, 1); | ||
783 | adapter->hw.flash_address = ioremap(flash_start, flash_len); | ||
784 | if (!adapter->hw.flash_address) { | ||
785 | err = -EIO; | ||
786 | goto err_flashmap; | ||
787 | } | ||
788 | } | ||
789 | |||
685 | if ((err = e1000_check_phy_reset_block(&adapter->hw))) | 790 | if ((err = e1000_check_phy_reset_block(&adapter->hw))) |
686 | DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); | 791 | DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); |
687 | 792 | ||
@@ -700,6 +805,8 @@ e1000_probe(struct pci_dev *pdev, | |||
700 | NETIF_F_HW_VLAN_TX | | 805 | NETIF_F_HW_VLAN_TX | |
701 | NETIF_F_HW_VLAN_RX | | 806 | NETIF_F_HW_VLAN_RX | |
702 | NETIF_F_HW_VLAN_FILTER; | 807 | NETIF_F_HW_VLAN_FILTER; |
808 | if (adapter->hw.mac_type == e1000_ich8lan) | ||
809 | netdev->features &= ~NETIF_F_HW_VLAN_FILTER; | ||
703 | } | 810 | } |
704 | 811 | ||
705 | #ifdef NETIF_F_TSO | 812 | #ifdef NETIF_F_TSO |
@@ -715,11 +822,17 @@ e1000_probe(struct pci_dev *pdev, | |||
715 | if (pci_using_dac) | 822 | if (pci_using_dac) |
716 | netdev->features |= NETIF_F_HIGHDMA; | 823 | netdev->features |= NETIF_F_HIGHDMA; |
717 | 824 | ||
718 | /* hard_start_xmit is safe against parallel locking */ | ||
719 | netdev->features |= NETIF_F_LLTX; | 825 | netdev->features |= NETIF_F_LLTX; |
720 | 826 | ||
721 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); | 827 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); |
722 | 828 | ||
829 | /* initialize eeprom parameters */ | ||
830 | |||
831 | if (e1000_init_eeprom_params(&adapter->hw)) { | ||
832 | E1000_ERR("EEPROM initialization failed\n"); | ||
833 | return -EIO; | ||
834 | } | ||
835 | |||
723 | /* before reading the EEPROM, reset the controller to | 836 | /* before reading the EEPROM, reset the controller to |
724 | * put the device in a known good starting state */ | 837 | * put the device in a known good starting state */ |
725 | 838 | ||
@@ -758,9 +871,6 @@ e1000_probe(struct pci_dev *pdev, | |||
758 | adapter->watchdog_timer.function = &e1000_watchdog; | 871 | adapter->watchdog_timer.function = &e1000_watchdog; |
759 | adapter->watchdog_timer.data = (unsigned long) adapter; | 872 | adapter->watchdog_timer.data = (unsigned long) adapter; |
760 | 873 | ||
761 | INIT_WORK(&adapter->watchdog_task, | ||
762 | (void (*)(void *))e1000_watchdog_task, adapter); | ||
763 | |||
764 | init_timer(&adapter->phy_info_timer); | 874 | init_timer(&adapter->phy_info_timer); |
765 | adapter->phy_info_timer.function = &e1000_update_phy_info; | 875 | adapter->phy_info_timer.function = &e1000_update_phy_info; |
766 | adapter->phy_info_timer.data = (unsigned long) adapter; | 876 | adapter->phy_info_timer.data = (unsigned long) adapter; |
@@ -790,6 +900,11 @@ e1000_probe(struct pci_dev *pdev, | |||
790 | EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data); | 900 | EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data); |
791 | eeprom_apme_mask = E1000_EEPROM_82544_APM; | 901 | eeprom_apme_mask = E1000_EEPROM_82544_APM; |
792 | break; | 902 | break; |
903 | case e1000_ich8lan: | ||
904 | e1000_read_eeprom(&adapter->hw, | ||
905 | EEPROM_INIT_CONTROL1_REG, 1, &eeprom_data); | ||
906 | eeprom_apme_mask = E1000_EEPROM_ICH8_APME; | ||
907 | break; | ||
793 | case e1000_82546: | 908 | case e1000_82546: |
794 | case e1000_82546_rev_3: | 909 | case e1000_82546_rev_3: |
795 | case e1000_82571: | 910 | case e1000_82571: |
@@ -849,6 +964,9 @@ e1000_probe(struct pci_dev *pdev, | |||
849 | return 0; | 964 | return 0; |
850 | 965 | ||
851 | err_register: | 966 | err_register: |
967 | if (adapter->hw.flash_address) | ||
968 | iounmap(adapter->hw.flash_address); | ||
969 | err_flashmap: | ||
852 | err_sw_init: | 970 | err_sw_init: |
853 | err_eeprom: | 971 | err_eeprom: |
854 | iounmap(adapter->hw.hw_addr); | 972 | iounmap(adapter->hw.hw_addr); |
@@ -882,6 +1000,7 @@ e1000_remove(struct pci_dev *pdev) | |||
882 | flush_scheduled_work(); | 1000 | flush_scheduled_work(); |
883 | 1001 | ||
884 | if (adapter->hw.mac_type >= e1000_82540 && | 1002 | if (adapter->hw.mac_type >= e1000_82540 && |
1003 | adapter->hw.mac_type != e1000_ich8lan && | ||
885 | adapter->hw.media_type == e1000_media_type_copper) { | 1004 | adapter->hw.media_type == e1000_media_type_copper) { |
886 | manc = E1000_READ_REG(&adapter->hw, MANC); | 1005 | manc = E1000_READ_REG(&adapter->hw, MANC); |
887 | if (manc & E1000_MANC_SMBUS_EN) { | 1006 | if (manc & E1000_MANC_SMBUS_EN) { |
@@ -910,6 +1029,8 @@ e1000_remove(struct pci_dev *pdev) | |||
910 | #endif | 1029 | #endif |
911 | 1030 | ||
912 | iounmap(adapter->hw.hw_addr); | 1031 | iounmap(adapter->hw.hw_addr); |
1032 | if (adapter->hw.flash_address) | ||
1033 | iounmap(adapter->hw.flash_address); | ||
913 | pci_release_regions(pdev); | 1034 | pci_release_regions(pdev); |
914 | 1035 | ||
915 | free_netdev(netdev); | 1036 | free_netdev(netdev); |
@@ -960,13 +1081,6 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
960 | return -EIO; | 1081 | return -EIO; |
961 | } | 1082 | } |
962 | 1083 | ||
963 | /* initialize eeprom parameters */ | ||
964 | |||
965 | if (e1000_init_eeprom_params(hw)) { | ||
966 | E1000_ERR("EEPROM initialization failed\n"); | ||
967 | return -EIO; | ||
968 | } | ||
969 | |||
970 | switch (hw->mac_type) { | 1084 | switch (hw->mac_type) { |
971 | default: | 1085 | default: |
972 | break; | 1086 | break; |
@@ -1078,6 +1192,10 @@ e1000_open(struct net_device *netdev) | |||
1078 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1192 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1079 | int err; | 1193 | int err; |
1080 | 1194 | ||
1195 | /* disallow open during test */ | ||
1196 | if (test_bit(__E1000_DRIVER_TESTING, &adapter->flags)) | ||
1197 | return -EBUSY; | ||
1198 | |||
1081 | /* allocate transmit descriptors */ | 1199 | /* allocate transmit descriptors */ |
1082 | 1200 | ||
1083 | if ((err = e1000_setup_all_tx_resources(adapter))) | 1201 | if ((err = e1000_setup_all_tx_resources(adapter))) |
@@ -1088,6 +1206,12 @@ e1000_open(struct net_device *netdev) | |||
1088 | if ((err = e1000_setup_all_rx_resources(adapter))) | 1206 | if ((err = e1000_setup_all_rx_resources(adapter))) |
1089 | goto err_setup_rx; | 1207 | goto err_setup_rx; |
1090 | 1208 | ||
1209 | err = e1000_request_irq(adapter); | ||
1210 | if (err) | ||
1211 | goto err_up; | ||
1212 | |||
1213 | e1000_power_up_phy(adapter); | ||
1214 | |||
1091 | if ((err = e1000_up(adapter))) | 1215 | if ((err = e1000_up(adapter))) |
1092 | goto err_up; | 1216 | goto err_up; |
1093 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; | 1217 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
@@ -1131,7 +1255,10 @@ e1000_close(struct net_device *netdev) | |||
1131 | { | 1255 | { |
1132 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1256 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1133 | 1257 | ||
1258 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); | ||
1134 | e1000_down(adapter); | 1259 | e1000_down(adapter); |
1260 | e1000_power_down_phy(adapter); | ||
1261 | e1000_free_irq(adapter); | ||
1135 | 1262 | ||
1136 | e1000_free_all_tx_resources(adapter); | 1263 | e1000_free_all_tx_resources(adapter); |
1137 | e1000_free_all_rx_resources(adapter); | 1264 | e1000_free_all_rx_resources(adapter); |
@@ -1189,8 +1316,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter, | |||
1189 | int size; | 1316 | int size; |
1190 | 1317 | ||
1191 | size = sizeof(struct e1000_buffer) * txdr->count; | 1318 | size = sizeof(struct e1000_buffer) * txdr->count; |
1192 | 1319 | txdr->buffer_info = vmalloc(size); | |
1193 | txdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus)); | ||
1194 | if (!txdr->buffer_info) { | 1320 | if (!txdr->buffer_info) { |
1195 | DPRINTK(PROBE, ERR, | 1321 | DPRINTK(PROBE, ERR, |
1196 | "Unable to allocate memory for the transmit descriptor ring\n"); | 1322 | "Unable to allocate memory for the transmit descriptor ring\n"); |
@@ -1302,11 +1428,11 @@ e1000_configure_tx(struct e1000_adapter *adapter) | |||
1302 | tdba = adapter->tx_ring[0].dma; | 1428 | tdba = adapter->tx_ring[0].dma; |
1303 | tdlen = adapter->tx_ring[0].count * | 1429 | tdlen = adapter->tx_ring[0].count * |
1304 | sizeof(struct e1000_tx_desc); | 1430 | sizeof(struct e1000_tx_desc); |
1305 | E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL)); | ||
1306 | E1000_WRITE_REG(hw, TDBAH, (tdba >> 32)); | ||
1307 | E1000_WRITE_REG(hw, TDLEN, tdlen); | 1431 | E1000_WRITE_REG(hw, TDLEN, tdlen); |
1308 | E1000_WRITE_REG(hw, TDH, 0); | 1432 | E1000_WRITE_REG(hw, TDBAH, (tdba >> 32)); |
1433 | E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL)); | ||
1309 | E1000_WRITE_REG(hw, TDT, 0); | 1434 | E1000_WRITE_REG(hw, TDT, 0); |
1435 | E1000_WRITE_REG(hw, TDH, 0); | ||
1310 | adapter->tx_ring[0].tdh = E1000_TDH; | 1436 | adapter->tx_ring[0].tdh = E1000_TDH; |
1311 | adapter->tx_ring[0].tdt = E1000_TDT; | 1437 | adapter->tx_ring[0].tdt = E1000_TDT; |
1312 | break; | 1438 | break; |
@@ -1418,7 +1544,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter, | |||
1418 | int size, desc_len; | 1544 | int size, desc_len; |
1419 | 1545 | ||
1420 | size = sizeof(struct e1000_buffer) * rxdr->count; | 1546 | size = sizeof(struct e1000_buffer) * rxdr->count; |
1421 | rxdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus)); | 1547 | rxdr->buffer_info = vmalloc(size); |
1422 | if (!rxdr->buffer_info) { | 1548 | if (!rxdr->buffer_info) { |
1423 | DPRINTK(PROBE, ERR, | 1549 | DPRINTK(PROBE, ERR, |
1424 | "Unable to allocate memory for the receive descriptor ring\n"); | 1550 | "Unable to allocate memory for the receive descriptor ring\n"); |
@@ -1560,9 +1686,6 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1560 | E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | | 1686 | E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | |
1561 | (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); | 1687 | (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); |
1562 | 1688 | ||
1563 | if (adapter->hw.mac_type > e1000_82543) | ||
1564 | rctl |= E1000_RCTL_SECRC; | ||
1565 | |||
1566 | if (adapter->hw.tbi_compatibility_on == 1) | 1689 | if (adapter->hw.tbi_compatibility_on == 1) |
1567 | rctl |= E1000_RCTL_SBP; | 1690 | rctl |= E1000_RCTL_SBP; |
1568 | else | 1691 | else |
@@ -1628,7 +1751,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1628 | rfctl |= E1000_RFCTL_IPV6_DIS; | 1751 | rfctl |= E1000_RFCTL_IPV6_DIS; |
1629 | E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl); | 1752 | E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl); |
1630 | 1753 | ||
1631 | rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC; | 1754 | rctl |= E1000_RCTL_DTYP_PS; |
1632 | 1755 | ||
1633 | psrctl |= adapter->rx_ps_bsize0 >> | 1756 | psrctl |= adapter->rx_ps_bsize0 >> |
1634 | E1000_PSRCTL_BSIZE0_SHIFT; | 1757 | E1000_PSRCTL_BSIZE0_SHIFT; |
@@ -1712,11 +1835,11 @@ e1000_configure_rx(struct e1000_adapter *adapter) | |||
1712 | case 1: | 1835 | case 1: |
1713 | default: | 1836 | default: |
1714 | rdba = adapter->rx_ring[0].dma; | 1837 | rdba = adapter->rx_ring[0].dma; |
1715 | E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL)); | ||
1716 | E1000_WRITE_REG(hw, RDBAH, (rdba >> 32)); | ||
1717 | E1000_WRITE_REG(hw, RDLEN, rdlen); | 1838 | E1000_WRITE_REG(hw, RDLEN, rdlen); |
1718 | E1000_WRITE_REG(hw, RDH, 0); | 1839 | E1000_WRITE_REG(hw, RDBAH, (rdba >> 32)); |
1840 | E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL)); | ||
1719 | E1000_WRITE_REG(hw, RDT, 0); | 1841 | E1000_WRITE_REG(hw, RDT, 0); |
1842 | E1000_WRITE_REG(hw, RDH, 0); | ||
1720 | adapter->rx_ring[0].rdh = E1000_RDH; | 1843 | adapter->rx_ring[0].rdh = E1000_RDH; |
1721 | adapter->rx_ring[0].rdt = E1000_RDT; | 1844 | adapter->rx_ring[0].rdt = E1000_RDT; |
1722 | break; | 1845 | break; |
@@ -1741,9 +1864,6 @@ e1000_configure_rx(struct e1000_adapter *adapter) | |||
1741 | E1000_WRITE_REG(hw, RXCSUM, rxcsum); | 1864 | E1000_WRITE_REG(hw, RXCSUM, rxcsum); |
1742 | } | 1865 | } |
1743 | 1866 | ||
1744 | if (hw->mac_type == e1000_82573) | ||
1745 | E1000_WRITE_REG(hw, ERT, 0x0100); | ||
1746 | |||
1747 | /* Enable Receives */ | 1867 | /* Enable Receives */ |
1748 | E1000_WRITE_REG(hw, RCTL, rctl); | 1868 | E1000_WRITE_REG(hw, RCTL, rctl); |
1749 | } | 1869 | } |
@@ -2083,6 +2203,12 @@ e1000_set_multi(struct net_device *netdev) | |||
2083 | uint32_t rctl; | 2203 | uint32_t rctl; |
2084 | uint32_t hash_value; | 2204 | uint32_t hash_value; |
2085 | int i, rar_entries = E1000_RAR_ENTRIES; | 2205 | int i, rar_entries = E1000_RAR_ENTRIES; |
2206 | int mta_reg_count = (hw->mac_type == e1000_ich8lan) ? | ||
2207 | E1000_NUM_MTA_REGISTERS_ICH8LAN : | ||
2208 | E1000_NUM_MTA_REGISTERS; | ||
2209 | |||
2210 | if (adapter->hw.mac_type == e1000_ich8lan) | ||
2211 | rar_entries = E1000_RAR_ENTRIES_ICH8LAN; | ||
2086 | 2212 | ||
2087 | /* reserve RAR[14] for LAA over-write work-around */ | 2213 | /* reserve RAR[14] for LAA over-write work-around */ |
2088 | if (adapter->hw.mac_type == e1000_82571) | 2214 | if (adapter->hw.mac_type == e1000_82571) |
@@ -2121,14 +2247,18 @@ e1000_set_multi(struct net_device *netdev) | |||
2121 | mc_ptr = mc_ptr->next; | 2247 | mc_ptr = mc_ptr->next; |
2122 | } else { | 2248 | } else { |
2123 | E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0); | 2249 | E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0); |
2250 | E1000_WRITE_FLUSH(hw); | ||
2124 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); | 2251 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); |
2252 | E1000_WRITE_FLUSH(hw); | ||
2125 | } | 2253 | } |
2126 | } | 2254 | } |
2127 | 2255 | ||
2128 | /* clear the old settings from the multicast hash table */ | 2256 | /* clear the old settings from the multicast hash table */ |
2129 | 2257 | ||
2130 | for (i = 0; i < E1000_NUM_MTA_REGISTERS; i++) | 2258 | for (i = 0; i < mta_reg_count; i++) { |
2131 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); | 2259 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
2260 | E1000_WRITE_FLUSH(hw); | ||
2261 | } | ||
2132 | 2262 | ||
2133 | /* load any remaining addresses into the hash table */ | 2263 | /* load any remaining addresses into the hash table */ |
2134 | 2264 | ||
@@ -2201,19 +2331,19 @@ static void | |||
2201 | e1000_watchdog(unsigned long data) | 2331 | e1000_watchdog(unsigned long data) |
2202 | { | 2332 | { |
2203 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; | 2333 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
2204 | |||
2205 | /* Do the rest outside of interrupt context */ | ||
2206 | schedule_work(&adapter->watchdog_task); | ||
2207 | } | ||
2208 | |||
2209 | static void | ||
2210 | e1000_watchdog_task(struct e1000_adapter *adapter) | ||
2211 | { | ||
2212 | struct net_device *netdev = adapter->netdev; | 2334 | struct net_device *netdev = adapter->netdev; |
2213 | struct e1000_tx_ring *txdr = adapter->tx_ring; | 2335 | struct e1000_tx_ring *txdr = adapter->tx_ring; |
2214 | uint32_t link, tctl; | 2336 | uint32_t link, tctl; |
2215 | 2337 | int32_t ret_val; | |
2216 | e1000_check_for_link(&adapter->hw); | 2338 | |
2339 | ret_val = e1000_check_for_link(&adapter->hw); | ||
2340 | if ((ret_val == E1000_ERR_PHY) && | ||
2341 | (adapter->hw.phy_type == e1000_phy_igp_3) && | ||
2342 | (E1000_READ_REG(&adapter->hw, CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) { | ||
2343 | /* See e1000_kumeran_lock_loss_workaround() */ | ||
2344 | DPRINTK(LINK, INFO, | ||
2345 | "Gigabit has been disabled, downgrading speed\n"); | ||
2346 | } | ||
2217 | if (adapter->hw.mac_type == e1000_82573) { | 2347 | if (adapter->hw.mac_type == e1000_82573) { |
2218 | e1000_enable_tx_pkt_filtering(&adapter->hw); | 2348 | e1000_enable_tx_pkt_filtering(&adapter->hw); |
2219 | if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) | 2349 | if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) |
@@ -2779,9 +2909,10 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2779 | case e1000_82571: | 2909 | case e1000_82571: |
2780 | case e1000_82572: | 2910 | case e1000_82572: |
2781 | case e1000_82573: | 2911 | case e1000_82573: |
2912 | case e1000_ich8lan: | ||
2782 | pull_size = min((unsigned int)4, skb->data_len); | 2913 | pull_size = min((unsigned int)4, skb->data_len); |
2783 | if (!__pskb_pull_tail(skb, pull_size)) { | 2914 | if (!__pskb_pull_tail(skb, pull_size)) { |
2784 | printk(KERN_ERR | 2915 | DPRINTK(DRV, ERR, |
2785 | "__pskb_pull_tail failed.\n"); | 2916 | "__pskb_pull_tail failed.\n"); |
2786 | dev_kfree_skb_any(skb); | 2917 | dev_kfree_skb_any(skb); |
2787 | return NETDEV_TX_OK; | 2918 | return NETDEV_TX_OK; |
@@ -2919,8 +3050,7 @@ e1000_reset_task(struct net_device *netdev) | |||
2919 | { | 3050 | { |
2920 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3051 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2921 | 3052 | ||
2922 | e1000_down(adapter); | 3053 | e1000_reinit_locked(adapter); |
2923 | e1000_up(adapter); | ||
2924 | } | 3054 | } |
2925 | 3055 | ||
2926 | /** | 3056 | /** |
@@ -2964,6 +3094,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
2964 | /* Adapter-specific max frame size limits. */ | 3094 | /* Adapter-specific max frame size limits. */ |
2965 | switch (adapter->hw.mac_type) { | 3095 | switch (adapter->hw.mac_type) { |
2966 | case e1000_undefined ... e1000_82542_rev2_1: | 3096 | case e1000_undefined ... e1000_82542_rev2_1: |
3097 | case e1000_ich8lan: | ||
2967 | if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { | 3098 | if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { |
2968 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n"); | 3099 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n"); |
2969 | return -EINVAL; | 3100 | return -EINVAL; |
@@ -3026,10 +3157,8 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3026 | 3157 | ||
3027 | netdev->mtu = new_mtu; | 3158 | netdev->mtu = new_mtu; |
3028 | 3159 | ||
3029 | if (netif_running(netdev)) { | 3160 | if (netif_running(netdev)) |
3030 | e1000_down(adapter); | 3161 | e1000_reinit_locked(adapter); |
3031 | e1000_up(adapter); | ||
3032 | } | ||
3033 | 3162 | ||
3034 | adapter->hw.max_frame_size = max_frame; | 3163 | adapter->hw.max_frame_size = max_frame; |
3035 | 3164 | ||
@@ -3074,12 +3203,15 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3074 | adapter->stats.bprc += E1000_READ_REG(hw, BPRC); | 3203 | adapter->stats.bprc += E1000_READ_REG(hw, BPRC); |
3075 | adapter->stats.mprc += E1000_READ_REG(hw, MPRC); | 3204 | adapter->stats.mprc += E1000_READ_REG(hw, MPRC); |
3076 | adapter->stats.roc += E1000_READ_REG(hw, ROC); | 3205 | adapter->stats.roc += E1000_READ_REG(hw, ROC); |
3206 | |||
3207 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
3077 | adapter->stats.prc64 += E1000_READ_REG(hw, PRC64); | 3208 | adapter->stats.prc64 += E1000_READ_REG(hw, PRC64); |
3078 | adapter->stats.prc127 += E1000_READ_REG(hw, PRC127); | 3209 | adapter->stats.prc127 += E1000_READ_REG(hw, PRC127); |
3079 | adapter->stats.prc255 += E1000_READ_REG(hw, PRC255); | 3210 | adapter->stats.prc255 += E1000_READ_REG(hw, PRC255); |
3080 | adapter->stats.prc511 += E1000_READ_REG(hw, PRC511); | 3211 | adapter->stats.prc511 += E1000_READ_REG(hw, PRC511); |
3081 | adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023); | 3212 | adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023); |
3082 | adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522); | 3213 | adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522); |
3214 | } | ||
3083 | 3215 | ||
3084 | adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS); | 3216 | adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS); |
3085 | adapter->stats.mpc += E1000_READ_REG(hw, MPC); | 3217 | adapter->stats.mpc += E1000_READ_REG(hw, MPC); |
@@ -3107,12 +3239,16 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3107 | adapter->stats.totl += E1000_READ_REG(hw, TOTL); | 3239 | adapter->stats.totl += E1000_READ_REG(hw, TOTL); |
3108 | adapter->stats.toth += E1000_READ_REG(hw, TOTH); | 3240 | adapter->stats.toth += E1000_READ_REG(hw, TOTH); |
3109 | adapter->stats.tpr += E1000_READ_REG(hw, TPR); | 3241 | adapter->stats.tpr += E1000_READ_REG(hw, TPR); |
3242 | |||
3243 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
3110 | adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64); | 3244 | adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64); |
3111 | adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127); | 3245 | adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127); |
3112 | adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255); | 3246 | adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255); |
3113 | adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511); | 3247 | adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511); |
3114 | adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023); | 3248 | adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023); |
3115 | adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522); | 3249 | adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522); |
3250 | } | ||
3251 | |||
3116 | adapter->stats.mptc += E1000_READ_REG(hw, MPTC); | 3252 | adapter->stats.mptc += E1000_READ_REG(hw, MPTC); |
3117 | adapter->stats.bptc += E1000_READ_REG(hw, BPTC); | 3253 | adapter->stats.bptc += E1000_READ_REG(hw, BPTC); |
3118 | 3254 | ||
@@ -3134,6 +3270,8 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3134 | if (hw->mac_type > e1000_82547_rev_2) { | 3270 | if (hw->mac_type > e1000_82547_rev_2) { |
3135 | adapter->stats.iac += E1000_READ_REG(hw, IAC); | 3271 | adapter->stats.iac += E1000_READ_REG(hw, IAC); |
3136 | adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC); | 3272 | adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC); |
3273 | |||
3274 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
3137 | adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC); | 3275 | adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC); |
3138 | adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC); | 3276 | adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC); |
3139 | adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC); | 3277 | adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC); |
@@ -3141,6 +3279,7 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3141 | adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC); | 3279 | adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC); |
3142 | adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC); | 3280 | adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC); |
3143 | adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC); | 3281 | adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC); |
3282 | } | ||
3144 | } | 3283 | } |
3145 | 3284 | ||
3146 | /* Fill out the OS statistics structure */ | 3285 | /* Fill out the OS statistics structure */ |
@@ -3547,7 +3686,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3547 | /* All receives must fit into a single buffer */ | 3686 | /* All receives must fit into a single buffer */ |
3548 | E1000_DBG("%s: Receive packet consumed multiple" | 3687 | E1000_DBG("%s: Receive packet consumed multiple" |
3549 | " buffers\n", netdev->name); | 3688 | " buffers\n", netdev->name); |
3550 | dev_kfree_skb_irq(skb); | 3689 | /* recycle */ |
3690 | buffer_info-> skb = skb; | ||
3551 | goto next_desc; | 3691 | goto next_desc; |
3552 | } | 3692 | } |
3553 | 3693 | ||
@@ -3675,7 +3815,6 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
3675 | buffer_info = &rx_ring->buffer_info[i]; | 3815 | buffer_info = &rx_ring->buffer_info[i]; |
3676 | 3816 | ||
3677 | while (staterr & E1000_RXD_STAT_DD) { | 3817 | while (staterr & E1000_RXD_STAT_DD) { |
3678 | buffer_info = &rx_ring->buffer_info[i]; | ||
3679 | ps_page = &rx_ring->ps_page[i]; | 3818 | ps_page = &rx_ring->ps_page[i]; |
3680 | ps_page_dma = &rx_ring->ps_page_dma[i]; | 3819 | ps_page_dma = &rx_ring->ps_page_dma[i]; |
3681 | #ifdef CONFIG_E1000_NAPI | 3820 | #ifdef CONFIG_E1000_NAPI |
@@ -4180,10 +4319,9 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4180 | return retval; | 4319 | return retval; |
4181 | } | 4320 | } |
4182 | } | 4321 | } |
4183 | if (netif_running(adapter->netdev)) { | 4322 | if (netif_running(adapter->netdev)) |
4184 | e1000_down(adapter); | 4323 | e1000_reinit_locked(adapter); |
4185 | e1000_up(adapter); | 4324 | else |
4186 | } else | ||
4187 | e1000_reset(adapter); | 4325 | e1000_reset(adapter); |
4188 | break; | 4326 | break; |
4189 | case M88E1000_PHY_SPEC_CTRL: | 4327 | case M88E1000_PHY_SPEC_CTRL: |
@@ -4200,10 +4338,9 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4200 | case PHY_CTRL: | 4338 | case PHY_CTRL: |
4201 | if (mii_reg & MII_CR_POWER_DOWN) | 4339 | if (mii_reg & MII_CR_POWER_DOWN) |
4202 | break; | 4340 | break; |
4203 | if (netif_running(adapter->netdev)) { | 4341 | if (netif_running(adapter->netdev)) |
4204 | e1000_down(adapter); | 4342 | e1000_reinit_locked(adapter); |
4205 | e1000_up(adapter); | 4343 | else |
4206 | } else | ||
4207 | e1000_reset(adapter); | 4344 | e1000_reset(adapter); |
4208 | break; | 4345 | break; |
4209 | } | 4346 | } |
@@ -4277,18 +4414,21 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
4277 | ctrl |= E1000_CTRL_VME; | 4414 | ctrl |= E1000_CTRL_VME; |
4278 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); | 4415 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); |
4279 | 4416 | ||
4417 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
4280 | /* enable VLAN receive filtering */ | 4418 | /* enable VLAN receive filtering */ |
4281 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 4419 | rctl = E1000_READ_REG(&adapter->hw, RCTL); |
4282 | rctl |= E1000_RCTL_VFE; | 4420 | rctl |= E1000_RCTL_VFE; |
4283 | rctl &= ~E1000_RCTL_CFIEN; | 4421 | rctl &= ~E1000_RCTL_CFIEN; |
4284 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); | 4422 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
4285 | e1000_update_mng_vlan(adapter); | 4423 | e1000_update_mng_vlan(adapter); |
4424 | } | ||
4286 | } else { | 4425 | } else { |
4287 | /* disable VLAN tag insert/strip */ | 4426 | /* disable VLAN tag insert/strip */ |
4288 | ctrl = E1000_READ_REG(&adapter->hw, CTRL); | 4427 | ctrl = E1000_READ_REG(&adapter->hw, CTRL); |
4289 | ctrl &= ~E1000_CTRL_VME; | 4428 | ctrl &= ~E1000_CTRL_VME; |
4290 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); | 4429 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); |
4291 | 4430 | ||
4431 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
4292 | /* disable VLAN filtering */ | 4432 | /* disable VLAN filtering */ |
4293 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 4433 | rctl = E1000_READ_REG(&adapter->hw, RCTL); |
4294 | rctl &= ~E1000_RCTL_VFE; | 4434 | rctl &= ~E1000_RCTL_VFE; |
@@ -4297,6 +4437,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
4297 | e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); | 4437 | e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); |
4298 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; | 4438 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
4299 | } | 4439 | } |
4440 | } | ||
4300 | } | 4441 | } |
4301 | 4442 | ||
4302 | e1000_irq_enable(adapter); | 4443 | e1000_irq_enable(adapter); |
@@ -4458,12 +4599,16 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4458 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4599 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4459 | uint32_t ctrl, ctrl_ext, rctl, manc, status; | 4600 | uint32_t ctrl, ctrl_ext, rctl, manc, status; |
4460 | uint32_t wufc = adapter->wol; | 4601 | uint32_t wufc = adapter->wol; |
4602 | #ifdef CONFIG_PM | ||
4461 | int retval = 0; | 4603 | int retval = 0; |
4604 | #endif | ||
4462 | 4605 | ||
4463 | netif_device_detach(netdev); | 4606 | netif_device_detach(netdev); |
4464 | 4607 | ||
4465 | if (netif_running(netdev)) | 4608 | if (netif_running(netdev)) { |
4609 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); | ||
4466 | e1000_down(adapter); | 4610 | e1000_down(adapter); |
4611 | } | ||
4467 | 4612 | ||
4468 | #ifdef CONFIG_PM | 4613 | #ifdef CONFIG_PM |
4469 | /* Implement our own version of pci_save_state(pdev) because pci- | 4614 | /* Implement our own version of pci_save_state(pdev) because pci- |
@@ -4521,7 +4666,9 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4521 | pci_enable_wake(pdev, PCI_D3cold, 0); | 4666 | pci_enable_wake(pdev, PCI_D3cold, 0); |
4522 | } | 4667 | } |
4523 | 4668 | ||
4669 | /* FIXME: this code is incorrect for PCI Express */ | ||
4524 | if (adapter->hw.mac_type >= e1000_82540 && | 4670 | if (adapter->hw.mac_type >= e1000_82540 && |
4671 | adapter->hw.mac_type != e1000_ich8lan && | ||
4525 | adapter->hw.media_type == e1000_media_type_copper) { | 4672 | adapter->hw.media_type == e1000_media_type_copper) { |
4526 | manc = E1000_READ_REG(&adapter->hw, MANC); | 4673 | manc = E1000_READ_REG(&adapter->hw, MANC); |
4527 | if (manc & E1000_MANC_SMBUS_EN) { | 4674 | if (manc & E1000_MANC_SMBUS_EN) { |
@@ -4532,6 +4679,9 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4532 | } | 4679 | } |
4533 | } | 4680 | } |
4534 | 4681 | ||
4682 | if (adapter->hw.phy_type == e1000_phy_igp_3) | ||
4683 | e1000_phy_powerdown_workaround(&adapter->hw); | ||
4684 | |||
4535 | /* Release control of h/w to f/w. If f/w is AMT enabled, this | 4685 | /* Release control of h/w to f/w. If f/w is AMT enabled, this |
4536 | * would have already happened in close and is redundant. */ | 4686 | * would have already happened in close and is redundant. */ |
4537 | e1000_release_hw_control(adapter); | 4687 | e1000_release_hw_control(adapter); |
@@ -4567,7 +4717,9 @@ e1000_resume(struct pci_dev *pdev) | |||
4567 | 4717 | ||
4568 | netif_device_attach(netdev); | 4718 | netif_device_attach(netdev); |
4569 | 4719 | ||
4720 | /* FIXME: this code is incorrect for PCI Express */ | ||
4570 | if (adapter->hw.mac_type >= e1000_82540 && | 4721 | if (adapter->hw.mac_type >= e1000_82540 && |
4722 | adapter->hw.mac_type != e1000_ich8lan && | ||
4571 | adapter->hw.media_type == e1000_media_type_copper) { | 4723 | adapter->hw.media_type == e1000_media_type_copper) { |
4572 | manc = E1000_READ_REG(&adapter->hw, MANC); | 4724 | manc = E1000_READ_REG(&adapter->hw, MANC); |
4573 | manc &= ~(E1000_MANC_ARP_EN); | 4725 | manc &= ~(E1000_MANC_ARP_EN); |