Skip to content

Commit 034e55e

Browse files
Cédric Le Goaterozbenh
authored andcommitted
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>
1 parent 9cc36bb commit 034e55e

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎arch/powerpc/boot/of.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ static void *of_try_claim(unsigned long size)
4040
#ifdef DEBUG
4141
printf(" trying: 0x%08lx\n\r", claim_base);
4242
#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)
4545
break;
4646
}
4747
if (addr == 0)

‎arch/powerpc/boot/of.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ typedef void *ihandle;
66

77
void of_init(void *promptr);
88
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);
1011
void *of_vmlinux_alloc(unsigned long size);
1112
void of_exit(void);
1213
void *of_finddevice(const char *name);

‎arch/powerpc/boot/oflib.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,40 +147,41 @@ static int check_of_version(void)
147147
return 1;
148148
}
149149

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)
151152
{
152153
int ret;
153154
prom_arg_t result;
154155

155156
if (need_map < 0)
156157
need_map = check_of_version();
157158
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);
159160

160161
ret = of_call_prom_ret("call-method", 5, 2, &result, "claim", memory,
161162
align, size, virt);
162163
if (ret != 0 || result == -1)
163-
return (void *) -1;
164+
return -1;
164165
ret = of_call_prom_ret("call-method", 5, 2, &result, "claim", chosen_mmu,
165166
align, size, virt);
166167
/* 0x12 == coherent + read/write */
167168
ret = of_call_prom("call-method", 6, 1, "map", chosen_mmu,
168169
0x12, size, virt, virt);
169-
return (void *) virt;
170+
return virt;
170171
}
171172

172173
void *of_vmlinux_alloc(unsigned long size)
173174
{
174175
unsigned long start = (unsigned long)_start, end = (unsigned long)_end;
175-
void *addr;
176+
unsigned long addr;
176177
void *p;
177178

178179
/* With some older POWER4 firmware we need to claim the area the kernel
179180
* will reside in. Newer firmwares don't need this so we just ignore
180181
* the return value.
181182
*/
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",
184185
start, end, end - start, addr);
185186

186187
p = malloc(size);

0 commit comments

Comments
 (0)