Skip to content

Commit

Permalink
cater for odyssey ocmb chipop for dump and ffdc
Browse files Browse the repository at this point in the history
1) Modify backend dts file to add fsi targets as they
are used as part of getting ffdc

2) Added new chipop for odyssey target which caters for
dump and ffdc

Tested
get_backend_target class_name chipop-ody ocmb_proc 0 ocmb_index 3
get_backend_target class_name fsi-ody ocmb_proc 0 ocmb_index 3
get_backend_target class_name chipop-ody ocmb_proc 0 ocmb_index 3
**sucessfully collected dump data len is 20184
before calling sbe_ody_ffdc_get
PDBG:fsi_ody_read[382]: rc = 0, addr = 0x02809, data = 0x9133603f, target = /hmfsi-ody@111
**status of ffdc_get is 0 ffdc_len 0

Signed-off-by: Marri Devender Rao <[email protected]>
Change-Id: Ieb21eef8c18344e9dae5e7f9c7acf0db60eced9e
  • Loading branch information
devenrao committed Dec 14, 2023
1 parent 216740b commit 403e877
Show file tree
Hide file tree
Showing 10 changed files with 298 additions and 113 deletions.
170 changes: 98 additions & 72 deletions bmc-sbefifo.dts.m4
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,25 @@ define(`HMFSI',

//ody ocmb system device tree targets will be mapped to backend
//ody sbefifo device tree targets based on proc, ocmb chip index
dnl
dnl HMFSI_ODY([index], [proc], [path-index], [port])
dnl
define(`HMFSI_ODY',
`
hmfsi-ody@$3$4 {
#address-cells = <0x2>;
#size-cells = <0x1>;
compatible = "ibm,kernel-fsi-ody";
device-path = "/i2cr$3$4/slave@00:00/raw";
reg = <0x0 0x$1 0x8000>; /*dummy to fix dts warning*/
index = <0x$1>;
proc = <0x$2>;
port = <$4>;

SBEFIFO_ODY($1, $2, $3, $4)
};
')dnl

dnl
dnl SBEFIFO_ODY([index], [proc], [path-index], [port] [])
dnl
Expand All @@ -105,6 +124,13 @@ define(`SBEFIFO_ODY',
proc = <0x$2>;
port = <$4>;
device-path = "/dev/sbefifo$3$4";

sbefifo-chipop-ody {
compatible = "ibm,sbefifo-chipop-ody";
index = <0x$1>;
proc = <0x$2>;
port = <$4>;
};
};

')dnl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HMFSI_ODY(5, 2, 3, 13)
HMFSI_ODY(6, 2, 3, 14)
HMFSI_ODY(7, 2, 3, 15)

HMFSI_ODY(0, 3, 4, 02)
HMFSI_ODY(1, 3, 4, 03)
HMFSI_ODY(2, 3, 4, 10)
HMFSI_ODY(3, 3, 4, 11)
HMFSI_ODY(4, 3, 4, 14)
HMFSI_ODY(5, 3, 4, 15)
HMFSI_ODY(6, 3, 4, 16)
HMFSI_ODY(7, 3, 4, 17)

HMFSI_ODY(0, 4, 5, 00)
HMFSI_ODY(1, 4, 5, 01)
HMFSI_ODY(2, 4, 5, 10)
HMFSI_ODY(3, 4, 5, 11)
HMFSI_ODY(4, 4, 5, 12)
HMFSI_ODY(5, 4, 5, 13)
HMFSI_ODY(6, 4, 5, 14)
HMFSI_ODY(7, 4, 5, 15)

HMFSI_ODY(0, 5, 6, 02)
HMFSI_ODY(1, 5, 6, 03)
HMFSI_ODY(2, 5, 6, 10)
HMFSI_ODY(3, 5, 6, 11)
HMFSI_ODY(4, 5, 6, 14)
HMFSI_ODY(5, 5, 6, 15)
HMFSI_ODY(6, 5, 6, 16)
HMFSI_ODY(7, 5, 6, 17)

HMFSI_ODY(0, 6, 7, 00)
HMFSI_ODY(1, 6, 7, 01)
HMFSI_ODY(2, 6, 7, 10)
HMFSI_ODY(3, 6, 7, 11)
HMFSI_ODY(4, 6, 7, 12)
HMFSI_ODY(5, 6, 7, 13)
HMFSI_ODY(6, 6, 7, 14)
HMFSI_ODY(7, 6, 7, 15)

HMFSI_ODY(0, 7, 8, 02)
HMFSI_ODY(1, 7, 8, 03)
HMFSI_ODY(2, 7, 8, 10)
HMFSI_ODY(3, 7, 8, 11)
HMFSI_ODY(4, 7, 8, 14)
HMFSI_ODY(5, 7, 8, 15)
HMFSI_ODY(6, 7, 8, 16)
HMFSI_ODY(7, 7, 8, 17)
};
7 changes: 7 additions & 0 deletions libpdbg/hwunit.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ struct chipop {
};
#define target_to_chipop(x) container_of(x, struct chipop, target)

struct chipop_ody {
struct pdbg_target target;
uint32_t (*ffdc_get)(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)

struct sbefifo {
struct pdbg_target target;
struct sbefifo_context *sf_ctx;
Expand Down
8 changes: 8 additions & 0 deletions libpdbg/libpdbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,14 @@ struct pdbg_target* get_ody_pib_target(struct pdbg_target* target);
* @return fsi target
*/
struct pdbg_target* get_ody_fsi_target(struct pdbg_target* target);

/**
* @brief Get the fsi pdbg target for the matching odyssey ocmb chip target
* @param[in] target ocmb pdbg_target
* @return fsi target
*/
struct pdbg_target* get_ody_chipop_target(struct pdbg_target* target);

/**
* @brief Read data from i2c device
*
Expand Down
118 changes: 82 additions & 36 deletions libpdbg/sbe_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,55 +170,101 @@ int sbe_mpipl_get_ti_info(struct pdbg_target *target, uint8_t **data, uint32_t *
return 0;
}

int sbe_dump(struct pdbg_target *target, uint8_t type, uint8_t clock, uint8_t fa_collect, uint8_t **data, uint32_t *data_len)
int sbe_dump(struct pdbg_target *target, uint8_t type, uint8_t clock,
uint8_t fa_collect, uint8_t **data, uint32_t *data_len)
{
struct chipop *chipop;
int rc;
if(!is_ody_ocmb_chip(target)) {
struct chipop *chipop;
int rc;

chipop = pib_to_chipop(target);
if (!chipop)
return -1;
chipop = pib_to_chipop(target);
if (!chipop)
return -1;

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

rc = chipop->dump(chipop, type, clock, fa_collect, data, data_len);
if (rc) {
PR_ERROR("sbe dump() returned rc=%d\n", rc);
return -1;
}
rc = chipop->dump(chipop, type, clock, fa_collect, data, data_len);
if (rc) {
PR_ERROR("sbe dump() returned rc=%d\n", rc);
return -1;
}
} else {
struct chipop_ody *chipop;
int rc;
struct pdbg_target *co_target = get_ody_chipop_target(target);
chipop = target_to_chipop_ody(co_target);
if (!chipop)
return -1;

if (!chipop->dump) {
PR_ERROR("dump() not implemented for the target\n");
return -1;
}
rc = chipop->dump(chipop, type, clock, fa_collect, data, data_len);
if (rc) {
PR_ERROR("sbe dump() returned rc=%d\n", rc);
return -1;
}
}
return 0;
}

int sbe_ffdc_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc, uint32_t *ffdc_len)
int sbe_ffdc_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc,
uint32_t *ffdc_len)
{
struct chipop *chipop;
const uint8_t *data = NULL;
uint32_t len = 0;

chipop = pib_to_chipop(target);
if (!chipop)
return -1;
if(!is_ody_ocmb_chip(target)) {
struct chipop *chipop;
const uint8_t *data = NULL;
uint32_t len = 0;

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

*status = chipop->ffdc_get(chipop, &data, &len);
if (data && len > 0) {
*ffdc = malloc(len);
assert(*ffdc);
memcpy(*ffdc, data, len);
*ffdc_len = len;
if (!chipop->ffdc_get) {
PR_ERROR("ffdc_get() not implemented for the target\n");
return -1;
}

*status = chipop->ffdc_get(chipop, &data, &len);
if (data && len > 0) {
*ffdc = malloc(len);
assert(*ffdc);
memcpy(*ffdc, data, len);
*ffdc_len = len;
} else {
*ffdc = NULL;
*ffdc_len = 0;
}
} else {
*ffdc = NULL;
*ffdc_len = 0;
}
struct chipop_ody *chipop;
const uint8_t *data = NULL;
uint32_t len = 0;

struct pdbg_target *co_target = get_ody_chipop_target(target);
chipop = target_to_chipop_ody(co_target);
if (!chipop)
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);
if (data && len > 0) {
*ffdc = malloc(len);
assert(*ffdc);
memcpy(*ffdc, data, len);
*ffdc_len = len;
} else {
*ffdc = NULL;
*ffdc_len = 0;
}
}
return 0;
}

Expand Down
Loading

0 comments on commit 403e877

Please sign in to comment.