32 cmd->
device->lun, __func__));
47 "ASL= %02x, ASC/ASCQ = %02x/%02x\n", ha->
host_no,
49 cmd->
device->lun, __func__,
88 "back to OS srb=%p srb->state:%d\n", ha->
host_no,
89 __func__, srb, srb->
state));
127 "handle=0x%0x, srb=%p\n", __func__,
138 DEBUG2(
printk(
"scsi%ld: %s: Command already returned back to "
139 "OS pkt->handle=%d srb=%p srb->state:%d\n",
143 " already returned to OS (srb=%p)\n", srb);
147 ddb_entry = srb->
ddb;
148 if (ddb_entry ==
NULL) {
150 goto status_entry_exit;
166 scsi_set_resid(cmd, residual);
167 if (!scsi_status && ((scsi_bufflen(cmd) - residual) <
173 "Mid-layer Data underrun0, "
175 "residual = 0x%x\n", ha->
host_no,
178 cmd->
device->lun, __func__,
179 scsi_bufflen(cmd), residual));
190 qla4xxx_copy_sense(ha, sts_entry, srb);
200 DEBUG2(
printk(
"scsi%ld:%d:%d:%d: %s: Device RESET occurred\n",
235 DEBUG2(
printk(
"scsi%ld:%d:%d:%d: %s: " "Data overrun\n",
238 cmd->
device->lun, __func__));
244 scsi_set_resid(cmd, residual);
259 if (!scsi_status && (scsi_bufflen(cmd) - residual) <
262 "scsi%ld:%d:%d:%d: %s: Mid-layer Data underrun, xferlen = 0x%x,residual = 0x%x\n",
266 cmd->
device->lun, __func__,
294 "scsi%ld:%d:%d:%d: %s: Dropped frame(s) detected (0x%x of 0x%x bytes).\n",
298 cmd->
device->lun, __func__,
303 goto check_scsi_status;
310 qla4xxx_copy_sense(ha, sts_entry, srb);
337 "compl=%02x, scsi=%02x, state=%02x, iFlags=%02x,"
339 cmd->
device->lun, __func__,
364 static void qla4xxx_passthru_status_entry(
struct scsi_qla_host *ha,
368 struct ddb_entry *ddb_entry;
378 ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index);
380 if (ddb_entry ==
NULL) {
382 __func__, sts_entry->
target);
386 cls_conn = ddb_entry->
conn;
388 spin_lock(&conn->
session->lock);
390 spin_unlock(&conn->
session->lock);
404 static struct mrb *qla4xxx_del_mrb_from_active_array(
struct scsi_qla_host *ha,
425 static void qla4xxx_mbox_status_entry(
struct scsi_qla_host *ha,
432 mrb = qla4xxx_del_mrb_from_active_array(ha,
444 "mbox_sts[0] = 0x%x, mbox_sts[6] = 0x%x\n",
452 status = mbox_sts_entry->
out_mbox[6];
454 data_size =
sizeof(mbox_sts_entry->
out_mbox);
462 "0x%x\n", __func__, mrb->
mbox_cmd));
479 struct srb *srb =
NULL;
497 switch (sts_entry->
hdr.entryType) {
500 qla4xxx_status_entry(ha, sts_entry);
505 qla4xxx_passthru_status_entry(ha,
509 "%s: Invalid status received\n",
515 qla4xxx_status_cont_entry(ha,
528 goto exit_prq_invalid_handle;
531 "srb %p\n", ha->
host_no, __func__, srb));
542 "ignoring\n", ha->
host_no, __func__));
547 "%s: mbox status IOCB\n", __func__));
548 qla4xxx_mbox_status_entry(ha,
558 "response queue \n", ha->
host_no,
560 sts_entry->
hdr.entryType));
570 ha->
isp_ops->complete_iocb(ha);
574 exit_prq_invalid_handle:
575 DEBUG2(
printk(
"scsi%ld: %s: Invalid handle(srb)=%p type=%x IOCS=%x\n",
576 ha->
host_no, __func__, srb, sts_entry->
hdr.entryType,
580 ha->
isp_ops->complete_iocb(ha);
592 static void qla4xxx_isr_decode_mailbox(
struct scsi_qla_host * ha,
601 else if (is_qla8022(ha))
604 mailbox_out = &ha->
reg->mailbox[0];
626 mbox_sts[i] =
readl(&mailbox_out[i]);
636 switch (mbox_status) {
658 "Reset HA\n", ha->
host_no, mbox_status));
694 "ACQUIRED\n", ha->
host_no, mbox_status));
712 printk(
"scsi%ld: AEN %04x, mbox_sts[2]=%04x, "
713 "mbox_sts[3]=%04x\n", ha->
host_no, mbox_sts[0],
714 mbox_sts[2], mbox_sts[3]);
737 "mbox_sts[1]=%04x, mbox_sts[2]=%04x\n",
739 mbox_sts[1], mbox_sts[2]));
746 "mbox_sts[2]=%04x, mbox_sts[3]=%04x\n",
747 ha->
host_no, mbox_sts[0], mbox_sts[1],
748 mbox_sts[2], mbox_sts[3]));
765 "mb1:0x%x mb2:0x%x mb3:0x%x "
766 "mb4:0x%x mb5:0x%x\n",
768 mbox_sts[0], mbox_sts[1],
769 mbox_sts[2], mbox_sts[3],
770 mbox_sts[4], mbox_sts[5]));
781 "overflowed! AEN LOST!!\n",
790 "%04x\n", i, mbox_sts[0],
791 mbox_sts[1], mbox_sts[2],
799 "scsi%ld: AEN %04x Transceiver"
800 " inserted\n", ha->
host_no, mbox_sts[0]));
805 "scsi%ld: AEN %04x Transceiver"
806 " removed\n", ha->
host_no, mbox_sts[0]));
812 if (is_qla8032(ha)) {
814 "scsi%ld: AEN %04x, mbox_sts[1]=%08x, mbox_sts[2]=%08x, mbox_sts[3]=%08x, mbox_sts[4]=%08x\n",
816 mbox_sts[1], mbox_sts[2],
817 mbox_sts[3], mbox_sts[4]));
818 opcode = mbox_sts[1] >> 16;
823 ha->
idc_info.request_desc = mbox_sts[1];
834 if (is_qla8032(ha)) {
836 "scsi%ld: AEN %04x, mbox_sts[1]=%08x, mbox_sts[2]=%08x, mbox_sts[3]=%08x, mbox_sts[4]=%08x\n",
838 mbox_sts[1], mbox_sts[2],
839 mbox_sts[3], mbox_sts[4]));
841 "scsi:%ld: AEN %04x IDC Complete notification\n",
848 "scsi%ld: AEN %04x UNKNOWN\n",
865 qla4xxx_isr_decode_mailbox(ha,
893 qla4xxx_isr_decode_mailbox(ha,
917 qla4xxx_isr_decode_mailbox(ha,
921 writel(set_rmask(CSR_SCSI_PROCESSOR_INTR),
922 &ha->
reg->ctrl_status);
933 static void qla4_82xx_spurious_interrupt(
struct scsi_qla_host *ha,
940 if (is_qla8022(ha)) {
958 unsigned long flags = 0;
964 "qla4xxx: Interrupt with NULL host ptr\n"));
979 if (ha->
isp_ops->rd_shdw_rsp_q_in(ha) !=
983 intr_status =
readl(&ha->
reg->ctrl_status);
994 "Status 0x%04x\n", ha->
host_no,
995 readl(isp_port_error_status (ha))));
1004 if ((
readl(&ha->
reg->ctrl_status) &
1007 &ha->
reg->ctrl_status);
1011 writel(set_rmask(CSR_FATAL_ERROR),
1012 &ha->
reg->ctrl_status);
1015 __qla4xxx_disable_intrs(ha);
1022 __qla4xxx_disable_intrs(ha);
1024 writel(set_rmask(CSR_SCSI_RESET_INTR),
1025 &ha->
reg->ctrl_status);
1033 ha->
isp_ops->interrupt_service_routine(ha, intr_status);
1040 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1055 unsigned long flags = 0;
1069 "%s legacy Int not triggered\n", __func__));
1084 qla4_82xx_spurious_interrupt(ha, reqs_count);
1090 qla4_82xx_spurious_interrupt(ha, reqs_count);
1094 ha->
isp_ops->interrupt_service_routine(ha, intr_status);
1103 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1107 #define LEG_INT_PTR_B31 (1 << 31)
1108 #define LEG_INT_PTR_B30 (1 << 30)
1109 #define PF_BITS_MASK (0xF << 16)
1120 unsigned long flags = 0;
1128 "%s: Legacy Interrupt Bit 31 not set, spurious interrupt!\n",
1136 "%s: Incorrect function ID 0x%x in legacy interrupt register, ha->pf_bit = 0x%x\n",
1137 __func__, (leg_int_ptr & PF_BITS_MASK), ha->
pf_bit);
1148 if ((leg_int_ptr & PF_BITS_MASK) != ha->
pf_bit)
1154 ha->
isp_ops->interrupt_service_routine(ha, leg_int_ptr);
1155 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1168 "qla4xxx: MSIX: Interrupt with NULL host ptr\n"));
1186 unsigned long flags;
1194 "%s: It is a spurious mailbox interrupt!\n",
1202 qla4xxx_isr_decode_mailbox(ha,
1210 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1226 unsigned long flags;
1230 if (is_qla8032(ha)) {
1231 qla4_83xx_mailbox_intr_handler(irq, dev_id);
1237 qla4_82xx_spurious_interrupt(ha, reqs_count);
1244 qla4_82xx_spurious_interrupt(ha, reqs_count);
1248 ha->
isp_ops->interrupt_service_routine(ha, intr_status);
1254 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1263 unsigned long flags;
1267 if (is_qla8032(ha)) {
1272 goto exit_msix_rsp_q;
1282 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1302 unsigned long flags;
1317 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1319 DEBUG2(
printk(
"qla4xxx(%ld): AEN[%d]=0x%08x, mbx1=0x%08x mbx2=0x%08x"
1320 " mbx3=0x%08x mbx4=0x%08x\n", ha->
host_no,
1322 mbox_sts[0], mbox_sts[1], mbox_sts[2],
1323 mbox_sts[3], mbox_sts[4]));
1325 switch (mbox_sts[0]) {
1327 switch (process_aen) {
1330 "[%d] state=%04x FLUSHED!\n",
1332 mbox_sts[0], mbox_sts[2],
1338 if (mbox_sts[1] == 1)
1340 mbox_sts[2], mbox_sts[3],
1347 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1359 if (is_qla8032(ha)) {
1360 ql4_printk(
KERN_INFO, ha,
"%s: MSI Interrupts not supported for ISP8324, Falling back-to INTx mode\n",
1377 if (is_qla8032(ha)) {
1385 "MSI-X: Falling back-to MSI mode -- %d.\n", ret);
1389 ret = pci_enable_msi(ha->
pdev);
1399 "MSI: Failed to reserve interrupt %d "
1400 "already in use.\n", ha->
pdev->irq);
1409 if (is_qla8022(ha)) {
1411 goto irq_not_attached;
1424 "INTx: Failed to reserve interrupt %d already in"
1425 " use.\n", ha->
pdev->irq);
1426 goto irq_not_attached;
1433 __func__, ha->
pdev->irq);