svn commit: r348838 - head/sys/riscv/riscv
Mitchell Horne
mhorne at FreeBSD.org
Sun Jun 9 15:48:38 UTC 2019
Author: mhorne
Date: Sun Jun 9 15:48:36 2019
New Revision: 348838
URL: https://svnweb.freebsd.org/changeset/base/348838
Log:
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
Modified:
head/sys/riscv/riscv/machdep.c
head/sys/riscv/riscv/pmap.c
Modified: head/sys/riscv/riscv/machdep.c
==============================================================================
--- head/sys/riscv/riscv/machdep.c Sun Jun 9 15:45:48 2019 (r348837)
+++ head/sys/riscv/riscv/machdep.c Sun Jun 9 15:48:36 2019 (r348838)
@@ -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();
}
Modified: head/sys/riscv/riscv/pmap.c
==============================================================================
--- head/sys/riscv/riscv/pmap.c Sun Jun 9 15:45:48 2019 (r348837)
+++ head/sys/riscv/riscv/pmap.c Sun Jun 9 15:48:36 2019 (r348838)
@@ -640,6 +640,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart,
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;
More information about the svn-src-all
mailing list