aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorJeremy Kerr <jeremy.kerr@canonical.com>2010-01-30 06:14:19 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-02-09 10:34:10 -0500
commit087f79c48c090a2c0cd9ee45231d63290d2036d2 (patch)
treec5d96d02ed64447ce36a68fe781a73a42a8ad19d /drivers/of
parent337148812f97368a8ec4a69f1691e4c5ce3af494 (diff)
of/flattree: endian-convert members of boot_param_header
The boot_param_header has big-endian fields, so change the types to __be32, and perform endian conversion when we access them. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/fdt.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 5c5f03ef7f06..18d282fefe58 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -28,7 +28,7 @@ struct boot_param_header *initial_boot_params;
28char *find_flat_dt_string(u32 offset) 28char *find_flat_dt_string(u32 offset)
29{ 29{
30 return ((char *)initial_boot_params) + 30 return ((char *)initial_boot_params) +
31 initial_boot_params->off_dt_strings + offset; 31 be32_to_cpu(initial_boot_params->off_dt_strings) + offset;
32} 32}
33 33
34/** 34/**
@@ -46,7 +46,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
46 void *data) 46 void *data)
47{ 47{
48 unsigned long p = ((unsigned long)initial_boot_params) + 48 unsigned long p = ((unsigned long)initial_boot_params) +
49 initial_boot_params->off_dt_struct; 49 be32_to_cpu(initial_boot_params->off_dt_struct);
50 int rc = 0; 50 int rc = 0;
51 int depth = -1; 51 int depth = -1;
52 52
@@ -66,7 +66,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
66 if (tag == OF_DT_PROP) { 66 if (tag == OF_DT_PROP) {
67 u32 sz = be32_to_cpup((__be32 *)p); 67 u32 sz = be32_to_cpup((__be32 *)p);
68 p += 8; 68 p += 8;
69 if (initial_boot_params->version < 0x10) 69 if (be32_to_cpu(initial_boot_params->version) < 0x10)
70 p = _ALIGN(p, sz >= 8 ? 8 : 4); 70 p = _ALIGN(p, sz >= 8 ? 8 : 4);
71 p += sz; 71 p += sz;
72 p = _ALIGN(p, 4); 72 p = _ALIGN(p, 4);
@@ -101,7 +101,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
101unsigned long __init of_get_flat_dt_root(void) 101unsigned long __init of_get_flat_dt_root(void)
102{ 102{
103 unsigned long p = ((unsigned long)initial_boot_params) + 103 unsigned long p = ((unsigned long)initial_boot_params) +
104 initial_boot_params->off_dt_struct; 104 be32_to_cpu(initial_boot_params->off_dt_struct);
105 105
106 while (be32_to_cpup((__be32 *)p) == OF_DT_NOP) 106 while (be32_to_cpup((__be32 *)p) == OF_DT_NOP)
107 p += 4; 107 p += 4;
@@ -135,7 +135,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
135 sz = be32_to_cpup((__be32 *)p); 135 sz = be32_to_cpup((__be32 *)p);
136 noff = be32_to_cpup((__be32 *)(p + 4)); 136 noff = be32_to_cpup((__be32 *)(p + 4));
137 p += 8; 137 p += 8;
138 if (initial_boot_params->version < 0x10) 138 if (be32_to_cpu(initial_boot_params->version) < 0x10)
139 p = _ALIGN(p, sz >= 8 ? 8 : 4); 139 p = _ALIGN(p, sz >= 8 ? 8 : 4);
140 140
141 nstr = find_flat_dt_string(noff); 141 nstr = find_flat_dt_string(noff);
@@ -296,7 +296,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
296 sz = be32_to_cpup((__be32 *)(*p)); 296 sz = be32_to_cpup((__be32 *)(*p));
297 noff = be32_to_cpup((__be32 *)((*p) + 4)); 297 noff = be32_to_cpup((__be32 *)((*p) + 4));
298 *p += 8; 298 *p += 8;
299 if (initial_boot_params->version < 0x10) 299 if (be32_to_cpu(initial_boot_params->version) < 0x10)
300 *p = _ALIGN(*p, sz >= 8 ? 8 : 4); 300 *p = _ALIGN(*p, sz >= 8 ? 8 : 4);
301 301
302 pname = find_flat_dt_string(noff); 302 pname = find_flat_dt_string(noff);
@@ -544,7 +544,7 @@ void __init unflatten_device_tree(void)
544 544
545 /* First pass, scan for size */ 545 /* First pass, scan for size */
546 start = ((unsigned long)initial_boot_params) + 546 start = ((unsigned long)initial_boot_params) +
547 initial_boot_params->off_dt_struct; 547 be32_to_cpu(initial_boot_params->off_dt_struct);
548 size = unflatten_dt_node(0, &start, NULL, NULL, 0); 548 size = unflatten_dt_node(0, &start, NULL, NULL, 0);
549 size = (size | 3) + 1; 549 size = (size | 3) + 1;
550 550
@@ -560,7 +560,7 @@ void __init unflatten_device_tree(void)
560 560
561 /* Second pass, do actual unflattening */ 561 /* Second pass, do actual unflattening */
562 start = ((unsigned long)initial_boot_params) + 562 start = ((unsigned long)initial_boot_params) +
563 initial_boot_params->off_dt_struct; 563 be32_to_cpu(initial_boot_params->off_dt_struct);
564 unflatten_dt_node(mem, &start, NULL, &allnextp, 0); 564 unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
565 if (be32_to_cpup((__be32 *)start) != OF_DT_END) 565 if (be32_to_cpup((__be32 *)start) != OF_DT_END)
566 pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start)); 566 pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start));