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 <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/28478
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Marshall Dawson 2018-09-04 13:25:39 -06:00 committed by Martin Roth
parent 64e1fcaaf9
commit 653f760b13
1 changed files with 23 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include <amdblocks/agesawrapper.h> #include <amdblocks/agesawrapper.h>
#include <amdblocks/agesawrapper_call.h> #include <amdblocks/agesawrapper_call.h>
#include <agesa_headers.h> #include <agesa_headers.h>
#include <soc/cpu.h>
#include <soc/northbridge.h> #include <soc/northbridge.h>
#include <soc/southbridge.h> #include <soc/southbridge.h>
#include <soc/pci_devs.h> #include <soc/pci_devs.h>
@ -40,6 +41,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <arch/bert_storage.h>
static void set_io_addr_reg(struct device *dev, u32 nodeid, u32 linkn, u32 reg, static void set_io_addr_reg(struct device *dev, u32 nodeid, u32 linkn, u32 reg,
u32 io_min, u32 io_max) 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 *alib;
acpi_header_t *ivrs; acpi_header_t *ivrs;
acpi_hest_t *hest; acpi_hest_t *hest;
acpi_bert_t *bert;
/* HEST */ /* HEST */
current = ALIGN(current, 8); current = ALIGN(current, 8);
@ -236,6 +239,26 @@ static unsigned long agesa_write_acpi_tables(struct device *device,
acpi_add_table(rsdp, (void *)current); acpi_add_table(rsdp, (void *)current);
current += ((acpi_header_t *)current)->length; 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); current = ALIGN(current, 8);
printk(BIOS_DEBUG, "ACPI: * IVRS at %lx\n", current); printk(BIOS_DEBUG, "ACPI: * IVRS at %lx\n", current);
ivrs = agesawrapper_getlateinitptr(PICK_IVRS); ivrs = agesawrapper_getlateinitptr(PICK_IVRS);