Lines 485-490
Link Here
|
485 |
static void bge_stop_fw(struct bge_softc *); |
485 |
static void bge_stop_fw(struct bge_softc *); |
486 |
static int bge_reset(struct bge_softc *); |
486 |
static int bge_reset(struct bge_softc *); |
487 |
static void bge_link_upd(struct bge_softc *); |
487 |
static void bge_link_upd(struct bge_softc *); |
|
|
488 |
static void bge_setwol(struct bge_softc *); |
488 |
|
489 |
|
489 |
static void bge_ape_lock_init(struct bge_softc *); |
490 |
static void bge_ape_lock_init(struct bge_softc *); |
490 |
static void bge_ape_read_fw_ver(struct bge_softc *); |
491 |
static void bge_ape_read_fw_ver(struct bge_softc *); |
Lines 3735-3741
Link Here
|
3735 |
IFQ_SET_READY(&ifp->if_snd); |
3736 |
IFQ_SET_READY(&ifp->if_snd); |
3736 |
ifp->if_hwassist = sc->bge_csum_features; |
3737 |
ifp->if_hwassist = sc->bge_csum_features; |
3737 |
ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | |
3738 |
ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | |
3738 |
IFCAP_VLAN_MTU; |
3739 |
IFCAP_VLAN_MTU | IFCAP_WOL_MAGIC; |
3739 |
if ((sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) != 0) { |
3740 |
if ((sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) != 0) { |
3740 |
ifp->if_hwassist |= CSUM_TSO; |
3741 |
ifp->if_hwassist |= CSUM_TSO; |
3741 |
ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; |
3742 |
ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; |
Lines 3743-3748
Link Here
|
3743 |
#ifdef IFCAP_VLAN_HWCSUM |
3744 |
#ifdef IFCAP_VLAN_HWCSUM |
3744 |
ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; |
3745 |
ifp->if_capabilities |= IFCAP_VLAN_HWCSUM; |
3745 |
#endif |
3746 |
#endif |
|
|
3747 |
if (pci_find_cap(dev, PCIY_PMG, ®) == 0) |
3748 |
ifp->if_capabilities |= IFCAP_WOL_MAGIC; |
3746 |
ifp->if_capenable = ifp->if_capabilities; |
3749 |
ifp->if_capenable = ifp->if_capabilities; |
3747 |
#ifdef DEVICE_POLLING |
3750 |
#ifdef DEVICE_POLLING |
3748 |
ifp->if_capabilities |= IFCAP_POLLING; |
3751 |
ifp->if_capabilities |= IFCAP_POLLING; |
Lines 5847-5852
Link Here
|
5847 |
} |
5850 |
} |
5848 |
} |
5851 |
} |
5849 |
#endif |
5852 |
#endif |
|
|
5853 |
if ((mask & IFCAP_WOL_MAGIC) != 0 && |
5854 |
(ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) |
5855 |
ifp->if_capenable ^= IFCAP_WOL_MAGIC; |
5850 |
if ((mask & IFCAP_TXCSUM) != 0 && |
5856 |
if ((mask & IFCAP_TXCSUM) != 0 && |
5851 |
(ifp->if_capabilities & IFCAP_TXCSUM) != 0) { |
5857 |
(ifp->if_capabilities & IFCAP_TXCSUM) != 0) { |
5852 |
ifp->if_capenable ^= IFCAP_TXCSUM; |
5858 |
ifp->if_capenable ^= IFCAP_TXCSUM; |
Lines 6073-6078
Link Here
|
6073 |
sc = device_get_softc(dev); |
6079 |
sc = device_get_softc(dev); |
6074 |
BGE_LOCK(sc); |
6080 |
BGE_LOCK(sc); |
6075 |
bge_stop(sc); |
6081 |
bge_stop(sc); |
|
|
6082 |
bge_setwol(sc); |
6076 |
BGE_UNLOCK(sc); |
6083 |
BGE_UNLOCK(sc); |
6077 |
|
6084 |
|
6078 |
return (0); |
6085 |
return (0); |
Lines 6086-6091
Link Here
|
6086 |
sc = device_get_softc(dev); |
6093 |
sc = device_get_softc(dev); |
6087 |
BGE_LOCK(sc); |
6094 |
BGE_LOCK(sc); |
6088 |
bge_stop(sc); |
6095 |
bge_stop(sc); |
|
|
6096 |
bge_setwol(sc); |
6089 |
BGE_UNLOCK(sc); |
6097 |
BGE_UNLOCK(sc); |
6090 |
|
6098 |
|
6091 |
return (0); |
6099 |
return (0); |
Lines 6771-6773
Link Here
|
6771 |
} |
6779 |
} |
6772 |
return (*func == NULL ? ENXIO : 0); |
6780 |
return (*func == NULL ? ENXIO : 0); |
6773 |
} |
6781 |
} |
|
|
6782 |
|
6783 |
static void |
6784 |
bge_setwol(struct bge_softc *sc) |
6785 |
{ |
6786 |
struct ifnet *ifp; |
6787 |
uint16_t pmstat; |
6788 |
int pmc; |
6789 |
|
6790 |
BGE_LOCK_ASSERT(sc); |
6791 |
|
6792 |
if (pci_find_cap(sc->bge_dev, PCIY_PMG, &pmc) != 0) |
6793 |
return; |
6794 |
ifp = sc->bge_ifp; |
6795 |
if ((ifp->if_capenable & IFCAP_WOL_MAGIC) == 0) |
6796 |
return; |
6797 |
if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) { |
6798 |
BGE_SETBIT(sc, BGE_MAC_MODE, BGE_MACMODE_MAGIC_PKT_ENB); |
6799 |
BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_PORTMODE); |
6800 |
BGE_SETBIT(sc, BGE_MAC_MODE, BGE_PORTMODE_GMII); |
6801 |
BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); |
6802 |
} |
6803 |
else { |
6804 |
BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_MAGIC_PKT_ENB); |
6805 |
} |
6806 |
|
6807 |
/* Request PME if WOL is requested. */ |
6808 |
pmstat = pci_read_config(sc->bge_dev, pmc + PCIR_POWER_STATUS, 2); |
6809 |
pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); |
6810 |
if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) |
6811 |
pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; |
6812 |
pci_write_config(sc->bge_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); |
6813 |
} |