Lines 410-417
Link Here
|
410 |
{ |
410 |
{ |
411 |
struct adapter *adapter; |
411 |
struct adapter *adapter; |
412 |
int error = 0; |
412 |
int error = 0; |
|
|
413 |
#if 0 |
413 |
u16 eeprom_data; |
414 |
u16 eeprom_data; |
414 |
|
415 |
#endif |
|
|
416 |
|
415 |
INIT_DEBUGOUT("igb_attach: begin"); |
417 |
INIT_DEBUGOUT("igb_attach: begin"); |
416 |
|
418 |
|
417 |
if (resource_disabled("igb", device_get_unit(dev))) { |
419 |
if (resource_disabled("igb", device_get_unit(dev))) { |
Lines 631-639
Link Here
|
631 |
* Setup Wake-on-Lan |
633 |
* Setup Wake-on-Lan |
632 |
*/ |
634 |
*/ |
633 |
/* APME bit in EEPROM is mapped to WUC.APME */ |
635 |
/* APME bit in EEPROM is mapped to WUC.APME */ |
|
|
636 |
#if 0 |
634 |
eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC) & E1000_WUC_APME; |
637 |
eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC) & E1000_WUC_APME; |
635 |
if (eeprom_data) |
638 |
if (eeprom_data) |
636 |
adapter->wol = E1000_WUFC_MAG; |
639 |
adapter->wol = E1000_WUFC_MAG; |
|
|
640 |
#endif |
637 |
|
641 |
|
638 |
/* Register for VLAN events */ |
642 |
/* Register for VLAN events */ |
639 |
adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, |
643 |
adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, |
Lines 728-738
Link Here
|
728 |
igb_release_manageability(adapter); |
732 |
igb_release_manageability(adapter); |
729 |
igb_release_hw_control(adapter); |
733 |
igb_release_hw_control(adapter); |
730 |
|
734 |
|
731 |
if (adapter->wol) { |
735 |
igb_enable_wakeup(dev); |
732 |
E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); |
|
|
733 |
E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); |
734 |
igb_enable_wakeup(dev); |
735 |
} |
736 |
|
736 |
|
737 |
/* Unregister VLAN events */ |
737 |
/* Unregister VLAN events */ |
738 |
if (adapter->vlan_attach != NULL) |
738 |
if (adapter->vlan_attach != NULL) |
Lines 786-796
Link Here
|
786 |
igb_release_manageability(adapter); |
786 |
igb_release_manageability(adapter); |
787 |
igb_release_hw_control(adapter); |
787 |
igb_release_hw_control(adapter); |
788 |
|
788 |
|
789 |
if (adapter->wol) { |
789 |
igb_enable_wakeup(dev); |
790 |
E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); |
|
|
791 |
E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); |
792 |
igb_enable_wakeup(dev); |
793 |
} |
794 |
|
790 |
|
795 |
IGB_CORE_UNLOCK(adapter); |
791 |
IGB_CORE_UNLOCK(adapter); |
796 |
|
792 |
|
Lines 1240-1245
Link Here
|
1240 |
ifp->if_capenable ^= IFCAP_LRO; |
1236 |
ifp->if_capenable ^= IFCAP_LRO; |
1241 |
reinit = 1; |
1237 |
reinit = 1; |
1242 |
} |
1238 |
} |
|
|
1239 |
if (mask & IFCAP_WOL) { |
1240 |
if (mask & IFCAP_WOL_MCAST) |
1241 |
ifp->if_capenable ^= IFCAP_WOL_MCAST; |
1242 |
if (mask & IFCAP_WOL_UCAST) |
1243 |
ifp->if_capenable ^= IFCAP_WOL_UCAST; |
1244 |
if (mask & IFCAP_WOL_MAGIC) |
1245 |
ifp->if_capenable ^= IFCAP_WOL_MAGIC; |
1246 |
} |
1243 |
if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) |
1247 |
if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) |
1244 |
igb_init(adapter); |
1248 |
igb_init(adapter); |
1245 |
VLAN_CAPABILITIES(ifp); |
1249 |
VLAN_CAPABILITIES(ifp); |
Lines 2299-2305
Link Here
|
2299 |
} |
2303 |
} |
2300 |
|
2304 |
|
2301 |
e1000_reset_hw(&adapter->hw); |
2305 |
e1000_reset_hw(&adapter->hw); |
2302 |
E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0); |
2306 |
E1000_WRITE_REG(&adapter->hw, E1000_WUFC, 0); |
2303 |
|
2307 |
|
2304 |
e1000_led_off(&adapter->hw); |
2308 |
e1000_led_off(&adapter->hw); |
2305 |
e1000_cleanup_led(&adapter->hw); |
2309 |
e1000_cleanup_led(&adapter->hw); |
Lines 3135-3141
Link Here
|
3135 |
|
3139 |
|
3136 |
/* Issue a global reset */ |
3140 |
/* Issue a global reset */ |
3137 |
e1000_reset_hw(hw); |
3141 |
e1000_reset_hw(hw); |
3138 |
E1000_WRITE_REG(hw, E1000_WUC, 0); |
3142 |
E1000_WRITE_REG(hw, E1000_WUFC, 0); |
3139 |
|
3143 |
|
3140 |
/* Reset for AutoMediaDetect */ |
3144 |
/* Reset for AutoMediaDetect */ |
3141 |
if (adapter->flags & IGB_MEDIA_RESET) { |
3145 |
if (adapter->flags & IGB_MEDIA_RESET) { |
Lines 3227-3232
Link Here
|
3227 |
| IFCAP_VLAN_MTU; |
3231 |
| IFCAP_VLAN_MTU; |
3228 |
|
3232 |
|
3229 |
/* |
3233 |
/* |
|
|
3234 |
* Force to enable WOL capabilities. |
3235 |
* Enable only WOL MAGIC by default. |
3236 |
*/ |
3237 |
ifp->if_capabilities |= IFCAP_WOL; |
3238 |
ifp->if_capenable |= IFCAP_WOL_MAGIC; |
3239 |
|
3240 |
/* |
3230 |
** Don't turn this on by default, if vlans are |
3241 |
** Don't turn this on by default, if vlans are |
3231 |
** created on another pseudo device (eg. lagg) |
3242 |
** created on another pseudo device (eg. lagg) |
3232 |
** then vlan events are not passed thru, breaking |
3243 |
** then vlan events are not passed thru, breaking |
Lines 5507-5515
Link Here
|
5507 |
static void |
5518 |
static void |
5508 |
igb_enable_wakeup(device_t dev) |
5519 |
igb_enable_wakeup(device_t dev) |
5509 |
{ |
5520 |
{ |
|
|
5521 |
struct adapter *adapter = device_get_softc(dev); |
5522 |
struct ifnet *ifp = adapter->ifp; |
5523 |
u32 wuc; |
5510 |
u16 cap, status; |
5524 |
u16 cap, status; |
5511 |
u8 id; |
5525 |
u8 id; |
5512 |
|
5526 |
|
|
|
5527 |
adapter->wol = E1000_READ_REG(&adapter->hw, E1000_WUFC); |
5528 |
if (ifp->if_capenable & IFCAP_WOL_MAGIC) { |
5529 |
adapter->wol |= E1000_WUFC_MAG; |
5530 |
} else { |
5531 |
adapter->wol &= ~E1000_WUFC_MAG; |
5532 |
} |
5533 |
if (ifp->if_capenable & IFCAP_WOL_MCAST) { |
5534 |
adapter->wol |= E1000_WUFC_MC; |
5535 |
} else { |
5536 |
adapter->wol &= ~E1000_WUFC_MC; |
5537 |
} |
5538 |
if (ifp->if_capenable & IFCAP_WOL_UCAST) { |
5539 |
adapter->wol |= E1000_WUFC_EX; |
5540 |
} else { |
5541 |
adapter->wol &= ~E1000_WUFC_EX; |
5542 |
} |
5543 |
if(adapter->wol & |
5544 |
( E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_MAG) ) { |
5545 |
wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); |
5546 |
wuc |= (E1000_WUC_PME_EN | E1000_WUC_APME) ; |
5547 |
E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); |
5548 |
E1000_WRITE_REG(&adapter->hw, E1000_WUFC, adapter->wol); |
5549 |
|
5513 |
/* First find the capabilities pointer*/ |
5550 |
/* First find the capabilities pointer*/ |
5514 |
cap = pci_read_config(dev, PCIR_CAP_PTR, 2); |
5551 |
cap = pci_read_config(dev, PCIR_CAP_PTR, 2); |
5515 |
/* Read the PM Capabilities */ |
5552 |
/* Read the PM Capabilities */ |
Lines 5522-5527
Link Here
|
5522 |
status = pci_read_config(dev, cap, 2); |
5559 |
status = pci_read_config(dev, cap, 2); |
5523 |
status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; |
5560 |
status |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; |
5524 |
pci_write_config(dev, cap, status, 2); |
5561 |
pci_write_config(dev, cap, status, 2); |
|
|
5562 |
} |
5525 |
return; |
5563 |
return; |
5526 |
} |
5564 |
} |
5527 |
|
5565 |
|