no message

Match-id-a819a7c55427378c2cc7cfd8efc8efe9dd0ae361
This commit is contained in:
xxx
2023-03-24 19:14:14 +08:00
committed by xxx
parent 931d3b07fb
commit f94fdc8e4f
3 changed files with 2 additions and 133 deletions
@@ -14,7 +14,6 @@
#include "global_task.h"
#include "gtask_inner.h"
#include "agent_manager.h"
#include "notify_manager.h"
#include "session_manager.h"
#include "service_manager.h"
#include "ext_interface.h"
@@ -52,8 +51,8 @@ static TEE_Result process_cmd_with_audit_event(const smc_cmd_t *cmd)
switch (cmd_id) {
case GLOBAL_CMD_ID_REGISTER_NOTIFY_MEMORY:
ret = register_notify_memery(cmd);
break;
/* not support spi, but tzdriver needs to return success */
return TEE_SUCCESS;
case GLOBAL_CMD_ID_REGISTER_LOG_MEM:
ret = map_rdr_mem(cmd);
break;
@@ -1,108 +0,0 @@
/*
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
* Licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v2 for more details.
*/
#include <stddef.h>
#include <mem_ops.h>
#include "tee_log.h"
#include "ta_framework.h"
#include "gtask_inner.h"
#include "notify_manager.h"
#include "mem_manager.h"
#include "tee_ext_api.h"
#include "tee_config.h"
#include "securec.h"
extern struct service_struct *g_cur_service;
extern struct session_struct *g_cur_session;
struct notify_data_struct *g_notify_data = NULL;
struct notify_data_struct *get_notify_data(void)
{
return g_notify_data;
}
static bool g_notify_mem_registered = false;
int64_t teecall_register_notify_mem(uint64_t mem_addr);
static TEE_Result check_param_for_register_notify_memery(const smc_cmd_t *cmd, uint32_t *mem_size,
uint64_t *mem_addr)
{
TEE_Param *params = NULL;
uint32_t param_types = 0;
if (cmd == NULL)
return TEE_ERROR_BAD_PARAMETERS;
if (g_notify_mem_registered) {
tloge("notify memory is already registered!\n");
return TEE_ERROR_GENERIC;
}
g_notify_data = NULL;
if (cmd_global_ns_get_params(cmd, &param_types, &params) != TEE_SUCCESS) {
tloge("failed to map operation!\n");
return TEE_ERROR_GENERIC;
}
/* check params types */
if ((TEE_PARAM_TYPE_GET(param_types, 0) != TEE_PARAM_TYPE_VALUE_INPUT) ||
(TEE_PARAM_TYPE_GET(param_types, 1) != TEE_PARAM_TYPE_VALUE_INPUT)) {
tloge("Bad expected parameter types.\n");
return TEE_ERROR_BAD_PARAMETERS;
}
/* this condition should never happen here */
if (params == NULL)
return TEE_ERROR_BAD_PARAMETERS;
*mem_size = params[1].value.a;
if (*mem_size != NOTIFY_MEM_SIZE) {
tloge("invalid notify mem size:%u\n", *mem_size);
return TEE_ERROR_BAD_PARAMETERS;
}
/* this will only be called once when booting up, the addr are trusted */
if (task_map_ns_phy_mem(0, params[0].value.a | ((uint64_t)params[0].value.b << SHIFT_OFFSET),
*mem_size, mem_addr)) {
tloge("map notify data buffer error");
return TEE_ERROR_GENERIC;
}
return TEE_SUCCESS;
}
TEE_Result register_notify_memery(const smc_cmd_t *cmd)
{
uint64_t mem_addr = 0;
uint32_t mem_size;
TEE_Result ret = check_param_for_register_notify_memery(cmd, &mem_size, &mem_addr);
if (ret != TEE_SUCCESS)
return ret;
/* will never reach there */
if (mem_addr == 0)
return TEE_ERROR_GENERIC;
int64_t rc = teecall_register_notify_mem(mem_addr);
if (rc != 0) {
tloge("register notify mem failed: rc is %llx\n", rc);
if (task_unmap(0, mem_addr, mem_size))
tloge("task_unmap failed\n");
return TEE_ERROR_BAD_PARAMETERS;
}
g_notify_data = (void *)(uintptr_t)mem_addr;
g_notify_mem_registered = true;
return TEE_SUCCESS;
}
@@ -1,22 +0,0 @@
/*
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
* Licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v2 for more details.
*/
#ifndef GTASK_NOTIFY_MANAGER_H
#define GTASK_NOTIFY_MANAGER_H
#include "sys_timer.h" /* timer_private_data_kernel */
#define NOTIFY_MEM_SIZE (4 * 1024)
TEE_Result register_notify_memery(const smc_cmd_t *cmd);
struct notify_data_struct *get_notify_data(void);
#endif /* GTASK_NOTIFY_MANAGER_H */