summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortanimura <tanimura@FreeBSD.org>2002-02-05 06:52:56 +0000
committertanimura <tanimura@FreeBSD.org>2002-02-05 06:52:56 +0000
commitdf91bf49f0979d8418358821772a374bbab0f6e1 (patch)
tree343b56e7ae750ee975a4a48bf7eacf62cb3d675e /sys
parent3f7a9ec8215356c8575697de1eb36c52530c5ecb (diff)
downloadFreeBSD-src-df91bf49f0979d8418358821772a374bbab0f6e1.zip
FreeBSD-src-df91bf49f0979d8418358821772a374bbab0f6e1.tar.gz
- Do not hang if the resource allocation fails.
- Add another quirk entry of SB AWE64. PR: kern/32530 Submitted by: Magnus Backstrom <b@etek.chalmers.se>
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sound/isa/emu8000.c47
-rw-r--r--sys/isa/pnp.c2
2 files changed, 30 insertions, 19 deletions
diff --git a/sys/dev/sound/isa/emu8000.c b/sys/dev/sound/isa/emu8000.c
index d17ca3c..73ac39f 100644
--- a/sys/dev/sound/isa/emu8000.c
+++ b/sys/dev/sound/isa/emu8000.c
@@ -1910,30 +1910,39 @@ emu_status(sc_p scp, int reg, int chn)
static int
emu_allocres(sc_p scp, device_t dev)
{
- int iobase;
+ int i;
- if (scp->io[0] == NULL) {
- scp->io_rid[0] = 0;
- scp->io[0] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[0], 0, ~0, 4, RF_ACTIVE);
- }
- if (scp->io[0] == NULL)
- return (1);
- iobase = rman_get_start(scp->io[0]);
- if (scp->io[1] == NULL) {
- scp->io_rid[1] = 1;
- scp->io[1] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[1], iobase + 0x400, iobase + 0x400 + 3, 4, RF_ACTIVE);
- }
- if (scp->io[2] == NULL) {
- scp->io_rid[2] = 2;
- scp->io[2] = bus_alloc_resource(dev, SYS_RES_IOPORT, &scp->io_rid[2], iobase + 0x800, iobase + 0x800 + 3, 4, RF_ACTIVE);
+ /*
+ * Attempt to allocate the EMU8000's three I/O port ranges.
+ */
+ for (i = 0; i < 3; i++)
+ {
+ if (scp->io[i] == NULL)
+ {
+ scp->io_rid[i] = i;
+ scp->io[i] = bus_alloc_resource(dev, SYS_RES_IOPORT,
+ &(scp->io_rid[i]),
+ 0, ~0, 4, RF_ACTIVE);
+ }
}
- if (scp->io[0] == NULL || scp->io[1] == NULL || scp->io[2] == NULL) {
- printf("emu_allocres: failed.\n");
- return (1);
+ /*
+ * Fail if any of the I/O ranges failed (I.e. weren't identified and
+ * configured by PNP, which can happen if the ID of the card isn't
+ * known by the PNP quirk-handling logic)
+ */
+ if (scp->io[0] == NULL || scp->io[1] == NULL || scp->io[2] == NULL)
+ {
+ printf("emu%d: Resource alloc failed, pnp_quirks "
+ "may need { 0x%08x, 0x%08x }\n",
+ device_get_unit(dev),
+ isa_get_vendorid(dev),
+ isa_get_logicalid(dev));
+
+ return 1;
}
- return (0);
+ return 0;
}
/* Releases resources. */
diff --git a/sys/isa/pnp.c b/sys/isa/pnp.c
index bf7ca97..6eff917 100644
--- a/sys/isa/pnp.c
+++ b/sys/isa/pnp.c
@@ -83,6 +83,8 @@ struct pnp_quirk pnp_quirks[] = {
PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
{ 0xc1008c0e /* SB64(CTL00c1) */, 0x22008c0e,
PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
+ { 0xc5008c0e /* SB64(CTL00c5) */, 0x22008c0e,
+ PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
{ 0xe4008c0e /* SB64(CTL00e4) */, 0x22008c0e,
PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
OpenPOWER on IntegriCloud