Lines Matching +full:smc +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/arm-smccc.h>
14 #include <linux/dma-mapping.h>
23 * @args: The array of values used in registers in smc instruction
31 * struct scm_legacy_command - one SCM command buffer
35 * @id: command to be executed
40 * ------------------- <--- struct scm_legacy_command
42 * ------------------- <--- scm_legacy_get_command_buffer()
44 * ------------------- <--- struct scm_legacy_response and
46 * ------------------- <--- scm_legacy_get_response_buffer()
48 * -------------------
58 __le32 id; member
63 * struct scm_legacy_response - one SCM response buffer
75 * scm_legacy_command_to_response() - Get a pointer to a scm_legacy_response
83 return (void *)cmd + le32_to_cpu(cmd->resp_hdr_offset); in scm_legacy_command_to_response()
87 * scm_legacy_get_command_buffer() - Get a pointer to a command buffer
95 return (void *)cmd->buf; in scm_legacy_get_command_buffer()
99 * scm_legacy_get_response_buffer() - Get a pointer to a response buffer
107 return (void *)rsp + le32_to_cpu(rsp->buf_offset); in scm_legacy_get_response_buffer()
110 static void __scm_legacy_do(const struct arm_smccc_args *smc, in __scm_legacy_do() argument
114 arm_smccc_smc(smc->args[0], smc->args[1], smc->args[2], in __scm_legacy_do()
115 smc->args[3], smc->args[4], smc->args[5], in __scm_legacy_do()
116 smc->args[6], smc->args[7], res); in __scm_legacy_do()
117 } while (res->a0 == QCOM_SCM_INTERRUPTED); in __scm_legacy_do()
121 * scm_legacy_call() - Sends a command to the SCM and waits for the command to
125 * @res: results from SMC call
137 u8 arglen = desc->arginfo & 0xf; in scm_legacy_call()
142 struct arm_smccc_args smc = {0}; in scm_legacy_call() local
153 return -ENOMEM; in scm_legacy_call()
155 cmd->len = cpu_to_le32(alloc_len); in scm_legacy_call()
156 cmd->buf_offset = cpu_to_le32(sizeof(*cmd)); in scm_legacy_call()
157 cmd->resp_hdr_offset = cpu_to_le32(sizeof(*cmd) + cmd_len); in scm_legacy_call()
158 cmd->id = cpu_to_le32(SCM_LEGACY_FNID(desc->svc, desc->cmd)); in scm_legacy_call()
162 arg_buf[i] = cpu_to_le32(desc->args[i]); in scm_legacy_call()
169 return -ENOMEM; in scm_legacy_call()
172 smc.args[0] = 1; in scm_legacy_call()
173 smc.args[1] = (unsigned long)&context_id; in scm_legacy_call()
174 smc.args[2] = cmd_phys; in scm_legacy_call()
177 __scm_legacy_do(&smc, &smc_res); in scm_legacy_call()
187 } while (!rsp->is_complete); in scm_legacy_call()
190 le32_to_cpu(rsp->buf_offset), in scm_legacy_call()
196 res->result[i] = le32_to_cpu(res_buf[i]); in scm_legacy_call()
215 * scm_legacy_call_atomic() - Send an atomic SCM command with up to 5 arguments
230 size_t arglen = desc->arginfo & 0xf; in scm_legacy_call_atomic()
234 arm_smccc_smc(SCM_LEGACY_ATOMIC_ID(desc->svc, desc->cmd, arglen), in scm_legacy_call_atomic()
236 desc->args[0], desc->args[1], desc->args[2], in scm_legacy_call_atomic()
237 desc->args[3], desc->args[4], 0, &smc_res); in scm_legacy_call_atomic()
240 res->result[0] = smc_res.a1; in scm_legacy_call_atomic()
241 res->result[1] = smc_res.a2; in scm_legacy_call_atomic()
242 res->result[2] = smc_res.a3; in scm_legacy_call_atomic()