Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Cédric Le Goater and committed by
Benjamin Herrenschmidt
034e55e6 9cc36bb0

+12 -10
+2 -2
arch/powerpc/boot/of.c
··· 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)
+2 -1
arch/powerpc/boot/of.h
··· 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);
+8 -7
arch/powerpc/boot/oflib.c
··· 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; ··· 156 155 if (need_map < 0) 157 156 need_map = check_of_version(); 158 157 if (align || !need_map) 159 - return (void *) of_call_prom("claim", 3, 1, virt, size, align); 158 + return of_call_prom("claim", 3, 1, virt, size, align); 160 159 161 160 ret = of_call_prom_ret("call-method", 5, 2, &result, "claim", memory, 162 161 align, size, virt); 163 162 if (ret != 0 || result == -1) 164 - return (void *) -1; 163 + return -1; 165 164 ret = of_call_prom_ret("call-method", 5, 2, &result, "claim", chosen_mmu, 166 165 align, size, virt); 167 166 /* 0x12 == coherent + read/write */ 168 167 ret = of_call_prom("call-method", 6, 1, "map", chosen_mmu, 169 168 0x12, size, virt, virt); 170 - return (void *) virt; 169 + return virt; 171 170 } 172 171 173 172 void *of_vmlinux_alloc(unsigned long size) 174 173 { 175 174 unsigned long start = (unsigned long)_start, end = (unsigned long)_end; 176 - void *addr; 175 + unsigned long addr; 177 176 void *p; 178 177 179 178 /* With some older POWER4 firmware we need to claim the area the kernel 180 179 * will reside in. Newer firmwares don't need this so we just ignore 181 180 * the return value. 182 181 */ 183 - addr = of_claim(start, end - start, 0); 184 - printf("Trying to claim from 0x%lx to 0x%lx (0x%lx) got %p\r\n", 182 + addr = (unsigned long) of_claim(start, end - start, 0); 183 + printf("Trying to claim from 0x%lx to 0x%lx (0x%lx) got %lx\r\n", 185 184 start, end, end - start, addr); 186 185 187 186 p = malloc(size);