Fix PPC970 boot after r348783

r348783 changed the behavior of the kernel mappings and broke booting on G5.

- Split the kernel mapping logic out so that the case where we are
running from the wrong memory space is handled using identity
mappings, and the case where we are not using a DMAP is handled by
forcibly mapping the kernel into the dmap range as intended by
r348783.

Reported by:	Mikael Urankar
Reviewed by:	luporl
Approved by:	jhibbits (mentor)
Differential Revision:	https://reviews.freebsd.org/D20608
This commit is contained in:
Brandon Bergren 2019-06-12 15:58:11 +00:00
parent fae5c36e4c
commit 664104b4af
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348994

View File

@ -684,8 +684,16 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernelstart,
* without a direct map or on which the kernel is not already executing
* out of the direct-mapped region.
*/
if (!hw_direct_map || kernelstart < DMAP_BASE_ADDRESS) {
if (kernelstart < DMAP_BASE_ADDRESS) {
/*
* For pre-dmap execution, we need to use identity mapping
* because we will be operating with the mmu on but in the
* wrong address configuration until we __restartkernel().
*/
for (pa = kernelstart & ~PAGE_MASK; pa < kernelend;
pa += PAGE_SIZE)
moea64_kenter(mmup, pa, pa);
} else if (!hw_direct_map) {
pkernelstart = kernelstart & ~DMAP_BASE_ADDRESS;
pkernelend = kernelend & ~DMAP_BASE_ADDRESS;
for (pa = pkernelstart & ~PAGE_MASK; pa < pkernelend;