arm64: Remove some redundant calculations from pmap_bootstrap{,_san1}()

No functional change intended.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
This commit is contained in:
Mark Johnston 2024-06-20 16:43:48 -04:00
parent f45213c74c
commit d03e1ffbea

View file

@ -1323,13 +1323,12 @@ pmap_bootstrap(vm_size_t kernlen)
min_pa = pmap_early_vtophys(KERNBASE);
physmap_idx = physmem_avail(physmap, nitems(physmap));
physmap_idx /= 2;
/*
* Find the minimum physical address. physmap is sorted,
* but may contain empty ranges.
*/
for (i = 0; i < physmap_idx * 2; i += 2) {
for (i = 0; i < physmap_idx; i += 2) {
if (physmap[i] == physmap[i + 1])
continue;
if (physmap[i] <= min_pa)
@ -1439,7 +1438,6 @@ pmap_bootstrap_san1(vm_offset_t va, int scale)
* allocation since pmap_bootstrap().
*/
physmap_idx = physmem_avail(physmap, nitems(physmap));
physmap_idx /= 2;
eva = va + (virtual_avail - VM_MIN_KERNEL_ADDRESS) / scale;
@ -1448,7 +1446,7 @@ pmap_bootstrap_san1(vm_offset_t va, int scale)
* the shadow map as high up as we can to avoid depleting the lower 4GB in case
* it's needed for, e.g., an xhci controller that can only do 32-bit DMA.
*/
for (i = (physmap_idx * 2) - 2; i >= 0; i -= 2) {
for (i = physmap_idx - 2; i >= 0; i -= 2) {
vm_paddr_t plow, phigh;
/* L2 mappings must be backed by memory that is L2-aligned */