1. 29 12月, 2008 1 次提交
    • T
      libata: beef up iterators · 1eca4365
      Tejun Heo 提交于
      There currently are the following looping constructs.
      
      * __ata_port_for_each_link() for all available links
      * ata_port_for_each_link() for edge links
      * ata_link_for_each_dev() for all devices
      * ata_link_for_each_dev_reverse() for all devices in reverse order
      
      Now there's a need for looping construct which is similar to
      __ata_port_for_each_link() but iterates over PMP links before the host
      link.  Instead of adding another one with long name, do the following
      cleanup.
      
      * Implement and export ata_link_next() and ata_dev_next() which take
        @mode parameter and can be used to build custom loop.
      * Implement ata_for_each_link() and ata_for_each_dev() which take
        looping mode explicitly.
      
      The following iteration modes are implemented.
      
      * ATA_LITER_EDGE		: loop over edge links
      * ATA_LITER_HOST_FIRST		: loop over all links, host link first
      * ATA_LITER_PMP_FIRST		: loop over all links, PMP links first
      
      * ATA_DITER_ENABLED		: loop over enabled devices
      * ATA_DITER_ENABLED_REVERSE	: loop over enabled devices in reverse order
      * ATA_DITER_ALL			: loop over all devices
      * ATA_DITER_ALL_REVERSE		: loop over all devices in reverse order
      
      This change removes exlicit device enabledness checks from many loops
      and makes it clear which ones are iterated over in which direction.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      1eca4365
  2. 11 11月, 2008 1 次提交
    • T
      libata: fix last_reset timestamp handling · 19b72321
      Tejun Heo 提交于
      ehc->last_reset is used to ensure that resets are not issued too
      close to each other.  It's initialized to jiffies minus one minute
      on EH entry.  However, when new links are initialized after PMP is
      probed, new links have zero for this timestamp resulting in long wait
      depending on the current jiffies.
      
      This patch makes last_set considered iff ATA_EHI_DID_RESET is set, in
      which case last_reset is always initialized.  As an added precaution,
      WARN_ON() is added so that warning is printed if last_reset is
      in future.
      
      This problem is spotted and debugged by Shane Huang.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Shane Huang <Shane.Huang@amd.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      19b72321
  3. 28 10月, 2008 2 次提交
  4. 23 10月, 2008 3 次提交
    • T
      libata: set device class to NONE if phys_offline · 816ab897
      Tejun Heo 提交于
      Reset methods don't have access to phys link status for slave links
      and may incorrectly indicate device presence causing unnecessary probe
      failures for unoccupied links.  This patch clears device class to NONE
      during post-reset processing if phys link is offline.
      
      As on/offlineness semantics is strictly defined and used in multiple
      places by the core layer, this won't change behavior for drivers which
      don't use slave links.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      816ab897
    • T
      libata-eh: fix slave link EH action mask handling · a568d1d2
      Tejun Heo 提交于
      Slave link action mask is transferred to master link and all the EH
      actions are taken by the master link.  ata_eh_about_to_do() and
      ata_eh_done() are called with ATA_EH_ALL_ACTIONS to clear the slave
      link actions during transfer.  This always sets ATA_PFLAG_RECOVERED
      flag causing spurious "EH complete" messages.
      
      Don't set ATA_PFLAG_RECOVERED for slave link actions.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      a568d1d2
    • T
      libata: transfer EHI control flags to slave ehc.i · 848e4c68
      Tejun Heo 提交于
      ATA_EHI_NO_AUTOPSY and ATA_EHI_QUIET are used to control the behavior
      of EH.  As only the master link is visible outside EH, these flags are
      set only for the master link although they should also apply to the
      slave link, which causes spurious EH messages during probe and
      suspend/resume.
      
      This patch transfers those two flags to slave ehc.i before performing
      slave autopsy and reporting.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      848e4c68
  5. 09 10月, 2008 1 次提交
  6. 29 9月, 2008 3 次提交
    • T
      libata-eh: clear UNIT ATTENTION after reset · 11fc33da
      Tejun Heo 提交于
      Resets make ATAPI devices raise UNIT ATTENTION which fails the next
      command.  As resets can happen asynchronously for unrelated reasons,
      this sometimes disrupts innocent users.  For example, reading DVD
      fails after the system wakes up from suspend or the other device
      sharing the channel went through bus error.
      
      Clearing UA has some problems as it might clear UA which the userland
      needs to know about.  However, UA after resets can only be about the
      reset itself and benefits of clearing it overweights cons.  Missing UA
      can only delay failure to one of the following commands anyway.  For
      example, timeout while burning is in progress will trigger reset and
      reset the device state and probably corrupt the burning run.  Although
      the userland application won't get the UA, its pending writes will
      fail.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      11fc33da
    • E
      libata: Implement disk shock protection support · 45fabbb7
      Elias Oltmanns 提交于
      On user request (through sysfs), the IDLE IMMEDIATE command with UNLOAD
      FEATURE as specified in ATA-7 is issued to the device and processing of
      the request queue is stopped thereafter until the specified timeout
      expires or user space asks to resume normal operation. This is supposed
      to prevent the heads of a hard drive from accidentally crashing onto the
      platter when a heavy shock is anticipated (like a falling laptop
      expected to hit the floor). In fact, the whole port stops processing
      commands until the timeout has expired in order to avoid any resets due
      to failed commands on another device.
      Signed-off-by: NElias Oltmanns <eo@nebensachen.de>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      45fabbb7
    • T
      libata: implement slave_link · b1c72916
      Tejun Heo 提交于
      Explanation taken from the comment of ata_slave_link_init().
      
       In libata, a port contains links and a link contains devices.  There
       is single host link but if a PMP is attached to it, there can be
       multiple fan-out links.  On SATA, there's usually a single device
       connected to a link but PATA and SATA controllers emulating TF based
       interface can have two - master and slave.
      
       However, there are a few controllers which don't fit into this
       abstraction too well - SATA controllers which emulate TF interface
       with both master and slave devices but also have separate SCR
       register sets for each device.  These controllers need separate links
       for physical link handling (e.g. onlineness, link speed) but should
       be treated like a traditional M/S controller for everything else
       (e.g. command issue, softreset).
      
       slave_link is libata's way of handling this class of controllers
       without impacting core layer too much.  For anything other than
       physical link handling, the default host link is used for both master
       and slave.  For physical link handling, separate @ap->slave_link is
       used.  All dirty details are implemented inside libata core layer.
       From LLD's POV, the only difference is that prereset, hardreset and
       postreset are called once more for the slave link, so the reset
       sequence looks like the following.
      
       prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) ->
       softreset(M) -> postreset(M) -> postreset(S)
      
       Note that softreset is called only for the master.  Softreset resets
       both M/S by definition, so SRST on master should handle both (the
       standard method will work just fine).
      
      As slave_link excludes PMP support and only code paths which deal with
      the attributes of physical link are affected, all the changes are
      localized to libata.h, libata-core.c and libata-eh.c.
      
       * ata_is_host_link() updated so that slave_link is considered as host
         link too.
      
       * iterator extended to iterate over the slave_link when using the
         underbarred version.
      
       * force param handling updated such that devno 16 is mapped to the
         slave link/device.
      
       * ata_link_on/offline() updated to return the combined result from
         master and slave link.  ata_phys_link_on/offline() are the direct
         versions.
      
       * EH autopsy and report are performed separately for master slave
         links.  Reset is udpated to implement the above described reset
         sequence.
      
      Except for reset update, most changes are minor, many of them just
      modifying dev->link to ata_dev_phys_link(dev) or using phys online
      test instead.
      
      After this update, LLDs can take full advantage of per-dev SCR
      registers by simply turning on slave link.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      b1c72916
  7. 22 8月, 2008 4 次提交
  8. 15 7月, 2008 5 次提交
    • T
      libata-eh: update atapi_eh_request_sense() to take @dev instead of @qc · 3eabddb8
      Tejun Heo 提交于
      Update atapi_eh_request_sense() to take @dev, @sense_buf and
      @dfl_sense_key instead of taking @qc and extracting information from
      it.  This change is to make the function more generic and allow it to
      be called from other places.
      
      While at it, make cdb initialization use initializer.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3eabddb8
    • T
      libata: improve EH internal command timeout handling · 87fbc5a0
      Tejun Heo 提交于
      ATA_TMOUT_INTERNAL which was 30secs were used for all internal
      commands which is way too long when something goes wrong.  This patch
      implements command type based stepped timeouts.  Different command
      types can use different timeouts and each command type can use
      different timeout values after timeouts.
      
      ie. the initial timeout is set to a value which should cover most of
      the cases but not too long so that run away cases don't delay things
      too much.  After the first try times out, the second try can use
      longer timeout and if that one times out too, it can go for full 30sec
      timeout.
      
      IDENTIFYs use 5s - 10s - 30s timeout and all other commands use 5s -
      10s timeouts.
      
      This patch significantly cuts down the needed time to handle failure
      cases while still allowing libata to work with nut job devices through
      retries.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      87fbc5a0
    • T
      libata: use ULONG_MAX to terminate reset timeout table · d8af0eb6
      Tejun Heo 提交于
      This doesn't introduce any functional changes.  This is to make reset
      timeout table consistent with to-be-added command timeout tables.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d8af0eb6
    • T
      libata: improve EH retry delay handling · 0a2c0f56
      Tejun Heo 提交于
      EH retries were delayed by 5 seconds to ensure that resets don't occur
      back-to-back.  However, this 5 second delay is superflous or excessive
      in many cases.  For example, after IDENTIFY times out, there's no
      reason to wait five more seconds before retrying.
      
      This patch adds ehc->last_reset timestamp and record the timestamp for
      the last reset trial or success and uses it to space resets by
      ATA_EH_RESET_COOL_DOWN which is 5 secs and removes unconditional 5 sec
      sleeps.
      
      As this change makes inter-try waits often shorter and they're
      redundant in nature, this patch also removes the "retrying..."
      messages.
      
      While at it, convert explicit rounding up division to DIV_ROUND_UP().
      
      This change speeds up EH in many cases w/o sacrificing robustness.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      0a2c0f56
    • T
      libata: consistently use msecs for time durations · 341c2c95
      Tejun Heo 提交于
      libata has been using mix of jiffies and msecs for time druations.
      This is getting confusing.  As writing sub HZ values in jiffies is
      PITA and msecs_to_jiffies() can't be used as initializer, unify unit
      for all time durations to msecs.  So, durations are in msecs and
      deadlines are in jiffies.  ata_deadline() is added to compute deadline
      from a start time and duration in msecs.
      
      While at it, drop now superflous _msec suffix from arguments and
      rename @timeout to @deadline if it represents a fixed point in time
      rather than duration.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      341c2c95
  9. 20 5月, 2008 4 次提交
    • T
      libata: ignore recovered PHY errors · e0614db2
      Tejun Heo 提交于
      No reason to get overzealous about recovered comm and data errors.
      Some PHYs habitually sets them w/o no good reason and being draconian
      about these soft error conditions doesn't seem to help anybody.
      
      If need ever rises, we might need to add soft PHY error condition, say
      AC_ERR_MAYBE_ATA_BUS and use it only to determine whether speed down
      is necessary but I don't think that's very likely to happen.  It's far
      more likely we'll get timeouts or fatal transmission errors if
      recovered errors are so prominent that they hamper operation.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      e0614db2
    • T
      libata: kill hotplug related race condition · f046519f
      Tejun Heo 提交于
      Originally, whole reset processing was done while the port is frozen
      and SError was cleared during @postreset().  This had two race
      conditions.  1: hotplug could occur after reset but before SError is
      cleared and libata won't know about it.  2: hotplug could occur after
      all the reset is complete but before the port is thawed.  As all
      events are cleared on thaw, the hotplug event would be lost.
      
      Commit ac371987 kills the first race
      by clearing SError during link resume but before link onlineness test.
      However, this doesn't fix race #2 and in some cases clearing SError
      after SRST is a good idea.
      
      This patch solves this problem by cross checking link onlineness with
      classification result after SError is cleared and port is thawed.
      Reset is retried if link is online but all devices attached to the
      link are unknown.  As all devices will be revalidated, this one-way
      check is enough to ensure that all devices are detected and
      revalidated reliably.
      
      This, luckily, also fixes the cases where host controller returns
      bogus status while harddrive is spinning up after hotplug making
      classification run before the device sends the first FIS and thus
      causes misdetection.
      
      Low level drivers can bypass the logic by setting class explicitly to
      ATA_DEV_NONE if ever necessary (currently none requires this).
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f046519f
    • T
      libata: move reset freeze/thaw handling into ata_eh_reset() · dc98c32c
      Tejun Heo 提交于
      Previously reset freeze/thaw handling lived outside of ata_eh_reset()
      mainly because the original PMP reset code needed the port frozen
      while resetting all the fan-out ports, which is no longer the case.
      
      This patch moves freeze/thaw handling into ata_eh_reset().
      @prereset() and @postreset() are now called w/o freezing the port
      although @prereset() an be called frozen if the port is frozen prior
      to entering ata_eh_reset().
      
      This makes code simpler and will help removing hotplug event related
      races.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      dc98c32c
    • T
      libata: reorganize ata_eh_reset() no reset method path · 932648b0
      Tejun Heo 提交于
      Reorganize ata_eh_reset() such that @prereset() is called even when no
      reset method is available and if block is used instead of goto to skip
      actual reset.  This makes no reset case behave better (readiness wait)
      and future changes easier.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      932648b0
  10. 06 5月, 2008 1 次提交
  11. 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
  12. 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
  13. 30 3月, 2008 1 次提交