From patchwork Mon Apr 24 03:48:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ananth N Mavinakayanahalli X-Patchwork-Id: 754088 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 3wBC5q1vbnz9s7q for ; Mon, 24 Apr 2017 13:49:51 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wBC5q10jlzDq9P for ; Mon, 24 Apr 2017 13:49:51 +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 3wBC5j2JJDzDq66 for ; Mon, 24 Apr 2017 13:49:44 +1000 (AEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3O3nUaF088511 for ; Sun, 23 Apr 2017 23:49:33 -0400 Received: from e23smtp04.au.ibm.com (e23smtp04.au.ibm.com [202.81.31.146]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a038qdjvt-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 23 Apr 2017 23:49:33 -0400 Received: from localhost by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Apr 2017 13:49:15 +1000 Received: from d23relay08.au.ibm.com (202.81.31.227) by e23smtp04.au.ibm.com (202.81.31.210) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 24 Apr 2017 13:49:12 +1000 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 v3O3n4oN5439942 for ; Mon, 24 Apr 2017 13:49:12 +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 v3O3mdHm019985 for ; Mon, 24 Apr 2017 13:48:39 +1000 Received: from thinktux.in.ibm.com ([9.85.80.87]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v3O3matr019768; Mon, 24 Apr 2017 13:48:38 +1000 From: Ananth N Mavinakayanahalli To: skiboot@lists.ozlabs.org Date: Mon, 24 Apr 2017 09:18:21 +0530 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable x-cbid: 17042403-0012-0000-0000-0000022A1813 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042403-0013-0000-0000-000007407C0B Message-Id: <149300570117.17959.15451092874911022726.stgit@thinktux.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-24_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704240058 Subject: [Skiboot] [PATCH V4] prd: Fix PRD scoms for P9 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: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The IPOLL register addresses have changed from P8. Signed-off-by: Ananth N Mavinakayanahalli --- V4 -- Verified if this patch applies on master. No changes --- hw/prd.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/hw/prd.c b/hw/prd.c index a44faa9..db27aa8 100644 --- a/hw/prd.c +++ b/hw/prd.c @@ -48,14 +48,46 @@ static struct dt_node *prd_node; static struct lock events_lock = LOCK_UNLOCKED; static struct lock ipoll_lock = LOCK_UNLOCKED; +static uint64_t prd_ipoll_mask_reg; +static uint64_t prd_ipoll_status_reg; +static uint64_t prd_ipoll_mask; + /* PRD registers */ -#define PRD_IPOLL_REG_MASK 0x01020013 -#define PRD_IPOLL_REG_STATUS 0x01020014 -#define PRD_IPOLL_XSTOP PPC_BIT(0) /* Xstop for host/core/millicode */ -#define PRD_IPOLL_RECOV PPC_BIT(1) /* Recoverable */ -#define PRD_IPOLL_SPEC_ATTN PPC_BIT(2) /* Special attention */ -#define PRD_IPOLL_HOST_ATTN PPC_BIT(3) /* Host attention */ -#define PRD_IPOLL_MASK PPC_BITMASK(0, 3) +#define PRD_P8_IPOLL_REG_MASK 0x01020013 +#define PRD_P8_IPOLL_REG_STATUS 0x01020014 +#define PRD_P8_IPOLL_XSTOP PPC_BIT(0) /* Xstop for host/core/millicode */ +#define PRD_P8_IPOLL_RECOV PPC_BIT(1) /* Recoverable */ +#define PRD_P8_IPOLL_SPEC_ATTN PPC_BIT(2) /* Special attention */ +#define PRD_P8_IPOLL_HOST_ATTN PPC_BIT(3) /* Host attention */ +#define PRD_P8_IPOLL_MASK PPC_BITMASK(0, 3) + +#define PRD_P9_IPOLL_REG_MASK 0x000F0033 +#define PRD_P9_IPOLL_REG_STATUS 0x000F0034 +#define PRD_P9_ERROR_TYPE0 PPC_BIT(0) +#define PRD_P9_ERROR_TYPE1 PPC_BIT(1) +#define PRD_P9_ERROR_TYPE2 PPC_BIT(2) +#define PRD_P9_ERROR_TYPE3 PPC_BIT(3) +#define PRD_P9_ERROR_TYPE4 PPC_BIT(4) +#define PRD_P9_MASK_INTERRUPT PPC_BIT(5) +#define PRD_P9_IPOLL_MASK PPC_BITMASK(0, 5) + +static void prd_init_scoms(void) +{ + switch (proc_gen) { + case proc_gen_p8: + prd_ipoll_mask_reg = PRD_P8_IPOLL_REG_MASK; + prd_ipoll_status_reg = PRD_P8_IPOLL_REG_STATUS; + prd_ipoll_mask = PRD_P8_IPOLL_MASK; + break; + case proc_gen_p9: + prd_ipoll_mask_reg = PRD_P9_IPOLL_REG_MASK; + prd_ipoll_status_reg = PRD_P9_IPOLL_REG_STATUS; + prd_ipoll_mask = PRD_P9_IPOLL_MASK; + break; + default: + return; + } +} static int queue_prd_msg_hbrt(struct opal_prd_msg *msg, void (*consumed)(void *data)) @@ -130,7 +162,7 @@ static int populate_ipoll_msg(struct opal_prd_msg *msg, uint32_t proc) int rc; lock(&ipoll_lock); - rc = xscom_read(proc, PRD_IPOLL_REG_MASK, &ipoll_mask); + rc = xscom_read(proc, prd_ipoll_mask_reg, &ipoll_mask); unlock(&ipoll_lock); if (rc) { @@ -207,7 +239,7 @@ static int __ipoll_update_mask(uint32_t proc, bool set, uint64_t bits) uint64_t mask; int rc; - rc = xscom_read(proc, PRD_IPOLL_REG_MASK, &mask); + rc = xscom_read(proc, prd_ipoll_mask_reg, &mask); if (rc) return rc; @@ -216,7 +248,7 @@ static int __ipoll_update_mask(uint32_t proc, bool set, uint64_t bits) else mask &= ~bits; - return xscom_write(proc, PRD_IPOLL_REG_MASK, mask); + return xscom_write(proc, prd_ipoll_mask_reg, mask); } static int ipoll_record_and_mask_pending(uint32_t proc) @@ -225,8 +257,8 @@ static int ipoll_record_and_mask_pending(uint32_t proc) int rc; lock(&ipoll_lock); - rc = xscom_read(proc, PRD_IPOLL_REG_STATUS, &status); - status &= PRD_IPOLL_MASK; + rc = xscom_read(proc, prd_ipoll_status_reg, &status); + status &= prd_ipoll_mask; if (!rc) __ipoll_update_mask(proc, true, status); unlock(&ipoll_lock); @@ -270,7 +302,7 @@ static int prd_msg_handle_attn_ack(struct opal_prd_msg *msg) lock(&ipoll_lock); rc = __ipoll_update_mask(msg->attn_ack.proc, false, - msg->attn_ack.ipoll_ack & PRD_IPOLL_MASK); + msg->attn_ack.ipoll_ack & prd_ipoll_mask); unlock(&ipoll_lock); if (rc) @@ -286,7 +318,7 @@ static int prd_msg_handle_init(struct opal_prd_msg *msg) lock(&ipoll_lock); for_each_chip(chip) { __ipoll_update_mask(chip->id, false, - msg->init.ipoll & PRD_IPOLL_MASK); + msg->init.ipoll & prd_ipoll_mask); } unlock(&ipoll_lock); @@ -311,7 +343,7 @@ static int prd_msg_handle_fini(void) lock(&ipoll_lock); for_each_chip(chip) { - __ipoll_update_mask(chip->id, true, PRD_IPOLL_MASK); + __ipoll_update_mask(chip->id, true, prd_ipoll_mask); } unlock(&ipoll_lock); @@ -354,10 +386,12 @@ void prd_init(void) { struct proc_chip *chip; + prd_init_scoms(); + /* mask everything */ lock(&ipoll_lock); for_each_chip(chip) { - __ipoll_update_mask(chip->id, true, PRD_IPOLL_MASK); + __ipoll_update_mask(chip->id, true, prd_ipoll_mask); } unlock(&ipoll_lock);