1. 08 6月, 2010 1 次提交
  2. 18 5月, 2010 1 次提交
    • 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. 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
  4. 03 12月, 2009 1 次提交
  5. 02 9月, 2009 1 次提交
    • R
      sata_sil24: always set protocol override for non-ATAPI data commands · 4f1a0ee1
      Robert Hancock 提交于
      The sil24 hardware has a built-in list of commands and associated protocols
      that gets used by default to decide how to handle a given command. However,
      if the command is not known to the controller then it presumably assumes it to
      be a non-data command which then causes protocol mismatch errors if the device
      ends up requesting data transfer. The new DATA SET MANAGEMENT - Trim command
      causes this issue since it's a DMA data-out command.
      
      Since we should always know best what protocol the command should be using,
      let's just set the override flag to inform the controller what protocol to use
      for all non-ATAPI commands with data transfer.
      Signed-off-by: NRobert Hancock <hancockrwd@gmail.com>
      Tested-by: NMark Lord <liml@rtr.ca>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      4f1a0ee1
  6. 07 4月, 2009 2 次提交
  7. 25 3月, 2009 1 次提交
  8. 09 1月, 2009 1 次提交
  9. 28 10月, 2008 1 次提交
    • T
      sata_sil24: configure max read request size to 4k · e8b3b5e9
      Tejun Heo 提交于
      Due to request posting limitations, bandwidth of sil3132 is limited to
      around 120MB/s with the minimum pci-e payload size (128bytes) which is
      used by most consumer systems.  However, write throughput can be
      slightly (~3%) increased by increasing the max read requeset size.
      Configure it to 4k which is the maximum supported.  This optimization
      is also done by SIMG's windows driver.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      e8b3b5e9
  10. 29 9月, 2008 1 次提交
    • T
      libata: make SCR access ops per-link · 82ef04fb
      Tejun Heo 提交于
      Logically, SCR access ops should take @link; however, there was no
      compelling reason to convert all SCR access ops when adding @link
      abstraction as there's one-to-one mapping between a port and a non-PMP
      link.  However, that assumption won't hold anymore with the scheduled
      addition of slave link.
      
      Make SCR access ops per-link.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      82ef04fb
  11. 04 7月, 2008 1 次提交
  12. 20 5月, 2008 1 次提交
    • T
      sata_sil24: don't use NCQ if marvell 4140 PMP is attached · 906c1ff4
      Tejun Heo 提交于
      When 4140 PMP is attached to sil24, NCQ commands to fan out port 1 and
      2 (0 based) often stall if commands are in progress to other ports.
      I've tried a number of things but can't tell what's going on.  It
      never happens w/ ahci and reportedly sata_mv which can issue NCQ
      commands to multiple devices simultaneously like sil24 does.
      
      Disable NCQ for devices behind 4140 PMP for the time being.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Mark Lord <liml@rtr.ca>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      906c1ff4
  13. 18 4月, 2008 15 次提交
    • T
      libata: move link onlineness check out of softreset methods · 45db2f6c
      Tejun Heo 提交于
      Currently, SATA softresets should do link onlineness check before
      actually performing SRST protocol but it doesn't really belong to
      softreset.
      
      This patch moves onlineness check in softreset to ata_eh_reset() and
      ata_eh_followup_srst_needed() to clean up code and help future sata_mv
      changes which need clear separation between SCR and TF accesses.
      
      sata_fsl is peculiar in that its softreset really isn't softreset but
      combination of hardreset and softreset.  This patch adds dummy private
      ->prereset to keep the current behavior but the driver really should
      implement separate hard and soft resets and return -EAGAIN from
      hardreset if it should be follwed by softreset.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      45db2f6c
    • T
      libata: kill dead code paths in reset path · 2a0c15ca
      Tejun Heo 提交于
      Some code paths which had been made obsolete by recent reset
      simplification were still around.  Kill them.
      
      * ata_eh_reset() checked for ATA_DEV_UNKNOWN to determine
        classification failure.  This is no longer applicable.
      
      * ata_do_reset() should convert ATA_DEV_UNKNOWN to ATA_DEV_NONE
        regardless of reset result (e.g. -EAGAIN).
      
      * LLDs don't need to convert ATA_DEV_UNKNOWN to ATA_DEV_NONE.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      2a0c15ca
    • T
      libata: implement PMP helpers · 071f44b1
      Tejun Heo 提交于
      Implement helpers to test whether PMP is supported, attached and
      determine pmp number to use when issuing SRST to a link.  While at it,
      move ata_is_host_link() so that it's together with the two new PMP
      helpers.
      
      This change simplifies LLDs and helps making PMP support optional.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      071f44b1
    • T
      libata: don't use ap->ioaddr in non-SFF drivers · 350756f6
      Tejun Heo 提交于
      ap->ioaddr is to carry addresses for TF and BMDMA registers of a SFF
      controller, don't abuse it in non-SFF controllers.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      350756f6
    • T
      libata: remove check_status from non-SFF drivers · 520d06f9
      Tejun Heo 提交于
      Now that all SFF stuff is separated out of core layer, core layer
      doesn't call ops->[alt_]check_status().  In fact, no one calls them
      for non-SFF drivers anymore.  Kill them.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      520d06f9
    • T
      libata: replace tf_read with qc_fill_rtf for non-SFF drivers · 4c9bf4e7
      Tejun Heo 提交于
      Now that all SFF stuff is separated out of core layer, core layer
      doesn't call ops->tf_read directly.  It gets called only via
      ops->qc_fill_rtf() for non-SFF drivers.  This patch directly
      implements private ops->qc_fill_rtf() for non-SFF controllers and kill
      ops->tf_read().
      
      This is much cleaner for non-SFF controllers as some of them have to
      cache SFF register values in private data structure and report the
      cached values via ops->tf_read().  Also, ops->tf_read() gets nasty for
      controllers which don't have clear notion of TF registers when
      operation is not in progress.
      
      As this change makes default ops->qc_fill_rtf unnecessary, move
      ata_sff_qc_fill_rtf() form ata_base_port_ops to ata_sff_port_ops where
      it belongs.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      4c9bf4e7
    • T
      libata: drop @finish_qc from ata_qc_complete_multiple() · 79f97dad
      Tejun Heo 提交于
      ata_qc_complete_multiple() took @finish_qc and called it on every qc
      before completing it.  This was to give opportunity to update TF cache
      before ata_qc_complete() tries to fill result_tf.  Now that result TF
      is a separate operation, this is no longer necessary.
      
      Update sata_sil24, which was the only user of this mechanism, such
      that it implements its own ops->qc_fill_rtf() and drop @finish_qc from
      ata_qc_complete_multiple().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      79f97dad
    • T
      libata: move PMP SCR access failure during reset to ata_eh_reset() · 5958e302
      Tejun Heo 提交于
      If PMP fan-out reset fails and SCR isn't accessible, PMP should be
      reset.  This used to be tested by sata_pmp_std_hardreset() and
      communicated to EH by -ERESTART.  However, this logic is generic and
      doesn't really have much to do with specific hardreset implementation.
      
      This patch moves SCR access failure detection logic to ata_eh_reset()
      where it belongs.  As this makes sata_pmp_std_hardreset() identical to
      sata_std_hardreset(), the function is killed and replaced with the
      standard method.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      5958e302
    • T
      libata: rename SFF port ops · 5682ed33
      Tejun Heo 提交于
      Add sff_ prefix to SFF specific port ops.
      
      This rename is in preparation of separating SFF support out of libata
      core layer.  This patch strictly renames ops and doesn't introduce any
      behavior difference.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      5682ed33
    • T
      libata: make reset related methods proper port operations · a1efdaba
      Tejun Heo 提交于
      Currently reset methods are not specified directly in the
      ata_port_operations table.  If a LLD wants to use custom reset
      methods, it should construct and use a error_handler which uses those
      reset methods.  It's done this way for two reasons.
      
      First, the ops table already contained too many methods and adding
      four more of them would noticeably increase the amount of necessary
      boilerplate code all over low level drivers.
      
      Second, as ->error_handler uses those reset methods, it can get
      confusing.  ie. By overriding ->error_handler, those reset ops can be
      made useless making layering a bit hazy.
      
      Now that ops table uses inheritance, the first problem doesn't exist
      anymore.  The second isn't completely solved but is relieved by
      providing default values - most drivers can just override what it has
      implemented and don't have to concern itself about higher level
      callbacks.  In fact, there currently is no driver which actually
      modifies error handling behavior.  Drivers which override
      ->error_handler just wraps the standard error handler only to prepare
      the controller for EH.  I don't think making ops layering strict has
      any noticeable benefit.
      
      This patch makes ->prereset, ->softreset, ->hardreset, ->postreset and
      their PMP counterparts propoer ops.  Default ops are provided in the
      base ops tables and drivers are converted to override individual reset
      methods instead of creating custom error_handler.
      
      * ata_std_error_handler() doesn't use sata_std_hardreset() if SCRs
        aren't accessible.  sata_promise doesn't need to use separate
        error_handlers for PATA and SATA anymore.
      
      * softreset is broken for sata_inic162x and sata_sx4.  As libata now
        always prefers hardreset, this doesn't really matter but the ops are
        forced to NULL using ATA_OP_NULL for documentation purpose.
      
      * pata_hpt374 needs to use different prereset for the first and second
        PCI functions.  This used to be done by branching from
        hpt374_error_handler().  The proper way to do this is to use
        separate ops and port_info tables for each function.  Converted.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      a1efdaba
    • T
      libata: implement and use ops inheritance · 029cfd6b
      Tejun Heo 提交于
      libata lets low level drivers build ata_port_operations table and
      register it with libata core layer.  This allows low level drivers
      high level of flexibility but also burdens them with lots of
      boilerplate entries.
      
      This becomes worse for drivers which support related similar
      controllers which differ slightly.  They share most of the operations
      except for a few.  However, the driver still needs to list all
      operations for each variant.  This results in large number of
      duplicate entries, which is not only inefficient but also error-prone
      as it becomes very difficult to tell what the actual differences are.
      
      This duplicate boilerplates all over the low level drivers also make
      updating the core layer exteremely difficult and error-prone.  When
      compounded with multi-branched development model, it ends up
      accumulating inconsistencies over time.  Some of those inconsistencies
      cause immediate problems and fixed.  Others just remain there dormant
      making maintenance increasingly difficult.
      
      To rectify the problem, this patch implements ata_port_operations
      inheritance.  To allow LLDs to easily re-use their own ops tables
      overriding only specific methods, this patch implements poor man's
      class inheritance.  An ops table has ->inherits field which can be set
      to any ops table as long as it doesn't create a loop.  When the host
      is started, the inheritance chain is followed and any operation which
      isn't specified is taken from the nearest ancestor which has it
      specified.  This operation is called finalization and done only once
      per an ops table and the LLD doesn't have to do anything special about
      it other than making the ops table non-const such that libata can
      update it.
      
      libata provides four base ops tables lower drivers can inherit from -
      base, sata, pmp, sff and bmdma.  To avoid overriding these ops
      accidentaly, these ops are declared const and LLDs should always
      inherit these instead of using them directly.
      
      After finalization, all the ops table are identical before and after
      the patch except for setting .irq_handler to ata_interrupt in drivers
      which didn't use to.  The .irq_handler doesn't have any actual effect
      and the field will soon be removed by later patch.
      
      * sata_sx4 is still using old style EH and currently doesn't take
        advantage of ops inheritance.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      029cfd6b
    • T
      libata: implement and use SHT initializers · 68d1d07b
      Tejun Heo 提交于
      libata lets low level drivers build scsi_host_template and register it
      to the SCSI layer.  This allows low level drivers high level of
      flexibility but also burdens them with lots of boilerplate entries.
      
      This patch implements SHT initializers which can be used to initialize
      all the boilerplate entries in a sht.  Three variants of them are
      implemented - BASE, BMDMA and NCQ - for different types of drivers.
      Note that entries can be overriden by putting individual initializers
      after the helper macro.
      
      All sht tables are identical before and after this patch.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      68d1d07b
    • T
      libata: implement and use ata_noop_irq_clear() · 358f9a77
      Tejun Heo 提交于
      ->irq_clear() is used to clear IRQ bit of a SFF controller and isn't
      useful for drivers which don't use libata SFF HSM implementation.
      However, it's a required callback and many drivers implement their own
      noop version as placeholder.  This patch implements ata_noop_irq_clear
      and use it to replace those custom placeholders.
      
      Also, SFF drivers which don't support BMDMA don't need to use
      ata_bmdma_irq_clear().  It becomes noop if BMDMA address isn't
      initialized.  Convert them to use ata_noop_irq_clear().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      358f9a77
    • T
      libata: kill ATA_LFLAG_SKIP_D2H_BSY · 8cebf274
      Tejun Heo 提交于
      Some controllers can't reliably record the initial D2H FIS after SATA
      link is brought online for whatever reason.  Advanced controllers
      which don't have traditional TF register based interface often have
      this problem as they don't really have the TF registers to update
      while the controller and link are being initialized.
      
      SKIP_D2H_BSY works around the problem by skipping the wait for device
      readiness before issuing SRST, so for such controllers libata issues
      SRST blindly and hopes for the best.
      
      Now that libata defaults to hardreset, this workaround is no longer
      necessary.  For controllers which have support for hardreset, SRST is
      never issued by itself.  It is only issued as follow-up SRST for
      device classification and PMP initialization, so there's no need to
      wait for it from prereset.
      
      Kill ATA_LFLAG_SKIP_D2H_BSY.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      8cebf274
    • T
      libata: prefer hardreset · cf480626
      Tejun Heo 提交于
      When both soft and hard resets are available, libata preferred
      softreset till now.  The logic behind it was to be softer to devices;
      however, this doesn't really help much.  Rationales for the change:
      
      * BIOS may freeze lock certain things during boot and softreset can't
        unlock those.  This by itself is okay but during operation PHY event
        or other error conditions can trigger hardreset and the device may
        end up with different configuration.
      
        For example, after a hardreset, previously unlockable HPA can be
        unlocked resulting in different device size and thus revalidation
        failure.  Similar condition can occur during or after resume.
      
      * Certain ATAPI devices require hardreset to recover after certain
        error conditions.  On PATA, this is done by issuing the DEVICE RESET
        command.  On SATA, COMRESET has equivalent effect.  The problem is
        that DEVICE RESET needs its own execution protocol.
      
        For SFF controllers with bare TF access, it can be easily
        implemented but more advanced controllers (e.g. ahci and sata_sil24)
        require specialized implementations.  Simply using hardreset solves
        the problem nicely.
      
      * COMRESET initialization sequence is the norm in SATA land and many
        SATA devices don't work properly if only SRST is used.  For example,
        some PMPs behave this way and libata works around by always issuing
        hardreset if the host supports PMP.
      
        Like the above example, libata has developed a number of mechanisms
        aiming to promote softreset to hardreset if softreset is not going
        to work.  This approach is time consuming and error prone.
      
        Also, note that, dependingon how you read the specs, it could be
        argued that PMP fan-out ports require COMRESET to start operation.
        In fact, all the PMPs on the market except one don't work properly
        if COMRESET is not issued to fan-out ports after PMP reset.
      
      * COMRESET is an integral part of SATA connection and any working
        device should be able to handle COMRESET properly.  After all, it's
        the way to signal hardreset during reboot.  This is the most used
        and recommended (at least by the ahci spec) method of resetting
        devices.
      
      So, this patch makes libata prefer hardreset over softreset by making
      the following changes.
      
      * Rename ATA_EH_RESET_MASK to ATA_EH_RESET and use it whereever
        ATA_EH_{SOFT|HARD}RESET used to be used.  ATA_EH_{SOFT|HARD}RESET is
        now only used to tell prereset whether soft or hard reset will be
        issued.
      
      * Strip out now unneeded promote-to-hardreset logics from
        ata_eh_reset(), ata_std_prereset(), sata_pmp_std_prereset() and
        other places.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      cf480626
  14. 19 2月, 2008 1 次提交
    • J
      libata: eliminate the home grown dma padding in favour of · dde20207
      James Bottomley 提交于
      that provided by the block layer
      
      ATA requires that all DMA transfers begin and end on word boundaries.
      Because of this, a large amount of machinery grew up in ide to adjust
      scatterlists on this basis.  However, as of 2.5, the block layer has a
      dma_alignment variable which ensures both the beginning and length of a
      DMA transfer are aligned on the dma_alignment boundary.  Although the
      block layer does adjust the beginning of the transfer to ensure this
      happens, it doesn't actually adjust the length, it merely makes sure
      that space is allocated for transfers beyond the declared length.  The
      upshot of this is that scatterlists may be padded to any size between
      the actual length and the length adjusted to the dma_alignment safely
      knowing that memory is allocated in this region.
      
      Right at the moment, SCSI takes the default dma_aligment which is on a
      512 byte boundary.  Note that this aligment only applies to transfers
      coming in from user space.  However, since all kernel allocations are
      automatically aligned on a minimum of 32 byte boundaries, it is safe to
      adjust them in this manner as well.
      
      tj: * Adjusting sg after padding is done in block layer.  Make libata
            set queue alignment correctly for ATAPI devices and drop broken
            sg mangling from ata_sg_setup().
          * Use request->raw_data_len for ATAPI transfer chunk size.
          * Killed qc->raw_nbytes.
          * Separated out killing qc->n_iter.
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      dde20207
  15. 23 1月, 2008 2 次提交
    • T
      libata: convert to chained sg · ff2aeb1e
      Tejun Heo 提交于
      libata used private sg iterator to handle padding sg.  Now that sg can
      be chained, padding can be handled using standard sg ops.  Convert to
      chained sg.
      
      * s/qc->__sg/qc->sg/
      
      * s/qc->pad_sgent/qc->extra_sg[]/.  Because chaining consumes one sg
        entry.  There need to be two extra sg entries.  The renaming is also
        for future addition of other extra sg entries.
      
      * Padding setup is moved into ata_sg_setup_extra() which is organized
        in a way that future addition of other extra sg entries is easy.
      
      * qc->orig_n_elem is unused and removed.
      
      * qc->n_elem now contains the number of sg entries that LLDs should
        map.  qc->mapped_n_elem is added to carry the original number of
        mapped sgs for unmapping.
      
      * The last sg of the original sg list is used to chain to extra sg
        list.  The original last sg is pointed to by qc->last_sg and the
        content is stored in qc->saved_last_sg.  It's restored during
        ata_sg_clean().
      
      * All sg walking code has been updated.  Unnecessary assertions and
        checks for conditions the core layer already guarantees are removed.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      ff2aeb1e
    • T
      libata: implement protocol tests · 405e66b3
      Tejun Heo 提交于
      Implement protocol tests - ata_is_atapi(), ata_is_nodata(),
      ata_is_pio(), ata_is_dma(), ata_is_ncq() and ata_is_data() and use
      them to replace is_atapi_taskfile() and hard coded protocol tests.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      405e66b3
  16. 15 1月, 2008 2 次提交
    • T
      sata_sil24: freeze on non-dev errors reported via CERR · c2e14f11
      Tejun Heo 提交于
      CERR reports errors detected during executing a command.  This doesn't
      mean the error is tied to the command and can be recovered by just
      issuing it again.  Many of the errors are fatal port-wide connditions
      including HSM violation, host bus error and ATA bus error and require
      freezing and port reset.
      
      The freezing part wasn't implemented previously.  This used to be okay
      because port resets were scheduled anyway and EH eventually resets and
      recovers the port.  With PMP support added, this is no longer true.
      The error condition and recover actions are attributed to the fan-out
      port and the host port condition isn't properly recovered leading to
      EH failures.
      
      This patch makes CERR errors which require resets to freeze the port.
      This will force host port reset and proper recovery.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Andrew Ryder <tireman@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      c2e14f11
    • T
      sata_sil24: fix stupid typo · 7293fa8f
      Tejun Heo 提交于
      Fix stupid typo.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      7293fa8f
  17. 11 1月, 2008 1 次提交
  18. 24 11月, 2007 1 次提交
    • T
      sata_sil24: fix sg table sizing · 93e2618e
      Tejun Heo 提交于
      sil24 unnecessarily used LIBATA_MAX_PRD and ATAPI sg table was short
      by one entry which might cause very obscure problems.  This patch
      updates sg table sizing such that
      
      * One full page is used for PRB + sg table.  On 4k page,
        this results in 253 sg's.
      
      * Make ATAPI sg block properly sized.
      
      * Make build fail if command block size doesn't equal PAGE_SIZE.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      93e2618e
  19. 30 10月, 2007 1 次提交
    • T
      libata: stop being overjealous about non-IO commands · f90f0828
      Tejun Heo 提交于
      libata EH always revalidated device and retried failed command after
      error except for ATAPI CCs.  This is unnecessary and hinders with
      users issuing direct commands.  This patch makes the following
      changes.
      
      * Make sata_sil24 not request ATA_EH_REVALIDATE on device errors.
        sil24 is the only driver which does this.  All others let libata EH
        core code decide.
      
      * Don't request revalidation after device error of non-IO command.
        Revalidation doesn't really help anybody.  As ATA_EH_REVALIDATE
        isn't set by default, there's no reason to clear it after sense data
        is read.  Kill ATA_EH_REVALIDATE clearing code while at it.
      
      * Don't retry non-IO command after device error.  Device has rejected
        the command.  There's no point in retrying.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f90f0828
  20. 29 10月, 2007 1 次提交
  21. 19 10月, 2007 1 次提交
    • J
      [libata] kill ata_sg_is_last() · 3be6cbd7
      Jeff Garzik 提交于
      Short term, this works around a bug introduced by early sg-chaining
      work.
      
      Long term, removing this function eliminates a branch from a hot
      path loop in each scatter/gather table build.  Also, as this code
      demonstrates, we don't need to _track_ the end of the s/g list, as
      long as we mark it in some way.  And doing so programatically is nice.
      So its a useful cleanup, regardless of its short term effects.
      
      Based conceptually on a quick patch by Jens Axboe.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3be6cbd7
  22. 13 10月, 2007 2 次提交
    • T
      libata: use ata_exec_internal() for PMP register access · b06ce3e5
      Tejun Heo 提交于
      PMP registers used to be accessed with dedicated accessors ->pmp_read
      and ->pmp_write.  During reset, those callbacks are called with the
      port frozen so they should be able to run without depending on
      interrupt delivery.  To achieve this, they were implemented polling.
      
      However, as resetting the host port makes the PMP to isolate fan-out
      ports until SError.X is cleared, resetting fan-out ports while port is
      frozen doesn't buy much additional safety.
      
      This patch updates libata PMP support such that PMP registers are
      accessed using regular ata_exec_internal() mechanism and kills
      ->pmp_read/write() callbacks.  The following changes are made.
      
      * PMP access helpers - sata_pmp_read_init_tf(), sata_pmp_read_val(),
        sata_pmp_write_init_tf() are folded into sata_pmp_read/write() which
        are now standalone PMP register access functions.
      
      * sata_pmp_read/write() returns err_mask instead of rc.  This is
        consistent with other functions which issue internal commands and
        allows more detailed error reporting.
      
      * ahci interrupt handler is modified to ignore BAD_PMP and
        spurious/illegal completion IRQs while reset is in progress.  These
        conditions are expected during reset.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      b06ce3e5
    • T
      sata_sil24: implement PORT_RST · 23818034
      Tejun Heo 提交于
      As DEV_RST (hardreset) sometimes fail to recover the controller
      (especially after PMP DMA CS errata).  In such cases, perform PORT_RST
      prior to DEV_RST.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      23818034