Make Trustonic TEE driver module compatible with kernel 5.4.

The paths and interfaces for qcom scm call on kernel 4.x and kernel 5.x are
different, considering that different platform use different kernels, so
workaround here for compatibility.

Change-Id: I1a52e58be740799587a8ec924a5fd76d8f69a018
Signed-off-by: linyx10 <linyx10@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1885962
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jefferson Rodrigo Capovilla <jeffecap@motorola.com>
Reviewed-by: Binsheng Que <quebs2@motorola.com>
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
linyx10 2021-02-24 22:51:32 +08:00 committed by linyx10
parent c866fdef4f
commit 0014e0a8e3

View file

@ -27,11 +27,20 @@
#define USE_SHM_BRIDGE
#endif
#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE
#include <linux/qcom_scm.h>
#include <soc/qcom/qseecomi.h>
#if defined USE_SHM_BRIDGE
#include <linux/qtee_shmbridge.h>
#endif
#elif KERNEL_VERSION(4, 14, 0) <= LINUX_VERSION_CODE
#include <soc/qcom/scm.h>
#include <soc/qcom/qseecomi.h>
#if defined USE_SHM_BRIDGE
#include <soc/qcom/qtee_shmbridge.h>
#endif
#endif
/*--------------- Implementation -------------- */
/* MobiCore Interrupt for Qualcomm (DT IRQ has priority if present) */
#define MC_INTR_SSIQ 280
@ -39,6 +48,7 @@
/* Use SMC for fastcalls */
#define MC_SMC_FASTCALL
#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 4, 0)
#define SCM_MOBIOS_FNID(s, c) (((((s) & 0xFF) << 8) | ((c) & 0xFF)) \
| 0x33000000)
@ -48,11 +58,20 @@
TZ_SYSCALL_PARAM_TYPE_VAL, \
TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
TZ_SYSCALL_PARAM_TYPE_VAL)
#endif
/* from following file */
#define SCM_SVC_MOBICORE 250
#define SCM_CMD_MOBICORE 1
#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE
extern int trustonic_smc_fastcall(void *fc_generic, size_t size);
static inline int smc_fastcall(void *fc_generic, size_t size)
{
return trustonic_smc_fastcall(fc_generic, size);
}
#elif KERNEL_VERSION(4, 14, 0) <= LINUX_VERSION_CODE
static inline int smc_fastcall(void *fc_generic, size_t size)
{
#if !defined(USE_SHM_BRIDGE)
@ -102,6 +121,7 @@ static inline int smc_fastcall(void *fc_generic, size_t size)
fc_generic, size);
#endif
}
#endif
/*
* Do not start the TEE at driver init