driver/tee: add some comments and document files in LICENSE

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2023-11-21 15:19:04 +08:00 committed by Xiang Xiao
parent 0c2cfc767d
commit 5a04354832
3 changed files with 59 additions and 10 deletions

33
LICENSE
View File

@ -8464,3 +8464,36 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------
drivers/misc/optee_msg.h
======================
PDX-License-Identifier: BSD-2-Clause
Copyright (c) 2015-2020, Linaro Limited
include/nuttx/tee.h
======================
Copyright (c) 2015-2016, Linaro Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following
conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -33,24 +33,32 @@ config DEV_RPMSG_SERVER
depends on RPTUN
choice
prompt "Select optee dev implementation"
prompt "Select OP-TEE dev implementation"
default DEV_OPTEE_NONE
---help---
There are two implementations of optee server,
one is soft tee server which does not distinguish
between secure and non-secure states and uses socket communication,
and the other is teeos which runs in the secure state of
the cpu and uses rpmsg cross-core communication.
config DEV_OPTEE_LOCAL
bool "OPTEE Local Socket Support"
depends on NET_LOCAL
depends on ALLOW_BSD_COMPONENTS
config DEV_OPTEE_RPMSG
bool "OPTEE RPMSG Socket Support"
bool "OP-TEE RPMSG Socket Support"
depends on NET_RPMSG
depends on ALLOW_BSD_COMPONENTS
config DEV_OPTEE_NONE
bool "Disable optee driver"
bool "Disable OP-TEE driver"
endchoice
config OPTEE_REMOTE_CPU_NAME
string "The cpuname on which the optee server runs"
string "The cpuname on which the OP-TEE server runs"
default "tee"
depends on DEV_OPTEE_RPMSG

View File

@ -35,6 +35,14 @@
#include "optee_msg.h"
/****************************************************************************
* The driver's main purpose is to support the porting of the open source
* component optee_client (https://github.com/OP-TEE/optee_client) to NuttX.
* The basic function of the driver module is to convert
* the REE application layer data and send it to the TEE through rpmsg.
* TEE implementation is optee_os(https://github.com/OP-TEE/optee_os).
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -51,7 +59,7 @@
#define TEE_ORIGIN_COMMS 0x00000002
#define TEE_IOCTL_PARAM_SIZE(x) (sizeof(struct tee_ioctl_param) * (x))
#define TEE_IOCTL_PARAM_SIZE(x) (sizeof(struct tee_ioctl_param) * (x))
#define OPTEE_MAX_IOVEC_NUM 7
#define OPTEE_MAX_PARAM_NUM 6
@ -72,7 +80,7 @@
static int optee_open(FAR struct file *filep);
static int optee_close(FAR struct file *filep);
static int optee_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
unsigned long arg);
/****************************************************************************
* Private Data
@ -448,7 +456,7 @@ static int optee_ioctl_open_session(FAR struct socket *psocket,
}
ret = optee_from_msg_param(arg->params, arg->num_params,
msg->params + 2);
msg->params + 2);
if (ret < 0)
{
return ret;
@ -565,20 +573,20 @@ optee_ioctl_shm_alloc(FAR struct tee_ioctl_shm_alloc_data *data)
if (memfd < 0)
{
return -errno;
return get_errno();
}
if (ftruncate(memfd, data->size) < 0)
{
close(memfd);
return -errno;
return get_errno();
}
data->id = (uintptr_t)mmap(NULL, data->size, PROT_READ | PROT_WRITE,
MAP_SHARED, memfd, 0);
if (data->id == (uintptr_t)MAP_FAILED)
{
return -errno;
return get_errno();
}
return memfd;