ANDROID: scsi: ufs: add a hook to prepare command

This patch adds one variant in UFS driver:

void    (*prepare_command)(struct ufs_hba *hba,
                        struct request *rq, struct ufshcd_lrb *lrbp);
 -> called in the beginning of queuecommand to update the request, if needed

Bug: 158050260
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ib91a735c2cbd215c1854ff57ef9a92642c41e005
This commit is contained in:
Jaegeuk Kim
2020-09-16 10:59:18 -07:00
parent 72ac44440d
commit 9670c1f680
2 changed files with 12 additions and 0 deletions

View File

@@ -2563,6 +2563,8 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun);
lrbp->intr_cmd = !ufshcd_is_intr_aggr_allowed(hba) ? true : false;
ufshcd_vops_prepare_command(hba, cmd->request, lrbp);
ufshcd_prepare_lrbp_crypto(cmd->request, lrbp);
lrbp->req_abort_skip = false;

View File

@@ -284,6 +284,7 @@ struct ufs_pwr_mode_info {
* @program_key: program or evict an inline encryption key
* @fill_prdt: called after initializing the standard PRDT fields so that any
* variant-specific PRDT fields can be initialized too
* @prepare_command: called when receiving a request in the first place
*/
struct ufs_hba_variant_ops {
const char *name;
@@ -321,6 +322,8 @@ struct ufs_hba_variant_ops {
const union ufs_crypto_cfg_entry *cfg, int slot);
int (*fill_prdt)(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
unsigned int segments);
void (*prepare_command)(struct ufs_hba *hba,
struct request *rq, struct ufshcd_lrb *lrbp);
};
/* clock gating state */
@@ -1214,6 +1217,13 @@ static inline int ufshcd_vops_fill_prdt(struct ufs_hba *hba,
return 0;
}
static inline void ufshcd_vops_prepare_command(struct ufs_hba *hba,
struct request *rq, struct ufshcd_lrb *lrbp)
{
if (hba->vops && hba->vops->prepare_command)
hba->vops->prepare_command(hba, rq, lrbp);
}
extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
/*