Marshall Dawson has uploaded this change for review.

View Change

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>
---
M src/soc/amd/stoneyridge/northbridge.c
1 file changed, 23 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/28478/1
diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c
index c78ca7c..912daa0 100644
--- a/src/soc/amd/stoneyridge/northbridge.c
+++ b/src/soc/amd/stoneyridge/northbridge.c
@@ -33,6 +33,7 @@
#include <amdblocks/agesawrapper.h>
#include <amdblocks/agesawrapper_call.h>
#include <agesa_headers.h>
+#include <soc/cpu.h>
#include <soc/northbridge.h>
#include <soc/southbridge.h>
#include <soc/pci_devs.h>
@@ -40,6 +41,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <arch/bert_storage.h>

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 @@
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 @@
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);

To view, visit change 28478. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fe38eefacaad0bc73d0cb4ae44a339a45857128
Gerrit-Change-Number: 28478
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd@gmail.com>