arch/x86/include/bert_storage: introduce bert_should_generate_acpi_table

Since bert_errors_present() is only available when ACPI_BERT is selected
the ACPI table generation code needs to check that before calling the
function, so add bert_should_generate_acpi_table that returns false when
ACPI_BERT isn't selected or the return value of bert_errors_present()
when ACPI_BERT is selected.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Ia955f627c190ea38e05b5aaedc7cb2d030274e83
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55024
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held 2021-05-27 20:37:21 +02:00
parent fba479267b
commit 62eb0ed93e
2 changed files with 6 additions and 1 deletions

View File

@ -56,6 +56,11 @@ void bert_errors_region(void **start, size_t *size);
size_t bert_storage_remaining(void);
/* Find if errors were added, a BERT region is present, and ACPI table needed */
bool bert_errors_present(void);
/* The BERT table should only be generated when BERT support is enabled and there's an error */
static inline bool bert_should_generate_acpi_table(void)
{
return CONFIG(ACPI_BERT) && bert_errors_present();
}
/* Get the number of entries associated with status */
static inline size_t bert_entry_count(acpi_generic_error_status_t *status)

View File

@ -239,7 +239,7 @@ static unsigned long agesa_write_acpi_tables(const struct device *device,
current += hest->header.length;
/* BERT */
if (CONFIG(ACPI_BERT) && bert_errors_present()) {
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.