soc/intel/cmn/block/acpi: enable BERT table without crashlog

Besides crashlog, there's also other errors such as MCA error, which
should be recorded in BERT table. With current code, BERT table is
not generated if crashlog is not enabled. Add if statement for
SOC_INTEL_CRASHLOG so that MCA error can be recorded in BERT table
when crashlog is not supported.
For some server mainboard, crashlog is supported through BMC instead
of host firmware.

Also check if BERT region is generated when crashlog is not enabled.

Change-Id: I323ca889eef2b246fc4e062582d2d11b4213316f
Signed-off-by: Tim Chu <Tim.Chu@quantatw.com>
Signed-off-by: Jonathan Zhang <jonzhang@meta.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68878
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
diff --git a/src/soc/intel/common/block/acpi/acpi_bert.c b/src/soc/intel/common/block/acpi/acpi_bert.c
index 779466c..7743ccc 100644
--- a/src/soc/intel/common/block/acpi/acpi_bert.c
+++ b/src/soc/intel/common/block/acpi/acpi_bert.c
@@ -9,11 +9,6 @@
 
 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;
@@ -27,7 +22,7 @@
 	return (crashlog_size > 0);
 }
 
-enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
+static enum cb_err record_crashlog_into_bert(void **region, size_t *length)
 {
 	acpi_generic_error_status_t *status = NULL;
 	size_t cpu_record_size, pmc_record_size;
@@ -97,3 +92,20 @@
 
 	return CB_SUCCESS;
 }
+
+enum cb_err acpi_soc_get_bert_region(void **region, size_t *length)
+{
+	if (CONFIG(SOC_INTEL_CRASHLOG)) {
+		return record_crashlog_into_bert(region, length);
+	} else {
+		/* Check if MCA error has been added into BERT. */
+		if (bert_should_generate_acpi_table()) {
+			bert_errors_region(region, length);
+			if (!*region) {
+				printk(BIOS_ERR, "Can't find BERT storage area\n");
+				return CB_ERR;
+			}
+		}
+		return CB_SUCCESS;
+	}
+}