The CVS revision log is not nearly as useful as the history/history.gitrepo, so remove it. Roman's commentary at the top of his driver repeatsthe same information elsewhere in the file so remove it. Also removesome other redundant or obsolete comments.

Both the driver and the datasheets confusingly refer to a DMA accessfor a SCSI WRITE command as a "DMA write". Similarly a SCSI READ commandis called a "DMA read". This is the opposite of the usual convention.Thankfully, the chip documentation and driver code also use "DMA send" and"DMA receive", so adopt this terminology.

This removes some unimportant discrepancies between the two core driverforks so that 'diff' can be used to reveal the important ones, tofacilitate reunification.

/*@@ -98,12 +61,6 @@ * transfer - some PC's will use the I/O bus, 68K's must use * memory mapped) and drops this file in their 'C' wrapper. *- * (Note from hch: unfortunately it was not enough for the different- * m68k folks and instead of improving this driver they copied it- * and hacked it up for their needs. As a consequence they lost- * most updates to this driver. Maybe someone will fix all these- * drivers to use a common core one day..)- * * As far as command queueing, two queues are maintained for * each 5380 in the system - commands that haven't been issued yet, * and commands that are currently executing. This means that an @@ -180,9 +137,6 @@ * rely on phase mismatch and EOP interrupts to determine end * of phase. *- * Defaults for these will be provided although the user may want to adjust - * these to allocate CPU resources to the SCSI driver or "real" code.- * * These macros MUST be defined : * * NCR5380_read(register) - read from the specified register@@ -219,7 +173,7 @@ static int do_abort(struct Scsi_Host *); static void do_reset(struct Scsi_Host *);

static void NCR5380_print_phase(struct Scsi_Host *instance)@@ -463,8 +413,6 @@ static irqreturn_t __init probe_intr(int * * Autoprobe for the IRQ line used by the NCR5380 by triggering an IRQ * and then looking to see what interrupt actually turned up.- *- * Locks: none, irqs must be enabled on entry */

static int NCR5380_init(struct Scsi_Host *instance, int flags)@@ -877,9 +807,6 @@ static void requeue_cmd(struct Scsi_Host * be done on the NCR5380 host adapters in a system. Both * NCR5380_queue_command() and NCR5380_intr() will try to start it * in case it is not running.- * - * Locks: called as its own thread with no locks held. Takes the- * host lock and called routines may take the isa dma lock. */

/*- At this point, either we've completed DMA, or we have a phase mismatch,- or we've unexpectedly lost BUSY (which is a real error).-- For write DMAs, we want to wait until the last byte has been- transferred out over the bus before we turn off DMA mode. Alas, there- seems to be no terribly good way of doing this on a 5380 under all- conditions. For non-scatter-gather operations, we can wait until REQ- and ACK both go false, or until a phase mismatch occurs. Gather-writes- are nastier, since the device will be expecting more data than we- are prepared to send it, and REQ will remain asserted. On a 53C8[01] we- could test LAST BIT SENT to assure transfer (I imagine this is precisely- why this signal was added to the newer chips) but on the older 538[01]- this signal does not exist. The workaround for this lack is a watchdog;- we bail out of the wait-loop after a modest amount of wait-time if- the usual exit conditions are not met. Not a terribly clean or- correct solution :-%-- Reads are equally tricky due to a nasty characteristic of the NCR5380.- If the chip is in DMA mode for an READ, it will respond to a target's- REQ by latching the SCSI data into the INPUT DATA register and asserting- ACK, even if it has _already_ been notified by the DMA controller that- the current DMA transfer has completed! If the NCR5380 is then taken- out of DMA mode, this already-acknowledged byte is lost.-- This is not a problem for "one DMA transfer per command" reads, because- the situation will never arise... either all of the data is DMA'ed- properly, or the target switches to MESSAGE IN phase to signal a- disconnection (either operation bringing the DMA to a clean halt).- However, in order to handle scatter-reads, we must work around the- problem. The chosen fix is to DMA N-2 bytes, then check for the- condition before taking the NCR5380 out of DMA mode. One or two extra- bytes are transferred via PIO as necessary to fill out the original- request.+ * At this point, either we've completed DMA, or we have a phase mismatch,+ * or we've unexpectedly lost BUSY (which is a real error).+ *+ * For DMA sends, we want to wait until the last byte has been+ * transferred out over the bus before we turn off DMA mode. Alas, there+ * seems to be no terribly good way of doing this on a 5380 under all+ * conditions. For non-scatter-gather operations, we can wait until REQ+ * and ACK both go false, or until a phase mismatch occurs. Gather-sends+ * are nastier, since the device will be expecting more data than we+ * are prepared to send it, and REQ will remain asserted. On a 53C8[01] we+ * could test Last Byte Sent to assure transfer (I imagine this is precisely+ * why this signal was added to the newer chips) but on the older 538[01]+ * this signal does not exist. The workaround for this lack is a watchdog;+ * we bail out of the wait-loop after a modest amount of wait-time if+ * the usual exit conditions are not met. Not a terribly clean or+ * correct solution :-%+ *+ * DMA receive is equally tricky due to a nasty characteristic of the NCR5380.+ * If the chip is in DMA receive mode, it will respond to a target's+ * REQ by latching the SCSI data into the INPUT DATA register and asserting+ * ACK, even if it has _already_ been notified by the DMA controller that+ * the current DMA transfer has completed! If the NCR5380 is then taken+ * out of DMA mode, this already-acknowledged byte is lost. This is+ * not a problem for "one DMA transfer per READ command", because+ * the situation will never arise... either all of the data is DMA'ed+ * properly, or the target switches to MESSAGE IN phase to signal a+ * disconnection (either operation bringing the DMA to a clean halt).+ * However, in order to handle scatter-receive, we must work around the+ * problem. The chosen fix is to DMA N-2 bytes, then check for the+ * condition before taking the NCR5380 out of DMA mode. One or two extra+ * bytes are transferred via PIO as necessary to fill out the original+ * request. */

-/*- * ++roman: To port the 5380 driver to the Atari, I had to do some changes in- * this file, too:- *- * - Some of the debug statements were incorrect (undefined variables and the- * like). I fixed that.- *- * - In information_transfer(), I think a #ifdef was wrong. Looking at the- * possible DMA transfer size should also happen for REAL_DMA. I added this- * in the #if statement.- *- * - When using real DMA, information_transfer() should return in a DATAOUT- * phase after starting the DMA. It has nothing more to do.- *- * - The interrupt service routine should run main after end of DMA, too (not- * only after RESELECTION interrupts). Additionally, it should _not_ test- * for more interrupts after running main, since a DMA process may have- * been started and interrupts are turned on now. The new int could happen- * inside the execution of NCR5380_intr(), leading to recursive- * calls.- *- * - I've added a function merge_contiguous_buffers() that tries to- * merge scatter-gather buffers that are located at contiguous- * physical addresses and can be processed with the same DMA setup.- * Since most scatter-gather operations work on a page (4K) of- * 4 buffers (1K), in more than 90% of all cases three interrupts and- * DMA setup actions are saved.- *- * - I've deleted all the stuff for AUTOPROBE_IRQ, REAL_DMA_POLL, PSEUDO_DMA- * and USLEEP, because these were messing up readability and will never be- * needed for Atari SCSI.- *- * - I've revised the NCR5380_main() calling scheme (relax the 'main_running'- * stuff), and 'main' is executed in a bottom half if awoken by an- * interrupt.- *- * - The code was quite cluttered up by "#if (NDEBUG & NDEBUG_*) printk..."- * constructs. In my eyes, this made the source rather unreadable, so I- * finally replaced that by the *_PRINTK() macros.- *- */+/* Ported to Atari by Roman Hodek and others. */

/*- * Insert the cmd into the issue queue. Note that REQUEST SENSE- * commands are added to the head of the queue since any command will- * clear the contingent allegiance condition that exists and the- * sense data is only guaranteed to be valid while the condition exists.- */-- /* ++guenther: now that the issue queue is being set up, we can lock ST-DMA.- * Otherwise a running NCR5380_main may steal the lock.- * Lock before actually inserting due to fairness reasons explained in- * atari_scsi.c. If we insert first, then it's impossible for this driver- * to release the lock.- * Stop timer for this command while waiting for the lock, or timeouts- * may happen (and they really do), and it's no good if the command doesn't- * appear in any of the queues. * ++roman: Just disabling the NCR interrupt isn't sufficient here, * because also a timer int can trigger an abort or reset, which would * alter queues and touch the lock.@@ -959,8 +897,6 @@ static void requeue_cmd(struct Scsi_Host * be done on the NCR5380 host adapters in a system. Both * NCR5380_queue_command() and NCR5380_intr() will try to start it * in case it is not running.- *- * Locks: called as its own thread with no locks held. */