History

scsi: ufs-bsg: Add support for uic commands in ufs_bsg_request()

Make ufshcd_send_uic_cmd() public for that.

Avri Altman committed 8 years ago

Commit e77044c1 parent 95e34bf4 files · +17 −2Browse files

Unified · Split

4 files
  1. drivers/scsi/ufs/ufs_bsg.c +11 −0
  2. drivers/scsi/ufs/ufshcd.c +1 −2
  3. drivers/scsi/ufs/ufshcd.h +2 −0
  4. include/uapi/scsi/scsi_bsg_ufs.h +3 −0
drivers/scsi/ufs/ufs_bsg.c+11−0
@@ -84,6 +84,7 @@ static int ufs_bsg_request(struct bsg_job *job) · 83 unmodified lines
8484 struct ufs_hba *hba = shost_priv(dev_to_shost(job->dev->parent));
8585 unsigned int req_len = job->request_len;
8686 unsigned int reply_len = job->reply_len;
87+ struct uic_command uc = {};
8788 int msgcode;
8889 uint8_t *desc_buff = NULL;
8990 int desc_len = 0;
@@ -116,6 +117,16 @@ static int ufs_bsg_request(struct bsg_job *job) · 26 unmodified lines
116117 dev_err(hba->dev,
117118 "exe raw upiu: error code %d\n", ret);
118119
120+ break;
121+ case UPIU_TRANSACTION_UIC_CMD:
122+ memcpy(&uc, &bsg_request->upiu_req.uc, UIC_CMD_SIZE);
123+ ret = ufshcd_send_uic_cmd(hba, &uc);
124+ if (ret)
125+ dev_dbg(hba->dev,
126+ "send uic cmd: error code %d\n", ret);
127+
128+ memcpy(&bsg_reply->upiu_rsp.uc, &uc, UIC_CMD_SIZE);
129+
119130 break;
120131 default:
121132 ret = -ENOTSUPP;
drivers/scsi/ufs/ufshcd.c+1−2
@@ -2059,8 +2059,7 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, · 2058 unmodified lines
20592059 *
20602060 * Returns 0 only if success.
20612061 */
2062−static int
2063−ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
2062+int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
20642063 {
20652064 int ret;
20662065 unsigned long flags;
drivers/scsi/ufs/ufshcd.h+2−0
@@ -895,6 +895,8 @@ int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, · 894 unmodified lines
895895
896896 u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba);
897897
898+int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
899+
898900 int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
899901 struct utp_upiu_req *req_upiu,
900902 struct utp_upiu_req *rsp_upiu,
include/uapi/scsi/scsi_bsg_ufs.h+3−0
@@ -13,6 +13,9 @@ · 12 unmodified lines
1313 */
1414
1515 #define UFS_CDB_SIZE 16
16+#define UPIU_TRANSACTION_UIC_CMD 0x1F
17+/* uic commands are 4DW long, per UFSHCI V2.1 paragraph 5.6.1 */
18+#define UIC_CMD_SIZE (sizeof(u32) * 4)
1619
1720 /**
1821 * struct utp_upiu_header - UPIU header structure

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t