Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Clean up functions



details:   https://anonhg.NetBSD.org/src/rev/4fa242fbdb44
branches:  trunk
changeset: 522459:4fa242fbdb44
user:      uch <uch%NetBSD.org@localhost>
date:      Tue Feb 19 17:21:18 2002 +0000

description:
Clean up functions
disable_intr, enable_intr, disable_interrupt, enable_interrupt,
disable_ext_intr, enable_ext_intr.
New functions:
for external interrupt:
_cpu_intr_suspend and _cpu_intr_resume.
for exception:
_cpu_exception_suspend and _cpu_exception_resume.

diffstat:

 sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c |   10 +-
 sys/arch/dreamcast/dreamcast/clock.c      |    8 +-
 sys/arch/dreamcast/dreamcast/locore.s     |   22 +----
 sys/arch/dreamcast/dreamcast/machdep.c    |    8 +-
 sys/arch/dreamcast/dreamcast/shb.c        |    6 +-
 sys/arch/evbsh3/evbsh3/locore.s           |   22 +----
 sys/arch/evbsh3/evbsh3/machdep.c          |    7 +-
 sys/arch/evbsh3/evbsh3/shb.c              |    6 +-
 sys/arch/hpcsh/hpcsh/locore.s             |  151 +++++++++++++----------------
 sys/arch/hpcsh/hpcsh/machdep.c            |    4 +-
 sys/arch/mmeye/mmeye/locore.s             |   22 +----
 sys/arch/mmeye/mmeye/machdep.c            |    7 +-
 sys/arch/mmeye/mmeye/shb.c                |    6 +-
 sys/arch/sh3/conf/files.sh3               |    4 +-
 sys/arch/sh3/include/cpufunc.h            |  107 ++++++--------------
 sys/arch/sh3/include/intr.h               |   11 +-
 sys/arch/sh3/sh3/clock.c                  |    7 +-
 sys/arch/sh3/sh3/locore_subr.S            |  100 +++++++++++++++++++
 sys/arch/sh3/sh3/trap.c                   |    6 +-
 19 files changed, 255 insertions(+), 259 deletions(-)

diffs (truncated from 1132 to 300 lines):

diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c
--- a/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: g2bus_bus_mem.c,v 1.3 2001/02/01 01:01:50 thorpej Exp $        */
+/*     $NetBSD: g2bus_bus_mem.c,v 1.4 2002/02/19 17:21:19 uch Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -127,16 +127,16 @@
 
 #define G2_LOCK                                                                \
        do {                                                            \
-               disable_intr();                                         \
+               _cpu_exception_suspend();                               \
                /* suspend any G2 DMA here... */                        \
                while((*(volatile unsigned int *)0xa05f688c) & 32);     \
-       } while(0)
+       } while(/*CONSTCOND*/0)
 
 #define G2_UNLOCK                                                      \
        do {                                                            \
                /* resume any G2 DMA here... */                         \
-               enable_intr();                                          \
-       } while(0)
+               _cpu_exception_resume(0);                               \
+       } while(/*CONSTCOND*/0)
 
 
 u_int8_t
diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/dreamcast/dreamcast/clock.c
--- a/sys/arch/dreamcast/dreamcast/clock.c      Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/dreamcast/dreamcast/clock.c      Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.2 2002/02/01 17:52:54 uch Exp $    */
+/*     $NetBSD: clock.c,v 1.3 2002/02/19 17:21:19 uch Exp $    */
 
 /*-
  * Copyright (c) 1993, 1994 Charles Hannum.
@@ -187,12 +187,14 @@
 gettick()
 {
        int counter;
+
        /* Don't want someone screwing with the counter while we're here. */
-       disable_intr();
+       _cpu_exception_suspend();
 
        counter = SHREG_TCNT0;
 
-       enable_intr();
+       _cpu_exception_resume(0);
+
        return counter;
 }
 
diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/dreamcast/dreamcast/locore.s
--- a/sys/arch/dreamcast/dreamcast/locore.s     Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/dreamcast/dreamcast/locore.s     Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.11 2002/02/17 20:53:01 uch Exp $  */
+/*     $NetBSD: locore.s,v 1.12 2002/02/19 17:21:19 uch Exp $  */
 
 /*-
  * Copyright (c) 1993, 1994, 1995, 1997
@@ -1569,26 +1569,6 @@
 XXL_trap:              .long   _C_LABEL(trap)
 XL_check_ipending:     .long   _C_LABEL(check_ipending)
 
-ENTRY(enable_interrupt)
-       INTR_ENABLE
-       rts
-       nop
-
-ENTRY(disable_interrupt)
-       INTR_DISABLE
-       rts
-       nop
-
-ENTRY(enable_ext_intr)
-       INTR_ENABLE
-       rts
-       nop
-
-ENTRY(disable_ext_intr)
-       INTR_DISABLE
-       rts
-       nop
-
 NENTRY(Xspllower)
        sts.l   pr, @-r15
        mov.l   r1, @-r15
diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/dreamcast/dreamcast/machdep.c
--- a/sys/arch/dreamcast/dreamcast/machdep.c    Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/dreamcast/dreamcast/machdep.c    Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.6 2002/02/17 20:57:11 uch Exp $  */
+/*     $NetBSD: machdep.c,v 1.7 2002/02/19 17:21:19 uch Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -122,6 +122,7 @@
 #include <machine/psl.h>
 #include <machine/bootinfo.h>
 #include <machine/bus.h>
+#include <sh3/cpufunc.h>
 #include <sh3/bscreg.h>
 #include <sh3/ccrreg.h>
 #include <sh3/cpgreg.h>
@@ -188,6 +189,7 @@
 void LoadAndReset __P((char *));
 void XLoadAndReset __P((char *));
 void Sh3Reset __P((void));
+
 #ifdef SH4
 void sh4_cache_flush __P((vaddr_t));
 #endif
@@ -653,7 +655,7 @@
 #endif
 
        splraise(-1);
-       enable_intr();
+       _cpu_exception_resume(0);       /* SR.BL = 0 */
 
        avail_end = sh3_trunc_page(IOM_RAM_END + 1);
 
@@ -787,7 +789,7 @@
 cpu_reset()
 {
 
-       disable_intr();
+       _cpu_exception_suspend();
 
        Sh3Reset();
        for (;;)
diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/dreamcast/dreamcast/shb.c
--- a/sys/arch/dreamcast/dreamcast/shb.c        Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/dreamcast/dreamcast/shb.c        Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: shb.c,v 1.5 2001/04/24 19:43:23 marcus Exp $   */
+/*     $NetBSD: shb.c,v 1.6 2002/02/19 17:21:19 uch Exp $      */
 
 /*-
  * Copyright (c) 1993, 1994 Charles Hannum.  All rights reserved.
@@ -431,7 +431,7 @@
                return 1;
        }
 
-       enable_ext_intr();
+       _cpu_intr_resume(0);
        while (ih) {
                if (ih->ih_arg)
                        (*ih->ih_fun)(ih->ih_arg);
@@ -439,7 +439,7 @@
                        (*ih->ih_fun)(&frame);
                ih = ih->ih_next;
        }
-       disable_ext_intr();
+       _cpu_intr_suspend();
 
        cpl = ocpl;
 
diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/evbsh3/evbsh3/locore.s
--- a/sys/arch/evbsh3/evbsh3/locore.s   Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/evbsh3/evbsh3/locore.s   Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.35 2002/02/17 20:53:03 uch Exp $  */
+/*     $NetBSD: locore.s,v 1.36 2002/02/19 17:21:19 uch Exp $  */
 
 /*-
  * Copyright (c) 1993, 1994, 1995, 1997
@@ -1570,26 +1570,6 @@
 XXL_trap:              .long   _C_LABEL(trap)
 XL_check_ipending:     .long   _C_LABEL(check_ipending)
 
-ENTRY(enable_interrupt)
-       INTR_ENABLE
-       rts
-       nop
-
-ENTRY(disable_interrupt)
-       INTR_DISABLE
-       rts
-       nop
-
-ENTRY(enable_ext_intr)
-       INTR_ENABLE
-       rts
-       nop
-
-ENTRY(disable_ext_intr)
-       INTR_DISABLE
-       rts
-       nop
-
 NENTRY(Xspllower)
        sts.l   pr, @-r15
        mov.l   r1, @-r15
diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/evbsh3/evbsh3/machdep.c
--- a/sys/arch/evbsh3/evbsh3/machdep.c  Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/evbsh3/evbsh3/machdep.c  Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.30 2002/02/17 20:57:12 uch Exp $ */
+/*     $NetBSD: machdep.c,v 1.31 2002/02/19 17:21:19 uch Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -183,6 +183,7 @@
 void LoadAndReset __P((char *));
 void XLoadAndReset __P((char *));
 void Sh3Reset __P((void));
+void cpu_reset(void);
 #ifdef SH4
 void sh4_cache_flush __P((vaddr_t));
 #endif
@@ -655,7 +656,7 @@
 #endif
 
        splraise(-1);
-       enable_intr();
+       _cpu_exception_resume(0);
 
        avail_end = sh3_trunc_page(IOM_RAM_END + 1);
 
@@ -789,7 +790,7 @@
 cpu_reset()
 {
 
-       disable_intr();
+       _cpu_exception_suspend();
 
        Sh3Reset();
        for (;;)
diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/evbsh3/evbsh3/shb.c
--- a/sys/arch/evbsh3/evbsh3/shb.c      Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/evbsh3/evbsh3/shb.c      Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: shb.c,v 1.13 2001/01/15 20:19:53 thorpej Exp $ */
+/*     $NetBSD: shb.c,v 1.14 2002/02/19 17:21:20 uch Exp $     */
 
 /*-
  * Copyright (c) 1993, 1994 Charles Hannum.  All rights reserved.
@@ -428,7 +428,7 @@
                return 1;
        }
 
-       enable_ext_intr();
+       _cpu_intr_resume(0);
        while (ih) {
                if (ih->ih_arg)
                        (*ih->ih_fun)(ih->ih_arg);
@@ -436,7 +436,7 @@
                        (*ih->ih_fun)(&frame);
                ih = ih->ih_next;
        }
-       disable_ext_intr();
+       _cpu_intr_suspend();
 
        cpl = ocpl;
 
diff -r e6dd677083be -r 4fa242fbdb44 sys/arch/hpcsh/hpcsh/locore.s
--- a/sys/arch/hpcsh/hpcsh/locore.s     Tue Feb 19 17:09:40 2002 +0000
+++ b/sys/arch/hpcsh/hpcsh/locore.s     Tue Feb 19 17:21:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.12 2002/02/17 21:01:19 uch Exp $  */
+/*     $NetBSD: locore.s,v 1.13 2002/02/19 17:21:20 uch Exp $  */
 
 /*-
  * Copyright (c) 1993, 1994, 1995, 1997
@@ -45,14 +45,34 @@
 
 #include "assym.h"
 
-#include <sys/errno.h>
-#include <sys/syscall.h>
+#include <machine/asm.h>
+#include <sys/syscall.h>/* SYS___sigreturn14, SYS_exit */      
+#include <sh3/param.h> /* NBPG */
+#include <sh3/pte.h>   /* PDSHIFT */
+#include <sh3/trap.h>  /* T_ASTFLT */
+#include <sh3/mmu_sh3.h>
+#include <sh3/mmu_sh4.h>
 
-#include <machine/asm.h>
-#include <machine/cputypes.h>
-#include <machine/param.h>
-#include <machine/pte.h>
-#include <machine/trap.h>
+#define SH3_BBRA       0xffffffb8
+#define SH4_BBRA       0xff200008
+#define SH3_EXPEVT     0xffffffd4
+#define SH3_INTEVT     0xffffffd8
+#define SH4_EXPEVT     0xff000024      
+#define SH4_INTEVT     0xff000028
+
+#if defined(SH3) && defined(SH4)
+#define MOV(x, r)      mov.l XL_/**/x, r; mov.l @r, r
+#define        REG_SYMBOL(x)   XL_/**/x:       .long   _C_LABEL(__sh_/**/x)
+#define        FUNC_SYMBOL(x)  XL_/**/x:       .long   _C_LABEL(__sh_/**/x)    
+#elif defined(SH3)



Home | Main Index | Thread Index | Old Index