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 <felix-coreboot@felixheld.de>
Change-Id: I86d4f5ef74d4d40cb93ac4a3feaf28b99022ebd5
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55055
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
Felix Held 2021-05-28 16:19:59 +02:00
parent 62eb0ed93e
commit d288d8c0b1
1 changed files with 19 additions and 21 deletions

View File

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