@@ -326,14 +326,11 @@ static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba, unsigned int tag,
326
326
static void ufshcd_add_tm_upiu_trace (struct ufs_hba * hba , unsigned int tag ,
327
327
const char * str )
328
328
{
329
- struct utp_task_req_desc * descp ;
330
- struct utp_upiu_task_req * task_req ;
331
329
int off = (int )tag - hba -> nutrs ;
330
+ struct utp_task_req_desc * descp = & hba -> utmrdl_base_addr [off ];
332
331
333
- descp = & hba -> utmrdl_base_addr [off ];
334
- task_req = (struct utp_upiu_task_req * )descp -> task_req_upiu ;
335
- trace_ufshcd_upiu (dev_name (hba -> dev ), str , & task_req -> header ,
336
- & task_req -> input_param1 );
332
+ trace_ufshcd_upiu (dev_name (hba -> dev ), str , & descp -> req_header ,
333
+ & descp -> input_param1 );
337
334
}
338
335
339
336
static void ufshcd_add_command_trace (struct ufs_hba * hba ,
@@ -475,22 +472,13 @@ void ufshcd_print_trs(struct ufs_hba *hba, unsigned long bitmap, bool pr_prdt)
475
472
476
473
static void ufshcd_print_tmrs (struct ufs_hba * hba , unsigned long bitmap )
477
474
{
478
- struct utp_task_req_desc * tmrdp ;
479
475
int tag ;
480
476
481
477
for_each_set_bit (tag , & bitmap , hba -> nutmrs ) {
482
- tmrdp = & hba -> utmrdl_base_addr [tag ];
478
+ struct utp_task_req_desc * tmrdp = & hba -> utmrdl_base_addr [tag ];
479
+
483
480
dev_err (hba -> dev , "TM[%d] - Task Management Header\n" , tag );
484
- ufshcd_hex_dump ("TM TRD: " , & tmrdp -> header ,
485
- sizeof (struct request_desc_header ));
486
- dev_err (hba -> dev , "TM[%d] - Task Management Request UPIU\n" ,
487
- tag );
488
- ufshcd_hex_dump ("TM REQ: " , tmrdp -> task_req_upiu ,
489
- sizeof (struct utp_upiu_req ));
490
- dev_err (hba -> dev , "TM[%d] - Task Management Response UPIU\n" ,
491
- tag );
492
- ufshcd_hex_dump ("TM RSP: " , tmrdp -> task_rsp_upiu ,
493
- sizeof (struct utp_task_req_desc ));
481
+ ufshcd_hex_dump ("" , tmrdp , sizeof (* tmrdp ));
494
482
}
495
483
}
496
484
@@ -4638,31 +4626,22 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev)
4638
4626
*/
4639
4627
static int ufshcd_task_req_compl (struct ufs_hba * hba , u32 index , u8 * resp )
4640
4628
{
4641
- struct utp_task_req_desc * task_req_descp ;
4642
- struct utp_upiu_task_rsp * task_rsp_upiup ;
4629
+ struct utp_task_req_desc * treq = hba -> utmrdl_base_addr + index ;
4643
4630
unsigned long flags ;
4644
4631
int ocs_value ;
4645
- int task_result ;
4646
4632
4647
4633
spin_lock_irqsave (hba -> host -> host_lock , flags );
4648
4634
4649
4635
/* Clear completed tasks from outstanding_tasks */
4650
4636
__clear_bit (index , & hba -> outstanding_tasks );
4651
4637
4652
- task_req_descp = hba -> utmrdl_base_addr ;
4653
- ocs_value = ufshcd_get_tmr_ocs (& task_req_descp [index ]);
4638
+ ocs_value = ufshcd_get_tmr_ocs (treq );
4654
4639
4655
- if (ocs_value == OCS_SUCCESS ) {
4656
- task_rsp_upiup = (struct utp_upiu_task_rsp * )
4657
- task_req_descp [index ].task_rsp_upiu ;
4658
- task_result = be32_to_cpu (task_rsp_upiup -> output_param1 );
4659
- task_result = task_result & MASK_TM_SERVICE_RESP ;
4660
- if (resp )
4661
- * resp = (u8 )task_result ;
4662
- } else {
4640
+ if (ocs_value != OCS_SUCCESS )
4663
4641
dev_err (hba -> dev , "%s: failed, ocs = 0x%x\n" ,
4664
4642
__func__ , ocs_value );
4665
- }
4643
+ else if (resp )
4644
+ * resp = be32_to_cpu (treq -> output_param1 ) & MASK_TM_SERVICE_RESP ;
4666
4645
spin_unlock_irqrestore (hba -> host -> host_lock , flags );
4667
4646
4668
4647
return ocs_value ;
@@ -5638,8 +5617,7 @@ static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag)
5638
5617
static int ufshcd_issue_tm_cmd (struct ufs_hba * hba , int lun_id , int task_id ,
5639
5618
u8 tm_function , u8 * tm_response )
5640
5619
{
5641
- struct utp_task_req_desc * task_req_descp ;
5642
- struct utp_upiu_task_req * task_req_upiup ;
5620
+ struct utp_task_req_desc * treq ;
5643
5621
struct Scsi_Host * host ;
5644
5622
unsigned long flags ;
5645
5623
int free_slot ;
@@ -5657,29 +5635,23 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id,
5657
5635
ufshcd_hold (hba , false);
5658
5636
5659
5637
spin_lock_irqsave (host -> host_lock , flags );
5660
- task_req_descp = hba -> utmrdl_base_addr ;
5661
- task_req_descp += free_slot ;
5638
+ treq = hba -> utmrdl_base_addr + free_slot ;
5662
5639
5663
5640
/* Configure task request descriptor */
5664
- task_req_descp -> header .dword_0 = cpu_to_le32 (UTP_REQ_DESC_INT_CMD );
5665
- task_req_descp -> header .dword_2 =
5666
- cpu_to_le32 (OCS_INVALID_COMMAND_STATUS );
5641
+ treq -> header .dword_0 = cpu_to_le32 (UTP_REQ_DESC_INT_CMD );
5642
+ treq -> header .dword_2 = cpu_to_le32 (OCS_INVALID_COMMAND_STATUS );
5667
5643
5668
5644
/* Configure task request UPIU */
5669
- task_req_upiup =
5670
- (struct utp_upiu_task_req * ) task_req_descp -> task_req_upiu ;
5671
5645
task_tag = hba -> nutrs + free_slot ;
5672
- task_req_upiup -> header .dword_0 =
5673
- UPIU_HEADER_DWORD (UPIU_TRANSACTION_TASK_REQ , 0 ,
5674
- lun_id , task_tag );
5675
- task_req_upiup -> header .dword_1 =
5676
- UPIU_HEADER_DWORD (0 , tm_function , 0 , 0 );
5646
+ treq -> req_header .dword_0 = UPIU_HEADER_DWORD (UPIU_TRANSACTION_TASK_REQ ,
5647
+ 0 , lun_id , task_tag );
5648
+ treq -> req_header .dword_1 = UPIU_HEADER_DWORD (0 , tm_function , 0 , 0 );
5677
5649
/*
5678
5650
* The host shall provide the same value for LUN field in the basic
5679
5651
* header and for Input Parameter.
5680
5652
*/
5681
- task_req_upiup -> input_param1 = cpu_to_be32 (lun_id );
5682
- task_req_upiup -> input_param2 = cpu_to_be32 (task_id );
5653
+ treq -> input_param1 = cpu_to_be32 (lun_id );
5654
+ treq -> input_param2 = cpu_to_be32 (task_id );
5683
5655
5684
5656
ufshcd_vops_setup_task_mgmt (hba , free_slot , tm_function );
5685
5657
0 commit comments