1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2015, Linaro Limited
4 * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
7 * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
9 #include <linux/linkage.h>
10 #include <linux/arm-smccc.h>
11 #include <generated/asm-offsets.h>
13 #ifdef CONFIG_EFI_LOADER
14 .section .text.efi_runtime
21 stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
22 stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
24 cbz x4, 1f /* no quirk structure */
25 ldr x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS]
26 cmp x9, #ARM_SMCCC_QUIRK_QCOM_A6
28 str x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS]
34 * void arm_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2,
35 * unsigned long a3, unsigned long a4, unsigned long a5,
36 * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
37 * struct arm_smccc_quirk *quirk)
39 ENTRY(__arm_smccc_smc)
41 ENDPROC(__arm_smccc_smc)
44 * void arm_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2,
45 * unsigned long a3, unsigned long a4, unsigned long a5,
46 * unsigned long a6, unsigned long a7, struct arm_smccc_res *res,
47 * struct arm_smccc_quirk *quirk)
49 ENTRY(__arm_smccc_hvc)
51 ENDPROC(__arm_smccc_hvc)
55 .macro SMCCC_1_2 instr
56 /* Save `res` and free a GPR that won't be clobbered */
57 stp x1, x19, [sp, #-16]!
59 /* Ensure `args` won't be clobbered while loading regs in next step */
62 /* Load the registers x0 - x17 from the struct arm_smccc_1_2_regs */
63 ldp x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS]
64 ldp x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS]
65 ldp x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS]
66 ldp x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS]
67 ldp x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS]
68 ldp x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS]
69 ldp x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS]
70 ldp x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]
71 ldp x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]
75 /* Load the `res` from the stack */
78 /* Store the registers x0 - x17 into the result structure */
79 stp x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS]
80 stp x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS]
81 stp x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS]
82 stp x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS]
83 stp x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS]
84 stp x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS]
85 stp x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS]
86 stp x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]
87 stp x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]
89 /* Restore original x19 */
90 ldp xzr, x19, [sp], #16
95 * void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args,
96 * struct arm_smccc_1_2_regs *res);
98 ENTRY(arm_smccc_1_2_smc)
100 ENDPROC(arm_smccc_1_2_smc)