diff --git a/drivers/cam_icp/fw_inc/hfi_reg.h b/drivers/cam_icp/fw_inc/hfi_reg.h index 01e72c456b..f5043a14d1 100644 --- a/drivers/cam_icp/fw_inc/hfi_reg.h +++ b/drivers/cam_icp/fw_inc/hfi_reg.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef _CAM_HFI_REG_H_ @@ -37,16 +38,11 @@ #define ICP_QHDR_PRI_TYPE_MASK 0x0000FF00 #define ICP_QHDR_Q_ID_MASK 0x000000FF -#define ICP_CMD_Q_SIZE_IN_BYTES 4096 -#define ICP_MSG_Q_SIZE_IN_BYTES 4096 +#define ICP_CMD_Q_SIZE_IN_BYTES 8192 +#define ICP_MSG_Q_SIZE_IN_BYTES 8192 #define ICP_DBG_Q_SIZE_IN_BYTES 102400 #define ICP_MSG_SFR_SIZE_IN_BYTES 4096 -#define ICP_SHARED_MEM_IN_BYTES (1024 * 1024) -#define ICP_UNCACHED_HEAP_SIZE_IN_BYTES (2 * 1024 * 1024) -#define ICP_HFI_MAX_PKT_SIZE_IN_WORDS 25600 -#define ICP_HFI_MAX_PKT_SIZE_MSGQ_IN_WORDS 1024 - #define ICP_HFI_QTBL_HOSTID1 0x01000000 #define ICP_HFI_QTBL_STATUS_ENABLED 0x00000001 #define ICP_HFI_NUMBER_OF_QS 3 diff --git a/drivers/cam_icp/hfi.c b/drivers/cam_icp/hfi.c index 14b69a56a8..a70588a6cf 100644 --- a/drivers/cam_icp/hfi.c +++ b/drivers/cam_icp/hfi.c @@ -275,7 +275,7 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id, return -EINVAL; } - if (q_id > Q_DBG) { + if (!((q_id == Q_MSG) || (q_id == Q_DBG))) { CAM_ERR(CAM_HFI, "Invalid q :%u", q_id); return -EINVAL; } @@ -305,13 +305,11 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id, goto err; } - if (q_id == Q_MSG) { + size_upper_bound = q->qhdr_q_size; + if (q_id == Q_MSG) read_q = (uint32_t *)g_hfi->map.msg_q.kva; - size_upper_bound = ICP_HFI_MAX_PKT_SIZE_MSGQ_IN_WORDS; - } else { + else read_q = (uint32_t *)g_hfi->map.dbg_q.kva; - size_upper_bound = ICP_HFI_MAX_PKT_SIZE_IN_WORDS; - } read_ptr = (uint32_t *)(read_q + q->qhdr_read_idx); write_ptr = (uint32_t *)(read_q + q->qhdr_write_idx); @@ -320,12 +318,7 @@ int hfi_read_message(uint32_t *pmsg, uint8_t q_id, size_in_words = write_ptr - read_ptr; else { word_diff = read_ptr - write_ptr; - if (q_id == Q_MSG) - size_in_words = (ICP_MSG_Q_SIZE_IN_BYTES >> - BYTE_WORD_SHIFT) - word_diff; - else - size_in_words = (ICP_DBG_Q_SIZE_IN_BYTES >> - BYTE_WORD_SHIFT) - word_diff; + size_in_words = q->qhdr_q_size - word_diff; } if ((size_in_words == 0) ||