Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/algor Yet more interrupt cleanup -- the platform ma...



details:   https://anonhg.NetBSD.org/src/rev/ea1d70a7b197
branches:  trunk
changeset: 511234:ea1d70a7b197
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Jun 15 04:01:39 2001 +0000

description:
Yet more interrupt cleanup -- the platform mater interrupt establish
function now just takes an "irq", which is an index into the irqmap
table for that platform.

diffstat:

 sys/arch/algor/algor/algor_p4032_intr.c |  57 ++++++++++++++++-----
 sys/arch/algor/algor/algor_p4032var.h   |  16 +-----
 sys/arch/algor/algor/algor_p5064_intr.c |  85 ++++++++++++++++++++++----------
 sys/arch/algor/algor/algor_p5064var.h   |  16 +-----
 sys/arch/algor/algor/interrupt.c        |   5 +-
 sys/arch/algor/dev/com_mainbus.c        |  14 +----
 sys/arch/algor/dev/lpt_mainbus.c        |  14 +----
 sys/arch/algor/include/intr.h           |   4 +-
 sys/arch/algor/pci/pcib.c               |  10 +-
 9 files changed, 121 insertions(+), 100 deletions(-)

diffs (truncated from 611 to 300 lines):

diff -r 80fd695a6f21 -r ea1d70a7b197 sys/arch/algor/algor/algor_p4032_intr.c
--- a/sys/arch/algor/algor/algor_p4032_intr.c   Fri Jun 15 02:07:06 2001 +0000
+++ b/sys/arch/algor/algor/algor_p4032_intr.c   Fri Jun 15 04:01:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: algor_p4032_intr.c,v 1.3 2001/06/10 09:13:06 thorpej Exp $     */
+/*     $NetBSD: algor_p4032_intr.c,v 1.4 2001/06/15 04:01:39 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -126,6 +126,15 @@
        "mcclock",
 };
 
+struct p4032_irqmap {
+       int     irqidx;         
+       int     cpuintr;
+       int     irqreg;
+       int     irqbit;
+       int     xbarreg;        
+       int     xbarshift;
+};      
+
 const struct p4032_irqmap p4032_irqmap[NIRQMAPS] = {
        /*
         * PCI INTERRUPTS
@@ -153,35 +162,35 @@
        /*
         * 8-BIT DEVICE INTERRUPTS
         */
-       { 4,                    1,
+       { P4032_IRQ_PCICTLR,    1,
          IRQREG_8BIT,          IRR0_PCICTLR,
          0,                    0 },
 
-       { 5,                    1,
+       { P4032_IRQ_FLOPPY,     1,
          IRQREG_8BIT,          IRR0_FLOPPY,
          0,                    2 },
 
-       { 6,                    1,
+       { P4032_IRQ_PCKBC,      1,
          IRQREG_8BIT,          IRR0_PCKBC,
          0,                    4 },
 
-       { 7,                    1,
+       { P4032_IRQ_COM1,       1,
          IRQREG_8BIT,          IRR0_COM1,
          0,                    6 },
 
-       { 8,                    1,
+       { P4032_IRQ_COM2,       1,
          IRQREG_8BIT,          IRR0_COM2,
          1,                    0 },
 
-       { 9,                    1,
+       { P4032_IRQ_LPT,        1,
          IRQREG_8BIT,          IRR0_LPT,
          1,                    2 },
 
-       { 10,                   1,
+       { P4032_IRQ_GPIO,       1,
          IRQREG_8BIT,          IRR0_GPIO,
          1,                    4 },
 
-       { 11,                   1,
+       { P4032_IRQ_RTC,        1,
          IRQREG_8BIT,          IRR0_RTC,
          1,                    6 },
 };
@@ -210,12 +219,15 @@
        "8-bit",
 };
 
+void   *algor_p4032_intr_establish(int, int (*)(void *), void *);
+void   algor_p4032_intr_disestablish(void *);
 
 int    algor_p4032_pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
 const char *algor_p4032_pci_intr_string(void *, pci_intr_handle_t);
 const struct evcnt *algor_p4032_pci_intr_evcnt(void *, pci_intr_handle_t);
 void   *algor_p4032_pci_intr_establish(void *, pci_intr_handle_t, int,
            int (*)(void *), void *);
+void   algor_p4032_pci_intr_disestablish(void *, void *);
 void   algor_p4032_pci_conf_interrupt(void *, int, int, int, int, int *);
 
 void   algor_p4032_iointr(u_int32_t, u_int32_t, u_int32_t, u_int32_t);
@@ -255,10 +267,12 @@
        acp->ac_pc.pc_intr_string = algor_p4032_pci_intr_string;
        acp->ac_pc.pc_intr_evcnt = algor_p4032_pci_intr_evcnt;
        acp->ac_pc.pc_intr_establish = algor_p4032_pci_intr_establish;
-       acp->ac_pc.pc_intr_disestablish = algor_p4032_intr_disestablish;
+       acp->ac_pc.pc_intr_disestablish = algor_p4032_pci_intr_disestablish;
        acp->ac_pc.pc_conf_interrupt = algor_p4032_pci_conf_interrupt;
        acp->ac_pc.pc_pciide_compat_intr_establish = NULL;
 
+       algor_intr_establish = algor_p4032_intr_establish;
+       algor_intr_disestablish = algor_p4032_intr_disestablish;
        algor_iointr = algor_p4032_iointr;
 }
 
@@ -328,12 +342,16 @@
 }
 
 void *
-algor_p4032_intr_establish(const struct p4032_irqmap *irqmap,
-    int (*func)(void *), void *arg)
+algor_p4032_intr_establish(int irq, int (*func)(void *), void *arg)
 {
+       const struct p4032_irqmap *irqmap;
        struct algor_intrhand *ih;
        int s;
 
+       irqmap = &p4032_irqmap[irq];
+
+       KASSERT(irq == irqmap->irqidx);
+
        ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT);
        if (ih == NULL)
                return (NULL);
@@ -366,12 +384,14 @@
 }
 
 void
-algor_p4032_intr_disestablish(void *v, void *cookie)
+algor_p4032_intr_disestablish(void *cookie)
 {
        const struct p4032_irqmap *irqmap;
-       struct algor_intrhand *ih = v;
+       struct algor_intrhand *ih = cookie;
        int s;
 
+       irqmap = ih->ih_irqmap;
+
        s = splhigh();
 
        /*
@@ -544,7 +564,14 @@
        if (ih >= NPCIIRQS)
                panic("algor_p4032_intr_establish: bogus IRQ %ld\n", ih);
 
-       return (algor_p4032_intr_establish(&p4032_irqmap[ih], func, arg));
+       return (algor_p4032_intr_establish(ih, func, arg));
+}
+
+void
+algor_p4032_pci_intr_disestablish(void *v, void *cookie)
+{
+
+       return (algor_p4032_intr_disestablish(cookie));
 }
 
 void
diff -r 80fd695a6f21 -r ea1d70a7b197 sys/arch/algor/algor/algor_p4032var.h
--- a/sys/arch/algor/algor/algor_p4032var.h     Fri Jun 15 02:07:06 2001 +0000
+++ b/sys/arch/algor/algor/algor_p4032var.h     Fri Jun 15 04:01:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: algor_p4032var.h,v 1.2 2001/06/10 05:26:58 thorpej Exp $       */
+/*     $NetBSD: algor_p4032var.h,v 1.3 2001/06/15 04:01:40 thorpej Exp $       */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -68,21 +68,7 @@
 #define        P4032_IRQ_GPIO          10
 #define        P4032_IRQ_RTC           11
 
-struct p4032_irqmap {
-       int             irqidx;
-       int             cpuintr;
-       int             irqreg;
-       int             irqbit;
-       int             xbarreg;
-       int             xbarshift;
-};
-
-void   algor_p4032_intr_disestablish(void *, void *);
-void   *algor_p4032_intr_establish(const struct p4032_irqmap *,
-           int (*)(void *), void *);
-
 extern struct p4032_config p4032_configuration;
-extern const struct p4032_irqmap p4032_irqmap[];
 
 void   algor_p4032loc_bus_io_init(bus_space_tag_t, void *);
 void   algor_p4032_bus_io_init(bus_space_tag_t, void *);
diff -r 80fd695a6f21 -r ea1d70a7b197 sys/arch/algor/algor/algor_p5064_intr.c
--- a/sys/arch/algor/algor/algor_p5064_intr.c   Fri Jun 15 02:07:06 2001 +0000
+++ b/sys/arch/algor/algor/algor_p5064_intr.c   Fri Jun 15 04:01:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: algor_p5064_intr.c,v 1.3 2001/06/10 09:13:07 thorpej Exp $     */
+/*     $NetBSD: algor_p5064_intr.c,v 1.4 2001/06/15 04:01:40 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -146,6 +146,15 @@
        "IDE secondary",
 };
 
+struct p5064_irqmap { 
+       int     irqidx;
+       int     cpuintr;
+       int     irqreg;
+       int     irqbit;
+       int     xbarreg;
+       int     xbarshift;
+}; 
+
 const struct p5064_irqmap p5064_irqmap[NIRQMAPS] = {
        /*
         * PCI INTERRUPTS
@@ -171,17 +180,17 @@
          2,                    6 },
 
        /* Ethernet */
-       { 4,                    1,
+       { P5064_IRQ_ETHERNET,           1,
          IRQREG_PCIINT,        PCIINT_ETH,
          4,                    2 },
 
        /* SCSI */
-       { 5,                    1,
+       { P5064_IRQ_SCSI,       1,
          IRQREG_PCIINT,        PCIINT_SCSI,
          4,                    4 },
 
        /* USB */
-       { 6,                    1,
+       { P5064_IRQ_USB,        1,
          IRQREG_PCIINT,        PCIINT_USB,
          4,                    6 },
 
@@ -189,32 +198,32 @@
         * LOCAL INTERRUPTS
         */
        /* keyboard */
-       { 7,                    2,
+       { P5064_IRQ_MKBD,       2,
          IRQREG_LOCINT,        LOCINT_MKBD,
          0,                    4 },
 
        /* COM1 */
-       { 8,                    2,
+       { P5064_IRQ_COM1,       2,
          IRQREG_LOCINT,        LOCINT_COM1,
          0,                    6 },
 
        /* COM2 */
-       { 9,                    2,
+       { P5064_IRQ_COM2,       2,
          IRQREG_LOCINT,        LOCINT_COM2,
          1,                    0 },
 
        /* floppy controller */
-       { 10,                   2,
+       { P5064_IRQ_FLOPPY,     2,
          IRQREG_LOCINT,        LOCINT_FLP,
          0,                    2 },
 
        /* parallel port */
-       { 11,                   2,
+       { P5064_IRQ_CENTRONICS, 2,
          IRQREG_LOCINT,        LOCINT_CENT,
          1,                    2 },
 
        /* RTC */
-       { 12,                   2,
+       { P5064_IRQ_RTC,        2,
          IRQREG_LOCINT,        LOCINT_RTC,
          1,                    6 },
 
@@ -222,17 +231,17 @@
         * ISA INTERRUPTS
         */
        /* ISA bridge */
-       { 13,                   0,
+       { P5064_IRQ_ISABRIDGE,  0,
          IRQREG_ISAINT,        ISAINT_ISABR,
          0,                    4 },
 
        /* IDE 0 */
-       { 14,                   0,
+       { P5064_IRQ_IDE0,       0,
          IRQREG_ISAINT,        ISAINT_IDE0,
          3,                    2 },
 
        /* IDE 1 */
-       { 15,                   0,
+       { P5064_IRQ_IDE1,       0,
          IRQREG_ISAINT,        ISAINT_IDE1,
          3,                    4 },
 };
@@ -282,11 +291,15 @@
        "local",
 };
 
+void   *algor_p5064_intr_establish(int, int (*)(void *), void *);
+void   algor_p5064_intr_disestablish(void *);
+
 int    algor_p5064_pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
 const char *algor_p5064_pci_intr_string(void *, pci_intr_handle_t);
 const struct evcnt *algor_p5064_pci_intr_evcnt(void *, pci_intr_handle_t);
 void   *algor_p5064_pci_intr_establish(void *, pci_intr_handle_t, int,
            int (*)(void *), void *);



Home | Main Index | Thread Index | Old Index