blob: 923139007c7cc413c8eb93d23fd3b3f5fa335633 [file] [log] [blame]
Zelalem Awekec8bc23e2021-07-09 15:32:21 -05001/*
2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef TRP_PRIVATE_H
8#define TRP_PRIVATE_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
20#define TRP_ARGS_END 0x40
21
22#ifndef __ASSEMBLER__
23
24#include <stdint.h>
25
26/* Data structure to hold SMC arguments */
27typedef struct trp_args {
28 uint64_t regs[TRP_ARGS_END >> 3];
29} __aligned(CACHE_WRITEBACK_GRANULE) trp_args_t;
30
31#define write_trp_arg(args, offset, val) (((args)->regs[offset >> 3]) \
32 = val)
33
34/* Definitions for RMI VERSION */
35#define RMI_ABI_VERSION_MAJOR U(0x0)
36#define RMI_ABI_VERSION_MINOR U(0x0)
37#define RMI_ABI_VERSION ((RMI_ABI_VERSION_MAJOR << 16) | \
38 RMI_ABI_VERSION_MINOR)
39
40/* Helper to issue SMC calls to BL31 */
41uint64_t trp_smc(trp_args_t *);
42
43/* The main function to executed only by Primary CPU */
44void trp_main(void);
45
46/* Setup TRP. Executed only by Primary CPU */
47void trp_setup(void);
48
49#endif /* __ASSEMBLER__ */
50#endif /* TRP_PRIVATE_H */