summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-07-25 23:29:55 +0000
committerian <ian@FreeBSD.org>2014-07-25 23:29:55 +0000
commit67c03a114548247f909c9d105e699826613d2ebe (patch)
treeefba872fbd4f25ce8526fc789338f2171bd01bdf /sys/arm
parent0adc7b49f4bf6aacff060b6e571f815c7d7252d3 (diff)
downloadFreeBSD-src-67c03a114548247f909c9d105e699826613d2ebe.zip
FreeBSD-src-67c03a114548247f909c9d105e699826613d2ebe.tar.gz
MFC r266565, r266651:
Map device memory using PTE_DEVICE attributes, and also ensure that the shared flag is set on normal-memory mappings made via pmap_kenter() for SMP. The "shared flag" part of this change isn't obvious from the diff, here's the deal... by using the array of preformatted page table entry templates instead of constructing the PTE from scratch, we automatically get the right attribute bits set for both caching and shared. Fix whitespace glitches.
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/arm/pmap-v6.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c
index e89b70b..2690092 100644
--- a/sys/arm/arm/pmap-v6.c
+++ b/sys/arm/arm/pmap-v6.c
@@ -381,7 +381,8 @@ struct l2_dtable {
/* pmap_kenter_internal flags */
#define KENTER_CACHE 0x1
-#define KENTER_USER 0x2
+#define KENTER_DEVICE 0x2
+#define KENTER_USER 0x4
/*
* Given an L1 table index, calculate the corresponding l2_dtable index
@@ -2401,12 +2402,17 @@ pmap_kenter_internal(vm_offset_t va, vm_offset_t pa, int flags)
ptep = &l2b->l2b_kva[l2pte_index(va)];
opte = *ptep;
+ if (flags & KENTER_CACHE)
+ *ptep = L2_S_PROTO | l2s_mem_types[PTE_CACHE] | pa | L2_S_REF;
+ else if (flags & KENTER_DEVICE)
+ *ptep = L2_S_PROTO | l2s_mem_types[PTE_DEVICE] | pa | L2_S_REF;
+ else
+ *ptep = L2_S_PROTO | l2s_mem_types[PTE_NOCACHE] | pa | L2_S_REF;
+
if (flags & KENTER_CACHE) {
- *ptep = L2_S_PROTO | pa | pte_l2_s_cache_mode | L2_S_REF;
pmap_set_prot(ptep, VM_PROT_READ | VM_PROT_WRITE,
flags & KENTER_USER);
} else {
- *ptep = L2_S_PROTO | pa | L2_S_REF;
pmap_set_prot(ptep, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE,
0);
}
@@ -2444,11 +2450,7 @@ void
pmap_kenter_device(vm_offset_t va, vm_paddr_t pa)
{
- /*
- * XXX - Need a way for kenter_internal to handle PTE_DEVICE mapping as
- * a potentially different thing than PTE_NOCACHE.
- */
- pmap_kenter_internal(va, pa, 0);
+ pmap_kenter_internal(va, pa, KENTER_DEVICE);
}
void
OpenPOWER on IntegriCloud