Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 Fix bus_type_t properly and enable ASI acce...



details:   https://anonhg.NetBSD.org/src/rev/3850ea684a9f
branches:  trunk
changeset: 473155:3850ea684a9f
user:      eeh <eeh%NetBSD.org@localhost>
date:      Sat May 22 20:28:22 1999 +0000

description:
Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()

diffstat:

 sys/arch/sparc64/include/bus.h     |  39 +++++++++++++++++++++----------------
 sys/arch/sparc64/sparc64/machdep.c |  35 ++++++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 19 deletions(-)

diffs (151 lines):

diff -r 404ba00b5ff6 -r 3850ea684a9f sys/arch/sparc64/include/bus.h
--- a/sys/arch/sparc64/include/bus.h    Sat May 22 20:25:49 1999 +0000
+++ b/sys/arch/sparc64/include/bus.h    Sat May 22 20:28:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus.h,v 1.10 1999/03/23 21:29:05 drochner Exp $        */
+/*     $NetBSD: bus.h,v 1.11 1999/05/22 20:28:22 eeh Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -81,11 +81,16 @@
  *
  * PCI spaces are non-cached and little endian
  */
-#define UPA_BUS_SPACE  ASI_PHYS_NON_CACHED
-#define        SBUS_BUS_SPACE  ASI_PHYS_NON_CACHED
-#define PCI_CONFIG_BUS_SPACE   ASI_PHYS_NON_CACHED_LITTLE
-#define PCI_IO_BUS_SPACE       ASI_PHYS_NON_CACHED_LITTLE
-#define PCI_MEMORY_BUS_SPACE   ASI_PHYS_CACHED_LITTLE
+
+enum bus_type { 
+       UPA_BUS_SPACE,
+       SBUS_BUS_SPACE,
+       PCI_CONFIG_BUS_SPACE,
+       PCI_IO_BUS_SPACE,
+       PCI_MEMORY_BUS_SPACE,
+       LAST_BUS_SPACE
+}; 
+extern int bus_type_asi[LAST_BUS_SPACE];
 /* For backwards compatibility */
 #define SPARC_BUS_SPACE        UPA_BUS_SPACE
 
@@ -93,7 +98,7 @@
  * Bus address and size types
  */
 typedef        u_int64_t       bus_space_handle_t;
-typedef u_long         bus_type_t;
+typedef enum bus_type  bus_type_t;
 typedef u_int64_t      bus_addr_t;
 typedef u_int64_t      bus_size_t;
 
@@ -350,18 +355,18 @@
  * Read a 1, 2, 4, or 8 byte quantity from bus space
  * described by tag/handle/offset.
  */
-#if 0
+#if 1
 #define        bus_space_read_1(t, h, o)                                       \
-           lduba((h) + (o), (t)->type)
+           lduba((h) + (o), bus_type_asi[(t)->type])
 
 #define        bus_space_read_2(t, h, o)                                       \
-           lduha((h) + (o), (t)->type)
+           lduha((h) + (o), bus_type_asi[(t)->type])
 
 #define        bus_space_read_4(t, h, o)                                       \
-           lda((h) + (o), (t)->type)
+           lda((h) + (o), bus_type_asi[(t)->type])
 
 #define        bus_space_read_8(t, h, o)                                       \
-           ldxa((h) + (o), (t)->type)
+           ldxa((h) + (o), bus_type_asi[(t)->type])
 #else
        /* For the time being don't use address spaces */
 #define        bus_space_read_1(t, h, o)                                       \
@@ -421,18 +426,18 @@
  * Write the 1, 2, 4, or 8 byte value `value' to bus space
  * described by tag/handle/offset.
  */
-#if 0
+#if 1
 #define        bus_space_write_1(t, h, o, v)                                   \
-       ((void)(stba((h) + (o), (t)->type, (v))))
+       ((void)(stba((h) + (o), bus_type_asi[(t)->type], (v))))
 
 #define        bus_space_write_2(t, h, o, v)                                   \
-       ((void)(stha((h) + (o), (t)->type, (v))))
+       ((void)(stha((h) + (o), bus_type_asi[(t)->type], (v))))
 
 #define        bus_space_write_4(t, h, o, v)                                   \
-       ((void)(sta((h) + (o), (t)->type, (v))))
+       ((void)(sta((h) + (o), bus_type_asi[(t)->type], (v))))
 
 #define        bus_space_write_8(t, h, o, v)                                   \
-       ((void)(stxa((h) + (o), (t)->type, (v))))
+       ((void)(stxa((h) + (o), bus_type_asi[(t)->type], (v))))
 #else
        /* Use primary ASI for now for debug */
 #define        bus_space_write_1(t, h, o, v)   do {                            \
diff -r 404ba00b5ff6 -r 3850ea684a9f sys/arch/sparc64/sparc64/machdep.c
--- a/sys/arch/sparc64/sparc64/machdep.c        Sat May 22 20:25:49 1999 +0000
+++ b/sys/arch/sparc64/sparc64/machdep.c        Sat May 22 20:28:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.39 1999/05/20 08:21:47 lukem Exp $ */
+/*     $NetBSD: machdep.c,v 1.40 1999/05/22 20:28:22 eeh Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -155,6 +155,36 @@
 caddr_t        mdallocsys __P((caddr_t));
 void   stackdump __P((void));
 
+/* 
+ * This is the table that tells us how to access different bus space types.
+ */ 
+
+#if BUS_BYPASS_ACCESS_ENABLED == 1
+/*
+ * Bypass access 
+ */
+int bus_type_asi[LAST_BUS_SPACE] = {
+       ASI_PHYS_NON_CACHED,
+       ASI_PHYS_NON_CACHED,
+       ASI_PHYS_NON_CACHED_LITTLE,
+       ASI_PHYS_NON_CACHED_LITTLE,
+       ASI_PHYS_CACHED_LITTLE,
+       0
+};
+#else
+/*
+ * MMU access 
+ */
+int bus_type_asi[LAST_BUS_SPACE] = {
+       ASI_PRIMARY,
+       ASI_PRIMARY,
+       ASI_PRIMARY_LITTLE,
+       ASI_PRIMARY_LITTLE,
+       ASI_PRIMARY_LITTLE,
+       0
+};
+#endif
+
 /*
  * Machine-dependent startup code
  */
@@ -1634,6 +1664,7 @@
 #endif
        switch (iospace) {
        case PCI_CONFIG_BUS_SPACE:
+       case PCI_IO_BUS_SPACE:
                pm_flags = PMAP_NC|PMAP_LITTLE;
                break;
        case PCI_MEMORY_BUS_SPACE:
@@ -1772,7 +1803,7 @@
 struct sparc_bus_space_tag mainbus_space_tag = {
        NULL,                           /* cookie */
        NULL,                           /* parent bus tag */
-       UPA_BUS_SPACE,                  /* type (ASI) */
+       UPA_BUS_SPACE,                  /* type */
        sparc_bus_map,                  /* bus_space_map */
        sparc_bus_unmap,                /* bus_space_unmap */
        NULL,                           /* bus_space_subregion */



Home | Main Index | Thread Index | Old Index