Commit a4b1c9b9 authored by Bean Huo's avatar Bean Huo Committed by Martin K. Petersen

scsi: ufs: core: Pass EHS length into ufshcd_prepare_req_desc_hdr()

We need to fill in the total EHS length in UTP Transfer Request Descriptor.
Add this functionality to ufshcd_prepare_req_desc_hdr().
Signed-off-by: default avatarBean Huo <beanhuo@micron.com>
Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f6b9d0fe
...@@ -2506,14 +2506,15 @@ static void ufshcd_disable_intr(struct ufs_hba *hba, u32 intrs) ...@@ -2506,14 +2506,15 @@ static void ufshcd_disable_intr(struct ufs_hba *hba, u32 intrs)
} }
/** /**
* ufshcd_prepare_req_desc_hdr() - Fills the requests header * ufshcd_prepare_req_desc_hdr - Fill UTP Transfer request descriptor header according to request
* descriptor according to request * descriptor according to request
* @lrbp: pointer to local reference block * @lrbp: pointer to local reference block
* @upiu_flags: flags required in the header * @upiu_flags: flags required in the header
* @cmd_dir: requests data direction * @cmd_dir: requests data direction
* @ehs_length: Total EHS Length (in 32‐bytes units of all Extra Header Segments)
*/ */
static void ufshcd_prepare_req_desc_hdr(struct ufshcd_lrb *lrbp, static void ufshcd_prepare_req_desc_hdr(struct ufshcd_lrb *lrbp, u8 *upiu_flags,
u8 *upiu_flags, enum dma_data_direction cmd_dir) enum dma_data_direction cmd_dir, int ehs_length)
{ {
struct utp_transfer_req_desc *req_desc = lrbp->utr_descriptor_ptr; struct utp_transfer_req_desc *req_desc = lrbp->utr_descriptor_ptr;
u32 data_direction; u32 data_direction;
...@@ -2532,8 +2533,8 @@ static void ufshcd_prepare_req_desc_hdr(struct ufshcd_lrb *lrbp, ...@@ -2532,8 +2533,8 @@ static void ufshcd_prepare_req_desc_hdr(struct ufshcd_lrb *lrbp,
*upiu_flags = UPIU_CMD_FLAGS_NONE; *upiu_flags = UPIU_CMD_FLAGS_NONE;
} }
dword_0 = data_direction | (lrbp->command_type dword_0 = data_direction | (lrbp->command_type << UPIU_COMMAND_TYPE_OFFSET) |
<< UPIU_COMMAND_TYPE_OFFSET); ehs_length << 8;
if (lrbp->intr_cmd) if (lrbp->intr_cmd)
dword_0 |= UTP_REQ_DESC_INT_CMD; dword_0 |= UTP_REQ_DESC_INT_CMD;
...@@ -2588,8 +2589,7 @@ void ufshcd_prepare_utp_scsi_cmd_upiu(struct ufshcd_lrb *lrbp, u8 upiu_flags) ...@@ -2588,8 +2589,7 @@ void ufshcd_prepare_utp_scsi_cmd_upiu(struct ufshcd_lrb *lrbp, u8 upiu_flags)
} }
/** /**
* ufshcd_prepare_utp_query_req_upiu() - fills the utp_transfer_req_desc, * ufshcd_prepare_utp_query_req_upiu() - fill the utp_transfer_req_desc for query request
* for query requsts
* @hba: UFS hba * @hba: UFS hba
* @lrbp: local reference block pointer * @lrbp: local reference block pointer
* @upiu_flags: flags * @upiu_flags: flags
...@@ -2660,7 +2660,7 @@ static int ufshcd_compose_devman_upiu(struct ufs_hba *hba, ...@@ -2660,7 +2660,7 @@ static int ufshcd_compose_devman_upiu(struct ufs_hba *hba,
else else
lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE;
ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, DMA_NONE); ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, DMA_NONE, 0);
if (hba->dev_cmd.type == DEV_CMD_TYPE_QUERY) if (hba->dev_cmd.type == DEV_CMD_TYPE_QUERY)
ufshcd_prepare_utp_query_req_upiu(hba, lrbp, upiu_flags); ufshcd_prepare_utp_query_req_upiu(hba, lrbp, upiu_flags);
else if (hba->dev_cmd.type == DEV_CMD_TYPE_NOP) else if (hba->dev_cmd.type == DEV_CMD_TYPE_NOP)
...@@ -2688,8 +2688,7 @@ static int ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) ...@@ -2688,8 +2688,7 @@ static int ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE;
if (likely(lrbp->cmd)) { if (likely(lrbp->cmd)) {
ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, lrbp->cmd->sc_data_direction, 0);
lrbp->cmd->sc_data_direction);
ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags); ufshcd_prepare_utp_scsi_cmd_upiu(lrbp, upiu_flags);
} else { } else {
ret = -EINVAL; ret = -EINVAL;
...@@ -6884,7 +6883,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, ...@@ -6884,7 +6883,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
/* update the task tag in the request upiu */ /* update the task tag in the request upiu */
req_upiu->header.dword_0 |= cpu_to_be32(tag); req_upiu->header.dword_0 |= cpu_to_be32(tag);
ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, DMA_NONE); ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, DMA_NONE, 0);
/* just copy the upiu request as it is */ /* just copy the upiu request as it is */
memcpy(lrbp->ucd_req_ptr, req_upiu, sizeof(*lrbp->ucd_req_ptr)); memcpy(lrbp->ucd_req_ptr, req_upiu, sizeof(*lrbp->ucd_req_ptr));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment