powerpc aim64: Return vm_paddr_t from moea64_bootstrap_alloc
Consistently use vm_paddr_t for the type returned from moea64_bootstrap_alloc and avoid temporarily smuggling it via a pointer. Instead, be explicit in the places that assume a 1:1 mapping. Effort: CHERI upstreaming Reviewed by: kib Sponsored by: AFRL, DARPA Pull Request: https://github.com/freebsd/freebsd-src/pull/2068
This commit is contained in:
@@ -1022,6 +1022,7 @@ moea64_early_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend)
|
||||
void
|
||||
moea64_mid_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend)
|
||||
{
|
||||
vm_paddr_t pa;
|
||||
int i;
|
||||
|
||||
/*
|
||||
@@ -1054,14 +1055,15 @@ moea64_mid_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend)
|
||||
moea64_bpvo_pool_size*sizeof(struct pvo_entry) / 1048576);
|
||||
}
|
||||
|
||||
moea64_bpvo_pool = (struct pvo_entry *)moea64_bootstrap_alloc(
|
||||
moea64_bpvo_pool_size*sizeof(struct pvo_entry), PAGE_SIZE);
|
||||
pa = moea64_bootstrap_alloc(
|
||||
moea64_bpvo_pool_size * sizeof(struct pvo_entry), PAGE_SIZE);
|
||||
moea64_bpvo_pool_index = 0;
|
||||
|
||||
/* Place at address usable through the direct map */
|
||||
if (hw_direct_map)
|
||||
moea64_bpvo_pool = (struct pvo_entry *)
|
||||
PHYS_TO_DMAP((uintptr_t)moea64_bpvo_pool);
|
||||
moea64_bpvo_pool = (struct pvo_entry *)PHYS_TO_DMAP(pa);
|
||||
else
|
||||
moea64_bpvo_pool = (struct pvo_entry *)pa;
|
||||
|
||||
/*
|
||||
* Make sure kernel vsid is allocated as well as VSID 0.
|
||||
@@ -1106,7 +1108,8 @@ moea64_late_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend)
|
||||
phandle_t mmu;
|
||||
ssize_t sz;
|
||||
int i;
|
||||
vm_offset_t pa, va;
|
||||
vm_paddr_t pa;
|
||||
vm_offset_t va;
|
||||
void *dpcpu;
|
||||
|
||||
/*
|
||||
@@ -2805,10 +2808,10 @@ moea64_remove_all(vm_page_t m)
|
||||
* Can only be called from moea64_bootstrap before avail start and end are
|
||||
* calculated.
|
||||
*/
|
||||
vm_offset_t
|
||||
vm_paddr_t
|
||||
moea64_bootstrap_alloc(vm_size_t size, vm_size_t align)
|
||||
{
|
||||
vm_offset_t s, e;
|
||||
vm_paddr_t s, e;
|
||||
int i, j;
|
||||
|
||||
size = round_page(size);
|
||||
|
||||
@@ -46,7 +46,7 @@ extern const struct mmu_kobj oea64_mmu;
|
||||
*/
|
||||
|
||||
/* Allocate physical memory for use in moea64_bootstrap. */
|
||||
vm_offset_t moea64_bootstrap_alloc(vm_size_t size, vm_size_t align);
|
||||
vm_paddr_t moea64_bootstrap_alloc(vm_size_t size, vm_size_t align);
|
||||
/* Set an LPTE structure to match the contents of a PVO */
|
||||
void moea64_pte_from_pvo(const struct pvo_entry *pvo, struct lpte *lpte);
|
||||
|
||||
|
||||
@@ -893,7 +893,7 @@ pagezero(vm_offset_t va)
|
||||
static uint64_t
|
||||
allocpages(int n)
|
||||
{
|
||||
u_int64_t ret;
|
||||
vm_paddr_t ret;
|
||||
|
||||
ret = moea64_bootstrap_alloc(n * PAGE_SIZE, PAGE_SIZE);
|
||||
for (int i = 0; i < n; i++)
|
||||
|
||||
@@ -608,17 +608,16 @@ moea64_bootstrap_native(vm_offset_t kernelstart, vm_offset_t kernelend)
|
||||
* its own size. Pick the larger of the two, which works on all
|
||||
* systems.
|
||||
*/
|
||||
moea64_pteg_table = (struct lpte *)moea64_bootstrap_alloc(size,
|
||||
MAX(256*1024, size));
|
||||
pa = moea64_bootstrap_alloc(size, MAX(256*1024, size));
|
||||
if (hw_direct_map)
|
||||
moea64_pteg_table =
|
||||
(struct lpte *)PHYS_TO_DMAP((vm_offset_t)moea64_pteg_table);
|
||||
moea64_pteg_table = (struct lpte *)PHYS_TO_DMAP(pa);
|
||||
else
|
||||
moea64_pteg_table = (struct lpte *)pa;
|
||||
|
||||
/* Allocate partition table (ISA 3.0). */
|
||||
if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) {
|
||||
moea64_part_table =
|
||||
(struct pate *)moea64_bootstrap_alloc(PART_SIZE, PART_SIZE);
|
||||
moea64_part_table =
|
||||
(struct pate *)PHYS_TO_DMAP((vm_offset_t)moea64_part_table);
|
||||
pa = moea64_bootstrap_alloc(PART_SIZE, PART_SIZE);
|
||||
moea64_part_table = (struct pate *)PHYS_TO_DMAP(pa);
|
||||
}
|
||||
DISABLE_TRANS(msr);
|
||||
bzero(__DEVOLATILE(void *, moea64_pteg_table), moea64_pteg_count *
|
||||
|
||||
Reference in New Issue
Block a user