xref: /rk3399_ARM-atf/include/services/rmmd_svc.h (revision 92c0f3baf2d2ee0f4db2c290727e6034b8aa294b)
177c27753SZelalem Aweke /*
2f801fdc2STushar Khandelwal  * Copyright (c) 2021-2025, Arm Limited and Contributors. All rights reserved.
377c27753SZelalem Aweke  *
477c27753SZelalem Aweke  * SPDX-License-Identifier: BSD-3-Clause
577c27753SZelalem Aweke  */
677c27753SZelalem Aweke 
777c27753SZelalem Aweke #ifndef RMMD_SVC_H
877c27753SZelalem Aweke #define RMMD_SVC_H
977c27753SZelalem Aweke 
10e9529e46SRaghu Krishnamurthy #include <common/sha_common_macros.h>
11319fb084SSoby Mathew #include <lib/smccc.h>
12319fb084SSoby Mathew #include <lib/utils_def.h>
13319fb084SSoby Mathew 
14fb00dc4aSSubhasish Ghosh /* STD calls FNUM Min/Max ranges */
15319fb084SSoby Mathew #define RMI_FNUM_MIN_VALUE	U(0x150)
16319fb084SSoby Mathew #define RMI_FNUM_MAX_VALUE	U(0x18F)
17319fb084SSoby Mathew 
18fb00dc4aSSubhasish Ghosh /* Construct RMI fastcall std FID from offset */
19fb00dc4aSSubhasish Ghosh #define SMC64_RMI_FID(_offset)					  \
20fb00dc4aSSubhasish Ghosh 	((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT)			| \
21fb00dc4aSSubhasish Ghosh 	 (SMC_64 << FUNCID_CC_SHIFT)				| \
22fb00dc4aSSubhasish Ghosh 	 (OEN_STD_START << FUNCID_OEN_SHIFT)			| \
23fb00dc4aSSubhasish Ghosh 	 (((RMI_FNUM_MIN_VALUE + (_offset)) & FUNCID_NUM_MASK)	  \
24fb00dc4aSSubhasish Ghosh 	  << FUNCID_NUM_SHIFT))
25fb00dc4aSSubhasish Ghosh 
26319fb084SSoby Mathew #define is_rmi_fid(fid) __extension__ ({		\
27319fb084SSoby Mathew 	__typeof__(fid) _fid = (fid);			\
28319fb084SSoby Mathew 	((GET_SMC_NUM(_fid) >= RMI_FNUM_MIN_VALUE) &&	\
29319fb084SSoby Mathew 	 (GET_SMC_NUM(_fid) <= RMI_FNUM_MAX_VALUE) &&	\
30319fb084SSoby Mathew 	 (GET_SMC_TYPE(_fid) == SMC_TYPE_FAST)	   &&	\
31319fb084SSoby Mathew 	 (GET_SMC_CC(_fid) == SMC_64)              &&	\
32319fb084SSoby Mathew 	 (GET_SMC_OEN(_fid) == OEN_STD_START)      &&	\
33319fb084SSoby Mathew 	 ((_fid & 0x00FE0000) == 0U)); })
34319fb084SSoby Mathew 
35319fb084SSoby Mathew /*
36fb00dc4aSSubhasish Ghosh  * RMI_FNUM_REQ_COMPLETE is the only function in the RMI range that originates
37319fb084SSoby Mathew  * from the Realm world and is handled by the RMMD. The RMI functions are
38319fb084SSoby Mathew  * always invoked by the Normal world, forwarded by RMMD and handled by the
39fb00dc4aSSubhasish Ghosh  * RMM.
40319fb084SSoby Mathew  */
41fb00dc4aSSubhasish Ghosh 					/* 0x18F */
42e50fedbcSJavier Almansa Sobrino #define RMM_RMI_REQ_COMPLETE		SMC64_RMI_FID(U(0x3F))
43319fb084SSoby Mathew 
448c980a4aSJavier Almansa Sobrino /* RMM_BOOT_COMPLETE arg0 error codes */
458c980a4aSJavier Almansa Sobrino #define E_RMM_BOOT_SUCCESS				(0)
468c980a4aSJavier Almansa Sobrino #define E_RMM_BOOT_UNKNOWN				(-1)
478c980a4aSJavier Almansa Sobrino #define E_RMM_BOOT_VERSION_MISMATCH			(-2)
488c980a4aSJavier Almansa Sobrino #define E_RMM_BOOT_CPUS_OUT_OF_RANGE			(-3)
498c980a4aSJavier Almansa Sobrino #define E_RMM_BOOT_CPU_ID_OUT_OF_RANGE			(-4)
508c980a4aSJavier Almansa Sobrino #define E_RMM_BOOT_INVALID_SHARED_BUFFER		(-5)
518c980a4aSJavier Almansa Sobrino #define E_RMM_BOOT_MANIFEST_VERSION_NOT_SUPPORTED	(-6)
528c980a4aSJavier Almansa Sobrino #define E_RMM_BOOT_MANIFEST_DATA_ERROR			(-7)
538c980a4aSJavier Almansa Sobrino 
548c980a4aSJavier Almansa Sobrino /* The SMC in the range 0x8400 0191 - 0x8400 01AF are reserved for RSIs.*/
55319fb084SSoby Mathew 
56319fb084SSoby Mathew /*
57319fb084SSoby Mathew  * EL3 - RMM SMCs used for requesting RMMD services. These SMCs originate in Realm
58319fb084SSoby Mathew  * world and return to Realm world.
59319fb084SSoby Mathew  *
60319fb084SSoby Mathew  * These are allocated from 0x8400 01B0 - 0x8400 01CF in the RMM Service range.
61319fb084SSoby Mathew  */
62319fb084SSoby Mathew #define RMMD_EL3_FNUM_MIN_VALUE		U(0x1B0)
63319fb084SSoby Mathew #define RMMD_EL3_FNUM_MAX_VALUE		U(0x1CF)
64319fb084SSoby Mathew 
65fb00dc4aSSubhasish Ghosh /* Construct RMM_EL3 fastcall std FID from offset */
66fb00dc4aSSubhasish Ghosh #define SMC64_RMMD_EL3_FID(_offset)					  \
67fb00dc4aSSubhasish Ghosh 	((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT)				| \
68fb00dc4aSSubhasish Ghosh 	 (SMC_64 << FUNCID_CC_SHIFT)					| \
69fb00dc4aSSubhasish Ghosh 	 (OEN_STD_START << FUNCID_OEN_SHIFT)				| \
70fb00dc4aSSubhasish Ghosh 	 (((RMMD_EL3_FNUM_MIN_VALUE + (_offset)) & FUNCID_NUM_MASK)	  \
71fb00dc4aSSubhasish Ghosh 	  << FUNCID_NUM_SHIFT))
72fb00dc4aSSubhasish Ghosh 
73319fb084SSoby Mathew /* The macros below are used to identify GTSI calls from the SMC function ID */
74319fb084SSoby Mathew #define is_rmmd_el3_fid(fid) __extension__ ({		\
75319fb084SSoby Mathew 	__typeof__(fid) _fid = (fid);			\
76319fb084SSoby Mathew 	((GET_SMC_NUM(_fid) >= RMMD_EL3_FNUM_MIN_VALUE) &&\
77319fb084SSoby Mathew 	(GET_SMC_NUM(_fid) <= RMMD_EL3_FNUM_MAX_VALUE)  &&\
78319fb084SSoby Mathew 	(GET_SMC_TYPE(_fid) == SMC_TYPE_FAST)	    &&	\
79319fb084SSoby Mathew 	(GET_SMC_CC(_fid) == SMC_64)                &&	\
80319fb084SSoby Mathew 	(GET_SMC_OEN(_fid) == OEN_STD_START)        &&	\
81319fb084SSoby Mathew 	((_fid & 0x00FE0000) == 0U)); })
82319fb084SSoby Mathew 
83fb00dc4aSSubhasish Ghosh 					/* 0x1B0 - 0x1B1 */
84e50fedbcSJavier Almansa Sobrino #define RMM_GTSI_DELEGATE		SMC64_RMMD_EL3_FID(U(0))
85e50fedbcSJavier Almansa Sobrino #define RMM_GTSI_UNDELEGATE		SMC64_RMMD_EL3_FID(U(1))
86319fb084SSoby Mathew 
87319fb084SSoby Mathew /* Return error codes from RMM-EL3 SMCs */
88dc65ae46SJavier Almansa Sobrino #define E_RMM_OK			 0
89dc65ae46SJavier Almansa Sobrino #define E_RMM_UNK			-1
90dc65ae46SJavier Almansa Sobrino #define E_RMM_BAD_ADDR			-2
91dc65ae46SJavier Almansa Sobrino #define E_RMM_BAD_PAS			-3
92dc65ae46SJavier Almansa Sobrino #define E_RMM_NOMEM			-4
93dc65ae46SJavier Almansa Sobrino #define E_RMM_INVAL			-5
9442cf6026SJuan Pablo Conde #define E_RMM_AGAIN			-6
952132c707SSona Mathew #define E_RMM_FAULT			-7
962132c707SSona Mathew #define E_RMM_IN_PROGRESS		-8
97319fb084SSoby Mathew 
98ade6000fSShruti Gupta /* Return error codes from RMI SMCs */
99ade6000fSShruti Gupta #define RMI_SUCCESS			0
100ade6000fSShruti Gupta #define RMI_ERROR_INPUT			1
101ade6000fSShruti Gupta 
102a0435105SSoby Mathew /*
103a0435105SSoby Mathew  * Retrieve Realm attestation key from EL3. Only P-384 ECC curve key is
104a0435105SSoby Mathew  * supported. The arguments to this SMC are :
105a0435105SSoby Mathew  *    arg0 - Function ID.
106a0435105SSoby Mathew  *    arg1 - Realm attestation key buffer Physical address.
107a0435105SSoby Mathew  *    arg2 - Realm attestation key buffer size (in bytes).
108a0435105SSoby Mathew  *    arg3 - The type of the elliptic curve to which the requested
109a0435105SSoby Mathew  *           attestation key belongs to. The value should be one of the
110a0435105SSoby Mathew  *           defined curve types.
111a0435105SSoby Mathew  * The return arguments are :
112a0435105SSoby Mathew  *    ret0 - Status / error.
113a0435105SSoby Mathew  *    ret1 - Size of the realm attestation key if successful.
114a0435105SSoby Mathew  */
115fb00dc4aSSubhasish Ghosh 					/* 0x1B2 */
116e50fedbcSJavier Almansa Sobrino #define RMM_ATTEST_GET_REALM_KEY	SMC64_RMMD_EL3_FID(U(2))
117fb00dc4aSSubhasish Ghosh 
118fb00dc4aSSubhasish Ghosh /*
119fb00dc4aSSubhasish Ghosh  * Retrieve Platform token from EL3.
120fb00dc4aSSubhasish Ghosh  * The arguments to this SMC are :
121fb00dc4aSSubhasish Ghosh  *    arg0 - Function ID.
122fb00dc4aSSubhasish Ghosh  *    arg1 - Platform attestation token buffer Physical address. (The challenge
123fb00dc4aSSubhasish Ghosh  *           object is passed in this buffer.)
124fb00dc4aSSubhasish Ghosh  *    arg2 - Platform attestation token buffer size (in bytes).
125fb00dc4aSSubhasish Ghosh  *    arg3 - Challenge object size (in bytes). It has to be one of the defined
126fb00dc4aSSubhasish Ghosh  *           SHA hash sizes.
127fb00dc4aSSubhasish Ghosh  * The return arguments are :
128fb00dc4aSSubhasish Ghosh  *    ret0 - Status / error.
129fb00dc4aSSubhasish Ghosh  *    ret1 - Size of the platform token if successful.
130fb00dc4aSSubhasish Ghosh  */
131fb00dc4aSSubhasish Ghosh 					/* 0x1B3 */
132e50fedbcSJavier Almansa Sobrino #define RMM_ATTEST_GET_PLAT_TOKEN	SMC64_RMMD_EL3_FID(U(3))
133a0435105SSoby Mathew 
1346a88ec8bSRaghu Krishnamurthy /* Starting RMM-EL3 interface version 0.4 */
1356a88ec8bSRaghu Krishnamurthy #define RMM_EL3_FEATURES				SMC64_RMMD_EL3_FID(U(4))
1366a88ec8bSRaghu Krishnamurthy #define RMM_EL3_FEAT_REG_0_IDX				U(0)
1376a88ec8bSRaghu Krishnamurthy /* Bit 0 of FEAT_REG_0 */
1386a88ec8bSRaghu Krishnamurthy /* 1 - the feature is present in EL3 , 0 - the feature is absent */
1396a88ec8bSRaghu Krishnamurthy #define RMM_EL3_FEAT_REG_0_EL3_TOKEN_SIGN_MASK		U(0x1)
1406a88ec8bSRaghu Krishnamurthy 
1416a88ec8bSRaghu Krishnamurthy /*
1426a88ec8bSRaghu Krishnamurthy  * Function codes to support attestation where EL3 is used to sign
1436a88ec8bSRaghu Krishnamurthy  * realm attestation tokens. In this model, the private key is not
1446a88ec8bSRaghu Krishnamurthy  * exposed to the RMM.
1456a88ec8bSRaghu Krishnamurthy  * The arguments to this SMC are:
1466a88ec8bSRaghu Krishnamurthy  *     arg0 - Function ID.
1476a88ec8bSRaghu Krishnamurthy  *     arg1 - Opcode, one of:
1486a88ec8bSRaghu Krishnamurthy  *               RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP,
1496a88ec8bSRaghu Krishnamurthy  *               RMM_EL3_TOKEN_SIGN_PULL_RESP_OP,
1506a88ec8bSRaghu Krishnamurthy  *               RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP
1516a88ec8bSRaghu Krishnamurthy  *     arg2 - Pointer to buffer with request/response structures,
1526a88ec8bSRaghu Krishnamurthy  *            which is in the RMM<->EL3 shared buffer.
1536a88ec8bSRaghu Krishnamurthy  *     arg3 - Buffer size of memory pointed by arg2.
1546a88ec8bSRaghu Krishnamurthy  *     arg4 - ECC Curve, when opcode is RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP
1556a88ec8bSRaghu Krishnamurthy  * The return arguments are:
1566a88ec8bSRaghu Krishnamurthy  *     ret0 - Status/Error
1576a88ec8bSRaghu Krishnamurthy  *     ret1 - Size of public key if opcode is RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP
1586a88ec8bSRaghu Krishnamurthy  */
1596a88ec8bSRaghu Krishnamurthy #define RMM_EL3_TOKEN_SIGN			SMC64_RMMD_EL3_FID(U(5))
1606a88ec8bSRaghu Krishnamurthy 
1616a88ec8bSRaghu Krishnamurthy /* Opcodes for RMM_EL3_TOKEN_SIGN  */
1626a88ec8bSRaghu Krishnamurthy #define RMM_EL3_TOKEN_SIGN_PUSH_REQ_OP          U(1)
1636a88ec8bSRaghu Krishnamurthy #define RMM_EL3_TOKEN_SIGN_PULL_RESP_OP         U(2)
1646a88ec8bSRaghu Krishnamurthy #define RMM_EL3_TOKEN_SIGN_GET_RAK_PUB_OP       U(3)
1656a88ec8bSRaghu Krishnamurthy 
166f801fdc2STushar Khandelwal /* Starting RMM-EL3 interface version 0.5 */
167f801fdc2STushar Khandelwal 
168f801fdc2STushar Khandelwal /*
169f801fdc2STushar Khandelwal  * Function code to support update of MEC keys.
170f801fdc2STushar Khandelwal  * The arguments of this SMC are:
171f801fdc2STushar Khandelwal  * 	arg0 - Function ID.
17200e62ff9SJuan Pablo Conde  * 	arg1 - [63:48]: Res0, [47:32]: MECID, [31:1]: Res0, [0]: MEC refresh
17300e62ff9SJuan Pablo Conde  * 	       reason
174f801fdc2STushar Khandelwal  * The return arguments are:
175f801fdc2STushar Khandelwal  * 	ret0 - Status/Error
176f801fdc2STushar Khandelwal  */
17700e62ff9SJuan Pablo Conde #define RMM_MEC_REFRESH				SMC64_RMMD_EL3_FID(U(6))
178f801fdc2STushar Khandelwal 
179a0435105SSoby Mathew /* ECC Curve types for attest key generation */
1806a88ec8bSRaghu Krishnamurthy #define ATTEST_KEY_CURVE_ECC_SECP384R1		U(0)
1816a88ec8bSRaghu Krishnamurthy 
1826a88ec8bSRaghu Krishnamurthy /* Identifier for the hash algorithm used for attestation signing */
1836a88ec8bSRaghu Krishnamurthy #define EL3_TOKEN_SIGN_HASH_ALG_SHA384		U(1)
184a0435105SSoby Mathew 
1852132c707SSona Mathew /* Starting RMM-EL3 interface version 0.6 */
1862132c707SSona Mathew /*
1872132c707SSona Mathew  * Function codes to support RMM IDE Key management Interface.
1882132c707SSona Mathew  * The arguments to this SMC are:
1892132c707SSona Mathew  *     arg0 - Function ID.
1902132c707SSona Mathew  *     arg1 - Enhanced Configuration Access Mechanism address
1912132c707SSona Mathew  *     arg2 - Root Port ID
1922132c707SSona Mathew  *     arg3 - IDE selective stream info
1932132c707SSona Mathew  *     arg4 - Quad word of key[63:0]
1942132c707SSona Mathew  *     arg5 - Quad word of key[127:64]
1952132c707SSona Mathew  *     arg6 - Quad word of key[191:128]
1962132c707SSona Mathew  *     arg7 - Quad word of key[255:192]
1972132c707SSona Mathew  *     arg8 - Quad word of IV [63:0]
1982132c707SSona Mathew  *     arg9 - Quad word of IV [95:64]
1992132c707SSona Mathew  *     arg10 - request_id
2002132c707SSona Mathew  *     arg11 - cookie
2012132c707SSona Mathew  * The return arguments are:
2022132c707SSona Mathew  *     ret0 - Status/Error
2032132c707SSona Mathew  */
2042132c707SSona Mathew #define RMM_IDE_KEY_PROG			SMC64_RMMD_EL3_FID(U(7))
2052132c707SSona Mathew 
2062132c707SSona Mathew /*******************************************************************************
2072132c707SSona Mathew  * Structure to hold el3_ide_key info
2082132c707SSona Mathew  ******************************************************************************/
2092132c707SSona Mathew #ifndef __ASSEMBLER__
2102132c707SSona Mathew typedef struct rp_ide_key_info {
2112132c707SSona Mathew 	uint64_t keyqw0;
2122132c707SSona Mathew 	uint64_t keyqw1;
2132132c707SSona Mathew 	uint64_t keyqw2;
2142132c707SSona Mathew 	uint64_t keyqw3;
2152132c707SSona Mathew 	uint64_t ifvqw0;
2162132c707SSona Mathew 	uint64_t ifvqw1;
2172132c707SSona Mathew } rp_ide_key_info_t;
2182132c707SSona Mathew #endif /* __ASSEMBLER__ */
2192132c707SSona Mathew 
2202132c707SSona Mathew /*
2212132c707SSona Mathew  * Function codes to support RMM IDE Key management Interface.
2222132c707SSona Mathew  * The arguments to this SMC are:
2232132c707SSona Mathew  *     arg0 - Function ID.
2242132c707SSona Mathew  *     arg1 - Enhanced Configuration Access Mechanism address
2252132c707SSona Mathew  *     arg2 - Root Port ID
2262132c707SSona Mathew  *     arg3 - IDE selective stream info
2272132c707SSona Mathew  *     arg4 - request_id
2282132c707SSona Mathew  *     arg5 - cookie
2292132c707SSona Mathew  * The return arguments are:
2302132c707SSona Mathew  *     ret0 - Status/Error
2312132c707SSona Mathew  */
2322132c707SSona Mathew #define RMM_IDE_KEY_SET_GO			SMC64_RMMD_EL3_FID(U(8))
2332132c707SSona Mathew 
2342132c707SSona Mathew /*
2352132c707SSona Mathew  * Function codes to support RMM IDE Key management Interface.
2362132c707SSona Mathew  * The arguments to this SMC are:
2372132c707SSona Mathew  *     arg0 - Function ID.
2382132c707SSona Mathew  *     arg1 - Enhanced Configuration Access Mechanism address
2392132c707SSona Mathew  *     arg2 - Root Port ID
2402132c707SSona Mathew  *     arg3 - IDE selective stream info
2412132c707SSona Mathew  *     arg4 - request_id
2422132c707SSona Mathew  *     arg5 - cookie
2432132c707SSona Mathew  * The return arguments are:
2442132c707SSona Mathew  *     ret0 - Status/Error
2452132c707SSona Mathew  */
2462132c707SSona Mathew #define RMM_IDE_KEY_SET_STOP			SMC64_RMMD_EL3_FID(U(9))
2472132c707SSona Mathew 
2482132c707SSona Mathew /*
2492132c707SSona Mathew  * Function codes to support RMM IDE Key management Interface.
2502132c707SSona Mathew  * The arguments to this SMC are:
2512132c707SSona Mathew  *     arg0 - Function ID.
2522132c707SSona Mathew  *     arg1 - Enhanced Configuration Access Mechanism address
2532132c707SSona Mathew  *     arg2 - Root Port ID
2542132c707SSona Mathew  * The return arguments are:
2552132c707SSona Mathew  *     ret0 - Status/Error
2562132c707SSona Mathew  *     ret1 - Retrieved response corresponding to the previous request.
2572132c707SSona Mathew  *     ret2 - request_id
2582132c707SSona Mathew  *     ret3 - cookie
2592132c707SSona Mathew  */
2602132c707SSona Mathew #define RMM_IDE_KM_PULL_RESPONSE		SMC64_RMMD_EL3_FID(U(10))
2612132c707SSona Mathew 
262745c129aSAndre Przywara /* Starting RMM-EL3 interface version 0.7 */
263745c129aSAndre Przywara /*
264745c129aSAndre Przywara  * Reserve memory for the RMM.
265745c129aSAndre Przywara  * The arguments to this SMC are:
266745c129aSAndre Przywara  *     arg0 - Function ID.
267745c129aSAndre Przywara  *     arg1 - Size of memory to be reserved (in bytes).
268745c129aSAndre Przywara  *     arg2 - Flags and alignment requirements.
269745c129aSAndre Przywara  * The return arguments are:
270745c129aSAndre Przywara  *     ret0 - Status/error.
271745c129aSAndre Przywara  *     ret1 - Physical address of the reserved memory area.
272745c129aSAndre Przywara  */
273745c129aSAndre Przywara #define RMM_RESERVE_MEMORY			SMC64_RMMD_EL3_FID(U(11))
274745c129aSAndre Przywara 
2758c980a4aSJavier Almansa Sobrino /*
2768c980a4aSJavier Almansa Sobrino  * RMM_BOOT_COMPLETE originates on RMM when the boot finishes (either cold
2778c980a4aSJavier Almansa Sobrino  * or warm boot). This is handled by the RMM-EL3 interface SMC handler.
2788c980a4aSJavier Almansa Sobrino  *
2798c980a4aSJavier Almansa Sobrino  * RMM_BOOT_COMPLETE FID is located at the end of the available range.
2808c980a4aSJavier Almansa Sobrino  */
2818c980a4aSJavier Almansa Sobrino 					 /* 0x1CF */
2828c980a4aSJavier Almansa Sobrino #define RMM_BOOT_COMPLETE		SMC64_RMMD_EL3_FID(U(0x1F))
2838c980a4aSJavier Almansa Sobrino 
2848c980a4aSJavier Almansa Sobrino /*
2858c980a4aSJavier Almansa Sobrino  * The major version number of the RMM Boot Interface implementation.
2868c980a4aSJavier Almansa Sobrino  * Increase this whenever the semantics of the boot arguments change making it
2878c980a4aSJavier Almansa Sobrino  * backwards incompatible.
2888c980a4aSJavier Almansa Sobrino  */
2898c980a4aSJavier Almansa Sobrino #define RMM_EL3_IFC_VERSION_MAJOR	(U(0))
2908c980a4aSJavier Almansa Sobrino 
2918c980a4aSJavier Almansa Sobrino /*
2928c980a4aSJavier Almansa Sobrino  * The minor version number of the RMM Boot Interface implementation.
2938c980a4aSJavier Almansa Sobrino  * Increase this when a bug is fixed, or a feature is added without
2948c980a4aSJavier Almansa Sobrino  * breaking compatibility.
2958c980a4aSJavier Almansa Sobrino  */
29600e62ff9SJuan Pablo Conde #define RMM_EL3_IFC_VERSION_MINOR	(U(8))
2978c980a4aSJavier Almansa Sobrino 
2988c980a4aSJavier Almansa Sobrino #define RMM_EL3_INTERFACE_VERSION				\
2998c980a4aSJavier Almansa Sobrino 	(((RMM_EL3_IFC_VERSION_MAJOR << 16) & 0x7FFFF) |	\
3008c980a4aSJavier Almansa Sobrino 		RMM_EL3_IFC_VERSION_MINOR)
3018c980a4aSJavier Almansa Sobrino 
3028c980a4aSJavier Almansa Sobrino #define RMM_EL3_IFC_VERSION_GET_MAJOR(_version) (((_version) >> 16) \
3038c980a4aSJavier Almansa Sobrino 								& 0x7FFF)
3048c980a4aSJavier Almansa Sobrino #define RMM_EL3_IFC_VERSION_GET_MAJOR_MINOR(_version) ((_version) & 0xFFFF)
305a0435105SSoby Mathew 
30677c27753SZelalem Aweke #ifndef __ASSEMBLER__
30777c27753SZelalem Aweke #include <stdint.h>
30877c27753SZelalem Aweke 
30977c27753SZelalem Aweke int rmmd_setup(void);
310*22bbb59fSAndre Przywara int rmmd_primary_activate(void);
311*22bbb59fSAndre Przywara int rmmd_secondary_activate(void);
31277c27753SZelalem Aweke uint64_t rmmd_rmi_handler(uint32_t smc_fid,
31377c27753SZelalem Aweke 		uint64_t x1,
31477c27753SZelalem Aweke 		uint64_t x2,
31577c27753SZelalem Aweke 		uint64_t x3,
31677c27753SZelalem Aweke 		uint64_t x4,
31777c27753SZelalem Aweke 		void *cookie,
31877c27753SZelalem Aweke 		void *handle,
31977c27753SZelalem Aweke 		uint64_t flags);
32077c27753SZelalem Aweke 
321319fb084SSoby Mathew uint64_t rmmd_rmm_el3_handler(uint32_t smc_fid,
32277c27753SZelalem Aweke 		uint64_t x1,
32377c27753SZelalem Aweke 		uint64_t x2,
32477c27753SZelalem Aweke 		uint64_t x3,
32577c27753SZelalem Aweke 		uint64_t x4,
32677c27753SZelalem Aweke 		void *cookie,
32777c27753SZelalem Aweke 		void *handle,
32877c27753SZelalem Aweke 		uint64_t flags);
32977c27753SZelalem Aweke 
33077c27753SZelalem Aweke #endif /* __ASSEMBLER__ */
33177c27753SZelalem Aweke #endif /* RMMD_SVC_H */
332