Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc PR port-sparc/54789: Sparc boot fails with "T...



details:   https://anonhg.NetBSD.org/src/rev/10c269af1606
branches:  trunk
changeset: 967991:10c269af1606
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Dec 30 22:13:46 2019 +0000

description:
PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.

diffstat:

 sys/arch/sparc/dev/apc.c          |   8 ++--
 sys/arch/sparc/include/cpu.h      |   4 +-
 sys/arch/sparc/sparc/clkctrl.c    |   9 +++--
 sys/arch/sparc/sparc/lock_stubs.s |  20 +++++++------
 sys/arch/sparc/sparc/locore.s     |  55 ++++++++++++++++++++------------------
 sys/arch/sparc/sparc/msiiep.c     |   8 ++--
 6 files changed, 55 insertions(+), 49 deletions(-)

diffs (truncated from 328 to 300 lines):

diff -r f87c8fb1a77f -r 10c269af1606 sys/arch/sparc/dev/apc.c
--- a/sys/arch/sparc/dev/apc.c  Mon Dec 30 19:52:11 2019 +0000
+++ b/sys/arch/sparc/dev/apc.c  Mon Dec 30 22:13:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apc.c,v 1.1 2010/01/15 20:57:12 bouyer Exp $   */
+/*     $NetBSD: apc.c,v 1.2 2019/12/30 22:13:46 ad Exp $       */
 
 /*
  * Copyright (c) 2010 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apc.c,v 1.1 2010/01/15 20:57:12 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apc.c,v 1.2 2019/12/30 22:13:46 ad Exp $");
 
 
 /*
@@ -45,7 +45,7 @@
 
 static int apcmatch(device_t, struct cfdata *, void *);
 static void apcattach(device_t, device_t, void *);
-static void apc_cpu_sleep(struct cpu_info *);
+static void apc_cpu_sleep(void);
 
 struct apc_softc {
        device_t        sc_dev;
@@ -86,7 +86,7 @@
 }
 
 static void
-apc_cpu_sleep(struct cpu_info *ci)
+apc_cpu_sleep(void)
 {
        uint8_t val;
        if (apc == NULL)
diff -r f87c8fb1a77f -r 10c269af1606 sys/arch/sparc/include/cpu.h
--- a/sys/arch/sparc/include/cpu.h      Mon Dec 30 19:52:11 2019 +0000
+++ b/sys/arch/sparc/include/cpu.h      Mon Dec 30 22:13:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.103 2019/12/01 15:34:45 ad Exp $ */
+/*     $NetBSD: cpu.h,v 1.104 2019/12/30 22:13:47 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -374,7 +374,7 @@
         * unrecoverable faults end up here.
         */
        void            (*memerr)(unsigned, u_int, u_int, struct trapframe *);
-       void            (*idlespin)(struct cpu_info *);
+       void            (*idlespin)(void);
        /* Module Control Registers */
        /*bus_space_handle_t*/ long ci_mbusport;
        /*bus_space_handle_t*/ long ci_mxccregs;
diff -r f87c8fb1a77f -r 10c269af1606 sys/arch/sparc/sparc/clkctrl.c
--- a/sys/arch/sparc/sparc/clkctrl.c    Mon Dec 30 19:52:11 2019 +0000
+++ b/sys/arch/sparc/sparc/clkctrl.c    Mon Dec 30 22:13:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clkctrl.c,v 1.5 2011/07/17 23:32:37 mrg Exp $  */
+/*     $NetBSD: clkctrl.c,v 1.6 2019/12/30 22:13:47 ad Exp $   */
 
 /*
  * Copyright (c) 2005 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clkctrl.c,v 1.5 2011/07/17 23:32:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clkctrl.c,v 1.6 2019/12/30 22:13:47 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,7 +44,7 @@
 CFATTACH_DECL_NEW(clkctrl, 0,
      clkctrl_match, clkctrl_attach, NULL, NULL);
 
-static void tadpole_cpu_sleep(struct cpu_info *);
+static void tadpole_cpu_sleep(void);
 volatile uint8_t *clkctrl_reg = NULL;
 
 static int
@@ -91,8 +91,9 @@
 
 /* ARGSUSED */
 static void
-tadpole_cpu_sleep(struct cpu_info *ci)
+tadpole_cpu_sleep(void)
 {
+
        if (clkctrl_reg == 0)
                return;
        *clkctrl_reg = 0;
diff -r f87c8fb1a77f -r 10c269af1606 sys/arch/sparc/sparc/lock_stubs.s
--- a/sys/arch/sparc/sparc/lock_stubs.s Mon Dec 30 19:52:11 2019 +0000
+++ b/sys/arch/sparc/sparc/lock_stubs.s Mon Dec 30 22:13:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock_stubs.s,v 1.12 2008/05/25 15:56:12 chs Exp $      */
+/*     $NetBSD: lock_stubs.s,v 1.13 2019/12/30 22:13:47 ad Exp $       */
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -122,10 +122,10 @@
  * void mutex_spin_enter(kmutex_t *);
  */
 ENTRY(mutex_spin_enter)
-       sethi   %hi(CPUINFO_VA), %o4
-       ld      [ %o4 + CPUINFO_MTX_COUNT ], %o5
+       sethi   %hi(CPUINFO_VA+CPUINFO_MTX_COUNT), %o4
+       ld      [ %o4 + %lo(CPUINFO_VA+CPUINFO_MTX_COUNT) ], %o5
        sub     %o5, 1, %o1
-       st      %o1, [ %o4 + CPUINFO_MTX_COUNT ]
+       st      %o1, [ %o4 + %lo(CPUINFO_VA+CPUINFO_MTX_COUNT) ]
        ldub    [ %o0 + MTX_IPL ], %o2
        rd      %psr, %o1
        sll     %o2, 8, %o2
@@ -140,8 +140,9 @@
        nop
        tst     %o5
 1:
+       sethi   %hi(CPUINFO_VA+CPUINFO_MTX_OLDSPL), %o4
        bz,a    2f
-        st     %o3, [ %o4 + CPUINFO_MTX_OLDSPL ]
+        st     %o3, [ %o4 + %lo(CPUINFO_VA+CPUINFO_MTX_OLDSPL) ]
 2:
 #if defined(MULTIPROCESSOR) || defined(DIAGNOSTIC)
        ldstub  [ %o0 + MTX_LOCK ], %o2
@@ -166,12 +167,13 @@
 #elif defined(MULTIPROCESSOR)
        clrb    [ %o0 + MTX_LOCK ]
 #endif
-       sethi    %hi(CPUINFO_VA), %o2
-       ld      [ %o2 + CPUINFO_MTX_OLDSPL ], %o3
-       ld      [ %o2 + CPUINFO_MTX_COUNT ], %o1
+       sethi    %hi(CPUINFO_VA+CPUINFO_MTX_OLDSPL), %o2
+       ld      [ %o2 + %lo(CPUINFO_VA+CPUINFO_MTX_OLDSPL) ], %o3
+       sethi    %hi(CPUINFO_VA+CPUINFO_MTX_COUNT), %o2
+       ld      [ %o2 + %lo(CPUINFO_VA+CPUINFO_MTX_COUNT) ], %o1
        addcc   %o1, 1, %o4
        bnz     1f
-        st     %o4, [ %o2 + CPUINFO_MTX_COUNT ]
+        st     %o4, [ %o2 + %lo(CPUINFO_VA+CPUINFO_MTX_COUNT) ]
        rd      %psr, %o1
        andn    %o1, PSR_PIL, %o1
        wr      %o3, %o1, %psr
diff -r f87c8fb1a77f -r 10c269af1606 sys/arch/sparc/sparc/locore.s
--- a/sys/arch/sparc/sparc/locore.s     Mon Dec 30 19:52:11 2019 +0000
+++ b/sys/arch/sparc/sparc/locore.s     Mon Dec 30 22:13:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.274 2019/06/07 00:18:26 mrg Exp $ */
+/*     $NetBSD: locore.s,v 1.275 2019/12/30 22:13:47 ad Exp $  */
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -1954,10 +1954,11 @@
 #if defined(SUN4M)
 _ENTRY(memfault_sun4m)
 memfault_sun4m:
-       sethi   %hi(CPUINFO_VA), %l4
+       sethi   %hi(CPUINFO_VA+CPUINFO_GETSYNCFLT), %l4
        ld      [%l4 + %lo(CPUINFO_VA+CPUINFO_GETSYNCFLT)], %l5
+       sethi   %hi(CPUINFO_VA+CPUINFO_SYNCFLTDUMP), %l4
        jmpl    %l5, %l7
-        or     %l4, %lo(CPUINFO_SYNCFLTDUMP), %l4
+        or     %l4, %lo(CPUINFO_VA+CPUINFO_SYNCFLTDUMP), %l4
        TRAP_SETUP(-CCFSZ-80)
        ! tally fault (curcpu()->cpu_data.cpu_nfault++) (clobbers %o0,%o1,%o2)
        INCR64(CPUINFO_VA + CPUINFO_NFAULT)
@@ -2519,10 +2520,10 @@
        set     _C_LABEL(sintrhand), %l4! %l4 = sintrhand[intlev];
        ld      [%l4 + %l5], %l4
 
-       sethi   %hi(CPUINFO_VA), %o2
-       ld      [ %o2 + CPUINFO_IDEPTH ], %o3
+       sethi   %hi(CPUINFO_VA+CPUINFO_IDEPTH), %o2
+       ld      [ %o2 + %lo(CPUINFO_VA+CPUINFO_IDEPTH) ], %o3
        inc     %o3
-       st      %o3, [ %o2 + CPUINFO_IDEPTH ]
+       st      %o3, [ %o2 + %lo(CPUINFO_VA+CPUINFO_IDEPTH) ]
 
        b       3f
         st     %fp, [%sp + CCFSZ + 16]
@@ -2543,10 +2544,10 @@
        bnz     1b
         nop
 
-       sethi   %hi(CPUINFO_VA), %o2
-       ld      [ %o2 + CPUINFO_IDEPTH ], %o3
+       sethi   %hi(CPUINFO_VA+CPUINFO_IDEPTH), %o2
+       ld      [ %o2 + %lo(CPUINFO_VA+CPUINFO_IDEPTH) ], %o3
        dec     %o3
-       st      %o3, [ %o2 + CPUINFO_IDEPTH ]
+       st      %o3, [ %o2 + %lo(CPUINFO_VA+CPUINFO_IDEPTH) ]
 
        mov     %l7, %g1
        wr      %l6, 0, %y
@@ -2563,8 +2564,8 @@
 #if defined(SUN4M)
 _ENTRY(_C_LABEL(sparc_interrupt4m))
 #if !defined(MSIIEP)   /* "normal" sun4m */
-       sethi   %hi(CPUINFO_VA), %l6
-       ld      [%l6 + CPUINFO_INTREG], %l7
+       sethi   %hi(CPUINFO_VA+CPUINFO_INTREG), %l6
+       ld      [%l6 + %lo(CPUINFO_VA+CPUINFO_INTREG)], %l7
        mov     1, %l4
        ld      [%l7 + ICR_PI_PEND_OFFSET], %l5 ! get pending interrupts
        sll     %l4, %l3, %l4   ! hw intr bits are in the lower halfword
@@ -2704,10 +2705,10 @@
        set     _C_LABEL(intrhand), %l4 ! %l4 = intrhand[intlev];
        ld      [%l4 + %l5], %l4
 
-       sethi   %hi(CPUINFO_VA), %o2
-       ld      [ %o2 + CPUINFO_IDEPTH ], %o3
+       sethi   %hi(CPUINFO_VA+CPUINFO_IDEPTH), %o2
+       ld      [ %o2 + %lo(CPUINFO_VA+CPUINFO_IDEPTH) ], %o3
        inc     %o3
-       st      %o3, [ %o2 + CPUINFO_IDEPTH ]
+       st      %o3, [ %o2 + %lo(CPUINFO_VA+CPUINFO_IDEPTH) ]
 
        b       3f
         st     %fp, [%sp + CCFSZ + 16]
@@ -2742,10 +2743,10 @@
         add    %sp, CCFSZ, %o0
        /* all done: restore registers and go return */
 4:
-       sethi   %hi(CPUINFO_VA), %o2
-       ld      [ %o2 + CPUINFO_IDEPTH ], %o3
+       sethi   %hi(CPUINFO_VA+CPUINFO_IDEPTH), %o2
+       ld      [ %o2 + %lo(CPUINFO_VA+CPUINFO_IDEPTH) ], %o3
        dec     %o3
-       st      %o3, [ %o2 + CPUINFO_IDEPTH ]
+       st      %o3, [ %o2 + %lo(CPUINFO_VA+CPUINFO_IDEPTH) ]
 
        mov     %l7, %g1
        wr      %l6, 0, %y
@@ -2763,8 +2764,8 @@
  * %l6 = &cpuinfo
  */
 lev14_softint:
-       sethi   %hi(CPUINFO_VA), %l7
-       ldd     [%l7 + CPUINFO_LEV14], %l4
+       sethi   %hi(CPUINFO_VA+CPUINFO_LEV14), %l7
+       ldd     [%l7 + %lo(CPUINFO_VA+CPUINFO_LEV14)], %l4
        inccc   %l5
        addx    %l4, %g0, %l4
        std     %l4, [%l7 + CPUINFO_LEV14]
@@ -4961,13 +4962,13 @@
  * Call the idlespin() function if it exists, otherwise just return.
  */
 ENTRY(cpu_idle)
-       sethi   %hi(CPUINFO_VA), %o0
-       ld      [%o0 + CPUINFO_IDLESPIN], %o1
+       sethi   %hi(CPUINFO_VA+CPUINFO_IDLESPIN), %o0
+       ld      [%o0 + %lo(CPUINFO_VA+CPUINFO_IDLESPIN)], %o1
        tst     %o1
        bz      1f
         nop
        jmp     %o1
-        nop    ! CPUINFO_VA is already in %o0
+        nop
 1:
        retl
         nop
@@ -5641,8 +5642,8 @@
        _ALIGN
 
 ENTRY(ipi_savefpstate)
-       sethi   %hi(CPUINFO_VA), %o5
-       ldd     [%o5 + CPUINFO_SAVEFPSTATE], %o2
+       sethi   %hi(CPUINFO_VA+CPUINFO_SAVEFPSTATE), %o5
+       ldd     [%o5 + %lo(CPUINFO_VA+CPUINFO_SAVEFPSTATE)], %o2
        inccc   %o3
        addx    %o2, 0, %o2
        std     %o2, [%o5 + CPUINFO_SAVEFPSTATE]
@@ -5855,14 +5856,16 @@
 _ENTRY(_C_LABEL(smp_get_syncflt))
        save    %sp, -CCFSZ, %sp
 
-       sethi   %hi(CPUINFO_VA), %o4
+       sethi   %hi(CPUINFO_VA+CPUINFO_GETSYNCFLT), %o4
        ld      [%l4 + %lo(CPUINFO_VA+CPUINFO_GETSYNCFLT)], %o5
        clr     %l1
        clr     %l3
+       sethi   %hi(CPUINFO_VA+CPUINFO_SYNCFLTDUMP), %o4
        jmpl    %o5, %l7
-        or     %o4, %lo(CPUINFO_SYNCFLTDUMP), %l4
+        or     %o4, %lo(CPUINFO_VA+CPUINFO_SYNCFLTDUMP), %l4
 
        ! load values out of the dump
+       sethi   %hi(CPUINFO_VA+CPUINFO_SYNCFLTDUMP), %o4
        ld      [%o4 + %lo(CPUINFO_VA+CPUINFO_SYNCFLTDUMP)], %o5
        st      %o5, [%i0]
        ld      [%o4 + %lo(CPUINFO_VA+CPUINFO_SYNCFLTDUMP+4)], %o5
diff -r f87c8fb1a77f -r 10c269af1606 sys/arch/sparc/sparc/msiiep.c
--- a/sys/arch/sparc/sparc/msiiep.c     Mon Dec 30 19:52:11 2019 +0000
+++ b/sys/arch/sparc/sparc/msiiep.c     Mon Dec 30 22:13:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msiiep.c,v 1.47 2019/11/10 21:16:33 chs Exp $ */
+/*     $NetBSD: msiiep.c,v 1.48 2019/12/30 22:13:47 ad Exp $ */
 
 /*



Home | Main Index | Thread Index | Old Index