[Pdbg] [PATCH 17/18] libpdbg: Add ocmb_{getscom/putscom} api
Amitay Isaacs
amitay at ozlabs.org
Thu Sep 24 14:42:35 AEST 2020
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
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;
--
2.26.2
More information about the Pdbg
mailing list