From 653f760b133fcad4b6465a25867f0c6d9b24bdb0 Mon Sep 17 00:00:00 2001 From: Marshall Dawson Date: Tue, 4 Sep 2018 13:25:39 -0600 Subject: amd/stoneyridge: Construct ACPI BERT table Add a Boot Error Record Table to the ACPI information. Avoid a driver error message by skipping the table altogether when no errors are found, or support isn't built in. BUG=b:65446699 TEST=inspect BERT region, and dmesg, on full patch stack. Use test data plus a failing Grunt system. Change-Id: I6fe38eefacaad0bc73d0cb4ae44a339a45857128 Signed-off-by: Marshall Dawson Reviewed-on: https://review.coreboot.org/28478 Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- src/soc/amd/stoneyridge/northbridge.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/soc/amd') diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c index c78ca7cb58..912daa05e2 100644 --- a/src/soc/amd/stoneyridge/northbridge.c +++ b/src/soc/amd/stoneyridge/northbridge.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include static void set_io_addr_reg(struct device *dev, u32 nodeid, u32 linkn, u32 reg, u32 io_min, u32 io_max) @@ -228,6 +230,7 @@ static unsigned long agesa_write_acpi_tables(struct device *device, acpi_header_t *alib; acpi_header_t *ivrs; acpi_hest_t *hest; + acpi_bert_t *bert; /* HEST */ current = ALIGN(current, 8); @@ -236,6 +239,26 @@ static unsigned long agesa_write_acpi_tables(struct device *device, acpi_add_table(rsdp, (void *)current); current += ((acpi_header_t *)current)->length; + /* BERT */ + if (IS_ENABLED(CONFIG_ACPI_BERT) && bert_errors_present()) { + /* Skip the table if no errors are present. ACPI driver reports + * a table with a 0-length region: + * BERT: [Firmware Bug]: table invalid. + */ + void *rgn; + size_t size; + bert_errors_region(&rgn, &size); + if (!rgn) { + printk(BIOS_ERR, "Error: Can't find BERT storage area\n"); + } else { + current = ALIGN(current, 8); + bert = (acpi_bert_t *)current; + acpi_write_bert((void *)current, (uintptr_t)rgn, size); + acpi_add_table(rsdp, (void *)current); + current += ((acpi_header_t *)current)->length; + } + } + current = ALIGN(current, 8); printk(BIOS_DEBUG, "ACPI: * IVRS at %lx\n", current); ivrs = agesawrapper_getlateinitptr(PICK_IVRS); -- cgit v1.2.3