aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/prom.c19
-rw-r--r--arch/powerpc/kernel/setup-common.c13
-rw-r--r--arch/powerpc/kernel/time.c4
-rw-r--r--include/asm-powerpc/prom.h12
4 files changed, 22 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index bf2005b2feb6..eb913f80bfb1 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -757,24 +757,9 @@ static int __init early_init_dt_scan_root(unsigned long node,
757static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) 757static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp)
758{ 758{
759 cell_t *p = *cellp; 759 cell_t *p = *cellp;
760 unsigned long r;
761 760
762 /* Ignore more than 2 cells */ 761 *cellp = p + s;
763 while (s > sizeof(unsigned long) / 4) { 762 return of_read_ulong(p, s);
764 p++;
765 s--;
766 }
767 r = *p++;
768#ifdef CONFIG_PPC64
769 if (s > 1) {
770 r <<= 32;
771 r |= *(p++);
772 s--;
773 }
774#endif
775
776 *cellp = p;
777 return r;
778} 763}
779 764
780 765
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 465e7435efbc..0af3fc1bdcc9 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -304,18 +304,21 @@ struct seq_operations cpuinfo_op = {
304void __init check_for_initrd(void) 304void __init check_for_initrd(void)
305{ 305{
306#ifdef CONFIG_BLK_DEV_INITRD 306#ifdef CONFIG_BLK_DEV_INITRD
307 const unsigned long *prop; 307 const unsigned int *prop;
308 int len;
308 309
309 DBG(" -> check_for_initrd()\n"); 310 DBG(" -> check_for_initrd()\n");
310 311
311 if (of_chosen) { 312 if (of_chosen) {
312 prop = get_property(of_chosen, "linux,initrd-start", NULL); 313 prop = get_property(of_chosen, "linux,initrd-start", &len);
313 if (prop != NULL) { 314 if (prop != NULL) {
314 initrd_start = (unsigned long)__va(*prop); 315 initrd_start = (unsigned long)
316 __va(of_read_ulong(prop, len / 4));
315 prop = get_property(of_chosen, 317 prop = get_property(of_chosen,
316 "linux,initrd-end", NULL); 318 "linux,initrd-end", &len);
317 if (prop != NULL) { 319 if (prop != NULL) {
318 initrd_end = (unsigned long)__va(*prop); 320 initrd_end = (unsigned long)
321 __va(of_read_ulong(prop, len / 4));
319 initrd_below_start_ok = 1; 322 initrd_below_start_ok = 1;
320 } else 323 } else
321 initrd_start = 0; 324 initrd_start = 0;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index b9a2061cfdb7..7a3c3f791ade 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -870,9 +870,7 @@ static int __init get_freq(char *name, int cells, unsigned long *val)
870 fp = get_property(cpu, name, NULL); 870 fp = get_property(cpu, name, NULL);
871 if (fp) { 871 if (fp) {
872 found = 1; 872 found = 1;
873 *val = 0; 873 *val = of_read_ulong(fp, cells);
874 while (cells--)
875 *val = (*val << 32) | *fp++;
876 } 874 }
877 875
878 of_node_put(cpu); 876 of_node_put(cpu);
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index c15e66a2e681..524629769336 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -197,7 +197,7 @@ extern int release_OF_resource(struct device_node* node, int index);
197 */ 197 */
198 198
199 199
200/* Helper to read a big number */ 200/* Helper to read a big number; size is in cells (not bytes) */
201static inline u64 of_read_number(const u32 *cell, int size) 201static inline u64 of_read_number(const u32 *cell, int size)
202{ 202{
203 u64 r = 0; 203 u64 r = 0;
@@ -206,6 +206,16 @@ static inline u64 of_read_number(const u32 *cell, int size)
206 return r; 206 return r;
207} 207}
208 208
209/* Like of_read_number, but we want an unsigned long result */
210#ifdef CONFIG_PPC32
211static inline unsigned long of_read_ulong(const u32 *cell, int size)
212{
213 return cell[size-1];
214}
215#else
216#define of_read_ulong(cell, size) of_read_number(cell, size)
217#endif
218
209/* Translate an OF address block into a CPU physical address 219/* Translate an OF address block into a CPU physical address
210 */ 220 */
211#define OF_BAD_ADDR ((u64)-1) 221#define OF_BAD_ADDR ((u64)-1)