#define DEBUG_FLAGS SCSI_NCR_DEBUG_FLAGS
#endif
+/*
+ * Locally used status flag
+ */
+#define SAM_STAT_ILLEGAL 0xff
+
static inline struct list_head *ncr_list_pop(struct list_head *head)
{
if (!list_empty(head)) {
** Other definitions
*/
-#define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f))
-
#define initverbose (driver_setup.verbose)
#define bootverbose (np->verbose)
*/
SCR_FROM_REG (SS_REG),
0,
- SCR_CALL ^ IFFALSE (DATA (S_GOOD)),
+ SCR_CALL ^ IFFALSE (DATA (SAM_STAT_GOOD)),
PADDRH (bad_status),
#ifndef SCSI_NCR_CCB_DONE_SUPPORT
8,
SCR_TO_REG (HS_REG),
0,
- SCR_LOAD_REG (SS_REG, S_GOOD),
+ SCR_LOAD_REG (SS_REG, SAM_STAT_GOOD),
0,
SCR_JUMP,
PADDR (cleanup_ok),
PADDRH (reset),
}/*-------------------------< BAD_STATUS >-----------------*/,{
/*
- ** If command resulted in either QUEUE FULL,
+ ** If command resulted in either TASK_SET FULL,
** CHECK CONDITION or COMMAND TERMINATED,
** call the C code.
*/
- SCR_INT ^ IFTRUE (DATA (S_QUEUE_FULL)),
+ SCR_INT ^ IFTRUE (DATA (SAM_STAT_TASK_SET_FULL)),
SIR_BAD_STATUS,
- SCR_INT ^ IFTRUE (DATA (S_CHECK_COND)),
+ SCR_INT ^ IFTRUE (DATA (SAM_STAT_CHECK_CONDITION)),
SIR_BAD_STATUS,
- SCR_INT ^ IFTRUE (DATA (S_TERMINATED)),
+ SCR_INT ^ IFTRUE (DATA (SAM_STAT_COMMAND_TERMINATED)),
SIR_BAD_STATUS,
SCR_RETURN,
0,
*/
cp->actualquirks = 0;
cp->host_status = cp->nego_status ? HS_NEGOTIATE : HS_BUSY;
- cp->scsi_status = S_ILLEGAL;
+ cp->scsi_status = SAM_STAT_ILLEGAL;
cp->parity_status = 0;
cp->xerr_status = XE_OK;
* in order to keep it alive.
*/
if (!found && sync_reset && !retrieve_from_waiting_list(0, np, cmd)) {
- cmd->result = DID_RESET << 16;
+ set_host_byte(cmd, DID_RESET);
ncr_queue_done_cmd(np, cmd);
}
* First, look for the scsi command in the waiting list
*/
if (remove_from_waiting_list(np, cmd)) {
- cmd->result = ScsiResult(DID_ABORT, 0);
+ set_host_byte(cmd, DID_ABORT);
ncr_queue_done_cmd(np, cmd);
return SCSI_ABORT_SUCCESS;
}
** Print out any error for debugging purpose.
*/
if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) {
- if (cp->host_status!=HS_COMPLETE || cp->scsi_status!=S_GOOD) {
+ if (cp->host_status != HS_COMPLETE ||
+ cp->scsi_status != SAM_STAT_GOOD) {
PRINT_ADDR(cmd, "ERROR: cmd=%x host_status=%x "
"scsi_status=%x\n", cmd->cmnd[0],
cp->host_status, cp->scsi_status);
/*
** Check the status.
*/
+ cmd->result = 0;
if ( (cp->host_status == HS_COMPLETE)
- && (cp->scsi_status == S_GOOD ||
- cp->scsi_status == S_COND_MET)) {
+ && (cp->scsi_status == SAM_STAT_GOOD ||
+ cp->scsi_status == SAM_STAT_CONDITION_MET)) {
/*
* All went well (GOOD status).
- * CONDITION MET status is returned on
+ * CONDITION MET status is returned on
* `Pre-Fetch' or `Search data' success.
*/
- cmd->result = ScsiResult(DID_OK, cp->scsi_status);
+ set_status_byte(cmd, cp->scsi_status);
/*
** @RESID@
}
}
} else if ((cp->host_status == HS_COMPLETE)
- && (cp->scsi_status == S_CHECK_COND)) {
+ && (cp->scsi_status == SAM_STAT_CHECK_CONDITION)) {
/*
** Check condition code
*/
- cmd->result = DID_OK << 16 | S_CHECK_COND;
+ set_status_byte(cmd, SAM_STAT_CHECK_CONDITION);
/*
** Copy back sense data to caller's buffer.
printk (".\n");
}
} else if ((cp->host_status == HS_COMPLETE)
- && (cp->scsi_status == S_CONFLICT)) {
+ && (cp->scsi_status == SAM_STAT_RESERVATION_CONFLICT)) {
/*
** Reservation Conflict condition code
*/
- cmd->result = DID_OK << 16 | S_CONFLICT;
-
+ set_status_byte(cmd, SAM_STAT_RESERVATION_CONFLICT);
+
} else if ((cp->host_status == HS_COMPLETE)
- && (cp->scsi_status == S_BUSY ||
- cp->scsi_status == S_QUEUE_FULL)) {
+ && (cp->scsi_status == SAM_STAT_BUSY ||
+ cp->scsi_status == SAM_STAT_TASK_SET_FULL)) {
/*
** Target is busy.
*/
- cmd->result = ScsiResult(DID_OK, cp->scsi_status);
+ set_status_byte(cmd, cp->scsi_status);
} else if ((cp->host_status == HS_SEL_TIMEOUT)
|| (cp->host_status == HS_TIMEOUT)) {
/*
** No response
*/
- cmd->result = ScsiResult(DID_TIME_OUT, cp->scsi_status);
+ set_status_byte(cmd, cp->scsi_status);
+ set_host_byte(cmd, DID_TIME_OUT);
} else if (cp->host_status == HS_RESET) {
/*
** SCSI bus reset
*/
- cmd->result = ScsiResult(DID_RESET, cp->scsi_status);
+ set_status_byte(cmd, sp->scsi_status);
+ set_host_byte(cmd, DID_RESET);
} else if (cp->host_status == HS_ABORTED) {
/*
** Transfer aborted
*/
- cmd->result = ScsiResult(DID_ABORT, cp->scsi_status);
+ set_status_byte(cmd, cp->scsi_status);
+ set_host_byte(cmd, DID_ABORT);
} else {
PRINT_ADDR(cmd, "COMMAND FAILED (%x %x) @%p.\n",
cp->host_status, cp->scsi_status, cp);
- cmd->result = ScsiResult(DID_ERROR, cp->scsi_status);
+ set_status_byte(cmd, cp->scsi_status);
+ set_host_byte(cmd, DID_ERROR);
}
/*
if (cp->host_status==HS_COMPLETE) {
switch (cp->scsi_status) {
- case S_GOOD:
+ case SAM_STAT_GOOD:
printk (" GOOD");
break;
- case S_CHECK_COND:
+ case SAM_STAT_CHECK_CONDITION:
printk (" SENSE:");
p = (u_char*) &cmd->sense_buffer;
for (i=0; i<14; i++)
switch(s_status) {
default: /* Just for safety, should never happen */
- case S_QUEUE_FULL:
+ case SAM_STAT_TASK_SET_FULL:
/*
** Decrease number of tags to the number of
** disconnected commands.
*/
cp->phys.header.savep = cp->startp;
cp->host_status = HS_BUSY;
- cp->scsi_status = S_ILLEGAL;
+ cp->scsi_status = SAM_STAT_ILLEGAL;
ncr_put_start_queue(np, cp);
if (disc_cnt)
INB (nc_ctest2); /* Clear SIGP */
OUTL_DSP (NCB_SCRIPT_PHYS (np, reselect));
return;
- case S_TERMINATED:
- case S_CHECK_COND:
+ case SAM_STAT_COMMAND_TERMINATED:
+ case SAM_STAT_CHECK_CONDIION:
/*
** If we were requesting sense, give up.
*/
cp->phys.header.wlastp = startp;
cp->host_status = HS_BUSY;
- cp->scsi_status = S_ILLEGAL;
+ cp->scsi_status = SAM_STAT_ILLEGAL;
cp->auto_sense = s_status;
cp->start.schedule.l_paddr =
spin_lock_irqsave(&np->smp_lock, flags);
if ((sts = ncr_queue_command(np, cmd)) != DID_OK) {
- cmd->result = sts << 16;
+ set_host_byte(cmd, sts;
#ifdef DEBUG_NCR53C8XX
printk("ncr53c8xx : command not queued - result=%d\n", sts);
#endif
#ifdef DEBUG_WAITING_LIST
printk("%s: cmd %lx done forced sts=%d\n", ncr_name(np), (u_long) wcmd, sts);
#endif
- wcmd->result = sts << 16;
+ set_host_byte(wcmd, sts);
ncr_queue_done_cmd(np, wcmd);
}
}