From d288d8c0b136d5fd8c652f427bbb58a0172b5d07 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Fri, 28 May 2021 16:19:59 +0200 Subject: [PATCH] soc/amd/stoneyridge: use common BERT ACPI table generation Implement acpi_soc_get_bert_region so that the common ACPI code will generate a BERT ACPI table that points to the BERT memory region instead of generating the BERT table in the SoC=specific code. Signed-off-by: Felix Held Change-Id: I86d4f5ef74d4d40cb93ac4a3feaf28b99022ebd5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/55055 Tested-by: build bot (Jenkins) Reviewed-by: Marshall Dawson --- src/soc/amd/stoneyridge/northbridge.c | 40 +++++++++++++-------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c index e1108de742..a16ade5fdc 100644 --- a/src/soc/amd/stoneyridge/northbridge.c +++ b/src/soc/amd/stoneyridge/northbridge.c @@ -229,7 +229,6 @@ static unsigned long agesa_write_acpi_tables(const struct device *device, acpi_header_t *alib; acpi_header_t *ivrs; acpi_hest_t *hest; - acpi_bert_t *bert; /* HEST */ current = ALIGN(current, 8); @@ -238,26 +237,6 @@ static unsigned long agesa_write_acpi_tables(const struct device *device, acpi_add_table(rsdp, (void *)current); current += hest->header.length; - /* BERT */ - if (bert_should_generate_acpi_table()) { - /* 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(bert, (uintptr_t)rgn, size); - acpi_add_table(rsdp, (void *)current); - current += bert->header.length; - } - } - current = ALIGN(current, 8); printk(BIOS_DEBUG, "ACPI: * IVRS at %lx\n", current); ivrs = agesawrapper_getlateinitptr(PICK_IVRS); @@ -347,6 +326,25 @@ static const struct pci_driver family15_northbridge __pci_driver = { .devices = pci_device_ids, }; +enum cb_err acpi_soc_get_bert_region(void **region, size_t *length) +{ + /* + * Skip the table if no errors are present. ACPI driver reports + * a table with a 0-length region: + * BERT: [Firmware Bug]: table invalid. + */ + if (!bert_should_generate_acpi_table()) + return CB_ERR; + + bert_errors_region(region, length); + if (!region) { + printk(BIOS_ERR, "Error: Can't find BERT storage area\n"); + return CB_ERR; + } + + return CB_SUCCESS; +} + /* * Enable VGA cycles. Set memory ranges of the FCH legacy devices (TPM, HPET, * BIOS RAM, Watchdog Timer, IOAPIC and ACPI) as non-posted. Set remaining