aboutsummaryrefslogtreecommitdiff
path: root/include/tee/optee_service.h
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@linaro.org>2022-07-26 16:21:42 +0200
committerTom Rini <trini@konsulko.com>2022-09-14 15:23:03 -0400
commit94ccfb78a4d61cac7cbc78f23751ec1db949d29e (patch)
treebc8c43a223a86af6c4e89952a9133adb4e7c1fbc /include/tee/optee_service.h
parentfd0d7a6c88fe0ae16dda95eba52c598b9fa9db2a (diff)
drivers: tee: optee: discover OP-TEE services
This change defines resources for OP-TEE service drivers to register themselves for being bound to when OP-TEE firmware reports the related service is supported. OP-TEE services are discovered during optee driver probe sequence which mandates optee driver is always probe once bound. Discovery of optee services and binding to related U-Boot drivers is embedded upon configuration switch CONFIG_OPTEE_SERVICE_DISCOVERY. Cc: Jens Wiklander <jens.wiklander@linaro.org> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'include/tee/optee_service.h')
-rw-r--r--include/tee/optee_service.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/tee/optee_service.h b/include/tee/optee_service.h
new file mode 100644
index 0000000000..fca468af7c
--- /dev/null
+++ b/include/tee/optee_service.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * (C) Copyright 2022 Linaro Limited
+ */
+
+#ifndef _OPTEE_SERVICE_H
+#define _OPTEE_SERVICE_H
+
+/*
+ * struct optee_service - Discoverable OP-TEE service
+ *
+ * @driver_name - Name of the related driver
+ * @uuid - UUID of the OP-TEE service related to the driver
+ *
+ * Use macro OPTEE_SERVICE_DRIVER() to register a driver related to an
+ * OP-TEE service discovered when driver asks OP-TEE services enumaration.
+ */
+struct optee_service {
+ const char *driver_name;
+ const struct tee_optee_ta_uuid uuid;
+};
+
+#ifdef CONFIG_OPTEE_SERVICE_DISCOVERY
+#define OPTEE_SERVICE_DRIVER(__name, __uuid, __drv_name) \
+ ll_entry_declare(struct optee_service, __name, optee_service) = { \
+ .uuid = __uuid, \
+ .driver_name = __drv_name, \
+ }
+#else
+#define OPTEE_SERVICE_DRIVER(__name, __uuid, __drv_name) \
+ static int __name##__COUNTER__ __always_unused
+#endif
+
+#endif /* _OPTEE_SERVICE_H */