Skip to content

Commit

Permalink
POZ: fix ffdc_get method to take chipop target
Browse files Browse the repository at this point in the history
modified the ffdc_get method to take chipop target and fsi
target to keep it inline with dump chipop

existing implementation crashes as we cannot convert
ocmb target to sbefifio using target_to_sbefifo macro as
sbefifo is a backend target and is parent of chipop target
in the backend.

Tested:
sbedump - calling sbe_ffdc_get
PDBG:fsi_ody_read[382]: rc = 0, addr = 0x02809, data = 0x9133603f, target = /hmfsi-ody@115
ffdc data status is 0 ffdc_len 0

Signed-off-by: Marri Devender Rao <[email protected]>
Change-Id: I7e364416f9f8dc50d0b38e0503bef50e432ff41b
  • Loading branch information
devenrao committed Mar 2, 2024
1 parent e81f3f6 commit 99b4fc4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libpdbg/hwunit.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct chipop {

struct chipop_ody {
struct pdbg_target target;
uint32_t (*ffdc_get)(struct pdbg_target *, const uint8_t **, uint32_t *);
uint32_t (*ffdc_get)(struct chipop_ody*, struct pdbg_target*, const uint8_t **, uint32_t *);
int (*dump)(struct chipop_ody *, uint8_t, uint8_t, uint8_t, uint8_t **, uint32_t *);
};
#define target_to_chipop_ody(x) container_of(x, struct chipop_ody, target)
Expand Down
13 changes: 10 additions & 3 deletions libpdbg/sbe_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,22 @@ int sbe_ffdc_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc,

struct pdbg_target *co_target = get_ody_chipop_target(target);
chipop = target_to_chipop_ody(co_target);
if (!chipop)
if (!chipop) {
PR_ERROR("chipop target not found for ody ocmb chip\n");
return -1;

}
if (!chipop->ffdc_get) {
PR_ERROR("ffdc_get() not implemented for the target\n");
return -1;
}

*status = chipop->ffdc_get(target, &data, &len);
struct pdbg_target *fsi = get_ody_fsi_target(target);

if (!fsi) {
PR_ERROR("fsi target not found for ody ocmb chip\n");
return -1;
}
*status = chipop->ffdc_get(chipop, fsi, &data, &len);
if (data && len > 0) {
*ffdc = malloc(len);
assert(*ffdc);
Expand Down
8 changes: 4 additions & 4 deletions libpdbg/sbefifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ static uint32_t sbefifo_op_ffdc_get(struct chipop *chipop, const uint8_t **ffdc,

}

static uint32_t sbefifo_op_ody_ffdc_get(struct pdbg_target *ocmb, const uint8_t **ffdc, uint32_t *ffdc_len)
static uint32_t sbefifo_op_ody_ffdc_get(struct chipop_ody *chipop, struct pdbg_target *fsi,
const uint8_t **ffdc, uint32_t *ffdc_len)
{
struct pdbg_target *fsi = get_ody_fsi_target(ocmb);
struct sbefifo *sbefifo = target_to_sbefifo(ocmb);

struct sbefifo *sbefifo = target_to_sbefifo(chipop->target.parent);

struct sbefifo_context *sctx = sbefifo->get_sbefifo_context(sbefifo);
uint32_t status, value = 0;
int rc;
Expand Down

0 comments on commit 99b4fc4

Please sign in to comment.