free memory below kernel offset
authorFlorian Fainelli <florian@openwrt.org>
Sun, 11 Nov 2012 16:11:00 +0000 (16:11 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 11 Nov 2012 16:11:00 +0000 (16:11 +0000)
Some bootloaders (e.g. PSPBoot on AC49x) have a load-offset, this frees that
memory region so it is usable for Linux.

Signed-off-by: Daniel Golle <dgolle@allnet.de>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
SVN-Revision: 34143

target/linux/ar7/patches-3.3/200-free-mem-below-kernel-offset.patch [new file with mode: 0644]

diff --git a/target/linux/ar7/patches-3.3/200-free-mem-below-kernel-offset.patch b/target/linux/ar7/patches-3.3/200-free-mem-below-kernel-offset.patch
new file mode 100644 (file)
index 0000000..399822a
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/arch/mips/ar7/memory.c
++++ b/arch/mips/ar7/memory.c
+@@ -67,5 +67,11 @@ void __init prom_meminit(void)
+ void __init prom_free_prom_memory(void)
+ {
+-      /* Nothing to free */
++      /* adapted from arch/mips/txx9/generic/setup.c */
++      unsigned long saddr = PHYS_OFFSET + PAGE_SIZE;
++      unsigned long eaddr = __pa_symbol(&_text);
++
++      /* free memory between prom-record and kernel _text base */
++      if (saddr < eaddr)
++              free_init_pages("prom memory", saddr, eaddr);
+ }