diff options
-rw-r--r-- | arch/powerpc/boot/of.h | 2 | ||||
-rw-r--r-- | arch/powerpc/boot/oflib.c | 29 |
2 files changed, 17 insertions, 14 deletions
diff --git a/arch/powerpc/boot/of.h b/arch/powerpc/boot/of.h index e4c68f7391c5..5da03d9b9463 100644 --- a/arch/powerpc/boot/of.h +++ b/arch/powerpc/boot/of.h @@ -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_ */ 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 @@ #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; |