NetBSD-Bugs archive

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

Re: port-atari/39965: "lock error" panic on install with AtariTT030



> The atari cpu_intr_p() tests the "idepth" variable managed by
> intr_dispatch() in atari/atari/intr.c. However, several of the
> interrupts, including the 5380 one, are hardwired and don't go
> anywhere near intr_dispatch().

Yes, it's the same problem I saw on sun3x on January.

atari has too many interrupt handlers, so it may be worth
to pull merged handlers (for both vectored and autovectored)
like other m68k ports.

XXX arch/atari/atari/intr.h should be merged into <machine/intr.h> too.

---
Index: atari/intr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/intr.c,v
retrieving revision 1.15
diff -u -r1.15 intr.c
--- atari/intr.c        28 Jun 2008 05:26:33 -0000      1.15
+++ atari/intr.c        3 Dec 2008 09:31:08 -0000
@@ -55,7 +55,7 @@
 typedef LIST_HEAD(, intrhand) ih_list_t;
 ih_list_t autovec_list[AVEC_MAX - AVEC_MIN + 1];
 ih_list_t uservec_list[UVEC_MAX - UVEC_MIN + 1];
-static int idepth;
+int idepth;
 volatile int ssir;
 
 void
@@ -287,7 +287,6 @@
        ih_list_t       *vec_list;
        struct intrhand *ih;
 
-       idepth++;
        uvmexp.intrs++;
        vector = (frame.cf_vo & 0xfff) >> 2;
        if (vector < (AVEC_LOC+AVEC_MAX) && vector >= AVEC_LOC)
@@ -300,7 +299,6 @@
                printf("intr_dispatch: vector %d unexpected\n", vector);
                if (++unexpected > 10)
                  panic("intr_dispatch: too many unexpected interrupts");
-               idepth--;
                return;
        }
        ih->ih_intrcnt[0]++;
@@ -316,7 +314,6 @@
            panic("intr_dispatch: too many stray interrupts");
        else
            printf("intr_dispatch: stray level %d interrupt\n", vector);
-       idepth--;
 }
 
 bool
Index: atari/locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/locore.s,v
retrieving revision 1.101
diff -u -r1.101 locore.s
--- atari/locore.s      3 Dec 2007 15:33:21 -0000       1.101
+++ atari/locore.s      3 Dec 2008 09:31:09 -0000
@@ -379,9 +379,11 @@
  */
 
 ENTRY_NOPROFILE(intr_glue)
+       addql   #1,_C_LABEL(idepth)
        moveml  %d0-%d1/%a0-%a1,%sp@-   |  Save scratch registers
        jbsr    _C_LABEL(intr_dispatch) |  handle interrupt
        moveml  %sp@+,%d0-%d1/%a0-%a1
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)
 
 ENTRY_NOPROFILE(lev2intr)
@@ -393,9 +395,11 @@
        jne     1f                      |  Yes, go service a VBL-request
        rte                             |  Nothing to do.
 1:
+       addql   #1,_C_LABEL(idepth)
        moveml  %d0-%d1/%a0-%a1,%sp@-
        jbsr    _C_LABEL(falcon_display_switch)
        moveml  %sp@+,%d0-%d1/%a0-%a1
+       subql   #1,_C_LABEL(idepth)
 #endif /* FALCON_VIDEO */
        rte
 
@@ -409,6 +413,7 @@
 #define        PLX_PCICR       0x4204
 #define        PLX_CNTRL       0x42ec
 #define        PLX_DMCFGA      0x42ac
+       addql   #1,_C_LABEL(idepth)
        moveml  %d0-%d2/%a0-%a1,%sp@-
        movw    %sp@(20),%sp@-          |  push previous SR value
        clrw    %sp@-                   |       padded to longword
@@ -431,6 +436,7 @@
        jbsr    _C_LABEL(milan_isa_intr)
        addql   #8,%sp
        moveml  %sp@+,%d0-%d2/%a0-%a1
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)
 
 /*
@@ -492,6 +498,7 @@
 
 ENTRY_NOPROFILE(lev3intr)
 ENTRY_NOPROFILE(badtrap)
+       addql   #1,_C_LABEL(idepth)
        moveml  #0xC0C0,%sp@-           |  save scratch regs
        movw    %sp@(22),%sp@-          |  push exception vector info
        clrw    %sp@-
@@ -499,9 +506,11 @@
        jbsr    _C_LABEL(straytrap)     |  report
        addql   #8,%sp                  |  pop args
        moveml  %sp@+,#0x0303           |  restore regs
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)         |  all done
 
 ENTRY_NOPROFILE(badmfpint)
+       addql   #1,_C_LABEL(idepth)
        moveml  #0xC0C0,%sp@-           |  save scratch regs
        movw    %sp@(22),%sp@-          |  push exception vector info
        clrw    %sp@-
@@ -509,6 +518,7 @@
        jbsr    _C_LABEL(straymfpint)   |  report
        addql   #8,%sp                  |  pop args
        moveml  %sp@+,#0x0303           |  restore regs
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)         |  all done
 
 ENTRY_NOPROFILE(trap0)
@@ -672,6 +682,7 @@
 
        /* MFP timer A handler --- System clock --- */
 ASENTRY_NOPROFILE(mfp_tima)
+       addql   #1,_C_LABEL(idepth)
        moveml  %d0-%d1/%a0-%a1,%sp@-   |  save scratch registers
        movl    %sp,%sp@-               |  push pointer to clockframe
        jbsr    _C_LABEL(hardclock)     |  call generic clock int routine
@@ -680,22 +691,26 @@
                                        |  add another system clock interrupt
        moveml  %sp@+,%d0-%d1/%a0-%a1   |  restore scratch regs 
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)         |  all done
 
 #ifdef STATCLOCK
        /* MFP timer C handler --- Stat/Prof clock --- */
 ASENTRY_NOPROFILE(mfp_timc)
+       addql   #1,_C_LABEL(idepth)
        moveml  %d0-%d1/%a0-%a1,%sp@-   |  save scratch registers
        jbsr    _C_LABEL(statintr)      |  call statistics clock handler
        addql   #1,_C_LABEL(intrcnt)+36 |  add another stat clock interrupt
        moveml  %sp@+,%d0-%d1/%a0-%a1   |  restore scratch regs 
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)         |  all done
 #endif /* STATCLOCK */
 
 #if NKBD > 0
        /* MFP ACIA handler --- keyboard/midi --- */
 ASENTRY_NOPROFILE(mfp_kbd)
+       addql   #1,_C_LABEL(idepth)
        addql   #1,_C_LABEL(intrcnt)+8  |  add another kbd/mouse interrupt
 
        moveml  %d0-%d1/%a0-%a1,%sp@-   |  Save scratch registers
@@ -705,12 +720,14 @@
        addql   #4,%sp                  |  pop SR
        moveml  %sp@+,%d0-%d1/%a0-%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)
 #endif /* NKBD */
 
 #if NNCRSCSI > 0
        /* MFP2 SCSI DMA handler --- NCR5380 --- */
 ASENTRY_NOPROFILE(mfp2_5380dm)
+       addql   #1,_C_LABEL(idepth)
        addql   #1,_C_LABEL(intrcnt)+24 |  add another 5380-DMA interrupt
 
        moveml  %d0-%d1/%a0-%a1,%sp@-   |  Save scratch registers
@@ -720,10 +737,12 @@
        addql   #4,%sp                  |  pop SR
        moveml  %sp@+,%d0-%d1/%a0-%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)
 
        /* MFP2 SCSI handler --- NCR5380 --- */
 ASENTRY_NOPROFILE(mfp2_5380)
+       addql   #1,_C_LABEL(idepth)
        addql   #1,_C_LABEL(intrcnt)+20 |  add another 5380-SCSI interrupt
 
        moveml  %d0-%d1/%a0-%a1,%sp@-   |  Save scratch registers
@@ -733,12 +752,14 @@
        addql   #4,%sp                  |  pop SR
        moveml  %sp@+,%d0-%d1/%a0-%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)
 #endif /* NNCRSCSI > 0 */
 
 #if NZS > 0
        /* SCC Interrupt --- modem2/serial2 --- */
 ASENTRY_NOPROFILE(sccint)
+       addql   #1,_C_LABEL(idepth)
        addql   #1,_C_LABEL(intrcnt)+32 |  add another SCC interrupt
 
        moveml  %d0-%d1/%a0-%a1,%sp@-   |  Save scratch registers
@@ -748,12 +769,14 @@
        addql   #4,%sp                  |  pop SR
        moveml  %sp@+,%d0-%d1/%a0-%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       addql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)
 #endif /* NZS > 0 */
 
 #ifdef _ATARIHW_
        /* Level 1 (Software) interrupt handler */
 ENTRY_NOPROFILE(lev1intr)
+       addql   #1,_C_LABEL(idepth)
        moveml  %d0-%d1/%a0-%a1,%sp@-
        movl    _C_LABEL(stio_addr),%a0 |  get KVA of ST-IO area
        moveb   #0, %a0@(SCU_SOFTINT)   |  Turn off software interrupt
@@ -761,6 +784,7 @@
        jbsr    _C_LABEL(nullop)        |  XXX handle software interrupts
        moveml  %sp@+,%d0-%d1/%a0-%a1
        addql   #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
+       subql   #1,_C_LABEL(idepth)
        jra     _ASM_LABEL(rei)
 
        /*
@@ -774,6 +798,7 @@
         * Note that the nmi has to be turned off while handling it because
         * the hardware modification has no de-bouncing logic....
         */
+       addql   #1,_C_LABEL(idepth)
        movl    %a0, %sp@-              |  save a0
        movl    _C_LABEL(stio_addr),%a0 |  get KVA of ST-IO area
        movb    %a0@(SCU_SYSMASK),%sp@- |  save current sysmask
@@ -781,6 +806,7 @@
        trap    #15                     |  drop into the debugger
        movb    %sp@+, %a0@(SCU_SYSMASK)|  restore sysmask
        movl    %sp@+, %a0              |  restore a0
+       subql   #1,_C_LABEL(idepth)
 #endif
        addql   #1,_C_LABEL(intrcnt)+28 |  add another nmi interrupt
        rte                             |  all done
Index: include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/include/intr.h,v
retrieving revision 1.18
diff -u -r1.18 intr.h
--- include/intr.h      28 Jun 2008 05:26:33 -0000      1.18
+++ include/intr.h      3 Dec 2008 09:31:09 -0000
@@ -65,6 +65,7 @@
 int spl0 __P((void));
 
 extern const uint16_t ipl2psl_table[NIPL];
+extern int idepth;
 
 typedef int ipl_t;
 typedef struct {

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index