xref: /arm-trusted-firmware/plat/xilinx/common/include/pm_svc_main.h (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*
2*91f16700Schasinglulu  * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
3*91f16700Schasinglulu  * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
4*91f16700Schasinglulu  *
5*91f16700Schasinglulu  * SPDX-License-Identifier: BSD-3-Clause
6*91f16700Schasinglulu  */
7*91f16700Schasinglulu 
8*91f16700Schasinglulu #ifndef PM_SVC_MAIN_H
9*91f16700Schasinglulu #define PM_SVC_MAIN_H
10*91f16700Schasinglulu 
11*91f16700Schasinglulu #include <pm_common.h>
12*91f16700Schasinglulu 
13*91f16700Schasinglulu /******************************************************************************/
14*91f16700Schasinglulu /**
15*91f16700Schasinglulu  * SECURE_REDUNDANT_CALL() - Adds redundancy to the function call. This is to
16*91f16700Schasinglulu  *			     avoid glitches which can skip a function call
17*91f16700Schasinglulu  *			     and cause altering of the code flow in security
18*91f16700Schasinglulu  *			     critical functions.
19*91f16700Schasinglulu  * @status: Variable which holds the return value of function executed
20*91f16700Schasinglulu  * @status_tmp: Variable which holds the return value of redundant function
21*91f16700Schasinglulu  *		call executed
22*91f16700Schasinglulu  * @function: Function to be executed
23*91f16700Schasinglulu  *
24*91f16700Schasinglulu  * Return: None
25*91f16700Schasinglulu  *
26*91f16700Schasinglulu  ******************************************************************************/
27*91f16700Schasinglulu #define SECURE_REDUNDANT_CALL(status, status_tmp, function, ...)   \
28*91f16700Schasinglulu 	{ \
29*91f16700Schasinglulu 		status = function(__VA_ARGS__); \
30*91f16700Schasinglulu 		status_tmp = function(__VA_ARGS__); \
31*91f16700Schasinglulu 	}
32*91f16700Schasinglulu 
33*91f16700Schasinglulu int32_t pm_setup(void);
34*91f16700Schasinglulu uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
35*91f16700Schasinglulu 			uint64_t x4, const void *cookie, void *handle,
36*91f16700Schasinglulu 			uint64_t flags);
37*91f16700Schasinglulu 
38*91f16700Schasinglulu int32_t pm_register_sgi(uint32_t sgi_num, uint32_t reset);
39*91f16700Schasinglulu #endif /* PM_SVC_MAIN_H */
40