diff options
author | scottl <scottl@FreeBSD.org> | 2013-08-12 23:30:01 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2013-08-12 23:30:01 +0000 |
commit | 28bd1409da1e9911c4152b06c5c7b89235e2b17a (patch) | |
tree | 34ad11c71aadd28f5ff680b63e3f0fd70956bed5 /sys/dev/sound | |
parent | c8a53736fe9139a202d17ed7f95389d33326cb61 (diff) | |
download | FreeBSD-src-28bd1409da1e9911c4152b06c5c7b89235e2b17a.zip FreeBSD-src-28bd1409da1e9911c4152b06c5c7b89235e2b17a.tar.gz |
Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI
command register. The lazy BAR allocation code in FreeBSD sometimes
disables this bit when it detects a range conflict, and will re-enable
it on demand when a driver allocates the BAR. Thus, the bit is no longer
a reliable indication of capability, and should not be checked. This
results in the elimination of a lot of code from drivers, and also gives
the opportunity to simplify a lot of drivers to use a helper API to set
the busmaster enable bit.
This changes fixes some recent reports of disk controllers and their
associated drives/enclosures disappearing during boot.
Submitted by: jhb
Reviewed by: jfv, marius, achadd, achim
MFC after: 1 day
Diffstat (limited to 'sys/dev/sound')
-rw-r--r-- | sys/dev/sound/pci/als4000.c | 5 | ||||
-rw-r--r-- | sys/dev/sound/pci/aureal.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/cmi.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/cs4281.c | 5 | ||||
-rw-r--r-- | sys/dev/sound/pci/csa.c | 8 | ||||
-rw-r--r-- | sys/dev/sound/pci/ds1.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/emu10k1.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/emu10kx.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/envy24.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/envy24ht.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/es137x.c | 9 | ||||
-rw-r--r-- | sys/dev/sound/pci/fm801.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/hdspe.c | 17 | ||||
-rw-r--r-- | sys/dev/sound/pci/maestro.c | 9 | ||||
-rw-r--r-- | sys/dev/sound/pci/maestro3.c | 5 | ||||
-rw-r--r-- | sys/dev/sound/pci/neomagic.c | 15 | ||||
-rw-r--r-- | sys/dev/sound/pci/solo.c | 12 | ||||
-rw-r--r-- | sys/dev/sound/pci/t4dwave.c | 7 | ||||
-rw-r--r-- | sys/dev/sound/pci/via82c686.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/vibes.c | 5 |
20 files changed, 23 insertions, 128 deletions
diff --git a/sys/dev/sound/pci/als4000.c b/sys/dev/sound/pci/als4000.c index bde95e7..0cd51e3 100644 --- a/sys/dev/sound/pci/als4000.c +++ b/sys/dev/sound/pci/als4000.c @@ -806,16 +806,13 @@ static int als_pci_attach(device_t dev) { struct sc_info *sc; - u_int32_t data; char status[SND_STATUSLEN]; sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_als4000 softc"); sc->dev = dev; - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); + pci_enable_busmaster(dev); /* * By default the power to the various components on the * ALS4000 is entirely controlled by the pci powerstate. We diff --git a/sys/dev/sound/pci/aureal.c b/sys/dev/sound/pci/aureal.c index 37e1c45..67af075 100644 --- a/sys/dev/sound/pci/aureal.c +++ b/sys/dev/sound/pci/aureal.c @@ -550,7 +550,6 @@ au_pci_probe(device_t dev) static int au_pci_attach(device_t dev) { - u_int32_t data; struct au_info *au; int type[10]; int regid[10]; @@ -565,10 +564,7 @@ au_pci_attach(device_t dev) au = malloc(sizeof(*au), M_DEVBUF, M_WAITOK | M_ZERO); au->unit = device_get_unit(dev); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); j=0; /* XXX dfr: is this strictly necessary? */ diff --git a/sys/dev/sound/pci/cmi.c b/sys/dev/sound/pci/cmi.c index 2b747e1..6075a92 100644 --- a/sys/dev/sound/pci/cmi.c +++ b/sys/dev/sound/pci/cmi.c @@ -935,15 +935,11 @@ static int cmi_attach(device_t dev) { struct sc_info *sc; - u_int32_t data; char status[SND_STATUSLEN]; sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_cmi softc"); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); sc->dev = dev; sc->regid = PCIR_BAR(0); diff --git a/sys/dev/sound/pci/cs4281.c b/sys/dev/sound/pci/cs4281.c index e533eee..6e1b17d 100644 --- a/sys/dev/sound/pci/cs4281.c +++ b/sys/dev/sound/pci/cs4281.c @@ -760,16 +760,13 @@ cs4281_pci_attach(device_t dev) { struct sc_info *sc; struct ac97_info *codec = NULL; - u_int32_t data; char status[SND_STATUSLEN]; sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->dev = dev; sc->type = pci_get_devid(dev); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); + pci_enable_busmaster(dev); #if __FreeBSD_version > 500000 if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { diff --git a/sys/dev/sound/pci/csa.c b/sys/dev/sound/pci/csa.c index 7fa0b13..4a766e7 100644 --- a/sys/dev/sound/pci/csa.c +++ b/sys/dev/sound/pci/csa.c @@ -242,7 +242,6 @@ csa_probe(device_t dev) static int csa_attach(device_t dev) { - u_int32_t stcmd; sc_p scp; csa_res *resp; struct sndcard_func *func; @@ -254,12 +253,7 @@ csa_attach(device_t dev) bzero(scp, sizeof(*scp)); scp->dev = dev; - /* Wake up the device. */ - stcmd = pci_read_config(dev, PCIR_COMMAND, 2); - if ((stcmd & PCIM_CMD_MEMEN) == 0 || (stcmd & PCIM_CMD_BUSMASTEREN) == 0) { - stcmd |= (PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, stcmd, 2); - } + pci_enable_busmaster(dev); /* Allocate the resources. */ resp = &scp->res; diff --git a/sys/dev/sound/pci/ds1.c b/sys/dev/sound/pci/ds1.c index 16626b5..302271a 100644 --- a/sys/dev/sound/pci/ds1.c +++ b/sys/dev/sound/pci/ds1.c @@ -941,7 +941,6 @@ ds_pci_probe(device_t dev) static int ds_pci_attach(device_t dev) { - u_int32_t data; u_int32_t subdev, i; struct sc_info *sc; struct ac97_info *codec = NULL; @@ -954,10 +953,7 @@ ds_pci_attach(device_t dev) sc->type = ds_finddev(pci_get_devid(dev), subdev); sc->rev = pci_get_revid(dev); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); sc->regid = PCIR_BAR(0); sc->reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->regid, diff --git a/sys/dev/sound/pci/emu10k1.c b/sys/dev/sound/pci/emu10k1.c index 0aaeb4b..026c721 100644 --- a/sys/dev/sound/pci/emu10k1.c +++ b/sys/dev/sound/pci/emu10k1.c @@ -2067,7 +2067,6 @@ emu_pci_attach(device_t dev) { struct ac97_info *codec = NULL; struct sc_info *sc; - u_int32_t data; int i, gotmic; char status[SND_STATUSLEN]; @@ -2081,10 +2080,7 @@ emu_pci_attach(device_t dev) sc->nchans = sc->audigy ? 8 : 4; sc->addrmask = sc->audigy ? EMU_A_PTR_ADDR_MASK : EMU_PTR_ADDR_MASK; - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); i = PCIR_BAR(0); sc->reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &i, RF_ACTIVE); diff --git a/sys/dev/sound/pci/emu10kx.c b/sys/dev/sound/pci/emu10kx.c index 4503c05..cca4997 100644 --- a/sys/dev/sound/pci/emu10kx.c +++ b/sys/dev/sound/pci/emu10kx.c @@ -3040,7 +3040,6 @@ emu_pci_attach(device_t dev) #if 0 struct emu_midiinfo *midiinfo; #endif - uint32_t data; int i; int device_flags; char status[255]; @@ -3182,11 +3181,6 @@ emu_pci_attach(device_t dev) if (sc->opcode_shift == 0) goto bad; - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); - pci_enable_busmaster(dev); i = PCIR_BAR(0); diff --git a/sys/dev/sound/pci/envy24.c b/sys/dev/sound/pci/envy24.c index 1c59765..6c23e28 100644 --- a/sys/dev/sound/pci/envy24.c +++ b/sys/dev/sound/pci/envy24.c @@ -2547,7 +2547,6 @@ envy24_alloc_resource(struct sc_info *sc) static int envy24_pci_attach(device_t dev) { - u_int32_t data; struct sc_info *sc; char status[SND_STATUSLEN]; int err = 0; @@ -2567,10 +2566,7 @@ envy24_pci_attach(device_t dev) sc->dev = dev; /* initialize PCI interface */ - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); /* allocate resources */ err = envy24_alloc_resource(sc); diff --git a/sys/dev/sound/pci/envy24ht.c b/sys/dev/sound/pci/envy24ht.c index b0c138d..7372e8a 100644 --- a/sys/dev/sound/pci/envy24ht.c +++ b/sys/dev/sound/pci/envy24ht.c @@ -2450,7 +2450,6 @@ envy24ht_alloc_resource(struct sc_info *sc) static int envy24ht_pci_attach(device_t dev) { - u_int32_t data; struct sc_info *sc; char status[SND_STATUSLEN]; int err = 0; @@ -2471,10 +2470,7 @@ envy24ht_pci_attach(device_t dev) sc->dev = dev; /* initialize PCI interface */ - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); /* allocate resources */ err = envy24ht_alloc_resource(sc); diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index f4e24af..42d0450 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -1704,7 +1704,6 @@ es_init_sysctls(device_t dev) static int es_pci_attach(device_t dev) { - uint32_t data; struct es_info *es = NULL; int mapped, i, numplay, dac_cfg; char status[SND_STATUSLEN]; @@ -1719,11 +1718,7 @@ es_pci_attach(device_t dev) mapped = 0; pci_enable_busmaster(dev); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); - if (mapped == 0 && (data & PCIM_CMD_MEMEN)) { + if (mapped == 0) { es->regid = MEM_MAP_REG; es->regtype = SYS_RES_MEMORY; es->reg = bus_alloc_resource_any(dev, es->regtype, &es->regid, @@ -1731,7 +1726,7 @@ es_pci_attach(device_t dev) if (es->reg) mapped++; } - if (mapped == 0 && (data & PCIM_CMD_PORTEN)) { + if (mapped == 0) { es->regid = PCIR_BAR(0); es->regtype = SYS_RES_IOPORT; es->reg = bus_alloc_resource_any(dev, es->regtype, &es->regid, diff --git a/sys/dev/sound/pci/fm801.c b/sys/dev/sound/pci/fm801.c index ccfef36..969d532 100644 --- a/sys/dev/sound/pci/fm801.c +++ b/sys/dev/sound/pci/fm801.c @@ -573,7 +573,6 @@ fm801_init(struct fm801_info *fm801) static int fm801_pci_attach(device_t dev) { - u_int32_t data; struct ac97_info *codec = 0; struct fm801_info *fm801; int i; @@ -583,10 +582,7 @@ fm801_pci_attach(device_t dev) fm801 = malloc(sizeof(*fm801), M_DEVBUF, M_WAITOK | M_ZERO); fm801->type = pci_get_devid(dev); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); for (i = 0; (mapped == 0) && (i < PCI_MAXMAPS_0); i++) { fm801->regid = PCIR_BAR(i); diff --git a/sys/dev/sound/pci/hdspe.c b/sys/dev/sound/pci/hdspe.c index fa576b6..68a17f4 100644 --- a/sys/dev/sound/pci/hdspe.c +++ b/sys/dev/sound/pci/hdspe.c @@ -243,20 +243,6 @@ hdspe_probe(device_t dev) } static int -set_pci_config(device_t dev) -{ - uint32_t data; - - pci_enable_busmaster(dev); - - data = pci_get_revid(dev); - data |= PCIM_CMD_PORTEN; - pci_write_config(dev, PCIR_COMMAND, data, 2); - - return 0; -} - -static int hdspe_init(struct sc_info *sc) { long long period; @@ -307,13 +293,12 @@ hdspe_attach(device_t dev) device_printf(dev, "hdspe_attach()\n"); #endif - set_pci_config(dev); - sc = device_get_softc(dev); sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_hdspe softc"); sc->dev = dev; + pci_enable_busmaster(dev); rev = pci_get_revid(dev); switch (rev) { case PCI_REVISION_AIO: diff --git a/sys/dev/sound/pci/maestro.c b/sys/dev/sound/pci/maestro.c index 66567fc..965d1c2 100644 --- a/sys/dev/sound/pci/maestro.c +++ b/sys/dev/sound/pci/maestro.c @@ -1844,15 +1844,10 @@ agg_attach(device_t dev) ess->curpwr = PCI_POWERSTATE_D3; pci_set_powerstate(dev, PCI_POWERSTATE_D0); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); /* Allocate resources. */ - if (data & PCIM_CMD_PORTEN) - reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT, ®id, - RF_ACTIVE); + reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT, ®id, RF_ACTIVE); if (reg != NULL) { ess->reg = reg; ess->regid = regid; diff --git a/sys/dev/sound/pci/maestro3.c b/sys/dev/sound/pci/maestro3.c index 41e71cd..20a9bda 100644 --- a/sys/dev/sound/pci/maestro3.c +++ b/sys/dev/sound/pci/maestro3.c @@ -1317,7 +1317,6 @@ m3_pci_attach(device_t dev) { struct sc_info *sc; struct ac97_info *codec = NULL; - u_int32_t data; char status[SND_STATUSLEN]; struct m3_card_type *card; int i, len, dacn, adcn; @@ -1351,9 +1350,7 @@ m3_pci_attach(device_t dev) adcn = M3_RCHANS; - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); + pci_enable_busmaster(dev); sc->regid = PCIR_BAR(0); sc->regtype = SYS_RES_MEMORY; diff --git a/sys/dev/sound/pci/neomagic.c b/sys/dev/sound/pci/neomagic.c index f46e3e1..71c1bf1 100644 --- a/sys/dev/sound/pci/neomagic.c +++ b/sys/dev/sound/pci/neomagic.c @@ -599,7 +599,7 @@ nm_pci_probe(device_t dev) { struct sc_info *sc = NULL; char *s = NULL; - u_int32_t subdev, i, data; + u_int32_t subdev, i; subdev = (pci_get_subdevice(dev) << 16) | pci_get_subvendor(dev); switch (pci_get_devid(dev)) { @@ -616,11 +616,6 @@ nm_pci_probe(device_t dev) return ENXIO; } - data = pci_read_config(dev, PCIR_COMMAND, 2); - pci_write_config(dev, PCIR_COMMAND, data | - PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | - PCIM_CMD_BUSMASTEREN, 2); - sc->regid = PCIR_BAR(1); sc->reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->regid, @@ -628,7 +623,6 @@ nm_pci_probe(device_t dev) if (!sc->reg) { device_printf(dev, "unable to map register space\n"); - pci_write_config(dev, PCIR_COMMAND, data, 2); free(sc, M_DEVBUF); return ENXIO; } @@ -645,7 +639,6 @@ nm_pci_probe(device_t dev) DEB(device_printf(dev, "subdev = 0x%x - badcard?\n", subdev)); } - pci_write_config(dev, PCIR_COMMAND, data, 2); bus_release_resource(dev, SYS_RES_MEMORY, sc->regid, sc->reg); free(sc, M_DEVBUF); @@ -670,7 +663,6 @@ nm_pci_probe(device_t dev) static int nm_pci_attach(device_t dev) { - u_int32_t data; struct sc_info *sc; struct ac97_info *codec = 0; char status[SND_STATUSLEN]; @@ -679,10 +671,7 @@ nm_pci_attach(device_t dev) sc->dev = dev; sc->type = pci_get_devid(dev); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); sc->bufid = PCIR_BAR(0); sc->buf = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->bufid, diff --git a/sys/dev/sound/pci/solo.c b/sys/dev/sound/pci/solo.c index ba92020..534d810 100644 --- a/sys/dev/sound/pci/solo.c +++ b/sys/dev/sound/pci/solo.c @@ -949,15 +949,9 @@ static int ess_resume(device_t dev) { uint16_t ddma; - uint32_t data; struct ess_info *sc = pcm_getdevinfo(dev); ess_lock(sc); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN; - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); - ddma = rman_get_start(sc->vc) | 1; pci_write_config(dev, ESS_PCI_LEGACYCONTROL, 0x805f, 2); pci_write_config(dev, ESS_PCI_DDMACONTROL, ddma, 2); @@ -988,13 +982,9 @@ ess_attach(device_t dev) struct ess_info *sc; char status[SND_STATUSLEN]; u_int16_t ddma; - u_int32_t data; sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN; - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); if (ess_alloc_resources(sc, dev)) goto no; diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c index 8d9c4c6..ef48890 100644 --- a/sys/dev/sound/pci/t4dwave.c +++ b/sys/dev/sound/pci/t4dwave.c @@ -822,7 +822,6 @@ tr_pci_probe(device_t dev) static int tr_pci_attach(device_t dev) { - u_int32_t data; struct tr_info *tr; struct ac97_info *codec = 0; bus_addr_t lowaddr; @@ -831,6 +830,7 @@ tr_pci_attach(device_t dev) #ifdef __sparc64__ device_t *children; int nchildren; + u_int32_t data; #endif tr = malloc(sizeof(*tr), M_DEVBUF, M_WAITOK | M_ZERO); @@ -857,10 +857,7 @@ tr_pci_attach(device_t dev) } } - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); tr->regid = PCIR_BAR(0); tr->regtype = SYS_RES_IOPORT; diff --git a/sys/dev/sound/pci/via82c686.c b/sys/dev/sound/pci/via82c686.c index 4f336bf..28198a6 100644 --- a/sys/dev/sound/pci/via82c686.c +++ b/sys/dev/sound/pci/via82c686.c @@ -485,11 +485,7 @@ via_attach(device_t dev) via->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_via82c686 softc"); - /* Get resources */ - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); /* Wake up and reset AC97 if necessary */ data = pci_read_config(dev, VIA_AC97STATUS, 1); diff --git a/sys/dev/sound/pci/vibes.c b/sys/dev/sound/pci/vibes.c index d391575..733e0d8 100644 --- a/sys/dev/sound/pci/vibes.c +++ b/sys/dev/sound/pci/vibes.c @@ -728,10 +728,7 @@ sv_attach(device_t dev) { sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->dev = dev; - data = pci_read_config(dev, PCIR_COMMAND, 2); - data |= (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, data, 2); - data = pci_read_config(dev, PCIR_COMMAND, 2); + pci_enable_busmaster(dev); #if __FreeBSD_version > 500000 if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { |