From patchwork Tue Oct 30 03:25:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 195277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7704D2C0093 for ; Tue, 30 Oct 2012 14:56:32 +1100 (EST) Received: from localhost ([::1]:54102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT2Rd-0001if-4F for incoming@patchwork.ozlabs.org; Mon, 29 Oct 2012 23:24:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT2Qw-0008IN-Pw for qemu-devel@nongnu.org; Mon, 29 Oct 2012 23:24:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TT2Qu-0001MA-BD for qemu-devel@nongnu.org; Mon, 29 Oct 2012 23:24:06 -0400 Received: from ozlabs.org ([203.10.76.45]:38615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TT2Qt-0001LC-Vx; Mon, 29 Oct 2012 23:24:04 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id EF06B2C00AC; Tue, 30 Oct 2012 14:23:57 +1100 (EST) From: David Gibson To: agraf@suse.de Date: Tue, 30 Oct 2012 14:25:04 +1100 Message-Id: <1351567512-17278-9-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1351567512-17278-1-git-send-email-david@gibson.dropbear.id.au> References: <1351567512-17278-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.10.76.45 Cc: Michael Ellerman , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH 08/16] pseries: Return the token when we register an RTAS call X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Michael Ellerman 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 Signed-off-by: Benjamin Herrenschmidt Signed-off-by: David Gibson --- hw/spapr.h | 2 +- hw/spapr_rtas.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/spapr.h b/hw/spapr.h index 51c709e..8f7ed85 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 ce76c58..64114e8 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, hwaddr rtas_addr,