What to do when Redboot lies about REALMEM?

Adrian Chadd adrian.chadd at gmail.com
Thu Mar 10 02:41:53 UTC 2011


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 at pcbsd-3114 /data/freebsd/mips/head/src/sys]$


More information about the freebsd-mips mailing list