Skip to content

Commit fed23ed

Browse files
Cédric Le Goaterozbenh
authored andcommitted
powerpc/boot: Use a common prom_args struct in oflib
This patch fixes warnings when the wrapper is compiled in 64bit and updates the boot wrapper code related to prom to converge with the kernel code in prom_init. This should make the review of changes easier. The kernel has a different number of possible arguments (10) when entering prom. There does not seem to be any good reason to have 12 in the wrapper, so the patch changes this value to args[10] in the prom_args struct. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent f4bce2f commit fed23ed

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

‎arch/powerpc/boot/of.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ int of_setprop(const void *phandle, const char *name, const void *buf,
1818
/* Console functions */
1919
void of_console_init(void);
2020

21+
typedef u32 __be32;
22+
2123
#endif /* _PPC_BOOT_OF_H_ */

‎arch/powerpc/boot/oflib.c‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,31 @@
1616

1717
#include "of.h"
1818

19+
/* The following structure is used to communicate with open firmware.
20+
* All arguments in and out are in big endian format. */
21+
struct prom_args {
22+
__be32 service; /* Address of service name string. */
23+
__be32 nargs; /* Number of input arguments. */
24+
__be32 nret; /* Number of output arguments. */
25+
__be32 args[10]; /* Input/output arguments. */
26+
};
27+
1928
static int (*prom) (void *);
2029

2130
void of_init(void *promptr)
2231
{
2332
prom = (int (*)(void *))promptr;
2433
}
2534

35+
#define ADDR(x) (u32)(unsigned long)(x)
36+
2637
int of_call_prom(const char *service, int nargs, int nret, ...)
2738
{
2839
int i;
29-
struct prom_args {
30-
const char *service;
31-
int nargs;
32-
int nret;
33-
unsigned int args[12];
34-
} args;
40+
struct prom_args args;
3541
va_list list;
3642

37-
args.service = service;
43+
args.service = ADDR(service);
3844
args.nargs = nargs;
3945
args.nret = nret;
4046

@@ -56,15 +62,10 @@ static int of_call_prom_ret(const char *service, int nargs, int nret,
5662
unsigned int *rets, ...)
5763
{
5864
int i;
59-
struct prom_args {
60-
const char *service;
61-
int nargs;
62-
int nret;
63-
unsigned int args[12];
64-
} args;
65+
struct prom_args args;
6566
va_list list;
6667

67-
args.service = service;
68+
args.service = ADDR(service);
6869
args.nargs = nargs;
6970
args.nret = nret;
7071

0 commit comments

Comments
 (0)