Skip to content

Commit

Permalink
rasdaemon:Add support for creating vendor tables at startup.
Browse files Browse the repository at this point in the history
When rasdaemon is running without non-standard error, those
tables are not created in the database file. Then ras-mc-ctl
script breaks trying to query data from non-existent tables.

Add support for creating vendor tables at startup.

Signed-off-by: Hunter He <hunter.he@jaguarmicro.com>
  • Loading branch information
hunterjaguar authored and mchehab committed Jan 22, 2024
1 parent 3e9a59a commit 4484bee
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions non-standard-yitian.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,6 @@ void decode_yitian_ddr_payload_err_regs(struct ras_ns_ev_decoder *ev_decoder,
const char *subtype_str = oem_subtype_name(yitian_payload_error_type,
header->type, header->subtype);

#ifdef HAVE_SQLITE3
if (ras->record_events && !ev_decoder->stmt_dec_record) {
if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
&yitian_ddr_payload_section_tab) != SQLITE_OK) {
trace_seq_printf(s, "create sql fail\n");
return;
}
}
#endif

now = time(NULL);
tm = localtime(&now);
if (tm)
Expand Down Expand Up @@ -217,6 +207,22 @@ void decode_yitian_ddr_payload_err_regs(struct ras_ns_ev_decoder *ev_decoder,

}

static int add_yitian_common_table(struct ras_events *ras,
struct ras_ns_ev_decoder *ev_decoder)
{
#ifdef HAVE_SQLITE3
if (ras->record_events && !ev_decoder->stmt_dec_record) {
if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
&yitian_ddr_payload_section_tab) != SQLITE_OK) {
log(TERM, LOG_WARNING,
"Failed to create sql yitian_ddr_payload_section_tab\n");
return -1;
}
}
#endif
return 0;
}

/* error data decoding functions */
static int decode_yitian710_ns_error(struct ras_events *ras,
struct ras_ns_ev_decoder *ev_decoder,
Expand All @@ -239,6 +245,7 @@ static int decode_yitian710_ns_error(struct ras_events *ras,
struct ras_ns_ev_decoder yitian_ns_oem_decoder[] = {
{
.sec_type = "a6980811-16ea-4e4d-b936-fb00a23ff29c",
.add_table = add_yitian_common_table,
.decode = decode_yitian710_ns_error,
},
};
Expand Down

0 comments on commit 4484bee

Please sign in to comment.