diff mbox series

[4/5] libpdbg: Add dump() method to chipop target

Message ID 20201211021356.414095-5-amitay@ozlabs.org
State Accepted
Headers show
Series Implement get dump chip-op | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch master (41586bce6f00623d2d25a8483ee9187c2c0218af)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Amitay Isaacs Dec. 11, 2020, 2:13 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/hwunit.h  | 1 +
 libpdbg/sbefifo.c | 9 +++++++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h
index 22b3b58..a3e3a41 100644
--- a/libpdbg/hwunit.h
+++ b/libpdbg/hwunit.h
@@ -77,6 +77,7 @@  struct chipop {
 	int (*mpipl_enter)(struct chipop *);
 	int (*mpipl_continue)(struct chipop *);
 	int (*mpipl_get_ti_info)(struct chipop *, uint8_t **, uint32_t *);
+	int (*dump)(struct chipop *, uint8_t, uint8_t, uint8_t **, uint32_t *);
 };
 #define target_to_chipop(x) container_of(x, struct chipop, target)
 
diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c
index cfc8488..e2a98cf 100644
--- a/libpdbg/sbefifo.c
+++ b/libpdbg/sbefifo.c
@@ -205,6 +205,14 @@  static int sbefifo_op_mpipl_get_ti_info(struct chipop *chipop, uint8_t **data, u
 	return sbefifo_mpipl_get_ti_info(sctx, data, data_len);
 }
 
+static int sbefifo_op_dump(struct chipop *chipop, uint8_t type, uint8_t clock, uint8_t **data, uint32_t *data_len)
+{
+	struct sbefifo *sbefifo = target_to_sbefifo(chipop->target.parent);
+	struct sbefifo_context *sctx = sbefifo->get_sbefifo_context(sbefifo);
+
+	return sbefifo_get_dump(sctx, type, clock, data, data_len);
+}
+
 static struct sbefifo *pib_to_sbefifo(struct pdbg_target *pib)
 {
 	struct pdbg_target *target;
@@ -800,6 +808,7 @@  static struct chipop sbefifo_chipop = {
 	.mpipl_enter = sbefifo_op_mpipl_enter,
 	.mpipl_continue = sbefifo_op_mpipl_continue,
 	.mpipl_get_ti_info = sbefifo_op_mpipl_get_ti_info,
+	.dump = sbefifo_op_dump,
 };
 DECLARE_HW_UNIT(sbefifo_chipop);