summaryrefslogtreecommitdiff
path: root/src/security/intel/txt/logging.c
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-05-12 16:16:19 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-06-21 05:41:48 +0000
commit773ecfe11d27c9e2d6506400368be39db1e19bf5 (patch)
treeb805682cd1a84ffb27128eff66cb4fc7d6a56297 /src/security/intel/txt/logging.c
parent3a1e1f07df1971d113c1aacc5b5be45d60eff368 (diff)
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>
Diffstat (limited to 'src/security/intel/txt/logging.c')
-rw-r--r--src/security/intel/txt/logging.c66
1 files changed, 23 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));
}
}