aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/oflib.c
diff options
context:
space:
mode:
authorCédric Le Goater <clg@fr.ibm.com>2014-04-24 03:23:26 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-04-28 03:35:26 -0400
commitfed23ed7ebf0fbea17ad8fed207ff35a747fecaf (patch)
tree99d044aa881921d9b33adafdaf236794f70fbd6d /arch/powerpc/boot/oflib.c
parentf4bce2f784706800efcab6830111df9b75c2f199 (diff)
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>
Diffstat (limited to 'arch/powerpc/boot/oflib.c')
-rw-r--r--arch/powerpc/boot/oflib.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/arch/powerpc/boot/oflib.c b/arch/powerpc/boot/oflib.c
index b0ec9cf3eaaf..c3288a3446b3 100644
--- a/arch/powerpc/boot/oflib.c
+++ b/arch/powerpc/boot/oflib.c
@@ -16,6 +16,15 @@
16 16
17#include "of.h" 17#include "of.h"
18 18
19/* The following structure is used to communicate with open firmware.
20 * All arguments in and out are in big endian format. */
21struct 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
19static int (*prom) (void *); 28static int (*prom) (void *);
20 29
21void of_init(void *promptr) 30void of_init(void *promptr)
@@ -23,18 +32,15 @@ void of_init(void *promptr)
23 prom = (int (*)(void *))promptr; 32 prom = (int (*)(void *))promptr;
24} 33}
25 34
35#define ADDR(x) (u32)(unsigned long)(x)
36
26int of_call_prom(const char *service, int nargs, int nret, ...) 37int of_call_prom(const char *service, int nargs, int nret, ...)
27{ 38{
28 int i; 39 int i;
29 struct prom_args { 40 struct prom_args args;
30 const char *service;
31 int nargs;
32 int nret;
33 unsigned int args[12];
34 } args;
35 va_list list; 41 va_list list;
36 42
37 args.service = service; 43 args.service = ADDR(service);
38 args.nargs = nargs; 44 args.nargs = nargs;
39 args.nret = nret; 45 args.nret = nret;
40 46
@@ -56,15 +62,10 @@ static int of_call_prom_ret(const char *service, int nargs, int nret,
56 unsigned int *rets, ...) 62 unsigned int *rets, ...)
57{ 63{
58 int i; 64 int i;
59 struct prom_args { 65 struct prom_args args;
60 const char *service;
61 int nargs;
62 int nret;
63 unsigned int args[12];
64 } args;
65 va_list list; 66 va_list list;
66 67
67 args.service = service; 68 args.service = ADDR(service);
68 args.nargs = nargs; 69 args.nargs = nargs;
69 args.nret = nret; 70 args.nret = nret;
70 71