diff --git a/drivers/gud/MobiCoreDriver/platform.h b/drivers/gud/MobiCoreDriver/platform.h index 936db23ba831..e56f37b26294 100644 --- a/drivers/gud/MobiCoreDriver/platform.h +++ b/drivers/gud/MobiCoreDriver/platform.h @@ -27,11 +27,20 @@ #define USE_SHM_BRIDGE #endif +#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE +#include +#include +#if defined USE_SHM_BRIDGE +#include +#endif +#elif KERNEL_VERSION(4, 14, 0) <= LINUX_VERSION_CODE #include #include #if defined USE_SHM_BRIDGE #include #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