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 <devenrao@in.ibm.com>
Change-Id: Ieb21eef8c18344e9dae5e7f9c7acf0db60eced9e
  • Loading branch information
devenrao committed Dec 12, 2023
1 parent 4b7813b commit 09ea041
Show file tree
Hide file tree
Showing 12 changed files with 285 additions and 78 deletions.
170 changes: 98 additions & 72 deletions bmc-sbefifo.dts.m4
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ define(`HMFSI',
};
')dnl

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 @@ -95,6 +114,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
Expand Down Expand Up @@ -150,76 +176,76 @@ define(`B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(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
16 changes: 16 additions & 0 deletions libpdbg/libpdbg_sbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ int sbe_istep(struct pdbg_target *target, uint32_t major, uint32_t minor);
*/
int sbe_ffdc_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc, uint32_t *ffdc_len);

/**
* @brief Get FFDC data if error is generated
*
* @param[in] target ocmb target to operate on
* @param[out] status The status word
* @param[out] ffdc pointer to output buffer to store ffdc data
* @param[out] ffdc_len the sizeof the ffdc data returned
*
* @return 0 on success, -1 on failure
*
* The ffdc data must be freed by caller. It is allocated using malloc and
* must be freed using free().
*/
int sbe_ffdc_ody_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc, uint32_t *ffdc_len);

/**
* @brief Execute enter mpipl on the pib
*
Expand Down Expand Up @@ -92,6 +107,7 @@ int sbe_mpipl_get_ti_info(struct pdbg_target *target, uint8_t **data, uint32_t *
*/
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_ody_dump(struct pdbg_target *target, uint8_t type, uint8_t clock, uint8_t fa_collect, uint8_t **data, uint32_t *data_len);
/**
* @brief Get sbe state
*
Expand Down
51 changes: 51 additions & 0 deletions libpdbg/sbe_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,27 @@ int sbe_dump(struct pdbg_target *target, uint8_t type, uint8_t clock, uint8_t fa
return 0;
}

int sbe_ody_dump(struct pdbg_target *target, uint8_t type, uint8_t clock, uint8_t fa_collect, uint8_t **data, uint32_t *data_len)
{
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)
{
struct chipop *chipop;
Expand Down Expand Up @@ -222,6 +243,36 @@ int sbe_ffdc_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc, u
return 0;
}

int sbe_ffdc_ody_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc, uint32_t *ffdc_len)
{
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;
}

static int sbe_read_msg_register(struct pdbg_target *pib, uint32_t *value)
{
struct pdbg_target *fsi = pdbg_target_parent_virtual("fsi", pib);
Expand Down
50 changes: 50 additions & 0 deletions libpdbg/sbefifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,37 @@ 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)
{
struct pdbg_target *fsi = get_ody_fsi_target(ocmb);
struct sbefifo *sbefifo = target_to_sbefifo(ocmb);

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

status = sbefifo_ffdc_get(sctx, ffdc, ffdc_len);
if (status)
return status;

/* Check if async FFDC is set */
rc = fsi_ody_read(fsi, SBE_MSG_REG, &value);
if (rc) {
PR_NOTICE("Failed to read sbe mailbox register\n");
goto end;
}

if ((value & SBE_MSG_ASYNC_FFDC) == SBE_MSG_ASYNC_FFDC) {
sbefifo_get_ffdc(sbefifo->sf_ctx);
return sbefifo_ffdc_get(sctx, ffdc, ffdc_len);
}

end:
*ffdc = NULL;
*ffdc_len = 0;
return 0;

}
static int sbefifo_op_istep(struct chipop *chipop,
uint32_t major, uint32_t minor)
{
Expand Down Expand Up @@ -239,6 +270,13 @@ static int sbefifo_op_dump(struct chipop *chipop, uint8_t type, uint8_t clock, u

return sbefifo_get_dump(sctx, type, clock, fa_collect, data, data_len);
}
static int sbefifo_op_ody_dump(struct chipop_ody *chipop, uint8_t type, uint8_t clock, uint8_t fa_collect, 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, fa_collect, data, data_len);
}

static int sbefifo_op_lpc_timeout(struct chipop *chipop, uint32_t *timeout_flag)
{
Expand Down Expand Up @@ -860,6 +898,17 @@ static struct chipop sbefifo_chipop = {
};
DECLARE_HW_UNIT(sbefifo_chipop);

static struct chipop_ody sbefifo_chipop_ody = {
.target = {
.name = "SBE FIFO Chip-op engine odyssey",
.compatible = "ibm,sbefifo-chipop-ody",
.class = "chipop-ody",
},
.dump = sbefifo_op_ody_dump,
.ffdc_get = sbefifo_op_ody_ffdc_get,
};
DECLARE_HW_UNIT(sbefifo_chipop_ody);

static struct pib sbefifo_pib = {
.target = {
.name = "SBE FIFO Chip-op based PIB",
Expand Down Expand Up @@ -937,6 +986,7 @@ static void register_sbefifo(void)
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_sbefifo_hw_unit);
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &kernel_sbefifo_ody_hw_unit);
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &sbefifo_chipop_hw_unit);
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &sbefifo_chipop_ody_hw_unit);
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &sbefifo_pib_hw_unit);
pdbg_hwunit_register(PDBG_BACKEND_SBEFIFO, &sbefifo_thread_hw_unit);
pdbg_hwunit_register(PDBG_DEFAULT_BACKEND, &sbefifo_mem_hw_unit);
Expand Down
Loading

0 comments on commit 09ea041

Please sign in to comment.