1. 20 5月, 2010 5 次提交
    • T
      libata-sff: port_task is SFF specific · c429137a
      Tejun Heo 提交于
      port_task is tightly bound to the standard SFF PIO HSM implementation.
      Using it for any other purpose would be error-prone and there's no
      such user and if some drivers need such feature, it would be much
      better off using its own.  Move it inside CONFIG_ATA_SFF and rename it
      to sff_pio_task.
      
      The only function which is exposed to the core layer is
      ata_sff_flush_pio_task() which is renamed from ata_port_flush_task()
      and now also takes care of resetting hsm_task_state to HSM_ST_IDLE,
      which is possible as it's now specific to PIO HSM.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c429137a
    • T
      libata-sff: ap->[last_]ctl are SFF specific · 5fe7454a
      Tejun Heo 提交于
      ap->[last_]ctl are specific to SFF controllers.  Put them inside
      CONFIG_ATA_SFF and move initialization into ata_sff_port_init().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      5fe7454a
    • T
      libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo() · 8244cd05
      Tejun Heo 提交于
      ->drain_fifo() is SFF specific.  Rename and relocate it.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      8244cd05
    • T
      libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init() · 270390e1
      Tejun Heo 提交于
      In preparation of proper SFF/BMDMA separation, introduce
      ata_sff_init/exit() and ata_sff_port_init().  These functions
      currently don't do anything.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      270390e1
    • T
      libata-sff: clean up BMDMA initialization · c7087652
      Tejun Heo 提交于
      When BMDMA initialization failed or BMDMA was not available for
      whatever reason, bmdma_addr was left at zero and used as an indication
      that BMDMA shouldn't be used.  This leads to the following problems.
      
      p1. For BMDMA drivers which don't use traditional BMDMA register,
          ata_bmdma_mode_filter() incorrectly inhibits DMA modes.  Those
          drivers either have to inherit from ata_sff_port_ops or clear
          ->mode_filter explicitly.
      
      p2. non-BMDMA drivers call into BMDMA PRD table allocation.  It
          doesn't actually allocate PRD table if bmdma_addr is not
          initialized but is still confusing.
      
      p3. For BMDMA drivers which don't use traditional BMDMA register, some
          methods might not be invoked as expected (e.g. bmdma_stop from
          ata_sff_post_internal_cmd()).
      
      p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
          worrying libata core might call into one of them.
      
      These problems are caused by the muddy line between SFF and BMDMA and
      the assumption that all BMDMA controllers initialize bmdma_addr.
      
      This patch fixes p1 and p2 by removing the bmdma_addr assumption and
      moving prd allocation to BMDMA port start.  Later patches will fix the
      remaining issues.
      
      This patch improves BMDMA initialization such that
      
      * When BMDMA register initialization fails, falls back to PIO instead
        of failing.  ata_pci_bmdma_init() never fails now.
      
      * When ata_pci_bmdma_init() falls back to PIO, it clears
        ap->mwdma_mask and udma_mask instead of depending on
        ata_bmdma_mode_filter().  This makes ata_bmdma_mode_filter()
        unnecessary thus resolving p1.
      
      * ata_port_start() which actually is BMDMA specific is moved to
        ata_bmdma_port_start().  ata_port_start() and ata_sff_port_start()
        are killed.
      
      * ata_sff_port_start32() is moved and renamed to
        ata_bmdma_port_start32().
      
      Drivers which no longer call into PRD table allocation are...
      
        pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all
        drivers which inherit from ata_sff_port_ops.
      
      pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD
      but is a BMDMA controller and doesn't have custom port_start like
      other such controllers.
      
      Note that with the previous patch which makes all and only BMDMA
      drivers inherit from ata_bmdma_port_ops, this change doesn't break
      drivers which need PRD table.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c7087652
  2. 18 5月, 2010 2 次提交
    • T
      libata-sff: reorder SFF/BMDMA functions · 9f2f7210
      Tejun Heo 提交于
      Reorder functions such that SFF and BMDMA functions are grouped.
      While at it, s/BMDMA/SFF in a few comments where it actually meant
      SFF.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      9f2f7210
    • T
      libata: kill ATA_FLAG_DISABLED · 3e4ec344
      Tejun Heo 提交于
      ATA_FLAG_DISABLED is only used by drivers which don't use
      ->error_handler framework and is largely broken.  Its only meaningful
      function is to make irq handlers skip processing if the flag is set,
      which is largely useless and even harmful as it makes those ports more
      likely to cause IRQ storms.
      
      Kill ATA_FLAG_DISABLED and makes the callers disable attached devices
      instead.  ata_port_probe() and ata_port_disable() which manipulate the
      flag are also killed.
      
      This simplifies condition check in IRQ handlers.  While updating IRQ
      handlers, remove ap NULL check as libata guarantees consecutive port
      allocation (unoccupied ports are initialized with dummies) and
      long-obsolete ATA_QCFLAG_ACTIVE check (checked by ata_qc_from_tag()).
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3e4ec344
  3. 15 5月, 2010 7 次提交
  4. 06 4月, 2010 1 次提交
  5. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  6. 23 3月, 2010 1 次提交
    • T
      libata-sff: fix spurious IRQ handling · 332ac7ff
      Tejun Heo 提交于
      Commit 27943620 introduced spurious
      IRQ handling but it has a race condition where valid completion can be
      lost while trying to clear spurious IRQ leading to occassional command
      timeouts.
      
      This patch improves SFF interrupt handler such that
      
      1. Once BMDMA HSM is stopped, the condition is never considered
         spurious.  As there's no way to resume stopped BMDMA HSM, if device
         status doesn't agree with BMDMA status, the only way out is
         aborting the command (otherwise, it will just end up timing out).
      
      2. ap->ops->sff_check_status() can be safely called to clear spurious
         device IRQ as it atomically returns completion status but BMDMA IRQ
         status can't be cleared in safe way if command is in flight.  After
         a spurious IRQ, call ap->ops->sff_irq_clear() only if the
         respective device is idle and retry completion if
         sff_check_status() indicates command completion.
      
      Please note that ata_piix uses bmdma_status for sff_irq_check() and #2
      won't weaken spurious IRQ handling even with in-flight command because
      if bmdma_status indicates IRQ pending but device status is not on
      spurious check, the next IRQ handler invocation will abort the command
      due to #1.
      
      This fixes bko#15537.
      
         https://bugzilla.kernel.org/show_bug.cgi?id=15537Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Andrew Benton <b3nton@gmail.com>
      Cc: Petr Uzel <petr.uzel@centrum.cz>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      332ac7ff
  7. 02 3月, 2010 3 次提交
    • A
      libata: Pass host flags into the pci helper · 16ea0fc9
      Alan Cox 提交于
      This allows parallel scan and the like to be set without having to stop
      using the existing full helper functions. This patch merely adds the argument
      and fixes up the callers. It doesn't undo the special cases already in the
      tree or add any new parallel callers.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      16ea0fc9
    • T
      libata: implement spurious irq handling for SFF and apply it to piix · 27943620
      Tejun Heo 提交于
      Traditional IDE interface sucks in that it doesn't have a reliable IRQ
      pending bit, so if the controller raises IRQ while the driver is
      expecting it not to, the IRQ won't be cleared and eventually the IRQ
      line will be killed by interrupt subsystem.  Some controllers have
      non-standard mechanism to indicate IRQ pending so that this condition
      can be detected and worked around.
      
      This patch adds an optional operation ->sff_irq_check() which will be
      called for each port from the ata_sff_interrupt() if an unexpected
      interrupt is received.  If the operation returns %true,
      ->sff_check_status() and ->sff_irq_clear() will be cleared for the
      port.  Note that this doesn't mark the interrupt as handled so it
      won't prevent IRQ subsystem from killing the IRQ if this mechanism
      fails to clear the spurious IRQ.
      
      This patch also implements ->sff_irq_check() for ata_piix.  Note that
      this adds slight overhead to shared IRQ operation as IRQs which are
      destined for other controllers will trigger extra register accesses to
      check whether IDE interrupt is pending but this solves rare screaming
      IRQ cases and for some curious reason also helps weird BIOS related
      glitch on Samsung n130 as reported in bko#14314.
      
        http://bugzilla.kernel.org/show_bug.cgi?id=14314
      
      * piix_base_ops dropped as suggested by Sergei.
      
      * Spurious IRQ detection doesn't kick in anymore if polling qc is in
        progress.  This provides less protection but some controllers have
        possible data corruption issues if the wrong register is accessed
        while a command is in progress.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NJohannes Stezenbach <js@sig21.net>
      Reported-by: NHans Werner <hwerner4@gmx.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      27943620
    • T
      libata: cleanup ata_sff_interrupt() · d88ec2e5
      Tejun Heo 提交于
      host->ports[i] is never NULL if i < host->n_ports and non-NULL return
      from ata_qc_from_tag() guarantees that the returned qc is active.
      Drop unnecessary tests.
      
      Superflous () dropped as suggested by Sergei.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d88ec2e5
  8. 09 2月, 2010 1 次提交
  9. 04 2月, 2010 1 次提交
  10. 17 12月, 2009 1 次提交
  11. 09 12月, 2009 1 次提交
  12. 04 12月, 2009 1 次提交
  13. 03 12月, 2009 1 次提交
  14. 10 6月, 2009 1 次提交
    • S
      libata-sff: avoid byte swapping in ata_sff_data_xfer() · 2102d749
      Sergei Shtylyov 提交于
      Handling of the trailing byte in ata_sff_data_xfer() is suboptimal bacause:
      
      - it always initializes the padding buffer to 0 which is not really needed in
        both the read and write cases;
      
      - it has to use memcpy() to transfer a single byte from/to the padding buffer;
      
      - it uses io{read|write}16() accessors which swap bytes on the big endian CPUs
        and so have to additionally convert the data from/to the little endian format
        instead of using io{read|write}16_rep() accessors which are not supposed to
        change the byte ordering.
      Signed-off-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      2102d749
  15. 17 4月, 2009 1 次提交
    • A
      ata: Report 16/32bit PIO as best we can · e3cf95dd
      Alan Cox 提交于
      The legacy old IDE ioctl API for this is a bit primitive so we try
      and map stuff sensibly onto it.
      
      - Set PIO over DMA devices to report 32bit
      - Add ability to change the PIO32 settings if the controller permits it
      - Add that functionality into the sff drivers
      - Add that functionality into the VLB legacy driver
      - Turn on the 32bit PIO on the ninja32 and add support there
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      e3cf95dd
  16. 25 3月, 2009 2 次提交
  17. 14 3月, 2009 1 次提交
    • S
      libata: Keep shadow last_ctl up to date during resets · e3e4385f
      Stuart MENEFY 提交于
      libata keeps a shadow copy of the ATA CTL register (which is write only),
      and only writes to the hardware when the required value doesn't match
      the shadow. However this copy wasn't being maintained when performing
      reset functions. This could cause problems for the first operation after
      a reset when the correct value might not be written to the CTL register.
      
      This problem was observed when hotplugging a drive: the identify command
      was being issued with interrupts enabled, when they should have been
      disabled.
      Signed-off-by: NStuart Menefy <stuart.menefy@st.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      e3e4385f
  18. 17 2月, 2009 1 次提交
    • S
      libata-sff: fix 32-bit PIO ATAPI regression · d1b3525b
      Sergei Shtylyov 提交于
      Commit 871af121 (libata: Add 32bit
      PIO support) has caused all kinds of errors on the ATAPI devices, so
      it has been empirically proven that one shouldn't try to read/write
      an extra data word when a device is not expecting it already. "Don't
      do it then"; however, still use a chance to do 32-bit read/write one
      last time when there are exactly 3 trailing bytes.
      
      Oh, and stop pointlessly swapping the bytes to and fro on big-endian
      machines by using io*_rep() accessors which shouldn't byte-swap.
      
      This patch should fix the kernel.org bug #12609.
      Signed-off-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d1b3525b
  19. 26 1月, 2009 2 次提交
  20. 13 1月, 2009 1 次提交
  21. 10 1月, 2009 1 次提交
  22. 09 1月, 2009 2 次提交
  23. 15 11月, 2008 1 次提交
    • T
      libata: improve phantom device detection · 6a6b97d3
      Tejun Heo 提交于
      Currently libata uses four methods to detect device presence.
      
      1. PHY status if available.
      2. TF register R/W test (only promotes presence, never demotes)
      3. device signature after reset
      4. IDENTIFY failure detection in SFF state machine
      
      Combination of the above works well in most cases but recently there
      have been a few reports where a phantom device causes unnecessary
      delay during probe.  In both cases, PHY status wasn't available.  In
      one case, it passed #2 and #3 and failed IDENTIFY with ATA_ERR which
      didn't qualify as #4.  The other failed #2 but as it passed #3 and #4,
      it still caused failure.
      
      In both cases, phantom device reported diagnostic failure, so these
      cases can be safely worked around by considering any !ATA_DRQ IDENTIFY
      failure as NODEV_HINT if diagnostic failure is set.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6a6b97d3
  24. 23 10月, 2008 1 次提交