Lines Matching refs:ha

18 static void qla4xxx_copy_sense(struct scsi_qla_host *ha,  in qla4xxx_copy_sense()  argument
28 DEBUG2(ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%d:%llu: %s:" in qla4xxx_copy_sense()
29 " sense len 0\n", ha->host_no, in qla4xxx_copy_sense()
32 ha->status_srb = NULL; in qla4xxx_copy_sense()
46 "ASL= %02x, ASC/ASCQ = %02x/%02x\n", ha->host_no, in qla4xxx_copy_sense()
61 ha->status_srb = srb; in qla4xxx_copy_sense()
63 ha->status_srb = NULL; in qla4xxx_copy_sense()
74 qla4xxx_status_cont_entry(struct scsi_qla_host *ha, in qla4xxx_status_cont_entry() argument
77 struct srb *srb = ha->status_srb; in qla4xxx_status_cont_entry()
87 "back to OS srb=%p srb->state:%d\n", ha->host_no, in qla4xxx_status_cont_entry()
89 ha->status_srb = NULL; in qla4xxx_status_cont_entry()
105 ha->status_srb = NULL; in qla4xxx_status_cont_entry()
114 static void qla4xxx_status_entry(struct scsi_qla_host *ha, in qla4xxx_status_entry() argument
123 srb = qla4xxx_del_from_active_array(ha, le32_to_cpu(sts_entry->handle)); in qla4xxx_status_entry()
125 ql4_printk(KERN_WARNING, ha, "%s invalid status entry: " in qla4xxx_status_entry()
128 if (is_qla80XX(ha)) in qla4xxx_status_entry()
129 set_bit(DPC_RESET_HA_FW_CONTEXT, &ha->dpc_flags); in qla4xxx_status_entry()
131 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_status_entry()
139 ha->host_no, __func__, sts_entry->handle, in qla4xxx_status_entry()
141 ql4_printk(KERN_WARNING, ha, "Command is NULL:" in qla4xxx_status_entry()
174 "residual = 0x%x\n", ha->host_no, in qla4xxx_status_entry()
189 qla4xxx_copy_sense(ha, sts_entry, srb); in qla4xxx_status_entry()
200 ha->host_no, cmd->device->channel, in qla4xxx_status_entry()
208 ha->host_no, cmd->device->channel, in qla4xxx_status_entry()
216 ha->host_no, cmd->device->channel, in qla4xxx_status_entry()
235 ha->host_no, in qla4xxx_status_entry()
260 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_status_entry()
262 ha->host_no, in qla4xxx_status_entry()
292 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_status_entry()
294 ha->host_no, in qla4xxx_status_entry()
309 qla4xxx_copy_sense(ha, sts_entry, srb); in qla4xxx_status_entry()
316 "state: 0x%x\n", ha->host_no, in qla4xxx_status_entry()
337 " iResp=%02x\n", ha->host_no, cmd->device->id, in qla4xxx_status_entry()
354 if (ha->status_srb == NULL) in qla4xxx_status_entry()
363 static void qla4xxx_passthru_status_entry(struct scsi_qla_host *ha, in qla4xxx_passthru_status_entry() argument
377 ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index); in qla4xxx_passthru_status_entry()
380 ql4_printk(KERN_ERR, ha, "%s: Invalid target index = 0x%x\n", in qla4xxx_passthru_status_entry()
392 ql4_printk(KERN_ERR, ha, "%s: Task is NULL\n", __func__); in qla4xxx_passthru_status_entry()
398 ha->iocb_cnt -= task_data->iocb_req_cnt; in qla4xxx_passthru_status_entry()
399 queue_work(ha->task_wq, &task_data->task_work); in qla4xxx_passthru_status_entry()
402 static struct mrb *qla4xxx_del_mrb_from_active_array(struct scsi_qla_host *ha, in qla4xxx_del_mrb_from_active_array() argument
411 mrb = ha->active_mrb_array[index]; in qla4xxx_del_mrb_from_active_array()
412 ha->active_mrb_array[index] = NULL; in qla4xxx_del_mrb_from_active_array()
417 ha->iocb_cnt -= mrb->iocb_cnt; in qla4xxx_del_mrb_from_active_array()
422 static void qla4xxx_mbox_status_entry(struct scsi_qla_host *ha, in qla4xxx_mbox_status_entry() argument
429 mrb = qla4xxx_del_mrb_from_active_array(ha, in qla4xxx_mbox_status_entry()
433 ql4_printk(KERN_WARNING, ha, "%s: mrb[%d] is null\n", __func__, in qla4xxx_mbox_status_entry()
440 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: mbox_cmd = 0x%x, " in qla4xxx_mbox_status_entry()
453 qla4xxx_post_ping_evt_work(ha, status, mrb->pid, data_size, in qla4xxx_mbox_status_entry()
458 DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: invalid mbox_cmd = " in qla4xxx_mbox_status_entry()
473 void qla4xxx_process_response_queue(struct scsi_qla_host *ha) in qla4xxx_process_response_queue() argument
480 while ((ha->response_ptr->signature != RESPONSE_PROCESSED)) { in qla4xxx_process_response_queue()
481 sts_entry = (struct status_entry *) ha->response_ptr; in qla4xxx_process_response_queue()
485 if (ha->response_out == (RESPONSE_QUEUE_DEPTH - 1)) { in qla4xxx_process_response_queue()
486 ha->response_out = 0; in qla4xxx_process_response_queue()
487 ha->response_ptr = ha->response_ring; in qla4xxx_process_response_queue()
489 ha->response_out++; in qla4xxx_process_response_queue()
490 ha->response_ptr++; in qla4xxx_process_response_queue()
497 qla4xxx_status_entry(ha, sts_entry); in qla4xxx_process_response_queue()
502 qla4xxx_passthru_status_entry(ha, in qla4xxx_process_response_queue()
505 ql4_printk(KERN_ERR, ha, in qla4xxx_process_response_queue()
512 qla4xxx_status_cont_entry(ha, in qla4xxx_process_response_queue()
521 srb = qla4xxx_del_from_active_array(ha, in qla4xxx_process_response_queue()
528 "srb %p\n", ha->host_no, __func__, srb)); in qla4xxx_process_response_queue()
539 "ignoring\n", ha->host_no, __func__)); in qla4xxx_process_response_queue()
543 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_process_response_queue()
545 qla4xxx_mbox_status_entry(ha, in qla4xxx_process_response_queue()
555 "response queue \n", ha->host_no, in qla4xxx_process_response_queue()
567 ha->isp_ops->complete_iocb(ha); in qla4xxx_process_response_queue()
573 ha->host_no, __func__, srb, sts_entry->hdr.entryType, in qla4xxx_process_response_queue()
577 ha->isp_ops->complete_iocb(ha); in qla4xxx_process_response_queue()
578 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_process_response_queue()
586 static int qla4_83xx_loopback_in_progress(struct scsi_qla_host *ha) in qla4_83xx_loopback_in_progress() argument
590 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4_83xx_loopback_in_progress()
591 if ((ha->idc_info.info2 & ENABLE_INTERNAL_LOOPBACK) || in qla4_83xx_loopback_in_progress()
592 (ha->idc_info.info2 & ENABLE_EXTERNAL_LOOPBACK)) { in qla4_83xx_loopback_in_progress()
593 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4_83xx_loopback_in_progress()
598 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4_83xx_loopback_in_progress()
608 static void qla4xxx_update_ipaddr_state(struct scsi_qla_host *ha, in qla4xxx_update_ipaddr_state() argument
620 ha->ip_config.ipv4_addr_state = ipaddr_state; in qla4xxx_update_ipaddr_state()
623 ha->ip_config.ipv6_link_local_state = ipaddr_state; in qla4xxx_update_ipaddr_state()
626 ha->ip_config.ipv6_addr0_state = ipaddr_state; in qla4xxx_update_ipaddr_state()
629 ha->ip_config.ipv6_addr1_state = ipaddr_state; in qla4xxx_update_ipaddr_state()
632 ql4_printk(KERN_INFO, ha, "%s: Invalid IPADDR index %d\n", in qla4xxx_update_ipaddr_state()
637 static void qla4xxx_default_router_changed(struct scsi_qla_host *ha, in qla4xxx_default_router_changed() argument
640 memcpy(&ha->ip_config.ipv6_default_router_addr.s6_addr32[0], in qla4xxx_default_router_changed()
642 memcpy(&ha->ip_config.ipv6_default_router_addr.s6_addr32[1], in qla4xxx_default_router_changed()
644 memcpy(&ha->ip_config.ipv6_default_router_addr.s6_addr32[2], in qla4xxx_default_router_changed()
646 memcpy(&ha->ip_config.ipv6_default_router_addr.s6_addr32[3], in qla4xxx_default_router_changed()
658 static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha, in qla4xxx_isr_decode_mailbox() argument
666 if (is_qla8032(ha) || is_qla8042(ha)) in qla4xxx_isr_decode_mailbox()
667 mailbox_out = &ha->qla4_83xx_reg->mailbox_out[0]; in qla4xxx_isr_decode_mailbox()
668 else if (is_qla8022(ha)) in qla4xxx_isr_decode_mailbox()
669 mailbox_out = &ha->qla4_82xx_reg->mailbox_out[0]; in qla4xxx_isr_decode_mailbox()
671 mailbox_out = &ha->reg->mailbox[0]; in qla4xxx_isr_decode_mailbox()
676 ha->mbox_status[0] = mbox_status; in qla4xxx_isr_decode_mailbox()
678 if (test_bit(AF_MBOX_COMMAND, &ha->flags)) { in qla4xxx_isr_decode_mailbox()
683 for (i = 0; i < ha->mbox_status_count; i++) in qla4xxx_isr_decode_mailbox()
684 ha->mbox_status[i] = readl(&mailbox_out[i]); in qla4xxx_isr_decode_mailbox()
686 set_bit(AF_MBOX_COMMAND_DONE, &ha->flags); in qla4xxx_isr_decode_mailbox()
688 if (test_bit(AF_MBOX_COMMAND_NOPOLL, &ha->flags)) in qla4xxx_isr_decode_mailbox()
689 complete(&ha->mbx_intr_comp); in qla4xxx_isr_decode_mailbox()
697 if (ha->aen_log.count < MAX_AEN_ENTRIES) { in qla4xxx_isr_decode_mailbox()
699 ha->aen_log.entry[ha->aen_log.count].mbox_sts[i] = in qla4xxx_isr_decode_mailbox()
701 ha->aen_log.count++; in qla4xxx_isr_decode_mailbox()
706 ql4_printk(KERN_INFO, ha, "%s: System Err\n", __func__); in qla4xxx_isr_decode_mailbox()
707 qla4xxx_dump_registers(ha); in qla4xxx_isr_decode_mailbox()
709 if ((is_qla8022(ha) && ql4xdontresethba) || in qla4xxx_isr_decode_mailbox()
710 ((is_qla8032(ha) || is_qla8042(ha)) && in qla4xxx_isr_decode_mailbox()
711 qla4_83xx_idc_dontreset(ha))) { in qla4xxx_isr_decode_mailbox()
713 ha->host_no, __func__)); in qla4xxx_isr_decode_mailbox()
715 set_bit(AF_GET_CRASH_RECORD, &ha->flags); in qla4xxx_isr_decode_mailbox()
716 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
726 "Reset HA\n", ha->host_no, mbox_status)); in qla4xxx_isr_decode_mailbox()
727 if (is_qla80XX(ha)) in qla4xxx_isr_decode_mailbox()
729 &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
731 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
735 set_bit(AF_LINK_UP, &ha->flags); in qla4xxx_isr_decode_mailbox()
736 if (test_bit(AF_INIT_DONE, &ha->flags)) in qla4xxx_isr_decode_mailbox()
737 set_bit(DPC_LINK_CHANGED, &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
739 ql4_printk(KERN_INFO, ha, "%s: LINK UP\n", __func__); in qla4xxx_isr_decode_mailbox()
740 qla4xxx_post_aen_work(ha, ISCSI_EVENT_LINKUP, in qla4xxx_isr_decode_mailbox()
744 if ((is_qla8032(ha) || is_qla8042(ha)) && in qla4xxx_isr_decode_mailbox()
745 ha->notify_link_up_comp) in qla4xxx_isr_decode_mailbox()
746 complete(&ha->link_up_comp); in qla4xxx_isr_decode_mailbox()
751 clear_bit(AF_LINK_UP, &ha->flags); in qla4xxx_isr_decode_mailbox()
752 if (test_bit(AF_INIT_DONE, &ha->flags)) { in qla4xxx_isr_decode_mailbox()
753 set_bit(DPC_LINK_CHANGED, &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
754 qla4xxx_wake_dpc(ha); in qla4xxx_isr_decode_mailbox()
757 ql4_printk(KERN_INFO, ha, "%s: LINK DOWN\n", __func__); in qla4xxx_isr_decode_mailbox()
758 qla4xxx_post_aen_work(ha, ISCSI_EVENT_LINKDOWN, in qla4xxx_isr_decode_mailbox()
764 ha->seconds_since_last_heartbeat = 0; in qla4xxx_isr_decode_mailbox()
769 "ACQUIRED\n", ha->host_no, mbox_status)); in qla4xxx_isr_decode_mailbox()
770 set_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
782 DEBUG2(printk("scsi%ld: AEN %04x\n", ha->host_no, in qla4xxx_isr_decode_mailbox()
788 "mbox_sts[3]=%04x\n", ha->host_no, mbox_sts[0], in qla4xxx_isr_decode_mailbox()
791 qla4xxx_update_ipaddr_state(ha, mbox_sts[5], in qla4xxx_isr_decode_mailbox()
798 set_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
801 if (is_qla80XX(ha)) in qla4xxx_isr_decode_mailbox()
803 &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
805 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
807 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ACB in disabling state\n", in qla4xxx_isr_decode_mailbox()
808 ha->host_no, __func__); in qla4xxx_isr_decode_mailbox()
810 complete(&ha->disable_acb_comp); in qla4xxx_isr_decode_mailbox()
811 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ACB state unconfigured\n", in qla4xxx_isr_decode_mailbox()
812 ha->host_no, __func__); in qla4xxx_isr_decode_mailbox()
820 DEBUG2(ql4_printk(KERN_INFO, ha, "scsi%ld: AEN %04x\n", in qla4xxx_isr_decode_mailbox()
821 ha->host_no, mbox_status)); in qla4xxx_isr_decode_mailbox()
825 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
828 ha->host_no, mbox_sts[0], mbox_sts[1], in qla4xxx_isr_decode_mailbox()
838 ha->host_no, mbox_sts[0], in qla4xxx_isr_decode_mailbox()
847 ha->host_no, mbox_sts[0], mbox_sts[1], in qla4xxx_isr_decode_mailbox()
854 if (ha->aen_q_count > 0) { in qla4xxx_isr_decode_mailbox()
857 ha->aen_q_count--; in qla4xxx_isr_decode_mailbox()
860 ha->aen_q[ha->aen_in].mbox_sts[i] = in qla4xxx_isr_decode_mailbox()
867 ha->host_no, ha->aen_in, in qla4xxx_isr_decode_mailbox()
873 ha->aen_in++; in qla4xxx_isr_decode_mailbox()
874 if (ha->aen_in == MAX_AEN_ENTRIES) in qla4xxx_isr_decode_mailbox()
875 ha->aen_in = 0; in qla4xxx_isr_decode_mailbox()
878 set_bit(DPC_AEN, &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
882 ha->host_no, __func__, in qla4xxx_isr_decode_mailbox()
886 ha->host_no)); in qla4xxx_isr_decode_mailbox()
900 " inserted\n", ha->host_no, mbox_sts[0])); in qla4xxx_isr_decode_mailbox()
906 " removed\n", ha->host_no, mbox_sts[0])); in qla4xxx_isr_decode_mailbox()
910 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4xxx_isr_decode_mailbox()
911 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
913 ha->host_no, mbox_sts[0], in qla4xxx_isr_decode_mailbox()
920 &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
921 ha->idc_info.request_desc = mbox_sts[1]; in qla4xxx_isr_decode_mailbox()
922 ha->idc_info.info1 = mbox_sts[2]; in qla4xxx_isr_decode_mailbox()
923 ha->idc_info.info2 = mbox_sts[3]; in qla4xxx_isr_decode_mailbox()
924 ha->idc_info.info3 = mbox_sts[4]; in qla4xxx_isr_decode_mailbox()
925 qla4xxx_wake_dpc(ha); in qla4xxx_isr_decode_mailbox()
931 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4xxx_isr_decode_mailbox()
932 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
934 ha->host_no, mbox_sts[0], in qla4xxx_isr_decode_mailbox()
937 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
939 ha->host_no, mbox_sts[0])); in qla4xxx_isr_decode_mailbox()
942 if (ha->notify_idc_comp) in qla4xxx_isr_decode_mailbox()
943 complete(&ha->idc_comp); in qla4xxx_isr_decode_mailbox()
947 ha->idc_info.info2 = mbox_sts[3]; in qla4xxx_isr_decode_mailbox()
949 if (qla4_83xx_loopback_in_progress(ha)) { in qla4xxx_isr_decode_mailbox()
950 set_bit(AF_LOOPBACK, &ha->flags); in qla4xxx_isr_decode_mailbox()
952 clear_bit(AF_LOOPBACK, &ha->flags); in qla4xxx_isr_decode_mailbox()
953 if (ha->saved_acb) in qla4xxx_isr_decode_mailbox()
955 &ha->dpc_flags); in qla4xxx_isr_decode_mailbox()
957 qla4xxx_wake_dpc(ha); in qla4xxx_isr_decode_mailbox()
962 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
964 ha->host_no, mbox_sts[0], mbox_sts[1], in qla4xxx_isr_decode_mailbox()
967 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
969 ha->host_no, mbox_sts[0])); in qla4xxx_isr_decode_mailbox()
970 qla4xxx_default_router_changed(ha, mbox_sts); in qla4xxx_isr_decode_mailbox()
974 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
976 ha->host_no, mbox_sts[0], mbox_sts[1], in qla4xxx_isr_decode_mailbox()
979 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
981 ha->host_no, mbox_sts[0])); in qla4xxx_isr_decode_mailbox()
983 ha->idc_extend_tmo = mbox_sts[1]; in qla4xxx_isr_decode_mailbox()
987 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
989 ha->host_no, mbox_sts[0], in qla4xxx_isr_decode_mailbox()
994 DEBUG2(ql4_printk(KERN_WARNING, ha, in qla4xxx_isr_decode_mailbox()
996 ha->host_no, mbox_sts[0], mbox_sts[1], in qla4xxx_isr_decode_mailbox()
1002 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
1004 ha->host_no, mbox_sts[0], mbox_sts[1], in qla4xxx_isr_decode_mailbox()
1007 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_isr_decode_mailbox()
1009 ha->host_no, mbox_sts[0])); in qla4xxx_isr_decode_mailbox()
1015 ha->host_no, mbox_sts[0])); in qla4xxx_isr_decode_mailbox()
1020 ha->host_no, mbox_status)); in qla4xxx_isr_decode_mailbox()
1022 ha->mbox_status[0] = mbox_status; in qla4xxx_isr_decode_mailbox()
1026 void qla4_83xx_interrupt_service_routine(struct scsi_qla_host *ha, in qla4_83xx_interrupt_service_routine() argument
1031 qla4xxx_isr_decode_mailbox(ha, in qla4_83xx_interrupt_service_routine()
1032 readl(&ha->qla4_83xx_reg->mailbox_out[0])); in qla4_83xx_interrupt_service_routine()
1034 writel(0, &ha->qla4_83xx_reg->risc_intr); in qla4_83xx_interrupt_service_routine()
1036 qla4xxx_process_response_queue(ha); in qla4_83xx_interrupt_service_routine()
1040 writel(0, &ha->qla4_83xx_reg->mb_int_mask); in qla4_83xx_interrupt_service_routine()
1051 void qla4_82xx_interrupt_service_routine(struct scsi_qla_host *ha, in qla4_82xx_interrupt_service_routine() argument
1056 test_bit(AF_INIT_DONE, &ha->flags)) in qla4_82xx_interrupt_service_routine()
1057 qla4xxx_process_response_queue(ha); in qla4_82xx_interrupt_service_routine()
1061 qla4xxx_isr_decode_mailbox(ha, in qla4_82xx_interrupt_service_routine()
1062 readl(&ha->qla4_82xx_reg->mailbox_out[0])); in qla4_82xx_interrupt_service_routine()
1065 writel(0, &ha->qla4_82xx_reg->host_int); in qla4_82xx_interrupt_service_routine()
1066 readl(&ha->qla4_82xx_reg->host_int); in qla4_82xx_interrupt_service_routine()
1077 void qla4xxx_interrupt_service_routine(struct scsi_qla_host * ha, in qla4xxx_interrupt_service_routine() argument
1082 qla4xxx_process_response_queue(ha); in qla4xxx_interrupt_service_routine()
1086 qla4xxx_isr_decode_mailbox(ha, in qla4xxx_interrupt_service_routine()
1087 readl(&ha->reg->mailbox[0])); in qla4xxx_interrupt_service_routine()
1091 &ha->reg->ctrl_status); in qla4xxx_interrupt_service_routine()
1092 readl(&ha->reg->ctrl_status); in qla4xxx_interrupt_service_routine()
1102 static void qla4_82xx_spurious_interrupt(struct scsi_qla_host *ha, in qla4_82xx_spurious_interrupt() argument
1108 DEBUG2(ql4_printk(KERN_INFO, ha, "Spurious Interrupt\n")); in qla4_82xx_spurious_interrupt()
1109 if (is_qla8022(ha)) { in qla4_82xx_spurious_interrupt()
1110 writel(0, &ha->qla4_82xx_reg->host_int); in qla4_82xx_spurious_interrupt()
1111 if (!ha->pdev->msi_enabled && !ha->pdev->msix_enabled) in qla4_82xx_spurious_interrupt()
1112 qla4_82xx_wr_32(ha, ha->nx_legacy_intr.tgt_mask_reg, in qla4_82xx_spurious_interrupt()
1115 ha->spurious_int_count++; in qla4_82xx_spurious_interrupt()
1125 struct scsi_qla_host *ha; in qla4xxx_intr_handler() local
1130 ha = (struct scsi_qla_host *) dev_id; in qla4xxx_intr_handler()
1131 if (!ha) { in qla4xxx_intr_handler()
1137 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_intr_handler()
1139 ha->isr_count++; in qla4xxx_intr_handler()
1148 if (ha->isp_ops->rd_shdw_rsp_q_in(ha) != in qla4xxx_intr_handler()
1149 ha->response_out) in qla4xxx_intr_handler()
1152 intr_status = readl(&ha->reg->ctrl_status); in qla4xxx_intr_handler()
1157 ha->spurious_int_count++; in qla4xxx_intr_handler()
1163 "Status 0x%04x\n", ha->host_no, in qla4xxx_intr_handler()
1164 readl(isp_port_error_status (ha)))); in qla4xxx_intr_handler()
1173 if ((readl(&ha->reg->ctrl_status) & in qla4xxx_intr_handler()
1176 &ha->reg->ctrl_status); in qla4xxx_intr_handler()
1177 readl(&ha->reg->ctrl_status); in qla4xxx_intr_handler()
1181 &ha->reg->ctrl_status); in qla4xxx_intr_handler()
1182 readl(&ha->reg->ctrl_status); in qla4xxx_intr_handler()
1184 __qla4xxx_disable_intrs(ha); in qla4xxx_intr_handler()
1186 set_bit(DPC_RESET_HA, &ha->dpc_flags); in qla4xxx_intr_handler()
1190 clear_bit(AF_ONLINE, &ha->flags); in qla4xxx_intr_handler()
1191 __qla4xxx_disable_intrs(ha); in qla4xxx_intr_handler()
1194 &ha->reg->ctrl_status); in qla4xxx_intr_handler()
1195 readl(&ha->reg->ctrl_status); in qla4xxx_intr_handler()
1197 if (!test_bit(AF_HA_REMOVAL, &ha->flags)) in qla4xxx_intr_handler()
1198 set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); in qla4xxx_intr_handler()
1202 ha->isp_ops->interrupt_service_routine(ha, intr_status); in qla4xxx_intr_handler()
1203 ha->total_io_count++; in qla4xxx_intr_handler()
1209 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_intr_handler()
1221 struct scsi_qla_host *ha = dev_id; in qla4_82xx_intr_handler() local
1227 if (unlikely(pci_channel_offline(ha->pdev))) in qla4_82xx_intr_handler()
1230 ha->isr_count++; in qla4_82xx_intr_handler()
1231 status = qla4_82xx_rd_32(ha, ISR_INT_VECTOR); in qla4_82xx_intr_handler()
1232 if (!(status & ha->nx_legacy_intr.int_vec_bit)) in qla4_82xx_intr_handler()
1235 status = qla4_82xx_rd_32(ha, ISR_INT_STATE_REG); in qla4_82xx_intr_handler()
1237 DEBUG7(ql4_printk(KERN_INFO, ha, in qla4_82xx_intr_handler()
1243 qla4_82xx_wr_32(ha, ha->nx_legacy_intr.tgt_status_reg, 0xffffffff); in qla4_82xx_intr_handler()
1246 qla4_82xx_rd_32(ha, ISR_INT_VECTOR); in qla4_82xx_intr_handler()
1247 qla4_82xx_rd_32(ha, ISR_INT_VECTOR); in qla4_82xx_intr_handler()
1249 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4_82xx_intr_handler()
1251 if (!(readl(&ha->qla4_82xx_reg->host_int) & in qla4_82xx_intr_handler()
1253 qla4_82xx_spurious_interrupt(ha, reqs_count); in qla4_82xx_intr_handler()
1256 intr_status = readl(&ha->qla4_82xx_reg->host_status); in qla4_82xx_intr_handler()
1259 qla4_82xx_spurious_interrupt(ha, reqs_count); in qla4_82xx_intr_handler()
1263 ha->isp_ops->interrupt_service_routine(ha, intr_status); in qla4_82xx_intr_handler()
1266 qla4_82xx_wr_32(ha, ha->nx_legacy_intr.tgt_mask_reg, 0xfbff); in qla4_82xx_intr_handler()
1272 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4_82xx_intr_handler()
1287 struct scsi_qla_host *ha = dev_id; in qla4_83xx_intr_handler() local
1291 ha->isr_count++; in qla4_83xx_intr_handler()
1292 leg_int_ptr = readl(&ha->qla4_83xx_reg->leg_int_ptr); in qla4_83xx_intr_handler()
1296 DEBUG7(ql4_printk(KERN_ERR, ha, in qla4_83xx_intr_handler()
1303 if ((leg_int_ptr & PF_BITS_MASK) != ha->pf_bit) { in qla4_83xx_intr_handler()
1304 DEBUG7(ql4_printk(KERN_ERR, ha, in qla4_83xx_intr_handler()
1307 ha->pf_bit)); in qla4_83xx_intr_handler()
1315 writel(0, &ha->qla4_83xx_reg->leg_int_trig); in qla4_83xx_intr_handler()
1317 leg_int_ptr = readl(&ha->qla4_83xx_reg->leg_int_ptr); in qla4_83xx_intr_handler()
1318 if ((leg_int_ptr & PF_BITS_MASK) != ha->pf_bit) in qla4_83xx_intr_handler()
1322 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4_83xx_intr_handler()
1323 leg_int_ptr = readl(&ha->qla4_83xx_reg->risc_intr); in qla4_83xx_intr_handler()
1324 ha->isp_ops->interrupt_service_routine(ha, leg_int_ptr); in qla4_83xx_intr_handler()
1325 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4_83xx_intr_handler()
1333 struct scsi_qla_host *ha; in qla4_8xxx_msi_handler() local
1335 ha = (struct scsi_qla_host *) dev_id; in qla4_8xxx_msi_handler()
1336 if (!ha) { in qla4_8xxx_msi_handler()
1342 ha->isr_count++; in qla4_8xxx_msi_handler()
1344 qla4_82xx_wr_32(ha, ha->nx_legacy_intr.tgt_status_reg, 0xffffffff); in qla4_8xxx_msi_handler()
1347 qla4_82xx_rd_32(ha, ISR_INT_VECTOR); in qla4_8xxx_msi_handler()
1348 qla4_82xx_rd_32(ha, ISR_INT_VECTOR); in qla4_8xxx_msi_handler()
1355 struct scsi_qla_host *ha = dev_id; in qla4_83xx_mailbox_intr_handler() local
1359 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4_83xx_mailbox_intr_handler()
1361 ival = readl(&ha->qla4_83xx_reg->risc_intr); in qla4_83xx_mailbox_intr_handler()
1363 ql4_printk(KERN_INFO, ha, in qla4_83xx_mailbox_intr_handler()
1366 ival = readl(&ha->qla4_83xx_reg->mb_int_mask); in qla4_83xx_mailbox_intr_handler()
1368 writel(ival, &ha->qla4_83xx_reg->mb_int_mask); in qla4_83xx_mailbox_intr_handler()
1372 qla4xxx_isr_decode_mailbox(ha, in qla4_83xx_mailbox_intr_handler()
1373 readl(&ha->qla4_83xx_reg->mailbox_out[0])); in qla4_83xx_mailbox_intr_handler()
1374 writel(0, &ha->qla4_83xx_reg->risc_intr); in qla4_83xx_mailbox_intr_handler()
1375 ival = readl(&ha->qla4_83xx_reg->mb_int_mask); in qla4_83xx_mailbox_intr_handler()
1377 writel(ival, &ha->qla4_83xx_reg->mb_int_mask); in qla4_83xx_mailbox_intr_handler()
1378 ha->isr_count++; in qla4_83xx_mailbox_intr_handler()
1380 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4_83xx_mailbox_intr_handler()
1395 struct scsi_qla_host *ha = dev_id; in qla4_8xxx_default_intr_handler() local
1400 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4_8xxx_default_intr_handler()
1403 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4_8xxx_default_intr_handler()
1405 if (!(readl(&ha->qla4_82xx_reg->host_int) & in qla4_8xxx_default_intr_handler()
1407 qla4_82xx_spurious_interrupt(ha, reqs_count); in qla4_8xxx_default_intr_handler()
1411 intr_status = readl(&ha->qla4_82xx_reg->host_status); in qla4_8xxx_default_intr_handler()
1414 qla4_82xx_spurious_interrupt(ha, reqs_count); in qla4_8xxx_default_intr_handler()
1418 ha->isp_ops->interrupt_service_routine(ha, intr_status); in qla4_8xxx_default_intr_handler()
1423 ha->isr_count++; in qla4_8xxx_default_intr_handler()
1424 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4_8xxx_default_intr_handler()
1432 struct scsi_qla_host *ha = dev_id; in qla4_8xxx_msix_rsp_q() local
1437 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4_8xxx_msix_rsp_q()
1438 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4_8xxx_msix_rsp_q()
1439 ival = readl(&ha->qla4_83xx_reg->iocb_int_mask); in qla4_8xxx_msix_rsp_q()
1441 ql4_printk(KERN_INFO, ha, "%s: It is a spurious iocb interrupt!\n", in qla4_8xxx_msix_rsp_q()
1445 qla4xxx_process_response_queue(ha); in qla4_8xxx_msix_rsp_q()
1446 writel(0, &ha->qla4_83xx_reg->iocb_int_mask); in qla4_8xxx_msix_rsp_q()
1448 intr_status = readl(&ha->qla4_82xx_reg->host_status); in qla4_8xxx_msix_rsp_q()
1450 qla4xxx_process_response_queue(ha); in qla4_8xxx_msix_rsp_q()
1451 writel(0, &ha->qla4_82xx_reg->host_int); in qla4_8xxx_msix_rsp_q()
1453 ql4_printk(KERN_INFO, ha, "%s: spurious iocb interrupt...\n", in qla4_8xxx_msix_rsp_q()
1458 ha->isr_count++; in qla4_8xxx_msix_rsp_q()
1460 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4_8xxx_msix_rsp_q()
1475 void qla4xxx_process_aen(struct scsi_qla_host * ha, uint8_t process_aen) in qla4xxx_process_aen() argument
1482 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_process_aen()
1483 while (ha->aen_out != ha->aen_in) { in qla4xxx_process_aen()
1484 aen = &ha->aen_q[ha->aen_out]; in qla4xxx_process_aen()
1489 ha->aen_q_count++; in qla4xxx_process_aen()
1490 ha->aen_out++; in qla4xxx_process_aen()
1492 if (ha->aen_out == MAX_AEN_ENTRIES) in qla4xxx_process_aen()
1493 ha->aen_out = 0; in qla4xxx_process_aen()
1495 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_process_aen()
1498 " mbx3=0x%08x mbx4=0x%08x\n", ha->host_no, in qla4xxx_process_aen()
1499 (ha->aen_out ? (ha->aen_out-1): (MAX_AEN_ENTRIES-1)), in qla4xxx_process_aen()
1509 ha->host_no, ha->aen_out, in qla4xxx_process_aen()
1517 qla4xxx_process_ddb_changed(ha, in qla4xxx_process_aen()
1523 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_process_aen()
1525 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_process_aen()
1528 int qla4xxx_request_irqs(struct scsi_qla_host *ha) in qla4xxx_request_irqs() argument
1533 if (is_qla40XX(ha)) in qla4xxx_request_irqs()
1538 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4xxx_request_irqs()
1539 …ql4_printk(KERN_INFO, ha, "%s: MSI Interrupts not supported for ISP%04x, Falling back-to INTx mode… in qla4xxx_request_irqs()
1540 __func__, ha->pdev->device); in qla4xxx_request_irqs()
1550 ret = qla4_8xxx_enable_msix(ha); in qla4xxx_request_irqs()
1552 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_request_irqs()
1553 "MSI-X: Enabled (0x%X).\n", ha->revision_id)); in qla4xxx_request_irqs()
1556 if (is_qla8032(ha) || is_qla8042(ha)) { in qla4xxx_request_irqs()
1557 ql4_printk(KERN_INFO, ha, "%s: ISP%04x: MSI-X: Falling back-to INTx mode. ret = %d\n", in qla4xxx_request_irqs()
1558 __func__, ha->pdev->device, ret); in qla4xxx_request_irqs()
1563 ql4_printk(KERN_WARNING, ha, in qla4xxx_request_irqs()
1568 ret = pci_alloc_irq_vectors(ha->pdev, 1, 1, PCI_IRQ_MSI); in qla4xxx_request_irqs()
1570 ret = request_irq(ha->pdev->irq, qla4_8xxx_msi_handler, in qla4xxx_request_irqs()
1571 0, DRIVER_NAME, ha); in qla4xxx_request_irqs()
1573 DEBUG2(ql4_printk(KERN_INFO, ha, "MSI: Enabled.\n")); in qla4xxx_request_irqs()
1576 ql4_printk(KERN_WARNING, ha, in qla4xxx_request_irqs()
1578 "already in use.\n", ha->pdev->irq); in qla4xxx_request_irqs()
1579 pci_free_irq_vectors(ha->pdev); in qla4xxx_request_irqs()
1584 if (is_qla8022(ha)) { in qla4xxx_request_irqs()
1585 ql4_printk(KERN_WARNING, ha, "%s: ISP82xx Legacy interrupt not supported\n", in qla4xxx_request_irqs()
1591 ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler, in qla4xxx_request_irqs()
1592 IRQF_SHARED, DRIVER_NAME, ha); in qla4xxx_request_irqs()
1594 DEBUG2(ql4_printk(KERN_INFO, ha, "INTx: Enabled.\n")); in qla4xxx_request_irqs()
1598 ql4_printk(KERN_WARNING, ha, in qla4xxx_request_irqs()
1600 " use.\n", ha->pdev->irq); in qla4xxx_request_irqs()
1605 set_bit(AF_IRQ_ATTACHED, &ha->flags); in qla4xxx_request_irqs()
1606 ha->host->irq = ha->pdev->irq; in qla4xxx_request_irqs()
1607 ql4_printk(KERN_INFO, ha, "%s: irq %d attached\n", in qla4xxx_request_irqs()
1608 __func__, ha->pdev->irq); in qla4xxx_request_irqs()
1614 void qla4xxx_free_irqs(struct scsi_qla_host *ha) in qla4xxx_free_irqs() argument
1616 if (!test_and_clear_bit(AF_IRQ_ATTACHED, &ha->flags)) in qla4xxx_free_irqs()
1619 if (ha->pdev->msix_enabled) in qla4xxx_free_irqs()
1620 free_irq(pci_irq_vector(ha->pdev, 1), ha); in qla4xxx_free_irqs()
1621 free_irq(pci_irq_vector(ha->pdev, 0), ha); in qla4xxx_free_irqs()
1622 pci_free_irq_vectors(ha->pdev); in qla4xxx_free_irqs()