mmu_oea64.c (212627) | mmu_oea64.c (212715) |
---|---|
1/*- 2 * Copyright (c) 2001 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Matt Thomas <matt@3am-software.com> of Allegro Networks, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 77 unchanged lines hidden (view full) --- 86 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 87 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 88 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 89 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 90 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 91 */ 92 93#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Matt Thomas <matt@3am-software.com> of Allegro Networks, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 77 unchanged lines hidden (view full) --- 86 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 87 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 88 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 89 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 90 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 91 */ 92 93#include <sys/cdefs.h> |
94__FBSDID("$FreeBSD: head/sys/powerpc/aim/mmu_oea64.c 212627 2010-09-15 00:17:52Z grehan $"); | 94__FBSDID("$FreeBSD: head/sys/powerpc/aim/mmu_oea64.c 212715 2010-09-16 00:22:25Z nwhitehorn $"); |
95 96/* 97 * Manages physical address maps. 98 * 99 * In addition to hardware address maps, this module is called upon to 100 * provide software-use-only maps which may or may not be stored in the 101 * same form as hardware maps. These pseudo-maps are used to store 102 * intermediate results from copy operations to and from address spaces. --- 1989 unchanged lines hidden (view full) --- 2092} 2093 2094#ifdef __powerpc64__ 2095void 2096moea64_pinit(mmu_t mmu, pmap_t pmap) 2097{ 2098 PMAP_LOCK_INIT(pmap); 2099 | 95 96/* 97 * Manages physical address maps. 98 * 99 * In addition to hardware address maps, this module is called upon to 100 * provide software-use-only maps which may or may not be stored in the 101 * same form as hardware maps. These pseudo-maps are used to store 102 * intermediate results from copy operations to and from address spaces. --- 1989 unchanged lines hidden (view full) --- 2092} 2093 2094#ifdef __powerpc64__ 2095void 2096moea64_pinit(mmu_t mmu, pmap_t pmap) 2097{ 2098 PMAP_LOCK_INIT(pmap); 2099 |
2100 SPLAY_INIT(&pmap->pm_slbtree); | 2100 pmap->pm_slb_tree_root = slb_alloc_tree(); |
2101 pmap->pm_slb = slb_alloc_user_cache(); 2102} 2103#else 2104void 2105moea64_pinit(mmu_t mmu, pmap_t pmap) 2106{ 2107 int i; 2108 uint32_t hash; --- 138 unchanged lines hidden (view full) --- 2247void 2248moea64_release(mmu_t mmu, pmap_t pmap) 2249{ 2250 2251 /* 2252 * Free segment registers' VSIDs 2253 */ 2254 #ifdef __powerpc64__ | 2101 pmap->pm_slb = slb_alloc_user_cache(); 2102} 2103#else 2104void 2105moea64_pinit(mmu_t mmu, pmap_t pmap) 2106{ 2107 int i; 2108 uint32_t hash; --- 138 unchanged lines hidden (view full) --- 2247void 2248moea64_release(mmu_t mmu, pmap_t pmap) 2249{ 2250 2251 /* 2252 * Free segment registers' VSIDs 2253 */ 2254 #ifdef __powerpc64__ |
2255 free_vsids(pmap); | 2255 slb_free_tree(pmap); |
2256 slb_free_user_cache(pmap->pm_slb); 2257 #else 2258 KASSERT(pmap->pm_sr[0] != 0, ("moea64_release: pm_sr[0] = 0")); 2259 2260 moea64_release_vsid(VSID_TO_HASH(pmap->pm_sr[0])); 2261 #endif 2262 2263 PMAP_LOCK_DESTROY(pmap); --- 353 unchanged lines hidden (view full) --- 2617 2618static struct pvo_entry * 2619moea64_pvo_find_va(pmap_t pm, vm_offset_t va) 2620{ 2621 struct pvo_entry *pvo; 2622 int ptegidx; 2623 uint64_t vsid; 2624 #ifdef __powerpc64__ | 2256 slb_free_user_cache(pmap->pm_slb); 2257 #else 2258 KASSERT(pmap->pm_sr[0] != 0, ("moea64_release: pm_sr[0] = 0")); 2259 2260 moea64_release_vsid(VSID_TO_HASH(pmap->pm_sr[0])); 2261 #endif 2262 2263 PMAP_LOCK_DESTROY(pmap); --- 353 unchanged lines hidden (view full) --- 2617 2618static struct pvo_entry * 2619moea64_pvo_find_va(pmap_t pm, vm_offset_t va) 2620{ 2621 struct pvo_entry *pvo; 2622 int ptegidx; 2623 uint64_t vsid; 2624 #ifdef __powerpc64__ |
2625 struct slb slb; | 2625 uint64_t slbv; |
2626 | 2626 |
2627 /* The page is not mapped if the segment isn't */ 2628 if (va_to_slb_entry(pm, va, &slb) != 0) 2629 return NULL; | 2627 if (pm == kernel_pmap) { 2628 slbv = kernel_va_to_slbv(va); 2629 } else { 2630 struct slb *slb; 2631 slb = user_va_to_slb_entry(pm, va); 2632 /* The page is not mapped if the segment isn't */ 2633 if (slb == NULL) 2634 return NULL; 2635 slbv = slb->slbv; 2636 } |
2630 | 2637 |
2631 vsid = (slb.slbv & SLBV_VSID_MASK) >> SLBV_VSID_SHIFT; 2632 if (slb.slbv & SLBV_L) | 2638 vsid = (slbv & SLBV_VSID_MASK) >> SLBV_VSID_SHIFT; 2639 if (slbv & SLBV_L) |
2633 va &= ~moea64_large_page_mask; 2634 else 2635 va &= ~ADDR_POFF; | 2640 va &= ~moea64_large_page_mask; 2641 else 2642 va &= ~ADDR_POFF; |
2636 ptegidx = va_to_pteg(vsid, va, slb.slbv & SLBV_L); | 2643 ptegidx = va_to_pteg(vsid, va, slbv & SLBV_L); |
2637 #else 2638 va &= ~ADDR_POFF; 2639 vsid = va_to_vsid(pm, va); 2640 ptegidx = va_to_pteg(vsid, va, 0); 2641 #endif 2642 2643 LOCK_TABLE(); 2644 LIST_FOREACH(pvo, &moea64_pvo_table[ptegidx], pvo_olink) { --- 384 unchanged lines hidden --- | 2644 #else 2645 va &= ~ADDR_POFF; 2646 vsid = va_to_vsid(pm, va); 2647 ptegidx = va_to_pteg(vsid, va, 0); 2648 #endif 2649 2650 LOCK_TABLE(); 2651 LIST_FOREACH(pvo, &moea64_pvo_table[ptegidx], pvo_olink) { --- 384 unchanged lines hidden --- |