blob: 43a4a4bfd27931267cffc7a4e795b618f6c42816 [file] [log] [blame]
Zelalem Awekec8bc23e2021-07-09 15:32:21 -05001/*
Soby Mathew68ea9542022-03-22 13:58:52 +00002 * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
Zelalem Awekec8bc23e2021-07-09 15:32:21 -05003 *
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
Soby Mathew68ea9542022-03-22 13:58:52 +000034/* RMI handled by TRP */
35#define RMI_FNUM_VERSION_REQ U(0x150)
36
37#define RMI_FNUM_GRANULE_DELEGATE U(0x151)
38#define RMI_FNUM_GRANULE_UNDELEGATE U(0x152)
39
40#define RMI_RMM_REQ_VERSION RMM_FID(SMC_64, RMI_FNUM_VERSION_REQ)
41
42#define RMI_RMM_GRANULE_DELEGATE RMM_FID(SMC_64, \
43 RMI_FNUM_GRANULE_DELEGATE)
44#define RMI_RMM_GRANULE_UNDELEGATE RMM_FID(SMC_64, \
45 RMI_FNUM_GRANULE_UNDELEGATE)
46
Zelalem Awekec8bc23e2021-07-09 15:32:21 -050047/* Definitions for RMI VERSION */
48#define RMI_ABI_VERSION_MAJOR U(0x0)
49#define RMI_ABI_VERSION_MINOR U(0x0)
50#define RMI_ABI_VERSION ((RMI_ABI_VERSION_MAJOR << 16) | \
51 RMI_ABI_VERSION_MINOR)
52
53/* Helper to issue SMC calls to BL31 */
54uint64_t trp_smc(trp_args_t *);
55
56/* The main function to executed only by Primary CPU */
57void trp_main(void);
58
59/* Setup TRP. Executed only by Primary CPU */
60void trp_setup(void);
61
62#endif /* __ASSEMBLER__ */
63#endif /* TRP_PRIVATE_H */