Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/dev Deprecate `findzs()' and try to map in ...



details:   https://anonhg.NetBSD.org/src/rev/970e3dc79fef
branches:  trunk
changeset: 472196:970e3dc79fef
user:      eeh <eeh%NetBSD.org@localhost>
date:      Sat Apr 24 21:08:12 1999 +0000

description:
Deprecate `findzs()' and try to map in the zs registers if they're not mapped
by the prom.

diffstat:

 sys/arch/sparc64/dev/zs.c |  41 +++++++++++++++++++++++++++++++++--------
 1 files changed, 33 insertions(+), 8 deletions(-)

diffs (83 lines):

diff -r a7517f8d46b0 -r 970e3dc79fef sys/arch/sparc64/dev/zs.c
--- a/sys/arch/sparc64/dev/zs.c Sat Apr 24 20:03:45 1999 +0000
+++ b/sys/arch/sparc64/dev/zs.c Sat Apr 24 21:08:12 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs.c,v 1.9 1999/03/27 01:21:36 wrstuden Exp $  */
+/*     $NetBSD: zs.c,v 1.10 1999/04/24 21:08:12 eeh Exp $      */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -109,7 +109,7 @@
 # error "no suitable software interrupt bit"
 #endif
 
-#define        ZS_DELAY()              (0)
+#define        ZS_DELAY()
 
 /* The layout of this is hardware-dependent (padding, order). */
 struct zschan {
@@ -170,8 +170,6 @@
                return (NULL);
        addr = zsaddr[zs_unit];
        if (addr == NULL)
-               addr = zsaddr[zs_unit] = findzs(zs_unit);
-       if (addr == NULL)
                return (NULL);
        if (channel == 0) {
                zc = &addr->zs_chan_a;
@@ -284,7 +282,7 @@
        void *aux;
 {
 #ifdef SUN4U
-       return 0;
+       return;
 #else
        struct zsc_softc *zsc = (void *) self;
        struct mainbus_attach_args *ma = aux;
@@ -317,8 +315,36 @@
        zsc->zsc_dmatag = sa->sa_dmatag;
 
        /* Use the mapping setup by the Sun PROM. */
-       if (zsaddr[zs_unit] == NULL)
-               zsaddr[zs_unit] = findzs(zs_unit);
+       if (zsaddr[zs_unit] == NULL) {
+               if (sa->sa_npromvaddrs) {
+                       /*
+                        * We're converting from a 32-bit pointer to a 64-bit
+                        * pointer.  Since the 32-bit entity is negative, but
+                        * the kernel is still mapped into the lower 4GB
+                        * range, this needs to be zero-extended.
+                        *
+                        * XXXXX If we map the kernel and devices into the
+                        * high 4GB range, this needs to be changed to
+                        * sign-extend the address.
+                        */
+                       zsaddr[zs_unit] = 
+                               (struct zsdevice *)
+                               (unsigned long)sa->sa_promvaddrs[0];
+               } else {
+                       bus_space_handle_t kvaddr;
+
+                       if (sbus_bus_map(sa->sa_bustag, sa->sa_slot,
+                                        sa->sa_offset,
+                                        sa->sa_size,
+                                        BUS_SPACE_MAP_LINEAR,
+                                        0, &kvaddr) != 0) {
+                               printf("%s @ sbus: cannot map registers\n",
+                                      self->dv_xname);
+                               return;
+                       }
+                       zsaddr[zs_unit] = (struct zsdevice *)kvaddr;
+               }
+       }
        zs_attach(zsc, sa->sa_pri);
 }
 
@@ -933,7 +959,6 @@
 prom_cngetc(dev)
        dev_t dev;
 {
-       int s;
        char c0;
 
        if (!stdin) {



Home | Main Index | Thread Index | Old Index