Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_physmem.c
Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail, | ||||
uint64_t maxphyssz, long *pavail, long *prealmem) | uint64_t maxphyssz, long *pavail, long *prealmem) | ||||
{ | { | ||||
size_t acnt, exi, hwi; | size_t acnt, exi, hwi; | ||||
uint64_t adj, end, start, xend, xstart; | uint64_t adj, end, start, xend, xstart; | ||||
long availmem, totalmem; | long availmem, totalmem; | ||||
const struct region *exp, *hwp; | const struct region *exp, *hwp; | ||||
uint64_t availsz; | uint64_t availsz; | ||||
bzero(avail, maxavail * sizeof(vm_paddr_t)); | |||||
totalmem = 0; | totalmem = 0; | ||||
availmem = 0; | availmem = 0; | ||||
availsz = 0; | availsz = 0; | ||||
acnt = 0; | acnt = 0; | ||||
for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) { | for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) { | ||||
adj = round_page(hwp->addr) - hwp->addr; | adj = round_page(hwp->addr) - hwp->addr; | ||||
start = round_page(hwp->addr); | start = round_page(hwp->addr); | ||||
end = trunc_page(hwp->size + adj) + start; | end = trunc_page(hwp->size + adj) + start; | ||||
▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
vm_paddr_t avail_list[PHYS_AVAIL_COUNT]; | vm_paddr_t avail_list[PHYS_AVAIL_COUNT]; | ||||
rman_res_t start, end; | rman_res_t start, end; | ||||
int rid, i; | int rid, i; | ||||
rid = 0; | rid = 0; | ||||
/* Get the avail list. */ | /* Get the avail list. */ | ||||
bzero(avail_list, sizeof(avail_list)); | |||||
regions_to_avail(avail_list, EXFLAG_NOALLOC | EXFLAG_NODUMP, | regions_to_avail(avail_list, EXFLAG_NOALLOC | EXFLAG_NODUMP, | ||||
PHYS_AVAIL_COUNT, 0, NULL, NULL); | PHYS_AVAIL_COUNT, 0, NULL, NULL); | ||||
/* Reserve all memory regions. */ | /* Reserve all memory regions. */ | ||||
for (i = 0; avail_list[i + 1] != 0; i += 2) { | for (i = 0; avail_list[i + 1] != 0; i += 2) { | ||||
start = avail_list[i]; | start = avail_list[i]; | ||||
end = avail_list[i + 1]; | end = avail_list[i + 1]; | ||||
Show All 26 Lines |