]> git.karo-electronics.de Git - linux-beck.git/commitdiff
powerpc/boot: Use a common prom_args struct in oflib
authorCédric Le Goater <clg@fr.ibm.com>
Thu, 24 Apr 2014 07:23:26 +0000 (09:23 +0200)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 28 Apr 2014 07:35:26 +0000 (17:35 +1000)
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>
arch/powerpc/boot/of.h
arch/powerpc/boot/oflib.c

index e4c68f7391c5c430613087054c45de516fe1cc6a..5da03d9b9463cc7781dd7e58b29887bbef30cfa6 100644 (file)
@@ -18,4 +18,6 @@ int of_setprop(const void *phandle, const char *name, const void *buf,
 /* Console functions */
 void of_console_init(void);
 
+typedef u32                    __be32;
+
 #endif /* _PPC_BOOT_OF_H_ */
index b0ec9cf3eaaf6e6bf44f9a77aeb079761a2d628c..c3288a3446b3602bc8583c6d8295ea559c7aa29b 100644 (file)
 
 #include "of.h"
 
+/* The following structure is used to communicate with open firmware.
+ * All arguments in and out are in big endian format. */
+struct prom_args {
+       __be32 service; /* Address of service name string. */
+       __be32 nargs;   /* Number of input arguments. */
+       __be32 nret;    /* Number of output arguments. */
+       __be32 args[10];        /* Input/output arguments. */
+};
+
 static int (*prom) (void *);
 
 void of_init(void *promptr)
@@ -23,18 +32,15 @@ void of_init(void *promptr)
        prom = (int (*)(void *))promptr;
 }
 
+#define ADDR(x)                (u32)(unsigned long)(x)
+
 int of_call_prom(const char *service, int nargs, int nret, ...)
 {
        int i;
-       struct prom_args {
-               const char *service;
-               int nargs;
-               int nret;
-               unsigned int args[12];
-       } args;
+       struct prom_args args;
        va_list list;
 
-       args.service = service;
+       args.service = ADDR(service);
        args.nargs = nargs;
        args.nret = nret;
 
@@ -56,15 +62,10 @@ static int of_call_prom_ret(const char *service, int nargs, int nret,
                            unsigned int *rets, ...)
 {
        int i;
-       struct prom_args {
-               const char *service;
-               int nargs;
-               int nret;
-               unsigned int args[12];
-       } args;
+       struct prom_args args;
        va_list list;
 
-       args.service = service;
+       args.service = ADDR(service);
        args.nargs = nargs;
        args.nret = nret;