forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/tee/optee/optee_private.h
....@@ -1,15 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2015, Linaro Limited
3
- *
4
- * This software is licensed under the terms of the GNU General Public
5
- * License version 2, as published by the Free Software Foundation, and
6
- * may be copied, distributed, and modified under those terms.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- *
134 */
145
156 #ifndef OPTEE_PRIVATE_H
....@@ -26,8 +17,10 @@
2617 /* Some Global Platform error codes used in this driver */
2718 #define TEEC_SUCCESS 0x00000000
2819 #define TEEC_ERROR_BAD_PARAMETERS 0xFFFF0006
20
+#define TEEC_ERROR_NOT_SUPPORTED 0xFFFF000A
2921 #define TEEC_ERROR_COMMUNICATION 0xFFFF000E
3022 #define TEEC_ERROR_OUT_OF_MEMORY 0xFFFF000C
23
+#define TEEC_ERROR_SHORT_BUFFER 0xFFFF0010
3124
3225 #define TEEC_ORIGIN_COMMS 0x00000002
3326
....@@ -77,6 +70,7 @@
7770 * struct optee - main service struct
7871 * @supp_teedev: supplicant device
7972 * @teedev: client device
73
+ * @ctx: driver internal TEE context
8074 * @invoke_fn: function to issue smc or hvc
8175 * @call_queue: queue of threads waiting to call @invoke_fn
8276 * @wait_queue: queue of threads from secure world waiting for a
....@@ -86,17 +80,24 @@
8680 * @memremaped_shm virtual address of memory in shared memory pool
8781 * @sec_caps: secure world capabilities defined by
8882 * OPTEE_SMC_SEC_CAP_* in optee_smc.h
83
+ * @scan_bus_done flag if device registation was already done.
84
+ * @scan_bus_wq workqueue to scan optee bus and register optee drivers
85
+ * @scan_bus_work workq to scan optee bus and register optee drivers
8986 */
9087 struct optee {
9188 struct tee_device *supp_teedev;
9289 struct tee_device *teedev;
9390 optee_invoke_fn *invoke_fn;
91
+ struct tee_context *ctx;
9492 struct optee_call_queue call_queue;
9593 struct optee_wait_queue wait_queue;
9694 struct optee_supp supp;
9795 struct tee_shm_pool *pool;
9896 void *memremaped_shm;
9997 u32 sec_caps;
98
+ bool scan_bus_done;
99
+ struct workqueue_struct *scan_bus_wq;
100
+ struct work_struct scan_bus_work;
100101 };
101102
102103 struct optee_session {
....@@ -182,6 +183,11 @@
182183 void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages,
183184 size_t page_offset);
184185
186
+#define PTA_CMD_GET_DEVICES 0x0
187
+#define PTA_CMD_GET_DEVICES_SUPP 0x1
188
+int optee_enumerate_devices(u32 func);
189
+void optee_unregister_devices(void);
190
+
185191 /*
186192 * Small helpers
187193 */