1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2015, 2020-2021 ARM Limited. All rights reserved. 5 * 6 * This program is free software and is provided to you under the terms of the 7 * GNU General Public License version 2 as published by the Free Software 8 * Foundation, and any use by you of this program is subject to the terms 9 * of such GNU license. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can access it online at 18 * http://www.gnu.org/licenses/gpl-2.0.html. 19 * 20 */ 21 22 #ifndef _KBASE_SMC_H_ 23 #define _KBASE_SMC_H_ 24 25 #if IS_ENABLED(CONFIG_ARM64) 26 27 #include <mali_kbase.h> 28 29 #define SMC_FAST_CALL (1 << 31) 30 #define SMC_64 (1 << 30) 31 32 #define SMC_OEN_OFFSET 24 33 #define SMC_OEN_MASK (0x3F << SMC_OEN_OFFSET) /* 6 bits */ 34 #define SMC_OEN_SIP (2 << SMC_OEN_OFFSET) 35 #define SMC_OEN_STD (4 << SMC_OEN_OFFSET) 36 37 38 /** 39 * kbase_invoke_smc_fid - Perform a secure monitor call 40 * @fid: The SMC function to call, see SMC Calling convention. 41 * @arg0: First argument to the SMC. 42 * @arg1: Second argument to the SMC. 43 * @arg2: Third argument to the SMC. 44 * 45 * See SMC Calling Convention for details. 46 * 47 * Return: the return value from the SMC. 48 */ 49 u64 kbase_invoke_smc_fid(u32 fid, u64 arg0, u64 arg1, u64 arg2); 50 51 /** 52 * kbase_invoke_smc_fid - Perform a secure monitor call 53 * @oen: Owning Entity number (SIP, STD etc). 54 * @function_number: The function number within the OEN. 55 * @smc64: use SMC64 calling convention instead of SMC32. 56 * @arg0: First argument to the SMC. 57 * @arg1: Second argument to the SMC. 58 * @arg2: Third argument to the SMC. 59 * 60 * See SMC Calling Convention for details. 61 * 62 * Return: the return value from the SMC call. 63 */ 64 u64 kbase_invoke_smc(u32 oen, u16 function_number, bool smc64, 65 u64 arg0, u64 arg1, u64 arg2); 66 67 #endif /* CONFIG_ARM64 */ 68 69 #endif /* _KBASE_SMC_H_ */ 70