From 9f5b999acafbe8936206ecdc10be2f0e4dd0a536 Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Tue, 3 Apr 2018 00:45:38 +0000 Subject: [PATCH] Add support for a pmap direct map for 64-bit Book-E As with AIM64, map the DMAP at the beginning of the fourth "quadrant" of memory, and move the KERNBASE to the the start of KVA. Eventually we may run the kernel out of the DMAP, but for now, continue booting as it has been. --- sys/powerpc/booke/pmap.c | 13 +++++++++++++ sys/powerpc/include/vmparam.h | 9 ++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index f5f1b2082b8..c9c9d15f9f2 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -1724,7 +1724,11 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend) debugf("mmu_booke_bootstrap: entered\n"); /* Set interesting system properties */ +#ifdef __powerpc64__ + hw_direct_map = 1; +#else hw_direct_map = 0; +#endif #if defined(COMPAT_FREEBSD32) || !defined(__powerpc64__) elf32_nxstack = 1; #endif @@ -1971,6 +1975,15 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend) debugf("physsz = 0x%09jx physmem = %jd (0x%09jx)\n", (uintmax_t)physsz, (uintmax_t)physmem, (uintmax_t)physmem); +#ifdef __powerpc64__ + /* + * Map the physical memory contiguously in TLB1. + * Round so it fits into a single mapping. + */ + tlb1_mapin_region(DMAP_BASE_ADDRESS, 0, + phys_avail[i + 1]); +#endif + /*******************************************************/ /* Initialize (statically allocated) kernel pmap. */ /*******************************************************/ diff --git a/sys/powerpc/include/vmparam.h b/sys/powerpc/include/vmparam.h index 60119cfc25d..4d3b069c5db 100644 --- a/sys/powerpc/include/vmparam.h +++ b/sys/powerpc/include/vmparam.h @@ -106,13 +106,8 @@ #define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE #ifdef __powerpc64__ -#ifdef AIM #define VM_MIN_KERNEL_ADDRESS 0xe000000000000000UL #define VM_MAX_KERNEL_ADDRESS 0xe0000001c7ffffffUL -#else -#define VM_MIN_KERNEL_ADDRESS 0xc000000000000000UL -#define VM_MAX_KERNEL_ADDRESS 0xc0000001c7ffffffUL -#endif #define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS #endif @@ -135,9 +130,9 @@ #ifdef __powerpc64__ #ifndef LOCORE -#define KERNBASE 0xc000000000000100UL /* start of kernel virtual */ +#define KERNBASE 0xe000000000000100UL /* start of kernel virtual */ #else -#define KERNBASE 0xc000000000000100 /* start of kernel virtual */ +#define KERNBASE 0xe000000000000100 /* start of kernel virtual */ #endif #else #define KERNBASE 0xc0000000 /* start of kernel virtual */