View | Details | Raw Unified | Return to bug 208343 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/e1000/if_igb.c (-12 / +50 lines)
Lines 728-738 Link Here
728
	igb_release_manageability(adapter);
728
	igb_release_manageability(adapter);
729
	igb_release_hw_control(adapter);
729
	igb_release_hw_control(adapter);
730
730
731
	if (adapter->wol) {
731
	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
732
737
	/* Unregister VLAN events */
733
	/* Unregister VLAN events */
738
	if (adapter->vlan_attach != NULL)
734
	if (adapter->vlan_attach != NULL)
Lines 786-796 Link Here
786
        igb_release_manageability(adapter);
782
        igb_release_manageability(adapter);
787
	igb_release_hw_control(adapter);
783
	igb_release_hw_control(adapter);
788
784
789
        if (adapter->wol) {
785
        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
786
795
	IGB_CORE_UNLOCK(adapter);
787
	IGB_CORE_UNLOCK(adapter);
796
788
Lines 1240-1245 Link Here
1240
			ifp->if_capenable ^= IFCAP_LRO;
1232
			ifp->if_capenable ^= IFCAP_LRO;
1241
			reinit = 1;
1233
			reinit = 1;
1242
		}
1234
		}
1235
		if (mask & IFCAP_WOL) {
1236
			if (mask & IFCAP_WOL_MCAST)
1237
				ifp->if_capenable ^= IFCAP_WOL_MCAST;
1238
			if (mask & IFCAP_WOL_UCAST)
1239
				ifp->if_capenable ^= IFCAP_WOL_UCAST;
1240
			if (mask & IFCAP_WOL_MAGIC)
1241
				ifp->if_capenable ^= IFCAP_WOL_MAGIC;
1242
		}
1243
		if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING))
1243
		if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING))
1244
			igb_init(adapter);
1244
			igb_init(adapter);
1245
		VLAN_CAPABILITIES(ifp);
1245
		VLAN_CAPABILITIES(ifp);
Lines 2299-2305 Link Here
2299
	}
2299
	}
2300
2300
2301
	e1000_reset_hw(&adapter->hw);
2301
	e1000_reset_hw(&adapter->hw);
2302
	E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0);
2302
	E1000_WRITE_REG(&adapter->hw, E1000_WUFC, 0);
2303
2303
2304
	e1000_led_off(&adapter->hw);
2304
	e1000_led_off(&adapter->hw);
2305
	e1000_cleanup_led(&adapter->hw);
2305
	e1000_cleanup_led(&adapter->hw);
Lines 3135-3141 Link Here
3135
3135
3136
	/* Issue a global reset */
3136
	/* Issue a global reset */
3137
	e1000_reset_hw(hw);
3137
	e1000_reset_hw(hw);
3138
	E1000_WRITE_REG(hw, E1000_WUC, 0);
3138
	E1000_WRITE_REG(hw, E1000_WUFC, 0);
3139
3139
3140
	/* Reset for AutoMediaDetect */
3140
	/* Reset for AutoMediaDetect */
3141
	if (adapter->flags & IGB_MEDIA_RESET) {
3141
	if (adapter->flags & IGB_MEDIA_RESET) {
Lines 3226-3232 Link Here
3226
			  |  IFCAP_VLAN_HWTSO
3226
			  |  IFCAP_VLAN_HWTSO
3227
			  |  IFCAP_VLAN_MTU;
3227
			  |  IFCAP_VLAN_MTU;
3228
3228
3229
	/* Force to enable WOL capabilities. */
3230
	ifp->if_capabilities |= IFCAP_WOL;
3231
3229
	/*
3232
	/*
3233
	 * Enable only WOL MAGIC by default
3234
	 * if WOL is enabled by EEPROM.
3235
	 */
3236
	if( adapter->wol ) {
3237
		ifp->if_capenable |= IFCAP_WOL_MAGIC;
3238
	}
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

Return to bug 208343