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

This commit is contained in:
palle 2014-08-24 19:09:43 +00:00
parent f1503a8db0
commit 5f4732d296
2 changed files with 15 additions and 4 deletions

View File

@ -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_state *is, int tsbsize, uint32_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 == -1) {
is->is_dvmabase = IOTSB_VSTART(is->is_tsbsize);

View File

@ -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
*/