forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/tee/optee/optee_msg.h
....@@ -1,28 +1,6 @@
1
+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
12 /*
2
- * Copyright (c) 2015-2016, Linaro Limited
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- * this list of conditions and the following disclaimer.
10
- *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- * this list of conditions and the following disclaimer in the documentation
13
- * and/or other materials provided with the distribution.
14
- *
15
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
- * POSSIBILITY OF SUCH DAMAGE.
3
+ * Copyright (c) 2015-2019, Linaro Limited
264 */
275 #ifndef _OPTEE_MSG_H
286 #define _OPTEE_MSG_H
....@@ -31,7 +9,7 @@
319 #include <linux/types.h>
3210
3311 /*
34
- * This file defines the OP-TEE message protocol used to communicate
12
+ * This file defines the OP-TEE message protocol (ABI) used to communicate
3513 * with an instance of OP-TEE running in secure world.
3614 *
3715 * This file is divided into three sections.
....@@ -168,9 +146,10 @@
168146 * @tmem: parameter by temporary memory reference
169147 * @rmem: parameter by registered memory reference
170148 * @value: parameter by opaque value
149
+ * @octets: parameter by octet string
171150 *
172151 * @attr & OPTEE_MSG_ATTR_TYPE_MASK indicates if tmem, rmem or value is used in
173
- * the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value,
152
+ * the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value or octets,
174153 * OPTEE_MSG_ATTR_TYPE_TMEM_* indicates @tmem and
175154 * OPTEE_MSG_ATTR_TYPE_RMEM_* indicates @rmem,
176155 * OPTEE_MSG_ATTR_TYPE_NONE indicates that none of the members are used.
....@@ -181,6 +160,7 @@
181160 struct optee_msg_param_tmem tmem;
182161 struct optee_msg_param_rmem rmem;
183162 struct optee_msg_param_value value;
163
+ u8 octets[24];
184164 } u;
185165 };
186166
....@@ -441,4 +421,25 @@
441421 */
442422 #define OPTEE_MSG_RPC_CMD_SHM_FREE 7
443423
424
+/*
425
+ * Access a device on an i2c bus
426
+ *
427
+ * [in] param[0].u.value.a mode: RD(0), WR(1)
428
+ * [in] param[0].u.value.b i2c adapter
429
+ * [in] param[0].u.value.c i2c chip
430
+ *
431
+ * [in] param[1].u.value.a i2c control flags
432
+ *
433
+ * [in/out] memref[2] buffer to exchange the transfer data
434
+ * with the secure world
435
+ *
436
+ * [out] param[3].u.value.a bytes transferred by the driver
437
+ */
438
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21
439
+/* I2C master transfer modes */
440
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD 0
441
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR 1
442
+/* I2C master control flags */
443
+#define OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT BIT(0)
444
+
444445 #endif /* _OPTEE_MSG_H */