RISC-V: Announce real and available memory at boot

Most architectures print their total (real) and available memory during
boot. Properly initialize the realmem global and print these messages.
Also print the physical memory chunks (behind a bootverbose flag).

Reviewed by:	markj
Approved by:	markj (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D20496
This commit is contained in:
Mitchell Horne 2019-06-09 15:48:36 +00:00
parent 93ca8057c5
commit bffa317ff2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348838
2 changed files with 29 additions and 0 deletions

View File

@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysproto.h>
#include <sys/tslog.h>
#include <sys/ucontext.h>
#include <sys/vmmeter.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
@ -140,7 +141,34 @@ cpu_startup(void *dummy)
identify_cpu();
printf("real memory = %ju (%ju MB)\n", ptoa((uintmax_t)realmem),
ptoa((uintmax_t)realmem) / (1024 * 1024));
/*
* Display any holes after the first chunk of extended memory.
*/
if (bootverbose) {
int indx;
printf("Physical memory chunk(s):\n");
for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
vm_paddr_t size;
size = phys_avail[indx + 1] - phys_avail[indx];
printf(
"0x%016jx - 0x%016jx, %ju bytes (%ju pages)\n",
(uintmax_t)phys_avail[indx],
(uintmax_t)phys_avail[indx + 1] - 1,
(uintmax_t)size, (uintmax_t)size / PAGE_SIZE);
}
}
vm_ksubmap_init(&kmi);
printf("avail memory = %ju (%ju MB)\n",
ptoa((uintmax_t)vm_free_count()),
ptoa((uintmax_t)vm_free_count()) / (1024 * 1024));
bufinit();
vm_pager_bufferinit();
}

View File

@ -640,6 +640,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, vm_size_t kernlen)
continue;
dump_avail[map_slot] = start;
dump_avail[map_slot + 1] = end;
realmem += atop((vm_offset_t)(end - start));
if (start >= kernstart && end <= pa)
continue;