From 218fd301cd4a4a0fe19466109e43e5232d1ea95b Mon Sep 17 00:00:00 2001 From: Jake Burkholder Date: Tue, 25 Jun 2002 15:13:09 +0000 Subject: [PATCH] pmap_kremove can no longer be used to remove the magic device mappings installed with pmap_kenter_flags, since the physical addresses may not have an associated vm_page. Add a function to do this. Tested by: Tomi Vainio --- sys/sparc64/include/pmap.h | 1 + sys/sparc64/sparc64/bus_machdep.c | 2 +- sys/sparc64/sparc64/pmap.c | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/sparc64/include/pmap.h b/sys/sparc64/include/pmap.h index d347fc84a260..1a8803ad4b4d 100644 --- a/sys/sparc64/include/pmap.h +++ b/sys/sparc64/include/pmap.h @@ -76,6 +76,7 @@ void pmap_bootstrap(vm_offset_t ekva); void pmap_context_rollover(void); vm_offset_t pmap_kextract(vm_offset_t va); void pmap_kenter_flags(vm_offset_t va, vm_offset_t pa, u_long flags); +void pmap_kremove_flags(vm_offset_t va); void pmap_qenter_flags(vm_offset_t va, vm_page_t *m, int count, u_long fl); int pmap_cache_enter(vm_page_t m, vm_offset_t va); diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c index ab53c8a09acd..897e04d36b6d 100644 --- a/sys/sparc64/sparc64/bus_machdep.c +++ b/sys/sparc64/sparc64/bus_machdep.c @@ -580,7 +580,7 @@ sparc64_bus_mem_unmap(void *bh, bus_size_t size) sva = trunc_page((vm_offset_t)bh); endva = sva + round_page(size); for (va = sva; va < endva; va += PAGE_SIZE) - pmap_kremove(va); + pmap_kremove_flags(va); tlb_range_demap(kernel_pmap, sva, sva + size - 1); kmem_free(kernel_map, sva, size); return (0); diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index 97f085e09037..6df4225d1e82 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -717,6 +717,20 @@ pmap_kremove(vm_offset_t va) TTE_ZERO(tp); } +/* + * Inverse of pmap_kenter_flags, used by bus_space_unmap(). + */ +void +pmap_kremove_flags(vm_offset_t va) +{ + struct tte *tp; + + tp = tsb_kvtotte(va); + CTR3(KTR_PMAP, "pmap_kremove: va=%#lx tp=%p data=%#lx", va, tp, + tp->tte_data); + TTE_ZERO(tp); +} + /* * Map a range of physical addresses into kernel virtual address space. *