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