[PATCH v4 16/78] ncr5380: Proceed with next command after NCR5380_select() calls scsi_done

2016-01-02 Thread Finn Thain
issue queue. Clarify this logic. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Ondrej Zary Tested-by: Michael Schmitz --- Good code style would be, if (this) { /* do stuff */ } rather than, if (!this) {

[PATCH v4 21/78] ncr5380: Sleep when polling, if possible

2016-01-02 Thread Finn Thain
erent 5380 hardware implementations. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Ondrej Zary Tested-by: Michael Schmitz --- Changed since v1: - Don't rely on loops_per_jiffy to estimate register access speed, measure it instead. Changed since v2: - As suggeste

[PATCH v4 13/78] ncr5380: Remove redundant register writes

2016-01-02 Thread Finn Thain
Remove the duplicate write to the Select Enable Register that appeared in v1.1.38. Also remove the redundant write to Initiator Command Register prior to calling do_abort(). Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Ondrej Zary Tested-by: Michael Schmitz --- drivers

Re: [PATCH v4 69/78] ncr5380: Fix whitespace in comments using regexp

2016-01-03 Thread Finn Thain
On Sat, 2 Jan 2016, Joe Perches wrote: > On Sun, 2016-01-03 at 16:06 +1100, Finn Thain wrote: > > Hanging indentation was a poor choice for the text inside comments. It > > has been used in the wrong places and done badly elsewhere. There is > > little consistency within

Re: [PATCH v4 34/78] atari_NCR5380: Use arbitration timeout

2016-01-24 Thread Finn Thain
On Sun, 24 Jan 2016, Geert Uytterhoeven wrote: > Hi Finn, > > On Sun, Jan 3, 2016 at 6:05 AM, Finn Thain wrote: > > Allow target selection to fail with a timeout instead of waiting in > > infinite loops. This gets rid of the unused NCR_TIMEOUT macro, it is more > &g

Re: [PATCH v4 34/78] atari_NCR5380: Use arbitration timeout

2016-01-25 Thread Finn Thain
On Mon, 25 Jan 2016, Geert Uytterhoeven wrote: > > In principle I think that Linux drivers should not carry workarounds > > for emulators. > > Please consider ARAnyM is the current m68k workhorse, so it would be > nice to handle this someway. AFAICT atari_scsi on aranym never did anything use

[PATCH] ncr5380: Don't re-enter NCR5380_select() when aborting a command

2016-01-25 Thread Finn Thain
Fixes: 707d62b37fbb ("ncr5380: Fix EH during arbitration and selection") Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |2 +- drivers/scsi/atari_NCR5380.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: linux/drivers/scsi

[PATCH] ncr5380: Correctly clear command pointers and lists after bus reset

2016-01-25 Thread Finn Thain
an Carpenter Fixes: 62717f537e1b ("ncr5380: Implement new eh_bus_reset_handler") Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 19 --- drivers/scsi/atari_NCR5380.c | 19 --- 2 files changed, 24 insertions(+), 14 deleti

Re: [PATCH] ncr5380: Don't re-enter NCR5380_select() when aborting a command

2016-02-22 Thread Finn Thain
Please ignore this patch. It isn't sufficient to fix the problem. I'll send another patch that does fix it. On Tue, 26 Jan 2016, Finn Thain wrote: > Fixes: 707d62b37fbb ("ncr5380: Fix EH during arbitration and selection") > Signed-off-by: Finn Thain > &g

[PATCH 6/6] ncr5380: Call scsi_eh_prep_cmnd() and scsi_eh_restore_cmnd() as and when appropriate

2016-02-22 Thread Finn Thain
ot;ncr5380: Fix autosense bugs") Reported-and-tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |4 ++-- drivers/scsi/atari_NCR5380.c |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) Index: linux/dr

[PATCH 0/6] ncr5380: Exception handling fixes for v4.5

2016-02-22 Thread Finn Thain
These patches fix some exception handling and autosense bugs that I accidentally introduced in v4.5-rc1. The error recovery and autosense code in these drivers has been unstable for a long time. Despite that, v4.5-rc1 shows a regression in as much as it exposes a bug in the aranym emulator. This

[PATCH 5/6] ncr5380: Fix NCR5380_select() EH checks and result handling

2016-02-22 Thread Finn Thain
Add missing checks for EH abort during arbitration and selection. Rework the handling of NCR5380_select() result to improve clarity. Fixes: 707d62b37fbb ("ncr5380: Fix EH during arbitration and selection") Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi

[PATCH 1/6] ncr5380: Correctly clear command pointers and lists after bus reset

2016-02-22 Thread Finn Thain
eh_bus_reset_handler") Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 19 --- drivers/scsi/atari_NCR5380.c | 19 --- 2 files changed, 24 insertions(+), 14 deletions(-

[PATCH 3/6] ncr5380: Dont re-enter NCR5380_select()

2016-02-22 Thread Finn Thain
5d40d ("ncr5380: Implement new eh_abort_handler") Reported-and-tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 16 drivers/scsi/atari_NCR5380.c | 16 2 files changed, 16 insertions(+), 16 deletions(-) Index

[PATCH 4/6] ncr5380: Forget aborted commands

2016-02-22 Thread Finn Thain
the ML may send it back to the LLD via via scsi_eh_get_sense(). Fix this and also fix two error paths, so that commands get forgotten iff completed. Fixes: 8b00c3d5d40d ("ncr5380: Implement new eh_abort_handler") Tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NC

[PATCH 2/6] ncr5380: Dont release lock for PIO transfer

2016-02-22 Thread Finn Thain
eported-and-tested-by: Michael Schmitz Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 16 +--- drivers/scsi/atari_NCR5380.c | 16 +--- 2 files changed, 18 insertions(+), 14 deletions(-) Index

Re: [RFC v6 03/25] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops

2015-10-14 Thread Finn Thain
James, would you please review and ack this patch, and patch 01/25 also? On Sun, 23 Aug 2015, Finn Thain wrote: > By implementing an arch_nvram_ops struct, any platform can re-use the > drivers/char/nvram module without needing any arch-specific code > in that module. Atari doe

[PATCH v7 03/26] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops

2015-11-01 Thread Finn Thain
. Replace this validate-checksum-and-read-byte sequence with the equivalent rtc_nvram_ops.read() call and remove the now unused functions. Signed-off-by: Finn Thain Tested-by: Christian T. Steigies Acked-by: Geert Uytterhoeven --- The advantage of the new ops struct over the old global nvram_

[PATCH v7 01/26] scsi/atari_scsi: Dont select CONFIG_NVRAM

2015-11-01 Thread Finn Thain
the valkyriefb driver with powerpc, and since that driver uses NVRAM, it is affected by CONFIG_ATARI_SCSI, because of the use of "select NVRAM". Adopt the powerpc convention on m68k to avoid surprises. Signed-off-by: Finn Thain Tested-by: Christian T. Steigies --- This patch temporaril

[PATCH 63/71] atari_NCR5380: Remove HOSTNO macro from printk() and seq_printf() calls

2015-11-18 Thread Finn Thain
Remove the HOSTNO macro that is peculiar to atari_NCR5380.c and contributes to the problem of divergence of the NCR5380 core drivers. Keep NCR5380.c in sync. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 17 + drivers/scsi/atari_NCR5380.c | 23

[PATCH 60/71] ncr5380: Implement new eh_abort_handler

2015-11-18 Thread Finn Thain
addressed in a subsequent patch. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 155 ++ drivers/scsi/atari_NCR5380.c | 157 ++- 2 files changed, 282 insertions(+), 30 deletions(-) Index: linux/drivers

[PATCH 46/71] ncr5380: Fix NDEBUG_NO_DATAOUT flag

2015-11-18 Thread Finn Thain
NDEBUG_NO_DATAOUT should not disable DATA IN phases too. Fix this. (This bug has long been fixed in atari_NCR5380.c.) Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux/drivers/scsi/NCR5380.c

[PATCH 48/71] atari_NCR5380: Fix queue_size limit

2015-11-18 Thread Finn Thain
his and cleanup some obsolete comments. Signed-off-by: Finn Thain --- drivers/scsi/atari_NCR5380.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) Index: linux/drivers/scsi/atari_NCR5380.c === --- lin

[PATCH 47/71] ncr5380: Fix and cleanup scsi_host_template initializers

2015-11-18 Thread Finn Thain
Add missing .module initializer. Use distinct .proc_name values for the g_NCR5380 and g_NCR5380_mmio modules. Remove pointless CAN_QUEUE and CMD_PER_LUN override macros. Cleanup whitespace and code style. Signed-off-by: Finn Thain --- drivers/scsi/atari_scsi.c |2 +- drivers/scsi

[PATCH 45/71] ncr5380: Cleanup #include directives

2015-11-18 Thread Finn Thain
Remove unused includes (stat.h, signal.h, proc_fs.h) and move includes needed by the core drivers into the common header (delay.h etc). Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |2 -- drivers/scsi/NCR5380.h |4 drivers/scsi/arm/cumana_1.c |4

[PATCH 49/71] atari_NCR5380: Introduce FLAG_DTC3181E

2015-11-18 Thread Finn Thain
The atari_NCR5380.c core driver lacks the DTC special case found in NCR5380.c. Add this special case. This reduces divergence between them and allows drivers like dmx3191d to make use of atari_NCR5380.c which is helpful for testing. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c

[PATCH 62/71] ncr5380: Implement new eh_bus_reset_handler

2015-11-18 Thread Finn Thain
: Finn Thain --- drivers/scsi/NCR5380.c | 50 ++- drivers/scsi/atari_NCR5380.c | 39 +++-- 2 files changed, 72 insertions(+), 17 deletions(-) Index: linux/drivers/scsi/atari_NCR5380.c

[PATCH 51/71] ncr5380: Remove command list debug code

2015-11-18 Thread Finn Thain
debugging, the easiest way to fix the discrepancy is simply remove this code. The only remaining users of NCR5380_show_info() and NCR5380_write_info() are drivers that define PSEUDO_DMA. The others have no use for the .show_info method, so don't initialize it. Signed-off-by: Finn

[PATCH 54/71] ncr5380: Use dsprintk() for queue debugging

2015-11-18 Thread Finn Thain
Print the command pointers in the log messages for debugging queue data structures. The LIST and REMOVE macros can then be removed. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 36 drivers/scsi/atari_NCR5380.c | 43

[PATCH 55/71] ncr5380: Remove LIST and REMOVE macros

2015-11-18 Thread Finn Thain
Printing command pointers can be useful when debugging queues. Other than that, the LIST and REMOVE macros are just clutter. These macros are redundant now that NDEBUG_QUEUES causes pointers to be printed, so remove them. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 19

[PATCH 59/71] ncr5380: Fix autosense bugs

2015-11-18 Thread Finn Thain
main loop in this way, scsi_eh_save takes place when an autosense command is dequeued rather than when re-queued. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 194 +++--- drivers/scsi/NCR5380.h |2 drivers/scsi/atari_NCR5380.c | 239

[PATCH 57/71] ncr5380: Use standard list data structure

2015-11-18 Thread Finn Thain
would only be churn because the existing EH handlers don't work and get replaced in a subsequent patch. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 214 +--- drivers/scsi/NCR5380.h | 16 ++ drivers/scsi/arm/cumana_1.c |1 driv

[PATCH 53/71] ncr5380: Use shost_priv helper

2015-11-18 Thread Finn Thain
Make use of the shost_priv() helper. Remove HOSTDATA and SETUP_HOSTDATA macros because they harm readability. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 23 ++- drivers/scsi/atari_NCR5380.c | 20 +++- 2 files changed, 17 insertions

[PATCH 52/71] ncr5380: Remove H_NO macro and introduce dsprintk

2015-11-18 Thread Finn Thain
ts of subsequent patches. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 11 +--- drivers/scsi/NCR5380.h |5 +++ drivers/scsi/atari_NCR5380.c | 57 +-- 3 files changed, 40 insertions(+), 33 deletions(-) Index: linux/drivers

[PATCH 58/71] ncr5380: Refactor command completion

2015-11-18 Thread Finn Thain
Implement a 'complete_cmd' function to complete commands. This is needed by the following patch; the new function provides a site for the logic needed to correctly handle REQUEST SENSE commands. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c

[PATCH 61/71] ncr5380: Fix EH during arbitration and selection

2015-11-18 Thread Finn Thain
ata struct to track the command in arbitration or selection phase. Replace 'retain_dma_irq' with the new 'selecting' pointer, to bring atari_NCR5380.c into line with NCR5380.c. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 78 +

[PATCH 56/71] ncr5380: Remove redundant volatile qualifiers

2015-11-18 Thread Finn Thain
The hostdata struct is now protected by a spin lock so the volatile qualifiers are redundant. Remove them. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.h | 12 ++-- drivers/scsi/atari_NCR5380.c |2 +- 2 files changed, 7 insertions(+), 7 deletions(-) Index: linux

[PATCH 50/71] ncr5380: Change instance->host_lock to hostdata->lock

2015-11-18 Thread Finn Thain
new lock should be uncontested even when the SCSI bus is contested. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 83 - drivers/scsi/NCR5380.h |1 drivers/scsi/atari_NCR5380.c | 139 +-- 3 files chan

[PATCH 70/71] atari_NCR5380: Merge changes from NCR5380.c

2015-11-18 Thread Finn Thain
reveal the important ones, to facilitate reunification. Signed-off-by: Finn Thain --- drivers/scsi/atari_NCR5380.c | 108 +-- 1 file changed, 64 insertions(+), 44 deletions(-) Index: linux/drivers/scsi/atari

[PATCH 69/71] ncr5380: Merge changes from atari_NCR5380.c

2015-11-18 Thread Finn Thain
reveal the important ones, to facilitate reunification. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 157 +++-- 1 file changed, 89 insertions(+), 68 deletions(-) Index: linux/drivers/scsi

[PATCH 68/71] ncr5380: Fix whitespace issues using regexp

2015-11-18 Thread Finn Thain
_,}NCR5380.c This removes some unimportant discrepancies between the two core driver forks so that 'diff' can be used to reveal the important ones, to facilitate reunification. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 550 +

[PATCH 71/71] ncr5380: Cleanup whitespace and parentheses

2015-11-18 Thread Finn Thain
Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 30 +++--- drivers/scsi/atari_NCR5380.c | 26 +- 2 files changed, 32 insertions(+), 24 deletions(-) Index: linux/drivers/scsi/NCR5380.c

[PATCH 65/71] atari_scsi, sun3_scsi: Remove global Scsi_Host pointer

2015-11-18 Thread Finn Thain
This refactoring removes two global Scsi_Host pointers. This improves consistency with other ncr5380 drivers. Adopting the same conventions as the other drivers makes them easier to read. Signed-off-by: Finn Thain --- drivers/scsi/atari_NCR5380.c |5 +- drivers/scsi/atari_scsi.c| 29

[PATCH 67/71] ncr5380: Cleanup comments

2015-11-18 Thread Finn Thain
ceive", so adopt this terminology. This removes some unimportant discrepancies between the two core driver forks so that 'diff' can be used to reveal the important ones, to facilitate reunification. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 154 ++

[PATCH 64/71] atari_NCR5380: Eliminate HOSTNO macro

2015-11-18 Thread Finn Thain
Keep the two core driver forks in sync. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 71 +++-- drivers/scsi/atari_NCR5380.c | 102 +++ 2 files changed, 84 insertions(+), 89 deletions(-) Index: linux/drivers

[PATCH 66/71] ncr5380: Fix soft lockups

2015-11-18 Thread Finn Thain
command is completed and by limiting the transfer size for drivers that don't use DMA in information transfer phases. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 10 -- drivers/scsi/atari_NCR5380.c | 10 -- 2 files changed, 16 insertions(+), 4 dele

[PATCH 24/71] ncr5380: Implement NCR5380_dma_xfer_len and remove LIMIT_TRANSFERSIZE macro

2015-11-18 Thread Finn Thain
. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 32 +--- drivers/scsi/arm/cumana_1.c |3 +++ drivers/scsi/arm/oak.c |2 ++ drivers/scsi/atari_NCR5380.c |8 +--- drivers/scsi/dtc.c | 14 ++ drivers/scsi

[PATCH 40/71] ncr5380: Introduce NCR5380_poll_politely2

2015-11-18 Thread Finn Thain
SCSI bus protocol sometimes requires monitoring two related conditions simultaneously. Enhance NCR5380_poll_politely() for this purpose, and put it to use in the arbitration algorithm. It will also find use in pseudo DMA. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 68

[PATCH 42/71] ncr5380: Replace READ_OVERRUNS macro with FLAG_NO_DMA_FIXUPS

2015-11-18 Thread Finn Thain
eliminate the READ_OVERRUNS macro. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) Index: linux/drivers/scsi/NCR5380.c === --- linux.orig/drivers

[PATCH 43/71] ncr5380: Standardize reselection handling

2015-11-18 Thread Finn Thain
ansfer. During selection, don't interfere with the chip registers after a reselection interrupt intervenes. Clean up some trivial issues with code style, comments and printk. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 115 +++ driver

[PATCH 26/71] ncr5380: Fix NCR5380_transfer_pio() result

2015-11-18 Thread Finn Thain
bits in STATUS_REG so that NCR5380_transfer_pio() can return the correct result. The return value is presently unused (perhaps because of bugs like this) but this change at least fixes the caller's phase variable, which is passed by reference. Signed-off-by: Finn Thain --- drivers/scsi/NCR5

[PATCH 44/71] ncr5380: Fix off-by-one bug in extended_msg[] bounds check

2015-11-18 Thread Finn Thain
Fix the array bounds check when transferring an extended message from the target. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |3 ++- drivers/scsi/atari_NCR5380.c |4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) Index: linux/drivers/scsi/NCR5380.c

[PATCH 39/71] ncr5380: Standardize interrupt handling

2015-11-18 Thread Finn Thain
hed and some are not. Before clearing the chip IRQ flag, clear all state that may cause it to be raised. That means clearing the DMA Mode and Busy Monitor bits in the Mode Register and clearing the host ID in the Select Enable register. Also clean up some printk's and some comments. Keep atari_NCR5

[PATCH 41/71] ncr5380: Replace redundant flags with FLAG_NO_DMA_FIXUP

2015-11-18 Thread Finn Thain
use of the TCR_LAST_BYTE_SENT bit. Remove the old flags. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 68 +++ drivers/scsi/NCR5380.h |4 -- drivers/scsi/dtc.c |4 -- drivers/scsi/g_NCR5380.c |5 +-- 4 files changed, 26 inserti

[PATCH 35/71] ncr5380: Dont wait for BUS FREE after disconnect

2015-11-18 Thread Finn Thain
" and perhaps BUS FREE polling was somehow helpful back in Linux v0.99.14u, when it was introduced. The relevant timeout is presently 1 second (for bus arbitration). Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |7 --- drivers/scsi/atari_NCR5380.c | 11 --

[PATCH 36/71] ncr5380: Use work_struct instead of delayed_work

2015-11-18 Thread Finn Thain
Each host instance now has it's own work queue so the main() work item can sleep when necessary. That means we can use a simple work item rather than a delayed work item. This brings NCR5380.c closer to atari_NCR5380.c. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |

[PATCH 38/71] ncr5380: Remove UNSAFE macro

2015-11-18 Thread Finn Thain
things because then we would have to handle the possibility of EH handler invocation during a PDMA transfer. The comments say that instead of using this macro, "you're going to be better off twiddling with transfersize". I agree. Remove this stuff. Signed-off-by: Finn Thain --

[PATCH 34/71] atari_NCR5380: Use arbitration timeout

2015-11-18 Thread Finn Thain
Allow target selection to fail with a timeout instead of waiting in infinite loops. This gets rid of the unused NCR_TIMEOUT macro, it is more defensive and has proved helpful in debugging. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 44

[PATCH 37/71] ncr5380: Standardize work queueing algorithm

2015-11-18 Thread Finn Thain
l the information transfer state machine from queuecommand because, according to Documentation/scsi/scsi_mid_low_api.txt that could happen in soft irq context. Fix this. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.h |1 drivers/scsi/atari_NCR5380.c |

[PATCH 31/71] ncr5380: Fix !REQ timeout in do_abort()

2015-11-18 Thread Finn Thain
NCR5380_poll_politely() never returns -1. That means do_abort() can fail to handle a timeout after waiting for the target to negate REQ. Fix this and cleanup other NCR5380_poll_politely() call sites. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 10 +- 1 file changed, 5

[PATCH 30/71] ncr5380: Add missing break after case MESSAGE_REJECT

2015-11-18 Thread Finn Thain
MESSAGE REJECT does not imply DISCONNECT: the target is about to enter MESSAGE IN or MESSAGE OUT phase. This bug fix comes from atari_NCR5380.c. Unfortunately it never made it into the original NCR5380.c core driver. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |1 + 1 file

[PATCH 33/71] atari_NCR5380: Set do_abort() timeouts

2015-11-18 Thread Finn Thain
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: Finn Thain --- drivers/scsi/NCR5380.c | 26 +- drivers/scsi/atari_NCR5380.c | 34

[PATCH 32/71] ncr5380: Fix bus phase in do_abort()

2015-11-18 Thread Finn Thain
NCR5380_poll_politely() returns either 0 (success) or -ETIMEDOUT. However, in do_abort(), the return value is incorrectly taken to be the status register value. This means that the bus is put into DATA OUT phase instead of MESSAGE OUT. Fix this. Signed-off-by: Finn Thain --- drivers/scsi

[PATCH 29/71] ncr5380: Remove references to linked commands

2015-11-18 Thread Finn Thain
From: Hannes Reinecke Some old drivers partially implemented support for linked commands using a "proposed" next_link pointer in struct scsi_cmnd that never actually existed. Remove this code. Signed-off-by: Finn Thain --- This is a modified version of Hannes' patch so I h

[PATCH 27/71] ncr5380: Add missing lock in eh_abort_handler

2015-11-18 Thread Finn Thain
0x420 [ef885ea0] [c0046870] worker_thread+0x14c/0x430 [ef885ed0] [c004e4f4] kthread+0xd8/0xec [ef885f40] [c00124d4] ret_from_kernel_thread+0x5c/0x64 Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) Index: linux/drivers

[PATCH 23/71] ncr5380: Always retry arbitration and selection

2015-11-18 Thread Finn Thain
failure or lost arbitration. The "else break" clause in NCR5380_main() that gets removed here appears to be a vestige of a long-gone loop that iterated over host instances. See commit 491447e1fcff ("[PATCH] next NCR5380 updates") in history/history.git. Signed-off-by: Finn Thain

[PATCH 25/71] ncr5380: Rework disconnect versus poll logic

2015-11-18 Thread Finn Thain
on for this discrepancy. The timing seems to have no relation to the type of adapter. Bizarrely, the timing in g_NCR5380 seems to relate only to one particular type of target device. This patch attempts to solve the problem for all NCR5380 drivers and all target

[PATCH 19/71] ncr5380: Cleanup bogus {request,release}_region() calls

2015-11-18 Thread Finn Thain
region() calls in dtc.c, pas16.c and t128.c. Fix these issues. Signed-off-by: Finn Thain --- drivers/scsi/arm/cumana_1.c |6 -- drivers/scsi/dtc.c |2 -- drivers/scsi/pas16.c|2 -- drivers/scsi/t128.c |2 -- 4 files changed, 12 deletions(-) Index:

[PATCH 28/71] ncr5380: Drop DEF_SCSI_QCMD macro

2015-11-18 Thread Finn Thain
Remove the DEF_SCSI_QCMD macro (already removed from atari_NCR5380.c). The lock provided by DEF_SCSI_QCMD is only needed for queue data structures. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 30 +++--- drivers/scsi/atari_NCR5380.c |2 +- 2 files

[PATCH 21/71] ncr5380: Sleep when polling, if possible

2015-11-18 Thread Finn Thain
When in process context, sleep during polling if doing so won't add significant latency. In interrupt context or if the lock is held, poll briefly then give up. Keep both core drivers in sync. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |

[PATCH 22/71] ncr5380: Eliminate selecting state

2015-11-18 Thread Finn Thain
ll for BSY. We can sleep while polling now that we have a suitable workqueue. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 74 --- drivers/scsi/NCR5380.h |2 - drivers/scsi/atari_NCR5380.c | 49 3 fil

[PATCH 20/71] ncr5380: Introduce unbound workqueue

2015-11-18 Thread Finn Thain
Allocate a work queue that will permit busy waiting and sleeping. This means NCR5380_init() can potentially fail, so add this error path. Signed-off-by: Finn Thain --- In subsequent patches, the work function adopts this work queue so it can sleep while polling, which allows the removal of

[PATCH 18/71] ncr5380: Eliminate USLEEP_WAITLONG delay

2015-11-18 Thread Finn Thain
r prevent EH working correctly but this is addressed in a subsequent patch. Remove USLEEP_WAITLONG. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 19 +-- drivers/scsi/g_NCR5380.c |1 - 2 files changed, 5 insertions(+), 15 deletions(-) Index: linux/dr

[PATCH 17/71] ncr5380: Keep BSY asserted when entering SELECTION phase

2015-11-18 Thread Finn Thain
NCR5380.c is not compliant with the SCSI-2 standard (at least, not with the draft revision 10L that I have to refer to). The selection algorithm in atari_NCR5380.c is correct, so use that. Signed-off-by: Finn Thain --- The NCR 5380 Family datasheet has a flow chart to support this. Please see

[PATCH 14/71] ncr5380: Use return instead of goto in NCR5380_select()

2015-11-18 Thread Finn Thain
The "failed" label in NCR5380_select() is not helpful. Some failures return 0, others -1. Use return instead of goto to improve clarity and brevity, like atari_NCR5380.c does. Fix the relevant comments. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c

[PATCH 16/71] ncr5380: Proceed with next command after NCR5380_select() calls scsi_done

2015-11-18 Thread Finn Thain
issue queue. Clarify this logic. Signed-off-by: Finn Thain --- Good code style would be, if (this) { /* do stuff */ } rather than, if (!this) { } else { /* do stuff */ } But I've used the latter form at this point in

[PATCH 15/71] ncr5380: Always escalate bad target time-out in NCR5380_select()

2015-11-18 Thread Finn Thain
arget that doesn't assert BSY. We need to handle these two cases differently; the latter case can be left to the SCSI ML. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 13 - drivers/scsi/NCR5380.h |6 -- drivers/scsi/atari_NCR5380.c | 13 ---

[PATCH 13/71] ncr5380: Remove redundant register writes

2015-11-18 Thread Finn Thain
Remove the duplicate write to the Select Enable Register that appeared in v1.1.38. Also remove the redundant write to Initiator Command Register prior to calling do_abort(). Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |2 -- drivers/scsi/atari_NCR5380.c |3 --- 2 files

[PATCH 09/71] atari_NCR5380: Reset bus on driver initialization if required

2015-11-18 Thread Finn Thain
indispensible. Keep the two implementations in sync. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 33 +++- drivers/scsi/atari_NCR5380.c | 113 +++ 2 files changed, 134 insertions(+), 12 deletions(-) Index: linux/drivers/scsi

[PATCH 11/71] ncr5380: Simplify bus reset handlers

2015-11-18 Thread Finn Thain
Make use of do_reset() in the bus reset handler in atari_NCR5380.c. The version in NCR5380.c already does so. Keep them in sync. Signed-off-by: Finn Thain --- Bus reset handlers in both core drivers still have serious problems for EH purposes. Those problems are addressed later in this series

[PATCH 12/71] ncr5380: Remove unused hostdata->aborted flag

2015-11-18 Thread Finn Thain
The aborted flag was introduced in v1.1.38 but never used. Remove it. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |2 -- drivers/scsi/NCR5380.h |1 - drivers/scsi/atari_NCR5380.c |2 -- 3 files changed, 5 deletions(-) Index: linux/drivers/scsi/NCR5380.c

[PATCH 10/71] atari_NCR5380: Remove RESET_BOOT, CONFIG_ATARI_SCSI_TOSHIBA_DELAY and CONFIG_ATARI_SCSI_RESET_BOOT

2015-11-18 Thread Finn Thain
be problematic already. Regardless, do_reset() now raises and clears the interrupt within local_irq_save/restore which should avoid problems. Signed-off-by: Finn Thain --- drivers/scsi/Kconfig | 17 --- drivers/scsi/NCR5380.c | 17 +-- drivers/scsi/NCR5380.h

[PATCH 07/71] ncr5380: Split NCR5380_init() into two functions

2015-11-18 Thread Finn Thain
ff-by: Finn Thain --- drivers/scsi/NCR5380.c | 34 -- drivers/scsi/NCR5380.h |1 + drivers/scsi/arm/cumana_1.c |2 ++ drivers/scsi/arm/oak.c |2 ++ drivers/scsi/dmx3191d.c |2 ++ drivers/scsi/dtc.c |2 ++ drivers

[PATCH 08/71] ncr5380: Move NCR53C400-specific code

2015-11-18 Thread Finn Thain
kinds of boards. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c | 18 -- drivers/scsi/g_NCR5380.c | 23 ++- drivers/scsi/g_NCR5380.h |6 ++ 3 files changed, 20 insertions(+), 27 deletions(-) Index: linux/drivers/scsi/NCR5380.c

[PATCH 05/71] ncr5380: Remove NCR5380_local_declare and NCR5380_setup macros

2015-11-18 Thread Finn Thain
e used for that purpose because the Scsi_Host struct has not yet been instantiated. Moreover, these macros were removed from atari_NCR5380.c long ago and now they constitute yet another discrepancy between the two core driver forks. Remove these "optimizations". Signed-off-by: F

[PATCH 01/71] atari_scsi: Fix SCSI host ID setting

2015-11-18 Thread Finn Thain
The NVRAM location of this byte is 16, as documented in http://toshyp.atari.org/en/004009.html This was confirmed by Michael Schmitz, by setting the SCSI host ID under EmuTOS and then checking the value in /proc/driver/nvram and /dev/nvram under Linux. Signed-off-by: Finn Thain --- drivers

[PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-18 Thread Finn Thain
Like my previous work on the NCR5380 drivers, this patch series has bug fixes, code cleanup and modernization. These drivers suffer from mistakes, poor style and neglect and this long series addresses the worst of it, covering all ten wrapper drivers and both of the core driver forks. The combined

[PATCH 06/71] ncr5380: Remove NCR5380_instance_name macro

2015-11-18 Thread Finn Thain
This macro makes the code cryptic. Remove it. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |2 +- drivers/scsi/g_NCR5380.c |7 --- drivers/scsi/g_NCR5380.h |2 -- 3 files changed, 5 insertions(+), 6 deletions(-) Index: linux/drivers/scsi/g_NCR5380.c

[PATCH 04/71] ncr5380: Remove more pointless macros

2015-11-18 Thread Finn Thain
ASM macro is never defined. rtrc in pas16.c is not used. NCR5380_map_config, do_NCR5380_intr, do_t128_intr and do_pas16_intr are unused. NCR_NOT_SET harms readability. Remove them. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.h |3 --- drivers/scsi/g_NCR5380.c | 29

[PATCH 03/71] ncr5380: Eliminate PDEBUG*, TDEBUG* and DTCDEBUG* macros

2015-11-18 Thread Finn Thain
Replace {P,T,DTC}DEBUG_INIT with NDEBUG_INIT. Remove dead debugging code, including code that's conditional upon *DEBUG_TRANSFER. Signed-off-by: Finn Thain --- drivers/scsi/dtc.c | 18 ++ drivers/scsi/dtc.h | 27 --- drivers/scsi/pas16.c |

[PATCH 02/71] ncr5380: Remove redundant static variable initializers

2015-11-18 Thread Finn Thain
Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |2 +- drivers/scsi/dtc.c |4 ++-- drivers/scsi/g_NCR5380.c |4 ++-- drivers/scsi/pas16.c | 10 +- drivers/scsi/sun3_scsi.c |8 drivers/scsi/t128.c |4 ++-- 6 files changed, 16

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-18 Thread Finn Thain
On Wed, 18 Nov 2015, Ondrej Zary wrote: > On Wednesday 18 November 2015, Finn Thain wrote: > > > Like my previous work on the NCR5380 drivers, this patch series has > > bug fixes, code cleanup and modernization. These drivers suffer from > > mistakes, poor style a

Re: [PATCH 10/71] atari_NCR5380: Remove RESET_BOOT, CONFIG_ATARI_SCSI_TOSHIBA_DELAY and CONFIG_ATARI_SCSI_RESET_BOOT

2015-11-18 Thread Finn Thain
w On Thu, 19 Nov 2015, Michael Schmitz wrote: > Hi Finn, > > Am 18.11.2015 um 21:35 schrieb Finn Thain: > > > The bus reset may raise an interrupt. That would be new behaviour for > > atari_scsi only when CONFIG_ATARI_SCSI_RESET_BOOT=n. The ST DMA > > interrupt

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-19 Thread Finn Thain
On Thu, 19 Nov 2015, Ondrej Zary wrote: > On Thursday 19 November 2015 03:24:56 Finn Thain wrote: > > > On Wed, 18 Nov 2015, Ondrej Zary wrote: > > > > > > > > I have some NCR5380 ISA cards and can test them. > > > > Thanks Ondrej. I'

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-19 Thread Finn Thain
On Fri, 20 Nov 2015, I wrote: > On Thu, 19 Nov 2015, Ondrej Zary wrote: > > > [ 240.108501] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables > > this message. > > [ 240.108597] modprobeD 001a 0 1957 1950 0x > > [ 240.108790] ce0fad00 0086 53881781 0

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-20 Thread Finn Thain
On Thu, 19 Nov 2015, Christoph Hellwig wrote: > On Fri, Nov 20, 2015 at 06:21:06PM +1100, Finn Thain wrote: > > > > Not sure what module was being probed here. I presume it was > > > g_NCR5380 or g_NCR5380_mmio. Neither of these calls > > > 'scsi_scan_hos

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-20 Thread Finn Thain
On Fri, 20 Nov 2015, Christoph Hellwig wrote: > On Fri, Nov 20, 2015 at 07:19:21PM +1100, Finn Thain wrote: > > > Yes. I didn't do that conversion because I don't have ISA hardware and > > I don't understand ISA probing. > > > > The present patch

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-20 Thread Finn Thain
Hi Ondrej, On Fri, 20 Nov 2015, Ondrej Zary wrote: > On Friday 20 November 2015 02:41:19 Finn Thain wrote: > > > > > > My tests involved 3 different scsi targets (two disks and a CD-ROM) > > but none of these send a SDTR. Your log says the driver correctly > &

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-21 Thread Finn Thain
On Sat, 21 Nov 2015, Ondrej Zary wrote: > On Saturday 21 November 2015 02:58:57 Finn Thain wrote: > > > > > I gather that your setup here is a QUANTUM LP240S target with Domex > > 3181 (DTC-436) card and g_NCR5380 module. I've been testing a similar > > s

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-23 Thread Finn Thain
On Mon, 23 Nov 2015, Ondrej Zary wrote: > > PDMA seems to be broken in multiple ways. NCR5380_pread cannot process > less than 128 bytes. In fact, 53C400 datasheet says that it's HW > limitation: non-modulo-128-byte transfers should use PIO. > > Adding > transfersize = round_down(tran

<    1   2   3   4   5   6   7   8   9   10   >