@@ -151,6 +151,11 @@ static int mpi3mr_report_manufacture(struct mpi3mr_ioc *mrioc,
151151 return - EFAULT ;
152152 }
153153
154+ if (mrioc -> pci_err_recovery ) {
155+ ioc_err (mrioc , "%s: pci error recovery in progress!\n" , __func__ );
156+ return - EFAULT ;
157+ }
158+
154159 data_out_sz = sizeof (struct rep_manu_request );
155160 data_in_sz = sizeof (struct rep_manu_reply );
156161 data_out = dma_alloc_coherent (& mrioc -> pdev -> dev ,
@@ -790,6 +795,12 @@ static int mpi3mr_set_identify(struct mpi3mr_ioc *mrioc, u16 handle,
790795 return - EFAULT ;
791796 }
792797
798+ if (mrioc -> pci_err_recovery ) {
799+ ioc_err (mrioc , "%s: pci error recovery in progress!\n" ,
800+ __func__ );
801+ return - EFAULT ;
802+ }
803+
793804 if ((mpi3mr_cfg_get_dev_pg0 (mrioc , & ioc_status , & device_pg0 ,
794805 sizeof (device_pg0 ), MPI3_DEVICE_PGAD_FORM_HANDLE , handle ))) {
795806 ioc_err (mrioc , "%s: device page0 read failed\n" , __func__ );
@@ -1007,6 +1018,9 @@ mpi3mr_alloc_hba_port(struct mpi3mr_ioc *mrioc, u16 port_id)
10071018 hba_port -> port_id = port_id ;
10081019 ioc_info (mrioc , "hba_port entry: %p, port: %d is added to hba_port list\n" ,
10091020 hba_port , hba_port -> port_id );
1021+ if (mrioc -> reset_in_progress ||
1022+ mrioc -> pci_err_recovery )
1023+ hba_port -> flags = MPI3MR_HBA_PORT_FLAG_NEW ;
10101024 list_add_tail (& hba_port -> list , & mrioc -> hba_port_table_list );
10111025 return hba_port ;
10121026}
@@ -1055,7 +1069,7 @@ void mpi3mr_update_links(struct mpi3mr_ioc *mrioc,
10551069 struct mpi3mr_sas_node * mr_sas_node ;
10561070 struct mpi3mr_sas_phy * mr_sas_phy ;
10571071
1058- if (mrioc -> reset_in_progress )
1072+ if (mrioc -> reset_in_progress || mrioc -> pci_err_recovery )
10591073 return ;
10601074
10611075 spin_lock_irqsave (& mrioc -> sas_node_lock , flags );
@@ -1978,7 +1992,7 @@ int mpi3mr_expander_add(struct mpi3mr_ioc *mrioc, u16 handle)
19781992 if (!handle )
19791993 return -1 ;
19801994
1981- if (mrioc -> reset_in_progress )
1995+ if (mrioc -> reset_in_progress || mrioc -> pci_err_recovery )
19821996 return -1 ;
19831997
19841998 if ((mpi3mr_cfg_get_sas_exp_pg0 (mrioc , & ioc_status , & expander_pg0 ,
@@ -2184,7 +2198,7 @@ void mpi3mr_expander_node_remove(struct mpi3mr_ioc *mrioc,
21842198 /* remove sibling ports attached to this expander */
21852199 list_for_each_entry_safe (mr_sas_port , next ,
21862200 & sas_expander -> sas_port_list , port_list ) {
2187- if (mrioc -> reset_in_progress )
2201+ if (mrioc -> reset_in_progress || mrioc -> pci_err_recovery )
21882202 return ;
21892203 if (mr_sas_port -> remote_identify .device_type ==
21902204 SAS_END_DEVICE )
@@ -2234,7 +2248,7 @@ void mpi3mr_expander_remove(struct mpi3mr_ioc *mrioc, u64 sas_address,
22342248 struct mpi3mr_sas_node * sas_expander ;
22352249 unsigned long flags ;
22362250
2237- if (mrioc -> reset_in_progress )
2251+ if (mrioc -> reset_in_progress || mrioc -> pci_err_recovery )
22382252 return ;
22392253
22402254 if (!hba_port )
@@ -2545,6 +2559,11 @@ static int mpi3mr_get_expander_phy_error_log(struct mpi3mr_ioc *mrioc,
25452559 return - EFAULT ;
25462560 }
25472561
2562+ if (mrioc -> pci_err_recovery ) {
2563+ ioc_err (mrioc , "%s: pci error recovery in progress!\n" , __func__ );
2564+ return - EFAULT ;
2565+ }
2566+
25482567 data_out_sz = sizeof (struct phy_error_log_request );
25492568 data_in_sz = sizeof (struct phy_error_log_reply );
25502569 sz = data_out_sz + data_in_sz ;
@@ -2804,6 +2823,12 @@ mpi3mr_expander_phy_control(struct mpi3mr_ioc *mrioc,
28042823 return - EFAULT ;
28052824 }
28062825
2826+ if (mrioc -> pci_err_recovery ) {
2827+ ioc_err (mrioc , "%s: pci error recovery in progress!\n" ,
2828+ __func__ );
2829+ return - EFAULT ;
2830+ }
2831+
28072832 data_out_sz = sizeof (struct phy_control_request );
28082833 data_in_sz = sizeof (struct phy_control_reply );
28092834 sz = data_out_sz + data_in_sz ;
@@ -3227,6 +3252,12 @@ mpi3mr_transport_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
32273252 goto out ;
32283253 }
32293254
3255+ if (mrioc -> pci_err_recovery ) {
3256+ ioc_err (mrioc , "%s: pci error recovery in progress!\n" , __func__ );
3257+ rc = - EFAULT ;
3258+ goto out ;
3259+ }
3260+
32303261 rc = mpi3mr_map_smp_buffer (& mrioc -> pdev -> dev , & job -> request_payload ,
32313262 & dma_addr_out , & dma_len_out , & addr_out );
32323263 if (rc )
0 commit comments