@@ -1318,17 +1318,19 @@ static void NCR5380_transfer_pio(struct Scsi_Host *instance,
1318
1318
1319
1319
dsprintk (NDEBUG_HANDSHAKE , instance , "REQ negated, handshake complete\n" );
1320
1320
1321
- /*
1322
- * We have several special cases to consider during REQ/ACK handshaking :
1323
- * 1. We were in MSGOUT phase, and we are on the last byte of the
1324
- * message. ATN must be dropped as ACK is dropped.
1325
- *
1326
- * 2. We are in a MSGIN phase, and we are on the last byte of the
1327
- * message. We must exit with ACK asserted, so that the calling
1328
- * code may raise ATN before dropping ACK to reject the message.
1329
- *
1330
- * 3. ACK and ATN are clear and the target may proceed as normal.
1331
- */
1321
+ /*
1322
+ * We have several special cases to consider during REQ/ACK
1323
+ * handshaking:
1324
+ *
1325
+ * 1. We were in MSGOUT phase, and we are on the last byte of
1326
+ * the message. ATN must be dropped as ACK is dropped.
1327
+ *
1328
+ * 2. We are in MSGIN phase, and we are on the last byte of the
1329
+ * message. We must exit with ACK asserted, so that the calling
1330
+ * code may raise ATN before dropping ACK to reject the message.
1331
+ *
1332
+ * 3. ACK and ATN are clear & the target may proceed as normal.
1333
+ */
1332
1334
if (!(p == PHASE_MSGIN && c == 1 )) {
1333
1335
if (p == PHASE_MSGOUT && c > 1 )
1334
1336
NCR5380_write (INITIATOR_COMMAND_REG , ICR_BASE | ICR_ASSERT_ATN );
@@ -1559,39 +1561,41 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1559
1561
/* The result is zero iff pseudo DMA send/receive was completed. */
1560
1562
hostdata -> dma_len = c ;
1561
1563
1562
- /*
1563
- * A note regarding the DMA errata workarounds for early NMOS silicon.
1564
- *
1565
- * For DMA sends, we want to wait until the last byte has been
1566
- * transferred out over the bus before we turn off DMA mode. Alas, there
1567
- * seems to be no terribly good way of doing this on a 5380 under all
1568
- * conditions. For non-scatter-gather operations, we can wait until REQ
1569
- * and ACK both go false, or until a phase mismatch occurs. Gather-sends
1570
- * are nastier, since the device will be expecting more data than we
1571
- * are prepared to send it, and REQ will remain asserted. On a 53C8[01] we
1572
- * could test Last Byte Sent to assure transfer (I imagine this is precisely
1573
- * why this signal was added to the newer chips) but on the older 538[01]
1574
- * this signal does not exist. The workaround for this lack is a watchdog;
1575
- * we bail out of the wait-loop after a modest amount of wait-time if
1576
- * the usual exit conditions are not met. Not a terribly clean or
1577
- * correct solution :-%
1578
- *
1579
- * DMA receive is equally tricky due to a nasty characteristic of the NCR5380.
1580
- * If the chip is in DMA receive mode, it will respond to a target's
1581
- * REQ by latching the SCSI data into the INPUT DATA register and asserting
1582
- * ACK, even if it has _already_ been notified by the DMA controller that
1583
- * the current DMA transfer has completed! If the NCR5380 is then taken
1584
- * out of DMA mode, this already-acknowledged byte is lost. This is
1585
- * not a problem for "one DMA transfer per READ command", because
1586
- * the situation will never arise... either all of the data is DMA'ed
1587
- * properly, or the target switches to MESSAGE IN phase to signal a
1588
- * disconnection (either operation bringing the DMA to a clean halt).
1589
- * However, in order to handle scatter-receive, we must work around the
1590
- * problem. The chosen fix is to DMA fewer bytes, then check for the
1591
- * condition before taking the NCR5380 out of DMA mode. One or two extra
1592
- * bytes are transferred via PIO as necessary to fill out the original
1593
- * request.
1594
- */
1564
+ /*
1565
+ * A note regarding the DMA errata workarounds for early NMOS silicon.
1566
+ *
1567
+ * For DMA sends, we want to wait until the last byte has been
1568
+ * transferred out over the bus before we turn off DMA mode. Alas, there
1569
+ * seems to be no terribly good way of doing this on a 5380 under all
1570
+ * conditions. For non-scatter-gather operations, we can wait until REQ
1571
+ * and ACK both go false, or until a phase mismatch occurs. Gather-sends
1572
+ * are nastier, since the device will be expecting more data than we
1573
+ * are prepared to send it, and REQ will remain asserted. On a 53C8[01]
1574
+ * we could test Last Byte Sent to assure transfer (I imagine this is
1575
+ * precisely why this signal was added to the newer chips) but on the
1576
+ * older 538[01] this signal does not exist. The workaround for this
1577
+ * lack is a watchdog; we bail out of the wait-loop after a modest
1578
+ * amount of wait-time if the usual exit conditions are not met.
1579
+ * Not a terribly clean or correct solution :-%
1580
+ *
1581
+ * DMA receive is equally tricky due to a nasty characteristic of the
1582
+ * NCR5380. If the chip is in DMA receive mode, it will respond to a
1583
+ * target's REQ by latching the SCSI data into the INPUT DATA register
1584
+ * and asserting ACK, even if it has _already_ been notified by the
1585
+ * DMA controller that the current DMA transfer has completed! If the
1586
+ * NCR5380 is then taken out of DMA mode, this already-acknowledged
1587
+ * byte is lost.
1588
+ *
1589
+ * This is not a problem for "one DMA transfer per READ
1590
+ * command", because the situation will never arise... either all of
1591
+ * the data is DMA'ed properly, or the target switches to MESSAGE IN
1592
+ * phase to signal a disconnection (either operation bringing the DMA
1593
+ * to a clean halt). However, in order to handle scatter-receive, we
1594
+ * must work around the problem. The chosen fix is to DMA fewer bytes,
1595
+ * then check for the condition before taking the NCR5380 out of DMA
1596
+ * mode. One or two extra bytes are transferred via PIO as necessary
1597
+ * to fill out the original request.
1598
+ */
1595
1599
1596
1600
if ((hostdata -> flags & FLAG_DMA_FIXUP ) &&
1597
1601
(NCR5380_read (BUS_AND_STATUS_REG ) & BASR_PHASE_MATCH )) {
0 commit comments