summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/security/intel/txt/logging.c66
-rw-r--r--src/security/intel/txt/txt.h1
2 files changed, 24 insertions, 43 deletions
diff --git a/src/security/intel/txt/logging.c b/src/security/intel/txt/logging.c
index 683247d7ac..b4eac3333e 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 @@ static void log_txt_error(const char *phase)
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 ec752a003e..e1a78af542 100644
--- a/src/security/intel/txt/txt.h
+++ b/src/security/intel/txt/txt.h
@@ -28,5 +28,6 @@ int intel_txt_run_bios_acm(const u8 input_params);
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_ */