From patchwork Fri Jul 7 21:08:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 785763 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 3x46gQ06Knz9s8J for ; Sat, 8 Jul 2017 07:09:38 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3x46gP65BLzDr8w for ; Sat, 8 Jul 2017 07:09:37 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3x46fw4CwwzDr9F for ; Sat, 8 Jul 2017 07:09:12 +1000 (AEST) Received: from pasglop.austin.ibm.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id v67L8efR002710; Fri, 7 Jul 2017 16:08:48 -0500 From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Fri, 7 Jul 2017 16:08:43 -0500 Message-Id: <20170707210846.24825-6-benh@kernel.crashing.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170707210846.24825-1-benh@kernel.crashing.org> References: <20170707210846.24825-1-benh@kernel.crashing.org> Subject: [Skiboot] [PATCH 6/9] phb4: Use new accessors in a few places 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: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This replaces use of MMIO registers with the new accessors in places that can be called during recovery procedures at times when the PHB can be fenced. Signed-off-by: Benjamin Herrenschmidt --- hw/phb4.c | 82 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index 03b357d..1612652 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -175,10 +175,10 @@ static void phb4_write_reg(struct phb4 *p, uint32_t offset, uint64_t val) static inline void phb4_ioda_sel(struct phb4 *p, uint32_t table, uint32_t addr, bool autoinc) { - out_be64(p->regs + PHB_IODA_ADDR, - (autoinc ? PHB_IODA_AD_AUTOINC : 0) | - SETFIELD(PHB_IODA_AD_TSEL, 0ul, table) | - SETFIELD(PHB_IODA_AD_TADR, 0ul, addr)); + phb4_write_reg(p, PHB_IODA_ADDR, + (autoinc ? PHB_IODA_AD_AUTOINC : 0) | + SETFIELD(PHB_IODA_AD_TSEL, 0ul, table) | + SETFIELD(PHB_IODA_AD_TADR, 0ul, addr)); } static void phb4_read_phb_status(struct phb4 *p, @@ -1734,7 +1734,7 @@ static int64_t phb4_get_msi_64(struct phb *phb, static void phb4_err_clear(struct phb4 *p) { uint64_t val64; - uint64_t fir = in_be64(p->regs + PHB_LEM_FIR_ACCUM); + uint64_t fir = phb4_read_reg(p, PHB_LEM_FIR_ACCUM); /* Rec 1: Acquire the PCI config lock (we don't need to do this) */ @@ -1743,50 +1743,50 @@ static void phb4_err_clear(struct phb4 *p) phb4_init_rc_cfg(p); /* Rec 16/17: Clear PBL errors */ - val64 = in_be64(p->regs + PHB_PBL_ERR_STATUS); - out_be64(p->regs + PHB_PBL_ERR_STATUS, val64); + val64 = phb4_read_reg(p, PHB_PBL_ERR_STATUS); + phb4_write_reg(p, PHB_PBL_ERR_STATUS, val64); /* Rec 18/19: Clear REGB errors */ - val64 = in_be64(p->regs + PHB_REGB_ERR_STATUS); - out_be64(p->regs + PHB_REGB_ERR_STATUS, val64); + val64 = phb4_read_reg(p, PHB_REGB_ERR_STATUS); + phb4_write_reg(p, PHB_REGB_ERR_STATUS, val64); /* Rec 20...59: Clear PHB error trap */ - val64 = in_be64(p->regs + PHB_TXE_ERR_STATUS); - out_be64(p->regs + PHB_TXE_ERR_STATUS, val64); - out_be64(p->regs + PHB_TXE_ERR1_STATUS, 0x0ul); - out_be64(p->regs + PHB_TXE_ERR_LOG_0, 0x0ul); - out_be64(p->regs + PHB_TXE_ERR_LOG_1, 0x0ul); - - val64 = in_be64(p->regs + PHB_RXE_ARB_ERR_STATUS); - out_be64(p->regs + PHB_RXE_ARB_ERR_STATUS, val64); - out_be64(p->regs + PHB_RXE_ARB_ERR1_STATUS, 0x0ul); - out_be64(p->regs + PHB_RXE_ARB_ERR_LOG_0, 0x0ul); - out_be64(p->regs + PHB_RXE_ARB_ERR_LOG_1, 0x0ul); - - val64 = in_be64(p->regs + PHB_RXE_MRG_ERR_STATUS); - out_be64(p->regs + PHB_RXE_MRG_ERR_STATUS, val64); - out_be64(p->regs + PHB_RXE_MRG_ERR1_STATUS, 0x0ul); - out_be64(p->regs + PHB_RXE_MRG_ERR_LOG_0, 0x0ul); - out_be64(p->regs + PHB_RXE_MRG_ERR_LOG_1, 0x0ul); - - val64 = in_be64(p->regs + PHB_RXE_TCE_ERR_STATUS); - out_be64(p->regs + PHB_RXE_TCE_ERR_STATUS, val64); - out_be64(p->regs + PHB_RXE_TCE_ERR1_STATUS, 0x0ul); - out_be64(p->regs + PHB_RXE_TCE_ERR_LOG_0, 0x0ul); - out_be64(p->regs + PHB_RXE_TCE_ERR_LOG_1, 0x0ul); - - val64 = in_be64(p->regs + PHB_ERR_STATUS); - out_be64(p->regs + PHB_ERR_STATUS, val64); - out_be64(p->regs + PHB_ERR1_STATUS, 0x0ul); - out_be64(p->regs + PHB_ERR_LOG_0, 0x0ul); - out_be64(p->regs + PHB_ERR_LOG_1, 0x0ul); + val64 = phb4_read_reg(p, PHB_TXE_ERR_STATUS); + phb4_write_reg(p, PHB_TXE_ERR_STATUS, val64); + phb4_write_reg(p, PHB_TXE_ERR1_STATUS, 0x0ul); + phb4_write_reg(p, PHB_TXE_ERR_LOG_0, 0x0ul); + phb4_write_reg(p, PHB_TXE_ERR_LOG_1, 0x0ul); + + val64 = phb4_read_reg(p, PHB_RXE_ARB_ERR_STATUS); + phb4_write_reg(p, PHB_RXE_ARB_ERR_STATUS, val64); + phb4_write_reg(p, PHB_RXE_ARB_ERR1_STATUS, 0x0ul); + phb4_write_reg(p, PHB_RXE_ARB_ERR_LOG_0, 0x0ul); + phb4_write_reg(p, PHB_RXE_ARB_ERR_LOG_1, 0x0ul); + + val64 = phb4_read_reg(p, PHB_RXE_MRG_ERR_STATUS); + phb4_write_reg(p, PHB_RXE_MRG_ERR_STATUS, val64); + phb4_write_reg(p, PHB_RXE_MRG_ERR1_STATUS, 0x0ul); + phb4_write_reg(p, PHB_RXE_MRG_ERR_LOG_0, 0x0ul); + phb4_write_reg(p, PHB_RXE_MRG_ERR_LOG_1, 0x0ul); + + val64 = phb4_read_reg(p, PHB_RXE_TCE_ERR_STATUS); + phb4_write_reg(p, PHB_RXE_TCE_ERR_STATUS, val64); + phb4_write_reg(p, PHB_RXE_TCE_ERR1_STATUS, 0x0ul); + phb4_write_reg(p, PHB_RXE_TCE_ERR_LOG_0, 0x0ul); + phb4_write_reg(p, PHB_RXE_TCE_ERR_LOG_1, 0x0ul); + + val64 = phb4_read_reg(p, PHB_ERR_STATUS); + phb4_write_reg(p, PHB_ERR_STATUS, val64); + phb4_write_reg(p, PHB_ERR1_STATUS, 0x0ul); + phb4_write_reg(p, PHB_ERR_LOG_0, 0x0ul); + phb4_write_reg(p, PHB_ERR_LOG_1, 0x0ul); /* Rec 61/62: Clear FIR/WOF */ - out_be64(p->regs + PHB_LEM_FIR_AND_MASK, ~fir); - out_be64(p->regs + PHB_LEM_WOF, 0x0ul); + phb4_write_reg(p, PHB_LEM_FIR_AND_MASK, ~fir); + phb4_write_reg(p, PHB_LEM_WOF, 0x0ul); /* Rec 63: Update LEM mask to its initial value */ - out_be64(p->regs + PHB_LEM_ERROR_MASK, 0x0ul); + phb4_write_reg(p, PHB_LEM_ERROR_MASK, 0x0ul); /* Rec 64: Clear the PCI config lock (we don't need to do this) */ }