diff options
author | Changyuan Lyu <changyuanl@google.com> | 2023-05-26 23:51:55 +0000 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2023-05-31 20:06:53 -0400 |
commit | 4851c39aae3a917d09983e1c6948fa9d749b5448 (patch) | |
tree | 0a0d3c78f9dd28ae591bdfa630c244e3b680aa42 | |
parent | b58b2ba351b07f546a8c1fb4eb46303231c24e95 (diff) | |
download | linux-4851c39aae3a917d09983e1c6948fa9d749b5448.tar.gz linux-4851c39aae3a917d09983e1c6948fa9d749b5448.tar.bz2 linux-4851c39aae3a917d09983e1c6948fa9d749b5448.zip |
scsi: pm80xx: Add fatal error checks
Add fatal error checking for the pm8001_phy_control() and
pm8001_lu_reset() functions.
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
Signed-off-by: Pranav Prasad <pranavpp@google.com>
Link: https://lore.kernel.org/r/20230526235155.433243-1-pranavpp@google.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/pm8001/pm8001_sas.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index e5673c774f66..a5a31dfa4512 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -167,6 +167,17 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, pm8001_ha = sas_phy->ha->lldd_ha; phy = &pm8001_ha->phy[phy_id]; pm8001_ha->phy[phy_id].enable_completion = &completion; + + if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) { + /* + * If the controller is in fatal error state, + * we will not get a response from the controller + */ + pm8001_dbg(pm8001_ha, FAIL, + "Phy control failed due to fatal errors\n"); + return -EFAULT; + } + switch (func) { case PHY_FUNC_SET_LINK_RATE: rates = funcdata; @@ -908,6 +919,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun) struct pm8001_device *pm8001_dev = dev->lldd_dev; struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev); DECLARE_COMPLETION_ONSTACK(completion_setstate); + + if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) { + /* + * If the controller is in fatal error state, + * we will not get a response from the controller + */ + pm8001_dbg(pm8001_ha, FAIL, + "LUN reset failed due to fatal errors\n"); + return rc; + } + if (dev_is_sata(dev)) { struct sas_phy *phy = sas_get_local_phy(dev); sas_execute_internal_abort_dev(dev, 0, NULL); |