mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
OP-TEE: add configure uart port function
When kernel change print log uart port, optee should keep the same with it. Kernel driver will tell optee the uart port id when tee-supplicant starts up. If fiq-debugger node is disabled, then id is set as 0xffffffff, optee uart print is disabled. Change-Id: Id0bc5428d244896fa95eb6a9c2f36bd3ff1248b7 Signed-off-by: Zhang Zhijie <zhangzj@rock-chips.com>
This commit is contained in:
parent
dc6a552956
commit
603bf24744
|
|
@ -33,6 +33,7 @@
|
|||
#include <arm_common/teesmc_st.h>
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
#include "tee_mem.h"
|
||||
#include "tee_tz_op.h"
|
||||
|
|
@ -1182,6 +1183,38 @@ static int configure_shm(struct tee_tz *ptee)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int rk_set_uart_port(struct tee_tz *ptee)
|
||||
{
|
||||
struct smc_param param = {0};
|
||||
struct device_node *np;
|
||||
int serial_id;
|
||||
int ret = 0;
|
||||
|
||||
np = of_find_node_by_name(NULL, "fiq-debugger");
|
||||
if (!np)
|
||||
return -ENODEV;
|
||||
|
||||
if (of_device_is_available(np)) {
|
||||
if (of_property_read_u32(np, "rockchip,serial-id", &serial_id))
|
||||
return -EINVAL;
|
||||
} else {
|
||||
serial_id = 0xffffffff;
|
||||
}
|
||||
|
||||
dev_dbg(DEV, "optee set uart port id: %d\n", serial_id);
|
||||
param.a0 = TEESMC32_ROCKCHIP_FASTCALL_SET_UART_PORT;
|
||||
param.a1 = serial_id;
|
||||
|
||||
mutex_lock(&ptee->mutex);
|
||||
#ifdef SWITCH_CPU0_DEBUG
|
||||
ret = tee_smc_call_switchcpu0(¶m);
|
||||
#else
|
||||
tee_smc_call(¶m);
|
||||
#endif
|
||||
mutex_unlock(&ptee->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
@ -1201,6 +1234,8 @@ static int tz_start(struct tee *tee)
|
|||
BUG_ON(ptee->started);
|
||||
ptee->started = true;
|
||||
|
||||
rk_set_uart_port(ptee);
|
||||
|
||||
ret = configure_shm(ptee);
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
|
|
|||
|
|
@ -346,6 +346,9 @@ struct teesmc_meta_open_session {
|
|||
#define TEESMC_OWNER_TRUSTED_APP 48
|
||||
#define TEESMC_OWNER_TRUSTED_OS 50
|
||||
|
||||
/* Rockchip define trusted os call */
|
||||
#define TEESMC_OWNER_TRUSTED_OS_ROCKCHIP 55
|
||||
|
||||
#define TEESMC_OWNER_TRUSTED_OS_API 63
|
||||
|
||||
/*
|
||||
|
|
@ -699,4 +702,9 @@ struct teesmc_meta_open_session {
|
|||
*/
|
||||
#define TEESMC_RPC_REQUEST_IRQ 0x0
|
||||
|
||||
#define TEESMC_ROCKCHIP_FUNCID_SET_UART_PORT 0x0000
|
||||
#define TEESMC32_ROCKCHIP_FASTCALL_SET_UART_PORT \
|
||||
TEESMC_CALL_VAL(TEESMC_32, TEESMC_FAST_CALL, TEESMC_OWNER_TRUSTED_OS_ROCKCHIP, \
|
||||
TEESMC_ROCKCHIP_FUNCID_SET_UART_PORT)
|
||||
|
||||
#endif /* TEESMC_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user