3 * (C) COPYRIGHT 2015 ARM Limited. All rights reserved.
5 * This program is free software and is provided to you under the terms of the
6 * GNU General Public License version 2 as published by the Free Software
7 * Foundation, and any use by you of this program is subject to the terms
10 * A copy of the licence is included with the program, and can also be obtained
11 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12 * Boston, MA 02110-1301, USA.
20 #include <mali_kbase.h>
21 #include <mali_kbase_smc.h>
23 #include <linux/compiler.h>
25 static noinline u64 invoke_smc_fid(u64 function_id,
26 u64 arg0, u64 arg1, u64 arg2)
28 register u64 x0 asm("x0") = function_id;
29 register u64 x1 asm("x1") = arg0;
30 register u64 x2 asm("x2") = arg1;
31 register u64 x3 asm("x3") = arg2;
40 : "r" (x1), "r" (x2), "r" (x3));
45 u64 kbase_invoke_smc_fid(u32 fid, u64 arg0, u64 arg1, u64 arg2)
47 /* Is fast call (bit 31 set) */
48 KBASE_DEBUG_ASSERT(fid & ~SMC_FAST_CALL);
49 /* bits 16-23 must be zero for fast calls */
50 KBASE_DEBUG_ASSERT((fid & (0xFF << 16)) == 0);
52 return invoke_smc_fid(fid, arg0, arg1, arg2);
55 u64 kbase_invoke_smc(u32 oen, u16 function_number, bool smc64,
56 u64 arg0, u64 arg1, u64 arg2)
60 /* Only the six bits allowed should be used. */
61 KBASE_DEBUG_ASSERT((oen & ~SMC_OEN_MASK) == 0);
63 fid |= SMC_FAST_CALL; /* Bit 31: Fast call */
65 fid |= SMC_64; /* Bit 30: 1=SMC64, 0=SMC32 */
66 fid |= oen; /* Bit 29:24: OEN */
67 /* Bit 23:16: Must be zero for fast calls */
68 fid |= (function_number); /* Bit 15:0: function number */
70 return kbase_invoke_smc_fid(fid, arg0, arg1, arg2);
73 #endif /* CONFIG_ARM64 */