16 Apr, 2016

1 commit

  • Rename SCSI_MAX_SG_SEGMENTS to SG_CHUNK_SIZE, which means the amount
    we fit into a single scatterlist chunk.

    Rename SCSI_MAX_SG_CHAIN_SEGMENTS to SG_MAX_SEGMENTS.

    Will move these 2 generic definitions to scatterlist.h later.

    Reviewed-by: Christoph Hellwig
    Acked-by: Bart Van Assche (for ib_srp changes)
    Signed-off-by: Ming Lin
    Acked-by: Tejun Heo
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Martin K. Petersen

    Ming Lin
     

12 Apr, 2016

6 commits

  • 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
     
  • Adopt the DMA implementation from atari_NCR5380.c. This means that
    atari_scsi and sun3_scsi can make use of the NCR5380.c core driver
    and the atari_NCR5380.c driver fork can be made redundant.

    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
     
  • Standardize the DMA setup hooks so that the DMA implementation in
    atari_NCR5380.c can be reconciled with pseudo DMA implementation in
    NCR5380.c.

    Calls to NCR5380_dma_recv_setup() and NCR5380_dma_send_setup() return
    a negative value on failure, zero on PDMA transfer success and a positive
    byte count for DMA setup success.

    This convention is not entirely new, but is now applied consistently.

    Also remove a pointless Status Register access: the *phase assignment is
    redundant because after NCR5380_transfer_dma() returns control to
    NCR5380_information_transfer(), that routine then returns control
    to NCR5380_main(), which means *phase is dead.

    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
     
  • Those wrapper drivers which use DMA define the REAL_DMA macro and
    those which use pseudo DMA define PSEUDO_DMA. These macros need to be
    removed for a number of reasons, not least of which is to have drivers
    share more code.

    Redefine the PDMA send and receive hooks as DMA setup hooks, so that the
    DMA code can be shared by all 5380 wrapper drivers. This will help to
    reunify the forked core driver.

    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
     
  • For those wrapper drivers which only implement Programmed IO, have
    NCR5380_dma_xfer_len() evaluate to zero. That allows PDMA to be easily
    disabled at run-time and so the PSEUDO_DMA macro is no longer needed.

    Also remove the spin counters used for debugging pseudo DMA drivers.

    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
     
  • The only chip that needs the workarounds enabled is an early NMOS
    device. That means that the common case is to disable them.

    Unfortunately the sense of the flag is such that it has to be set
    for the common case.

    Rename the flag so that zero can be used to mean "no errata workarounds
    needed". This simplifies the code.

    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
     

24 Feb, 2016

2 commits

  • We get a warning for the fas216 driver when it is compiled as a loadable
    module, as the __setup() functions are never called then:

    scsi/arm/fas216.c:101:19: warning: 'fas216_log_setup' defined but not used [-Wunused-function]
    static int __init fas216_log_setup(char *str)

    This adds an #ifndef MODULE around the definition to shut up the warning
    and clarify for the reader when it is used or not.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Martin K. Petersen

    Arnd Bergmann
     
  • The calc_sync_xfer function is only used if CONFIG_SCSI_ACORNSCSI_SYNC
    is set, otherwise we get a compiler warning:

    scsi/arm/acornscsi.c:680:15: warning: 'calc_sync_xfer' defined but not used [-Wunused-function]
    unsigned char calc_sync_xfer(unsigned int period, unsigned int offset)

    This marks the function as __maybe_unused to shut up the warning and
    silently drop the function in the object code when there is no caller.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Martin K. Petersen

    Arnd Bergmann
     

07 Jan, 2016

9 commits

  • Because of the rudimentary design of the chip, it is necessary to poll the
    SCSI bus signals during PIO and this tends to hog the CPU. The driver will
    accept new commands while others execute, and this causes a soft lockup
    because the workqueue item will not terminate until the issue queue is
    emptied.

    When exercising dmx3191d using sequential IO from dd, the driver is sent
    512 KiB WRITE commands and 128 KiB READs. For a PIO transfer, the rate is
    is only about 300 KiB/s, so these are long-running commands. And although
    PDMA may run at several MiB/s, interrupts are disabled for the duration
    of the transfer.

    Fix the unresponsiveness and soft lockup issues by calling cond_resched()
    after each command is completed and by limiting max_sectors for drivers
    that don't implement real DMA.

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

    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: 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
     
  • 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 pointless release_region() calls in dtc.c,
    pas16.c and t128.c.

    Fix these issues.

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

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

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

    Finn Thain
     

01 Jun, 2015

1 commit


03 Feb, 2015

1 commit


20 Nov, 2014

7 commits

  • 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
     
  • Static variables from dtc.c and pas16.c should not appear in the core
    NCR5380.c driver. Aside from being a layering issue this worsens the
    divergence between the three core driver variants (atari_NCR5380.c and
    sun3_NCR5380.c don't support PSEUDO_DMA) and it can mean multiple hosts
    share the same counters.

    Fix this by making the pseudo DMA spin counters in the core more generic.
    This also avoids the abuse of the {DTC,PAS16}_PUBLIC_RELEASE macros, so
    they can be removed.

    oak.c doesn't use PDMA and hence it doesn't use the counters and hence it
    needs no write_info() method. Remove it.

    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
     
  • 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
     
  • 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
     

12 Nov, 2014

5 commits

  • Calling scsi_print_command should not be necessary during abort;
    if the information is required one should enable scsi logging.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Robert Elliott
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     
  • print_opcode_name() was only ever called with a '0' argument
    from LLDDs and ULDs which were _not_ supporting variable length
    CDBs, so the 'if' clause was never triggered.
    Instead we should be using the last argument to specify
    the cdb length to avoid accidental overflow when reading
    the cdb buffer.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Robert Elliott
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     
  • Update logging messages to use dev_printk() variants for correct
    device annotations.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Robert Elliott
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     
  • fas216 returns DID_BAD_TARGET for an incomplete data
    transfer. The midlayer uses DID_BAD_TARGET to signal
    a non-existing or not reachable target. So we should
    rather be using DID_ERROR here.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Robert Elliott
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     
  • Update acornscsi to use scsi_print_command() instead of the
    underscore version and use scmd_printk() in acornscsi_done().
    This will add correct device annotations in the resulting message.
    And we should be using set_host_byte() for setting the
    final result.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Robert Elliott
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     

18 Jul, 2014

1 commit

  • The SCSI standard defines 64-bit values for LUNs, and large arrays
    employing large or hierarchical LUN numbers become more and more
    common.

    So update the linux SCSI stack to use 64-bit LUN numbers.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Ewan Milne
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     

29 May, 2014

1 commit

  • The acornscsi driver was added in v2.1.88. It has always #undef-ed
    CONFIG_SCSI_ACORNSCSI_LINK near the top of acornscsi.c. And, just to be
    sure, it has also always triggered a preprocessor error if
    CONFIG_SCSI_ACORNSCSI_LINK was still defined. But, as far as I can see,
    it has never even been possible to set SCSI_ACORNSCSI_LINK through
    kconfig, or its predecessors, in the first place.

    Let's remove the code involved.

    Signed-off-by: Paul Bolle
    Acked-by: Russell King
    Acked-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Paul Bolle
     

28 May, 2014

1 commit


20 Mar, 2014

1 commit


10 Apr, 2013

3 commits


22 Jan, 2013

1 commit

  • The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
    while now and is almost always enabled by default. As agreed during the
    Linux kernel summit, remove it from any "depends on" lines in Kconfigs.

    CC: Russell King
    CC: "James E.J. Bottomley"
    Signed-off-by: Kees Cook
    Signed-off-by: Greg Kroah-Hartman

    Kees Cook