blob: 696b4ea6ac4b03e603d89fc2beadec62e27a9971 [file] [log] [blame]
Manish V Badarkhe39dd5552022-06-21 09:41:32 +01001/*
2 * Copyright (c) 2022 Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * DRTM support for DRTM error remediation.
7 *
8 */
9#include <inttypes.h>
10#include <stdint.h>
11
12#include <common/debug.h>
13#include <common/runtime_svc.h>
14#include "drtm_main.h"
15#include <plat/common/platform.h>
16
17uint64_t drtm_set_error(uint64_t x1, void *ctx)
18{
19 int rc;
20
21 rc = plat_set_drtm_error(x1);
22
23 if (rc != 0) {
24 SMC_RET1(ctx, INTERNAL_ERROR);
25 }
26
27 SMC_RET1(ctx, SUCCESS);
28}
29
30uint64_t drtm_get_error(void *ctx)
31{
32 uint64_t error_code;
33 int rc;
34
35 rc = plat_get_drtm_error(&error_code);
36
37 if (rc != 0) {
38 SMC_RET1(ctx, INTERNAL_ERROR);
39 }
40
41 SMC_RET2(ctx, SUCCESS, error_code);
42}
43
44void drtm_enter_remediation(uint64_t err_code, const char *err_str)
45{
46 int rc = plat_set_drtm_error(err_code);
47
48 if (rc != 0) {
49 ERROR("%s(): drtm_error_set() failed unexpectedly rc=%d\n",
50 __func__, rc);
51 panic();
52 }
53
54 ERROR("DRTM: entering remediation of error:\n%" PRIu64 "\t\'%s\'\n",
55 err_code, err_str);
56
57 ERROR("%s(): system reset is not yet supported\n", __func__);
58 plat_system_reset();
59}