xref: /rk3399_ARM-atf/plat/xilinx/common/include/pm_svc_main.h (revision c0719d210ca971f09ef5a77a4bb9a5b918313cf3)
1a92681d9SJay Buddhabhatti /*
2a92681d9SJay Buddhabhatti  * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
3*c0719d21SDevanshi Chauhan  * Copyright (c) 2022-2025, 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 
134661c8f5SJay Buddhabhatti #define PASS_THROUGH_FW_CMD_ID	U(0xfff)
144661c8f5SJay Buddhabhatti 
15cebb7cc1SJay Buddhabhatti /******************************************************************************/
16cebb7cc1SJay Buddhabhatti /**
17cebb7cc1SJay Buddhabhatti  * SECURE_REDUNDANT_CALL() - Adds redundancy to the function call. This is to
18cebb7cc1SJay Buddhabhatti  *			     avoid glitches which can skip a function call
19cebb7cc1SJay Buddhabhatti  *			     and cause altering of the code flow in security
20cebb7cc1SJay Buddhabhatti  *			     critical functions.
21cebb7cc1SJay Buddhabhatti  * @status: Variable which holds the return value of function executed
22cebb7cc1SJay Buddhabhatti  * @status_tmp: Variable which holds the return value of redundant function
23cebb7cc1SJay Buddhabhatti  *		call executed
24cebb7cc1SJay Buddhabhatti  * @function: Function to be executed
25cebb7cc1SJay Buddhabhatti  *
26cebb7cc1SJay Buddhabhatti  * Return: None
27cebb7cc1SJay Buddhabhatti  *
28cebb7cc1SJay Buddhabhatti  ******************************************************************************/
29cebb7cc1SJay Buddhabhatti #define SECURE_REDUNDANT_CALL(status, status_tmp, function, ...)   \
30cebb7cc1SJay Buddhabhatti 	{ \
31cebb7cc1SJay Buddhabhatti 		status = function(__VA_ARGS__); \
32cebb7cc1SJay Buddhabhatti 		status_tmp = function(__VA_ARGS__); \
33cebb7cc1SJay Buddhabhatti 	}
34cebb7cc1SJay Buddhabhatti 
35*c0719d21SDevanshi Chauhan bool pm_pwrdwn_req_status(void);
3688ee0816SJay Buddhabhatti void request_cpu_pwrdwn(void);
37a92681d9SJay Buddhabhatti int32_t pm_setup(void);
38a92681d9SJay Buddhabhatti uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
39a92681d9SJay Buddhabhatti 			uint64_t x4, const void *cookie, void *handle,
40a92681d9SJay Buddhabhatti 			uint64_t flags);
41a92681d9SJay Buddhabhatti 
42a92681d9SJay Buddhabhatti int32_t pm_register_sgi(uint32_t sgi_num, uint32_t reset);
43a92681d9SJay Buddhabhatti #endif /* PM_SVC_MAIN_H */
44