blob: f3a487605cfe480b9763da40779a9fcc5f193916 [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
Javier Almansa Sobrino7176a772021-11-24 18:37:37 +000010#include <services/rmmd_svc.h>
11
Zelalem Awekec8bc23e2021-07-09 15:32:21 -050012/* Definitions to help the assembler access the SMC/ERET args structure */
13#define TRP_ARGS_SIZE TRP_ARGS_END
14#define TRP_ARG0 0x0
15#define TRP_ARG1 0x8
16#define TRP_ARG2 0x10
17#define TRP_ARG3 0x18
18#define TRP_ARG4 0x20
19#define TRP_ARG5 0x28
20#define TRP_ARG6 0x30
21#define TRP_ARG7 0x38
22#define TRP_ARGS_END 0x40
23
Javier Almansa Sobrino7176a772021-11-24 18:37:37 +000024/* Definitions for RMM-EL3 Interface ABI VERSION */
25#define TRP_RMM_EL3_ABI_VERS_MAJOR RMM_EL3_IFC_VERSION_MAJOR
26#define TRP_RMM_EL3_ABI_VERS_MINOR RMM_EL3_IFC_VERSION_MINOR
27#define TRP_RMM_EL3_ABI_VERS (((TRP_RMM_EL3_ABI_VERS_MAJOR & 0x7FFF) << 16) | \
28 (TRP_RMM_EL3_ABI_VERS_MINOR & 0xFFFF))
29
30#define TRP_PLATFORM_CORE_COUNT PLATFORM_CORE_COUNT
31
Zelalem Awekec8bc23e2021-07-09 15:32:21 -050032#ifndef __ASSEMBLER__
33
34#include <stdint.h>
35
36/* Data structure to hold SMC arguments */
37typedef struct trp_args {
38 uint64_t regs[TRP_ARGS_END >> 3];
39} __aligned(CACHE_WRITEBACK_GRANULE) trp_args_t;
40
41#define write_trp_arg(args, offset, val) (((args)->regs[offset >> 3]) \
42 = val)
Subhasish Ghosh3ad16032022-05-12 12:22:17 +010043/* RMI SMC64 FIDs handled by the TRP */
44#define RMI_RMM_REQ_VERSION SMC64_RMI_FID(U(0))
45#define RMI_RMM_GRANULE_DELEGATE SMC64_RMI_FID(U(1))
46#define RMI_RMM_GRANULE_UNDELEGATE SMC64_RMI_FID(U(2))
Soby Mathew68ea9542022-03-22 13:58:52 +000047
Zelalem Awekec8bc23e2021-07-09 15:32:21 -050048/* Definitions for RMI VERSION */
49#define RMI_ABI_VERSION_MAJOR U(0x0)
50#define RMI_ABI_VERSION_MINOR U(0x0)
Javier Almansa Sobrino7176a772021-11-24 18:37:37 +000051#define RMI_ABI_VERSION (((RMI_ABI_VERSION_MAJOR & 0x7FFF) \
52 << 16) | \
53 (RMI_ABI_VERSION_MINOR & 0xFFFF))
54
55#define TRP_RMM_EL3_VERSION_GET_MAJOR(x) \
56 RMM_EL3_IFC_VERSION_GET_MAJOR((x))
57#define TRP_RMM_EL3_VERSION_GET_MINOR(x) \
58 RMM_EL3_IFC_VERSION_GET_MAJOR_MINOR((x))
Zelalem Awekec8bc23e2021-07-09 15:32:21 -050059
60/* Helper to issue SMC calls to BL31 */
61uint64_t trp_smc(trp_args_t *);
62
63/* The main function to executed only by Primary CPU */
64void trp_main(void);
65
66/* Setup TRP. Executed only by Primary CPU */
Javier Almansa Sobrino7176a772021-11-24 18:37:37 +000067void trp_setup(uint64_t x0,
68 uint64_t x1,
69 uint64_t x2,
70 uint64_t x3);
Zelalem Awekec8bc23e2021-07-09 15:32:21 -050071
72#endif /* __ASSEMBLER__ */
73#endif /* TRP_PRIVATE_H */