summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2008-08-02 03:43:54 +0000
committeralc <alc@FreeBSD.org>2008-08-02 03:43:54 +0000
commita59aadb8d676bfb26dd7f5f8f11db083f37ad18d (patch)
tree51f2a18cab63b8c7bd5e05341c9325488593d697 /sys/amd64
parente0b5c971c2aa4250126a8dab9c31bf0c6495e746 (diff)
downloadFreeBSD-src-a59aadb8d676bfb26dd7f5f8f11db083f37ad18d.zip
FreeBSD-src-a59aadb8d676bfb26dd7f5f8f11db083f37ad18d.tar.gz
Enhance pmap_mapdev_attr(). Take advantage of recent enhancements to
pmap_change_attr() in order to use the direct map for any cache mode, not just write-back mode. It is worth noting that this change also eliminates a situation in which we have two mappings to the same physical memory with different cache modes. Submitted by: Magesh Dhasayyan (with some changes by me) Discussed with: jhb
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 4d18f40..cc40152 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4305,11 +4305,14 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, int mode)
vm_offset_t va, tmpva, offset;
/*
- * If this fits within the direct map window and use WB caching
- * mode, use the direct map.
+ * If the specified range of physical addresses fits within the direct
+ * map window, use the direct map.
*/
- if (pa < dmaplimit && (pa + size) < dmaplimit && mode == PAT_WRITE_BACK)
- return ((void *)PHYS_TO_DMAP(pa));
+ if (pa < dmaplimit && pa + size < dmaplimit) {
+ va = PHYS_TO_DMAP(pa);
+ if (!pmap_change_attr(va, size, mode))
+ return ((void *)va);
+ }
offset = pa & PAGE_MASK;
size = roundup(offset + size, PAGE_SIZE);
va = kmem_alloc_nofault(kernel_map, size);
OpenPOWER on IntegriCloud