Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/arch/sparc64/sparc64 Pullup 1.29 by patch [eeh]:



details:   https://anonhg.NetBSD.org/src/rev/77bf9e92463a
branches:  netbsd-1-5
changeset: 489888:77bf9e92463a
user:      tv <tv%NetBSD.org@localhost>
date:      Wed Oct 18 03:31:05 2000 +0000

description:
Pullup 1.29 by patch [eeh]:
Add support for write protecting clock registers.

diffstat:

 sys/arch/sparc64/sparc64/clock.c |  43 +++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 9 deletions(-)

diffs (86 lines):

diff -r c50d3905fdbd -r 77bf9e92463a sys/arch/sparc64/sparc64/clock.c
--- a/sys/arch/sparc64/sparc64/clock.c  Wed Oct 18 03:20:02 2000 +0000
+++ b/sys/arch/sparc64/sparc64/clock.c  Wed Oct 18 03:31:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.19.2.2 2000/07/31 02:06:39 mrg Exp $ */
+/*     $NetBSD: clock.c,v 1.19.2.3 2000/10/18 03:31:05 tv Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -151,6 +151,15 @@
 
 int timerblurb = 10; /* Guess a value; used before clock is attached */
 
+struct bus_map_args {
+       bus_space_tag_t tag;
+       bus_type_t      bustype;
+       bus_addr_t      addr;
+       bus_space_handle_t      bh;
+};
+
+static struct bus_map_args mapargs;
+
 /*
  * The OPENPROM calls the clock the "eeprom", so we have to have our
  * own special match function to call it the "clock".
@@ -241,6 +250,12 @@
                return;
        }
        clockattach(sa->sa_node, bh);
+
+       /* Save mapping info for later. */
+       mapargs.tag = sa->sa_bustag;
+       mapargs.bustype = sa->sa_slot;
+       mapargs.addr = (sa->sa_offset & ~NBPG);
+       mapargs.bh = bh;
 }
 
 /* ARGSUSED */
@@ -267,6 +282,12 @@
                return;
        }
        clockattach(ea->ea_node, bh);
+
+       /* Save mapping info for later. */
+       mapargs.tag = ea->ea_bustag;
+       mapargs.bustype = 0;
+       mapargs.addr = EBUS_PADDR_FROM_REG(&ea->ea_regs[0]);
+       mapargs.bh = bh;
 }
 
 static void
@@ -400,22 +421,26 @@
        register int s;
        register vm_prot_t prot;/* nonzero => change prot */
        static int writers;
+       
 
        s = splhigh();
        if (onoff)
-               prot = writers++ == 0 ? VM_PROT_READ|VM_PROT_WRITE : 0;
+               prot = writers++ == 0 ? BUS_SPACE_MAP_LINEAR : 0;
        else
-               prot = --writers == 0 ? VM_PROT_READ : 0;
+               prot = --writers == 0 ? 
+                       BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_READONLY : 0;
        splx(s);
-#if 0
        if (prot) {
-               vaddr_t va = (vaddr_t)clockreg & ~(NBPG-1);
-               paddr_t pa;
+               bus_space_handle_t newhandle;
 
-               (void) pmap_extract(pmap_kernel(), va, &pa);
-               pmap_enter(pmap_kernel(), va, pa, prot, prot|PMAP_WIRED);
+               bus_space_map2(mapargs.tag, mapargs.bustype,
+                              mapargs.addr, 8192, prot,
+                              mapargs.bh, &newhandle);
+               /* We can panic now or take a datafault later... */
+               if (mapargs.bh != newhandle)
+                       panic("sbus_wenable: address %p changed to %p\n",
+                             (vaddr_t)mapargs.bh, (vaddr_t)newhandle);
        }
-#endif
 }
 
 void



Home | Main Index | Thread Index | Old Index