Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/54092 )
Change subject: security/intel/txt: Split off microcode error types string printing ......................................................................
security/intel/txt: Split off microcode error types string printing
The purpose is to reuse the types string in CBnT error printing.
Change-Id: I435de402fef6d4702c9c7250c8bd31243a04a46e Signed-off-by: Arthur Heymans arthur@aheymans.xyz Reviewed-on: https://review.coreboot.org/c/coreboot/+/54092 Reviewed-by: Angel Pons th3fanbus@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/security/intel/txt/logging.c M src/security/intel/txt/txt.h 2 files changed, 24 insertions(+), 43 deletions(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
diff --git a/src/security/intel/txt/logging.c b/src/security/intel/txt/logging.c index 683247d..b4eac33 100644 --- a/src/security/intel/txt/logging.c +++ b/src/security/intel/txt/logging.c @@ -3,11 +3,32 @@ #include <arch/mmio.h> #include <console/console.h> #include <cpu/x86/smm.h> +#include <stdint.h> #include <types.h>
#include "txt.h" #include "txt_register.h"
+const char *intel_txt_processor_error_type(uint8_t type) +{ + static const char *const names[] = { + [0] = "Legacy Shutdown", + [5] = "Load memory type error in ACM area", + [6] = "Unrecognized ACM format", + [7] = "Failure to authenticate", + [8] = "Invalid ACM format", + [9] = "Unexpected Snoop hit", + [10] = "Invalid event", + [11] = "Invalid MLE", + [12] = "Machine check event", + [13] = "VMXAbort", + [14] = "AC memory corruption", + [15] = "Illegal voltage/bus ratio", + }; + + return type < ARRAY_SIZE(names) && names[type] ? names[type] : "Unknown"; +} + /** * Logs microcode or SINIT ACM errors. * Does not log SBIOS ACM errors. @@ -24,49 +45,8 @@ else printk(BIOS_ERR, " Caused by: Processor\n");
- printk(BIOS_ERR, " Type: "); - - switch (txt_error & TXT_ERROR_MASK) { - case 0: - printk(BIOS_ERR, "Legacy Shutdown\n"); - break; - case 5: - printk(BIOS_ERR, "Load memory type error in ACM area\n"); - break; - case 6: - printk(BIOS_ERR, "Unrecognized ACM format\n"); - break; - case 7: - printk(BIOS_ERR, "Failure to authenticate\n"); - break; - case 8: - printk(BIOS_ERR, "Invalid ACM format\n"); - break; - case 9: - printk(BIOS_ERR, "Unexpected Snoop hit\n"); - break; - case 10: - printk(BIOS_ERR, "Invalid event\n"); - break; - case 11: - printk(BIOS_ERR, "Invalid MLE\n"); - break; - case 12: - printk(BIOS_ERR, "Machine check event\n"); - break; - case 13: - printk(BIOS_ERR, "VMXAbort\n"); - break; - case 14: - printk(BIOS_ERR, "AC memory corruption\n"); - break; - case 15: - printk(BIOS_ERR, "Illegal voltage/bus ratio\n"); - break; - default: - printk(BIOS_ERR, "unknown\n"); - break; - } + printk(BIOS_ERR, " Type: %s\n", + intel_txt_processor_error_type(txt_error & TXT_ERROR_MASK)); } }
diff --git a/src/security/intel/txt/txt.h b/src/security/intel/txt/txt.h index ec752a0..e1a78af 100644 --- a/src/security/intel/txt/txt.h +++ b/src/security/intel/txt/txt.h @@ -28,5 +28,6 @@ bool intel_txt_prepare_txt_env(void); /* Allow platform override to skip TXT lockdown, e.g. required for RAS error injection. */ bool skip_intel_txt_lockdown(void); +const char *intel_txt_processor_error_type(uint8_t type);
#endif /* SECURITY_INTEL_TXT_H_ */