Commit 80d3eb6d authored by Finn Thain's avatar Finn Thain Committed by Martin K. Petersen

atari_NCR5380: Set do_abort() timeouts

Use timeouts in do_abort() in atari_NCR5380.c instead of infinite loops.
Also fix the kernel-doc comment. Keep the two core driver forks in sync.
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Tested-by: default avatarOndrej Zary <linux@rainbow-software.org>
Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f35d3474
...@@ -1458,16 +1458,12 @@ static void do_reset(struct Scsi_Host *instance) ...@@ -1458,16 +1458,12 @@ static void do_reset(struct Scsi_Host *instance)
local_irq_restore(flags); local_irq_restore(flags);
} }
/* /**
* Function : do_abort (Scsi_Host *host) * do_abort - abort the currently established nexus by going to
* * MESSAGE OUT phase and sending an ABORT message.
* Purpose : abort the currently established nexus. Should only be * @instance: relevant scsi host instance
* called from a routine which can drop into a
*
* Returns : 0 on success, -1 on failure.
* *
* Locks: queue lock held by caller * Returns 0 on success, -1 on failure.
* FIXME: sort this out and get new_eh running
*/ */
static int do_abort(struct Scsi_Host *instance) static int do_abort(struct Scsi_Host *instance)
...@@ -1489,9 +1485,9 @@ static int do_abort(struct Scsi_Host *instance) ...@@ -1489,9 +1485,9 @@ static int do_abort(struct Scsi_Host *instance)
* the target sees, so we just handshake. * the target sees, so we just handshake.
*/ */
rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 60 * HZ); rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 10 * HZ);
if (rc < 0) if (rc < 0)
return -1; goto timeout;
tmp = NCR5380_read(STATUS_REG) & PHASE_MASK; tmp = NCR5380_read(STATUS_REG) & PHASE_MASK;
...@@ -1500,9 +1496,9 @@ static int do_abort(struct Scsi_Host *instance) ...@@ -1500,9 +1496,9 @@ static int do_abort(struct Scsi_Host *instance)
if (tmp != PHASE_MSGOUT) { if (tmp != PHASE_MSGOUT) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, 3 * HZ); rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, 3 * HZ);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
if (rc < 0) if (rc < 0)
return -1; goto timeout;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
} }
tmp = ABORT; tmp = ABORT;
msgptr = &tmp; msgptr = &tmp;
...@@ -1516,6 +1512,10 @@ static int do_abort(struct Scsi_Host *instance) ...@@ -1516,6 +1512,10 @@ static int do_abort(struct Scsi_Host *instance)
*/ */
return len ? -1 : 0; return len ? -1 : 0;
timeout:
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
return -1;
} }
#if defined(REAL_DMA) || defined(PSEUDO_DMA) || defined (REAL_DMA_POLL) #if defined(REAL_DMA) || defined(PSEUDO_DMA) || defined (REAL_DMA_POLL)
......
...@@ -1835,19 +1835,19 @@ static void do_reset(struct Scsi_Host *instance) ...@@ -1835,19 +1835,19 @@ static void do_reset(struct Scsi_Host *instance)
local_irq_restore(flags); local_irq_restore(flags);
} }
/* /**
* Function : do_abort (Scsi_Host *host) * do_abort - abort the currently established nexus by going to
* * MESSAGE OUT phase and sending an ABORT message.
* Purpose : abort the currently established nexus. Should only be * @instance: relevant scsi host instance
* called from a routine which can drop into a
* *
* Returns : 0 on success, -1 on failure. * Returns 0 on success, -1 on failure.
*/ */
static int do_abort(struct Scsi_Host *instance) static int do_abort(struct Scsi_Host *instance)
{ {
unsigned char tmp, *msgptr, phase; unsigned char tmp, *msgptr, phase;
int len; int len;
int rc;
/* Request message out phase */ /* Request message out phase */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
...@@ -1862,16 +1862,20 @@ static int do_abort(struct Scsi_Host *instance) ...@@ -1862,16 +1862,20 @@ static int do_abort(struct Scsi_Host *instance)
* the target sees, so we just handshake. * the target sees, so we just handshake.
*/ */
while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ)) rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 10 * HZ);
; if (rc < 0)
goto timeout;
tmp = NCR5380_read(STATUS_REG) & PHASE_MASK;
NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp)); NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
if ((tmp & PHASE_MASK) != PHASE_MSGOUT) { if (tmp != PHASE_MSGOUT) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | NCR5380_write(INITIATOR_COMMAND_REG,
ICR_ASSERT_ACK); ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
while (NCR5380_read(STATUS_REG) & SR_REQ) rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, 3 * HZ);
; if (rc < 0)
goto timeout;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
} }
...@@ -1887,6 +1891,10 @@ static int do_abort(struct Scsi_Host *instance) ...@@ -1887,6 +1891,10 @@ static int do_abort(struct Scsi_Host *instance)
*/ */
return len ? -1 : 0; return len ? -1 : 0;
timeout:
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
return -1;
} }
#if defined(REAL_DMA) #if defined(REAL_DMA)
......
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