Date: Fri, 27 Jul 2007 05:59:37 GMT From: Christopher Davis <loafier@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 124159 for review Message-ID: <200707270559.l6R5xbt3034206@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124159 Change 124159 by loafier@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)) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707270559.l6R5xbt3034206>