acpi: rework BERT ACPI table generation logic
Check if the ACPI_BERT Kconfig option is selected and only then try to generate the BERT table. Also remove the acpi_is_boot_error_src_present weak function from the ACPI global compilation unit and use the return value of acpi_soc_get_bert_region to determine if there is a valid BERT region with logged errors. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I2a281f5f636010ba3b2e7e097e9cf53683022aea Reviewed-on: https://review.coreboot.org/c/coreboot/+/55054 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
@@ -1560,11 +1560,6 @@ unsigned long acpi_create_lpi_desc_ncst(acpi_lpi_desc_ncst_t *lpi_desc, uint16_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* BERT helpers */
|
/* BERT helpers */
|
||||||
bool __weak acpi_is_boot_error_src_present(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
__weak enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
|
__weak enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
|
||||||
{
|
{
|
||||||
return CB_ERR;
|
return CB_ERR;
|
||||||
@@ -1813,12 +1808,12 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||||||
|
|
||||||
current = acpi_align_current(current);
|
current = acpi_align_current(current);
|
||||||
|
|
||||||
if (acpi_is_boot_error_src_present()) {
|
if (CONFIG(ACPI_BERT)) {
|
||||||
void *region;
|
void *region;
|
||||||
size_t size;
|
size_t size;
|
||||||
printk(BIOS_DEBUG, "ACPI: * BERT\n");
|
|
||||||
bert = (acpi_bert_t *) current;
|
bert = (acpi_bert_t *) current;
|
||||||
acpi_soc_get_bert_region(®ion, &size);
|
if (acpi_soc_get_bert_region(®ion, &size) == CB_SUCCESS) {
|
||||||
|
printk(BIOS_DEBUG, "ACPI: * BERT\n");
|
||||||
acpi_write_bert(bert, (uintptr_t)region, size);
|
acpi_write_bert(bert, (uintptr_t)region, size);
|
||||||
if (bert->header.length >= sizeof(acpi_bert_t)) {
|
if (bert->header.length >= sizeof(acpi_bert_t)) {
|
||||||
current += bert->header.length;
|
current += bert->header.length;
|
||||||
@@ -1826,6 +1821,7 @@ unsigned long write_acpi_tables(unsigned long start)
|
|||||||
}
|
}
|
||||||
current = acpi_align_current(current);
|
current = acpi_align_current(current);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "current = %lx\n", current);
|
printk(BIOS_DEBUG, "current = %lx\n", current);
|
||||||
|
|
||||||
|
@@ -1341,7 +1341,6 @@ void acpi_create_lpit(acpi_lpit_t *lpit);
|
|||||||
unsigned long acpi_create_lpi_desc_ncst(acpi_lpi_desc_ncst_t *lpi_desc, uint16_t uid);
|
unsigned long acpi_create_lpi_desc_ncst(acpi_lpi_desc_ncst_t *lpi_desc, uint16_t uid);
|
||||||
|
|
||||||
/* For crashlog. */
|
/* For crashlog. */
|
||||||
bool acpi_is_boot_error_src_present(void);
|
|
||||||
enum cb_err acpi_soc_get_bert_region(void **region, size_t *length);
|
enum cb_err acpi_soc_get_bert_region(void **region, size_t *length);
|
||||||
|
|
||||||
/* For ACPI S3 support. */
|
/* For ACPI S3 support. */
|
||||||
|
@@ -7,6 +7,25 @@
|
|||||||
#include <intelblocks/acpi.h>
|
#include <intelblocks/acpi.h>
|
||||||
#include <intelblocks/crashlog.h>
|
#include <intelblocks/crashlog.h>
|
||||||
|
|
||||||
|
static bool boot_error_src_present(void)
|
||||||
|
{
|
||||||
|
if (!CONFIG(SOC_INTEL_CRASHLOG)) {
|
||||||
|
printk(BIOS_DEBUG, "Crashlog disabled.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!discover_crashlog()) {
|
||||||
|
printk(BIOS_SPEW, "Crashlog discovery result: crashlog not found\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
collect_pmc_and_cpu_crashlog_from_srams();
|
||||||
|
|
||||||
|
/* Discovery tables sizes can be larger than the actual valid collected data */
|
||||||
|
u32 crashlog_size = cl_get_total_data_size();
|
||||||
|
|
||||||
|
return (crashlog_size > 0);
|
||||||
|
}
|
||||||
|
|
||||||
enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
|
enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
|
||||||
{
|
{
|
||||||
@@ -14,6 +33,10 @@ enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
|
|||||||
size_t cpu_record_size, pmc_record_size;
|
size_t cpu_record_size, pmc_record_size;
|
||||||
void *cl_data = NULL;
|
void *cl_data = NULL;
|
||||||
|
|
||||||
|
if (!boot_error_src_present()) {
|
||||||
|
return CB_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
if (!cl_get_total_data_size()) {
|
if (!cl_get_total_data_size()) {
|
||||||
printk(BIOS_ERR, "Error: No crashlog record present\n");
|
printk(BIOS_ERR, "Error: No crashlog record present\n");
|
||||||
return CB_ERR;
|
return CB_ERR;
|
||||||
@@ -71,24 +94,3 @@ enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
|
|||||||
|
|
||||||
return CB_SUCCESS;
|
return CB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool acpi_is_boot_error_src_present(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!CONFIG(SOC_INTEL_CRASHLOG)) {
|
|
||||||
printk(BIOS_DEBUG, "Crashlog disabled.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!discover_crashlog()) {
|
|
||||||
printk(BIOS_SPEW, "Crashlog discovery result: crashlog not found\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
collect_pmc_and_cpu_crashlog_from_srams();
|
|
||||||
|
|
||||||
/* Discovery tables sizes can be larger than the actual valid collected data */
|
|
||||||
u32 crashlog_size = cl_get_total_data_size();
|
|
||||||
|
|
||||||
return (crashlog_size > 0);
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user