Commit 034e55e6c2f8e2a9ea37901ea87bac8a08464441

Authored by Cédric Le Goater
Committed by Benjamin Herrenschmidt
1 parent 9cc36bb0ac

powerpc/boot: Rework of_claim() to make it 64bit friendly

This patch fixes 64bit compile warnings and updates the wrapper code
to converge the kernel code in prom_init.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Showing 3 changed files with 12 additions and 10 deletions Side-by-side Diff

arch/powerpc/boot/of.c
... ... @@ -40,8 +40,8 @@
40 40 #ifdef DEBUG
41 41 printf(" trying: 0x%08lx\n\r", claim_base);
42 42 #endif
43   - addr = (unsigned long)of_claim(claim_base, size, 0);
44   - if ((void *)addr != (void *)-1)
  43 + addr = (unsigned long) of_claim(claim_base, size, 0);
  44 + if (addr != PROM_ERROR)
45 45 break;
46 46 }
47 47 if (addr == 0)
arch/powerpc/boot/of.h
... ... @@ -6,7 +6,8 @@
6 6  
7 7 void of_init(void *promptr);
8 8 int of_call_prom(const char *service, int nargs, int nret, ...);
9   -void *of_claim(unsigned long virt, unsigned long size, unsigned long align);
  9 +unsigned int of_claim(unsigned long virt, unsigned long size,
  10 + unsigned long align);
10 11 void *of_vmlinux_alloc(unsigned long size);
11 12 void of_exit(void);
12 13 void *of_finddevice(const char *name);
arch/powerpc/boot/oflib.c
... ... @@ -147,7 +147,8 @@
147 147 return 1;
148 148 }
149 149  
150   -void *of_claim(unsigned long virt, unsigned long size, unsigned long align)
  150 +unsigned int of_claim(unsigned long virt, unsigned long size,
  151 + unsigned long align)
151 152 {
152 153 int ret;
153 154 prom_arg_t result;
154 155  
155 156  
156 157  
157 158  
... ... @@ -155,32 +156,32 @@
155 156 if (need_map < 0)
156 157 need_map = check_of_version();
157 158 if (align || !need_map)
158   - return (void *) of_call_prom("claim", 3, 1, virt, size, align);
  159 + return of_call_prom("claim", 3, 1, virt, size, align);
159 160  
160 161 ret = of_call_prom_ret("call-method", 5, 2, &result, "claim", memory,
161 162 align, size, virt);
162 163 if (ret != 0 || result == -1)
163   - return (void *) -1;
  164 + return -1;
164 165 ret = of_call_prom_ret("call-method", 5, 2, &result, "claim", chosen_mmu,
165 166 align, size, virt);
166 167 /* 0x12 == coherent + read/write */
167 168 ret = of_call_prom("call-method", 6, 1, "map", chosen_mmu,
168 169 0x12, size, virt, virt);
169   - return (void *) virt;
  170 + return virt;
170 171 }
171 172  
172 173 void *of_vmlinux_alloc(unsigned long size)
173 174 {
174 175 unsigned long start = (unsigned long)_start, end = (unsigned long)_end;
175   - void *addr;
  176 + unsigned long addr;
176 177 void *p;
177 178  
178 179 /* With some older POWER4 firmware we need to claim the area the kernel
179 180 * will reside in. Newer firmwares don't need this so we just ignore
180 181 * the return value.
181 182 */
182   - addr = of_claim(start, end - start, 0);
183   - printf("Trying to claim from 0x%lx to 0x%lx (0x%lx) got %p\r\n",
  183 + addr = (unsigned long) of_claim(start, end - start, 0);
  184 + printf("Trying to claim from 0x%lx to 0x%lx (0x%lx) got %lx\r\n",
184 185 start, end, end - start, addr);
185 186  
186 187 p = malloc(size);