190
190
megasas_complete_cmd (struct megasas_instance * instance , struct megasas_cmd * cmd ,
191
191
u8 alt_status );
192
192
static u32
193
- megasas_read_fw_status_reg_gen2 (struct megasas_register_set __iomem * regs );
193
+ megasas_read_fw_status_reg_gen2 (struct megasas_instance * instance );
194
194
static int
195
195
megasas_adp_reset_gen2 (struct megasas_instance * instance ,
196
196
struct megasas_register_set __iomem * reg_set );
@@ -420,19 +420,21 @@ megasas_disable_intr_xscale(struct megasas_instance *instance)
420
420
* @regs: MFI register set
421
421
*/
422
422
static u32
423
- megasas_read_fw_status_reg_xscale (struct megasas_register_set __iomem * regs )
423
+ megasas_read_fw_status_reg_xscale (struct megasas_instance * instance )
424
424
{
425
- return readl (& ( regs ) -> outbound_msg_0 );
425
+ return readl (& instance -> reg_set -> outbound_msg_0 );
426
426
}
427
427
/**
428
428
* megasas_clear_interrupt_xscale - Check & clear interrupt
429
429
* @regs: MFI register set
430
430
*/
431
431
static int
432
- megasas_clear_intr_xscale (struct megasas_register_set __iomem * regs )
432
+ megasas_clear_intr_xscale (struct megasas_instance * instance )
433
433
{
434
434
u32 status ;
435
435
u32 mfiStatus = 0 ;
436
+ struct megasas_register_set __iomem * regs ;
437
+ regs = instance -> reg_set ;
436
438
437
439
/*
438
440
* Check if it is our interrupt
@@ -597,19 +599,21 @@ megasas_disable_intr_ppc(struct megasas_instance *instance)
597
599
* @regs: MFI register set
598
600
*/
599
601
static u32
600
- megasas_read_fw_status_reg_ppc (struct megasas_register_set __iomem * regs )
602
+ megasas_read_fw_status_reg_ppc (struct megasas_instance * instance )
601
603
{
602
- return readl (& ( regs ) -> outbound_scratch_pad_0 );
604
+ return readl (& instance -> reg_set -> outbound_scratch_pad_0 );
603
605
}
604
606
605
607
/**
606
608
* megasas_clear_interrupt_ppc - Check & clear interrupt
607
609
* @regs: MFI register set
608
610
*/
609
611
static int
610
- megasas_clear_intr_ppc (struct megasas_register_set __iomem * regs )
612
+ megasas_clear_intr_ppc (struct megasas_instance * instance )
611
613
{
612
614
u32 status , mfiStatus = 0 ;
615
+ struct megasas_register_set __iomem * regs ;
616
+ regs = instance -> reg_set ;
613
617
614
618
/*
615
619
* Check if it is our interrupt
@@ -722,20 +726,22 @@ megasas_disable_intr_skinny(struct megasas_instance *instance)
722
726
* @regs: MFI register set
723
727
*/
724
728
static u32
725
- megasas_read_fw_status_reg_skinny (struct megasas_register_set __iomem * regs )
729
+ megasas_read_fw_status_reg_skinny (struct megasas_instance * instance )
726
730
{
727
- return readl (& ( regs ) -> outbound_scratch_pad_0 );
731
+ return readl (& instance -> reg_set -> outbound_scratch_pad_0 );
728
732
}
729
733
730
734
/**
731
735
* megasas_clear_interrupt_skinny - Check & clear interrupt
732
736
* @regs: MFI register set
733
737
*/
734
738
static int
735
- megasas_clear_intr_skinny (struct megasas_register_set __iomem * regs )
739
+ megasas_clear_intr_skinny (struct megasas_instance * instance )
736
740
{
737
741
u32 status ;
738
742
u32 mfiStatus = 0 ;
743
+ struct megasas_register_set __iomem * regs ;
744
+ regs = instance -> reg_set ;
739
745
740
746
/*
741
747
* Check if it is our interrupt
@@ -749,7 +755,7 @@ megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
749
755
/*
750
756
* Check if it is our interrupt
751
757
*/
752
- if ((megasas_read_fw_status_reg_skinny (regs ) & MFI_STATE_MASK ) ==
758
+ if ((megasas_read_fw_status_reg_skinny (instance ) & MFI_STATE_MASK ) ==
753
759
MFI_STATE_FAULT ) {
754
760
mfiStatus = MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE ;
755
761
} else
@@ -867,20 +873,22 @@ megasas_disable_intr_gen2(struct megasas_instance *instance)
867
873
* @regs: MFI register set
868
874
*/
869
875
static u32
870
- megasas_read_fw_status_reg_gen2 (struct megasas_register_set __iomem * regs )
876
+ megasas_read_fw_status_reg_gen2 (struct megasas_instance * instance )
871
877
{
872
- return readl (& ( regs ) -> outbound_scratch_pad_0 );
878
+ return readl (& instance -> reg_set -> outbound_scratch_pad_0 );
873
879
}
874
880
875
881
/**
876
882
* megasas_clear_interrupt_gen2 - Check & clear interrupt
877
883
* @regs: MFI register set
878
884
*/
879
885
static int
880
- megasas_clear_intr_gen2 (struct megasas_register_set __iomem * regs )
886
+ megasas_clear_intr_gen2 (struct megasas_instance * instance )
881
887
{
882
888
u32 status ;
883
889
u32 mfiStatus = 0 ;
890
+ struct megasas_register_set __iomem * regs ;
891
+ regs = instance -> reg_set ;
884
892
885
893
/*
886
894
* Check if it is our interrupt
@@ -2685,7 +2693,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
2685
2693
2686
2694
i = 0 ;
2687
2695
outstanding = atomic_read (& instance -> fw_outstanding );
2688
- fw_state = instance -> instancet -> read_fw_status_reg (instance -> reg_set ) & MFI_STATE_MASK ;
2696
+ fw_state = instance -> instancet -> read_fw_status_reg (instance ) & MFI_STATE_MASK ;
2689
2697
2690
2698
if ((!outstanding && (fw_state == MFI_STATE_OPERATIONAL )))
2691
2699
goto no_outstanding ;
@@ -2714,7 +2722,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
2714
2722
2715
2723
outstanding = atomic_read (& instance -> fw_outstanding );
2716
2724
2717
- fw_state = instance -> instancet -> read_fw_status_reg (instance -> reg_set ) & MFI_STATE_MASK ;
2725
+ fw_state = instance -> instancet -> read_fw_status_reg (instance ) & MFI_STATE_MASK ;
2718
2726
if ((!outstanding && (fw_state == MFI_STATE_OPERATIONAL )))
2719
2727
goto no_outstanding ;
2720
2728
}
@@ -3668,9 +3676,8 @@ megasas_deplete_reply_queue(struct megasas_instance *instance,
3668
3676
return IRQ_HANDLED ;
3669
3677
}
3670
3678
3671
- if ((mfiStatus = instance -> instancet -> clear_intr (
3672
- instance -> reg_set )
3673
- ) == 0 ) {
3679
+ mfiStatus = instance -> instancet -> clear_intr (instance );
3680
+ if (mfiStatus == 0 ) {
3674
3681
/* Hardware may not set outbound_intr_status in MSI-X mode */
3675
3682
if (!instance -> msix_vectors )
3676
3683
return IRQ_NONE ;
@@ -3680,7 +3687,7 @@ megasas_deplete_reply_queue(struct megasas_instance *instance,
3680
3687
3681
3688
if ((mfiStatus & MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE )) {
3682
3689
fw_state = instance -> instancet -> read_fw_status_reg (
3683
- instance -> reg_set ) & MFI_STATE_MASK ;
3690
+ instance ) & MFI_STATE_MASK ;
3684
3691
3685
3692
if (fw_state != MFI_STATE_FAULT ) {
3686
3693
dev_notice (& instance -> pdev -> dev , "fw state:%x\n" ,
@@ -3763,7 +3770,7 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
3763
3770
u32 cur_state ;
3764
3771
u32 abs_state , curr_abs_state ;
3765
3772
3766
- abs_state = instance -> instancet -> read_fw_status_reg (instance -> reg_set );
3773
+ abs_state = instance -> instancet -> read_fw_status_reg (instance );
3767
3774
fw_state = abs_state & MFI_STATE_MASK ;
3768
3775
3769
3776
if (fw_state != MFI_STATE_READY )
@@ -3896,7 +3903,7 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
3896
3903
*/
3897
3904
for (i = 0 ; i < max_wait ; i ++ ) {
3898
3905
curr_abs_state = instance -> instancet ->
3899
- read_fw_status_reg (instance -> reg_set );
3906
+ read_fw_status_reg (instance );
3900
3907
3901
3908
if (abs_state == curr_abs_state ) {
3902
3909
msleep (1000 );
@@ -5032,24 +5039,21 @@ megasas_issue_init_mfi(struct megasas_instance *instance)
5032
5039
static u32
5033
5040
megasas_init_adapter_mfi (struct megasas_instance * instance )
5034
5041
{
5035
- struct megasas_register_set __iomem * reg_set ;
5036
5042
u32 context_sz ;
5037
5043
u32 reply_q_sz ;
5038
5044
5039
- reg_set = instance -> reg_set ;
5040
-
5041
5045
/*
5042
5046
* Get various operational parameters from status register
5043
5047
*/
5044
- instance -> max_fw_cmds = instance -> instancet -> read_fw_status_reg (reg_set ) & 0x00FFFF ;
5048
+ instance -> max_fw_cmds = instance -> instancet -> read_fw_status_reg (instance ) & 0x00FFFF ;
5045
5049
/*
5046
5050
* Reduce the max supported cmds by 1. This is to ensure that the
5047
5051
* reply_q_sz (1 more than the max cmd that driver may send)
5048
5052
* does not exceed max cmds that the FW can support
5049
5053
*/
5050
5054
instance -> max_fw_cmds = instance -> max_fw_cmds - 1 ;
5051
5055
instance -> max_mfi_cmds = instance -> max_fw_cmds ;
5052
- instance -> max_num_sge = (instance -> instancet -> read_fw_status_reg (reg_set ) & 0xFF0000 ) >>
5056
+ instance -> max_num_sge = (instance -> instancet -> read_fw_status_reg (instance ) & 0xFF0000 ) >>
5053
5057
0x10 ;
5054
5058
/*
5055
5059
* For MFI skinny adapters, MEGASAS_SKINNY_INT_CMDS commands
@@ -5105,7 +5109,7 @@ megasas_init_adapter_mfi(struct megasas_instance *instance)
5105
5109
5106
5110
instance -> fw_support_ieee = 0 ;
5107
5111
instance -> fw_support_ieee =
5108
- (instance -> instancet -> read_fw_status_reg (reg_set ) &
5112
+ (instance -> instancet -> read_fw_status_reg (instance ) &
5109
5113
0x04000000 );
5110
5114
5111
5115
dev_notice (& instance -> pdev -> dev , "megasas_init_mfi: fw_support_ieee=%d" ,
@@ -5305,7 +5309,6 @@ static int megasas_init_fw(struct megasas_instance *instance)
5305
5309
u32 max_sectors_2 , tmp_sectors , msix_enable ;
5306
5310
u32 scratch_pad_1 , scratch_pad_2 , scratch_pad_3 , status_reg ;
5307
5311
resource_size_t base_addr ;
5308
- struct megasas_register_set __iomem * reg_set ;
5309
5312
struct megasas_ctrl_info * ctrl_info = NULL ;
5310
5313
unsigned long bar_list ;
5311
5314
int i , j , loop , fw_msix_count = 0 ;
@@ -5332,8 +5335,6 @@ static int megasas_init_fw(struct megasas_instance *instance)
5332
5335
goto fail_ioremap ;
5333
5336
}
5334
5337
5335
- reg_set = instance -> reg_set ;
5336
-
5337
5338
if (instance -> adapter_type != MFI_SERIES )
5338
5339
instance -> instancet = & megasas_instance_template_fusion ;
5339
5340
else {
@@ -5362,7 +5363,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
5362
5363
if (megasas_transition_to_ready (instance , 0 )) {
5363
5364
if (instance -> adapter_type >= INVADER_SERIES ) {
5364
5365
status_reg = instance -> instancet -> read_fw_status_reg (
5365
- instance -> reg_set );
5366
+ instance );
5366
5367
do_adp_reset = status_reg & MFI_RESET_ADAPTER ;
5367
5368
}
5368
5369
@@ -5407,7 +5408,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
5407
5408
}
5408
5409
5409
5410
/* Check if MSI-X is supported while in ready state */
5410
- msix_enable = (instance -> instancet -> read_fw_status_reg (reg_set ) &
5411
+ msix_enable = (instance -> instancet -> read_fw_status_reg (instance ) &
5411
5412
0x4000000 ) >> 0x1a ;
5412
5413
if (msix_enable && !msix_disable ) {
5413
5414
int irq_flags = PCI_IRQ_MSIX ;
0 commit comments