summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-03-27 08:44:27 +0000
committeradrian <adrian@FreeBSD.org>2011-03-27 08:44:27 +0000
commitd780eed653d1e75874aa9b10dce0edb0321b2cdf (patch)
tree03d27a856e178c497b2e200047c0efad2a4039c2
parented6776603dc7dc939c7be2a36eb796773985d011 (diff)
downloadFreeBSD-src-d780eed653d1e75874aa9b10dce0edb0321b2cdf.zip
FreeBSD-src-d780eed653d1e75874aa9b10dce0edb0321b2cdf.tar.gz
Add an option - AR71XX_REALMEM - which overrides the amount of
memory detected from Redboot, or overrides the "otherwise" case if no Redboot information was found. Some AR71XX platforms don't use Redboot (eg TP-LINK devices using UBoot; some later Ubiquiti devices which apparently also use UBoot) and at least one plain out lies - the Ubiquiti LS-SR71A Redboot says there's 16mb of RAM when in fact there's 32mb. A more "clean" solution will be needed at a later date.
-rw-r--r--sys/conf/options6
-rw-r--r--sys/mips/atheros/ar71xx_machdep.c14
2 files changed, 20 insertions, 0 deletions
diff --git a/sys/conf/options b/sys/conf/options
index a507d69..145b33b 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -872,3 +872,9 @@ SDP opt_ofed.h
SDP_DEBUG opt_ofed.h
IPOIB_DEBUG opt_ofed.h
IPOIB_CM opt_ofed.h
+
+# At least one of the AR71XX ubiquiti boards has a Redboot configuration
+# that "lies" about the amount of RAM it has. Until a cleaner method is
+# defined, this option will suffice in overriding what Redboot says.
+AR71XX_REALMEM opt_global.h
+
diff --git a/sys/mips/atheros/ar71xx_machdep.c b/sys/mips/atheros/ar71xx_machdep.c
index c8abc74..3d98cda 100644
--- a/sys/mips/atheros/ar71xx_machdep.c
+++ b/sys/mips/atheros/ar71xx_machdep.c
@@ -180,6 +180,20 @@ platform_start(__register_t a0 __unused, __register_t a1 __unused,
if (realmem == 0)
realmem = btoc(32*1024*1024);
+ /*
+ * Allow build-time override in case Redboot lies
+ * or in other situations (eg where there's u-boot)
+ * where there isn't (yet) a convienent method of
+ * being told how much RAM is available.
+ *
+ * This happens on at least the Ubiquiti LS-SR71A
+ * board, where redboot says there's 16mb of RAM
+ * but in fact there's 32mb.
+ */
+#if defined(AR71XX_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);
OpenPOWER on IntegriCloud