qla2xxx: Collect PCI register checks and board_disable scheduling
Add an uint16_t variant of qla2x00_check_reg_for_disconnect and use these routines to check and schedule a PCI-disconnected board from a centralized place. Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Acked-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
1a2fbf185c
commit
c821e0d5b2
5 changed files with 20 additions and 27 deletions
|
@ -475,7 +475,8 @@ extern uint8_t *qla25xx_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
|
||||||
extern int qla25xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
|
extern int qla25xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
|
||||||
uint32_t);
|
uint32_t);
|
||||||
extern int qla2x00_is_a_vp_did(scsi_qla_host_t *, uint32_t);
|
extern int qla2x00_is_a_vp_did(scsi_qla_host_t *, uint32_t);
|
||||||
bool qla2x00_check_reg_for_disconnect(scsi_qla_host_t *, uint32_t);
|
bool qla2x00_check_reg32_for_disconnect(scsi_qla_host_t *, uint32_t);
|
||||||
|
bool qla2x00_check_reg16_for_disconnect(scsi_qla_host_t *, uint16_t);
|
||||||
|
|
||||||
extern int qla2x00_beacon_on(struct scsi_qla_host *);
|
extern int qla2x00_beacon_on(struct scsi_qla_host *);
|
||||||
extern int qla2x00_beacon_off(struct scsi_qla_host *);
|
extern int qla2x00_beacon_off(struct scsi_qla_host *);
|
||||||
|
|
|
@ -56,16 +56,8 @@ qla2100_intr_handler(int irq, void *dev_id)
|
||||||
vha = pci_get_drvdata(ha->pdev);
|
vha = pci_get_drvdata(ha->pdev);
|
||||||
for (iter = 50; iter--; ) {
|
for (iter = 50; iter--; ) {
|
||||||
hccr = RD_REG_WORD(®->hccr);
|
hccr = RD_REG_WORD(®->hccr);
|
||||||
/* Check for PCI disconnection */
|
if (qla2x00_check_reg16_for_disconnect(vha, hccr))
|
||||||
if (hccr == 0xffff) {
|
|
||||||
/*
|
|
||||||
* Schedule this on the default system workqueue so that
|
|
||||||
* all the adapter workqueues and the DPC thread can be
|
|
||||||
* shutdown cleanly.
|
|
||||||
*/
|
|
||||||
schedule_work(&ha->board_disable);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
if (hccr & HCCR_RISC_PAUSE) {
|
if (hccr & HCCR_RISC_PAUSE) {
|
||||||
if (pci_channel_offline(ha->pdev))
|
if (pci_channel_offline(ha->pdev))
|
||||||
break;
|
break;
|
||||||
|
@ -121,7 +113,7 @@ qla2100_intr_handler(int irq, void *dev_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
qla2x00_check_reg_for_disconnect(scsi_qla_host_t *vha, uint32_t reg)
|
qla2x00_check_reg32_for_disconnect(scsi_qla_host_t *vha, uint32_t reg)
|
||||||
{
|
{
|
||||||
/* Check for PCI disconnection */
|
/* Check for PCI disconnection */
|
||||||
if (reg == 0xffffffff) {
|
if (reg == 0xffffffff) {
|
||||||
|
@ -136,6 +128,12 @@ qla2x00_check_reg_for_disconnect(scsi_qla_host_t *vha, uint32_t reg)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
qla2x00_check_reg16_for_disconnect(scsi_qla_host_t *vha, uint16_t reg)
|
||||||
|
{
|
||||||
|
return qla2x00_check_reg32_for_disconnect(vha, 0xffff0000 | reg);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qla2300_intr_handler() - Process interrupts for the ISP23xx and ISP63xx.
|
* qla2300_intr_handler() - Process interrupts for the ISP23xx and ISP63xx.
|
||||||
* @irq:
|
* @irq:
|
||||||
|
@ -174,7 +172,7 @@ qla2300_intr_handler(int irq, void *dev_id)
|
||||||
vha = pci_get_drvdata(ha->pdev);
|
vha = pci_get_drvdata(ha->pdev);
|
||||||
for (iter = 50; iter--; ) {
|
for (iter = 50; iter--; ) {
|
||||||
stat = RD_REG_DWORD(®->u.isp2300.host_status);
|
stat = RD_REG_DWORD(®->u.isp2300.host_status);
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, stat))
|
if (qla2x00_check_reg32_for_disconnect(vha, stat))
|
||||||
break;
|
break;
|
||||||
if (stat & HSR_RISC_PAUSED) {
|
if (stat & HSR_RISC_PAUSED) {
|
||||||
if (unlikely(pci_channel_offline(ha->pdev)))
|
if (unlikely(pci_channel_offline(ha->pdev)))
|
||||||
|
@ -2631,7 +2629,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
|
||||||
vha = pci_get_drvdata(ha->pdev);
|
vha = pci_get_drvdata(ha->pdev);
|
||||||
for (iter = 50; iter--; ) {
|
for (iter = 50; iter--; ) {
|
||||||
stat = RD_REG_DWORD(®->host_status);
|
stat = RD_REG_DWORD(®->host_status);
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, stat))
|
if (qla2x00_check_reg32_for_disconnect(vha, stat))
|
||||||
break;
|
break;
|
||||||
if (stat & HSRX_RISC_PAUSED) {
|
if (stat & HSRX_RISC_PAUSED) {
|
||||||
if (unlikely(pci_channel_offline(ha->pdev)))
|
if (unlikely(pci_channel_offline(ha->pdev)))
|
||||||
|
@ -2721,7 +2719,7 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
|
||||||
* we process the response queue.
|
* we process the response queue.
|
||||||
*/
|
*/
|
||||||
stat = RD_REG_DWORD(®->host_status);
|
stat = RD_REG_DWORD(®->host_status);
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, stat))
|
if (qla2x00_check_reg32_for_disconnect(vha, stat))
|
||||||
goto out;
|
goto out;
|
||||||
qla24xx_process_response_queue(vha, rsp);
|
qla24xx_process_response_queue(vha, rsp);
|
||||||
if (!ha->flags.disable_msix_handshake) {
|
if (!ha->flags.disable_msix_handshake) {
|
||||||
|
@ -2761,7 +2759,7 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
|
||||||
hccr = RD_REG_DWORD_RELAXED(®->hccr);
|
hccr = RD_REG_DWORD_RELAXED(®->hccr);
|
||||||
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
||||||
}
|
}
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, hccr))
|
if (qla2x00_check_reg32_for_disconnect(vha, hccr))
|
||||||
goto out;
|
goto out;
|
||||||
queue_work_on((int) (rsp->id - 1), ha->wq, &rsp->q_work);
|
queue_work_on((int) (rsp->id - 1), ha->wq, &rsp->q_work);
|
||||||
|
|
||||||
|
@ -2796,7 +2794,7 @@ qla24xx_msix_default(int irq, void *dev_id)
|
||||||
vha = pci_get_drvdata(ha->pdev);
|
vha = pci_get_drvdata(ha->pdev);
|
||||||
do {
|
do {
|
||||||
stat = RD_REG_DWORD(®->host_status);
|
stat = RD_REG_DWORD(®->host_status);
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, stat))
|
if (qla2x00_check_reg32_for_disconnect(vha, stat))
|
||||||
break;
|
break;
|
||||||
if (stat & HSRX_RISC_PAUSED) {
|
if (stat & HSRX_RISC_PAUSED) {
|
||||||
if (unlikely(pci_channel_offline(ha->pdev)))
|
if (unlikely(pci_channel_offline(ha->pdev)))
|
||||||
|
|
|
@ -2924,7 +2924,7 @@ qlafx00_intr_handler(int irq, void *dev_id)
|
||||||
vha = pci_get_drvdata(ha->pdev);
|
vha = pci_get_drvdata(ha->pdev);
|
||||||
for (iter = 50; iter--; clr_intr = 0) {
|
for (iter = 50; iter--; clr_intr = 0) {
|
||||||
stat = QLAFX00_RD_INTR_REG(ha);
|
stat = QLAFX00_RD_INTR_REG(ha);
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, stat))
|
if (qla2x00_check_reg32_for_disconnect(vha, stat))
|
||||||
break;
|
break;
|
||||||
intr_stat = stat & QLAFX00_HST_INT_STS_BITS;
|
intr_stat = stat & QLAFX00_HST_INT_STS_BITS;
|
||||||
if (!intr_stat)
|
if (!intr_stat)
|
||||||
|
|
|
@ -2123,7 +2123,7 @@ qla82xx_msix_default(int irq, void *dev_id)
|
||||||
vha = pci_get_drvdata(ha->pdev);
|
vha = pci_get_drvdata(ha->pdev);
|
||||||
do {
|
do {
|
||||||
host_int = RD_REG_DWORD(®->host_int);
|
host_int = RD_REG_DWORD(®->host_int);
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, host_int))
|
if (qla2x00_check_reg32_for_disconnect(vha, host_int))
|
||||||
break;
|
break;
|
||||||
if (host_int) {
|
if (host_int) {
|
||||||
stat = RD_REG_DWORD(®->host_status);
|
stat = RD_REG_DWORD(®->host_status);
|
||||||
|
@ -2184,7 +2184,7 @@ qla82xx_msix_rsp_q(int irq, void *dev_id)
|
||||||
spin_lock_irqsave(&ha->hardware_lock, flags);
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
||||||
vha = pci_get_drvdata(ha->pdev);
|
vha = pci_get_drvdata(ha->pdev);
|
||||||
host_int = RD_REG_DWORD(®->host_int);
|
host_int = RD_REG_DWORD(®->host_int);
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, host_int))
|
if (qla2x00_check_reg32_for_disconnect(vha, host_int))
|
||||||
goto out;
|
goto out;
|
||||||
qla24xx_process_response_queue(vha, rsp);
|
qla24xx_process_response_queue(vha, rsp);
|
||||||
WRT_REG_DWORD(®->host_int, 0);
|
WRT_REG_DWORD(®->host_int, 0);
|
||||||
|
@ -2219,7 +2219,7 @@ qla82xx_poll(int irq, void *dev_id)
|
||||||
vha = pci_get_drvdata(ha->pdev);
|
vha = pci_get_drvdata(ha->pdev);
|
||||||
|
|
||||||
host_int = RD_REG_DWORD(®->host_int);
|
host_int = RD_REG_DWORD(®->host_int);
|
||||||
if (qla2x00_check_reg_for_disconnect(vha, host_int))
|
if (qla2x00_check_reg32_for_disconnect(vha, host_int))
|
||||||
goto out;
|
goto out;
|
||||||
if (host_int) {
|
if (host_int) {
|
||||||
stat = RD_REG_DWORD(®->host_status);
|
stat = RD_REG_DWORD(®->host_status);
|
||||||
|
|
|
@ -5183,13 +5183,7 @@ qla2x00_timer(scsi_qla_host_t *vha)
|
||||||
*/
|
*/
|
||||||
if (!pci_channel_offline(ha->pdev)) {
|
if (!pci_channel_offline(ha->pdev)) {
|
||||||
pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
|
pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
|
||||||
if (w == 0xffff)
|
qla2x00_check_reg16_for_disconnect(vha, w);
|
||||||
/*
|
|
||||||
* Schedule this on the default system workqueue so that
|
|
||||||
* all the adapter workqueues and the DPC thread can be
|
|
||||||
* shutdown cleanly.
|
|
||||||
*/
|
|
||||||
schedule_work(&ha->board_disable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure qla82xx_watchdog is run only for physical port */
|
/* Make sure qla82xx_watchdog is run only for physical port */
|
||||||
|
|
Loading…
Add table
Reference in a new issue