soc/amd/common/blocks/cpu/mca: factor out common BERT helper functions

Change-Id: I03365c3820cbe7277f14adc5460e892fb8d9b7a5
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56284
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/soc/amd/common/block/cpu/mca/mcax_bert.c b/src/soc/amd/common/block/cpu/mca/mcax_bert.c
index f976158..8d864e8 100644
--- a/src/soc/amd/common/block/cpu/mca/mcax_bert.c
+++ b/src/soc/amd/common/block/cpu/mca/mcax_bert.c
@@ -8,6 +8,7 @@
 #include <arch/bert_storage.h>
 #include <cper.h>
 #include <types.h>
+#include "mca_common_defs.h"
 
 /* MISC4 is the last used register in the MCAX banks of Picasso */
 #define MCAX_USED_REGISTERS_PER_BANK	(MCAX_MISC4_OFFSET + 1)
@@ -40,41 +41,6 @@
 	return size;
 }
 
-static enum cper_x86_check_type error_to_chktype(struct mca_bank_status *mci)
-{
-	int error = mca_err_type(mci->sts);
-
-	if (error == MCA_ERRTYPE_BUS)
-		return X86_PROCESSOR_BUS_CHK;
-	if (error == MCA_ERRTYPE_INT)
-		return X86_PROCESSOR_MS_CHK;
-	if (error == MCA_ERRTYPE_MEM)
-		return X86_PROCESSOR_CACHE_CHK;
-	if (error == MCA_ERRTYPE_TLB)
-		return X86_PROCESSOR_TLB_CHK;
-
-	return X86_PROCESSOR_MS_CHK; /* unrecognized */
-}
-
-/* Fill additional information in the Generic Processor Error Section. */
-static void fill_generic_section(cper_proc_generic_error_section_t *sec,
-		struct mca_bank_status *mci)
-{
-	int type = mca_err_type(mci->sts);
-
-	if (type == MCA_ERRTYPE_BUS) /* try to map MCA errors to CPER types */
-		sec->error_type = GENPROC_ERRTYPE_BUS;
-	else if (type == MCA_ERRTYPE_INT)
-		sec->error_type = GENPROC_ERRTYPE_UARCH;
-	else if (type == MCA_ERRTYPE_MEM)
-		sec->error_type = GENPROC_ERRTYPE_CACHE;
-	else if (type == MCA_ERRTYPE_TLB)
-		sec->error_type = GENPROC_ERRTYPE_TLB;
-	else
-		sec->error_type = GENPROC_ERRTYPE_UNKNOWN;
-	sec->validation |= GENPROC_VALID_PROC_ERR_TYPE;
-}
-
 /* Convert an error reported by an MCA bank into BERT information to be reported
  * by the OS.  The ACPI driver doesn't recognize/parse the IA32/X64 structure,
  * which is the best method to report MSR context.  As a result, add two