From patchwork Fri Feb 20 00:37:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 441815 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 027671400EA for ; Fri, 20 Feb 2015 11:38:55 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id E4AB41A0F26 for ; Fri, 20 Feb 2015 11:38:54 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 7E7F31A0E65 for ; Fri, 20 Feb 2015 11:38:24 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 5586F140290; Fri, 20 Feb 2015 11:38:24 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id 2D566D47040; Fri, 20 Feb 2015 11:38:24 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Fri, 20 Feb 2015 11:37:56 +1100 Message-Id: <1424392679-27859-13-git-send-email-mikey@neuling.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1424392679-27859-1-git-send-email-mikey@neuling.org> References: <1424392679-27859-1-git-send-email-mikey@neuling.org> Cc: imunsie@au.ibm.com, grimm@linux.vnet.ibm.com, skiboot@lists.ozlabs.org Subject: [Skiboot] [PATCH 13/16] capi: Dynamically calculate which CAPP port to use X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 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" Currently we hardware the CAPP to use PHB0. This works for tuleta but not for other systems. This makes the port mapping dynamic so that first PHB to request a mode change to CAPI will get the CAPP port mapped to it. Calls to switch addition PHBs to CAPI mode will fail. Signed-off-by: Michael Neuling --- hw/phb3.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/hw/phb3.c b/hw/phb3.c index 8b9c188..f2e8442 100644 --- a/hw/phb3.c +++ b/hw/phb3.c @@ -3085,17 +3085,34 @@ static int64_t capp_load_ucode(struct phb3 *p) static void phb3_init_capp_regs(struct phb3 *p) { - /* writing field vals directly */ uint64_t reg; xscom_read(p->chip_id, APC_MASTER_PB_CTRL, ®); reg |= PPC_BIT(3); xscom_write(p->chip_id, APC_MASTER_PB_CTRL, reg); - /* port0 port1 - * 100 PHB0 disabled - * we're told it's the same for Venice - */ - xscom_write(p->chip_id, APC_MASTER_CAPI_CTRL, 0x4070000000000000); + + /* Dynamically workout which PHB to connect to port 0 of the CAPP. + * Here is the table from the CAPP workbook: + * APC_MASTER CAPP CAPP + * bits 1:3 port0 port1 + * 000 disabled disabled + * * 001 PHB2 disabled + * * 010 PHB1 disabled + * 011 PHB1 PHB2 + * * 100 PHB0 disabled + * 101 PHB0 PHB2 + * 110 PHB0 PHB1 + * + * We don't use port1 so only those starred above are used. + * Hence reduce table to: + * PHB0 -> APC MASTER(bits 1:3) = 0b100 + * PHB1 -> APC MASTER(bits 1:3) = 0b010 + * PHB2 -> APC MASTER(bits 1:3) = 0b001 + */ + reg = 0x4000000000000000ULL >> p->index; + reg |= 0x0070000000000000; + xscom_write(p->chip_id, APC_MASTER_CAPI_CTRL,reg); + PHBINF(p, "CAPP: port attached\n"); /* tlb and mmio */ xscom_write(p->chip_id, TRANSPORT_CONTROL, 0x4028000104000000);