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*88ee0816SJay Buddhabhatti extern bool pwrdwn_req_received; 14*88ee0816SJay 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*88ee0816SJay Buddhabhatti void request_cpu_pwrdwn(void); 36a92681d9SJay Buddhabhatti int32_t pm_setup(void); 37a92681d9SJay Buddhabhatti uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3, 38a92681d9SJay Buddhabhatti uint64_t x4, const void *cookie, void *handle, 39a92681d9SJay Buddhabhatti uint64_t flags); 40a92681d9SJay Buddhabhatti 41a92681d9SJay Buddhabhatti int32_t pm_register_sgi(uint32_t sgi_num, uint32_t reset); 42a92681d9SJay Buddhabhatti #endif /* PM_SVC_MAIN_H */ 43