aboutsummaryrefslogtreecommitdiff
path: root/include/ras.h
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2020-04-27 21:08:08 +1000
committerOliver O'Halloran <oohall@gmail.com>2020-06-11 12:52:55 +1000
commit8c49753c04ae39cbd9b238484ccb8de88a4355df (patch)
tree1ef61b3c290fe7a1cae4fc70ed4ea364c74e2275 /include/ras.h
parentdca0d5345631fb8d116eaf015416a6a51ead6028 (diff)
downloadskiboot-8c49753c04ae39cbd9b238484ccb8de88a4355df.zip
skiboot-8c49753c04ae39cbd9b238484ccb8de88a4355df.tar.gz
skiboot-8c49753c04ae39cbd9b238484ccb8de88a4355df.tar.bz2
core/mce: add support for decoding and handling machine checks
This provides an initial facility to decode machine checks into human readable strings, plus a minimum amount of metadata that a handler has to understand in order to deal with the machine check. For now this is only used by skiboot to make MCE reporting nicer, and an ERAT flush recovery attempt which is more about code coverage than really being helpful. *********************************************** Fatal MCE at 00000000300c9c0c .memcmp+0x3c MSR 9000000000141002 Cause: instruction fetch TLB multi-hit error Effective address: 0x00000000300c9c0c ... The intention is to subsequently provide an OPAL API with this information that will enable an OS to implement a machine independent OPAL machine check driver. The code and data tables are derived from Linux code that I wrote, so relicensing is okay. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'include/ras.h')
-rw-r--r--include/ras.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/ras.h b/include/ras.h
new file mode 100644
index 0000000..d0faaee
--- /dev/null
+++ b/include/ras.h
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: Apache-2.0
+/* Copyright 2020 IBM Corp. */
+
+#ifndef __RAS_H
+#define __RAS_H
+
+#include <compiler.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+#include <bitutils.h>
+#include <types.h>
+
+#include <ccan/container_of/container_of.h>
+#include <ccan/list/list.h>
+#include <ccan/short_types/short_types.h>
+#include <ccan/build_assert/build_assert.h>
+#include <ccan/array_size/array_size.h>
+#include <ccan/endian/endian.h>
+#include <ccan/str/str.h>
+
+#include <processor.h>
+
+#define MCE_NO_ERROR 0x0001
+#define MCE_UNKNOWN 0x0002
+#define MCE_INSNFETCH 0x0004
+#define MCE_LOADSTORE 0x0008
+#define MCE_TABLE_WALK 0x0010
+#define MCE_IMPRECISE 0x0020
+#define MCE_MEMORY_ERROR 0x0040
+#define MCE_SLB_ERROR 0x0080
+#define MCE_ERAT_ERROR 0x0100
+#define MCE_TLB_ERROR 0x0200
+#define MCE_TLBIE_ERROR 0x0400
+#define MCE_INVOLVED_EA 0x0800
+#define MCE_INVOLVED_PA 0x1000
+
+void decode_mce(uint64_t srr0, uint64_t srr1,
+ uint32_t dsisr, uint64_t dar,
+ uint64_t *type, const char **error_str,
+ uint64_t *address);
+
+#endif /* __RAS_H */