mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
driver/tee: add some comments and document files in LICENSE
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -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
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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.
|
||||||
|
|||||||
+12
-4
@@ -33,24 +33,32 @@ config DEV_RPMSG_SERVER
|
|||||||
depends on RPTUN
|
depends on RPTUN
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Select optee dev implementation"
|
prompt "Select OP-TEE dev implementation"
|
||||||
default DEV_OPTEE_NONE
|
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
|
config DEV_OPTEE_LOCAL
|
||||||
bool "OPTEE Local Socket Support"
|
bool "OPTEE Local Socket Support"
|
||||||
depends on NET_LOCAL
|
depends on NET_LOCAL
|
||||||
|
depends on ALLOW_BSD_COMPONENTS
|
||||||
|
|
||||||
config DEV_OPTEE_RPMSG
|
config DEV_OPTEE_RPMSG
|
||||||
bool "OPTEE RPMSG Socket Support"
|
bool "OP-TEE RPMSG Socket Support"
|
||||||
depends on NET_RPMSG
|
depends on NET_RPMSG
|
||||||
|
depends on ALLOW_BSD_COMPONENTS
|
||||||
|
|
||||||
config DEV_OPTEE_NONE
|
config DEV_OPTEE_NONE
|
||||||
bool "Disable optee driver"
|
bool "Disable OP-TEE driver"
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config OPTEE_REMOTE_CPU_NAME
|
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"
|
default "tee"
|
||||||
depends on DEV_OPTEE_RPMSG
|
depends on DEV_OPTEE_RPMSG
|
||||||
|
|
||||||
|
|||||||
+14
-6
@@ -35,6 +35,14 @@
|
|||||||
|
|
||||||
#include "optee_msg.h"
|
#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
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -51,7 +59,7 @@
|
|||||||
|
|
||||||
#define TEE_ORIGIN_COMMS 0x00000002
|
#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_IOVEC_NUM 7
|
||||||
#define OPTEE_MAX_PARAM_NUM 6
|
#define OPTEE_MAX_PARAM_NUM 6
|
||||||
@@ -72,7 +80,7 @@
|
|||||||
static int optee_open(FAR struct file *filep);
|
static int optee_open(FAR struct file *filep);
|
||||||
static int optee_close(FAR struct file *filep);
|
static int optee_close(FAR struct file *filep);
|
||||||
static int optee_ioctl(FAR struct file *filep, int cmd,
|
static int optee_ioctl(FAR struct file *filep, int cmd,
|
||||||
unsigned long arg);
|
unsigned long arg);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* 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,
|
ret = optee_from_msg_param(arg->params, arg->num_params,
|
||||||
msg->params + 2);
|
msg->params + 2);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
@@ -565,20 +573,20 @@ optee_ioctl_shm_alloc(FAR struct tee_ioctl_shm_alloc_data *data)
|
|||||||
|
|
||||||
if (memfd < 0)
|
if (memfd < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return get_errno();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ftruncate(memfd, data->size) < 0)
|
if (ftruncate(memfd, data->size) < 0)
|
||||||
{
|
{
|
||||||
close(memfd);
|
close(memfd);
|
||||||
return -errno;
|
return get_errno();
|
||||||
}
|
}
|
||||||
|
|
||||||
data->id = (uintptr_t)mmap(NULL, data->size, PROT_READ | PROT_WRITE,
|
data->id = (uintptr_t)mmap(NULL, data->size, PROT_READ | PROT_WRITE,
|
||||||
MAP_SHARED, memfd, 0);
|
MAP_SHARED, memfd, 0);
|
||||||
if (data->id == (uintptr_t)MAP_FAILED)
|
if (data->id == (uintptr_t)MAP_FAILED)
|
||||||
{
|
{
|
||||||
return -errno;
|
return get_errno();
|
||||||
}
|
}
|
||||||
|
|
||||||
return memfd;
|
return memfd;
|
||||||
|
|||||||
Reference in New Issue
Block a user