summaryrefslogtreecommitdiffstats
path: root/plat/arm/board/fvp/aarch64/fvp_ras.c
blob: f9b96341aa6c5936af2f0e1b8bd74729eb1a0451 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <inttypes.h>
#include <stdint.h>

#include <lib/extensions/ras.h>
#include <services/sdei.h>

#ifdef PLATFORM_TEST_RAS_FFH
static int injected_fault_handler(const struct err_record_info *info,
		int probe_data, const struct err_handler_data *const data)
{
	uint64_t status;
	int ret;

	/*
	 * The faulting error record is already selected by the SER probe
	 * function.
	 */
	status = read_erxstatus_el1();

	ERROR("Fault reported by system error record %d on 0x%lx: status=0x%" PRIx64 "\n",
			probe_data, read_mpidr_el1(), status);
	ERROR(" exception reason=%u syndrome=0x%" PRIx64 "\n", data->ea_reason,
			data->flags);

	/* Clear error */
	write_erxstatus_el1(status);

	ret = sdei_dispatch_event(5000);
	if (ret < 0) {
		ERROR("Can't dispatch event to SDEI\n");
		panic();
	} else {
		INFO("SDEI event dispatched\n");
	}

	return 0;
}

void plat_handle_uncontainable_ea(void)
{
	/* Do not change the string, CI expects it. Wait forever */
	INFO("Injected Uncontainable Error\n");
	while (true) {
		wfe();
	}
}
#endif

struct ras_interrupt fvp_ras_interrupts[] = {
};

struct err_record_info fvp_err_records[] = {
#ifdef PLATFORM_TEST_RAS_FFH
	/* Record for injected fault */
	ERR_RECORD_SYSREG_V1(0, 2, ras_err_ser_probe_sysreg,
			injected_fault_handler, NULL),
#endif
};

REGISTER_ERR_RECORD_INFO(fvp_err_records);
REGISTER_RAS_INTERRUPTS(fvp_ras_interrupts);