blob: 2e316edaeca47b7281621eee044fc782fcf4a28f [file] [log] [blame]
Jeenu Viswambharan2e2e8812017-12-08 15:38:21 +00001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch_helpers.h>
8#include <debug.h>
9#include <ea_handle.h>
10#include <ehf.h>
11#include <platform.h>
12#include <ras.h>
13#include <ras_arch.h>
14
15/* Handler that receives External Aborts on RAS-capable systems */
16int ras_ea_handler(unsigned int ea_reason, uint64_t syndrome, void *cookie,
17 void *handle, uint64_t flags)
18{
19 unsigned int i, n_handled = 0, ret;
20 int probe_data;
21 struct err_record_info *info;
22
23 const struct err_handler_data err_data = {
24 .version = ERR_HANDLER_VERSION,
25 .ea_reason = ea_reason,
26 .syndrome = syndrome,
27 .flags = flags,
28 .cookie = cookie,
29 .handle = handle
30 };
31
32 for_each_err_record_info(i, info) {
33 assert(info->probe != NULL);
34 assert(info->handler != NULL);
35
36 /* Continue probing until the record group signals no error */
37 while (1) {
38 if (info->probe(info, &probe_data) == 0)
39 break;
40
41 /* Handle error */
42 ret = info->handler(info, probe_data, &err_data);
43 if (ret != 0)
44 return ret;
45
46 n_handled++;
47 }
48 }
49
50 return (n_handled != 0);
51}