summaryrefslogtreecommitdiffstats
path: root/sys/pccard/pcic.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2001-07-31 06:44:37 +0000
committerimp <imp@FreeBSD.org>2001-07-31 06:44:37 +0000
commit7ffebadcef03ef7d4c21bb2bacc7138cf1cce87a (patch)
treebf5b7745d1930fe2e8d980854cd090f6d9336f91 /sys/pccard/pcic.c
parentac051210c345e786944512f477e364d55b394ea1 (diff)
downloadFreeBSD-src-7ffebadcef03ef7d4c21bb2bacc7138cf1cce87a.zip
FreeBSD-src-7ffebadcef03ef7d4c21bb2bacc7138cf1cce87a.tar.gz
A bunch of interrupt related cleanup.
o Move PIOCSRESOURCE from pccard to pcic so the kernel can give pccardd better hints as to what resources to use. o Implement an undocumented hw.pcic.interrupt_route to allow people that need to do so to route their interrupts in a non-standard way. o Only preallocate a resource in probe if we're routing via pci. o If we aren't routing via pci, then set the irq to use explicitly to defeat the automatic IRQ routing of the pci layer. This, with the pccardd code should be close to what can be committed to -stable.
Diffstat (limited to 'sys/pccard/pcic.c')
-rw-r--r--sys/pccard/pcic.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c
index 14b444a..2b2b4da 100644
--- a/sys/pccard/pcic.c
+++ b/sys/pccard/pcic.c
@@ -368,6 +368,41 @@ pcic_attach(device_t dev)
return (bus_generic_attach(dev));
}
+
+static int
+pcic_sresource(struct slot *slt, caddr_t data)
+{
+ struct pccard_resource *pr;
+ struct resource *r;
+ int flags;
+ int rid = 0;
+ device_t bridgedev = slt->dev;
+ struct pcic_slot *sp = slt->cdata;
+
+ 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);
+ }
+ switch(pr->type) {
+ default:
+ return (EINVAL);
+ case SYS_RES_MEMORY:
+ case SYS_RES_IRQ:
+ case SYS_RES_IOPORT:
+ break;
+ }
+ 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);
+}
+
/*
* ioctl calls - Controller specific ioctls
*/
@@ -379,17 +414,17 @@ pcic_ioctl(struct slot *slt, int cmd, caddr_t data)
switch(cmd) {
default:
return (ENOTTY);
- /*
- * Get/set PCIC registers
- */
- case PIOCGREG:
+ case PIOCGREG: /* Get pcic register */
((struct pcic_reg *)data)->value =
sp->getb(sp, ((struct pcic_reg *)data)->reg);
- break;
+ break; /* Set pcic register */
case PIOCSREG:
sp->putb(sp, ((struct pcic_reg *)data)->reg,
((struct pcic_reg *)data)->value);
break;
+ case PIOCSRESOURCE: /* Can I use this resource? */
+ pcic_sresource(slt, data);
+ break;
}
return (0);
}
OpenPOWER on IntegriCloud