diff options
author | imp <imp@FreeBSD.org> | 2000-08-17 05:52:18 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2000-08-17 05:52:18 +0000 |
commit | 251df65ed0ab54dd99220af7e485a491e73a5cdb (patch) | |
tree | 9c6bebdf658bfd02607758362ad79dea47334a7f /sys/dev/pcic | |
parent | 9f676df9eaedcddad53a3ff06a81a2aa8e393f9f (diff) | |
download | FreeBSD-src-251df65ed0ab54dd99220af7e485a491e73a5cdb.zip FreeBSD-src-251df65ed0ab54dd99220af7e485a491e73a5cdb.tar.gz |
Add support for loading this as a module (before there were some
problems). Also pick an irq if one isn't specified. Ditto for
memory.
Add additional printfs in the error paths. These will disappear in time.
There are still some panics, but this is a good checkpoint.
Diffstat (limited to 'sys/dev/pcic')
-rw-r--r-- | sys/dev/pcic/i82365.c | 8 | ||||
-rw-r--r-- | sys/dev/pcic/i82365_isa.c | 19 |
2 files changed, 16 insertions, 11 deletions
diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c index 39438a0..3b11018 100644 --- a/sys/dev/pcic/i82365.c +++ b/sys/dev/pcic/i82365.c @@ -216,12 +216,14 @@ pcic_activate(device_t dev) 0, ~0, 1, RF_ACTIVE); if (sc->irq_res) { sc->irq = rman_get_start(sc->irq_res); - if ((err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, + if ((err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC, pcic_intr, sc, &sc->intrhand)) != 0) { + device_printf(dev, "Cannot setup intr\n"); pcic_deactivate(dev); return err; } } else { + printf("Polling not supported\n"); /* XXX Do polling */ return (ENXIO); } @@ -279,8 +281,10 @@ pcic_attach(device_t dev) sc->dev = dev; /* Activate our resources */ - if ((error = pcic_activate(dev)) != 0) + if ((error = pcic_activate(dev)) != 0) { + printf("pcic_attach (active) returns %d\n", error); return error; + } /* now check for each controller/socket */ diff --git a/sys/dev/pcic/i82365_isa.c b/sys/dev/pcic/i82365_isa.c index e7ddfb3..3dc67dd 100644 --- a/sys/dev/pcic/i82365_isa.c +++ b/sys/dev/pcic/i82365_isa.c @@ -99,8 +99,10 @@ int pcic_isa_intr_alloc_mask = PCIC_ISA_INTR_ALLOC_MASK; * End of configurable parameters. *****************************************************************************/ +#define PCICISADEBUG 1 + #ifdef PCICISADEBUG -int pcicisa_debug = 0 /* XXX */ ; +int pcicisa_debug = PCICISADEBUG; #define DPRINTF(arg) if (pcicisa_debug) printf arg; #define DEVPRINTF(arg) if (pcicisa_debug) device_printf arg; #else @@ -316,7 +318,6 @@ pcic_isa_probe(device_t dev) /* If we have the resources we need then we're good to go. */ if (bus_get_resource_start(dev, SYS_RES_IOPORT, 0) == 0) return (ENXIO); - rid = 0; res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_ACTIVE); if (res == NULL) { @@ -324,21 +325,22 @@ pcic_isa_probe(device_t dev) * No IRQ specified, find one. This can be due to the PnP * data not specifying any IRQ */ - for (i = 0; res == NULL && i < 16; i++) { + for (i = 0; i < 16; i++) { if (((1 << i) & PCIC_INTR_IRQ_VALIDMASK) == 0) continue; res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, i, i, 1, RF_ACTIVE); + if (res != NULL) + break; } if (res == NULL) return (ENXIO); mem = rman_get_start(res); bus_release_resource(dev, SYS_RES_IRQ, rid, res); - bus_set_resource(dev, SYS_RES_IRQ, 0, mem, 1); + bus_set_resource(dev, SYS_RES_IRQ, 0, i, 1); } else { bus_release_resource(dev, SYS_RES_IRQ, rid, res); } - /* XXX This might not be needed in future, get it directly from * XXX parent */ rid = 0; @@ -355,16 +357,16 @@ pcic_isa_probe(device_t dev) 0xa0000, 0xdffff, 1 << 13, RF_ACTIVE); if (res != NULL) { mem = rman_get_start(res); - bus_release_resource(dev, SYS_RES_MEMORY, res, rid); + bus_release_resource(dev, SYS_RES_MEMORY, rid, res); bus_set_resource(dev, SYS_RES_MEMORY, 0, mem, 1 << 13); } + } else { + bus_release_resource(dev, SYS_RES_MEMORY, rid, res); } if (res == NULL) { device_printf(dev, "Cannot allocate mem\n"); return ENOMEM; } - bus_release_resource(dev, SYS_RES_MEMORY, rid, res); - return (0); } @@ -375,7 +377,6 @@ pcic_isa_attach(device_t dev) if ((err = pcic_attach(dev)) == 0) pcic_isa_bus_width_probe (dev); - return err; } |