blob: b38d6c42ce4849f84288e466bbc1d1c9cd2c14ef [file] [log] [blame]
Manish Pandeye62b67b2023-02-27 15:21:26 +00001/*
2 * Copyright (c) 2023, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7
8#include <arch_helpers.h>
9#include <serror.h>
10#include <tftf_lib.h>
11
12#ifdef __aarch64__
13static volatile uint64_t serror_triggered;
14extern void inject_unrecoverable_ras_error(void);
15
16static bool serror_handler(void)
17{
18 serror_triggered = 1;
19 return true;
20}
21
22/*
23 * Test Kernel First handling paradigm of RAS errors.
24 *
25 * Register a custom serror handler in tftf, inject a RAS error and wait
26 * for finite time to ensure that SError triggered and handled.
27 */
28test_result_t test_ras_kfh(void)
29{
30 register_custom_serror_handler(serror_handler);
31 inject_unrecoverable_ras_error();
32
33 /* Give reasonable time for SError to be triggered/handled */
34 waitms(500);
35
36 unregister_custom_serror_handler();
37
38 if (serror_triggered == false) {
39 tftf_testcase_printf("SError is not triggered\n");
40 return TEST_RESULT_FAIL;
41 }
42
43 return TEST_RESULT_SUCCESS;
44}
45#else
46test_result_t test_ras_kfh(void)
47{
48 tftf_testcase_printf("Not supported on AArch32.\n");
49 return TEST_RESULT_SKIPPED;
50}
51
52#endif