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