diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-12-27 00:27:20 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-12-27 00:27:20 +0000 |
commit | ed3a4b59eb9f47de8399688a7c7d401bf4d4c734 (patch) | |
tree | bb8e93b7b038010a811c6a00b505f8ed780622a6 /sys/dev | |
parent | 90f8942c32b00998c60aeff1926768212f6ba328 (diff) |
new priority mechanism for pcmcia interrupt allocation, ie. "best effort"
for machines low on interrupts. work by fgsch, and myself
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/isa/i82365_isa.c | 27 | ||||
-rw-r--r-- | sys/dev/isa/i82365_isasubr.c | 26 | ||||
-rw-r--r-- | sys/dev/isa/i82365_isavar.h | 5 |
3 files changed, 38 insertions, 20 deletions
diff --git a/sys/dev/isa/i82365_isa.c b/sys/dev/isa/i82365_isa.c index dc62cab308c..1bd07bead49 100644 --- a/sys/dev/isa/i82365_isa.c +++ b/sys/dev/isa/i82365_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365_isa.c,v 1.1 1998/09/11 08:02:50 fgsch Exp $ */ +/* $OpenBSD: i82365_isa.c,v 1.2 1998/12/27 00:27:18 deraadt Exp $ */ /* $NetBSD: i82365_isa.c,v 1.11 1998/06/09 07:25:00 thorpej Exp $ */ /* @@ -174,6 +174,7 @@ pcic_isa_attach(parent, self, aux) bus_space_tag_t memt = ia->ia_memt; bus_space_handle_t ioh; bus_space_handle_t memh; + int i; /* Map i/o space. */ if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) { @@ -205,15 +206,23 @@ pcic_isa_attach(parent, self, aux) */ if ((sc->irq = ia->ia_irq) == IRQUNK) { - if (isa_intr_alloc(ic, - PCIC_CSC_INTR_IRQ_VALIDMASK & pcic_isa_intr_alloc_mask, - IST_EDGE, &sc->irq)) { - printf("\n%s: can't allocate interrupt\n", - sc->dev.dv_xname); - return; - } - printf(": using irq %d", sc->irq); + int ist = IST_EDGE; + + for (i = 0; i < npcic_isa_intr_list; i++) + if (isa_intr_check(ic, pcic_isa_intr_list[i], ist) == 2) + goto found; + for (i = 0; i < npcic_isa_intr_list; i++) + if (isa_intr_check(ic, pcic_isa_intr_list[i], ist)) + goto found; + printf("\n%s: can't allocate interrupt\n", sc->dev.dv_xname); + return; } + +found: + sc->irq = pcic_isa_intr_list[i]; + + printf(": using irq %d", sc->irq); + printf("\n"); pcic_attach(sc); diff --git a/sys/dev/isa/i82365_isasubr.c b/sys/dev/isa/i82365_isasubr.c index 7eb1608ec08..a4c853500ca 100644 --- a/sys/dev/isa/i82365_isasubr.c +++ b/sys/dev/isa/i82365_isasubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365_isasubr.c,v 1.2 1998/12/19 15:58:24 fgsch Exp $ */ +/* $OpenBSD: i82365_isasubr.c,v 1.3 1998/12/27 00:27:18 deraadt Exp $ */ /* $NetBSD: i82365_isasubr.c,v 1.1 1998/06/07 18:28:31 sommerfe Exp $ */ /* @@ -85,11 +85,12 @@ int pcic_isa_alloc_iosize = PCIC_ISA_ALLOC_IOSIZE; * lines. */ -#ifndef PCIC_ISA_INTR_ALLOC_MASK -#define PCIC_ISA_INTR_ALLOC_MASK 0xff5f -#endif +char pcic_isa_intr_list[] = { + 3, 4, 12, 14, 9, 5, 10, 11, 15, 13, 7 +}; -int pcic_isa_intr_alloc_mask = PCIC_ISA_INTR_ALLOC_MASK; +int npcic_isa_intr_list = + sizeof(pcic_isa_intr_list) / sizeof(pcic_isa_intr_list[0]); /***************************************************************************** * End of configurable parameters. @@ -212,7 +213,7 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg) isa_chipset_tag_t ic = h->sc->intr_est; int irq, ist; void *ih; - int reg; + int i, reg; if (pf->cfe->flags & PCMCIA_CFE_IRQLEVEL) ist = IST_LEVEL; @@ -221,9 +222,16 @@ pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg) else ist = IST_LEVEL; - if (isa_intr_alloc(ic, - PCIC_INTR_IRQ_VALIDMASK & pcic_isa_intr_alloc_mask, ist, &irq)) - return (NULL); + for (i = 0; i < npcic_isa_intr_list; i++) + if (isa_intr_check(ic, pcic_isa_intr_list[i], ist) == 2) + goto found; + for (i = 0; i < npcic_isa_intr_list; i++) + if (isa_intr_check(ic, pcic_isa_intr_list[i], ist)) + goto found; + return (NULL); + +found: + irq = pcic_isa_intr_list[i]; if ((ih = isa_intr_establish(ic, irq, ist, ipl, fct, arg, h->pcmcia->dv_xname)) == NULL) return (NULL); diff --git a/sys/dev/isa/i82365_isavar.h b/sys/dev/isa/i82365_isavar.h index 446261a39da..aadca7a8d51 100644 --- a/sys/dev/isa/i82365_isavar.h +++ b/sys/dev/isa/i82365_isavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365_isavar.h,v 1.1 1998/09/11 08:02:51 fgsch Exp $ */ +/* $OpenBSD: i82365_isavar.h,v 1.2 1998/12/27 00:27:19 deraadt Exp $ */ /* $NetBSD: i82365_isavar.h,v 1.1 1998/06/07 18:28:31 sommerfe Exp $ */ /* @@ -31,7 +31,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -extern int pcic_isa_intr_alloc_mask; +extern char pcic_isa_intr_list[]; +extern int npcic_isa_intr_list; /* * Establish/disestablish interrupts for PCMCIA functions. |