From a7bebae1d583ab55734062f39090e1296fb9bb3b Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 12 Mar 2015 15:08:23 +0000 Subject: [PATCH] MFC 277713: If the boot-time memory test is enabled, output a dot ('.') for each GB of RAM tested so people watching the console can see that the machine is making progress and not hung. PR: 196650 git-svn-id: svn://svn.freebsd.org/base/stable/10@279921 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/amd64/amd64/machdep.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index b2d30ff3c..fc971872c 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1521,6 +1521,8 @@ static char bootmethod[16] = ""; SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0, "System firmware boot method"); +#define PAGES_PER_GB (1024 * 1024 * 1024 / PAGE_SIZE) + /* * Populate the (physmap) array with base/bound pairs describing the * available physical memory in the system, then test this memory and @@ -1541,6 +1543,7 @@ getmemsize(caddr_t kmdp, u_int64_t first) struct bios_smap *smapbase; struct efi_map_header *efihdr; quad_t dcons_addr, dcons_size; + int page_counter; bzero(physmap, sizeof(physmap)); basemem = 0; @@ -1651,6 +1654,9 @@ getmemsize(caddr_t kmdp, u_int64_t first) * physmap is in bytes, so when converting to page boundaries, * round up the start address and round down the end address. */ + page_counter = 0; + if (memtest != 0) + printf("Testing system memory"); for (i = 0; i <= physmap_idx; i += 2) { vm_paddr_t end; @@ -1680,6 +1686,14 @@ getmemsize(caddr_t kmdp, u_int64_t first) if (memtest == 0) goto skip_memtest; + /* + * Print a "." every GB to show we're making + * progress. + */ + page_counter++; + if ((page_counter % PAGES_PER_GB) == 0) + printf("."); + /* * map page into kernel: valid, read/write,non-cacheable */ @@ -1767,6 +1781,8 @@ getmemsize(caddr_t kmdp, u_int64_t first) } *pte = 0; invltlb(); + if (memtest != 0) + printf("\n"); /* * XXX -- 2.45.0