From 4bc38523ecdd893cdc76b6d337f8d04dcaf32326 Mon Sep 17 00:00:00 2001 From: Thomas Moestl Date: Fri, 12 Oct 2001 15:49:51 +0000 Subject: [PATCH] Add pmap_kenter_flags(), which is used by MD bus code that will be committed soon, add a stub form pmap_kenter_temporary(), and implement pmap_extract() and pmap_kextract(). --- sys/sparc64/include/pmap.h | 3 +++ sys/sparc64/sparc64/pmap.c | 50 +++++++++++++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/sys/sparc64/include/pmap.h b/sys/sparc64/include/pmap.h index 6f12ab56b50e..90cf94f3dcde 100644 --- a/sys/sparc64/include/pmap.h +++ b/sys/sparc64/include/pmap.h @@ -66,6 +66,9 @@ struct pmap { void pmap_bootstrap(vm_offset_t skpa, vm_offset_t ekva); vm_offset_t pmap_kextract(vm_offset_t va); +void pmap_kenter_flags(vm_offset_t va, vm_offset_t pa, u_long flags); + +#define vtophys(va) pmap_kextract(((vm_offset_t) (va))) extern vm_offset_t avail_start; extern vm_offset_t avail_end; diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index f8e1aea5f90b..5db7d2f7560e 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -412,6 +412,39 @@ pmap_kenter(vm_offset_t va, vm_offset_t pa) stp->st_tte = tte; } +/* + * Map a wired page into kernel virtual address space. This additionally + * takes a flag argument wich is or'ed to the TTE data. This is used by + * bus_space_map(). + */ +void +pmap_kenter_flags(vm_offset_t va, vm_offset_t pa, u_long flags) +{ + struct stte *stp; + struct tte tte; + + tte.tte_tag = TT_CTX(TLB_CTX_KERNEL) | TT_VA(va); + if ((flags & TD_W) != 0) + flags |= TD_SW; + tte.tte_data = TD_V | TD_8K | TD_VA_LOW(va) | TD_PA(pa) | + TD_REF | TD_P | flags; + stp = tsb_kvtostte(va); + CTR4(KTR_PMAP, "pmap_kenter: va=%#lx pa=%#lx stp=%p data=%#lx", + va, pa, stp, stp->st_tte.tte_data); + stp->st_tte = tte; +} + +/* + * Make a temporary mapping for a physical address. This is only intended + * to be used for panic dumps. + */ +void * +pmap_kenter_temporary(vm_offset_t pa, int i) +{ + + TODO; +} + /* * Remove a wired page from kernel virtual address space. */ @@ -970,15 +1003,24 @@ pmap_zero_page_area(vm_offset_t pa, int off, int size) vm_offset_t pmap_extract(pmap_t pmap, vm_offset_t va) { - TODO; - return (0); + struct stte *stp; + + stp = tsb_stte_lookup(pmap, va); + if (stp == NULL) + return (0); + else + return (TD_PA(stp->st_tte.tte_data) | (va & PAGE_MASK)); } vm_offset_t pmap_kextract(vm_offset_t va) { - TODO; - return (0); + struct stte *stp; + + stp = tsb_kvtostte(va); + KASSERT((stp->st_tte.tte_data & TD_V) != 0, + ("pmap_kextract: invalid virtual address 0x%lx", va)); + return (TD_PA(stp->st_tte.tte_data) | (va & PAGE_MASK)); } int