Commit aec166fd authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: aha152x: Modify done() to use separate status bytes

Instead of passing in the combined SCSI result values, split them off into
separate status, message, and host byte values.

Link: https://lore.kernel.org/r/20210427083046.31620-30-hare@suse.deSigned-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a9d2d806
...@@ -619,7 +619,8 @@ static struct { ...@@ -619,7 +619,8 @@ static struct {
static irqreturn_t intr(int irq, void *dev_id); static irqreturn_t intr(int irq, void *dev_id);
static void reset_ports(struct Scsi_Host *shpnt); static void reset_ports(struct Scsi_Host *shpnt);
static void aha152x_error(struct Scsi_Host *shpnt, char *msg); static void aha152x_error(struct Scsi_Host *shpnt, char *msg);
static void done(struct Scsi_Host *shpnt, int error); static void done(struct Scsi_Host *shpnt, unsigned char status_byte,
unsigned char msg_byte, unsigned char host_byte);
/* diagnostics */ /* diagnostics */
static void show_command(struct scsi_cmnd * ptr); static void show_command(struct scsi_cmnd * ptr);
...@@ -1271,7 +1272,8 @@ static int aha152x_biosparam(struct scsi_device *sdev, struct block_device *bdev ...@@ -1271,7 +1272,8 @@ static int aha152x_biosparam(struct scsi_device *sdev, struct block_device *bdev
* Internal done function * Internal done function
* *
*/ */
static void done(struct Scsi_Host *shpnt, int error) static void done(struct Scsi_Host *shpnt, unsigned char status_byte,
unsigned char msg_byte, unsigned char host_byte)
{ {
if (CURRENT_SC) { if (CURRENT_SC) {
if(DONE_SC) if(DONE_SC)
...@@ -1281,7 +1283,9 @@ static void done(struct Scsi_Host *shpnt, int error) ...@@ -1281,7 +1283,9 @@ static void done(struct Scsi_Host *shpnt, int error)
DONE_SC = CURRENT_SC; DONE_SC = CURRENT_SC;
CURRENT_SC = NULL; CURRENT_SC = NULL;
DONE_SC->result = error; DONE_SC->result = status_byte;
set_msg_byte(DONE_SC, msg_byte);
set_host_byte(DONE_SC, host_byte);
} else } else
printk(KERN_ERR "aha152x: done() called outside of command\n"); printk(KERN_ERR "aha152x: done() called outside of command\n");
} }
...@@ -1376,13 +1380,16 @@ static void busfree_run(struct Scsi_Host *shpnt) ...@@ -1376,13 +1380,16 @@ static void busfree_run(struct Scsi_Host *shpnt)
if(CURRENT_SC->SCp.phase & completed) { if(CURRENT_SC->SCp.phase & completed) {
/* target sent COMMAND COMPLETE */ /* target sent COMMAND COMPLETE */
done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_OK << 16)); done(shpnt, CURRENT_SC->SCp.Status,
CURRENT_SC->SCp.Message, DID_OK);
} else if(CURRENT_SC->SCp.phase & aborted) { } else if(CURRENT_SC->SCp.phase & aborted) {
done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_ABORT << 16)); done(shpnt, CURRENT_SC->SCp.Status,
CURRENT_SC->SCp.Message, DID_ABORT);
} else if(CURRENT_SC->SCp.phase & resetted) { } else if(CURRENT_SC->SCp.phase & resetted) {
done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_RESET << 16)); done(shpnt, CURRENT_SC->SCp.Status,
CURRENT_SC->SCp.Message, DID_RESET);
} else if(CURRENT_SC->SCp.phase & disconnected) { } else if(CURRENT_SC->SCp.phase & disconnected) {
/* target sent DISCONNECT */ /* target sent DISCONNECT */
...@@ -1394,7 +1401,8 @@ static void busfree_run(struct Scsi_Host *shpnt) ...@@ -1394,7 +1401,8 @@ static void busfree_run(struct Scsi_Host *shpnt)
CURRENT_SC = NULL; CURRENT_SC = NULL;
} else { } else {
done(shpnt, DID_ERROR << 16); done(shpnt, SAM_STAT_GOOD,
COMMAND_COMPLETE, DID_ERROR);
} }
#if defined(AHA152X_STAT) #if defined(AHA152X_STAT)
} else { } else {
...@@ -1515,7 +1523,8 @@ static void seldo_run(struct Scsi_Host *shpnt) ...@@ -1515,7 +1523,8 @@ static void seldo_run(struct Scsi_Host *shpnt)
if (TESTLO(SSTAT0, SELDO)) { if (TESTLO(SSTAT0, SELDO)) {
scmd_printk(KERN_ERR, CURRENT_SC, scmd_printk(KERN_ERR, CURRENT_SC,
"aha152x: passing bus free condition\n"); "aha152x: passing bus free condition\n");
done(shpnt, DID_NO_CONNECT << 16); done(shpnt, SAM_STAT_GOOD,
COMMAND_COMPLETE, DID_NO_CONNECT);
return; return;
} }
...@@ -1552,12 +1561,15 @@ static void selto_run(struct Scsi_Host *shpnt) ...@@ -1552,12 +1561,15 @@ static void selto_run(struct Scsi_Host *shpnt)
CURRENT_SC->SCp.phase &= ~selecting; CURRENT_SC->SCp.phase &= ~selecting;
if (CURRENT_SC->SCp.phase & aborted) if (CURRENT_SC->SCp.phase & aborted)
done(shpnt, DID_ABORT << 16); done(shpnt, SAM_STAT_GOOD,
COMMAND_COMPLETE, DID_ABORT);
else if (TESTLO(SSTAT0, SELINGO)) else if (TESTLO(SSTAT0, SELINGO))
done(shpnt, DID_BUS_BUSY << 16); done(shpnt, SAM_STAT_GOOD,
COMMAND_COMPLETE, DID_BUS_BUSY);
else else
/* ARBITRATION won, but SELECTION failed */ /* ARBITRATION won, but SELECTION failed */
done(shpnt, DID_NO_CONNECT << 16); done(shpnt, SAM_STAT_GOOD,
COMMAND_COMPLETE, DID_NO_CONNECT);
} }
/* /*
...@@ -1891,7 +1903,8 @@ static void cmd_init(struct Scsi_Host *shpnt) ...@@ -1891,7 +1903,8 @@ static void cmd_init(struct Scsi_Host *shpnt)
if (CURRENT_SC->SCp.sent_command) { if (CURRENT_SC->SCp.sent_command) {
scmd_printk(KERN_ERR, CURRENT_SC, scmd_printk(KERN_ERR, CURRENT_SC,
"command already sent\n"); "command already sent\n");
done(shpnt, DID_ERROR << 16); done(shpnt, SAM_STAT_GOOD,
COMMAND_COMPLETE, DID_ERROR);
return; return;
} }
...@@ -2231,7 +2244,8 @@ static int update_state(struct Scsi_Host *shpnt) ...@@ -2231,7 +2244,8 @@ static int update_state(struct Scsi_Host *shpnt)
static void parerr_run(struct Scsi_Host *shpnt) static void parerr_run(struct Scsi_Host *shpnt)
{ {
scmd_printk(KERN_ERR, CURRENT_SC, "parity error\n"); scmd_printk(KERN_ERR, CURRENT_SC, "parity error\n");
done(shpnt, DID_PARITY << 16); done(shpnt, SAM_STAT_GOOD,
COMMAND_COMPLETE, DID_PARITY);
} }
/* /*
...@@ -2262,7 +2276,8 @@ static void rsti_run(struct Scsi_Host *shpnt) ...@@ -2262,7 +2276,8 @@ static void rsti_run(struct Scsi_Host *shpnt)
} }
if(CURRENT_SC && !CURRENT_SC->device->soft_reset) if(CURRENT_SC && !CURRENT_SC->device->soft_reset)
done(shpnt, DID_RESET << 16 ); done(shpnt, SAM_STAT_GOOD,
COMMAND_COMPLETE, DID_RESET);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment