* General Public License for more details.
*
*/
-
-#include "qla_os.h"
-
#include "qla_def.h"
static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
}
} else /* IS_QLA23XX(ha) */ {
stat = RD_REG_DWORD(®->u.isp2300.host_status);
- if ((stat & HSR_RISC_INT) == 0)
+ if (stat & HSR_RISC_PAUSED) {
+ hccr = RD_REG_WORD(®->hccr);
+ if (hccr & (BIT_15 | BIT_13 | BIT_11 | BIT_8))
+ qla_printk(KERN_INFO, ha,
+ "Parity error -- HCCR=%x.\n", hccr);
+ else
+ qla_printk(KERN_INFO, ha,
+ "RISC paused -- HCCR=%x\n", hccr);
+
+ /*
+ * Issue a "HARD" reset in order for the RISC
+ * interrupt bit to be cleared. Schedule a big
+ * hammmer to get out of the RISC PAUSED state.
+ */
+ WRT_REG_WORD(®->hccr, HCCR_RESET_RISC);
+ RD_REG_WORD(®->hccr);
+ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
+ break;
+ } else if ((stat & HSR_RISC_INT) == 0)
break;
mbx = MSW(stat);
qla2x00_async_event(ha, mbx);
break;
default:
- hccr = RD_REG_WORD(®->hccr);
- if (hccr & HCCR_RISC_PAUSE) {
- qla_printk(KERN_INFO, ha,
- "RISC paused, dumping HCCR=%x\n",
- hccr);
-
- /*
- * Issue a "HARD" reset in order for
- * the RISC interrupt bit to be
- * cleared. Schedule a big hammmer to
- * get out of the RISC PAUSED state.
- */
- WRT_REG_WORD(®->hccr,
- HCCR_RESET_RISC);
- RD_REG_WORD(®->hccr);
- set_bit(ISP_ABORT_NEEDED,
- &ha->dpc_flags);
- break;
- } else {
- DEBUG2(printk("scsi(%ld): Unrecognized "
- "interrupt type (%d)\n",
- ha->host_no, stat & 0xff));
- }
+ DEBUG2(printk("scsi(%ld): Unrecognized "
+ "interrupt type (%d)\n",
+ ha->host_no, stat & 0xff));
break;
}
WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
device_reg_t *reg = ha->iobase;
/* Load return mailbox registers. */
- ha->flags.mbox_int = TRUE;
+ ha->flags.mbox_int = 1;
ha->mailbox_out[0] = mb0;
wptr = (uint16_t *)MAILBOX_REG(ha, reg, 1);
break;
}
- mb[0] = LSW(mbx);
switch (mb[0]) {
case MBA_SCSI_COMPLETION: /* Fast Post */
if (!ha->flags.online)
sp = ha->outstanding_cmds[index];
if (sp) {
/* Free outstanding command slot. */
- ha->outstanding_cmds[index] = 0;
+ ha->outstanding_cmds[index] = NULL;
if (ha->actthreads)
ha->actthreads--;
uint16_t comp_status;
uint16_t scsi_status;
uint8_t lscsi_status;
- uint32_t resid;
+ int32_t resid;
uint8_t sense_sz = 0;
uint16_t rsp_info_len;
/* Validate handle. */
if (pkt->handle < MAX_OUTSTANDING_COMMANDS) {
sp = ha->outstanding_cmds[pkt->handle];
- ha->outstanding_cmds[pkt->handle] = 0;
+ ha->outstanding_cmds[pkt->handle] = NULL;
} else
sp = NULL;
cp->result = DID_OK << 16;
break;
}
+ if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) {
+ resid = le32_to_cpu(pkt->residual_length);
+ cp->resid = resid;
+ CMD_RESID_LEN(cp) = resid;
+ }
if (lscsi_status == SS_BUSY_CONDITION) {
cp->result = DID_BUS_BUSY << 16 | lscsi_status;
break;
ha->host_no, t, l, comp_status, scsi_status));
resid = le32_to_cpu(pkt->residual_length);
- CMD_RESID_LEN(cp) = resid;
+ if (scsi_status & SS_RESIDUAL_UNDER) {
+ cp->resid = resid;
+ CMD_RESID_LEN(cp) = resid;
+ }
/*
* Check to see if SCSI Status is non zero. If so report SCSI
}
/* Handle mid-layer underflow */
- cp->resid = resid;
if ((unsigned)(cp->request_bufflen - resid) <
cp->underflow) {
qla_printk(KERN_INFO, ha,
if (sp) {
/* Free outstanding command slot. */
- ha->outstanding_cmds[pkt->handle] = 0;
+ ha->outstanding_cmds[pkt->handle] = NULL;
if (ha->actthreads)
ha->actthreads--;
sp->lun_queue->out_cnt--;
CMD_ENTRY_STATUS(sp->cmd) = pkt->entry_status;
/* Free outstanding command slot. */
- ha->outstanding_cmds[pkt->handle1] = 0;
+ ha->outstanding_cmds[pkt->handle1] = NULL;
add_to_done_queue(ha, sp);
}