[6/8] pseries: Return the token when we register an RTAS call

Submitted by David Gibson on Oct. 11, 2012, 11:47 a.m.


Message ID 1349956064-26709-7-git-send-email-david@gibson.dropbear.id.au
State New
Headers show

Commit Message

David Gibson Oct. 11, 2012, 11:47 a.m.
From: Michael Ellerman <michael@ellerman.id.au>

The kernel will soon be able to service some RTAS calls. However the
choice of tokens will still be up to userspace. To support this have
spapr_rtas_register() return the token that is allocated for an
RTAS call, that allows the calling code to tell the kernel what the
token value is.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
 hw/spapr.h      |    2 +-
 hw/spapr_rtas.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/hw/spapr.h b/hw/spapr.h
index 54960f3..f6864da 100644
--- a/hw/spapr.h
+++ b/hw/spapr.h
@@ -320,7 +320,7 @@  static inline void rtas_st(target_ulong phys, int n, uint32_t val)
 typedef void (*spapr_rtas_fn)(sPAPREnvironment *spapr, uint32_t token,
                               uint32_t nargs, target_ulong args,
                               uint32_t nret, target_ulong rets);
-void spapr_rtas_register(const char *name, spapr_rtas_fn fn);
+int spapr_rtas_register(const char *name, spapr_rtas_fn fn);
 target_ulong spapr_rtas_call(sPAPREnvironment *spapr,
                              uint32_t token, uint32_t nargs, target_ulong args,
                              uint32_t nret, target_ulong rets);
diff --git a/hw/spapr_rtas.c b/hw/spapr_rtas.c
index b96078b..38c105f 100644
--- a/hw/spapr_rtas.c
+++ b/hw/spapr_rtas.c
@@ -239,7 +239,7 @@  target_ulong spapr_rtas_call(sPAPREnvironment *spapr,
     return H_PARAMETER;
-void spapr_rtas_register(const char *name, spapr_rtas_fn fn)
+int spapr_rtas_register(const char *name, spapr_rtas_fn fn)
     int i;
@@ -255,7 +255,7 @@  void spapr_rtas_register(const char *name, spapr_rtas_fn fn)
     rtas_next->name = name;
     rtas_next->fn = fn;
-    rtas_next++;
+    return (rtas_next++ - rtas_table) + TOKEN_BASE;
 int spapr_rtas_device_tree_setup(void *fdt, target_phys_addr_t rtas_addr,