Commit 32a93100 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Stop adapter if pci errors detected

In a couple of cases, the driver detected a pci error (via pci device state
or via failed register reads) but didn't take any action to disable the
device.  Additionally, the driver is ignoring the status of pci
configuration space reads.

Having the driver take the adapter offline whenever the pci error is
detected.  Pay attention to pci_config_space_read status and return failure
if an error is seen.
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 731eedcb
...@@ -1844,8 +1844,12 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) ...@@ -1844,8 +1844,12 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba)
/* If the pci channel is offline, ignore possible errors, since /* If the pci channel is offline, ignore possible errors, since
* we cannot communicate with the pci card anyway. * we cannot communicate with the pci card anyway.
*/ */
if (pci_channel_offline(phba->pcidev)) if (pci_channel_offline(phba->pcidev)) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"3166 pci channel is offline\n");
lpfc_sli4_offline_eratt(phba);
return; return;
}
memset(&portsmphr_reg, 0, sizeof(portsmphr_reg)); memset(&portsmphr_reg, 0, sizeof(portsmphr_reg));
if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf);
...@@ -1922,6 +1926,7 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) ...@@ -1922,6 +1926,7 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba)
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"3151 PCI bus read access failure: x%x\n", "3151 PCI bus read access failure: x%x\n",
readl(phba->sli4_hba.u.if_type2.STATUSregaddr)); readl(phba->sli4_hba.u.if_type2.STATUSregaddr));
lpfc_sli4_offline_eratt(phba);
return; return;
} }
reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr);
......
...@@ -4487,7 +4487,9 @@ lpfc_sli_brdreset(struct lpfc_hba *phba) ...@@ -4487,7 +4487,9 @@ lpfc_sli_brdreset(struct lpfc_hba *phba)
} }
/* Turn off parity checking and serr during the physical reset */ /* Turn off parity checking and serr during the physical reset */
pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value); if (pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value))
return -EIO;
pci_write_config_word(phba->pcidev, PCI_COMMAND, pci_write_config_word(phba->pcidev, PCI_COMMAND,
(cfg_value & (cfg_value &
~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR))); ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR)));
...@@ -4564,7 +4566,12 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba) ...@@ -4564,7 +4566,12 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba)
"0389 Performing PCI function reset!\n"); "0389 Performing PCI function reset!\n");
/* Turn off parity checking and serr during the physical reset */ /* Turn off parity checking and serr during the physical reset */
pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value); if (pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value)) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
"3205 PCI read Config failed\n");
return -EIO;
}
pci_write_config_word(phba->pcidev, PCI_COMMAND, (cfg_value & pci_write_config_word(phba->pcidev, PCI_COMMAND, (cfg_value &
~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR))); ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment