Tejas Patel | c73a90e | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 1 | /* |
Venkatesh Yadav Abbarapu | bf70449 | 2021-04-19 07:49:57 -0600 | [diff] [blame] | 2 | * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved. |
Devanshi Chauhan | c0719d2 | 2025-05-16 02:49:34 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2022-2025, Advanced Micro Devices, Inc. All rights reserved. |
Tejas Patel | c73a90e | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 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 | |
Jay Buddhabhatti | 4661c8f | 2024-06-24 02:10:29 -0700 | [diff] [blame] | 13 | #define PASS_THROUGH_FW_CMD_ID U(0xfff) |
| 14 | |
Jay Buddhabhatti | cebb7cc | 2023-07-31 00:11:00 -0700 | [diff] [blame] | 15 | /******************************************************************************/ |
| 16 | /** |
| 17 | * SECURE_REDUNDANT_CALL() - Adds redundancy to the function call. This is to |
| 18 | * avoid glitches which can skip a function call |
| 19 | * and cause altering of the code flow in security |
| 20 | * critical functions. |
| 21 | * @status: Variable which holds the return value of function executed |
| 22 | * @status_tmp: Variable which holds the return value of redundant function |
| 23 | * call executed |
| 24 | * @function: Function to be executed |
| 25 | * |
| 26 | * Return: None |
| 27 | * |
| 28 | ******************************************************************************/ |
| 29 | #define SECURE_REDUNDANT_CALL(status, status_tmp, function, ...) \ |
| 30 | { \ |
| 31 | status = function(__VA_ARGS__); \ |
| 32 | status_tmp = function(__VA_ARGS__); \ |
| 33 | } |
| 34 | |
Devanshi Chauhan | c0719d2 | 2025-05-16 02:49:34 -0700 | [diff] [blame^] | 35 | bool pm_pwrdwn_req_status(void); |
Jay Buddhabhatti | 88ee081 | 2023-06-19 05:08:54 -0700 | [diff] [blame] | 36 | void request_cpu_pwrdwn(void); |
Venkatesh Yadav Abbarapu | 912b7a6 | 2022-05-24 11:11:12 +0530 | [diff] [blame] | 37 | int32_t pm_setup(void); |
Tejas Patel | ab43d15 | 2019-01-09 04:10:29 -0800 | [diff] [blame] | 38 | uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3, |
Venkatesh Yadav Abbarapu | 3d2ebe7 | 2022-05-24 14:02:52 +0530 | [diff] [blame] | 39 | uint64_t x4, const void *cookie, void *handle, |
Tejas Patel | ab43d15 | 2019-01-09 04:10:29 -0800 | [diff] [blame] | 40 | uint64_t flags); |
Tejas Patel | c73a90e | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 41 | |
Venkatesh Yadav Abbarapu | 912b7a6 | 2022-05-24 11:11:12 +0530 | [diff] [blame] | 42 | int32_t pm_register_sgi(uint32_t sgi_num, uint32_t reset); |
Tejas Patel | c73a90e | 2018-12-14 00:55:37 -0800 | [diff] [blame] | 43 | #endif /* PM_SVC_MAIN_H */ |