aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYazen Ghannam <yazen.ghannam@amd.com>2018-05-04 01:59:55 -0400
committerIngo Molnar <mingo@kernel.org>2018-05-14 02:57:48 -0400
commita32bc29ed19776ef6827d6336847de9a0b7a8dc5 (patch)
treef26e5d8200d89c5d1e03e8abd0197d74b57b3fca
parentc6bc4ac0aadede7a5c5260bcc315cd2b18c6b471 (diff)
efi: Decode IA32/X64 MS Check structure
The IA32/X64 MS Check structure varies from the other Check structures in the the bit positions of its fields, and it includes an additional "Error Type" field. Decode the MS Check structure in a separate function. Based on UEFI 2.7 Table 257. IA32/X64 MS Check Field Description. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20180504060003.19618-10-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--drivers/firmware/efi/cper-x86.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/drivers/firmware/efi/cper-x86.c b/drivers/firmware/efi/cper-x86.c
index 5e6716564dba..356b8d326219 100644
--- a/drivers/firmware/efi/cper-x86.c
+++ b/drivers/firmware/efi/cper-x86.c
@@ -57,6 +57,20 @@
57#define CHECK_BUS_TIME_OUT BIT_ULL(32) 57#define CHECK_BUS_TIME_OUT BIT_ULL(32)
58#define CHECK_BUS_ADDR_SPACE(check) (((check) & GENMASK_ULL(34, 33)) >> 33) 58#define CHECK_BUS_ADDR_SPACE(check) (((check) & GENMASK_ULL(34, 33)) >> 33)
59 59
60#define CHECK_VALID_MS_ERR_TYPE BIT_ULL(0)
61#define CHECK_VALID_MS_PCC BIT_ULL(1)
62#define CHECK_VALID_MS_UNCORRECTED BIT_ULL(2)
63#define CHECK_VALID_MS_PRECISE_IP BIT_ULL(3)
64#define CHECK_VALID_MS_RESTARTABLE_IP BIT_ULL(4)
65#define CHECK_VALID_MS_OVERFLOW BIT_ULL(5)
66
67#define CHECK_MS_ERR_TYPE(check) (((check) & GENMASK_ULL(18, 16)) >> 16)
68#define CHECK_MS_PCC BIT_ULL(19)
69#define CHECK_MS_UNCORRECTED BIT_ULL(20)
70#define CHECK_MS_PRECISE_IP BIT_ULL(21)
71#define CHECK_MS_RESTARTABLE_IP BIT_ULL(22)
72#define CHECK_MS_OVERFLOW BIT_ULL(23)
73
60enum err_types { 74enum err_types {
61 ERR_TYPE_CACHE = 0, 75 ERR_TYPE_CACHE = 0,
62 ERR_TYPE_TLB, 76 ERR_TYPE_TLB,
@@ -111,17 +125,56 @@ static const char * const ia_check_bus_addr_space_strs[] = {
111 "Other Transaction", 125 "Other Transaction",
112}; 126};
113 127
128static const char * const ia_check_ms_error_type_strs[] = {
129 "No Error",
130 "Unclassified",
131 "Microcode ROM Parity Error",
132 "External Error",
133 "FRC Error",
134 "Internal Unclassified",
135};
136
114static inline void print_bool(char *str, const char *pfx, u64 check, u64 bit) 137static inline void print_bool(char *str, const char *pfx, u64 check, u64 bit)
115{ 138{
116 printk("%s%s: %s\n", pfx, str, (check & bit) ? "true" : "false"); 139 printk("%s%s: %s\n", pfx, str, (check & bit) ? "true" : "false");
117} 140}
118 141
142static void print_err_info_ms(const char *pfx, u16 validation_bits, u64 check)
143{
144 if (validation_bits & CHECK_VALID_MS_ERR_TYPE) {
145 u8 err_type = CHECK_MS_ERR_TYPE(check);
146
147 printk("%sError Type: %u, %s\n", pfx, err_type,
148 err_type < ARRAY_SIZE(ia_check_ms_error_type_strs) ?
149 ia_check_ms_error_type_strs[err_type] : "unknown");
150 }
151
152 if (validation_bits & CHECK_VALID_MS_PCC)
153 print_bool("Processor Context Corrupt", pfx, check, CHECK_MS_PCC);
154
155 if (validation_bits & CHECK_VALID_MS_UNCORRECTED)
156 print_bool("Uncorrected", pfx, check, CHECK_MS_UNCORRECTED);
157
158 if (validation_bits & CHECK_VALID_MS_PRECISE_IP)
159 print_bool("Precise IP", pfx, check, CHECK_MS_PRECISE_IP);
160
161 if (validation_bits & CHECK_VALID_MS_RESTARTABLE_IP)
162 print_bool("Restartable IP", pfx, check, CHECK_MS_RESTARTABLE_IP);
163
164 if (validation_bits & CHECK_VALID_MS_OVERFLOW)
165 print_bool("Overflow", pfx, check, CHECK_MS_OVERFLOW);
166}
167
119static void print_err_info(const char *pfx, u8 err_type, u64 check) 168static void print_err_info(const char *pfx, u8 err_type, u64 check)
120{ 169{
121 u16 validation_bits = CHECK_VALID_BITS(check); 170 u16 validation_bits = CHECK_VALID_BITS(check);
122 171
172 /*
173 * The MS Check structure varies a lot from the others, so use a
174 * separate function for decoding.
175 */
123 if (err_type == ERR_TYPE_MS) 176 if (err_type == ERR_TYPE_MS)
124 return; 177 return print_err_info_ms(pfx, validation_bits, check);
125 178
126 if (validation_bits & CHECK_VALID_TRANS_TYPE) { 179 if (validation_bits & CHECK_VALID_TRANS_TYPE) {
127 u8 trans_type = CHECK_TRANS_TYPE(check); 180 u8 trans_type = CHECK_TRANS_TYPE(check);