diff options
Diffstat (limited to 'sys/dev/vr/if_vr.c')
-rw-r--r-- | sys/dev/vr/if_vr.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index 2afe16e3c6d2..284628365c83 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -607,7 +607,7 @@ vr_attach(device_t dev) const struct vr_type *t; uint8_t eaddr[ETHER_ADDR_LEN]; int error, rid; - int i, phy, pmc; + int i, phy; sc = device_get_softc(dev); sc->vr_dev = dev; @@ -656,11 +656,6 @@ vr_attach(device_t dev) /* Allocate ifnet structure. */ ifp = sc->vr_ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) { - device_printf(dev, "couldn't allocate ifnet structure\n"); - error = ENOSPC; - goto fail; - } if_setsoftc(ifp, sc); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); @@ -693,8 +688,7 @@ vr_attach(device_t dev) sc->vr_txthresh = VR_TXTHRESH_MAX; } - if (sc->vr_revid >= REV_ID_VT6102_A && - pci_find_cap(dev, PCIY_PMG, &pmc) == 0) + if (sc->vr_revid >= REV_ID_VT6102_A && pci_has_pm(dev)) if_setcapabilitiesbit(ifp, IFCAP_WOL_UCAST | IFCAP_WOL_MAGIC, 0); /* Rhine supports oversized VLAN frame. */ @@ -709,7 +703,7 @@ vr_attach(device_t dev) * shuts down. Be sure to kick it in the head to wake it * up again. */ - if (pci_find_cap(dev, PCIY_PMG, &pmc) == 0) + if (pci_has_pm(dev)) VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1)); /* @@ -843,8 +837,6 @@ vr_detach(device_t dev) taskqueue_drain(taskqueue_fast, &sc->vr_inttask); ether_ifdetach(ifp); } - if (sc->vr_miibus) - device_delete_child(dev, sc->vr_miibus); bus_generic_detach(dev); if (sc->vr_intrhand) @@ -2533,14 +2525,12 @@ static void vr_setwol(struct vr_softc *sc) { if_t ifp; - int pmc; - uint16_t pmstat; uint8_t v; VR_LOCK_ASSERT(sc); if (sc->vr_revid < REV_ID_VT6102_A || - pci_find_cap(sc->vr_dev, PCIY_PMG, &pmc) != 0) + !pci_has_pm(sc->vr_dev)) return; ifp = sc->vr_ifp; @@ -2579,11 +2569,8 @@ vr_setwol(struct vr_softc *sc) CSR_WRITE_1(sc, VR_STICKHW, v); /* Request PME if WOL is requested. */ - pmstat = pci_read_config(sc->vr_dev, pmc + PCIR_POWER_STATUS, 2); - pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); if ((if_getcapenable(ifp) & IFCAP_WOL) != 0) - pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(sc->vr_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + pci_enable_pme(sc->vr_dev); } static void |