12 Apr, 2016

4 commits

  • Now that atari_scsi and sun3_scsi have been converted to use the NCR5380.c
    core driver, remove atari_NCR5380.c. Also remove the last vestiges of its
    Tagged Command Queueing implementation from the wrapper drivers.

    The TCQ support in atari_NCR5380.c is abandoned by this patch. It is not
    merged into the remaining core driver because,

    1) atari_scsi defines SUPPORT_TAGS but leaves FLAG_TAGGED_QUEUING disabled
    by default, which indicates that it is mostly undesirable.

    2) I'm told that it doesn't work correctly when enabled.

    3) The algorithm does not make use of block layer tags which it will have
    to do because scmd->tag is deprecated.

    4) sun3_scsi doesn't define SUPPORT_TAGS at all, yet the the SUPPORT_TAGS
    macro interacts with the CONFIG_SUN3 macro in 'interesting' ways.

    5) Compile-time configuration with macros like SUPPORT_TAGS caused the
    configuration space to explode, leading to untestable and unmaintainable
    code that is too hard to reason about.

    The merge_contiguous_buffers() code is also abandoned. This was unused
    by sun3_scsi. Only atari_scsi used it and then only on TT, because only TT
    supports scatter/gather. I suspect that the TT would work fine with
    ENABLE_CLUSTERING instead. If someone can benchmark the difference then
    perhaps the merge_contiguous_buffers() code can be be justified. Until
    then we are better off without the extra complexity.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Tested-by: Ondrej Zary
    Signed-off-by: Martin K. Petersen

    Finn Thain
     
  • Add support for the custom Sun 3 DMA logic to the NCR5380.c core driver.
    This code is copied from atari_NCR5380.c.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Tested-by: Ondrej Zary
    Signed-off-by: Martin K. Petersen

    Finn Thain
     
  • Only the atari_scsi and sun3_scsi drivers define DMA_MIN_SIZE.
    Both drivers also define NCR5380_dma_xfer_len, which means
    DMA_MIN_SIZE can be removed from the core driver.

    This removes another discrepancy between the two core drivers.

    Signed-off-by: Finn Thain
    Tested-by: Michael Schmitz
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Martin K. Petersen

    Finn Thain
     
  • For the NCR5380.c core driver, these macros are never used.
    If REAL_DMA were to be defined, compilation would fail.

    For the atari_NCR5380.c core driver, REAL_DMA is always defined.

    Hence these macros are pointless.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Tested-by: Ondrej Zary
    Signed-off-by: Martin K. Petersen

    Finn Thain
     

07 Jan, 2016

7 commits

  • 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
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Martin K. Petersen

    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 churn because the existing EH handlers don't work and get replaced
    in a subsequent patch.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Ondrej Zary
    Tested-by: Michael Schmitz
    Signed-off-by: Martin K. Petersen

    Finn Thain
     
  • 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 NCR5380.c differ here. Because
    it is just for 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 Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Ondrej Zary
    Tested-by: Michael Schmitz
    Signed-off-by: Martin K. Petersen

    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
    Reviewed-by: Hannes Reinecke
    Tested-by: Ondrej Zary
    Tested-by: Michael Schmitz
    Signed-off-by: Martin K. Petersen

    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
    Reviewed-by: Hannes Reinecke
    Tested-by: Ondrej Zary
    Tested-by: Michael Schmitz
    Signed-off-by: Martin K. Petersen

    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_RESET_BOOT and
    ATARI_SCSI_TOSHIBA_DELAY Kconfig symbols, which are now redundant.

    Remove the atari_scsi_reset_boot(), mac_scsi_reset_boot() and
    sun3_scsi_reset_boot() routines. None of this duplicated code is needed
    now that all drivers can use NCR5380_maybe_reset_bus().

    This brings atari_scsi, mac_scsi and sun3_scsi into line with all of the
    other NCR5380 drivers.

    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
    is not assigned to atari_scsi at this stage, so
    CONFIG_ATARI_SCSI_RESET_BOOT=y may well 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
    Reviewed-by: Hannes Reinecke
    Tested-by: Ondrej Zary
    Tested-by: Michael Schmitz
    Signed-off-by: Martin K. Petersen

    Finn Thain
     
  • Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Ondrej Zary
    Signed-off-by: Martin K. Petersen

    Finn Thain
     

09 Mar, 2015

1 commit


20 Nov, 2014

16 commits

  • There's no need to run the cmd->done callback for aborted commands. Remove
    the old EH code and the RESET_RUN_DONE macro.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • The static variable setup_use_tagged_queuing is declared in mac_scsi.c,
    sun3_scsi.c and atari_scsi.c and doesn't belong in the core driver.
    None of the other NCR5380 drivers suffer from this layering issue which
    makes merging the core drivers more difficult and will likely hinder plans
    for future use of platform data to configure the driver.

    Replace the static variable with a host flag. This way it can be reported
    along with the other flags.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Given the preceding changes to atari_NCR5380.c, this patch should not change
    behaviour of the sun3_scsi and sun3_scsi_vme modules.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • atari_NCR5380.c enables its IRQ when it is already enabled. Sun3 doesn't
    use the ENABLE_IRQ/DISABLE_IRQ cruft. Remove it.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • The #defines in sun3_scsi.h are intended to influence subsequent #includes
    in sun3_scsi.c. IMHO, that's too convoluted.

    Move sun3_scsi.h macro definitions to sun3_scsi.c, consistent with other
    NCR5380 drivers.

    Omit the unused NCR5380_local_declare() and NCR5380_setup() macros.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Convert sun3_scsi to platform device and eliminate scsi_register().

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Acked-by: Geert Uytterhoeven
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Convert Scsi_Cmnd to struct scsi_cmnd and drop the #include "scsi.h".
    The sun3_NCR5380.c core driver already uses struct scsi_cmnd so converting
    the other core drivers reduces the diff which makes them easier to unify.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • The *_RELEASE macros don't tell me anything. In some cases the version in
    the macro contradicts the version in the comments. Anyway, the Linux kernel
    version is sufficient information. Remove these macros to improve readability.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Compile-time override of scsi host defaults is pointless for drivers that
    provide module parameters and __setup options for that. Too many macros make
    the code hard to read so remove them.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • If the host->info() method is not set, then host->name is used by default.
    For atari_scsi, that is exactly the same text. So remove the redundant
    info() method. Keep sun3_scsi.c in line with atari_scsi.

    Some NCR5380 drivers return an empty string from the info() method
    (arm/cumana_1.c arm/oak.c mac_scsi.c) while other drivers use the default
    (dmx3191d dtc.c g_NCR5380.c pas16.c t128.c).

    Implement a common info() method to replace a lot of duplicated code which
    the various drivers use to announce the same information.

    This replaces most of the (deprecated) show_info() output and all of the
    NCR5380_print_info() output. This also eliminates a bunch of code in
    g_NCR5380 which just duplicates functionality in the core driver.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Oak scsi doesn't use any IRQ, but it sets irq = IRQ_NONE rather than
    SCSI_IRQ_NONE. Problem is, the core NCR5380 driver expects SCSI_IRQ_NONE
    if it is to issue IDENTIFY commands that prevent target disconnection.
    And, as Geert points out, IRQ_NONE is part of enum irqreturn.

    Other drivers, when they can't get an IRQ or can't use one, will set
    host->irq = SCSI_IRQ_NONE (that is, 255). But when they exit they will
    attempt to free IRQ 255 which was never requested.

    Fix these bugs by using NO_IRQ in place of SCSI_IRQ_NONE and IRQ_NONE.
    That means IRQ 0 is no longer probed by ISA drivers but I don't think
    this matters.

    Setting IRQ = 255 for these ISA drivers is understood to mean no IRQ.
    This remains supported so as to avoid breaking existing ISA setups (which
    can be difficult to get working) and because existing documentation
    (SANE, TLDP etc) describes this usage for the ISA NCR5380 driver options.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • The LIMIT_TRANSFERSIZE, PSEUDO_DMA, PARITY and UNSAFE options are all
    documented in the core drivers where they are used. The same goes for the
    chip databook reference. Remove the duplicate comments.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Every NCR5380 driver sets AUTOSENSE so it need not be optional (and the
    mid-layer expects it). Remove this redundant macro to improve readability.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Add missing static qualifiers and remove the now pointless prototypes. The
    NCR5380_* prototypes are all declared in NCR5380.h and renamed using macros.
    Further declarations are redundant (some are completely unused). Remove
    them.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Some macros are never evaluated (i.e. FOO, USLEEP, SCSI2 and USE_WRAPPER;
    and in some drivers, NCR5380_intr and NCR5380_proc_info). DRIVER_SETUP
    serves no purpose anymore. Remove these macro definitions.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Tested-by: Michael Schmitz
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Remove unused fields from hostdata structs declared with the
    NCR5380_implementation_fields macro.

    Signed-off-by: Finn Thain
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Finn Thain
     

28 May, 2014

5 commits

  • The sun3 drivers suffer from a whole bunch of duplicated code. Fix this
    by following the g_NCR5380_mmio example. (Notionally, sun3_scsi relates to
    sun3_scsi_vme in the same way that g_NCR5380 relates to g_NCR5380_mmio.)

    Dead code is also removed: we now have working debug macros so
    SUN3_SCSI_DEBUG is undesirable. Dead code within #ifdef OLD_DMA is also
    dropped, consistent with sun3_scsi_vme.c.

    Signed-off-by: Finn Thain
    Acked-by: Sam Creasey
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Move the #include "NCR5380.h" out of the sun3_scsi.h header file and into
    the driver .c files, like all the other NCR5380 drivers in the tree.

    This improves uniformity and reduces the depth of nested includes. The
    sequence of #include's, #define's and #if's no longer does my head in.

    Signed-off-by: Finn Thain
    Acked-by: Sam Creasey
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • All three NCR5380 core driver implementations share the same NCR5380.h
    header file so they need to agree on certain macro definitions.

    The flag bit used by the NDEBUG_MERGING macro in atari_NCR5380 and
    sun3_NCR5380 collides with the bit used by NDEBUG_LISTS.

    Moreover, NDEBUG_ABORT appears in NCR5380.c so it should be defined in
    NCR5380.h rather than in each of the many drivers using that core.

    An undefined NDEBUG_ABORT macro caused compiler errors and led to dodgy
    workarounds in the core driver that can now be removed.
    (See commits f566a576bca09de85bf477fc0ab2c8c96405b77b and
    185a7a1cd79b9891e3c17abdb103ba1c98d6ca7a.)

    Move all of the NDEBUG_ABORT, NDEBUG_TAGS and NDEBUG_MERGING macro
    definitions into NCR5380.h where all the other NDEBUG macros live.

    Also, incorrect "#ifdef NDEBUG" becomes "#if NDEBUG" to fix the warning:
    drivers/scsi/mac_scsi.c: At top level:
    drivers/scsi/NCR5380.c:418: warning: 'NCR5380_print' defined but not used
    drivers/scsi/NCR5380.c:459: warning: 'NCR5380_print_phase' defined but not used

    The debugging code is now enabled when NDEBUG != 0.

    Signed-off-by: Finn Thain
    Acked-by: Sam Creasey
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Only the NCR5380_dprint() macro should invoke the NCR5380_print() function.
    That's why NCR5380.c only defines the function #if NDEBUG. Use the standard
    macro.

    Signed-off-by: Finn Thain
    Acked-by: Sam Creasey
    Signed-off-by: Christoph Hellwig

    Finn Thain
     
  • Signed-off-by: Finn Thain
    Acked-by: Sam Creasey
    Signed-off-by: Christoph Hellwig

    Finn Thain
     

20 May, 2014

1 commit

  • [Resend of earlier patch - added equivalent changes to sun3 NCR5380 code]

    The abort/reset lowlevel return codes had changed with the new
    error SCSI handling - update Atari and Sun3 NCR5380 drivers to reflect this.

    Change reset handling for Atari to clear queues only, do not attempt
    to call done() on each command aborted by the reset. The EH code
    should do that for us. Queues _must_ be cleared, otherwise
    atari_scsi_bus_reset will not release the ST-DMA lock, deadlocking
    further error recovery.

    Update the Sun3 NCR5380 driver as well - the Sun3 driver was
    derived from the Atari one. Kudos to Finn Thain for the Sun3 part
    and cleaning up the header files. After the header cleanup, the
    initio.h include (!) can be dropped from sun3_scsi.h now.

    Signed-off-by: Michael Schmitz
    Signed-off-by: Finn Thain
    Acked-by: Sam Creasey
    Cc: Geert Uytterhoeven
    Cc: James E.J. Bottomley
    Cc: linux-scsi@vger.kernel.org
    Signed-off-by: Christoph Hellwig

    Michael Schmitz
     

05 May, 2013

1 commit


29 Mar, 2012

1 commit


30 Jun, 2011

3 commits

  • This fixes a.o.:

    drivers/scsi/sun3_scsi.h:225:5: warning: "NDEBUG" is not defined
    drivers/scsi/sun3_scsi.h:345:14: warning: "NDEBUG_ABORT" is not defined
    drivers/scsi/sun3_scsi.h:351:14: warning: "NDEBUG_TAGS" is not defined
    drivers/scsi/sun3_scsi.h:357:14: warning: "NDEBUG_MERGING" is not defined

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: James Bottomley

    Geert Uytterhoeven
     
  • and call it from sun3scsi_release(), cfr. the other NCR5380 drivers.

    This fixes:

    drivers/scsi/NCR5380.h:303: warning: ‘NCR5380_exit’ declared ‘static’ but never defined

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: James Bottomley

    Geert Uytterhoeven
     
  • WARNING: vmlinux.o(.text+0x18545c): Section mismatch in reference from the function sun3scsi_detect() to the function .init.text:NCR5380_print_options()
    WARNING: vmlinux.o(.text+0x18556c): Section mismatch in reference from the function sun3scsi_detect() to the function .init.text:NCR5380_print_options()
    WARNING: vmlinux.o(.text+0x187692): Section mismatch in reference from the function sun3scsi_detect() to the function .init.text:NCR5380_print_options()
    WARNING: vmlinux.o(.text+0x187770): Section mismatch in reference from the function sun3scsi_detect() to the function .init.text:NCR5380_print_options()

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: James Bottomley

    Geert Uytterhoeven
     

08 Aug, 2010

1 commit