blob: 4c5222eb54f0e19876d828ab77fb4576ef4d3af5 [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)
Subhasish Ghosh3ad16032022-05-12 12:22:17 +010033/* RMI SMC64 FIDs handled by the TRP */
34#define RMI_RMM_REQ_VERSION SMC64_RMI_FID(U(0))
35#define RMI_RMM_GRANULE_DELEGATE SMC64_RMI_FID(U(1))
36#define RMI_RMM_GRANULE_UNDELEGATE SMC64_RMI_FID(U(2))
Soby Mathew68ea9542022-03-22 13:58:52 +000037
Zelalem Awekec8bc23e2021-07-09 15:32:21 -050038/* Definitions for RMI VERSION */
39#define RMI_ABI_VERSION_MAJOR U(0x0)
40#define RMI_ABI_VERSION_MINOR U(0x0)
41#define RMI_ABI_VERSION ((RMI_ABI_VERSION_MAJOR << 16) | \
42 RMI_ABI_VERSION_MINOR)
43
44/* Helper to issue SMC calls to BL31 */
45uint64_t trp_smc(trp_args_t *);
46
47/* The main function to executed only by Primary CPU */
48void trp_main(void);
49
50/* Setup TRP. Executed only by Primary CPU */
51void trp_setup(void);
52
53#endif /* __ASSEMBLER__ */
54#endif /* TRP_PRIVATE_H */