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

Revert index commit #100

Closed
Closed
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
35 changes: 26 additions & 9 deletions libpdbg/dtb.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ static const uint16_t ODYSSEY_CHIP_ID = 0x60C0;
static const uint8_t ATTR_TYPE_OCMB_CHIP = 75;
static const char* RAINIER = "rainier";
static const char* EVEREST = "everest";
static const char* FUJI = "fuji";
static const char* BLUERIDGE = "blueridge";

static struct pdbg_dtb pdbg_dtb = {
.backend = {
Expand Down Expand Up @@ -116,6 +118,13 @@ bool contains_substring_ignoring_case(const char* buffer, const char* substring)
size_t bufferLen = strlen(buffer);
size_t substringLen = strlen(substring);

//If the string that we are looking for is longer than the
//given string, return as not found
if(substringLen > bufferLen)
{
return false;
}

for (size_t i = 0; i <= bufferLen - substringLen; ++i) {
size_t j;
for (j = 0; j < substringLen; ++j) {
Expand Down Expand Up @@ -319,10 +328,12 @@ static void bmc_target(struct pdbg_dtb *dtb)
pdbg_proc = PDBG_PROC_P10;
if (!dtb->backend.fdt) {
char *system_type = get_p10_system_type();
if (contains_substring_ignoring_case(system_type, EVEREST)) {
if (contains_substring_ignoring_case(system_type, EVEREST) ||
contains_substring_ignoring_case(system_type, FUJI)) {
pdbg_log(PDBG_INFO, "bmc_target - loading bmc kernel everest target");
dtb->backend.fdt = &_binary_bmc_kernel_everest_dtb_o_start;
} else if (contains_substring_ignoring_case(system_type, RAINIER)) {
} else if (contains_substring_ignoring_case(system_type, RAINIER)||
contains_substring_ignoring_case(system_type, BLUERIDGE)) {
pdbg_log(PDBG_INFO, "bmc_target - loading bmc kernel rainier target");
dtb->backend.fdt = &_binary_bmc_kernel_rainier_dtb_o_start;
} else {
Expand Down Expand Up @@ -350,10 +361,12 @@ static void bmc_target(struct pdbg_dtb *dtb)
pdbg_proc = PDBG_PROC_P10;
if (!dtb->backend.fdt) {
char *system_type = get_p10_system_type();
if (contains_substring_ignoring_case(system_type, EVEREST)) {
if (contains_substring_ignoring_case(system_type, EVEREST) ||
contains_substring_ignoring_case(system_type, FUJI)) {
pdbg_log(PDBG_INFO, "bmc_target - loading bmc kernel everest target");
dtb->backend.fdt = &_binary_bmc_kernel_everest_dtb_o_start;
} else if (contains_substring_ignoring_case(system_type, RAINIER)) {
} else if (contains_substring_ignoring_case(system_type, RAINIER) ||
contains_substring_ignoring_case(system_type, BLUERIDGE)) {
pdbg_log(PDBG_INFO, "bmc_target - loading bmc kernel rainier target");
dtb->backend.fdt = &_binary_bmc_kernel_rainier_dtb_o_start;
} else {
Expand Down Expand Up @@ -406,11 +419,13 @@ static void sbefifo_target(struct pdbg_dtb *dtb)
pdbg_proc = PDBG_PROC_P10;
if (!dtb->backend.fdt) {
char *system_type = get_p10_system_type();
if (contains_substring_ignoring_case(system_type, EVEREST)) {
if (contains_substring_ignoring_case(system_type, EVEREST) ||
contains_substring_ignoring_case(system_type, FUJI)) {
pdbg_log(PDBG_INFO,
"sbefifo_target - loading bmc sbefifo everest target");
dtb->backend.fdt = &_binary_bmc_sbefifo_everest_dtb_o_start;
} else if (contains_substring_ignoring_case(system_type, RAINIER)) {
} else if (contains_substring_ignoring_case(system_type, RAINIER) ||
contains_substring_ignoring_case(system_type, BLUERIDGE)) {
pdbg_log(PDBG_INFO,
"sbefifo_target - loading bmc sbefifo rainier target");
dtb->backend.fdt = &_binary_bmc_sbefifo_rainier_dtb_o_start;
Expand Down Expand Up @@ -439,11 +454,13 @@ static void sbefifo_target(struct pdbg_dtb *dtb)
pdbg_proc = PDBG_PROC_P10;
if (!dtb->backend.fdt) {
char *system_type = get_p10_system_type();
if (contains_substring_ignoring_case(system_type, EVEREST)) {
if (contains_substring_ignoring_case(system_type, EVEREST) ||
contains_substring_ignoring_case(system_type, FUJI)) {
pdbg_log(PDBG_INFO,
"sbefifo_target - loading bmc sbefifo everest target");
dtb->backend.fdt = &_binary_bmc_sbefifo_everest_dtb_o_start;
} else if (contains_substring_ignoring_case(system_type, RAINIER)) {
} else if (contains_substring_ignoring_case(system_type, RAINIER) ||
contains_substring_ignoring_case(system_type, BLUERIDGE)) {
pdbg_log(PDBG_INFO,
"sbefifo_target - loading bmc sbefifo rainier target");
dtb->backend.fdt = &_binary_bmc_sbefifo_rainier_dtb_o_start;
Expand Down Expand Up @@ -725,7 +742,7 @@ static void close_dtb(struct pdbg_mfile *mfile)

bool is_ody_ocmb_chip(struct pdbg_target *target)
{
uint8_t type;
uint8_t type = 0;
pdbg_target_get_attribute(target, "ATTR_TYPE", 1, 1, &type);
if(type != ATTR_TYPE_OCMB_CHIP) {
return false;
Expand Down
4 changes: 3 additions & 1 deletion libpdbg/ocmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ static int sbefifo_ocmb_getscom(struct ocmb *ocmb, uint64_t addr, uint64_t *valu
struct sbefifo_context *sctx = sbefifo->get_sbefifo_context(sbefifo);
uint8_t instance_id;

instance_id = pdbg_target_index(&ocmb->target) & 0xff;
uint32_t fapi_pos = 0;
pdbg_target_get_attribute(&ocmb->target, "ATTR_FAPI_POS", 4, 1, &fapi_pos);
instance_id = fapi_pos & 0x0f;

return sbefifo_hw_register_get(sctx,
SBEFIFO_TARGET_TYPE_OCMB,
Expand Down
40 changes: 32 additions & 8 deletions libpdbg/sbe_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,14 @@ int sbe_dump(struct pdbg_target *target, uint8_t type, uint8_t clock,
}

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

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

Expand All @@ -225,10 +229,23 @@ int sbe_ffdc_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc,
return -1;
}

*status = chipop->ffdc_get(chipop, (const uint8_t**)ffdc, ffdc_len);
*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 {
struct chipop_ody *chipop;
const uint8_t *data = NULL;
uint32_t len = 0;

struct pdbg_target *co_target = get_ody_chipop_target(target);
struct chipop_ody *chipop = target_to_chipop_ody(co_target);
chipop = target_to_chipop_ody(co_target);
if (!chipop) {
PR_ERROR("chipop target not found for ody ocmb chip\n");
return -1;
Expand All @@ -237,14 +254,21 @@ int sbe_ffdc_get(struct pdbg_target *target, uint32_t *status, uint8_t **ffdc,
PR_ERROR("ffdc_get() not implemented for the target\n");
return -1;
}

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, (const uint8_t**)ffdc, ffdc_len);
*status = chipop->ffdc_get(chipop, fsi, &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 Expand Up @@ -397,7 +421,7 @@ int sbe_ody_get_state(struct pdbg_target *fsi, enum sbe_state *state)
rc = sbe_ody_read_state_register(fsi, &value);
if (rc)
return -1;
if (value == SBE_STATE_CHECK_CFAM) {
if ((value == SBE_STATE_CHECK_CFAM) || (value == SBE_MSG_STATE_UNKNOWN)) {
rc = sbe_ody_read_msg_register(fsi, &msg.reg);
if (rc)
return -1;
Expand Down
Loading