Commit 4851c39a authored by Changyuan Lyu's avatar Changyuan Lyu Committed by Martin K. Petersen

scsi: pm80xx: Add fatal error checks

Add fatal error checking for the pm8001_phy_control() and
pm8001_lu_reset() functions.
Signed-off-by: default avatarChangyuan Lyu <changyuanl@google.com>
Signed-off-by: default avatarPranav Prasad <pranavpp@google.com>
Link: https://lore.kernel.org/r/20230526235155.433243-1-pranavpp@google.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b58b2ba3
...@@ -167,6 +167,17 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, ...@@ -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; pm8001_ha = sas_phy->ha->lldd_ha;
phy = &pm8001_ha->phy[phy_id]; phy = &pm8001_ha->phy[phy_id];
pm8001_ha->phy[phy_id].enable_completion = &completion; 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) { switch (func) {
case PHY_FUNC_SET_LINK_RATE: case PHY_FUNC_SET_LINK_RATE:
rates = funcdata; rates = funcdata;
...@@ -908,6 +919,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun) ...@@ -908,6 +919,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
struct pm8001_device *pm8001_dev = dev->lldd_dev; struct pm8001_device *pm8001_dev = dev->lldd_dev;
struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev); struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
DECLARE_COMPLETION_ONSTACK(completion_setstate); 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)) { if (dev_is_sata(dev)) {
struct sas_phy *phy = sas_get_local_phy(dev); struct sas_phy *phy = sas_get_local_phy(dev);
sas_execute_internal_abort_dev(dev, 0, NULL); sas_execute_internal_abort_dev(dev, 0, NULL);
......
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