Re: [PATCH v3 60/77] ncr5380: Implement new eh_abort_handler

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Introduce a new eh_abort_handler implementation. This one attempts to follow all of the rules relating to EH handlers. There is still a known bug: during selection, a command becomes invisible to the EH handlers because it only appears in a pointer on the

Re: [PATCH v3 59/77] ncr5380: Fix autosense bugs

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: NCR5380_information_transfer() may re-queue a command for autosense, after calling scsi_eh_prep_cmnd(). This creates several possibilities: 1. Reselection may intervene before the re-queued command gets processed. If the reconnected command then unde

Re: [PATCH v3 57/77] ncr5380: Use standard list data structure

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: The NCR5380 drivers have a home-spun linked list implementation for scsi_cmnd structs that uses cmd->host_scribble as a 'next' pointer. Adopt the standard list_head data structure and list operations instead. Remove the eh_abort_handler rather than conver

Re: [PATCH v3 58/77] ncr5380: Refactor command completion

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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

Re: [PATCH v3 56/77] ncr5380: Remove redundant volatile qualifiers

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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 in

Re: [PATCH v3 55/77] ncr5380: Remove LIST and REMOVE macros

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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 ---

Re: [PATCH v3 54/77] ncr5380: Use dsprintk() for queue debugging

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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/

Re: [PATCH v3 53/77] ncr5380: Use shost_priv helper

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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 +++-

Re: [PATCH v3 52/77] ncr5380: Remove H_NO macro and introduce dsprintk

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Replace all H_NO and some HOSTNO macros (both peculiar to atari_NCR5380.c) with a new dsprintk macro that's more useful and more consistent. The new macro avoids a lot of boilerplate in new code in subsequent patches. Keep NCR5380.c in sync. Remaining HOS

Re: [PATCH v3 51/77] ncr5380: Remove command list debug code

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Some NCR5380 hosts offer a .show_info method to access the contents of the various command list data structures from a procfs file. When NDEBUG is set, the same information is sent to the console during EH. The two core drivers, atari_NCR5380.c and NCR53

Re: [PATCH v3 50/77] ncr5380: Change instance->host_lock to hostdata->lock

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: NCR5380.c presently uses the instance->host_lock spin lock. Convert this to a new spin lock that protects the NCR5380_hostdata struct. atari_NCR5380.c previously used local_irq_save/restore() rather than a spin lock. Convert this to hostdata->lock in irq

Re: [PATCH v3 49/77] ncr5380: Remove redundant ICR_ARBITRATION_LOST test and eliminate FLAG_DTC3181E

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Remove FLAG_DTC3181E. It was used to suppress a final Arbitration Lost (SEL asserted) test that isn't actually needed. The test was suppressed because it causes problems for DTC436 and DTC536 chips. It takes place after the host wins arbitration, so SEL h

Re: [PATCH v3 47/77] ncr5380: Fix and cleanup scsi_host_template initializers

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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/at

Re: [PATCH v3 48/77] atari_NCR5380: Fix queue_size limit

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: When a target reports a QUEUE_FULL condition it causes the driver to update the 'queue_size' limit with the number of currently allocated tags. At least, that's what's supposed to happen, according to the comments. Unfortunately the terms in the assignmen

Re: [PATCH v3 46/77] ncr5380: Fix NDEBUG_NO_DATAOUT flag

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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(-) Reviewed-by: Hannes

Re: [PATCH v3 45/77] ncr5380: Cleanup #include directives

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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

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

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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(-) Re

Re: [PATCH v3 43/77] ncr5380: Standardize reselection handling

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Bring the two NCR5380_reselect() implementations into agreement. Replace infinite loops in atari_NCR5380.c with timeouts, as per NCR5380.c. Remove 'abort' flag in NCR5380.c as per atari_NCR5380.c -- if reselection fails, there may be no MESSAGE IN phase

Re: [PATCH v3 42/77] ncr5380: Replace READ_OVERRUNS macro with FLAG_NO_DMA_FIXUPS

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: The workarounds for chip errata appear twice, in slightly different forms. One is used when defined(REAL_DMA) || defined(REAL_DMA_POLL), the other when defined(PSEUDO_DMA). In the PDMA case, the workarounds have been made conditional on FLAG_NO_DMA_FIXUPS

Re: [PATCH v3 41/77] ncr5380: Replace redundant flags with FLAG_NO_DMA_FIXUP

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: The flags DMA_WORKS_RIGHT, FLAG_NCR53C400 and FLAG_HAS_LAST_BYTE_SENT all mean the same thing, i.e. the chip is not a 538[01]. (More recent devices such as the 53C80 have a 'Last Byte Sent' bit in the Target Command Register as well as other fixes for End

Re: [PATCH v3 40/77] ncr5380: Introduce NCR5380_poll_politely2

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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 ---

Re: [PATCH v3 39/77] ncr5380: Standardize interrupt handling

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Because interrupt handling is crucial to the core driver(s), all wrapper drivers need to agree on this code. This patch removes discrepancies. NCR5380_intr() in NCR5380.c has the following pointless loop that differs from the code in atari_NCR5380.c.

Re: [PATCH v3 38/77] ncr5380: Remove UNSAFE macro

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Configuring core drivers using macros like this one prevents re-unifying the core driver forks, and prevents implementing the core driver as a library or a platform driver. The UNSAFE macro in particular is a poor workaround for the problem of interrupt

Re: [PATCH v3 37/77] ncr5380: Standardize work queueing algorithm

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: The complex main_running/queue_main mechanism is peculiar to atari_NCR5380.c. It isn't SMP safe and offers little value given that the work queue already offers concurrency management. Remove this complexity to bring atari_NCR5380.c closer to NCR5380.c.

Re: [PATCH v3 36/77] ncr5380: Use work_struct instead of delayed_work

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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 ---

Re: [PATCH v3 35/77] ncr5380: Dont wait for BUS FREE after disconnect

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: When there is a queued command and no connected command, NCR5380_select() is called and arbitration begins. The chip waits for BUS FREE once the MR_ARBITRATE bit in the mode register is enabled. That means there is no need to wait for BUS FREE after disco

Re: [PATCH v3 34/77] atari_NCR5380: Use arbitration timeout

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 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 defensive and has proved helpful in debugging. Signed-off-by: Finn Thain --- drivers/scsi/NCR5380.c |

Re: [PATCH v3 33/77] atari_NCR5380: Set do_abort() timeouts

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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/s

Re: [PATCH v3 32/77] ncr5380: Fix bus phase in do_abort()

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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-o

Re: [PATCH v3 31/77] ncr5380: Fix !REQ timeout in do_abort()

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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

Re: [PATCH v3 30/77] ncr5380: Add missing break after case MESSAGE_REJECT

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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 --- dr

Re: [PATCH v3 29/77] ncr5380: Remove references to linked commands

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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

Re: [PATCH v3 28/77] ncr5380: Drop DEF_SCSI_QCMD macro

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: 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 +++--- dri

Re: [PATCH v3 27/77] ncr5380: Add missing lock in eh_abort_handler

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: The host spin lock needs to be acquired by NCR5380_abort() before it calls NCR5380_select(). This patch doesn't actually fix the EH issues in this driver but it does avoid this: BUG: spinlock already unlocked on CPU#0, kworker/u4:1/14 lock: 0xc0c0f834,

Re: [PATCH v3 26/77] ncr5380: Fix NCR5380_transfer_pio() result

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: According to the SCSI-2 draft revision 10L, atari_NCR5380.c is correct when it says that the phase lines are valid up until ACK is negated following the transmission of the last byte in MESSAGE IN phase. This is true for all information transfer phases, f

Re: [PATCH v3 25/77] ncr5380: Rework disconnect versus poll logic

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: The atari_NCR5380.c and NCR5380.c core drivers differ in their handling of target disconnection. This is partly because atari_NCR5380.c had all of the polling and sleeping removed to become entirely interrupt-driven, and it is partly because of damage don

Re: [PATCH v3 24/77] ncr5380: Implement NCR5380_dma_xfer_len and remove LIMIT_TRANSFERSIZE macro

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Follow the example of the atari_NCR5380.c core driver and adopt the NCR5380_dma_xfer_len() hook. Implement NCR5380_dma_xfer_len() for dtc.c and g_NCR5380.c to take care of the limitations of these cards. Keep the default for drivers using PSEUDO_DMA. Eli

Re: [PATCH v3 23/77] ncr5380: Always retry arbitration and selection

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: If NCR5380_select() returns -1, it means arbitration was lost or selection failed and should be retried. If the main loop simply terminates when there are still commands on the issue queue, they will remain queued until they expire. Fix this by clearing

Re: [PATCH v3 22/77] ncr5380: Eliminate selecting state

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:18 AM, Finn Thain wrote: Linux v2.1.105 changed the algorithm for polling for the BSY signal in NCR5380_select() and NCR5380_main(). Presently, this code has a bug. Back then, NCR5380_set_timer(hostdata, 1) meant reschedule main() after sleeping for 10 ms. Repeated 25 times this

Re: [PATCH v3 21/77] ncr5380: Sleep when polling, if possible

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:17 AM, Finn Thain wrote: 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. Calibrate busy-wait iterations to allow for variation in chip

Re: [PATCH v3 20/77] ncr5380: Introduce unbound workqueue

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:17 AM, Finn Thain wrote: 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 whi

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

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:17 AM, Finn Thain wrote: Commit 8b801ead3d7a ("[ARM] rpc: update Acorn SCSI drivers to modern ecard interfaces") neglected to remove a request_region() call in cumana_1.c. Commit eda32612f7b2 ("[PATCH] give all LLDD driver a ->release method") in history/history.git added some p

Re: [PATCH v3 18/77] ncr5380: Eliminate USLEEP_WAITLONG delay

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:17 AM, Finn Thain wrote: Linux 2.1.105 introduced the USLEEP_WAITLONG delay, apparently "needed for Mustek scanners". It is intended to stall the issue queue for 5 seconds. There are a number of problems with this. 1. Only g_NCR5380 enables the delay, which implies that the othe

Re: [PATCH v3 17/77] ncr5380: Keep BSY asserted when entering SELECTION phase

2015-12-21 Thread Hannes Reinecke
On 12/22/2015 02:17 AM, Finn Thain wrote: 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 Reviewed-by: Hannes Reinecke Cheer

RE: st driver doesn't seem to grok LTO partitioning

2015-12-21 Thread Seymour, Shane M
If you need help with anything please let me know I'd be more than happy to contribute (with testing and a review if you want). I have a system with an older LTO-3 tape drive that I can use any time (it doesn’t support partitioning so if nothing else I can make sure partitioning attempts fail gr

Re: [PATCH v2 1/3] badblocks: Add core badblock management code

2015-12-21 Thread NeilBrown
On Sat, Dec 05 2015, Verma, Vishal L wrote: > On Fri, 2015-12-04 at 15:30 -0800, James Bottomley wrote: > [...] >> > +ssize_t badblocks_store(struct badblocks *bb, const char *page, >> > size_t len, >> > + int unack) >> [...] >> > +int badblocks_init(struct badblocks *bb, int enab

Re: [PATCH v2 3/3] hpsa: add box and bay information for enclosure devices

2015-12-21 Thread Matthew R. Ochs
Reviewed-by: Matthew R. Ochs -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v2 1/3] hpsa: fix path_info_show

2015-12-21 Thread Matthew R. Ochs
> On Dec 21, 2015, at 11:21 AM, Don Brace wrote: > > left off some changes from Rasmus Villemoes where he changed > snprintf to scnprintf > > Suggested-by: Rasmus Villemoes > Reviewed-by: Justin Lindley > Reviewed-by: Kevin Barnett > Reviewed-by: Scott Teel > Reviewed-by: Rasmus Villemoes >

Re: [PATCH 00/17] lpfc: Update to revision 11.0.0.10

2015-12-21 Thread Martin K. Petersen
> "James" == James Smart writes: James> This patch set updates the lpfc driver to revision 11.0.0.10 James> The patches were cut against scsi-misc Applied to 4.5/scsi-queue except for 3/17. -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line

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

2015-12-21 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 v3 03/77] ncr5380: Eliminate PDEBUG*, TDEBUG* and DTCDEBUG* macros

2015-12-21 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 Reviewed-by: Hannes Reinecke --- drivers/scsi/dtc.c | 18 ++ drivers/scsi/dtc.h | 27 ---

[PATCH v3 04/77] ncr5380: Remove more pointless macros

2015-12-21 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 Reviewed-by: Hannes Reinecke --- drivers/scsi/NCR5380.h |3 --- drivers/scsi/g_NC

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

2015-12-21 Thread Finn Thain
Move board-specific code like this, NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE); from the core driver to the board driver. Eliminate the NCR53C400 macro from the core driver. Removal of all macros like this one will be necessary in order to have one core driver that can support all kin

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

2015-12-21 Thread Finn Thain
The NCR5380_local_declare and NCR5380_setup macros exist to define and initialize a particular local variable, to provide the address of the chip registers needed for the driver's implementation of its NCR5380_read/write register access macros. In cumana_1 and macscsi, these macros generate pointl

[PATCH v3 11/77] ncr5380: Simplify bus reset handlers

2015-12-21 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 Reviewed-by: Hannes Reinecke --- Bus reset handlers in both core drivers still have serious problems for EH purposes. Those problems are ad

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

2015-12-21 Thread Finn Thain
This patch splits the NCR5380_init() function into two parts, similar to the scheme used with atari_NCR5380.c. This avoids two problems. Firstly, NCR5380_init() may perform a bus reset, which would cause the chip to assert IRQ. The chip is unable to mask its bus reset interrupt. Drivers can't call

[PATCH v3 06/77] ncr5380: Remove NCR5380_instance_name macro

2015-12-21 Thread Finn Thain
This macro makes the code cryptic. Remove it. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke --- 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/

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

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

[PATCH v3 13/77] ncr5380: Remove redundant register writes

2015-12-21 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 --- drivers/scsi/NCR5380.c |2 -- drivers/scsi/atari_N

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

2015-12-21 Thread Finn Thain
Remove the restart_select and targets_present variables introduced in Linux v1.1.38. The former was used only for a questionable debug printk and the latter "so we can call a select failure a retryable condition". Well, retrying select failure in general is a different problem to a target that does

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

2015-12-21 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 Reviewed-by: Hannes Reinecke --- drivers/scsi/NCR5380.c |

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

2015-12-21 Thread Finn Thain
The atari_NCR5380.c core driver now takes care of bus reset upon driver initialization if required (same as NCR5380.c). Move the Toshiba CD-ROM support into the core driver, enabled with a host flag, so that all NCR5380 drivers can make use of it. Drop the RESET_BOOT macros and the ATARI_SCSI_RESE

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

2015-12-21 Thread Finn Thain
Merge the bus reset code from NCR5380.c into atari_NCR5380.c. This allows for removal of a lot of duplicated code conditional on the RESET_BOOT macro (in the next patch). The atari_NCR5380.c fork lacks the do_reset() and NCR5380_poll_politely() routines from NCR5380.c, so introduce them. They are

[PATCH v3 34/77] atari_NCR5380: Use arbitration timeout

2015-12-21 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 ++--- drive

[PATCH v3 38/77] ncr5380: Remove UNSAFE macro

2015-12-21 Thread Finn Thain
Configuring core drivers using macros like this one prevents re-unifying the core driver forks, and prevents implementing the core driver as a library or a platform driver. The UNSAFE macro in particular is a poor workaround for the problem of interrupt latency. Releasing the locks complicates thi

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

2015-12-21 Thread Finn Thain
The host spin lock needs to be acquired by NCR5380_abort() before it calls NCR5380_select(). This patch doesn't actually fix the EH issues in this driver but it does avoid this: BUG: spinlock already unlocked on CPU#0, kworker/u4:1/14 lock: 0xc0c0f834, .magic: dead4ead, .owner: /-1, .owner_cpu: -

[PATCH v3 43/77] ncr5380: Standardize reselection handling

2015-12-21 Thread Finn Thain
Bring the two NCR5380_reselect() implementations into agreement. Replace infinite loops in atari_NCR5380.c with timeouts, as per NCR5380.c. Remove 'abort' flag in NCR5380.c as per atari_NCR5380.c -- if reselection fails, there may be no MESSAGE IN phase so don't attempt data transfer. During sel

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

2015-12-21 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 v3 40/77] ncr5380: Introduce NCR5380_poll_politely2

2015-12-21 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 | 66 +++

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

2015-12-21 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/NCR538

[PATCH v3 39/77] ncr5380: Standardize interrupt handling

2015-12-21 Thread Finn Thain
Because interrupt handling is crucial to the core driver(s), all wrapper drivers need to agree on this code. This patch removes discrepancies. NCR5380_intr() in NCR5380.c has the following pointless loop that differs from the code in atari_NCR5380.c. done = 1; do {

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

2015-12-21 Thread Finn Thain
When there is a queued command and no connected command, NCR5380_select() is called and arbitration begins. The chip waits for BUS FREE once the MR_ARBITRATE bit in the mode register is enabled. That means there is no need to wait for BUS FREE after disconnecting. There is presently no polling for

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

2015-12-21 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 inser

[PATCH v3 48/77] atari_NCR5380: Fix queue_size limit

2015-12-21 Thread Finn Thain
When a target reports a QUEUE_FULL condition it causes the driver to update the 'queue_size' limit with the number of currently allocated tags. At least, that's what's supposed to happen, according to the comments. Unfortunately the terms in the assignment are swapped. Fix this and cleanup some obs

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

2015-12-21 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 | 12 +--- d

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

2015-12-21 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 have dropped his sign

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

2015-12-21 Thread Finn Thain
Replace all H_NO and some HOSTNO macros (both peculiar to atari_NCR5380.c) with a new dsprintk macro that's more useful and more consistent. The new macro avoids a lot of boilerplate in new code in subsequent patches. Keep NCR5380.c in sync. Remaining HOSTNO macros are removed as side-effects of su

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

2015-12-21 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 v3 47/77] ncr5380: Fix and cleanup scsi_host_template initializers

2015-12-21 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/dmx3191d.c

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

2015-12-21 Thread Finn Thain
The NCR5380 drivers have a home-spun linked list implementation for scsi_cmnd structs that uses cmd->host_scribble as a 'next' pointer. Adopt the standard list_head data structure and list operations instead. Remove the eh_abort_handler rather than convert it. Doing the conversion would only be chu

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

2015-12-21 Thread Finn Thain
The workarounds for chip errata appear twice, in slightly different forms. One is used when defined(REAL_DMA) || defined(REAL_DMA_POLL), the other when defined(PSEUDO_DMA). In the PDMA case, the workarounds have been made conditional on FLAG_NO_DMA_FIXUPS. Do the same for the DMA case, to eliminate

[PATCH v3 53/77] ncr5380: Use shost_priv helper

2015-12-21 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(+), 2

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

2015-12-21 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 v3 62/77] ncr5380: Implement new eh_bus_reset_handler

2015-12-21 Thread Finn Thain
NCR5380.c lacks a sane eh_bus_reset_handler. The atari_NCR5380.c code is much better but it should not throw out the issue queue (that would be a host reset) and it neglects to set the result code for commands that it throws out. Fix these bugs and keep the two core drivers in sync. Signed-off-by:

[PATCH v3 59/77] ncr5380: Fix autosense bugs

2015-12-21 Thread Finn Thain
NCR5380_information_transfer() may re-queue a command for autosense, after calling scsi_eh_prep_cmnd(). This creates several possibilities: 1. Reselection may intervene before the re-queued command gets processed. If the reconnected command then undergoes autosense, this causes the scsi_eh_s

[PATCH v3 58/77] ncr5380: Refactor command completion

2015-12-21 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 | 31 ++-- driv

[PATCH v3 56/77] ncr5380: Remove redundant volatile qualifiers

2015-12-21 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/drive

[PATCH v3 49/77] ncr5380: Remove redundant ICR_ARBITRATION_LOST test and eliminate FLAG_DTC3181E

2015-12-21 Thread Finn Thain
Remove FLAG_DTC3181E. It was used to suppress a final Arbitration Lost (SEL asserted) test that isn't actually needed. The test was suppressed because it causes problems for DTC436 and DTC536 chips. It takes place after the host wins arbitration, so SEL has been asserted. These chips can't seem to

[PATCH v3 64/77] atari_NCR5380: Eliminate HOSTNO macro

2015-12-21 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/scsi

[PATCH v3 75/77] ncr5380: Enable PDMA for DTC chips

2015-12-21 Thread Finn Thain
From: Ondrej Zary Add I/O register mapping for DTC chips and enable PDMA mode. These chips have 16-bit wide HOST BUFFER register and it must be read by 16-bit accesses (we lose data otherwise). Large PIO transfers crash at least the DTCT-436P chip (all reads result in 0xFF) so this patch actual

[PATCH v3 74/77] ncr5380: Enable PDMA for NCR53C400A

2015-12-21 Thread Finn Thain
From: Ondrej Zary Add I/O register mapping for NCR53C400A and enable PDMA mode to improve performance and fix non-working IRQ. Tested with HP C2502 (and user-space enabler). Signed-off-by: Ondrej Zary Signed-off-by: Finn Thain --- Changes to Ondrej's version: - An 'if' statement is now a 's

[PATCH v3 67/77] ncr5380: Cleanup comments

2015-12-21 Thread Finn Thain
The CVS revision log is not nearly as useful as the history/history.git repo, so remove it. Roman's commentary at the top of his driver repeats the same information elsewhere in the file so remove it. Also remove some other redundant or obsolete comments. Both the driver and the datasheets confusi

[PATCH v3 76/77] ncr5380: Fix wait for 53C80 registers registers after PDMA

2015-12-21 Thread Finn Thain
From: Ondrej Zary The check for 53C80 registers accessibility was commented out because it was broken (inverted). Fix and enable it. Signed-off-by: Ondrej Zary Signed-off-by: Finn Thain --- drivers/scsi/g_NCR5380.c | 37 ++--- 1 file changed, 6 insertions(+)

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

2015-12-21 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 v3 72/77] ncr5380: Fix pseudo DMA transfers on 53C400

2015-12-21 Thread Finn Thain
From: Ondrej Zary Pseudo-DMA (PDMA) has been broken for ages, resulting in hangs on 53C400-based cards. According to 53C400 datasheet, PDMA transfer length must be a multiple of 128. Check if that's true and use PIO if it's not. This makes PDMA work on 53C400 (Canon FG2-5202). Signed-off-by: O

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

2015-12-21 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 v3 20/77] ncr5380: Introduce unbound workqueue

2015-12-21 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 some

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

2015-12-21 Thread Finn Thain
In the past, NCR5380.c was overlooked by those working on atari_NCR5380.c and this caused needless divergence. All of the changes in this patch were taken from atari_NCR5380.c. This removes some unimportant discrepancies between the two core driver forks so that 'diff' can be used to reveal the im

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

2015-12-21 Thread Finn Thain
The atari_NCR5380.c and NCR5380.c core drivers differ in their handling of target disconnection. This is partly because atari_NCR5380.c had all of the polling and sleeping removed to become entirely interrupt-driven, and it is partly because of damage done to NCR5380.c after atari_NCR5380.c was for

[PATCH v3 28/77] ncr5380: Drop DEF_SCSI_QCMD macro

2015-12-21 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 c

  1   2   >