aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xl/if_xl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/xl/if_xl.c')
-rw-r--r--sys/dev/xl/if_xl.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/sys/dev/xl/if_xl.c b/sys/dev/xl/if_xl.c
index 573bc6581577..0d1e05833f1e 100644
--- a/sys/dev/xl/if_xl.c
+++ b/sys/dev/xl/if_xl.c
@@ -1063,7 +1063,7 @@ xl_attach(device_t dev)
u_int16_t sinfo2, xcvr[2];
struct xl_softc *sc;
if_t ifp;
- int media, pmcap;
+ int media;
int error = 0, phy, rid, res;
uint16_t did;
@@ -1188,11 +1188,6 @@ xl_attach(device_t dev)
/* Initialize interface name. */
ifp = sc->xl_ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- device_printf(dev, "can not if_alloc()\n");
- error = ENOSPC;
- goto fail;
- }
if_setsoftc(ifp, sc);
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
@@ -1319,9 +1314,7 @@ xl_attach(device_t dev)
sc->xl_type = XL_TYPE_90X;
/* Check availability of WOL. */
- if ((sc->xl_caps & XL_CAPS_PWRMGMT) != 0 &&
- pci_find_cap(dev, PCIY_PMG, &pmcap) == 0) {
- sc->xl_pmcap = pmcap;
+ if ((sc->xl_caps & XL_CAPS_PWRMGMT) != 0 && pci_has_pm(dev)) {
sc->xl_flags |= XL_FLAG_WOL;
sinfo2 = 0;
xl_read_eeprom(sc, (caddr_t)&sinfo2, XL_EE_SOFTINFO2, 1, 0);
@@ -1577,8 +1570,6 @@ xl_detach(device_t dev)
callout_drain(&sc->xl_tick_callout);
ether_ifdetach(ifp);
}
- if (sc->xl_miibus)
- device_delete_child(dev, sc->xl_miibus);
bus_generic_detach(dev);
ifmedia_removeall(&sc->ifmedia);
@@ -3263,7 +3254,7 @@ static void
xl_setwol(struct xl_softc *sc)
{
if_t ifp;
- u_int16_t cfg, pmstat;
+ u_int16_t cfg;
if ((sc->xl_flags & XL_FLAG_WOL) == 0)
return;
@@ -3280,12 +3271,6 @@ xl_setwol(struct xl_softc *sc)
if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) != 0)
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_ENABLE);
/* Request PME. */
- pmstat = pci_read_config(sc->xl_dev,
- sc->xl_pmcap + PCIR_POWER_STATUS, 2);
if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) != 0)
- pmstat |= PCIM_PSTAT_PMEENABLE;
- else
- pmstat &= ~PCIM_PSTAT_PMEENABLE;
- pci_write_config(sc->xl_dev,
- sc->xl_pmcap + PCIR_POWER_STATUS, pmstat, 2);
+ pci_enable_pme(sc->xl_dev);
}