Commit 44e4665c authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] ppc64: Fix a device-tree bug on Apple's

Apple's Open Firmware has a funny bug when creating the /cpus nodes
where it leaves a dangling '\0' character in the CPU name which ends up
appearing in the full path of the node. This is bogus and
confuses /proc/device-tree badly.

This patch strips those bogus zero's from the node full path when
reading the device-tree from Open Firmware. The "name" property is not
modified and still contains the spurrious 0 (it basically contains 0
tailing 0 instead of one) but that shouldn't be a problem.

An equivalent patch for ppc32 will follow shortly
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 21e3024c
...@@ -1566,7 +1566,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start, ...@@ -1566,7 +1566,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
{ {
int l, align; int l, align;
phandle child; phandle child;
char *namep, *prev_name, *sstart; char *namep, *prev_name, *sstart, *p, *ep;
unsigned long soff; unsigned long soff;
unsigned char *valp; unsigned char *valp;
unsigned long offset = reloc_offset(); unsigned long offset = reloc_offset();
...@@ -1588,6 +1588,14 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start, ...@@ -1588,6 +1588,14 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
call_prom("package-to-path", 3, 1, node, namep, l); call_prom("package-to-path", 3, 1, node, namep, l);
} }
namep[l] = '\0'; namep[l] = '\0';
/* Fixup an Apple bug where they have bogus \0 chars in the
* middle of the path in some properties
*/
for (p = namep, ep = namep + l; p < ep; p++)
if (*p == '\0') {
memmove(p, p+1, ep - p);
ep--; l--;
}
*mem_start = _ALIGN(((unsigned long) namep) + strlen(namep) + 1, 4); *mem_start = _ALIGN(((unsigned long) namep) + strlen(namep) + 1, 4);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment