mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	scsi: ufs-bsg: Add support for uic commands in ufs_bsg_request()
Make ufshcd_send_uic_cmd() public for that. Signed-off-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
		
							parent
							
								
									95e34bf930
								
							
						
					
					
						commit
						e77044c5a8
					
				
					 4 changed files with 17 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -84,6 +84,7 @@ static int ufs_bsg_request(struct bsg_job *job)
 | 
			
		|||
	struct ufs_hba *hba = shost_priv(dev_to_shost(job->dev->parent));
 | 
			
		||||
	unsigned int req_len = job->request_len;
 | 
			
		||||
	unsigned int reply_len = job->reply_len;
 | 
			
		||||
	struct uic_command uc = {};
 | 
			
		||||
	int msgcode;
 | 
			
		||||
	uint8_t *desc_buff = NULL;
 | 
			
		||||
	int desc_len = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -116,6 +117,16 @@ static int ufs_bsg_request(struct bsg_job *job)
 | 
			
		|||
			dev_err(hba->dev,
 | 
			
		||||
				"exe raw upiu: error code %d\n", ret);
 | 
			
		||||
 | 
			
		||||
		break;
 | 
			
		||||
	case UPIU_TRANSACTION_UIC_CMD:
 | 
			
		||||
		memcpy(&uc, &bsg_request->upiu_req.uc, UIC_CMD_SIZE);
 | 
			
		||||
		ret = ufshcd_send_uic_cmd(hba, &uc);
 | 
			
		||||
		if (ret)
 | 
			
		||||
			dev_dbg(hba->dev,
 | 
			
		||||
				"send uic cmd: error code %d\n", ret);
 | 
			
		||||
 | 
			
		||||
		memcpy(&bsg_reply->upiu_rsp.uc, &uc, UIC_CMD_SIZE);
 | 
			
		||||
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		ret = -ENOTSUPP;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2059,8 +2059,7 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd,
 | 
			
		|||
 *
 | 
			
		||||
 * Returns 0 only if success.
 | 
			
		||||
 */
 | 
			
		||||
static int
 | 
			
		||||
ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
 | 
			
		||||
int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
	unsigned long flags;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -895,6 +895,8 @@ int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
 | 
			
		|||
 | 
			
		||||
u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba);
 | 
			
		||||
 | 
			
		||||
int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd);
 | 
			
		||||
 | 
			
		||||
int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
 | 
			
		||||
			     struct utp_upiu_req *req_upiu,
 | 
			
		||||
			     struct utp_upiu_req *rsp_upiu,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,9 @@
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
#define UFS_CDB_SIZE	16
 | 
			
		||||
#define UPIU_TRANSACTION_UIC_CMD 0x1F
 | 
			
		||||
/* uic commands are 4DW long, per UFSHCI V2.1 paragraph 5.6.1 */
 | 
			
		||||
#define UIC_CMD_SIZE (sizeof(u32) * 4)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * struct utp_upiu_header - UPIU header structure
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue