提交 7946d5a5 编写于 作者: A Anton Blanchard 提交者: Benjamin Herrenschmidt

powerpc: Make cache info device tree accesses endian safe

Signed-off-by: NAnton Blanchard <anton@samba.org>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 08bc1dc5
...@@ -320,14 +320,14 @@ static void __init initialize_cache_info(void) ...@@ -320,14 +320,14 @@ static void __init initialize_cache_info(void)
* d-cache and i-cache sizes... -Peter * d-cache and i-cache sizes... -Peter
*/ */
if (num_cpus == 1) { if (num_cpus == 1) {
const u32 *sizep, *lsizep; const __be32 *sizep, *lsizep;
u32 size, lsize; u32 size, lsize;
size = 0; size = 0;
lsize = cur_cpu_spec->dcache_bsize; lsize = cur_cpu_spec->dcache_bsize;
sizep = of_get_property(np, "d-cache-size", NULL); sizep = of_get_property(np, "d-cache-size", NULL);
if (sizep != NULL) if (sizep != NULL)
size = *sizep; size = be32_to_cpu(*sizep);
lsizep = of_get_property(np, "d-cache-block-size", lsizep = of_get_property(np, "d-cache-block-size",
NULL); NULL);
/* fallback if block size missing */ /* fallback if block size missing */
...@@ -336,7 +336,7 @@ static void __init initialize_cache_info(void) ...@@ -336,7 +336,7 @@ static void __init initialize_cache_info(void)
"d-cache-line-size", "d-cache-line-size",
NULL); NULL);
if (lsizep != NULL) if (lsizep != NULL)
lsize = *lsizep; lsize = be32_to_cpu(*lsizep);
if (sizep == NULL || lsizep == NULL) if (sizep == NULL || lsizep == NULL)
DBG("Argh, can't find dcache properties ! " DBG("Argh, can't find dcache properties ! "
"sizep: %p, lsizep: %p\n", sizep, lsizep); "sizep: %p, lsizep: %p\n", sizep, lsizep);
...@@ -350,7 +350,7 @@ static void __init initialize_cache_info(void) ...@@ -350,7 +350,7 @@ static void __init initialize_cache_info(void)
lsize = cur_cpu_spec->icache_bsize; lsize = cur_cpu_spec->icache_bsize;
sizep = of_get_property(np, "i-cache-size", NULL); sizep = of_get_property(np, "i-cache-size", NULL);
if (sizep != NULL) if (sizep != NULL)
size = *sizep; size = be32_to_cpu(*sizep);
lsizep = of_get_property(np, "i-cache-block-size", lsizep = of_get_property(np, "i-cache-block-size",
NULL); NULL);
if (lsizep == NULL) if (lsizep == NULL)
...@@ -358,7 +358,7 @@ static void __init initialize_cache_info(void) ...@@ -358,7 +358,7 @@ static void __init initialize_cache_info(void)
"i-cache-line-size", "i-cache-line-size",
NULL); NULL);
if (lsizep != NULL) if (lsizep != NULL)
lsize = *lsizep; lsize = be32_to_cpu(*lsizep);
if (sizep == NULL || lsizep == NULL) if (sizep == NULL || lsizep == NULL)
DBG("Argh, can't find icache properties ! " DBG("Argh, can't find icache properties ! "
"sizep: %p, lsizep: %p\n", sizep, lsizep); "sizep: %p, lsizep: %p\n", sizep, lsizep);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册