diff options
author | Xiaofei Tan <tanxiaofei@huawei.com> | 2017-10-24 23:51:42 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2017-10-31 12:27:58 -0400 |
commit | 0e3231fc930b25a6db5cf709457c2221d520edf9 (patch) | |
tree | 0f486ecc49a7d9274b0f182ec45408e669527a7b /drivers/scsi/hisi_sas | |
parent | 729428ca906140a59d94768ac8c8d7a8494c064b (diff) | |
download | linux-0e3231fc930b25a6db5cf709457c2221d520edf9.tar.bz2 |
scsi: hisi_sas: check PHY state in get_wideport_bitmap_v3_hw()
We should check register PHY_STATE when getting the bitmap of a
wideport, as, if the PHY is not ready, the value of register
PHY_PORT_NUM_MA is not valid.
V2 hw has done this check, and v3 hw should do this check too.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/hisi_sas')
-rw-r--r-- | drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 67ebd8f6f84a..c88e787325bb 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -755,10 +755,12 @@ static int get_wideport_bitmap_v3_hw(struct hisi_hba *hisi_hba, int port_id) { int i, bitmap = 0; u32 phy_port_num_ma = hisi_sas_read32(hisi_hba, PHY_PORT_NUM_MA); + u32 phy_state = hisi_sas_read32(hisi_hba, PHY_STATE); for (i = 0; i < hisi_hba->n_phy; i++) - if (((phy_port_num_ma >> (i * 4)) & 0xf) == port_id) - bitmap |= 1 << i; + if (phy_state & BIT(i)) + if (((phy_port_num_ma >> (i * 4)) & 0xf) == port_id) + bitmap |= BIT(i); return bitmap; } |