1. 07 1月, 2016 11 次提交
    • F
      ncr5380: Standardize interrupt handling · cd400825
      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 {
      		/* ... */
      	} while (!done);
      
      The 'done' flag gets cleared when a reconnected command is to be processed
      from the work queue. But in NCR5380.c, the flag is also used to cause the
      interrupt conditions to be re-examined. Perhaps this was because
      NCR5380_reselect() was expected to cause another interrupt, or perhaps
      the remaining present interrupt conditions need to be handled after the
      NCR5380_reselect() call?
      
      Actually, both possibilities are bogus, as is the loop itself. It seems
      have been overlooked in the hit-and-miss removal of scsi host instance
      list iteration many years ago; see history/history.git commit 491447e1fcff
      ("[PATCH] next NCR5380 updates") and commit 69e1a9482e57 ("[PATCH] fix up
      NCR5380 private data"). See also my earlier patch, "Always retry
      arbitration and selection".
      
      The datasheet says, "IRQ can be reset simply by reading the Reset
      Parity/Interrupt Register". So don't treat the chip IRQ like a
      level-triggered interrupt. Of the conditions that set the IRQ flag,
      some are level-triggered and some are edge-triggered, which means IRQ
      itself must be edge-triggered.
      
      Some interrupt conditions are latched 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_NCR5380.c and
      NCR5380.c in agreement.
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Tested-by: NMichael Schmitz <schmitzmic@gmail.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      cd400825
    • F
      ncr5380: Rework disconnect versus poll logic · 686f3990
      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
      forked. See commit 37cd23b44929 ("Linux 2.1.105") in history/history.git.
      
      The polling changes that were made in v2.1.105 are questionable at best:
      if REQ is not already asserted when NCR5380_transfer_pio() is invoked, and
      if the expected phase is DATA IN or DATA OUT, the function will schedule
      main() to execute after USLEEP_SLEEP jiffies and then return. The problems
      here are the expected REQ timing and the sleep interval*. Avoid this issue
      by using NCR5380_poll_politely() instead of scheduling main().
      
      The atari_NCR5380.c core driver requires the use of the chip interrupt and
      always permits target disconnection. It sets the cmd->device->disconnect
      flag when a device disconnects, but never tests this flag.
      
      The NCR5380.c core driver permits disconnection only when
      instance->irq != NO_IRQ. It sets the cmd->device->disconnect flag when
      a device disconnects and it tests this flag in a couple of places:
      
      1. During NCR5380_information_transfer(), following COMMAND OUT phase,
         if !cmd->device->disconnect, the initiator will take a guess as to
         whether or not the target will then choose to go to MESSAGE IN phase
         and disconnect. If the driver guesses "yes", it will schedule main()
         to execute after USLEEP_SLEEP jiffies and then return there.
      
         Unfortunately the driver may guess "yes" even after it has denied
         the target the disconnection privilege. When the target does not
         disconnect, the sleep can be beneficial, assuming the sleep interval
         is appropriate (mostly it is not*).
      
         And even if the driver guesses "yes" correctly, and the target would
         then disconnect, the driver still has to go through the MESSAGE IN
         phase in order to get to BUS FREE phase. The main loop can do nothing
         useful until BUS FREE, and sleeping just delays the phase transition.
      
      2. If !cmd->device->disconnect and REQ is not already asserted when
         NCR5380_information_transfer() is invoked, the function polls for REQ
         for USLEEP_POLL jiffies. If REQ is not asserted, it then schedules
         main() to execute after USLEEP_SLEEP jiffies and returns.
      
         The idea is apparently to yeild the CPU while waiting for REQ.
         This is conditional upon !cmd->device->disconnect, but there seems
         to be no rhyme or reason for that. For example, the flag may be
         unset because disconnection privilege was denied because the driver
         has no IRQ. Or the flag may be unset because the device has never
         needed to disconnect before. Or if the flag is set, disconnection
         may have no relevance to the present bus phase.
      
      Another deficiency of the existing algorithm is as follows. When the
      driver has no IRQ, it prevents disconnection, and generally polls and
      sleeps more than it would normally. Now, if the driver is going to poll
      anyway, why not allow the target to disconnect? That way the driver can do
      something useful with the bus instead of polling unproductively!
      
      Avoid this pointless latency, complexity and guesswork by using
      NCR5380_poll_politely() instead of scheduling main().
      
      * For g_NCR5380, the time intervals for USLEEP_SLEEP and USLEEP_POLL are
        200 ms and 10 ms, respectively. They are 20 ms and 200 ms respectively
        for the other NCR5380 drivers. There doesn't seem to be any reason 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 devices.
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Tested-by: NMichael Schmitz <schmitzmic@gmail.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      686f3990
    • F
      ncr5380: Implement NCR5380_dma_xfer_len and remove LIMIT_TRANSFERSIZE macro · ff3d4578
      Finn Thain 提交于
      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.
      
      Eliminate the unused macro LIMIT_TRANSFERSIZE.
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Tested-by: NMichael Schmitz <schmitzmic@gmail.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      ff3d4578
    • F
      ncr5380: Introduce unbound workqueue · 0ad0eff9
      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: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Tested-by: NMichael Schmitz <schmitzmic@gmail.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      0ad0eff9
    • F
      ncr5380: Eliminate USLEEP_WAITLONG delay · 4d029e9a
      Finn Thain 提交于
      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 other five
         drivers using the NCR5380.c core driver remain incompatible with
         Mustek scanners.
      
      2. The delay is not implemented by atari_NCR5380.c, which is problematic
         for re-unifying the two core driver forks.
      
      3. The delay is implemented using NCR5380_set_timer() which makes it
         unreliable. A new command queued by the mid-layer cancels the delay.
      
      4. The delay is applied indiscriminately in several situations in which
         NCR5380_select() returns -1. These are-- reselection by the target,
         failure of the target to assert BSY, and failure of the target to
         assert REQ. It's clear from the comments that USLEEP_WAITLONG is not
         relevant to the reselection case. And reportedly, these scanners do
         not disconnect.
      
      5. atari_NCR5380.c was forked before Linux 2.1.105, so it was spared some
         of the damage done to NCR5380.c. In this case, the atari_NCR5380.c core
         driver was more standard-compliant and may not have needed any
         workaround like the USLEEP_WAITLONG kludge. The compliance issue was
         addressed in the previous patch.
      
      If these scanners still don't work, we need a better solution. Retrying
      selection until EH aborts a command offers equivalent robustness. Bugs in
      the existing driver prevent EH working correctly but this is addressed in
      a subsequent patch. Remove USLEEP_WAITLONG.
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      4d029e9a
    • F
      ncr5380: Move NCR53C400-specific code · 4d8c08c7
      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 kinds of
      boards.
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      4d8c08c7
    • F
      ncr5380: Split NCR5380_init() into two functions · b6488f97
      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 request_irq() before calling NCR5380_init(), because
      initialization must happen before the interrupt handler executes. If
      driver initialization causes an interrupt it may be problematic on some
      platforms. To avoid that, first move the bus reset code into
      NCR5380_maybe_reset_bus().
      
      Secondly, NCR5380_init() contains some board-specific interrupt setup code
      for the NCR53C400 that does not belong in the core driver. In moving this
      code, better not re-order interrupt initialization and bus reset. Again,
      the solution is to move the bus reset code into NCR5380_maybe_reset_bus().
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      b6488f97
    • F
      ncr5380: Remove NCR5380_instance_name macro · b01ec348
      Finn Thain 提交于
      This macro makes the code cryptic. Remove it.
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      b01ec348
    • F
      ncr5380: Remove NCR5380_local_declare and NCR5380_setup macros · 54d8fe44
      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 pointless code like this,
      	struct Scsi_Host *_instance;
      	_instance = instance;
      
      In pas16, the use of NCR5380_read/write in pas16_hw_detect() requires that
      the io_port local variable has been defined and initialized, but the
      NCR5380_local_declare and NCR5380_setup macros can't be 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: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      54d8fe44
    • F
      ncr5380: Remove more pointless macros · c0965e63
      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: NFinn Thain <fthain@telegraphics.com.au>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Tested-by: NOndrej Zary <linux@rainbow-software.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      c0965e63
    • F
  2. 09 3月, 2015 2 次提交
  3. 20 11月, 2014 9 次提交
  4. 18 7月, 2014 1 次提交
  5. 28 5月, 2014 1 次提交
  6. 20 3月, 2014 1 次提交
  7. 10 4月, 2013 1 次提交
  8. 04 1月, 2013 1 次提交
    • G
      Drivers: scsi: remove __dev* attributes. · 6f039790
      Greg Kroah-Hartman 提交于
      CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
      markings need to be removed.
      
      This change removes the use of __devinit, __devexit_p, __devinitdata,
      __devinitconst, and __devexit from these drivers.
      
      Based on patches originally written by Bill Pemberton, but redone by me
      in order to handle some of the coding style issues better, by hand.
      
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Cc: Adam Radford <linuxraid@lsi.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f039790
  9. 29 3月, 2012 1 次提交
  10. 31 3月, 2011 1 次提交
  11. 11 8月, 2010 2 次提交
  12. 25 11月, 2007 1 次提交
    • J
      [SCSI] NCR5380: Fix bugs and canonicalize irq handler usage · 1e641664
      Jeff Garzik 提交于
      * Always pass the same value to free_irq() that we pass to
        request_irq().  This fixes several bugs.
      
      * Always call NCR5380_intr() with 'irq' and 'dev_id' arguments.
      
        Note, scsi_falcon_intr() is the only case now where dev_id is not the
        scsi_host.
      
      * Always pass Scsi_Host to request_irq().  For most cases, the drivers
        already did so, and I merely neated the source code line.  In other
        cases, either NULL or a non-sensical value was passed, verified to be
        unused, then changed to be Scsi_Host in anticipation of the future.
      
      In addition to the bugs fixes, this change makes the interface usage
      consistent, which in turn enables the possibility of directly
      referencing Scsi_Host from all NCR5380_intr() invocations.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      1e641664
  13. 13 10月, 2007 1 次提交
  14. 15 2月, 2007 1 次提交
    • T
      [PATCH] remove many unneeded #includes of sched.h · cd354f1a
      Tim Schmielau 提交于
      After Al Viro (finally) succeeded in removing the sched.h #include in module.h
      recently, it makes sense again to remove other superfluous sched.h includes.
      There are quite a lot of files which include it but don't actually need
      anything defined in there.  Presumably these includes were once needed for
      macros that used to live in sched.h, but moved to other header files in the
      course of cleaning it up.
      
      To ease the pain, this time I did not fiddle with any header files and only
      removed #includes from .c-files, which tend to cause less trouble.
      
      Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
      arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
      allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
      configs in arch/arm/configs on arm.  I also checked that no new warnings were
      introduced by the patch (actually, some warnings are removed that were emitted
      by unnecessarily included header files).
      Signed-off-by: NTim Schmielau <tim@physik3.uni-rostock.de>
      Acked-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cd354f1a
  15. 07 8月, 2006 1 次提交
    • M
      [SCSI] Improve inquiry printing · 4ff36718
      Matthew Wilcox 提交于
       - Replace scsi_device_types array API with scsi_device_type function API.
         Gets rid of a lot of common code, as well as being easier to use.
       - Add the new device types in SPC4 r05a, and rename some of the older ones.
       - Reformat the printing of inquiry data; now fits on one line and
         includes PQ.
      
      I think I've addressed all the feedback from the previous versions.  My
      current test box prints:
      
      scsi 2:0:1:0: Direct access     HP 18.2G ATLAS10K3_18_SCA HP05 PQ: 0 ANSI: 2
      Signed-off-by: NMatthew Wilcox <matthew@wil.cx>
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      4ff36718
  16. 03 7月, 2006 1 次提交
  17. 01 7月, 2006 1 次提交
  18. 10 6月, 2006 1 次提交
  19. 24 3月, 2006 1 次提交
  20. 10 11月, 2005 1 次提交