summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt <matt@NetBSD.org>2011-06-29 23:15:55 +0000
committermatt <matt@NetBSD.org>2011-06-29 23:15:55 +0000
commitcc7b9f2ff73f2b6bd596a2db69d3f319668f39af (patch)
tree28babbccdf3d2b76de6d71d439bc8ee28d2db7bd
parent13736a8d443228e4d124790fc840ed69c02c3981 (diff)
Don't use TLB1 entries for device access if they are writethrough or not
cache-inhibited.
-rw-r--r--sys/arch/powerpc/booke/e500_tlb.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/arch/powerpc/booke/e500_tlb.c b/sys/arch/powerpc/booke/e500_tlb.c
index 902a03b9a50..911144f2a8e 100644
--- a/sys/arch/powerpc/booke/e500_tlb.c
+++ b/sys/arch/powerpc/booke/e500_tlb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: e500_tlb.c,v 1.5 2011/06/23 05:42:27 matt Exp $ */
+/* $NetBSD: e500_tlb.c,v 1.6 2011/06/29 23:15:55 matt Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.5 2011/06/23 05:42:27 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.6 2011/06/29 23:15:55 matt Exp $");
#include <sys/param.h>
@@ -689,9 +689,13 @@ e500_tlb_mapiodev(paddr_t pa, psize_t len)
/*
* See if we have a TLB entry for the pa. If completely falls within
- * mark the reference and return the pa.
+ * mark the reference and return the pa. But only if the tlb entry
+ * is not cacheable.
*/
- if (xtlb && pa + len <= xtlb->e_tlb.tlb_va + xtlb->e_tlb.tlb_size) {
+ if (xtlb
+ && pa + len <= xtlb->e_tlb.tlb_va + xtlb->e_tlb.tlb_size
+ && ((xtlb->e_tlb.tlb_pte & PTE_W) == 0
+ || (xtlb->e_tlb.tlb_pte & PTE_I) == PTE_I)) {
xtlb->e_refcnt++;
return (void *) pa;
}