From patchwork Thu Jul 23 19:49:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin K Parashar X-Patchwork-Id: 499505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7C5B3140273 for ; Fri, 24 Jul 2015 05:50:57 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 67B061A0DA9 for ; Fri, 24 Jul 2015 05:50:57 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 2EFFA1A0B8C for ; Fri, 24 Jul 2015 05:50:51 +1000 (AEST) Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Jul 2015 05:50:50 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Jul 2015 05:50:48 +1000 X-Helo: d23dlp02.au.ibm.com X-MailFrom: vipin@linux.vnet.ibm.com X-RcptTo: skiboot@lists.ozlabs.org Received: from d23relay08.au.ibm.com (d23relay08.au.ibm.com [9.185.71.33]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id C25322BB0051 for ; Fri, 24 Jul 2015 05:50:47 +1000 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t6NJoZNO47775972 for ; Fri, 24 Jul 2015 05:50:44 +1000 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t6NJoEDd003439 for ; Fri, 24 Jul 2015 05:50:14 +1000 Received: from localhost.in.ibm.com ([9.79.217.109]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t6NJo8Xa003047; Fri, 24 Jul 2015 05:50:13 +1000 From: Vipin K Parashar To: skiboot@lists.ozlabs.org Date: Fri, 24 Jul 2015 01:19:48 +0530 Message-Id: <1437680989-12126-2-git-send-email-vipin@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1437680989-12126-1-git-send-email-vipin@linux.vnet.ibm.com> References: <1437680989-12126-1-git-send-email-vipin@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15072319-0021-0000-0000-000001974CCE Subject: [Skiboot] [PATCH v2 1/2] opal-api: Add OPAL call OPAL_TRIGGER_XSTOP to invoke xstop X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This patch adds a new OPAL call OPAL_TRIGGER_XSTOP which will be used to invoke xstop. This call invokes xstop by writing to a XSCOM register. XSCOM address and FIR bit details are obtained via device-tree property 'ibm,sw-checkstop-fir', which contains two cells. First cell contains XSCOM address while second cell contains FIR bit number. No input parameter is required. Machine enters xstop state upon completion of this call. Signed-off-by: Vipin K Parashar --- hw/xscom.c | 33 +++++++++++++++++++++++++++++++++ include/opal-api.h | 3 ++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/hw/xscom.c b/hw/xscom.c index 9d3523c..b875ca9 100644 --- a/hw/xscom.c +++ b/hw/xscom.c @@ -53,6 +53,12 @@ DEFINE_LOG_ENTRY(OPAL_RC_XSCOM_RESET, OPAL_PLATFORM_ERR_EVT, OPAL_XSCOM, OPAL_CEC_HARDWARE, OPAL_PREDICTIVE_ERR_GENERAL, OPAL_NA, NULL); +/* xscom details to trigger xstop */ +static struct { + uint64_t addr; + uint64_t fir_bit; +} xstop_xscom; + /* * Locking notes: * @@ -483,9 +489,26 @@ static void xscom_init_chip_info(struct proc_chip *chip) chip->ec_level |= (val >> 8) & 0xf; } +/* +* This function triggers xstop by writing to XSCOM. +* Machine would enter xstop state post completion of this. +*/ +static int64_t opal_trigger_xstop(void) +{ + int rc = OPAL_UNSUPPORTED; + + if (xstop_xscom.addr) + rc = xscom_writeme(xstop_xscom.addr, + PPC_BIT(xstop_xscom.fir_bit)); + + return rc; +} +opal_call(OPAL_TRIGGER_XSTOP, opal_trigger_xstop, 0); + void xscom_init(void) { struct dt_node *xn; + const struct dt_property *p; dt_for_each_compatible(dt_root, xn, "ibm,xscom") { uint32_t gcid = dt_get_chip_id(xn); @@ -521,6 +544,16 @@ void xscom_init(void) chip->ec_level >> 4, chip->ec_level & 0xf); } + + /* Collect details to trigger xstop via XSCOM write */ + p = dt_find_property(dt_root, "ibm,sw-checkstop-fir"); + if (p) { + xstop_xscom.addr = dt_property_get_cell(p, 0); + xstop_xscom.fir_bit = dt_property_get_cell(p, 1); + prlog(PR_INFO, "XSTOP: XSCOM addr = 0x%llx, FIR bit = %lld\n", + xstop_xscom.addr, xstop_xscom.fir_bit); + } else + prlog(PR_INFO, "XSTOP: ibm,sw-checkstop-fir prop not found\n"); } void xscom_used_by_console(void) diff --git a/include/opal-api.h b/include/opal-api.h index bfad589..1b56270 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -161,7 +161,8 @@ #define OPAL_PRD_MSG 113 #define OPAL_LEDS_GET_INDICATOR 114 #define OPAL_LEDS_SET_INDICATOR 115 -#define OPAL_LAST 115 +#define OPAL_TRIGGER_XSTOP 116 +#define OPAL_LAST 116 /* Device tree flags */