diff options
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 128 |
1 files changed, 69 insertions, 59 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 0816de267610..7a51283f4939 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -464,6 +464,52 @@ e1000_get_hw_control(struct e1000_adapter *adapter) | |||
464 | } | 464 | } |
465 | } | 465 | } |
466 | 466 | ||
467 | static void | ||
468 | e1000_init_manageability(struct e1000_adapter *adapter) | ||
469 | { | ||
470 | if (adapter->en_mng_pt) { | ||
471 | uint32_t manc = E1000_READ_REG(&adapter->hw, MANC); | ||
472 | |||
473 | /* disable hardware interception of ARP */ | ||
474 | manc &= ~(E1000_MANC_ARP_EN); | ||
475 | |||
476 | /* enable receiving management packets to the host */ | ||
477 | /* this will probably generate destination unreachable messages | ||
478 | * from the host OS, but the packets will be handled on SMBUS */ | ||
479 | if (adapter->hw.has_manc2h) { | ||
480 | uint32_t manc2h = E1000_READ_REG(&adapter->hw, MANC2H); | ||
481 | |||
482 | manc |= E1000_MANC_EN_MNG2HOST; | ||
483 | #define E1000_MNG2HOST_PORT_623 (1 << 5) | ||
484 | #define E1000_MNG2HOST_PORT_664 (1 << 6) | ||
485 | manc2h |= E1000_MNG2HOST_PORT_623; | ||
486 | manc2h |= E1000_MNG2HOST_PORT_664; | ||
487 | E1000_WRITE_REG(&adapter->hw, MANC2H, manc2h); | ||
488 | } | ||
489 | |||
490 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | ||
491 | } | ||
492 | } | ||
493 | |||
494 | static void | ||
495 | e1000_release_manageability(struct e1000_adapter *adapter) | ||
496 | { | ||
497 | if (adapter->en_mng_pt) { | ||
498 | uint32_t manc = E1000_READ_REG(&adapter->hw, MANC); | ||
499 | |||
500 | /* re-enable hardware interception of ARP */ | ||
501 | manc |= E1000_MANC_ARP_EN; | ||
502 | |||
503 | if (adapter->hw.has_manc2h) | ||
504 | manc &= ~E1000_MANC_EN_MNG2HOST; | ||
505 | |||
506 | /* don't explicitly have to mess with MANC2H since | ||
507 | * MANC has an enable disable that gates MANC2H */ | ||
508 | |||
509 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | ||
510 | } | ||
511 | } | ||
512 | |||
467 | int | 513 | int |
468 | e1000_up(struct e1000_adapter *adapter) | 514 | e1000_up(struct e1000_adapter *adapter) |
469 | { | 515 | { |
@@ -475,6 +521,7 @@ e1000_up(struct e1000_adapter *adapter) | |||
475 | e1000_set_multi(netdev); | 521 | e1000_set_multi(netdev); |
476 | 522 | ||
477 | e1000_restore_vlan(adapter); | 523 | e1000_restore_vlan(adapter); |
524 | e1000_init_manageability(adapter); | ||
478 | 525 | ||
479 | e1000_configure_tx(adapter); | 526 | e1000_configure_tx(adapter); |
480 | e1000_setup_rctl(adapter); | 527 | e1000_setup_rctl(adapter); |
@@ -614,7 +661,7 @@ e1000_reinit_locked(struct e1000_adapter *adapter) | |||
614 | void | 661 | void |
615 | e1000_reset(struct e1000_adapter *adapter) | 662 | e1000_reset(struct e1000_adapter *adapter) |
616 | { | 663 | { |
617 | uint32_t pba, manc; | 664 | uint32_t pba; |
618 | uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF; | 665 | uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF; |
619 | 666 | ||
620 | /* Repartition Pba for greater than 9k mtu | 667 | /* Repartition Pba for greater than 9k mtu |
@@ -705,14 +752,7 @@ e1000_reset(struct e1000_adapter *adapter) | |||
705 | phy_data); | 752 | phy_data); |
706 | } | 753 | } |
707 | 754 | ||
708 | if ((adapter->en_mng_pt) && | 755 | e1000_release_manageability(adapter); |
709 | (adapter->hw.mac_type >= e1000_82540) && | ||
710 | (adapter->hw.mac_type < e1000_82571) && | ||
711 | (adapter->hw.media_type == e1000_media_type_copper)) { | ||
712 | manc = E1000_READ_REG(&adapter->hw, MANC); | ||
713 | manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST); | ||
714 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | ||
715 | } | ||
716 | } | 756 | } |
717 | 757 | ||
718 | /** | 758 | /** |
@@ -1078,22 +1118,13 @@ e1000_remove(struct pci_dev *pdev) | |||
1078 | { | 1118 | { |
1079 | struct net_device *netdev = pci_get_drvdata(pdev); | 1119 | struct net_device *netdev = pci_get_drvdata(pdev); |
1080 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1120 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1081 | uint32_t manc; | ||
1082 | #ifdef CONFIG_E1000_NAPI | 1121 | #ifdef CONFIG_E1000_NAPI |
1083 | int i; | 1122 | int i; |
1084 | #endif | 1123 | #endif |
1085 | 1124 | ||
1086 | flush_scheduled_work(); | 1125 | flush_scheduled_work(); |
1087 | 1126 | ||
1088 | if (adapter->hw.mac_type >= e1000_82540 && | 1127 | e1000_release_manageability(adapter); |
1089 | adapter->hw.mac_type < e1000_82571 && | ||
1090 | adapter->hw.media_type == e1000_media_type_copper) { | ||
1091 | manc = E1000_READ_REG(&adapter->hw, MANC); | ||
1092 | if (manc & E1000_MANC_SMBUS_EN) { | ||
1093 | manc |= E1000_MANC_ARP_EN; | ||
1094 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | ||
1095 | } | ||
1096 | } | ||
1097 | 1128 | ||
1098 | /* Release control of h/w to f/w. If f/w is AMT enabled, this | 1129 | /* Release control of h/w to f/w. If f/w is AMT enabled, this |
1099 | * would have already happened in close and is redundant. */ | 1130 | * would have already happened in close and is redundant. */ |
@@ -5011,7 +5042,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
5011 | { | 5042 | { |
5012 | struct net_device *netdev = pci_get_drvdata(pdev); | 5043 | struct net_device *netdev = pci_get_drvdata(pdev); |
5013 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5044 | struct e1000_adapter *adapter = netdev_priv(netdev); |
5014 | uint32_t ctrl, ctrl_ext, rctl, manc, status; | 5045 | uint32_t ctrl, ctrl_ext, rctl, status; |
5015 | uint32_t wufc = adapter->wol; | 5046 | uint32_t wufc = adapter->wol; |
5016 | #ifdef CONFIG_PM | 5047 | #ifdef CONFIG_PM |
5017 | int retval = 0; | 5048 | int retval = 0; |
@@ -5080,16 +5111,12 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
5080 | pci_enable_wake(pdev, PCI_D3cold, 0); | 5111 | pci_enable_wake(pdev, PCI_D3cold, 0); |
5081 | } | 5112 | } |
5082 | 5113 | ||
5083 | if (adapter->hw.mac_type >= e1000_82540 && | 5114 | e1000_release_manageability(adapter); |
5084 | adapter->hw.mac_type < e1000_82571 && | 5115 | |
5085 | adapter->hw.media_type == e1000_media_type_copper) { | 5116 | /* make sure adapter isn't asleep if manageability is enabled */ |
5086 | manc = E1000_READ_REG(&adapter->hw, MANC); | 5117 | if (adapter->en_mng_pt) { |
5087 | if (manc & E1000_MANC_SMBUS_EN) { | 5118 | pci_enable_wake(pdev, PCI_D3hot, 1); |
5088 | manc |= E1000_MANC_ARP_EN; | 5119 | pci_enable_wake(pdev, PCI_D3cold, 1); |
5089 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | ||
5090 | pci_enable_wake(pdev, PCI_D3hot, 1); | ||
5091 | pci_enable_wake(pdev, PCI_D3cold, 1); | ||
5092 | } | ||
5093 | } | 5120 | } |
5094 | 5121 | ||
5095 | if (adapter->hw.phy_type == e1000_phy_igp_3) | 5122 | if (adapter->hw.phy_type == e1000_phy_igp_3) |
@@ -5115,7 +5142,7 @@ e1000_resume(struct pci_dev *pdev) | |||
5115 | { | 5142 | { |
5116 | struct net_device *netdev = pci_get_drvdata(pdev); | 5143 | struct net_device *netdev = pci_get_drvdata(pdev); |
5117 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5144 | struct e1000_adapter *adapter = netdev_priv(netdev); |
5118 | uint32_t manc, err; | 5145 | uint32_t err; |
5119 | 5146 | ||
5120 | pci_set_power_state(pdev, PCI_D0); | 5147 | pci_set_power_state(pdev, PCI_D0); |
5121 | e1000_pci_restore_state(adapter); | 5148 | e1000_pci_restore_state(adapter); |
@@ -5135,19 +5162,13 @@ e1000_resume(struct pci_dev *pdev) | |||
5135 | e1000_reset(adapter); | 5162 | e1000_reset(adapter); |
5136 | E1000_WRITE_REG(&adapter->hw, WUS, ~0); | 5163 | E1000_WRITE_REG(&adapter->hw, WUS, ~0); |
5137 | 5164 | ||
5165 | e1000_init_manageability(adapter); | ||
5166 | |||
5138 | if (netif_running(netdev)) | 5167 | if (netif_running(netdev)) |
5139 | e1000_up(adapter); | 5168 | e1000_up(adapter); |
5140 | 5169 | ||
5141 | netif_device_attach(netdev); | 5170 | netif_device_attach(netdev); |
5142 | 5171 | ||
5143 | if (adapter->hw.mac_type >= e1000_82540 && | ||
5144 | adapter->hw.mac_type < e1000_82571 && | ||
5145 | adapter->hw.media_type == e1000_media_type_copper) { | ||
5146 | manc = E1000_READ_REG(&adapter->hw, MANC); | ||
5147 | manc &= ~(E1000_MANC_ARP_EN); | ||
5148 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | ||
5149 | } | ||
5150 | |||
5151 | /* If the controller is 82573 and f/w is AMT, do not set | 5172 | /* If the controller is 82573 and f/w is AMT, do not set |
5152 | * DRV_LOAD until the interface is up. For all other cases, | 5173 | * DRV_LOAD until the interface is up. For all other cases, |
5153 | * let the f/w know that the h/w is now under the control | 5174 | * let the f/w know that the h/w is now under the control |
@@ -5248,7 +5269,8 @@ static void e1000_io_resume(struct pci_dev *pdev) | |||
5248 | { | 5269 | { |
5249 | struct net_device *netdev = pci_get_drvdata(pdev); | 5270 | struct net_device *netdev = pci_get_drvdata(pdev); |
5250 | struct e1000_adapter *adapter = netdev->priv; | 5271 | struct e1000_adapter *adapter = netdev->priv; |
5251 | uint32_t manc, swsm; | 5272 | |
5273 | e1000_init_manageability(adapter); | ||
5252 | 5274 | ||
5253 | if (netif_running(netdev)) { | 5275 | if (netif_running(netdev)) { |
5254 | if (e1000_up(adapter)) { | 5276 | if (e1000_up(adapter)) { |
@@ -5259,26 +5281,14 @@ static void e1000_io_resume(struct pci_dev *pdev) | |||
5259 | 5281 | ||
5260 | netif_device_attach(netdev); | 5282 | netif_device_attach(netdev); |
5261 | 5283 | ||
5262 | if (adapter->hw.mac_type >= e1000_82540 && | 5284 | /* If the controller is 82573 and f/w is AMT, do not set |
5263 | adapter->hw.mac_type < e1000_82571 && | 5285 | * DRV_LOAD until the interface is up. For all other cases, |
5264 | adapter->hw.media_type == e1000_media_type_copper) { | 5286 | * let the f/w know that the h/w is now under the control |
5265 | manc = E1000_READ_REG(&adapter->hw, MANC); | 5287 | * of the driver. */ |
5266 | manc &= ~(E1000_MANC_ARP_EN); | 5288 | if (adapter->hw.mac_type != e1000_82573 || |
5267 | E1000_WRITE_REG(&adapter->hw, MANC, manc); | 5289 | !e1000_check_mng_mode(&adapter->hw)) |
5268 | } | 5290 | e1000_get_hw_control(adapter); |
5269 | |||
5270 | switch (adapter->hw.mac_type) { | ||
5271 | case e1000_82573: | ||
5272 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | ||
5273 | E1000_WRITE_REG(&adapter->hw, SWSM, | ||
5274 | swsm | E1000_SWSM_DRV_LOAD); | ||
5275 | break; | ||
5276 | default: | ||
5277 | break; | ||
5278 | } | ||
5279 | 5291 | ||
5280 | if (netif_running(netdev)) | ||
5281 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
5282 | } | 5292 | } |
5283 | 5293 | ||
5284 | /* e1000_main.c */ | 5294 | /* e1000_main.c */ |