ql4_os.c (da106212cbec2f4c96543d66fd24958b72b67ab1) | ql4_os.c (f8086f4fd462195a5a824c851997bd12ffceae00) |
---|---|
1/* 2 * QLogic iSCSI HBA Driver 3 * Copyright (c) 2003-2010 QLogic Corporation 4 * 5 * See LICENSE.qla4xxx for copyright and licensing details. 6 */ 7#include <linux/moduleparam.h> 8#include <linux/slab.h> --- 2406 unchanged lines hidden (view full) --- 2415 * 2416 * Note: The caller should not hold the idc lock. 2417 **/ 2418static int qla4_8xxx_check_temp(struct scsi_qla_host *ha) 2419{ 2420 uint32_t temp, temp_state, temp_val; 2421 int status = QLA_SUCCESS; 2422 | 1/* 2 * QLogic iSCSI HBA Driver 3 * Copyright (c) 2003-2010 QLogic Corporation 4 * 5 * See LICENSE.qla4xxx for copyright and licensing details. 6 */ 7#include <linux/moduleparam.h> 8#include <linux/slab.h> --- 2406 unchanged lines hidden (view full) --- 2415 * 2416 * Note: The caller should not hold the idc lock. 2417 **/ 2418static int qla4_8xxx_check_temp(struct scsi_qla_host *ha) 2419{ 2420 uint32_t temp, temp_state, temp_val; 2421 int status = QLA_SUCCESS; 2422 |
2423 temp = qla4_8xxx_rd_32(ha, CRB_TEMP_STATE); | 2423 temp = qla4_82xx_rd_32(ha, CRB_TEMP_STATE); |
2424 2425 temp_state = qla82xx_get_temp_state(temp); 2426 temp_val = qla82xx_get_temp_val(temp); 2427 2428 if (temp_state == QLA82XX_TEMP_PANIC) { 2429 ql4_printk(KERN_WARNING, ha, "Device temperature %d degrees C" 2430 " exceeds maximum allowed. Hardware has been shut" 2431 " down.\n", temp_val); --- 19 unchanged lines hidden (view full) --- 2451 * 2452 * Context: Interrupt 2453 **/ 2454static int qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha) 2455{ 2456 uint32_t fw_heartbeat_counter; 2457 int status = QLA_SUCCESS; 2458 | 2424 2425 temp_state = qla82xx_get_temp_state(temp); 2426 temp_val = qla82xx_get_temp_val(temp); 2427 2428 if (temp_state == QLA82XX_TEMP_PANIC) { 2429 ql4_printk(KERN_WARNING, ha, "Device temperature %d degrees C" 2430 " exceeds maximum allowed. Hardware has been shut" 2431 " down.\n", temp_val); --- 19 unchanged lines hidden (view full) --- 2451 * 2452 * Context: Interrupt 2453 **/ 2454static int qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha) 2455{ 2456 uint32_t fw_heartbeat_counter; 2457 int status = QLA_SUCCESS; 2458 |
2459 fw_heartbeat_counter = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); | 2459 fw_heartbeat_counter = qla4_82xx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); |
2460 /* If PEG_ALIVE_COUNTER is 0xffffffff, AER/EEH is in progress, ignore */ 2461 if (fw_heartbeat_counter == 0xffffffff) { 2462 DEBUG2(printk(KERN_WARNING "scsi%ld: %s: Device in frozen " 2463 "state, QLA82XX_PEG_ALIVE_COUNTER is 0xffffffff\n", 2464 ha->host_no, __func__)); 2465 return status; 2466 } 2467 --- 5 unchanged lines hidden (view full) --- 2473 2474 ql4_printk(KERN_INFO, ha, 2475 "scsi(%ld): %s, Dumping hw/fw registers:\n " 2476 " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2:" 2477 " 0x%x,\n PEG_NET_0_PC: 0x%x, PEG_NET_1_PC:" 2478 " 0x%x,\n PEG_NET_2_PC: 0x%x, PEG_NET_3_PC:" 2479 " 0x%x,\n PEG_NET_4_PC: 0x%x\n", 2480 ha->host_no, __func__, | 2460 /* If PEG_ALIVE_COUNTER is 0xffffffff, AER/EEH is in progress, ignore */ 2461 if (fw_heartbeat_counter == 0xffffffff) { 2462 DEBUG2(printk(KERN_WARNING "scsi%ld: %s: Device in frozen " 2463 "state, QLA82XX_PEG_ALIVE_COUNTER is 0xffffffff\n", 2464 ha->host_no, __func__)); 2465 return status; 2466 } 2467 --- 5 unchanged lines hidden (view full) --- 2473 2474 ql4_printk(KERN_INFO, ha, 2475 "scsi(%ld): %s, Dumping hw/fw registers:\n " 2476 " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2:" 2477 " 0x%x,\n PEG_NET_0_PC: 0x%x, PEG_NET_1_PC:" 2478 " 0x%x,\n PEG_NET_2_PC: 0x%x, PEG_NET_3_PC:" 2479 " 0x%x,\n PEG_NET_4_PC: 0x%x\n", 2480 ha->host_no, __func__, |
2481 qla4_8xxx_rd_32(ha, | 2481 qla4_82xx_rd_32(ha, |
2482 QLA82XX_PEG_HALT_STATUS1), | 2482 QLA82XX_PEG_HALT_STATUS1), |
2483 qla4_8xxx_rd_32(ha, | 2483 qla4_82xx_rd_32(ha, |
2484 QLA82XX_PEG_HALT_STATUS2), | 2484 QLA82XX_PEG_HALT_STATUS2), |
2485 qla4_8xxx_rd_32(ha, QLA82XX_CRB_PEG_NET_0 + | 2485 qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_0 + |
2486 0x3c), | 2486 0x3c), |
2487 qla4_8xxx_rd_32(ha, QLA82XX_CRB_PEG_NET_1 + | 2487 qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_1 + |
2488 0x3c), | 2488 0x3c), |
2489 qla4_8xxx_rd_32(ha, QLA82XX_CRB_PEG_NET_2 + | 2489 qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_2 + |
2490 0x3c), | 2490 0x3c), |
2491 qla4_8xxx_rd_32(ha, QLA82XX_CRB_PEG_NET_3 + | 2491 qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_3 + |
2492 0x3c), | 2492 0x3c), |
2493 qla4_8xxx_rd_32(ha, QLA82XX_CRB_PEG_NET_4 + | 2493 qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_4 + |
2494 0x3c)); 2495 status = QLA_ERROR; 2496 } 2497 } else 2498 ha->seconds_since_last_heartbeat = 0; 2499 2500 ha->fw_heartbeat_counter = fw_heartbeat_counter; 2501 return status; --- 8 unchanged lines hidden (view full) --- 2510void qla4_8xxx_watchdog(struct scsi_qla_host *ha) 2511{ 2512 uint32_t dev_state, halt_status; 2513 2514 /* don't poll if reset is going on */ 2515 if (!(test_bit(DPC_RESET_ACTIVE, &ha->dpc_flags) || 2516 test_bit(DPC_RESET_HA, &ha->dpc_flags) || 2517 test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags))) { | 2494 0x3c)); 2495 status = QLA_ERROR; 2496 } 2497 } else 2498 ha->seconds_since_last_heartbeat = 0; 2499 2500 ha->fw_heartbeat_counter = fw_heartbeat_counter; 2501 return status; --- 8 unchanged lines hidden (view full) --- 2510void qla4_8xxx_watchdog(struct scsi_qla_host *ha) 2511{ 2512 uint32_t dev_state, halt_status; 2513 2514 /* don't poll if reset is going on */ 2515 if (!(test_bit(DPC_RESET_ACTIVE, &ha->dpc_flags) || 2516 test_bit(DPC_RESET_HA, &ha->dpc_flags) || 2517 test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags))) { |
2518 dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE); | 2518 dev_state = qla4_82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); |
2519 2520 if (qla4_8xxx_check_temp(ha)) { 2521 ql4_printk(KERN_INFO, ha, "disabling pause" 2522 " transmit on port 0 & 1.\n"); | 2519 2520 if (qla4_8xxx_check_temp(ha)) { 2521 ql4_printk(KERN_INFO, ha, "disabling pause" 2522 " transmit on port 0 & 1.\n"); |
2523 qla4_8xxx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, | 2523 qla4_82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, |
2524 CRB_NIU_XG_PAUSE_CTL_P0 | 2525 CRB_NIU_XG_PAUSE_CTL_P1); 2526 set_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags); 2527 qla4xxx_wake_dpc(ha); 2528 } else if (dev_state == QLA82XX_DEV_NEED_RESET && 2529 !test_bit(DPC_RESET_HA, &ha->dpc_flags)) { 2530 if (!ql4xdontresethba) { 2531 ql4_printk(KERN_INFO, ha, "%s: HW State: " --- 7 unchanged lines hidden (view full) --- 2539 __func__); 2540 set_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags); 2541 qla4xxx_wake_dpc(ha); 2542 } else { 2543 /* Check firmware health */ 2544 if (qla4_8xxx_check_fw_alive(ha)) { 2545 ql4_printk(KERN_INFO, ha, "disabling pause" 2546 " transmit on port 0 & 1.\n"); | 2524 CRB_NIU_XG_PAUSE_CTL_P0 | 2525 CRB_NIU_XG_PAUSE_CTL_P1); 2526 set_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags); 2527 qla4xxx_wake_dpc(ha); 2528 } else if (dev_state == QLA82XX_DEV_NEED_RESET && 2529 !test_bit(DPC_RESET_HA, &ha->dpc_flags)) { 2530 if (!ql4xdontresethba) { 2531 ql4_printk(KERN_INFO, ha, "%s: HW State: " --- 7 unchanged lines hidden (view full) --- 2539 __func__); 2540 set_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags); 2541 qla4xxx_wake_dpc(ha); 2542 } else { 2543 /* Check firmware health */ 2544 if (qla4_8xxx_check_fw_alive(ha)) { 2545 ql4_printk(KERN_INFO, ha, "disabling pause" 2546 " transmit on port 0 & 1.\n"); |
2547 qla4_8xxx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, | 2547 qla4_82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, |
2548 CRB_NIU_XG_PAUSE_CTL_P0 | 2549 CRB_NIU_XG_PAUSE_CTL_P1); | 2548 CRB_NIU_XG_PAUSE_CTL_P0 | 2549 CRB_NIU_XG_PAUSE_CTL_P1); |
2550 halt_status = qla4_8xxx_rd_32(ha, | 2550 halt_status = qla4_82xx_rd_32(ha, |
2551 QLA82XX_PEG_HALT_STATUS1); 2552 2553 if (QLA82XX_FWERROR_CODE(halt_status) == 0x67) 2554 ql4_printk(KERN_ERR, ha, "%s:" 2555 " Firmware aborted with" 2556 " error code 0x00006700." 2557 " Device is being reset\n", 2558 __func__); --- 476 unchanged lines hidden (view full) --- 3035 if (!test_bit(AF_ONLINE, &ha->flags) && 3036 !test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { 3037 /* Adapter initialization failed, see if we can retry 3038 * resetting the ha. 3039 * Since we don't want to block the DPC for too long 3040 * with multiple resets in the same thread, 3041 * utilize DPC to retry */ 3042 if (is_qla8022(ha)) { | 2551 QLA82XX_PEG_HALT_STATUS1); 2552 2553 if (QLA82XX_FWERROR_CODE(halt_status) == 0x67) 2554 ql4_printk(KERN_ERR, ha, "%s:" 2555 " Firmware aborted with" 2556 " error code 0x00006700." 2557 " Device is being reset\n", 2558 __func__); --- 476 unchanged lines hidden (view full) --- 3035 if (!test_bit(AF_ONLINE, &ha->flags) && 3036 !test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { 3037 /* Adapter initialization failed, see if we can retry 3038 * resetting the ha. 3039 * Since we don't want to block the DPC for too long 3040 * with multiple resets in the same thread, 3041 * utilize DPC to retry */ 3042 if (is_qla8022(ha)) { |
3043 qla4_8xxx_idc_lock(ha); 3044 dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE); 3045 qla4_8xxx_idc_unlock(ha); | 3043 qla4_82xx_idc_lock(ha); 3044 dev_state = qla4_82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); 3045 qla4_82xx_idc_unlock(ha); |
3046 if (dev_state == QLA82XX_DEV_FAILED) { 3047 ql4_printk(KERN_INFO, ha, "%s: don't retry " 3048 "recover adapter. H/W is in Failed " 3049 "state\n", __func__); 3050 qla4xxx_dead_adapter_cleanup(ha); 3051 clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags); 3052 clear_bit(DPC_RESET_HA, &ha->dpc_flags); 3053 clear_bit(DPC_RESET_HA_FW_CONTEXT, --- 326 unchanged lines hidden (view full) --- 3380 return; 3381 } 3382 3383 /* post events to application */ 3384 qla4xxx_do_work(ha); 3385 3386 if (is_qla8022(ha)) { 3387 if (test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags)) { | 3046 if (dev_state == QLA82XX_DEV_FAILED) { 3047 ql4_printk(KERN_INFO, ha, "%s: don't retry " 3048 "recover adapter. H/W is in Failed " 3049 "state\n", __func__); 3050 qla4xxx_dead_adapter_cleanup(ha); 3051 clear_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags); 3052 clear_bit(DPC_RESET_HA, &ha->dpc_flags); 3053 clear_bit(DPC_RESET_HA_FW_CONTEXT, --- 326 unchanged lines hidden (view full) --- 3380 return; 3381 } 3382 3383 /* post events to application */ 3384 qla4xxx_do_work(ha); 3385 3386 if (is_qla8022(ha)) { 3387 if (test_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags)) { |
3388 qla4_8xxx_idc_lock(ha); 3389 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 3388 qla4_82xx_idc_lock(ha); 3389 qla4_82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
3390 QLA82XX_DEV_FAILED); | 3390 QLA82XX_DEV_FAILED); |
3391 qla4_8xxx_idc_unlock(ha); | 3391 qla4_82xx_idc_unlock(ha); |
3392 ql4_printk(KERN_INFO, ha, "HW State: FAILED\n"); 3393 qla4_8xxx_device_state_handler(ha); 3394 } 3395 if (test_and_clear_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags)) { 3396 qla4_8xxx_need_qsnt_handler(ha); 3397 } 3398 } 3399 --- 107 unchanged lines hidden (view full) --- 3507 /* Kill the kernel thread for this host */ 3508 if (ha->task_wq) 3509 destroy_workqueue(ha->task_wq); 3510 3511 /* Put firmware in known state */ 3512 ha->isp_ops->reset_firmware(ha); 3513 3514 if (is_qla8022(ha)) { | 3392 ql4_printk(KERN_INFO, ha, "HW State: FAILED\n"); 3393 qla4_8xxx_device_state_handler(ha); 3394 } 3395 if (test_and_clear_bit(DPC_HA_NEED_QUIESCENT, &ha->dpc_flags)) { 3396 qla4_8xxx_need_qsnt_handler(ha); 3397 } 3398 } 3399 --- 107 unchanged lines hidden (view full) --- 3507 /* Kill the kernel thread for this host */ 3508 if (ha->task_wq) 3509 destroy_workqueue(ha->task_wq); 3510 3511 /* Put firmware in known state */ 3512 ha->isp_ops->reset_firmware(ha); 3513 3514 if (is_qla8022(ha)) { |
3515 qla4_8xxx_idc_lock(ha); | 3515 qla4_82xx_idc_lock(ha); |
3516 qla4_8xxx_clear_drv_active(ha); | 3516 qla4_8xxx_clear_drv_active(ha); |
3517 qla4_8xxx_idc_unlock(ha); | 3517 qla4_82xx_idc_unlock(ha); |
3518 } 3519 3520 /* Detach interrupts */ 3521 if (test_and_clear_bit(AF_IRQ_ATTACHED, &ha->flags)) 3522 qla4xxx_free_irqs(ha); 3523 3524 /* free extra memory */ 3525 qla4xxx_mem_free(ha); --- 132 unchanged lines hidden (view full) --- 3658 .rd_shdw_req_q_out = qla4xxx_rd_shdw_req_q_out, 3659 .rd_shdw_rsp_q_in = qla4xxx_rd_shdw_rsp_q_in, 3660 .get_sys_info = qla4xxx_get_sys_info, 3661}; 3662 3663static struct isp_operations qla4_8xxx_isp_ops = { 3664 .iospace_config = qla4_8xxx_iospace_config, 3665 .pci_config = qla4_8xxx_pci_config, | 3518 } 3519 3520 /* Detach interrupts */ 3521 if (test_and_clear_bit(AF_IRQ_ATTACHED, &ha->flags)) 3522 qla4xxx_free_irqs(ha); 3523 3524 /* free extra memory */ 3525 qla4xxx_mem_free(ha); --- 132 unchanged lines hidden (view full) --- 3658 .rd_shdw_req_q_out = qla4xxx_rd_shdw_req_q_out, 3659 .rd_shdw_rsp_q_in = qla4xxx_rd_shdw_rsp_q_in, 3660 .get_sys_info = qla4xxx_get_sys_info, 3661}; 3662 3663static struct isp_operations qla4_8xxx_isp_ops = { 3664 .iospace_config = qla4_8xxx_iospace_config, 3665 .pci_config = qla4_8xxx_pci_config, |
3666 .disable_intrs = qla4_8xxx_disable_intrs, 3667 .enable_intrs = qla4_8xxx_enable_intrs, | 3666 .disable_intrs = qla4_82xx_disable_intrs, 3667 .enable_intrs = qla4_82xx_enable_intrs, |
3668 .start_firmware = qla4_8xxx_load_risc, | 3668 .start_firmware = qla4_8xxx_load_risc, |
3669 .intr_handler = qla4_8xxx_intr_handler, 3670 .interrupt_service_routine = qla4_8xxx_interrupt_service_routine, 3671 .reset_chip = qla4_8xxx_isp_reset, | 3669 .intr_handler = qla4_82xx_intr_handler, 3670 .interrupt_service_routine = qla4_82xx_interrupt_service_routine, 3671 .reset_chip = qla4_82xx_isp_reset, |
3672 .reset_firmware = qla4_8xxx_stop_firmware, | 3672 .reset_firmware = qla4_8xxx_stop_firmware, |
3673 .queue_iocb = qla4_8xxx_queue_iocb, 3674 .complete_iocb = qla4_8xxx_complete_iocb, 3675 .rd_shdw_req_q_out = qla4_8xxx_rd_shdw_req_q_out, 3676 .rd_shdw_rsp_q_in = qla4_8xxx_rd_shdw_rsp_q_in, | 3673 .queue_iocb = qla4_82xx_queue_iocb, 3674 .complete_iocb = qla4_82xx_complete_iocb, 3675 .rd_shdw_req_q_out = qla4_82xx_rd_shdw_req_q_out, 3676 .rd_shdw_rsp_q_in = qla4_82xx_rd_shdw_rsp_q_in, |
3677 .get_sys_info = qla4_8xxx_get_sys_info, 3678}; 3679 3680uint16_t qla4xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha) 3681{ 3682 return (uint16_t)le32_to_cpu(ha->shadow_regs->req_q_out); 3683} 3684 | 3677 .get_sys_info = qla4_8xxx_get_sys_info, 3678}; 3679 3680uint16_t qla4xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha) 3681{ 3682 return (uint16_t)le32_to_cpu(ha->shadow_regs->req_q_out); 3683} 3684 |
3685uint16_t qla4_8xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha) | 3685uint16_t qla4_82xx_rd_shdw_req_q_out(struct scsi_qla_host *ha) |
3686{ 3687 return (uint16_t)le32_to_cpu(readl(&ha->qla4_8xxx_reg->req_q_out)); 3688} 3689 3690uint16_t qla4xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha) 3691{ 3692 return (uint16_t)le32_to_cpu(ha->shadow_regs->rsp_q_in); 3693} 3694 | 3686{ 3687 return (uint16_t)le32_to_cpu(readl(&ha->qla4_8xxx_reg->req_q_out)); 3688} 3689 3690uint16_t qla4xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha) 3691{ 3692 return (uint16_t)le32_to_cpu(ha->shadow_regs->rsp_q_in); 3693} 3694 |
3695uint16_t qla4_8xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha) | 3695uint16_t qla4_82xx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha) |
3696{ 3697 return (uint16_t)le32_to_cpu(readl(&ha->qla4_8xxx_reg->rsp_q_in)); 3698} 3699 3700static ssize_t qla4xxx_show_boot_eth_info(void *data, int type, char *buf) 3701{ 3702 struct scsi_qla_host *ha = data; 3703 char *str = buf; --- 1452 unchanged lines hidden (view full) --- 5156 * firmware 5157 * NOTE: interrupts enabled upon successful completion 5158 */ 5159 status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); 5160 while ((!test_bit(AF_ONLINE, &ha->flags)) && 5161 init_retry_count++ < MAX_INIT_RETRIES) { 5162 5163 if (is_qla8022(ha)) { | 3696{ 3697 return (uint16_t)le32_to_cpu(readl(&ha->qla4_8xxx_reg->rsp_q_in)); 3698} 3699 3700static ssize_t qla4xxx_show_boot_eth_info(void *data, int type, char *buf) 3701{ 3702 struct scsi_qla_host *ha = data; 3703 char *str = buf; --- 1452 unchanged lines hidden (view full) --- 5156 * firmware 5157 * NOTE: interrupts enabled upon successful completion 5158 */ 5159 status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); 5160 while ((!test_bit(AF_ONLINE, &ha->flags)) && 5161 init_retry_count++ < MAX_INIT_RETRIES) { 5162 5163 if (is_qla8022(ha)) { |
5164 qla4_8xxx_idc_lock(ha); 5165 dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE); 5166 qla4_8xxx_idc_unlock(ha); | 5164 qla4_82xx_idc_lock(ha); 5165 dev_state = qla4_82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); 5166 qla4_82xx_idc_unlock(ha); |
5167 if (dev_state == QLA82XX_DEV_FAILED) { 5168 ql4_printk(KERN_WARNING, ha, "%s: don't retry " 5169 "initialize adapter. H/W is in failed state\n", 5170 __func__); 5171 break; 5172 } 5173 } 5174 DEBUG2(printk("scsi: %s: retrying adapter initialization " --- 6 unchanged lines hidden (view full) --- 5181 } 5182 5183 if (!test_bit(AF_ONLINE, &ha->flags)) { 5184 ql4_printk(KERN_WARNING, ha, "Failed to initialize adapter\n"); 5185 5186 if (is_qla8022(ha) && ql4xdontresethba) { 5187 /* Put the device in failed state. */ 5188 DEBUG2(printk(KERN_ERR "HW STATE: FAILED\n")); | 5167 if (dev_state == QLA82XX_DEV_FAILED) { 5168 ql4_printk(KERN_WARNING, ha, "%s: don't retry " 5169 "initialize adapter. H/W is in failed state\n", 5170 __func__); 5171 break; 5172 } 5173 } 5174 DEBUG2(printk("scsi: %s: retrying adapter initialization " --- 6 unchanged lines hidden (view full) --- 5181 } 5182 5183 if (!test_bit(AF_ONLINE, &ha->flags)) { 5184 ql4_printk(KERN_WARNING, ha, "Failed to initialize adapter\n"); 5185 5186 if (is_qla8022(ha) && ql4xdontresethba) { 5187 /* Put the device in failed state. */ 5188 DEBUG2(printk(KERN_ERR "HW STATE: FAILED\n")); |
5189 qla4_8xxx_idc_lock(ha); 5190 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 5189 qla4_82xx_idc_lock(ha); 5190 qla4_82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
5191 QLA82XX_DEV_FAILED); | 5191 QLA82XX_DEV_FAILED); |
5192 qla4_8xxx_idc_unlock(ha); | 5192 qla4_82xx_idc_unlock(ha); |
5193 } 5194 ret = -ENODEV; 5195 goto remove_host; 5196 } 5197 5198 /* Startup the kernel thread for this host adapter. */ 5199 DEBUG2(printk("scsi: %s: Starting kernel thread for " 5200 "qla4xxx_dpc\n", __func__)); --- 827 unchanged lines hidden (view full) --- 6028 * start & initialize the firmware. The other functions 6029 * on the card will reset the firmware context 6030 */ 6031 if (!fn) { 6032 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: devfn being reset " 6033 "0x%x is the owner\n", ha->host_no, __func__, 6034 ha->pdev->devfn); 6035 | 5193 } 5194 ret = -ENODEV; 5195 goto remove_host; 5196 } 5197 5198 /* Startup the kernel thread for this host adapter. */ 5199 DEBUG2(printk("scsi: %s: Starting kernel thread for " 5200 "qla4xxx_dpc\n", __func__)); --- 827 unchanged lines hidden (view full) --- 6028 * start & initialize the firmware. The other functions 6029 * on the card will reset the firmware context 6030 */ 6031 if (!fn) { 6032 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: devfn being reset " 6033 "0x%x is the owner\n", ha->host_no, __func__, 6034 ha->pdev->devfn); 6035 |
6036 qla4_8xxx_idc_lock(ha); 6037 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 6036 qla4_82xx_idc_lock(ha); 6037 qla4_82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
6038 QLA82XX_DEV_COLD); 6039 | 6038 QLA82XX_DEV_COLD); 6039 |
6040 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DRV_IDC_VERSION, | 6040 qla4_82xx_wr_32(ha, QLA82XX_CRB_DRV_IDC_VERSION, |
6041 QLA82XX_IDC_VERSION); 6042 | 6041 QLA82XX_IDC_VERSION); 6042 |
6043 qla4_8xxx_idc_unlock(ha); | 6043 qla4_82xx_idc_unlock(ha); |
6044 clear_bit(AF_FW_RECOVERY, &ha->flags); 6045 rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); | 6044 clear_bit(AF_FW_RECOVERY, &ha->flags); 6045 rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); |
6046 qla4_8xxx_idc_lock(ha); | 6046 qla4_82xx_idc_lock(ha); |
6047 6048 if (rval != QLA_SUCCESS) { 6049 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: HW State: " 6050 "FAILED\n", ha->host_no, __func__); 6051 qla4_8xxx_clear_drv_active(ha); | 6047 6048 if (rval != QLA_SUCCESS) { 6049 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: HW State: " 6050 "FAILED\n", ha->host_no, __func__); 6051 qla4_8xxx_clear_drv_active(ha); |
6052 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 6052 qla4_82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
6053 QLA82XX_DEV_FAILED); 6054 } else { 6055 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: HW State: " 6056 "READY\n", ha->host_no, __func__); | 6053 QLA82XX_DEV_FAILED); 6054 } else { 6055 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: HW State: " 6056 "READY\n", ha->host_no, __func__); |
6057 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 6057 qla4_82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
6058 QLA82XX_DEV_READY); 6059 /* Clear driver state register */ | 6058 QLA82XX_DEV_READY); 6059 /* Clear driver state register */ |
6060 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DRV_STATE, 0); | 6060 qla4_82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, 0); |
6061 qla4_8xxx_set_drv_active(ha); 6062 ret = qla4xxx_request_irqs(ha); 6063 if (ret) { 6064 ql4_printk(KERN_WARNING, ha, "Failed to " 6065 "reserve interrupt %d already in use.\n", 6066 ha->pdev->irq); 6067 rval = QLA_ERROR; 6068 } else { 6069 ha->isp_ops->enable_intrs(ha); 6070 rval = QLA_SUCCESS; 6071 } 6072 } | 6061 qla4_8xxx_set_drv_active(ha); 6062 ret = qla4xxx_request_irqs(ha); 6063 if (ret) { 6064 ql4_printk(KERN_WARNING, ha, "Failed to " 6065 "reserve interrupt %d already in use.\n", 6066 ha->pdev->irq); 6067 rval = QLA_ERROR; 6068 } else { 6069 ha->isp_ops->enable_intrs(ha); 6070 rval = QLA_SUCCESS; 6071 } 6072 } |
6073 qla4_8xxx_idc_unlock(ha); | 6073 qla4_82xx_idc_unlock(ha); |
6074 } else { 6075 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: devfn 0x%x is not " 6076 "the reset owner\n", ha->host_no, __func__, 6077 ha->pdev->devfn); | 6074 } else { 6075 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: devfn 0x%x is not " 6076 "the reset owner\n", ha->host_no, __func__, 6077 ha->pdev->devfn); |
6078 if ((qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == | 6078 if ((qla4_82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == |
6079 QLA82XX_DEV_READY)) { 6080 clear_bit(AF_FW_RECOVERY, &ha->flags); 6081 rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); 6082 if (rval == QLA_SUCCESS) { 6083 ret = qla4xxx_request_irqs(ha); 6084 if (ret) { 6085 ql4_printk(KERN_WARNING, ha, "Failed to" 6086 " reserve interrupt %d already in" 6087 " use.\n", ha->pdev->irq); 6088 rval = QLA_ERROR; 6089 } else { 6090 ha->isp_ops->enable_intrs(ha); 6091 rval = QLA_SUCCESS; 6092 } 6093 } | 6079 QLA82XX_DEV_READY)) { 6080 clear_bit(AF_FW_RECOVERY, &ha->flags); 6081 rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); 6082 if (rval == QLA_SUCCESS) { 6083 ret = qla4xxx_request_irqs(ha); 6084 if (ret) { 6085 ql4_printk(KERN_WARNING, ha, "Failed to" 6086 " reserve interrupt %d already in" 6087 " use.\n", ha->pdev->irq); 6088 rval = QLA_ERROR; 6089 } else { 6090 ha->isp_ops->enable_intrs(ha); 6091 rval = QLA_SUCCESS; 6092 } 6093 } |
6094 qla4_8xxx_idc_lock(ha); | 6094 qla4_82xx_idc_lock(ha); |
6095 qla4_8xxx_set_drv_active(ha); | 6095 qla4_8xxx_set_drv_active(ha); |
6096 qla4_8xxx_idc_unlock(ha); | 6096 qla4_82xx_idc_unlock(ha); |
6097 } 6098 } 6099 clear_bit(DPC_RESET_ACTIVE, &ha->dpc_flags); 6100 return rval; 6101} 6102 6103static pci_ers_result_t 6104qla4xxx_pci_slot_reset(struct pci_dev *pdev) --- 166 unchanged lines hidden --- | 6097 } 6098 } 6099 clear_bit(DPC_RESET_ACTIVE, &ha->dpc_flags); 6100 return rval; 6101} 6102 6103static pci_ers_result_t 6104qla4xxx_pci_slot_reset(struct pci_dev *pdev) --- 166 unchanged lines hidden --- |