From 0dc607f68d318d670f3edc084280b8e5c339847e Mon Sep 17 00:00:00 2001 From: Pratikkumar Prajapati Date: Mon, 10 Jul 2023 15:44:21 -0700 Subject: [PATCH] soc/intel/meteorlake: Adjust discovery table offset based on CPUID CPUID CPUID_METEORLAKE_B0 onwards the discovery table offset needs to be left-shifted by 3. Reference: EDS Vol 1 (640228) BUG=b:289600699 TEST=Able to boot google/rex with crashlog enabled. Change-Id: I90647fb6190a52b42298398263978beaf931b035 Signed-off-by: Pratikkumar Prajapati Reviewed-on: https://review.coreboot.org/c/coreboot/+/76400 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/soc/intel/meteorlake/crashlog.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/soc/intel/meteorlake/crashlog.c b/src/soc/intel/meteorlake/crashlog.c index 2e3c97ae4a..219c7e8256 100644 --- a/src/soc/intel/meteorlake/crashlog.c +++ b/src/soc/intel/meteorlake/crashlog.c @@ -2,6 +2,8 @@ #include #include +#include +#include #include #include #include @@ -351,6 +353,17 @@ static bool cpu_cl_get_capability(tel_crashlog_devsc_cap_t *cl_devsc_cap) return true; } +static u32 get_disc_table_offset(void) +{ + u32 offset = cpu_cl_devsc_cap.discovery_data.fields.discovery_table_offset; + if (cpu_get_cpuid() >= CPUID_METEORLAKE_B0) { + offset <<= 3; + printk(BIOS_DEBUG, "adjusted cpu discovery table offset: 0x%x\n", offset); + } + + return offset; +} + static bool cpu_cl_gen_discovery_table(void) { u32 bar_addr = 0, disc_tab_addr = 0; @@ -359,16 +372,10 @@ static bool cpu_cl_gen_discovery_table(void) if (!bar_addr) return false; - disc_tab_addr = bar_addr + - cpu_cl_devsc_cap.discovery_data.fields.discovery_table_offset; + disc_tab_addr = bar_addr + get_disc_table_offset(); memset(&cpu_cl_disc_tab, 0, sizeof(cpu_crashlog_discovery_table_t)); - - printk(BIOS_DEBUG, "cpu discovery table offset: 0x%x\n", - cpu_cl_devsc_cap.discovery_data.fields.discovery_table_offset); - cpu_cl_disc_tab.header.data = ((u64)read32((u32 *)disc_tab_addr) + ((u64)read32((u32 *)(disc_tab_addr + 4)) << 32)); - printk(BIOS_DEBUG, "cpu_crashlog_discovery_table buffer count: 0x%x\n", cpu_cl_disc_tab.header.fields.count);