From 08c3eee43a7d60e7709fc8f82227a1bc616810f3 Mon Sep 17 00:00:00 2001 From: houxiaoyong Date: Mon, 5 Mar 2018 15:43:15 +0800 Subject: [PATCH] Hifi_dsp: add hikey970 memmap and fix a bug about memory overflow Signed-off-by: houxiaoyong --- drivers/hisi/ap/platform/kirin970/global_ddr_map.h | 14 ++++++++++++++ drivers/hisi/hifi_dsp/hifi_om.c | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100755 drivers/hisi/ap/platform/kirin970/global_ddr_map.h mode change 100644 => 100755 drivers/hisi/hifi_dsp/hifi_om.c diff --git a/drivers/hisi/ap/platform/kirin970/global_ddr_map.h b/drivers/hisi/ap/platform/kirin970/global_ddr_map.h new file mode 100755 index 000000000000..2187e4848cfb --- /dev/null +++ b/drivers/hisi/ap/platform/kirin970/global_ddr_map.h @@ -0,0 +1,14 @@ +#ifndef _HI_GLOBAL_MEM_MAP_INCLUDE_H_ +#define _HI_GLOBAL_MEM_MAP_INCLUDE_H_ + + +#define HISI_RESERVED_HIFI_PHYMEM_BASE 0x8D500000 +#define HISI_RESERVED_HIFI_PHYMEM_SIZE (0xC00000) + +#ifdef CONFIG_HISI_FAMA +#define HISI_RESERVED_HIFI_DATA_PHYMEM_BASE_FAMA 0x5AE300000 +#endif +#define HISI_RESERVED_HIFI_DATA_PHYMEM_BASE 0x8E300000 +#define HISI_RESERVED_HIFI_DATA_PHYMEM_SIZE (0x500000) + +#endif diff --git a/drivers/hisi/hifi_dsp/hifi_om.c b/drivers/hisi/hifi_dsp/hifi_om.c old mode 100644 new mode 100755 index 22263a5822ec..6499ad6f045e --- a/drivers/hisi/hifi_dsp/hifi_om.c +++ b/drivers/hisi/hifi_dsp/hifi_om.c @@ -790,10 +790,10 @@ int hikey_ap_mailbox_read(struct hikey_msg_with_content *hikey_msg) hikey_msg->msg_info.msg_len); return -1; } - - hikey_ap_mailbox_read_queue(hikey_msg_head, hikey_msg->msg_info.msg_content, - hikey_msg->msg_info.msg_len - offsetof(struct hikey_ap2dsp_msg_body, msg_content)); - + if(hikey_msg->msg_info.msg_len > offsetof(struct hikey_ap2dsp_msg_body, msg_content)){ + hikey_ap_mailbox_read_queue(hikey_msg_head, hikey_msg->msg_info.msg_content, + hikey_msg->msg_info.msg_len - offsetof(struct hikey_ap2dsp_msg_body, msg_content)); + } return 0; }