From patchwork Thu Sep 24 04:42:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1370286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bxj9r73Xzz9sTM for ; Thu, 24 Sep 2020 14:44:00 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=RJXTrRc3; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4Bxj9r5PBGzDqZ1 for ; Thu, 24 Sep 2020 14:44:00 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Bxj8g1VChzDqZD for ; Thu, 24 Sep 2020 14:42:59 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=RJXTrRc3; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Bxj8f2Ls3z9sSt; Thu, 24 Sep 2020 14:42:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1600922578; bh=5uvo7ZFHLA3dXK9dpmz2e5Ei5ZUS3qPRJIrQ9Ozr1G0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJXTrRc3KNP2A7tsAuETtgcdtOmeZGPAQqtO6OFO3NM1jKF+DDcVSHqTPtML8iPuF 52MjFOMypsvjgClCeKfS9eNq9+A3umWIIcJTfNqYbLv6AjH+QG0ttP0bbAStndzSNw tuUMmYtSJR+XnRCbGkonjAPm4ESd+ZOux+9CCw3nj4I9CAu0dW6E7bG0zB3CN3ZnIZ ZVOQLHnnYg3O2SqaqG1Sq0HSSn7G4gDquc1TxFN6X/r8WsXEwL5/hPJgepRqJzfE+z 44Zut041vKiCTVOrt/iwW5vIhff+qSmMXmzLFMqzyJ5TEyrAm95/cxp90S1/2GYKJ9 Poe/8sweVlw1g== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 24 Sep 2020 14:42:35 +1000 Message-Id: <20200924044236.130586-18-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924044236.130586-1-amitay@ozlabs.org> References: <20200924044236.130586-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 17/18] libpdbg: Add ocmb_{getscom/putscom} api X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/libpdbg.h | 22 ++++++++++++++++++++++ libpdbg/target.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 2630fd7..08894d6 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -1329,6 +1329,28 @@ int sbe_mpipl_continue(struct pdbg_target *target); */ int sbe_mpipl_get_ti_info(struct pdbg_target *target, uint8_t **data, uint32_t *data_len); +/** + * @brief Read a OCMB SCOM register + * + * @param[in] target ocmb target + * @param[in] addr the address offset relative to target + * @param[out] val the read data + * + * @return 0 on success, -1 on failure + */ +int ocmb_getscom(struct pdbg_target *target, uint64_t addr, uint64_t *val); + +/** + * @brief Write a OCMB SCOM register + * + * @param[in] target ocmb target + * @param[in] addr the address offset relative to target + * @param[in] val the write data + * + * @return 0 on success, -1 on failure + */ +int ocmb_putscom(struct pdbg_target *target, uint64_t addr, uint64_t val); + /** * @brief Type for specifying a progress callback for long running * operations diff --git a/libpdbg/target.c b/libpdbg/target.c index 8a7d1a6..89006d0 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -455,6 +455,44 @@ int sbe_mpipl_get_ti_info(struct pdbg_target *target, uint8_t **data, uint32_t * return chipop->mpipl_get_ti_info(chipop, data, data_len); } +int ocmb_getscom(struct pdbg_target *target, uint64_t addr, uint64_t *val) +{ + struct ocmb *ocmb; + + assert(pdbg_target_is_class(target, "ocmb")); + + if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) + return -1; + + ocmb = target_to_ocmb(target); + + if (!ocmb->getscom) { + PR_ERROR("getscom() not implemented for the target\n"); + return -1; + } + + return ocmb->getscom(ocmb, addr, val); +} + +int ocmb_putscom(struct pdbg_target *target, uint64_t addr, uint64_t val) +{ + struct ocmb *ocmb; + + assert(pdbg_target_is_class(target, "ocmb")); + + if (pdbg_target_status(target) != PDBG_TARGET_ENABLED) + return -1; + + ocmb = target_to_ocmb(target); + + if (!ocmb->putscom) { + PR_ERROR("putscom() not implemented for the target\n"); + return -1; + } + + return ocmb->putscom(ocmb, addr, val); +} + uint32_t sbe_ffdc_get(struct pdbg_target *target, uint8_t **ffdc, uint32_t *ffdc_len) { struct chipop *chipop;