diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index 01c33cc8fbf8..6a9039e01cda 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -434,14 +434,13 @@ crdioctl_sresource(dev_t dev, caddr_t data) { struct pccard_resource *pr; struct resource *r; - int i; - int rid = 1; - int err; + int flags; + int rid = 0; device_t bridgedev; pr = (struct pccard_resource *)data; pr->resource_addr = ~0ul; - bridgedev = device_get_parent(PCCARD_DEV2SOFTC(dev)->dev); + bridgedev = PCCARD_DEV2SOFTC(dev)->dev; switch(pr->type) { default: return (EINVAL); @@ -450,17 +449,12 @@ crdioctl_sresource(dev_t dev, caddr_t data) case SYS_RES_IOPORT: break; } - for (i = pr->min; i + pr->size - 1 <= pr->max; i++) { - err = bus_set_resource(bridgedev, pr->type, rid, i, pr->size); - if (err != 0) - continue; - r = bus_alloc_resource(bridgedev, pr->type, &rid, 0ul, ~0ul, - pr->size, 0); - if (r == NULL) - continue; + flags = rman_make_alignment_flags(pr->size); + r = bus_alloc_resource(bridgedev, pr->type, &rid, pr->min, pr->max, + pr->size, flags); + if (r != NULL) { pr->resource_addr = (u_long)rman_get_start(r); bus_release_resource(bridgedev, pr->type, rid, r); - return (0); } return (0); } diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c index 28ac7f958deb..89c14cd1cd22 100644 --- a/sys/pccard/pcic.c +++ b/sys/pccard/pcic.c @@ -817,8 +817,12 @@ pcic_alloc_resource(device_t dev, device_t child, int type, int *rid, /* * If we're routing via pci, we can share. */ - if (sc->func_route == pci_parallel && type == SYS_RES_IRQ) + if (sc->func_route == pci_parallel && type == SYS_RES_IRQ) { + if (bootverbose) + device_printf(child, "Forcing IRQ to %d\n", sc->irq); + start = end = sc->irq; flags |= RF_SHAREABLE; + } return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags)); diff --git a/sys/pccard/pcic_pci.c b/sys/pccard/pcic_pci.c index df7b1aec83d8..132c838e42f1 100644 --- a/sys/pccard/pcic_pci.c +++ b/sys/pccard/pcic_pci.c @@ -430,7 +430,7 @@ pcic_pci_attach(device_t dev) sp->sc = sc; sockbase = pci_read_config(dev, 0x10, 4); if (sockbase & 0x1) { - device_printf(dev, "I/O mapped device!\n"); + device_printf(dev, "I/O mapped device, might not work.\n"); sc->iorid = CB_PCI_SOCKET_BASE; sc->iores = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->iorid, 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE); @@ -446,6 +446,7 @@ pcic_pci_attach(device_t dev) sc->flags = PCIC_PD_POWER; num6729++; } else { + device_printf(dev, "Memory mapped device, will work.\n"); sc->memrid = CB_PCI_SOCKET_BASE; sc->memres = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->memrid, 0, ~0, 1, RF_ACTIVE); @@ -523,6 +524,7 @@ pcic_pci_attach(device_t dev) } sc->irqrid = rid; sc->irqres = r; + sc->irq = rman_get_start(r); error = bus_setup_intr(dev, r, INTR_TYPE_MISC, pcic_pci_intr, (void *) sc, &sc->ih); if (error) {