Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k/stand/boot Probe the actual memory size and wa...
details: https://anonhg.NetBSD.org/src/rev/e532c5cc4270
branches: trunk
changeset: 330359:e532c5cc4270
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jul 06 08:10:21 2014 +0000
description:
Probe the actual memory size and warn if it's different from SRAM value.
Without this, ancient X680x0 machines with a dead SRAM battery will
fail to boot silently (or hang right after early copyright messages).
Discussed with and reviewed by isaki@.
XXX: probably we should rather pass the probed memory size to a kernel
XXX: than the size value stored in SRAM..
diffstat:
sys/arch/x68k/stand/boot/boot.c | 35 +++++++++++++++++++++++++++++++++--
1 files changed, 33 insertions(+), 2 deletions(-)
diffs (69 lines):
diff -r 9fcfd205a954 -r e532c5cc4270 sys/arch/x68k/stand/boot/boot.c
--- a/sys/arch/x68k/stand/boot/boot.c Sun Jul 06 08:06:03 2014 +0000
+++ b/sys/arch/x68k/stand/boot/boot.c Sun Jul 06 08:10:21 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.20 2014/07/06 06:28:49 tsutsui Exp $ */
+/* $NetBSD: boot.c,v 1.21 2014/07/06 08:10:21 tsutsui Exp $ */
/*
* Copyright (c) 2001 Minoura Makoto
@@ -327,6 +327,23 @@
}
}
+static u_int
+checkmemsize(void)
+{
+ u_int m;
+
+#define MIN_MB 4
+#define MAX_MB 12
+
+ for (m = MIN_MB; m <= MAX_MB; m++) {
+ if (badbaddr((void *)(m * 1024 * 1024 - 1))) {
+ /* no memory */
+ break;
+ }
+ }
+
+ return (m - 1) * 1024 * 1024;
+}
extern const char bootprog_rev[];
extern const char bootprog_name[];
@@ -339,6 +356,8 @@
void
bootmain(int bootdev)
{
+ u_int sram_memsize;
+ u_int probed_memsize;
#ifndef NETBOOT
hostadaptor = get_scsi_host_adapter();
@@ -352,7 +371,8 @@
printf("This MPU cannot run NetBSD.\n");
exit(1);
}
- if (SRAM_MEMSIZE < 4*1024*1024) {
+ sram_memsize = SRAM_MEMSIZE;
+ if (sram_memsize < 4*1024*1024) {
printf("Main memory too small.\n");
exit(1);
}
@@ -383,5 +403,16 @@
}
#endif
print_title("%s, Revision %s\n", bootprog_name, bootprog_rev);
+
+ /* check actual memory size for machines with a dead SRAM battery */
+ probed_memsize = checkmemsize();
+ if (sram_memsize != probed_memsize) {
+ printf("\x1b[1mWarning: SRAM Memory Size (%d MB) "
+ "is different from probed Memory Size (%d MB)\n"
+ " Check and reset SRAM values.\x1b[m\n\n",
+ sram_memsize / (1024 * 1024),
+ probed_memsize / (1024 * 1024));
+ }
+
bootmenu();
}
Home |
Main Index |
Thread Index |
Old Index