Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / firmware / arm_ffa / smccc.c
blob4d85bfff0a4e6749990ad4db90c0225326c63857
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2021 ARM Ltd.
4 */
6 #include <linux/printk.h>
8 #include "common.h"
10 static void __arm_ffa_fn_smc(ffa_value_t args, ffa_value_t *res)
12 arm_smccc_1_2_smc(&args, res);
15 static void __arm_ffa_fn_hvc(ffa_value_t args, ffa_value_t *res)
17 arm_smccc_1_2_hvc(&args, res);
20 int __init ffa_transport_init(ffa_fn **invoke_ffa_fn)
22 enum arm_smccc_conduit conduit;
24 if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
25 return -EOPNOTSUPP;
27 conduit = arm_smccc_1_1_get_conduit();
28 if (conduit == SMCCC_CONDUIT_NONE) {
29 pr_err("%s: invalid SMCCC conduit\n", __func__);
30 return -EOPNOTSUPP;
33 if (conduit == SMCCC_CONDUIT_SMC)
34 *invoke_ffa_fn = __arm_ffa_fn_smc;
35 else
36 *invoke_ffa_fn = __arm_ffa_fn_hvc;
38 return 0;