Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc Add oea_iobat_remove(paddr_t).



details:   https://anonhg.NetBSD.org/src/rev/9ade17456822
branches:  trunk
changeset: 542781:9ade17456822
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Feb 06 23:02:33 2003 +0000

description:
Add oea_iobat_remove(paddr_t).

diffstat:

 sys/arch/powerpc/include/oea/bat.h |   3 +-
 sys/arch/powerpc/oea/oea_machdep.c |  46 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 3 deletions(-)

diffs (84 lines):

diff -r 9ddadc982597 -r 9ade17456822 sys/arch/powerpc/include/oea/bat.h
--- a/sys/arch/powerpc/include/oea/bat.h        Thu Feb 06 23:01:32 2003 +0000
+++ b/sys/arch/powerpc/include/oea/bat.h        Thu Feb 06 23:02:33 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bat.h,v 1.3 2003/02/05 07:35:31 matt Exp $     */
+/*     $NetBSD: bat.h,v 1.4 2003/02/06 23:02:33 matt Exp $     */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -180,6 +180,7 @@
 #ifdef _KERNEL
 void oea_batinit(paddr_t, ...);
 void oea_iobat_add(paddr_t, register_t);
+void oea_iobat_remove(paddr_t);
 extern struct bat battable[];
 #endif
 
diff -r 9ddadc982597 -r 9ade17456822 sys/arch/powerpc/oea/oea_machdep.c
--- a/sys/arch/powerpc/oea/oea_machdep.c        Thu Feb 06 23:01:32 2003 +0000
+++ b/sys/arch/powerpc/oea/oea_machdep.c        Thu Feb 06 23:02:33 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oea_machdep.c,v 1.2 2003/02/05 07:05:20 matt Exp $     */
+/*     $NetBSD: oea_machdep.c,v 1.3 2003/02/06 23:02:34 matt Exp $     */
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -151,7 +151,7 @@
        /*
         * Set up trap vectors.  Don't assume vectors are on 0x100.
         */
-       for (exc = EXC_RST; exc <= EXC_LAST; exc += 0x100) {
+       for (exc = 0; exc <= EXC_LAST; exc += 0x100) {
                switch (exc) {
                default:
                        size = (size_t)&trapsize;
@@ -374,6 +374,48 @@
 }
 
 void
+oea_iobat_remove(paddr_t pa)
+{
+       register_t batu;
+       int i, n;
+
+       n = pa >> ADDR_SR_SHFT;
+       if (!BAT_VA_MATCH_P(battable[n].batu, pa) ||
+           !BAT_VALID_P(battable[n].batu, PSL_PR))
+               return;
+       battable[n].batl = 0;
+       battable[n].batu = 0;
+#define        BAT_RESET(n) \
+       __asm __volatile("mtdbatu %0,%1; mtdbatl %0,%1" :: "n"(n), "r"(0))
+#define        BATU_GET(n, r)  __asm __volatile("mfdbatu %0,%1" : "=r"(r) : "n"(n))
+
+       for (i=1 ; i<4 ; i++) {
+               switch (i) {
+               case 1:
+                       BATU_GET(1, batu);
+                       if (BAT_VA_MATCH_P(batu, pa) &&
+                           BAT_VALID_P(batu, PSL_PR))
+                               BAT_RESET(1);
+                       break;
+               case 2:
+                       BATU_GET(2, batu);
+                       if (BAT_VA_MATCH_P(batu, pa) &&
+                           BAT_VALID_P(batu, PSL_PR))
+                               BAT_RESET(2);
+                       break;
+               case 3:
+                       BATU_GET(3, batu);
+                       if (BAT_VA_MATCH_P(batu, pa) &&
+                           BAT_VALID_P(batu, PSL_PR))
+                               BAT_RESET(3);
+                       break;
+               default:
+                       break;
+               }
+       }
+}
+
+void
 oea_batinit(paddr_t pa, ...)
 {
        struct mem_region *allmem, *availmem, *mp;



Home | Main Index | Thread Index | Old Index