From patchwork Tue Aug 22 02:39:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 804235 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 ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xbvtG3GCWz9t16 for ; Tue, 22 Aug 2017 12:40:22 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xbvtG2Tj0zDqgp for ; Tue, 22 Aug 2017 12:40:22 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xbvsw1BmHzDqfx for ; Tue, 22 Aug 2017 12:40:03 +1000 (AEST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7M2cqdW057872 for ; Mon, 21 Aug 2017 22:40:02 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0a-001b2d01.pphosted.com with ESMTP id 2cg8xc0m6q-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Aug 2017 22:40:01 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Aug 2017 12:39:59 +1000 Received: from d23relay09.au.ibm.com (202.81.31.228) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 22 Aug 2017 12:39:57 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v7M2dvC741222288 for ; Tue, 22 Aug 2017 12:39:57 +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 v7M2dvSf007788 for ; Tue, 22 Aug 2017 12:39:57 +1000 Received: from jupiter.in.ibm.com ([9.79.198.74]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v7M2dsfQ007711; Tue, 22 Aug 2017 12:39:55 +1000 From: Mahesh J Salgaonkar To: skiboot list Date: Tue, 22 Aug 2017 08:09:49 +0530 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable x-cbid: 17082202-0040-0000-0000-00000350ECFC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17082202-0041-0000-0000-00000CCEC707 Message-Id: <150336956567.1156.16420902013674242696.stgit@jupiter.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-21_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1708220038 Subject: [Skiboot] [PATCH] opal: Extract sw checkstop fir address from HDAT. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nagendra K Gurram , Venkatesh Sainath , Daniel M Crowell Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Mahesh Salgaonkar Extract sw checkstop fir address info from HDAT and populate device tree node ibm,sw-checkstop-fir. This patch is required for OPAL_CEC_REBOOT2 OPAL call to work as expected on p9. With this patch a device property 'ibm,sw-checkstop-fir' is now properly populated: # lsprop ibm,sw-checkstop-fir ibm,sw-checkstop-fir 05012000 0000001f Signed-off-by: Mahesh Salgaonkar Tested-by: Vasant Hegde --- Changes from RFC: - Added tested-by and updated the patch description. No code changes. --- hdata/spira.c | 25 ++++++++++++++++++++++++- hdata/spira.h | 4 ++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/hdata/spira.c b/hdata/spira.c index d5e6984..676daf9 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -425,9 +425,10 @@ static bool add_xscom_sppcrd(uint64_t xscom_base) for_each_ntuple_idx(&spira.ntuples.proc_chip, hdif, i, SPPCRD_HDIF_SIG) { const struct sppcrd_chip_info *cinfo; + unsigned int csize; u32 ve, version; - cinfo = HDIF_get_idata(hdif, SPPCRD_IDATA_CHIP_INFO, NULL); + cinfo = HDIF_get_idata(hdif, SPPCRD_IDATA_CHIP_INFO, &csize); if (!CHECK_SPPTR(cinfo)) { prerror("XSCOM: Bad ChipID data %d\n", i); continue; @@ -487,6 +488,28 @@ static bool add_xscom_sppcrd(uint64_t xscom_base) parse_i2c_devs(hdif, SPPCRD_IDATA_HOST_I2C, np); add_vas_node(np, i); } + + /* + * Add sw checkstop scom address (ibm,sw-checkstop-fir) + * + * The latest HDAT versions have sw checkstop scom address + * info. But not sure from which version onwards (at least + * HDAT spec do not mention that explicitly). Hence use the + * sppcrd struct size returned by HDIF_get_idata to figure out + * whether it contains sw checkstop scom address info. Also + * check if sw_xstop_fir_scom address is non-zero. + */ + if ((csize >= (offsetof(struct sppcrd_chip_info, + sw_xstop_fir_bitpos) + 1)) && + cinfo->sw_xstop_fir_scom) { + __be32 fir_bit = cinfo->sw_xstop_fir_bitpos; + + if (!dt_find_property(dt_root, "ibm,sw-checkstop-fir")) + dt_add_property_cells(dt_root, + "ibm,sw-checkstop-fir", + be32_to_cpu(cinfo->sw_xstop_fir_scom), + be32_to_cpu(fir_bit)); + } } return i > 0; diff --git a/hdata/spira.h b/hdata/spira.h index 4867b6d..0276d4a 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -1035,6 +1035,10 @@ struct sppcrd_chip_info { __be32 capp1_func_state; /* *possibly* from Version 0x20 - check spec */ __be32 stop_levels; + /* From latest version (possibly 0x21 and later) */ + __be32 sw_xstop_fir_scom; + uint8_t sw_xstop_fir_bitpos; + uint8_t reserved_1[3]; } __packed; /* Idata index 1 : Chip TOD */