@@ -138,6 +138,9 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTER *ioc);
138
138
static void
139
139
_base_clear_outstanding_commands (struct MPT3SAS_ADAPTER * ioc );
140
140
141
+ static u32
142
+ _base_readl_ext_retry (const volatile void __iomem * addr );
143
+
141
144
/**
142
145
* mpt3sas_base_check_cmd_timeout - Function
143
146
* to check timeout and command termination due
@@ -213,6 +216,20 @@ _base_readl_aero(const volatile void __iomem *addr)
213
216
return ret_val ;
214
217
}
215
218
219
+ static u32
220
+ _base_readl_ext_retry (const volatile void __iomem * addr )
221
+ {
222
+ u32 i , ret_val ;
223
+
224
+ for (i = 0 ; i < 30 ; i ++ ) {
225
+ ret_val = readl (addr );
226
+ if (ret_val == 0 )
227
+ continue ;
228
+ }
229
+
230
+ return ret_val ;
231
+ }
232
+
216
233
static inline u32
217
234
_base_readl (const volatile void __iomem * addr )
218
235
{
@@ -940,7 +957,7 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAPTER *ioc)
940
957
941
958
dump_stack ();
942
959
943
- doorbell = ioc -> base_readl (& ioc -> chip -> Doorbell );
960
+ doorbell = ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell );
944
961
if ((doorbell & MPI2_IOC_STATE_MASK ) == MPI2_IOC_STATE_FAULT ) {
945
962
mpt3sas_print_fault_code (ioc , doorbell &
946
963
MPI2_DOORBELL_DATA_MASK );
@@ -6686,7 +6703,7 @@ mpt3sas_base_get_iocstate(struct MPT3SAS_ADAPTER *ioc, int cooked)
6686
6703
{
6687
6704
u32 s , sc ;
6688
6705
6689
- s = ioc -> base_readl (& ioc -> chip -> Doorbell );
6706
+ s = ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell );
6690
6707
sc = s & MPI2_IOC_STATE_MASK ;
6691
6708
return cooked ? sc : s ;
6692
6709
}
@@ -6831,7 +6848,7 @@ _base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout)
6831
6848
__func__ , count , timeout ));
6832
6849
return 0 ;
6833
6850
} else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS ) {
6834
- doorbell = ioc -> base_readl (& ioc -> chip -> Doorbell );
6851
+ doorbell = ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell );
6835
6852
if ((doorbell & MPI2_IOC_STATE_MASK ) ==
6836
6853
MPI2_IOC_STATE_FAULT ) {
6837
6854
mpt3sas_print_fault_code (ioc , doorbell );
@@ -6871,7 +6888,7 @@ _base_wait_for_doorbell_not_used(struct MPT3SAS_ADAPTER *ioc, int timeout)
6871
6888
count = 0 ;
6872
6889
cntdn = 1000 * timeout ;
6873
6890
do {
6874
- doorbell_reg = ioc -> base_readl (& ioc -> chip -> Doorbell );
6891
+ doorbell_reg = ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell );
6875
6892
if (!(doorbell_reg & MPI2_DOORBELL_USED )) {
6876
6893
dhsprintk (ioc ,
6877
6894
ioc_info (ioc , "%s: successful count(%d), timeout(%d)\n" ,
@@ -7019,7 +7036,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
7019
7036
__le32 * mfp ;
7020
7037
7021
7038
/* make sure doorbell is not in use */
7022
- if ((ioc -> base_readl (& ioc -> chip -> Doorbell ) & MPI2_DOORBELL_USED )) {
7039
+ if ((ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell ) & MPI2_DOORBELL_USED )) {
7023
7040
ioc_err (ioc , "doorbell is in use (line=%d)\n" , __LINE__ );
7024
7041
return - EFAULT ;
7025
7042
}
@@ -7068,15 +7085,15 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
7068
7085
}
7069
7086
7070
7087
/* read the first two 16-bits, it gives the total length of the reply */
7071
- reply [0 ] = le16_to_cpu (ioc -> base_readl (& ioc -> chip -> Doorbell )
7088
+ reply [0 ] = le16_to_cpu (ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell )
7072
7089
& MPI2_DOORBELL_DATA_MASK );
7073
7090
writel (0 , & ioc -> chip -> HostInterruptStatus );
7074
7091
if ((_base_wait_for_doorbell_int (ioc , 5 ))) {
7075
7092
ioc_err (ioc , "doorbell handshake int failed (line=%d)\n" ,
7076
7093
__LINE__ );
7077
7094
return - EFAULT ;
7078
7095
}
7079
- reply [1 ] = le16_to_cpu (ioc -> base_readl (& ioc -> chip -> Doorbell )
7096
+ reply [1 ] = le16_to_cpu (ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell )
7080
7097
& MPI2_DOORBELL_DATA_MASK );
7081
7098
writel (0 , & ioc -> chip -> HostInterruptStatus );
7082
7099
@@ -7087,10 +7104,10 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
7087
7104
return - EFAULT ;
7088
7105
}
7089
7106
if (i >= reply_bytes /2 ) /* overflow case */
7090
- ioc -> base_readl (& ioc -> chip -> Doorbell );
7107
+ ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell );
7091
7108
else
7092
7109
reply [i ] = le16_to_cpu (
7093
- ioc -> base_readl (& ioc -> chip -> Doorbell )
7110
+ ioc -> base_readl_ext_retry (& ioc -> chip -> Doorbell )
7094
7111
& MPI2_DOORBELL_DATA_MASK );
7095
7112
writel (0 , & ioc -> chip -> HostInterruptStatus );
7096
7113
}
@@ -7949,7 +7966,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)
7949
7966
goto out ;
7950
7967
}
7951
7968
7952
- host_diagnostic = ioc -> base_readl (& ioc -> chip -> HostDiagnostic );
7969
+ host_diagnostic = ioc -> base_readl_ext_retry (& ioc -> chip -> HostDiagnostic );
7953
7970
drsprintk (ioc ,
7954
7971
ioc_info (ioc , "wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n" ,
7955
7972
count , host_diagnostic ));
@@ -7969,7 +7986,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)
7969
7986
for (count = 0 ; count < (300000000 /
7970
7987
MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC ); count ++ ) {
7971
7988
7972
- host_diagnostic = ioc -> base_readl (& ioc -> chip -> HostDiagnostic );
7989
+ host_diagnostic = ioc -> base_readl_ext_retry (& ioc -> chip -> HostDiagnostic );
7973
7990
7974
7991
if (host_diagnostic == 0xFFFFFFFF ) {
7975
7992
ioc_info (ioc ,
@@ -8359,10 +8376,13 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
8359
8376
ioc -> rdpq_array_enable_assigned = 0 ;
8360
8377
ioc -> use_32bit_dma = false;
8361
8378
ioc -> dma_mask = 64 ;
8362
- if (ioc -> is_aero_ioc )
8379
+ if (ioc -> is_aero_ioc ) {
8363
8380
ioc -> base_readl = & _base_readl_aero ;
8364
- else
8381
+ ioc -> base_readl_ext_retry = & _base_readl_ext_retry ;
8382
+ } else {
8365
8383
ioc -> base_readl = & _base_readl ;
8384
+ ioc -> base_readl_ext_retry = & _base_readl ;
8385
+ }
8366
8386
r = mpt3sas_base_map_resources (ioc );
8367
8387
if (r )
8368
8388
goto out_free_resources ;
0 commit comments