blob: 2f36720a950e7c80246542ec3f12e24ebca6abbc [file] [log] [blame]
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +01001/*
Sona Mathewa4223962025-03-31 17:12:41 -05002 * Copyright (c) 2022-2025, Arm Limited. All rights reserved.
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef TRP_HELPERS_H
8#define TRP_HELPERS_H
9
10/* Definitions to help the assembler access the SMC/ERET args structure */
11#define TRP_ARGS_SIZE TRP_ARGS_END
12#define TRP_ARG0 0x0
13#define TRP_ARG1 0x8
14#define TRP_ARG2 0x10
15#define TRP_ARG3 0x18
16#define TRP_ARG4 0x20
17#define TRP_ARG5 0x28
18#define TRP_ARG6 0x30
19#define TRP_ARG7 0x38
Sona Mathewa4223962025-03-31 17:12:41 -050020#define TRP_ARG8 0x40
21#define TRP_ARG9 0x48
22#define TRP_ARG10 0x50
23#define TRP_ARG11 0x58
24#define TRP_ARGS_END 0x60
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010025
26#ifndef __ASSEMBLER__
27
28#include <platform_def.h>
29
30/* Data structure to hold SMC arguments */
31typedef struct trp_args {
32 uint64_t regs[TRP_ARGS_END >> 3];
33} __aligned(CACHE_WRITEBACK_GRANULE) trp_args_t;
34
35trp_args_t *set_smc_args(uint64_t arg0,
36 uint64_t arg1,
37 uint64_t arg2,
38 uint64_t arg3,
39 uint64_t arg4,
40 uint64_t arg5,
41 uint64_t arg6,
Sona Mathewa4223962025-03-31 17:12:41 -050042 uint64_t arg7,
43 uint64_t arg8,
44 uint64_t arg9,
45 uint64_t arg10,
46 uint64_t arg11);
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010047
48__dead2 void trp_boot_abort(uint64_t err);
49
AlexeiFedorovf9044ab2022-11-24 13:42:44 +000050/* TRP SMC result registers X0-X4 */
51#define TRP_SMC_RESULT_REGS 5
52
53struct trp_smc_result {
54 unsigned long long x[TRP_SMC_RESULT_REGS];
55};
56
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010057#endif /* __ASSEMBLER __ */
58#endif /* TRP_HELPERS_H */