aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-12-15 10:56:10 -0500
committerJeff Garzik <jeff@garzik.org>2006-12-26 15:51:29 -0500
commit0fccd0e9e3802748855d967940c16f8c59d4e2b6 (patch)
tree6c869abd0f2af31d532b90a489ca1db749f8bd5b /drivers
parent167fb2841633edd2812e385af4b593d870abd15a (diff)
e1000: consolidate managability enabling/disabling
Several bugs existed in how we handle manageability issues all over the driver. This patch consolidates all the managability release and init code in two single functions and call them from appropriate locations. This fixes several BMC packet redirect issues and powerup/down hiccups. Originally from Jesse Brandeburg <jesse.brandeburg@intel.com>, rewritten to use feature flags by me. Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/e1000/e1000_hw.c9
-rw-r--r--drivers/net/e1000/e1000_hw.h2
-rw-r--r--drivers/net/e1000/e1000_main.c128
3 files changed, 77 insertions, 62 deletions
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index ce82eb52ea95..1ea556ef093b 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -448,6 +448,10 @@ e1000_set_mac_type(struct e1000_hw *hw)
448 if (hw->mac_type == e1000_82543) 448 if (hw->mac_type == e1000_82543)
449 hw->bad_tx_carr_stats_fd = TRUE; 449 hw->bad_tx_carr_stats_fd = TRUE;
450 450
451 /* capable of receiving management packets to the host */
452 if (hw->mac_type >= e1000_82571)
453 hw->has_manc2h = TRUE;
454
451 return E1000_SUCCESS; 455 return E1000_SUCCESS;
452} 456}
453 457
@@ -7823,9 +7827,8 @@ e1000_enable_mng_pass_thru(struct e1000_hw *hw)
7823 fwsm = E1000_READ_REG(hw, FWSM); 7827 fwsm = E1000_READ_REG(hw, FWSM);
7824 factps = E1000_READ_REG(hw, FACTPS); 7828 factps = E1000_READ_REG(hw, FACTPS);
7825 7829
7826 if (((fwsm & E1000_FWSM_MODE_MASK) == 7830 if ((((fwsm & E1000_FWSM_MODE_MASK) >> E1000_FWSM_MODE_SHIFT) ==
7827 (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT)) && 7831 e1000_mng_mode_pt) && !(factps & E1000_FACTPS_MNGCG))
7828 (factps & E1000_FACTPS_MNGCG))
7829 return TRUE; 7832 return TRUE;
7830 } else 7833 } else
7831 if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN)) 7834 if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN))
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index fef1f7b4845b..18a4ae4549ad 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -1301,6 +1301,7 @@ struct e1000_ffvt_entry {
1301#define E1000_82542_RSSIR E1000_RSSIR 1301#define E1000_82542_RSSIR E1000_RSSIR
1302#define E1000_82542_KUMCTRLSTA E1000_KUMCTRLSTA 1302#define E1000_82542_KUMCTRLSTA E1000_KUMCTRLSTA
1303#define E1000_82542_SW_FW_SYNC E1000_SW_FW_SYNC 1303#define E1000_82542_SW_FW_SYNC E1000_SW_FW_SYNC
1304#define E1000_82542_MANC2H E1000_MANC2H
1304 1305
1305/* Statistics counters collected by the MAC */ 1306/* Statistics counters collected by the MAC */
1306struct e1000_hw_stats { 1307struct e1000_hw_stats {
@@ -1461,6 +1462,7 @@ struct e1000_hw {
1461 boolean_t leave_av_bit_off; 1462 boolean_t leave_av_bit_off;
1462 boolean_t kmrn_lock_loss_workaround_disabled; 1463 boolean_t kmrn_lock_loss_workaround_disabled;
1463 boolean_t bad_tx_carr_stats_fd; 1464 boolean_t bad_tx_carr_stats_fd;
1465 boolean_t has_manc2h;
1464}; 1466};
1465 1467
1466 1468
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
467static void
468e1000_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
494static void
495e1000_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
467int 513int
468e1000_up(struct e1000_adapter *adapter) 514e1000_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)
614void 661void
615e1000_reset(struct e1000_adapter *adapter) 662e1000_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 */