Skip to content

Commit a8ebca9

Browse files
fthainmartinkpetersen
authored andcommitted
scsi: NCR5380: Clean up indentation
Tidy up a few indentation annoyances. No functional change. Signed-off-by: Finn Thain <[email protected]> Link: https://lore.kernel.org/r/8541ea096fde9f8716b79e4f0707aed916a8c58d.1723001788.git.fthain@linux-m68k.org Signed-off-by: Martin K. Petersen <[email protected]>
1 parent c331df3 commit a8ebca9

File tree

3 files changed

+56
-52
lines changed

3 files changed

+56
-52
lines changed

drivers/scsi/NCR5380.c

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,17 +1318,19 @@ static void NCR5380_transfer_pio(struct Scsi_Host *instance,
13181318

13191319
dsprintk(NDEBUG_HANDSHAKE, instance, "REQ negated, handshake complete\n");
13201320

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+
*/
13321334
if (!(p == PHASE_MSGIN && c == 1)) {
13331335
if (p == PHASE_MSGOUT && c > 1)
13341336
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
@@ -1559,39 +1561,41 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
15591561
/* The result is zero iff pseudo DMA send/receive was completed. */
15601562
hostdata->dma_len = c;
15611563

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+
*/
15951599

15961600
if ((hostdata->flags & FLAG_DMA_FIXUP) &&
15971601
(NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) {

drivers/scsi/NCR5380.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* NCR 5380 defines
44
*
55
* Copyright 1993, Drew Eckhardt
6-
* Visionary Computing
7-
* (Unix consulting and custom programming)
8-
9-
* +1 (303) 666-5836
6+
* Visionary Computing
7+
* (Unix consulting and custom programming)
8+
9+
* +1 (303) 666-5836
1010
*
1111
* For more information, please consult
1212
*
@@ -78,7 +78,7 @@
7878
#define ICR_DIFF_ENABLE 0x20 /* wo Set to enable diff. drivers */
7979
#define ICR_ASSERT_ACK 0x10 /* rw ini Set to assert ACK */
8080
#define ICR_ASSERT_BSY 0x08 /* rw Set to assert BSY */
81-
#define ICR_ASSERT_SEL 0x04 /* rw Set to assert SEL */
81+
#define ICR_ASSERT_SEL 0x04 /* rw Set to assert SEL */
8282
#define ICR_ASSERT_ATN 0x02 /* rw Set to assert ATN */
8383
#define ICR_ASSERT_DATA 0x01 /* rw SCSI_DATA_REG is asserted */
8484

@@ -135,7 +135,7 @@
135135
#define BASR_IRQ 0x10 /* ro mirror of IRQ pin */
136136
#define BASR_PHASE_MATCH 0x08 /* ro Set when MSG CD IO match TCR */
137137
#define BASR_BUSY_ERROR 0x04 /* ro Unexpected change to inactive state */
138-
#define BASR_ATN 0x02 /* ro BUS status */
138+
#define BASR_ATN 0x02 /* ro BUS status */
139139
#define BASR_ACK 0x01 /* ro BUS status */
140140

141141
/* Write any value to this register to start a DMA send */
@@ -170,7 +170,7 @@
170170
#define CSR_BASE CSR_53C80_INTR
171171

172172
/* Note : PHASE_* macros are based on the values of the STATUS register */
173-
#define PHASE_MASK (SR_MSG | SR_CD | SR_IO)
173+
#define PHASE_MASK (SR_MSG | SR_CD | SR_IO)
174174

175175
#define PHASE_DATAOUT 0
176176
#define PHASE_DATAIN SR_IO

drivers/scsi/sun3_scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ static int sun3scsi_dma_setup(struct NCR5380_hostdata *hostdata,
304304
sun3_udc_write(UDC_INT_ENABLE, UDC_CSR);
305305
#endif
306306

307-
return count;
307+
return count;
308308

309309
}
310310

0 commit comments

Comments
 (0)