Date: Thu, 10 Mar 2011 10:41:52 +0800 From: Adrian Chadd <adrian.chadd@gmail.com> To: freebsd-mips@freebsd.org Subject: What to do when Redboot lies about REALMEM? Message-ID: <AANLkTinL1bP5MOFf9JgZx8wWp-XNUW=-KUSw-RGE=BSi@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
One of the Ubiquiti boards (LS-SR71) has redboot firmware that seems to lie
about the amount of RAM it has.
Although the board has 32 megabytes of RAM, Redboot only reports 16mb. Linux
doesn't query redboot; it probes the amount of RAM by writing bits and
reading them back until it finds where that fails.
I've whacked together a quick hack to make this memory selection overridable
in the kernel configuration.
What would be the cleaner way? :)
Thanks,
Adrian
Index: conf/options
===================================================================
--- conf/options (revision 219395)
+++ conf/options (working copy)
@@ -30,6 +30,9 @@
# If filename is missing, the default is
# opt_<name-of-option-in-lower-case>.h
+# A temporary workaround for where redboot lies
+MIPS_REALMEM opt_global.h
+
AAC_DEBUG opt_aac.h
AHC_ALLOW_MEMIO opt_aic7xxx.h
AHC_TMODE_ENABLE opt_aic7xxx.h
Index: mips/atheros/ar71xx_machdep.c
===================================================================
--- mips/atheros/ar71xx_machdep.c (revision 219395)
+++ mips/atheros/ar71xx_machdep.c (working copy)
@@ -180,6 +180,11 @@
if (realmem == 0)
realmem = btoc(32*1024*1024);
+ /* Allow build-time override in case Redboot lies */
+#if defined(MIPS_REALMEM)
+ realmem = btoc(MIPS_REALMEM);
+#endif
+
/* phys_avail regions are in bytes */
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
[adrian@pcbsd-3114 /data/freebsd/mips/head/src/sys]$
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinL1bP5MOFf9JgZx8wWp-XNUW=-KUSw-RGE=BSi>
