PERFORCE change 124159 for review
Christopher Davis
loafier at FreeBSD.org
Fri Jul 27 05:59:38 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=124159
Change 124159 by loafier at chrisdsoc on 2007/07/27 05:59:22
Use pci_enable_io() to help determine whether to allocate memory or IO.
Affected files ...
.. //depot/projects/soc2007/loafier_busalloc/src/sys/dev/sound/pci/aureal.c#6 edit
Differences ...
==== //depot/projects/soc2007/loafier_busalloc/src/sys/dev/sound/pci/aureal.c#6 (text+ko) ====
@@ -562,6 +562,7 @@
struct au_info *sc;
struct ac97_info *codec;
char status[SND_STATUSLEN];
+ int mapped = 0;
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
if (sc == NULL) {
@@ -571,17 +572,21 @@
sc->unit = device_get_unit(dev);
pci_enable_busmaster(dev);
- pci_enable_io(dev, SYS_RES_IOPORT);
- pci_enable_io(dev, SYS_RES_MEMORY);
- sc->spec = au_res_spec_mem;
- if (bus_alloc_resources(dev, sc->spec, sc->res) != 0) {
+ if (mapped == 0 && pci_enable_io(dev, SYS_RES_MEMORY) == 0) {
+ sc->spec = au_res_spec_mem;
+ if (bus_alloc_resources(dev, sc->spec, sc->res) == 0)
+ mapped++;
+ }
+ if (mapped == 0 && pci_enable_io(dev, SYS_RES_IOPORT) == 0) {
sc->spec = au_res_spec_io;
- if (bus_alloc_resources(dev, sc->spec, sc->res) != 0) {
- device_printf(dev, "unable to allocate resources\n");
- goto bad;
- }
- }
+ if (bus_alloc_resources(dev, sc->spec, sc->res) == 0)
+ mapped++;
+ }
+ if (mapped == 0) {
+ device_printf(dev, "unable to map register space\n");
+ goto bad;
+ }
au_wr4(sc, AU_REG_IRQEN, 0);
if (snd_setup_intr(dev, sc->res[RES_IRQ], 0, au_intr, sc, &sc->ih)) {
More information about the p4-projects
mailing list