From patchwork Thu Feb 12 01:57: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: 438991 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3B44D14017B for ; Thu, 12 Feb 2015 12:58:38 +1100 (AEDT) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id DCE041A0A2C for ; Thu, 12 Feb 2015 12:58:37 +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 C1DF41A09FF for ; Thu, 12 Feb 2015 12:58:11 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 7D3231400EA; Thu, 12 Feb 2015 12:58:11 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id 650B8D46EE9; Thu, 12 Feb 2015 12:58:11 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Thu, 12 Feb 2015 12:57:56 +1100 Message-Id: <1423706279-12170-7-git-send-email-mikey@neuling.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1423706279-12170-1-git-send-email-mikey@neuling.org> References: <1423706279-12170-1-git-send-email-mikey@neuling.org> Cc: grimm@linux.vnet.ibm.com, imunsie@au.ibm.com, skiboot@lists.ozlabs.org Subject: [Skiboot] [PATCH 07/10] 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 b27bac3..56f68a7 100644 --- a/hw/phb3.c +++ b/hw/phb3.c @@ -3083,17 +3083,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 stared 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);