Module Name:    src
Committed By:   palle
Date:           Sun Aug 24 19:09:43 UTC 2014

Modified Files:
        src/sys/arch/sparc64/dev: iommu.c iommureg.h

Log Message:
Initialize IOMMU control and status register properly - from OpenBSD - ok mrg@


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/sparc64/dev/iommu.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc64/dev/iommureg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/dev/iommu.c
diff -u src/sys/arch/sparc64/dev/iommu.c:1.107 src/sys/arch/sparc64/dev/iommu.c:1.108
--- src/sys/arch/sparc64/dev/iommu.c:1.107	Sun Mar 25 03:51:33 2012
+++ src/sys/arch/sparc64/dev/iommu.c	Sun Aug 24 19:09:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommu.c,v 1.107 2012/03/25 03:51:33 mrg Exp $	*/
+/*	$NetBSD: iommu.c,v 1.108 2014/08/24 19:09:43 palle Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.107 2012/03/25 03:51:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.108 2014/08/24 19:09:43 palle Exp $");
 
 #include "opt_ddb.h"
 
@@ -134,7 +134,13 @@ iommu_init(char *name, struct iommu_stat
 	 * 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 == -1) {
 		is->is_dvmabase = IOTSB_VSTART(is->is_tsbsize);

Index: src/sys/arch/sparc64/dev/iommureg.h
diff -u src/sys/arch/sparc64/dev/iommureg.h:1.19 src/sys/arch/sparc64/dev/iommureg.h:1.20
--- src/sys/arch/sparc64/dev/iommureg.h:1.19	Sun Mar 20 20:42:06 2011
+++ src/sys/arch/sparc64/dev/iommureg.h	Sun Aug 24 19:09:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommureg.h,v 1.19 2011/03/20 20:42:06 mrg Exp $	*/
+/*	$NetBSD: iommureg.h,v 1.20 2014/08/24 19:09:43 palle Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -110,6 +110,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
  */

Reply via email to