Skip to content

Commit

Permalink
errorlog: Replace hardcode value with macro
Browse files Browse the repository at this point in the history
Suggested-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
Vasant Hegde authored and oohal committed Feb 26, 2020
1 parent ee07f2c commit c8418ac
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/errorlog.c
Expand Up @@ -93,7 +93,7 @@ void log_add_section(struct errorlog *buf, uint32_t tag)
tmp = (struct elog_user_data_section *)(buf->user_data_dump +
buf->user_section_size);
/* Use DESC if no other tag provided */
tmp->tag = tag ? cpu_to_be32(tag) : cpu_to_be32(0x44455343);
tmp->tag = tag ? cpu_to_be32(tag) : cpu_to_be32(OPAL_ELOG_SEC_DESC);
tmp->size = cpu_to_be16(size);

buf->user_section_size += size;
Expand Down
2 changes: 1 addition & 1 deletion core/platform.c
Expand Up @@ -99,7 +99,7 @@ static int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag)
"OPAL: Reboot requested due to Platform error.");
if (diag) {
/* Add user section "DESC" */
log_add_section(buf, 0x44455343);
log_add_section(buf, OPAL_ELOG_SEC_DESC);
log_append_data(buf, diag, strlen(diag));
}
log_commit(buf);
Expand Down
2 changes: 1 addition & 1 deletion core/test/run-pel.c
Expand Up @@ -101,7 +101,7 @@ int main(void)

buffer = elog->user_data_dump + elog->user_section_size;
tmp = (struct elog_user_data_section *)buffer;
tmp->tag = 0x44455343; /* ASCII of DESC */
tmp->tag = OPAL_ELOG_SEC_DESC; /* ASCII of DESC */
tmp->size = size + sizeof(struct elog_user_data_section) - 1;
strcpy(tmp->data_dump, "Hello World!");
elog->user_section_size += tmp->size;
Expand Down
4 changes: 2 additions & 2 deletions hw/fsp/fsp-mem-err.c
Expand Up @@ -233,7 +233,7 @@ static bool handle_memory_resilience(u32 cmd_sub_mod, u64 paddr)
log_append_msg(buf,
"OPAL_MEM_ERR: Cannot queue up memory "
"resilience error event to the OS");
log_add_section(buf, 0x44455350);
log_add_section(buf, OPAL_ELOG_SEC_DESC);
log_append_data(buf, (char *) &mem_err_evt,
sizeof(struct OpalMemoryErrorData));
log_commit(buf);
Expand Down Expand Up @@ -322,7 +322,7 @@ static bool handle_memory_deallocation(u64 paddr_start, u64 paddr_end)
log_append_msg(buf,
"OPAL_MEM_ERR: Cannot queue up memory "
"deallocation error event to the OS");
log_add_section(buf, 0x44455350);
log_add_section(buf, OPAL_ELOG_SEC_DESC);
log_append_data(buf, (char *)&mem_err_evt,
sizeof(struct OpalMemoryErrorData));
log_commit(buf);
Expand Down
2 changes: 2 additions & 0 deletions include/errorlog.h
Expand Up @@ -324,6 +324,8 @@ enum opal_reasoncode {
OPAL_RC_CONSOLE_HANG = OPAL_SRC_COMPONENT_CONSOLE | 0x10,
};

#define OPAL_ELOG_SEC_DESC 0x44455343

#define DEFINE_LOG_ENTRY(reason, type, id, subsys, \
severity, subtype) static struct opal_err_info err_##reason = \
{ .reason_code = reason, .err_type = type, .cmp_id = id, \
Expand Down

0 comments on commit c8418ac

Please sign in to comment.