Pass the array length into regions_to_avail.

On arm64 we will need to get the phys_avail array from before the kernel
is excluded to create teh DMAP region. In preperation for this pass in the
array length into regions_to_avail.
This commit is contained in:
Andrew Turner 2018-05-22 14:26:58 +00:00
parent 82a4284d4b
commit 3a327967cc

View File

@ -168,8 +168,8 @@ arm_physmem_print_tables(void)
* Returns the number of pages of non-excluded memory added to the avail list.
*/
static size_t
regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail,
long *prealmem)
regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail,
long *pavail, long *prealmem)
{
size_t acnt, exi, hwi;
uint64_t end, start, xend, xstart;
@ -258,7 +258,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail,
}
availmem += pm_btop((vm_offset_t)(end - start));
}
if (acnt >= MAX_AVAIL_ENTRIES)
if (acnt >= maxavail)
panic("Not enough space in the dump/phys_avail arrays");
}
@ -389,9 +389,10 @@ arm_physmem_init_kernel_globals(void)
{
size_t nextidx;
regions_to_avail(dump_avail, EXFLAG_NODUMP, NULL, NULL);
nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, &physmem,
&realmem);
regions_to_avail(dump_avail, EXFLAG_NODUMP, MAX_AVAIL_ENTRIES, NULL,
NULL);
nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC,
MAX_AVAIL_ENTRIES, &physmem, &realmem);
if (nextidx == 0)
panic("No memory entries in phys_avail");
Maxmem = atop(phys_avail[nextidx - 1]);