Michael and Ben,<br><br>If you are free please help me check this delayed patch.<br><br>For the original thread please filter email with the key words "Fix 64bit".<br><br>Best Regards<br>Tiejun<br><br><div class="gmail_quote">
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
In the DTB tree created by firmware on some Maple 64bit targets, such as ATCA6101,<br>
these two properties, address&size, should be 2. But the actual corresponding<br>
values<br>
of host bridge node are set 1 incorrectly by the firmware, we have to provide one<br>
fixup function to fix that.<br>
<br>
Signed-off-by: Tiejun Chen <<a href="mailto:tiejun.china@gmail.com">tiejun.china@gmail.com</a>><br>
---<br>
arch/powerpc/kernel/prom_init.c | 51 ++++++++++++++++++++++++++++++++++++++-<br>
1 files changed, 50 insertions(+), 1 deletions(-)<br>
<br>
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c<br>
index 2445945..7848b45 100644<br>
--- a/arch/powerpc/kernel/prom_init.c<br>
+++ b/arch/powerpc/kernel/prom_init.c<br>
@@ -1907,14 +1907,63 @@ static void __init flatten_device_tree(void)<br>
}<br>
<br>
#ifdef CONFIG_PPC_MAPLE<br>
+/* On ATCA6101 64bit target host bridge parent node has specified address and<br>
+ * size properties to be 2. But the actual "cell" value for host bridge node<br>
+ * is 1 since early MOTLoad internal bug. */<br>
+static void __init fixup_device_tree_atca6101(void)<br>
+{<br>
+ phandle hb;<br>
+ u32 hb_ranges[4];<br>
+ u32 size_cell, addr_cell;<br>
+ struct prom_t *_prom = &RELOC(prom);<br>
+ char *name;<br>
+<br>
+ name = "/hostbridge@f8000000";<br>
+ hb = call_prom("finddevice", 1, 1, ADDR(name));<br>
+ if (!PHANDLE_VALID(hb))<br>
+ return;<br>
+<br>
+ if (prom_getproplen(hb, "reg") != 8)<br>
+ return;<br>
+<br>
+ if (prom_getprop(hb, "reg", hb_ranges, (sizeof(hb_ranges))/2)<br>
+ == PROM_ERROR)<br>
+ return;<br>
+<br>
+ prom_getprop(_prom->root, "#address-cells", &addr_cell, sizeof(addr_cell));<br>
+ prom_getprop(_prom->root, "#size-cells", &size_cell, sizeof(size_cell));<br>
+<br>
+ if ((addr_cell != 2) || (size_cell != 2) ||<br>
+ (hb_ranges[0] != 0xf8000000))<br>
+ return;<br>
+<br>
+ prom_printf("Fixing up bogus HOSTBRIDGE reg on ATCA6101...\n");<br>
+<br>
+ hb_ranges[3] = hb_ranges[1];<br>
+ hb_ranges[1] = hb_ranges[0];<br>
+ hb_ranges[0] = hb_ranges[2] = 0;<br>
+ prom_setprop(hb, name, "reg",<br>
+ hb_ranges, sizeof(hb_ranges));<br>
+}<br>
/* PIBS Version 1.05.0000 04/26/2005 has an incorrect /ht/isa/ranges property.<br>
- * The values are bad, and it doesn't even have the right number of cells. */<br>
+ * The values are bad, and it doesn't even have the right number of cells.<br>
+ * Additionally, the early MOTLoad generate incorrect address&size cells on<br>
+ * some Maple platform such as ATCA6101. */<br>
static void __init fixup_device_tree_maple(void)<br>
{<br>
phandle isa;<br>
u32 rloc = 0x01002000; /* IO space; PCI device = 4 */<br>
u32 isa_ranges[6];<br>
char *name;<br>
+ u32 node;<br>
+ char prop[64];<br>
+ int model;<br>
+<br>
+ /* FIXME: This may be used for more Maple targets not only ATCA6101. */<br>
+ node = call_prom("finddevice", 1, 1, ADDR("/"));<br>
+ model = prom_getprop(node, "model", prop, sizeof(prop));<br>
+ if (model != PROM_ERROR && (strcmp(prop, "Motorola,ATCA-6101") == 0))<br>
+ fixup_device_tree_atca6101();<br>
<br>
name = "/ht@0/isa@4";<br>
isa = call_prom("finddevice", 1, 1, ADDR(name));<br>
<font color="#888888">--<br>
1.5.6<br>
<br>
_______________________________________________<br>
Linuxppc-dev mailing list<br>
<a href="mailto:Linuxppc-dev@ozlabs.org">Linuxppc-dev@ozlabs.org</a><br>
<a href="https://ozlabs.org/mailman/listinfo/linuxppc-dev" target="_blank">https://ozlabs.org/mailman/listinfo/linuxppc-dev</a><br>
<br>
</font></blockquote></div><br>