summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-08-17 20:46:51 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-08-17 20:46:51 +0000
commitc3601d5861a5e8e211a96d2fd1b12be9d55fcbe7 (patch)
treecdbbb6eba56f28922bfc8bf9985a7731d7768a3a
parent795c9e7e841224f48581c52e1043a450f43efe02 (diff)
Properly initialize the IOMMU control and status register for pyro(4).
Fixes DMA problems spotted on the v445.
-rw-r--r--sys/arch/sparc64/dev/iommu.c10
-rw-r--r--sys/arch/sparc64/dev/iommureg.h7
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c
index 2b9de41917e..41d347fb823 100644
--- a/sys/arch/sparc64/dev/iommu.c
+++ b/sys/arch/sparc64/dev/iommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommu.c,v 1.64 2011/05/18 23:36:31 ariane Exp $ */
+/* $OpenBSD: iommu.c,v 1.65 2012/08/17 20:46:50 kettenis Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -149,7 +149,13 @@ iommu_init(char *name, struct iommu_state *is, int tsbsize, u_int32_t iovabase)
* be hard-wired, so we read the start and size from the PROM and
* just use those values.
*/
- is->is_cr = IOMMUCR_EN;
+ if (strncmp(name, "pyro", 4) == 0) {
+ is->is_cr = IOMMUREG_READ(is, iommu_cr);
+ is->is_cr &= ~IOMMUCR_FIRE_BE;
+ is->is_cr |= (IOMMUCR_FIRE_SE | IOMMUCR_FIRE_CM_EN |
+ IOMMUCR_FIRE_TE);
+ } else
+ is->is_cr = IOMMUCR_EN;
is->is_tsbsize = tsbsize;
if (iovabase == (u_int32_t)-1) {
is->is_dvmabase = IOTSB_VSTART(is->is_tsbsize);
diff --git a/sys/arch/sparc64/dev/iommureg.h b/sys/arch/sparc64/dev/iommureg.h
index 153c058cf36..db1b0671dbe 100644
--- a/sys/arch/sparc64/dev/iommureg.h
+++ b/sys/arch/sparc64/dev/iommureg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommureg.h,v 1.16 2008/07/12 13:08:04 kettenis Exp $ */
+/* $OpenBSD: iommureg.h,v 1.17 2012/08/17 20:46:50 kettenis Exp $ */
/* $NetBSD: iommureg.h,v 1.6 2001/07/20 00:07:13 eeh Exp $ */
/*
@@ -90,6 +90,11 @@ struct iommu_strbuf {
#define IOMMUCR_DE 0x000000000000000002LL /* Diag enable */
#define IOMMUCR_EN 0x000000000000000001LL /* Enable IOMMU */
+#define IOMMUCR_FIRE_SE 0x000000000000000400LL /* Snoop enable */
+#define IOMMUCR_FIRE_CM_EN 0x000000000000000300LL /* Cache mode enable */
+#define IOMMUCR_FIRE_BE 0x000000000000000002LL /* Bypass enable */
+#define IOMMUCR_FIRE_TE 0x000000000000000001LL /* Translation enabled */
+
/*
* IOMMU stuff
*/