1. 06 5月, 2008 1 次提交
  2. 25 4月, 2008 1 次提交
    • M
      libata-eh set tf flags in NCQ EH result_tf · a6116c9e
      Mark Lord 提交于
      Fix mis-reporting of NCQ errors by ensuring that result_tf->flags
      is properly initialized in libata-eh.  This allows ata_gen_ata_sense()
      to report the failed block number correctly to SCSI after a media error
      during NCQ.
      
      This patch may also be a candidate for backporting to earlier kernels.
      Without this fix, SCSI will fail I/O on the entire request rather
      than just the bad sector.  That can be bad for a request that was
      merged from many independent read reads from different tasks.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      a6116c9e
  3. 18 4月, 2008 13 次提交
    • T
      libata: make EH fail gracefully if no reset method is available · 4f7faa3f
      Tejun Heo 提交于
      When no reset method is available, libata currently oopses.  Although
      the condition can't happen unless there's a bug in a low level driver,
      oopsing isn't the best way to report the error condition.  Complain,
      dump stack and fail reset instead.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      4f7faa3f
    • 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: unify mechanism to request follow-up SRST · 305d2a1a
      Tejun Heo 提交于
      Previously, there were two ways to trigger follow-up SRST from
      hardreset method - returning -EAGAIN and leaving all device classes
      unmodified.  Drivers never used the latter mechanism and the only use
      case for the former was when hardreset couldn't classify.
      
      Drop the latter mechanism and let -EAGAIN mean "perform follow-up SRST
      if classification is required".  This change removes unnecessary
      follow-up SRSTs and simplifies reset implementations.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      305d2a1a
    • 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: implement and use sata_std_hardreset() · 57c9efdf
      Tejun Heo 提交于
      Implement sata_std_hardreset(), which simply wraps around
      sata_link_hardreset().  sata_std_hardreset() becomes new standard
      hardreset method for sata_port_ops and sata_sff_hardreset() moves from
      ata_base_port_ops to ata_sff_port_ops, which is where it really
      belongs.
      
      ata_is_builtin_hardreset() is added so that both
      ata_std_error_handler() and ata_sff_error_handler() skip both builtin
      hardresets if SCR isn't accessible.
      
      piix_sidpr_hardreset() in ata_piix.c is identical to
      sata_std_hardreset() in functionality and got replaced with the
      standard function.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      57c9efdf
    • T
      libata: rename SFF functions · 9363c382
      Tejun Heo 提交于
      SFF functions have confusing names.  Some have sff prefix, some have
      bmdma, some std, some pci and some none.  Unify the naming by...
      
      * SFF functions which are common to both BMDMA and non-BMDMA are
        prefixed with ata_sff_.
      
      * SFF functions which are specific to BMDMA are prefixed with
        ata_bmdma_.
      
      * SFF functions which are specific to PCI but apply to both BMDMA and
        non-BMDMA are prefixed with ata_pci_sff_.
      
      * SFF functions which are specific to PCI and BMDMA are prefixed with
        ata_pci_bmdma_.
      
      * Drop generic prefixes from LLD specific routines.  For example,
        bfin_std_dev_select -> bfin_dev_select.
      
      The following renames are noteworthy.
      
        ata_qc_issue_prot() -> ata_sff_qc_issue()
        ata_pci_default_filter() -> ata_bmdma_mode_filter()
        ata_dev_try_classify() -> ata_sff_dev_classify()
      
      This rename is in preparation of separating SFF support out of libata
      core layer.  This patch strictly renames functions and doesn't
      introduce any behavior difference.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      9363c382
    • T
      libata: implement ATA_QCFLAG_RETRY · 03faab78
      Tejun Heo 提交于
      Currently whether a command should be retried after failure is
      determined inside ata_eh_finish().  Add ATA_QCFLAG_RETRY and move the
      logic into ata_eh_autopsy().  This makes things clearer and helps
      extending retry determination logic.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      03faab78
    • 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: kill ata_ehi_schedule_probe() · b558eddd
      Tejun Heo 提交于
      ata_ehi_schedule_probe() was created to hide details of link-resuming
      reset magic.  Now that all the softreset workarounds are gone,
      scheduling probe is very simple - set probe_mask and request RESET.
      Kill ata_ehi_schedule_probe() and open code it.  This also increases
      consistency as ata_ehi_schedule_probe() couldn't cover individual
      device probings so they were open-coded even when the helper existed.
      
      While at it, define ATA_ALL_DEVICES as mask of all possible devices on
      a link and always use it when requesting probe on link level for
      simplicity and consistency.  Setting extra bits in the probe_mask
      doesn't hurt anybody.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      b558eddd
    • T
      libata: kill ATA_EHI_RESUME_LINK · 672b2d65
      Tejun Heo 提交于
      ATA_EHI_RESUME_LINK has two functions - promote reset to hardreset if
      ATA_LFLAG_HRST_TO_RESUME is set and preventing EH from shortcutting
      reset action when probing is requested.  The former is gone now and
      the latter can easily be achieved by making EH to perform at least one
      reset if reset is requested, which also makes more sense than
      depending on RESUME_LINK flag.
      
      As ATA_EHI_RESUME_LINK was the only EHI reset modifier, this also
      kills reset modifier handling.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      672b2d65
    • 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
  4. 30 3月, 2008 1 次提交
  5. 11 3月, 2008 1 次提交
  6. 21 2月, 2008 1 次提交
    • T
      libata: implement libata.force module parameter · 33267325
      Tejun Heo 提交于
      This patch implements libata.force module parameter which can
      selectively override ATA port, link and device configurations
      including cable type, SATA PHY SPD limit, transfer mode and NCQ.
      
      For example, you can say "use 1.5Gbps for all fan-out ports attached
      to the second port but allow 3.0Gbps for the PMP device itself, oh,
      the device attached to the third fan-out port chokes on NCQ and
      shouldn't go over UDMA4" by the following.
      
       libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      33267325
  7. 23 1月, 2008 11 次提交
  8. 11 1月, 2008 2 次提交
    • T
      libata: don't normalize UNKNOWN to NONE after reset · 4ccd3329
      Tejun Heo 提交于
      After non-classifying reset, ehc->classes[] could contain
      ATA_DEV_UNKNOWN which used to be normalized to ATA_DEV_NONE for
      consistency.  However, this causes unfortunate side effect for drivers
      which have non-classifying hardresets (e.g. sata_nv) by making
      hardreset report ATA_DEV_NONE for non-classifying resets and thus
      makes EH believe that the port is unoccupied and recovery can be
      skipped.  The end result is that after a device is swapped with
      another one, the new device isn't attached after the old one is
      detached.
      
      This patch makes ata_eh_reset() not normalize UNKNOWN to NONE after
      non-classifying resets.  This fixes the above problem.  As UNKNOWN and
      NONE are handled differently by only EH hotplug logic, this doesn't
      cause other behavior changes.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Robert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4ccd3329
    • T
      libata-pmp: propagate timeout to host link · 2695e366
      Tejun Heo 提交于
      Timeout on downstream command may indicate transmission problem on
      host link.  Propagate timeouts to host link.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      2695e366
  9. 18 12月, 2007 1 次提交
  10. 02 12月, 2007 1 次提交
  11. 19 11月, 2007 1 次提交
  12. 03 11月, 2007 4 次提交
    • T
      libata: consider errors not associated with commands for speed down · dfcc173d
      Tejun Heo 提交于
      libata EH used to ignore errors not associated with commands when
      determining whether speed down is necessary or not.  This leads to the
      following problems.
      
      * Errors not associated with commands can occur indefinitely without
        libata EH taking corrective actions.
      
      * Upstream link errors don't trigger speed down when PMP is attached
        to it and commands issued to downstream device trigger errors on the
        upstream link.
      
      This patch makes ata_eh_link_autopsy() consider errors not associated
      with command for speed down.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      dfcc173d
    • T
      libata: more robust reset failure handling · 08cf69d0
      Tejun Heo 提交于
      Reset failure is a critical error.  It results in disabling the link
      requiring user intervention to re-enable it.  Make reset failure
      handling more robust such that libata EH doesn't give up too early.
      
      * Temporary glitches during hardreset may lead to classification
        failure when there's no softreset available.  Retry instead of
        giving up.
      
      * Initial softreset or follow up softreset may fail classification.
        Move classification error handling block out of followup softreset
        block such that both cases are handled and retry instead of giving
        up.  Also, on the last try, give ATA class a blind shot.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      08cf69d0
    • T
      libata: cosmetic clean up / reorganization of ata_eh_reset() · 416dc9ed
      Tejun Heo 提交于
      Clean up and reorganize ata_eh_reset() to ease further changes.
      
      * Cache ARRAY_SIZE(ata_eh_reset_timeouts) in @max_tries.
      * Cache link->flags in @lflags.
      * Move failure handling block to the end of the function and unnest
        both success and failure handling blocks.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      416dc9ed
    • T
      libata: fix timing computation in ata_eh_reset() · cd955463
      Tejun Heo 提交于
      As jiffies changes asynchronously, it needs to be cached if unchanging
      timestamp is needed.  The code in ata_eh_reset() intended to do that
      with @now but never actually did it.  Fix it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cd955463
  13. 30 10月, 2007 2 次提交
    • T
      libata: implement and use ATA_QCFLAG_QUIET · e027bd36
      Tejun Heo 提交于
      Implement ATA_QCFLAG_QUIET which indicates that there's no need to
      report if the command fails with AC_ERR_DEV and set it for passthrough
      commands.
      
      Combined with previous changes, this now makes device errors for all
      direct commands reported directly to the issuer without going through
      EH actions and reporting.
      
      Note that EH is still invoked after non-IO device errors to determine
      the nature of the error and resume command execution (some controller
      requires special care after error to continue).  It just performs
      default maintenance after error, examines what's going on, realizes
      that it's none of its business and reports the command failure without
      logging any error messages.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      e027bd36
    • 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