0001
0002
0003
0004
0005
0006 #include <linux/printk.h>
0007
0008 #include "common.h"
0009
0010 static void __arm_ffa_fn_smc(ffa_value_t args, ffa_value_t *res)
0011 {
0012 arm_smccc_1_2_smc(&args, res);
0013 }
0014
0015 static void __arm_ffa_fn_hvc(ffa_value_t args, ffa_value_t *res)
0016 {
0017 arm_smccc_1_2_hvc(&args, res);
0018 }
0019
0020 int __init ffa_transport_init(ffa_fn **invoke_ffa_fn)
0021 {
0022 enum arm_smccc_conduit conduit;
0023
0024 if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
0025 return -EOPNOTSUPP;
0026
0027 conduit = arm_smccc_1_1_get_conduit();
0028 if (conduit == SMCCC_CONDUIT_NONE) {
0029 pr_err("%s: invalid SMCCC conduit\n", __func__);
0030 return -EOPNOTSUPP;
0031 }
0032
0033 if (conduit == SMCCC_CONDUIT_SMC)
0034 *invoke_ffa_fn = __arm_ffa_fn_smc;
0035 else
0036 *invoke_ffa_fn = __arm_ffa_fn_hvc;
0037
0038 return 0;
0039 }