]> err.no Git - linux-2.6/commitdiff
[ARM] 4845/1: Orion: Ignore memory tags with invalid data
authorGuennadi Liakhovetski <lg@denx.de>
Fri, 29 Feb 2008 20:12:57 +0000 (21:12 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 6 Mar 2008 12:18:17 +0000 (12:18 +0000)
The DNS-323, Kurobox-Pro / Linkstation-Pro, QNAP TS-109/TS-209 and some
other orion-based systems have several bogus memory entries in the tag
table, which causes the system to crash at startup. Ignore them by
resetting the tag ID to 0 in a machine fixup function.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-orion/common.c
arch/arm/mach-orion/common.h
arch/arm/mach-orion/dns323-setup.c
arch/arm/mach-orion/kurobox_pro-setup.c
arch/arm/mach-orion/ts209-setup.c

index 5f0ee4b8a9b73a5a1cfced1a0e0a5efa91e1e993..2d6d413f02351bb23b66e32c08fa119bb1a950bf 100644 (file)
@@ -17,7 +17,9 @@
 #include <linux/mv643xx_eth.h>
 #include <linux/mv643xx_i2c.h>
 #include <asm/page.h>
+#include <asm/setup.h>
 #include <asm/timex.h>
+#include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/arch/hardware.h>
 #include "common.h"
@@ -347,3 +349,21 @@ void __init orion_init(void)
                platform_device_register(&orion_ehci1);
        platform_device_register(&orion_i2c);
 }
+
+/*
+ * Many orion-based systems have buggy bootloader implementations.
+ * This is a common fixup for bogus memory tags.
+ */
+void __init tag_fixup_mem32(struct machine_desc *mdesc, struct tag *t,
+                           char **from, struct meminfo *meminfo)
+{
+       for (; t->hdr.size; t = tag_next(t))
+               if (t->hdr.tag == ATAG_MEM &&
+                   (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK ||
+                    t->u.mem.start & ~PAGE_MASK)) {
+                       printk(KERN_WARNING
+                              "Clearing invalid memory bank %dKB@0x%08x\n",
+                              t->u.mem.size / 1024, t->u.mem.start);
+                       t->hdr.tag = 0;
+               }
+}
index 10154ec885dfb1c08339732710e59d2c3d9f333a..501497cc2c4df431658a0b036358d374d5f86c5a 100644 (file)
@@ -83,4 +83,10 @@ struct mv_sata_platform_data;
 
 void __init orion_sata_init(struct mv_sata_platform_data *sata_data);
 
+struct machine_desc;
+struct meminfo;
+struct tag;
+extern void __init tag_fixup_mem32(struct machine_desc *, struct tag *,
+                                  char **, struct meminfo *);
+
 #endif /* __ARCH_ORION_COMMON_H__ */
index 02b280c2482064d465fd23a489e046a2d36b3aa3..076e155ad5106106980f6ea05ef93762d986a4c7 100644 (file)
@@ -319,4 +319,5 @@ MACHINE_START(DNS323, "D-Link DNS-323")
        .map_io         = orion_map_io,
        .init_irq       = orion_init_irq,
        .timer          = &orion_timer,
+       .fixup          = tag_fixup_mem32,
 MACHINE_END
index 6817aca4aa2653b6d92647add7ee6e65a1e66aaf..785a07bdf1e24681f63b28a0a603f43a2c89e00e 100644 (file)
@@ -240,4 +240,5 @@ MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro")
        .map_io         = orion_map_io,
        .init_irq       = orion_init_irq,
        .timer          = &orion_timer,
+       .fixup          = tag_fixup_mem32,
 MACHINE_END
index b8cfe6813e9d5313f8d7d5ad7d29b3b2e75050c5..45764dad16d0fb3bb121b5e5911761ae36051162 100644 (file)
@@ -357,4 +357,5 @@ MACHINE_START(TS209, "QNAP TS-109/TS-209")
        .map_io         = orion_map_io,
        .init_irq       = orion_init_irq,
        .timer          = &orion_timer,
+       .fixup          = tag_fixup_mem32,
 MACHINE_END