aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/alc
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/alc')
-rw-r--r--sys/dev/alc/if_alc.c48
-rw-r--r--sys/dev/alc/if_alcvar.h1
2 files changed, 4 insertions, 45 deletions
diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c
index 86ae705667de..7d47054414d6 100644
--- a/sys/dev/alc/if_alc.c
+++ b/sys/dev/alc/if_alc.c
@@ -1584,12 +1584,6 @@ alc_attach(device_t dev)
alc_get_macaddr(sc);
ifp = sc->alc_ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- device_printf(dev, "cannot 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);
@@ -1600,10 +1594,9 @@ alc_attach(device_t dev)
if_setsendqready(ifp);
if_setcapabilities(ifp, IFCAP_TXCSUM | IFCAP_TSO4);
if_sethwassist(ifp, ALC_CSUM_FEATURES | CSUM_TSO);
- if (pci_find_cap(dev, PCIY_PMG, &base) == 0) {
+ if (pci_has_pm(dev)) {
if_setcapabilitiesbit(ifp, IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST, 0);
sc->alc_flags |= ALC_FLAG_PM;
- sc->alc_pmcap = base;
}
if_setcapenable(ifp, if_getcapabilities(ifp));
@@ -1645,12 +1638,6 @@ alc_attach(device_t dev)
/* Create local taskq. */
sc->alc_tq = taskqueue_create_fast("alc_taskq", M_WAITOK,
taskqueue_thread_enqueue, &sc->alc_tq);
- if (sc->alc_tq == NULL) {
- device_printf(dev, "could not create taskqueue.\n");
- ether_ifdetach(ifp);
- error = ENXIO;
- goto fail;
- }
taskqueue_start_threads(&sc->alc_tq, 1, PI_NET, "%s taskq",
device_get_nameunit(sc->alc_dev));
@@ -1711,10 +1698,6 @@ alc_detach(device_t dev)
sc->alc_tq = NULL;
}
- if (sc->alc_miibus != NULL) {
- device_delete_child(dev, sc->alc_miibus);
- sc->alc_miibus = NULL;
- }
bus_generic_detach(dev);
alc_dma_free(sc);
@@ -2546,7 +2529,6 @@ alc_setwol_813x(struct alc_softc *sc)
{
if_t ifp;
uint32_t reg, pmcs;
- uint16_t pmstat;
ALC_LOCK_ASSERT(sc);
@@ -2595,13 +2577,8 @@ alc_setwol_813x(struct alc_softc *sc)
CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS);
}
/* Request PME. */
- pmstat = pci_read_config(sc->alc_dev,
- sc->alc_pmcap + 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->alc_dev,
- sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2);
+ pci_enable_pme(sc->alc_dev);
}
static void
@@ -2609,7 +2586,6 @@ alc_setwol_816x(struct alc_softc *sc)
{
if_t ifp;
uint32_t gphy, mac, master, pmcs, reg;
- uint16_t pmstat;
ALC_LOCK_ASSERT(sc);
@@ -2660,13 +2636,8 @@ alc_setwol_816x(struct alc_softc *sc)
if ((sc->alc_flags & ALC_FLAG_PM) != 0) {
/* Request PME. */
- pmstat = pci_read_config(sc->alc_dev,
- sc->alc_pmcap + 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->alc_dev,
- sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2);
+ pci_enable_pme(sc->alc_dev);
}
}
@@ -2690,22 +2661,11 @@ alc_resume(device_t dev)
{
struct alc_softc *sc;
if_t ifp;
- uint16_t pmstat;
sc = device_get_softc(dev);
- ALC_LOCK(sc);
- if ((sc->alc_flags & ALC_FLAG_PM) != 0) {
- /* Disable PME and clear PME status. */
- pmstat = pci_read_config(sc->alc_dev,
- sc->alc_pmcap + PCIR_POWER_STATUS, 2);
- if ((pmstat & PCIM_PSTAT_PMEENABLE) != 0) {
- pmstat &= ~PCIM_PSTAT_PMEENABLE;
- pci_write_config(sc->alc_dev,
- sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2);
- }
- }
/* Reset PHY. */
+ ALC_LOCK(sc);
alc_phy_reset(sc);
ifp = sc->alc_ifp;
if ((if_getflags(ifp) & IFF_UP) != 0) {
diff --git a/sys/dev/alc/if_alcvar.h b/sys/dev/alc/if_alcvar.h
index f68c22146868..c3073c6f0a2e 100644
--- a/sys/dev/alc/if_alcvar.h
+++ b/sys/dev/alc/if_alcvar.h
@@ -219,7 +219,6 @@ struct alc_softc {
uint32_t alc_dma_wr_burst;
uint32_t alc_rcb;
int alc_expcap;
- int alc_pmcap;
int alc_flags;
#define ALC_FLAG_PCIE 0x0001
#define ALC_FLAG_PCIX 0x0002