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