xref: /aosp_15_r20/external/coreboot/src/soc/amd/common/block/acpi/bert.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <acpi/acpi.h>
4 #include <arch/bert_storage.h>
5 #include <console/console.h>
6 #include <types.h>
7 
acpi_soc_get_bert_region(void ** region,size_t * length)8 enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
9 {
10 	/*
11 	 * Skip the table if no errors are present.  ACPI driver reports
12 	 * a table with a 0-length region:
13 	 *   BERT: [Firmware Bug]: table invalid.
14 	 */
15 	if (!bert_should_generate_acpi_table())
16 		return CB_ERR;
17 
18 	bert_errors_region(region, length);
19 	if (!*region) {
20 		printk(BIOS_ERR, "Can't find BERT storage area\n");
21 		return CB_ERR;
22 	}
23 
24 	return CB_SUCCESS;
25 }
26