diff options
author | Pratikkumar Prajapati <pratikkumar.v.prajapati@intel.com> | 2023-07-10 17:16:11 -0700 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2023-09-01 21:18:29 +0000 |
commit | 6cba9769897dd75086e3304550cb4e4b8167b8d3 (patch) | |
tree | 16192556b7d1c8f6e08a885e4d2c06e55ddff877 /src/soc/intel | |
parent | 0dc607f68d318d670f3edc084280b8e5c339847e (diff) |
soc/intel/meteorlake: Validate CPU crashlog discovery table and records
CPU crashlog discovery table and crashlog record is considered
invalid if first 32bits of the table is either 0x0 (no crashlog)
or 0xdeadbeef (invalid crashlog).
Crashlog record is considered consumed if bit 31 is set. So in this
case stop processing the subsequent records.
BUG=b:289600699
TEST=Able to build and verified invalid records are skipped on
google/rex.
Change-Id: Ia81bd293a533217425e44473ae85b2115c85faf6
Signed-off-by: Pratikkumar Prajapati <pratikkumar.v.prajapati@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76333
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel')
-rw-r--r-- | src/soc/intel/meteorlake/crashlog.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/soc/intel/meteorlake/crashlog.c b/src/soc/intel/meteorlake/crashlog.c index 219c7e8256..9d3c5d60e4 100644 --- a/src/soc/intel/meteorlake/crashlog.c +++ b/src/soc/intel/meteorlake/crashlog.c @@ -12,6 +12,8 @@ #include <soc/pci_devs.h> #include <string.h> +#define CRASHLOG_CONSUMED_MASK BIT(31) + /* global crashLog info */ static bool m_pmc_crashLog_support; static bool m_pmc_crashLog_present; @@ -364,6 +366,11 @@ static u32 get_disc_table_offset(void) return offset; } +static bool is_crashlog_data_valid(u32 dw0) +{ + return (dw0 != 0x0 && dw0 != INVALID_CRASHLOG_RECORD); +} + static bool cpu_cl_gen_discovery_table(void) { u32 bar_addr = 0, disc_tab_addr = 0; @@ -373,6 +380,11 @@ static bool cpu_cl_gen_discovery_table(void) return false; disc_tab_addr = bar_addr + get_disc_table_offset(); + + u32 dw0 = read32((u32 *)disc_tab_addr); + if (!is_crashlog_data_valid(dw0)) + return false; + memset(&cpu_cl_disc_tab, 0, sizeof(cpu_crashlog_discovery_table_t)); cpu_cl_disc_tab.header.data = ((u64)read32((u32 *)disc_tab_addr) + ((u64)read32((u32 *)(disc_tab_addr + 4)) << 32)); @@ -381,7 +393,18 @@ static bool cpu_cl_gen_discovery_table(void) int cur_offset = 0; for (int i = 0; i < cpu_cl_disc_tab.header.fields.count; i++) { - cur_offset = 8 + 24*i; + cur_offset = 8 + 24 * i; + + dw0 = read32((u32 *)disc_tab_addr + cur_offset); + if (!is_crashlog_data_valid(dw0)) + continue; + + if (dw0 & CRASHLOG_CONSUMED_MASK) { + printk(BIOS_DEBUG, "cpu crashlog records already consumed." + "id: 0x%x dw0: 0x%x\n", i, dw0); + break; + } + cpu_cl_disc_tab.buffers[i].data = ((u64)read32((u32 *)(disc_tab_addr + cur_offset)) + ((u64)read32((u32 *) (disc_tab_addr + cur_offset + 4)) << 32)); |