blob: b896a9381774bbfe1bdd3d4e18ce0bcc586f2f2b (
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
68
69
70
71
72
|
/*
* Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* DRTM support for DRTM error remediation.
*
*/
#include <stdint.h>
#include <common/debug.h>
#include <common/runtime_svc.h>
#include "drtm_main.h"
static enum drtm_retc drtm_error_set(long long error_code)
{
/* TODO: Store the error code in non-volatile memory. */
return SUCCESS;
}
static enum drtm_retc drtm_error_get(long long *error_code)
{
/* TODO: Get error code from non-volatile memory. */
*error_code = 0;
return SUCCESS;
}
void drtm_enter_remediation(long long err_code, const char *err_str)
{
int rc;
if ((rc = drtm_error_set(err_code))) {
ERROR("%s(): drtm_error_set() failed unexpectedly rc=%d\n",
__func__, rc);
panic();
}
NOTICE("DRTM: entering remediation of error:\n%lld\t\'%s\'\n",
err_code, err_str);
/* TODO: Reset the system rather than panic(). */
ERROR("%s(): system reset is not yet supported\n", __func__);
panic();
}
uintptr_t drtm_set_error(uint64_t x1, void *ctx)
{
int rc;
if ((rc = drtm_error_set(x1))) {
SMC_RET1(ctx, rc);
}
SMC_RET1(ctx, SUCCESS);
}
uintptr_t drtm_get_error(void *ctx)
{
long long error_code;
int rc;
if ((rc = drtm_error_get(&error_code))) {
SMC_RET1(ctx, rc);
}
SMC_RET2(ctx, SUCCESS, error_code);
}
|