From: Sumit Garg <[email protected]>

OP-TEE message UID check API can be useful to know whether OP-TEE
is enabled on not assuming the corresponding SMC call is properly
handled if OP-TEE is not supported.

This API can be used by platform code to know OP-TEE presence and
on that basis OP-TEE DT node can be added as part of DT fixups for
the OP-TEE driver probe to happen for both U-Boot and Linux.

Signed-off-by: Sumit Garg <[email protected]>
---
 drivers/tee/optee/core.c | 5 +++++
 include/tee/optee.h      | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 5fc0505c788..4d67c948ec1 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -795,6 +795,11 @@ static optee_invoke_fn *get_invoke_func(struct udevice 
*dev)
        return ERR_PTR(-EINVAL);
 }
 
+bool is_optee_smc_api(void)
+{
+       return is_optee_api(optee_smccc_smc);
+}
+
 static int optee_of_to_plat(struct udevice *dev)
 {
        struct optee_pdata *pdata = dev_get_plat(dev);
diff --git a/include/tee/optee.h b/include/tee/optee.h
index 77729450bb6..d1194493780 100644
--- a/include/tee/optee.h
+++ b/include/tee/optee.h
@@ -65,4 +65,13 @@ static inline int optee_copy_fdt_nodes(void *new_blob)
 }
 #endif
 
+#if defined(CONFIG_OPTEE)
+bool is_optee_smc_api(void);
+#else
+static inline bool is_optee_smc_api(void)
+{
+       return false;
+}
+#endif
+
 #endif /* _OPTEE_H */
-- 
2.51.0

Reply via email to