Skip to content

Commit

Permalink
Merge pull request #92 from devenrao/oper
Browse files Browse the repository at this point in the history
POZ: To cater for additional requirements to parse SBE FFDC data
  • Loading branch information
aravynd authored Apr 16, 2024
2 parents e1f6365 + 5bc25b2 commit dd4d428
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
10 changes: 10 additions & 0 deletions libpdbg/sbefifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ static uint32_t sbefifo_op_ffdc_get(struct chipop *chipop, const uint8_t **ffdc,
if (status)
return status;

//if there is ffdc data for success case then parse it
if (*ffdc_len > 0) {
return status;
}

/* Check if async FFDC is set */
rc = fsi_read(fsi, SBE_MSG_REG, &value);
if (rc) {
Expand Down Expand Up @@ -210,6 +215,11 @@ static uint32_t sbefifo_op_ody_ffdc_get(struct chipop_ody *chipop, struct pdbg_t
if (status)
return status;

//if there is ffdc data for success case then parse it
if (*ffdc_len > 0) {
return status;
}

/* Check if async FFDC is set */
rc = fsi_ody_read(fsi, SBE_MSG_REG, &value);
if (rc) {
Expand Down
4 changes: 3 additions & 1 deletion libsbefifo/ffdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ void sbefifo_ffdc_set(struct sbefifo_context *sctx, uint32_t status, uint8_t *ff

uint32_t sbefifo_ffdc_get(struct sbefifo_context *sctx, const uint8_t **ffdc, uint32_t *ffdc_len)
{
*ffdc = sctx->ffdc;
if (sctx->ffdc_len > 0) {
*ffdc = sctx->ffdc;
}
*ffdc_len = sctx->ffdc_len;

return sctx->status;
Expand Down
10 changes: 8 additions & 2 deletions libsbefifo/operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "libsbefifo.h"
#include "sbefifo_private.h"

static const uint16_t SBEFIFO_MAX_FFDC_SIZE = 0x8000;

static int sbefifo_read(struct sbefifo_context *sctx, void *buf, size_t *buflen)
{
ssize_t n;
Expand Down Expand Up @@ -133,6 +135,10 @@ int sbefifo_parse_output(struct sbefifo_context *sctx, uint32_t cmd,
*out = NULL;
}

//if there is ffdc data for success store it in internal buffer
if((buflen - offset-4) > *out_len) {
sbefifo_ffdc_set(sctx, status_word, buf + offset, buflen - offset-4);
}
return 0;
}

Expand All @@ -152,10 +158,10 @@ int sbefifo_operation(struct sbefifo_context *sctx,
return ENOTCONN;

/*
* Allocate extra memory for FFDC (SBEFIFO_MAX_FFDC_SIZE = 0x2000)
* Allocate extra memory for FFDC (SBEFIFO_MAX_FFDC_SIZE = 0x8000)32kb
* Use *out_len as a hint to expected reply length
*/
buflen = (*out_len + 0x2000 + 3) & ~(uint32_t)3;
buflen = (*out_len + SBEFIFO_MAX_FFDC_SIZE + 3) & ~(uint32_t)3;
buf = malloc(buflen);
if (!buf)
return ENOMEM;
Expand Down

0 comments on commit dd4d428

Please sign in to comment.