From: Chad Dupuis <cdupuis@redhat.com> Date: Fri, 10 Dec 2010 18:55:15 -0500 Subject: [scsi] qla4xxx: make get_sys_info function return void Message-id: <20101210185514.7449.46792.sendpatchset@localhost.localdomain> Patchwork-id: 30080 O-Subject: [RHEL 5.6 PATCH 3/4] qla4xxx: change the get_sys_info function to return void. Bugzilla: 656999 Bugzilla -------- Bug 656999 (https://bugzilla.redhat.com/show_bug.cgi?id=656999) Upstream Status --------------- Will be pushed upstream with our next patch submission. Description ----------- >From 5fcd0e369c681798915adc37b3b4166fb593c09a Mon Sep 17 00:00:00 2001 From: Prasanna Mumbai <prasanna.mumbai@qlogic.com> Date: Thu, 9 Dec 2010 21:51:42 -0800 Subject: [PATCH 3/4] qla4xxx: change the get_sys_info function to return void. - Change the get_sys_info to return void. - Check for device state before sending a mailbox commmand & doing reset. Signed-off-by: Prasanna Mumbai <prasanna.mumbai@qlogic.com> diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index 8a2ef45..95d942e 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h @@ -341,7 +341,7 @@ struct isp_operations { void (*complete_iocb) (struct scsi_qla_host *); uint16_t (*rd_shdw_req_q_out) (struct scsi_qla_host *); uint16_t (*rd_shdw_rsp_q_in) (struct scsi_qla_host *); - int (*get_sys_info) (struct scsi_qla_host *); + void (*get_sys_info) (struct scsi_qla_host *); }; /* diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h index 42599ba..00e68a2 100644 --- a/drivers/scsi/qla4xxx/ql4_glbl.h +++ b/drivers/scsi/qla4xxx/ql4_glbl.h @@ -86,7 +86,7 @@ extern void qla4xxx_queue_iocb(struct scsi_qla_host *ha); extern void qla4xxx_complete_iocb(struct scsi_qla_host *ha); void qla4xxx_mailbox_premature_completion(struct scsi_qla_host *ha); void qla4xxx_dump_registers(struct scsi_qla_host *ha); -int qla4xxx_get_sys_info(struct scsi_qla_host *ha); +void qla4xxx_get_sys_info(struct scsi_qla_host *ha); extern int qla4xxx_iospace_config(struct scsi_qla_host *ha); extern void qla4xxx_pci_config(struct scsi_qla_host *ha); extern uint32_t *qla4xxx_isp_mbx_out(struct scsi_qla_host *ha); @@ -139,7 +139,7 @@ extern uint16_t qla4xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha); extern uint16_t qla4_8xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha); extern uint16_t qla4_8xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha); void qla4_8xxx_interrupt_service_routine(struct scsi_qla_host *ha, uint32_t intr_status); -int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha); +void qla4_8xxx_get_sys_info(struct scsi_qla_host *ha); void qla4_8xxx_init_local_data(struct scsi_qla_host *ha); void qla4_8xxx_watchdog(struct scsi_qla_host *ha); int qla4_8xxx_stop_firmware(struct scsi_qla_host *ha); diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index fed730a..b04b51c 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c @@ -165,11 +165,10 @@ int qla4xxx_init_rings(struct scsi_qla_host *ha) * @ha: pointer to host adapter structure. * **/ -int qla4xxx_get_sys_info(struct scsi_qla_host *ha) +void qla4xxx_get_sys_info(struct scsi_qla_host *ha) { struct flash_sys_info *sys_info; dma_addr_t sys_info_dma; - int status = QLA_ERROR; sys_info = dma_alloc_coherent(&ha->pdev->dev, sizeof(*sys_info), &sys_info_dma, GFP_KERNEL); @@ -198,14 +197,17 @@ int qla4xxx_get_sys_info(struct scsi_qla_host *ha) min(sizeof(ha->serial_number), sizeof(sys_info->acSerialNumber))); - status = QLA_SUCCESS; exit_sys_info_free: dma_free_coherent(&ha->pdev->dev, sizeof(*sys_info), sys_info, sys_info_dma); exit_get_sys_info: - return status; + dev_info(&ha->pdev->dev, "%s: mac %02x:%02x:%02x:%02x:%02x:%02x " + "serial %s\n", __func__, ha->my_mac[0], ha->my_mac[1], + ha->my_mac[2], ha->my_mac[3], ha->my_mac[4], ha->my_mac[5], + ha->serial_number); + return; } /** @@ -1375,8 +1377,7 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, if (qla4xxx_get_fw_version(ha) == QLA_ERROR) goto exit_init_hba; - if (ha->isp_ops->get_sys_info(ha) == QLA_ERROR) - goto exit_init_hba; + ha->isp_ops->get_sys_info(ha); if (qla4xxx_init_local_data(ha) == QLA_ERROR) goto exit_init_hba; diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index d3b99c7..70d9c4c 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c @@ -33,6 +33,7 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, u_long wait_count; uint32_t intr_status; unsigned long flags = 0; + uint32_t dev_state; /* Make sure that pointers are valid */ if (!mbx_cmd || !mbx_sts) { @@ -51,6 +52,16 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, } if (is_qla8022(ha)) { + qla4_8xxx_idc_lock(ha); + dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE); + qla4_8xxx_idc_unlock(ha); + if (dev_state == QLA82XX_DEV_FAILED) { + dev_info(&ha->pdev->dev, "%s: don't retry " + "adapter init. H/W is in Failed state\n", + __func__); + goto mbox_exit_status; + } + if (test_bit(AF_FW_RECOVERY, &ha->flags)) { DEBUG2(printk("scsi%ld: %s: prematurely complete mbx " " cmd as firmware recovery detected\n", diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c index da57107..8d383b4 100644 --- a/drivers/scsi/qla4xxx/ql4_nx.c +++ b/drivers/scsi/qla4xxx/ql4_nx.c @@ -2215,20 +2215,19 @@ qla4_8xxx_isp_reset(struct scsi_qla_host *ha) * @ha: pointer to host adapter structure. * **/ -int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha) +void qla4_8xxx_get_sys_info(struct scsi_qla_host *ha) { uint32_t mbox_cmd[MBOX_REG_COUNT]; uint32_t mbox_sts[MBOX_REG_COUNT]; struct mbx_sys_info *sys_info; dma_addr_t sys_info_dma; - int status = QLA_ERROR; sys_info = dma_alloc_coherent(&ha->pdev->dev, sizeof(*sys_info), &sys_info_dma, GFP_KERNEL); if (sys_info == NULL) { DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n", ha->host_no, __func__)); - return status; + goto exit_get_sys_info; } memset(sys_info, 0, sizeof(*sys_info)); @@ -2268,12 +2267,18 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha) ha->my_mac[3], ha->my_mac[4], ha->my_mac[5], ha->serial_number)); - status = QLA_SUCCESS; exit_sys_info_free: dma_free_coherent(&ha->pdev->dev, sizeof(*sys_info), sys_info, sys_info_dma); - return status; + +exit_get_sys_info: + dev_info(&ha->pdev->dev, "%s: mac %02x:%02x:%02x:%02x:%02x:%02x " + "serial %s\n", __func__, + ha->my_mac[0], ha->my_mac[1], ha->my_mac[2], + ha->my_mac[3], ha->my_mac[4], ha->my_mac[5], + ha->serial_number); + return; } /* Interrupt handling helpers. */ diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 6088ff4..bdde44e 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -1839,6 +1839,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, struct ddb_entry *ddb_entry, *ddbtemp; uint8_t i; char buf[34]; + uint32_t dev_state; if (pci_enable_device(pdev)) return -1; @@ -1930,6 +1931,16 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, (void) qla4xxx_initialize_adapter(ha, REBUILD_DDB_LIST); for (i = 1; !test_bit(AF_ONLINE, &ha->flags) && i <= MAX_INIT_RETRIES; i++) { + qla4_8xxx_idc_lock(ha); + dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE); + qla4_8xxx_idc_unlock(ha); + if (dev_state == QLA82XX_DEV_FAILED) { + dev_info(&ha->pdev->dev, "%s: don't retry " + "adapter init. H/W is in Failed state\n", + __func__); + break; + } + DEBUG2(dev_info(&ha->pdev->dev, "%s: retry adapter init %d\n", __func__, i));