1 /*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 #include <inttypes.h>
8 #include <stdint.h>
9
10 #include <lib/extensions/ras.h>
11 #include <services/sdei.h>
12
13 #ifdef PLATFORM_TEST_RAS_FFH
injected_fault_handler(const struct err_record_info * info,int probe_data,const struct err_handler_data * const data)14 static int injected_fault_handler(const struct err_record_info *info,
15 int probe_data, const struct err_handler_data *const data)
16 {
17 uint64_t status;
18 int ret;
19
20 /*
21 * The faulting error record is already selected by the SER probe
22 * function.
23 */
24 status = read_erxstatus_el1();
25
26 ERROR("Fault reported by system error record %d on 0x%lx: status=0x%" PRIx64 "\n",
27 probe_data, read_mpidr_el1(), status);
28 ERROR(" exception reason=%u syndrome=0x%" PRIx64 "\n", data->ea_reason,
29 data->flags);
30
31 /* Clear error */
32 write_erxstatus_el1(status);
33
34 ret = sdei_dispatch_event(5000);
35 if (ret < 0) {
36 ERROR("Can't dispatch event to SDEI\n");
37 panic();
38 } else {
39 INFO("SDEI event dispatched\n");
40 }
41
42 return 0;
43 }
44
plat_handle_uncontainable_ea(void)45 void plat_handle_uncontainable_ea(void)
46 {
47 /* Do not change the string, CI expects it. Wait forever */
48 INFO("Injected Uncontainable Error\n");
49 while (true) {
50 wfe();
51 }
52 }
53 #endif
54
55 struct ras_interrupt fvp_ras_interrupts[] = {
56 };
57
58 struct err_record_info fvp_err_records[] = {
59 #ifdef PLATFORM_TEST_RAS_FFH
60 /* Record for injected fault */
61 ERR_RECORD_SYSREG_V1(0, 2, ras_err_ser_probe_sysreg,
62 injected_fault_handler, NULL),
63 #endif
64 };
65
66 REGISTER_ERR_RECORD_INFO(fvp_err_records);
67 REGISTER_RAS_INTERRUPTS(fvp_ras_interrupts);
68