diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2023-09-22 04:44:12 +0300 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2023-09-22 04:44:12 +0300 |
commit | fe15880f317348ba9e81c46f270d1c1ee0002e8e (patch) | |
tree | ab44a7af7f67655724ce2f54672626846382027a /drivers/scsi/pm8001/pm80xx_hwi.c | |
parent | 17d11949827375d74bdf5df18c3f5813ee7d5933 (diff) | |
parent | 80975adc79dde8985f4ea68fe0b158bc8a913580 (diff) | |
download | linux-fe15880f317348ba9e81c46f270d1c1ee0002e8e.tar.xz |
Merge patch series "scsi: pm8001: Bug fix and cleanup"
Damien Le Moal <dlemoal@kernel.org> says:
The first patch of this series fixes an issue with IRQ setup which
prevents the controller from resuming after a system suspend. The
following patches are code cleanup without any functional changes.
[mkp: The first patch went into v6.6-rc2 and thus this merge
constitutes the remaining patches of the series]
Link: https://lore.kernel.org/r/20230911232745.325149-1-dlemoal@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/pm8001/pm80xx_hwi.c')
-rw-r--r-- | drivers/scsi/pm8001/pm80xx_hwi.c | 63 |
1 files changed, 22 insertions, 41 deletions
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index f6857632dc7c..a52ae6841939 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -1715,27 +1715,6 @@ static void pm80xx_hw_chip_rst(struct pm8001_hba_info *pm8001_ha) } /** - * pm80xx_chip_intx_interrupt_enable - enable PM8001 chip interrupt - * @pm8001_ha: our hba card information - */ -static void -pm80xx_chip_intx_interrupt_enable(struct pm8001_hba_info *pm8001_ha) -{ - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_CLEAR_ALL); - pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, ODCR_CLEAR_ALL); -} - -/** - * pm80xx_chip_intx_interrupt_disable - disable PM8001 chip interrupt - * @pm8001_ha: our hba card information - */ -static void -pm80xx_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha) -{ - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR, ODMR_MASK_ALL); -} - -/** * pm80xx_chip_interrupt_enable - enable PM8001 chip interrupt * @pm8001_ha: our hba card information * @vec: interrupt number to enable @@ -1743,16 +1722,16 @@ pm80xx_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha) static void pm80xx_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec) { -#ifdef PM8001_USE_MSIX + if (!pm8001_ha->use_msix) { + pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_CLEAR_ALL); + pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, ODCR_CLEAR_ALL); + return; + } + if (vec < 32) pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR, 1U << vec); else - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR_U, - 1U << (vec - 32)); - return; -#endif - pm80xx_chip_intx_interrupt_enable(pm8001_ha); - + pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR_U, 1U << (vec - 32)); } /** @@ -1763,19 +1742,20 @@ pm80xx_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec) static void pm80xx_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec) { -#ifdef PM8001_USE_MSIX + if (!pm8001_ha->use_msix) { + pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR, ODMR_MASK_ALL); + return; + } + if (vec == 0xFF) { /* disable all vectors 0-31, 32-63 */ pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, 0xFFFFFFFF); pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_U, 0xFFFFFFFF); - } else if (vec < 32) + } else if (vec < 32) { pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, 1U << vec); - else - pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_U, - 1U << (vec - 32)); - return; -#endif - pm80xx_chip_intx_interrupt_disable(pm8001_ha); + } else { + pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_U, 1U << (vec - 32)); + } } /** @@ -3671,10 +3651,12 @@ static int mpi_set_controller_config_resp(struct pm8001_hba_info *pm8001_ha, (struct set_ctrl_cfg_resp *)(piomb + 4); u32 status = le32_to_cpu(pPayload->status); u32 err_qlfr_pgcd = le32_to_cpu(pPayload->err_qlfr_pgcd); + u32 tag = le32_to_cpu(pPayload->tag); pm8001_dbg(pm8001_ha, MSG, "SET CONTROLLER RESP: status 0x%x qlfr_pgcd 0x%x\n", status, err_qlfr_pgcd); + pm8001_tag_free(pm8001_ha, tag); return 0; } @@ -4671,7 +4653,7 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) payload.sas_identify.dev_type = SAS_END_DEVICE; payload.sas_identify.initiator_bits = SAS_PROTOCOL_ALL; memcpy(payload.sas_identify.sas_addr, - &pm8001_ha->sas_addr, SAS_ADDR_SIZE); + &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE); payload.sas_identify.phy_id = phy_id; return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, @@ -4800,16 +4782,15 @@ static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha, static u32 pm80xx_chip_is_our_interrupt(struct pm8001_hba_info *pm8001_ha) { -#ifdef PM8001_USE_MSIX - return 1; -#else u32 value; + if (pm8001_ha->use_msix) + return 1; + value = pm8001_cr32(pm8001_ha, 0, MSGU_ODR); if (value) return 1; return 0; -#endif } /** |