From 482a667634c18507857e751277e6f58f1c91052a Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 14 Aug 2001 19:23:12 +0000 Subject: [PATCH] Treat min,max of 0,0 for IRQ special. Reject it if we didn't specifically assing an IRQ. Add better comments while I'm here. MFC after: 1 day # Note: That's merging all the -current pci pcic code, not just this one # change for the Aug 15th code freeze. --- sys/pccard/pcic.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c index 1cd257ee8359..96f667c4a94c 100644 --- a/sys/pccard/pcic.c +++ b/sys/pccard/pcic.c @@ -402,10 +402,27 @@ pcic_sresource(struct slot *slt, caddr_t data) pr = (struct pccard_resource *)data; pr->resource_addr = ~0ul; - if (pr->type == SYS_RES_IRQ && sp->sc->func_route == pci_parallel) { - pr->resource_addr = sp->sc->irq; - return (0); + + /* + * If we're using PCI interrupt routing, then force the IRQ to + * use and to heck with what the user requested. If they want + * to be able to request IRQs, they must use ISA interrupt + * routing. If we don't give them an irq, and it is the + * pccardd 0,0 case, then just return (giving the "bad resource" + * return in pr->resource_addr). + */ + if (pr->type == SYS_RES_IRQ) { + if (sp->sc->func_route >= pci_parallel) { + pr->resource_addr = sp->sc->irq; + return (0); + } + if (pr->min == 0 && pr->max == 0) + return (0); } + + /* + * Make sure we grok this type. + */ switch(pr->type) { default: return (EINVAL); @@ -414,6 +431,12 @@ pcic_sresource(struct slot *slt, caddr_t data) case SYS_RES_IOPORT: break; } + + /* + * Allocate the resource, and align it to the most natural + * size. If we get it, then tell userland what we actually got + * in the range they requested. + */ flags = rman_make_alignment_flags(pr->size); r = bus_alloc_resource(bridgedev, pr->type, &rid, pr->min, pr->max, pr->size, flags);