Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POZ: To cater for additional requirements to parse SBE FFDC data #92

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
devenrao marked this conversation as resolved.
Show resolved Hide resolved

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
Loading