blob: 1cbf9b7ec47dcf63047f6daeadb4566c0c45f38c [file] [log] [blame]
Fathi Boudra422bf772019-12-02 11:10:16 +02001--- a/plat/arm/board/fvp/aarch64/fvp_ras.c
2+++ b/plat/arm/board/fvp/aarch64/fvp_ras.c
Manish Pandeycfab9a32021-11-09 11:57:41 +00003@@ -4,12 +4,50 @@
4 * SPDX-License-Identifier: BSD-3-Clause
Fathi Boudra422bf772019-12-02 11:10:16 +02005 */
6
Manish Pandeycfab9a32021-11-09 11:57:41 +00007+#include <inttypes.h>
8+#include <stdint.h>
9+
Fathi Boudra422bf772019-12-02 11:10:16 +020010 #include <lib/extensions/ras.h>
11+#include <services/sdei.h>
12+
13+static int injected_fault_handler(const struct err_record_info *info,
14+ int probe_data, const struct err_handler_data *const data)
15+{
16+ uint64_t status;
17+ int ret __unused;
18+
19+ /*
20+ * The faulting error record is already selected by the SER probe
21+ * function.
22+ */
23+ status = read_erxstatus_el1();
24+
Manish Pandeycfab9a32021-11-09 11:57:41 +000025+ ERROR("Fault reported by system error record %d on 0x%lx: status=0x%" PRIx64 "\n",
Fathi Boudra422bf772019-12-02 11:10:16 +020026+ probe_data, read_mpidr_el1(), status);
Manish Pandeycfab9a32021-11-09 11:57:41 +000027+ ERROR(" exception reason=%u syndrome=0x%" PRIx64 "\n", data->ea_reason,
Fathi Boudra422bf772019-12-02 11:10:16 +020028+ data->flags);
29+
30+ /* Clear error */
31+ write_erxstatus_el1(status);
32+
33+ ret = sdei_dispatch_event(5000);
34+ if (ret < 0) {
35+ ERROR("Can't dispatch event to SDEI\n");
36+ panic();
37+ } else {
38+ INFO("SDEI event dispatched\n");
39+ }
40+
41+ return 0;
42+}
43
44 struct ras_interrupt fvp_ras_interrupts[] = {
45 };
46
47 struct err_record_info fvp_err_records[] = {
48+ /* Record for injected fault */
49+ ERR_RECORD_SYSREG_V1(0, 2, ras_err_ser_probe_sysreg,
50+ injected_fault_handler, NULL),
51 };
52
53 REGISTER_ERR_RECORD_INFO(fvp_err_records);