xref: /rk3399_ARM-atf/services/std_svc/rmmd/trp/trp_private.h (revision ec56d5951f03bab04a23c83288da527c6c3499dc)
1 /*
2  * Copyright (c) 2021-2022, 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 #include <services/rmmd_svc.h>
11 #include <trp_helpers.h>
12 
13 /* Definitions for RMM-EL3 Interface ABI VERSION */
14 #define TRP_RMM_EL3_ABI_VERS_MAJOR	RMM_EL3_IFC_VERSION_MAJOR
15 #define TRP_RMM_EL3_ABI_VERS_MINOR	RMM_EL3_IFC_VERSION_MINOR
16 #define TRP_RMM_EL3_ABI_VERS	(((TRP_RMM_EL3_ABI_VERS_MAJOR & 0x7FFF) << 16) | \
17 				 (TRP_RMM_EL3_ABI_VERS_MINOR & 0xFFFF))
18 
19 #define TRP_PLATFORM_CORE_COUNT		PLATFORM_CORE_COUNT
20 
21 #ifndef __ASSEMBLER__
22 
23 #include <stdint.h>
24 
25 #define write_trp_arg(args, offset, val) (((args)->regs[offset >> 3])	\
26 					 = val)
27 /* RMI SMC64 FIDs handled by the TRP */
28 #define RMI_RMM_REQ_VERSION		SMC64_RMI_FID(U(0))
29 #define RMI_RMM_GRANULE_DELEGATE	SMC64_RMI_FID(U(1))
30 #define RMI_RMM_GRANULE_UNDELEGATE	SMC64_RMI_FID(U(2))
31 #define RMI_RMM_PDEV_CREATE		SMC64_RMI_FID(U(0x26))
32 
33 /* Definitions for RMI VERSION */
34 #define RMI_ABI_VERSION_MAJOR		U(0x0)
35 #define RMI_ABI_VERSION_MINOR		U(0x0)
36 #define RMI_ABI_VERSION			(((RMI_ABI_VERSION_MAJOR & 0x7FFF) \
37 								  << 16) | \
38 					 (RMI_ABI_VERSION_MINOR & 0xFFFF))
39 
40 #define TRP_RMM_EL3_VERSION_GET_MAJOR(x)		\
41 				RMM_EL3_IFC_VERSION_GET_MAJOR((x))
42 #define TRP_RMM_EL3_VERSION_GET_MINOR(x)		\
43 				RMM_EL3_IFC_VERSION_GET_MAJOR_MINOR((x))
44 
45 /* Helper to issue SMC calls to BL31 */
46 uint64_t trp_smc(trp_args_t *);
47 
48 /* The main function to executed only by Primary CPU */
49 void trp_main(void);
50 
51 /* Setup TRP. Executed only by Primary CPU */
52 void trp_setup(uint64_t x0,
53 	       uint64_t x1,
54 	       uint64_t x2,
55 	       uint64_t x3);
56 
57 /* Validate arguments for warm boot only */
58 int trp_validate_warmboot_args(uint64_t x0, uint64_t x1,
59 			       uint64_t x2, uint64_t x3);
60 
61 #endif /* __ASSEMBLER__ */
62 #endif /* TRP_PRIVATE_H */
63