From 88ee2a8f42af3c407826d2520a9432467b8858b7 Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Sat, 25 Nov 2017 22:13:19 +0000 Subject: [PATCH] Allow platform modules to set the size of large pizes, as potentially discovered from firmware, and better handle highly-discontiguous memory and CPU maps. MFC after: 3 weeks --- sys/powerpc/aim/mmu_oea64.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index ba0f9792d1ac..39084aa64fbf 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -572,8 +572,10 @@ moea64_probe_large_page(void) /* FALLTHROUGH */ default: - moea64_large_page_size = 0x1000000; /* 16 MB */ - moea64_large_page_shift = 24; + if (moea64_large_page_size == 0) { + moea64_large_page_size = 0x1000000; /* 16 MB */ + moea64_large_page_shift = 24; + } } moea64_large_page_mask = moea64_large_page_size - 1; @@ -873,9 +875,9 @@ moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend /* * Calculate the last available physical address. */ + Maxmem = 0; for (i = 0; phys_avail[i + 2] != 0; i += 2) - ; - Maxmem = powerpc_btop(phys_avail[i + 1]); + Maxmem = max(Maxmem, powerpc_btop(phys_avail[i + 1])); /* * Initialize MMU and remap early physical mappings @@ -956,7 +958,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend pa += PAGE_SIZE; va += PAGE_SIZE; } - dpcpu_init(dpcpu, 0); + dpcpu_init(dpcpu, curcpu); /* * Allocate some things for page zeroing. We put this directly