From patchwork Wed Aug 16 13:51:52 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: 802085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xXW4M40zcz9sxR for ; Wed, 16 Aug 2017 23:52:19 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xXW4M1WG5zDrKH for ; Wed, 16 Aug 2017 23:52:19 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 3xXW452X2nzDrJb for ; Wed, 16 Aug 2017 23:52:05 +1000 (AEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7GDoExm079093 for ; Wed, 16 Aug 2017 09:52:01 -0400 Received: from e23smtp04.au.ibm.com (e23smtp04.au.ibm.com [202.81.31.146]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ccmgkk31u-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 16 Aug 2017 09:52:01 -0400 Received: from localhost by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 16 Aug 2017 23:51:58 +1000 Received: from d23relay07.au.ibm.com (202.81.31.226) by e23smtp04.au.ibm.com (202.81.31.210) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 16 Aug 2017 23:51:55 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v7GDptnv30212246 for ; Wed, 16 Aug 2017 23:51:55 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v7GDps2b010107 for ; Wed, 16 Aug 2017 23:51:55 +1000 Received: from jupiter.in.ibm.com ([9.124.213.79]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v7GDpqpU010075; Wed, 16 Aug 2017 23:51:53 +1000 From: Mahesh J Salgaonkar To: skiboot list Date: Wed, 16 Aug 2017 19:21:52 +0530 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable x-cbid: 17081613-0012-0000-0000-000002596BB8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17081613-0013-0000-0000-00000774FBA9 Message-Id: <150289150546.16215.15391010178561823123.stgit@jupiter.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-16_05:, , 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-1708160231 Subject: [Skiboot] [RFC 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. This is an RFC patch need to be tested. Signed-off-by: Mahesh Salgaonkar Tested-by: Vasant Hegde --- 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 */