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 define 'struct iommureg2', that include...



details:   https://anonhg.NetBSD.org/src/rev/9d06af6aff8b
branches:  trunk
changeset: 763458:9d06af6aff8b
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Mar 20 20:42:06 2011 +0000

description:
define 'struct iommureg2', that includes the full set of regs for the
schizo and pyro iommu's.  use these in IOMMUREG().

add back IOMMUREG_READ() and IOMMUREG_WRITE() macros.

diffstat:

 sys/arch/sparc64/dev/iommureg.h |  39 +++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 6 deletions(-)

diffs (62 lines):

diff -r 5197b1d74127 -r 9d06af6aff8b sys/arch/sparc64/dev/iommureg.h
--- a/sys/arch/sparc64/dev/iommureg.h   Sun Mar 20 20:40:22 2011 +0000
+++ b/sys/arch/sparc64/dev/iommureg.h   Sun Mar 20 20:42:06 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iommureg.h,v 1.18 2011/03/16 05:49:43 mrg Exp $        */
+/*     $NetBSD: iommureg.h,v 1.19 2011/03/20 20:42:06 mrg Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -48,11 +48,26 @@
  * controllers.
  */
 
-/* iommmu registers */
+/*
+ * iommu registers - keep iommureg2 aligned with iommureg, so we can always
+ * use offsetof on iommureg2, regardless of the controller.
+ */
 struct iommureg {
-       uint64_t        iommu_cr;       /* IOMMU control register */
-       uint64_t        iommu_tsb;      /* IOMMU TSB base register */
-       uint64_t        iommu_flush;    /* IOMMU flush register */
+       volatile uint64_t       iommu_cr;       /* IOMMU control register */
+       volatile uint64_t       iommu_tsb;      /* IOMMU TSB base register */
+       volatile uint64_t       iommu_flush;    /* IOMMU flush register */
+};
+
+/* iommu registers for schizo and newer controllers.  */
+struct iommureg2 {
+       volatile uint64_t       iommu_cr;       /* IOMMU control register */
+       volatile uint64_t       iommu_tsb;      /* IOMMU TSB base register */
+       volatile uint64_t       iommu_flush;    /* IOMMU flush register */
+       volatile u_int64_t      iommu_ctxflush;
+       volatile u_int64_t      iommu_reserved[28];
+       volatile u_int64_t      iommu_cache_flush;
+       volatile u_int64_t      iommu_cache_invalidate;
+       volatile u_int64_t      iommu_reserved2[30];
 };
 
 /* streaming buffer registers */
@@ -62,8 +77,20 @@
        uint64_t        strbuf_flushsync;/* streaming buffer flush sync */
 };
 
-#define        IOMMUREG(x)     (offsetof(struct iommureg, x))
+#define        IOMMUREG(x)     (offsetof(struct iommureg2, x))
 #define        STRBUFREG(x)    (offsetof(struct iommu_strbuf, x))
+
+#define IOMMUREG_READ(is, reg)                         \
+       bus_space_read_8((is)->is_bustag,               \
+               (is)->is_iommu,                         \
+               IOMMUREG(reg))  
+
+#define IOMMUREG_WRITE(is, reg, v)                     \
+       bus_space_write_8((is)->is_bustag,              \
+               (is)->is_iommu,                         \
+               IOMMUREG(reg),                          \
+               (v))
+
 /* streaming buffer control register */
 #define STRBUF_EN      0x000000000000000001LL
 #define STRBUF_D       0x000000000000000002LL



Home | Main Index | Thread Index | Old Index