aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ae/if_ae.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ae/if_ae.c')
-rw-r--r--sys/dev/ae/if_ae.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/sys/dev/ae/if_ae.c b/sys/dev/ae/if_ae.c
index 62c1a8a30cc8..87de885701ae 100644
--- a/sys/dev/ae/if_ae.c
+++ b/sys/dev/ae/if_ae.c
@@ -238,7 +238,7 @@ ae_attach(device_t dev)
if_t ifp;
uint8_t chiprev;
uint32_t pcirev;
- int nmsi, pmc;
+ int nmsi;
int error;
sc = device_get_softc(dev); /* Automatically allocated and zeroed
@@ -326,12 +326,6 @@ ae_attach(device_t dev)
goto fail;
ifp = sc->ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- device_printf(dev, "could not allocate ifnet structure.\n");
- error = ENXIO;
- 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);
@@ -342,7 +336,7 @@ ae_attach(device_t dev)
if_sethwassist(ifp, 0);
if_setsendqlen(ifp, ifqmaxlen);
if_setsendqready(ifp);
- if (pci_find_cap(dev, PCIY_PMG, &pmc) == 0) {
+ if (pci_has_pm(dev)) {
if_setcapabilitiesbit(ifp, IFCAP_WOL_MAGIC, 0);
sc->flags |= AE_FLAG_PMG;
}
@@ -368,12 +362,6 @@ ae_attach(device_t dev)
*/
sc->tq = taskqueue_create_fast("ae_taskq", M_WAITOK,
taskqueue_thread_enqueue, &sc->tq);
- if (sc->tq == NULL) {
- device_printf(dev, "could not create taskqueue.\n");
- ether_ifdetach(ifp);
- error = ENXIO;
- goto fail;
- }
taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq",
device_get_nameunit(sc->dev));
@@ -773,10 +761,6 @@ ae_detach(device_t dev)
taskqueue_free(sc->tq);
sc->tq = NULL;
}
- if (sc->miibus != NULL) {
- device_delete_child(dev, sc->miibus);
- sc->miibus = NULL;
- }
bus_generic_detach(sc->dev);
ae_dma_free(sc);
if (sc->intrhand != NULL) {
@@ -1318,9 +1302,7 @@ ae_pm_init(ae_softc_t *sc)
{
if_t ifp;
uint32_t val;
- uint16_t pmstat;
struct mii_data *mii;
- int pmc;
AE_LOCK_ASSERT(sc);
@@ -1379,13 +1361,8 @@ ae_pm_init(ae_softc_t *sc)
/*
* Configure PME.
*/
- if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0) {
- pmstat = pci_read_config(sc->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->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
- }
+ if ((if_getcapenable(ifp) & IFCAP_WOL) != 0)
+ pci_enable_pme(sc->dev);
}
static int