Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/isa Make shared IRQs for the normal PIC case w...



details:   https://anonhg.NetBSD.org/src/rev/1a8c23d7428d
branches:  trunk
changeset: 537618:1a8c23d7428d
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Thu Oct 03 15:58:56 2002 +0000

description:
Make shared IRQs for the normal PIC case work again as they did before
the MP merge (i.e. treat them as having the lowest level of all registered
handlers in the chain for the IRQ).

diffstat:

 sys/arch/i386/isa/isa_machdep.c |  34 +++++++++++++++++++++-------------
 sys/arch/i386/isa/vector.s      |   6 +++---
 2 files changed, 24 insertions(+), 16 deletions(-)

diffs (114 lines):

diff -r c29f0941cf76 -r 1a8c23d7428d sys/arch/i386/isa/isa_machdep.c
--- a/sys/arch/i386/isa/isa_machdep.c   Thu Oct 03 15:41:44 2002 +0000
+++ b/sys/arch/i386/isa/isa_machdep.c   Thu Oct 03 15:58:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: isa_machdep.c,v 1.55 2002/10/01 12:57:11 fvdl Exp $    */
+/*     $NetBSD: isa_machdep.c,v 1.56 2002/10/03 15:58:56 fvdl Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.55 2002/10/01 12:57:11 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.56 2002/10/03 15:58:56 fvdl Exp $");
 
 #define ISA_DMA_STATS
 
@@ -317,7 +317,7 @@
 }
 
 int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
-int ilevel[ICU_LEN];
+int iminlevel[ICU_LEN], imaxlevel[ICU_LEN];
 struct intrhand *intrhand[ICU_LEN];
 
 /*
@@ -373,6 +373,9 @@
        /*
         * Enforce a hierarchy that gives slow devices a better chance at not
         * dropping data.
+        *
+        * (as a side effect, this also takes care of shared IRQs with
+        *  different IPL for iunmask below)
         */
        for (level = 0; level<(NIPL-1); level++)
                imasks[level+1] |= imasks[level];
@@ -414,26 +417,30 @@
        /* And eventually calculate the complete masks. */
        for (irq = 0; irq < ICU_LEN; irq++) {
                int irqs = 1 << irq;
-               int level = 0;
+               int minlevel = IPL_SERIAL;
+               int maxlevel = 0;
 
                if (intrhand[irq] == NULL) {
-                       level = IPL_HIGH;
-                       irqs = IMASK(IPL_HIGH);
+                       maxlevel = minlevel = IPL_SERIAL;
+                       irqs = IMASK(IPL_SERIAL);
                } else {
                        for (q = intrhand[irq]; q; q = q->ih_next) {
                                irqs |= IMASK(q->ih_level);
-                               if (q->ih_level > level)
-                                       level = q->ih_level;
+                               if (q->ih_level > maxlevel)
+                                       maxlevel = q->ih_level;
+                               if (q->ih_level < minlevel)
+                                       minlevel = q->ih_level;
                        }
                }
-               if (irqs != IMASK(level))
+               if (irqs != IMASK(maxlevel))
                        panic("irq %d level %x mask mismatch: %x vs %x", irq, level, irqs, IMASK(level));
                
-               ilevel[irq] = level;
+               imaxlevel[irq] = maxlevel;
+               iminlevel[irq] = minlevel;
                intrmask[irq] = irqs | (1 << IPL_TAGINTR);
 #if 0
                printf("irq %d: level %x, mask 0x%x (%x)\n",
-                   irq, ilevel[irq], intrmask[irq], IMASK(ilevel[irq]));
+                   irq, imaxlevel[irq], intrmask[irq], IMASK(imaxlevel[irq]));
 #endif
 
        }
@@ -448,8 +455,9 @@
                        irqs |= 1 << IRQ_SLAVE;
                imen = ~irqs;
        }
-       for (irq = 0; irq < ICU_LEN; irq++)
-               iunmask[irq] = ~imasks[irq];
+       for (level = 0; level < NIPL; level++)
+               iunmask[level] = ~imasks[level];
+
 }
 
 static int
diff -r c29f0941cf76 -r 1a8c23d7428d sys/arch/i386/isa/vector.s
--- a/sys/arch/i386/isa/vector.s        Thu Oct 03 15:41:44 2002 +0000
+++ b/sys/arch/i386/isa/vector.s        Thu Oct 03 15:58:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vector.s,v 1.51 2002/10/01 12:57:14 fvdl Exp $ */
+/*     $NetBSD: vector.s,v 1.52 2002/10/03 15:58:56 fvdl Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -240,14 +240,14 @@
        MASK(irq_num, icu)              /* mask it in hardware */       ;\
        ack(irq_num)                    /* and allow other intrs */     ;\
        incl    MY_COUNT+V_INTR         /* statistical info */          ;\
-       movl    _C_LABEL(ilevel) + (irq_num) * 4, %eax                  ;\
+       movl    _C_LABEL(iminlevel) + (irq_num) * 4, %eax               ;\
        movzbl  CPL,%ebx                /* XXX tuneme */                ;\
        cmpl    %eax,%ebx               /* XXX tuneme */                ;\
        jae     XHOLD(irq_num)          /* currently masked; hold it */ ;\
 XRESUME_VEC(irq_num)                                           \
        movzbl  CPL,%eax                /* cpl to restore on exit */    ;\
        pushl   %eax                    /* XXX tuneme   */              ;\
-       movl    _C_LABEL(ilevel) + (irq_num) * 4, %eax  /* XXXtuneme */ ;\
+       movl    _C_LABEL(imaxlevel) + (irq_num) * 4, %eax/* XXXtuneme */ ;\
        movl    %eax,CPL                /* XXX tuneme            */     ;\
        sti                             /* safe to take intrs now */    ;\
        movl    _C_LABEL(intrhand) + (irq_num) * 4,%ebx /* head of chain */ ;\



Home | Main Index | Thread Index | Old Index