1. 23 10月, 2008 1 次提交
  2. 29 9月, 2008 5 次提交
    • 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
    • T
      libata: misc updates to prepare for slave link · b5b3fa38
      Tejun Heo 提交于
      * Add ATA_EH_ALL_ACTIONS.
      
      * Make sata_link_{on|off}_line() return bool instead of int.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      b5b3fa38
    • T
      libata: reimplement link iterator · aadffb68
      Tejun Heo 提交于
      Implement __ata_port_next_link() and reimplement
      __ata_port_for_each_link() and ata_port_for_each_link() using it.
      This removes relatively large inlined code and makes iteration easier
      to extend.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      aadffb68
    • 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
  3. 22 8月, 2008 3 次提交
    • A
      libata: Fix a large collection of DMA mode mismatches · b15b3eba
      Alan Cox 提交于
      Dave Müller sent a diff for the pata_oldpiix that highlighted a problem
      where a lot of the ATA drivers assume dma_mode == 0 means "no DMA" while
      the core code uses 0xFF.
      
      This turns out to have other consequences such as code doing >= XFER_UDMA_0
      also catching 0xFF as UDMAlots. Fortunately it doesn't generally affect
      set_dma_mode, although some drivers call back into their own set mode code
      from other points.
      
      Having been through the drivers I've added helpers for using_udma/using_mwdma
      dma_enabled so that people don't open code ranges that may change (eg if UDMA8
      appears somewhere)
      
      Thanks to David for the initial bits
      [and added fix for pata_oldpiix from and signed-off-by Dave Mueller
       <dave.mueller@gmx.ch>  -jg]
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      b15b3eba
    • T
      libata: restore SControl on detach · d127ea7b
      Tejun Heo 提交于
      Save SControl during probing and restore it on detach.  This prevents
      adjustments made by libata drivers to seep into the next driver which
      gets attached (be it a libata one or not).
      
      It's not clear whether SControl also needs to be restored on suspend.
      The next system to have control (ACPI or kexec'd kernel) would
      probably like to see the original SControl value but there's no
      guarantee that a link is gonna keep working after SControl is adjusted
      without a reset and adding a reset and modified recovery cycle soley
      for this is an overkill.  For now, do it only for detach.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d127ea7b
    • T
      libata: implement no[hs]rst force params · 05944bdf
      Tejun Heo 提交于
      Implement force params nohrst, nosrst and norst.  This is to work
      around reset related problems and ease debugging.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      05944bdf
  4. 31 7月, 2008 3 次提交
  5. 15 7月, 2008 2 次提交
    • 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: 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
  6. 19 6月, 2008 1 次提交
  7. 31 5月, 2008 1 次提交
  8. 20 5月, 2008 4 次提交
    • T
      libata: ignore SIMG4726 config pseudo device · 50af2fa1
      Tejun Heo 提交于
      I was hoping ATA_HORKAGE_NODMA | ATA_HORKAGE_SKIP_PM could keep it
      happy but no even this doesn't work under certain configurations and
      it's not like we can do anything useful with the cofig device anyway.
      Replace ATA_HORKAGE_SKIP_PM with ATA_HORKAGE_DISABLE and use it for
      the config device.  This makes the device completely ignored by
      libata.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      50af2fa1
    • T
      libata: don't schedule LPM action seperately during probing · 391191c1
      Tejun Heo 提交于
      There's no reason to schedule LPM action after probing is complete
      causing another EH iteration.  Just schedule it together with probing
      itself.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      391191c1
    • 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: fix sata_link_hardreset() @online out parameter handling · 0cbf0711
      Tejun Heo 提交于
      The @online out parameter is supposed to set to true iff link is
      online and reset succeeded as advertised in the function description
      and callers are coded expecting that.  However, sata_link_reset()
      didn't behave this way on device readiness test failure.  Fix it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      0cbf0711
  9. 06 5月, 2008 1 次提交
  10. 30 4月, 2008 1 次提交
  11. 25 4月, 2008 3 次提交
  12. 19 4月, 2008 1 次提交
  13. 18 4月, 2008 14 次提交
    • A
      libata: Be a bit more slack about early devices · b93fda12
      Alan Cox 提交于
      We have a certain number of 'ATA' emulations often on CF or other flash
      devices that are at best "loosely based" on the CF 1.1 standard. These
      devices report themselves as disk but don't support the ATA minimal
      command set only the CF 1.1 set.
      
      Relax the PIO checking for devices reporting ATA rev 0, or no iordy
      support, or CFA. Rework the code a bit as it was already messy and this
      made it quite ugly.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      b93fda12
    • A
      libata: cable logic · f792068e
      Alan Cox 提交于
      The cable detect isolation patch inadvertently removed 40 wire short
      cable handling. Put it back
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f792068e
    • 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: 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: separate PMP support code from core code · 48515f6c
      Tejun Heo 提交于
      Most of PMP support code is already in libata-pmp.c.  All that are in
      libata-core.c are sata_pmp_port_ops and EXPORTs.  Move them to
      libata-pmp.c.  Also, collect PMP related prototypes and declarations
      in header files and move them right above of SFF stuff.
      
      This change is to make PMP support optional.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      48515f6c
    • T
      libata: make SFF support optional · 127102ae
      Tejun Heo 提交于
      Now that SFF support is completely separated out from the core layer,
      it can be made optional.  Add CONFIG_ATA_SFF and let SFF drivers
      depend on it.  If CONFIG_ATA_SFF isn't set, all codes in libata-sff.c
      and data structures for SFF support are disabled.  This saves good
      number of bytes for small systems.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      127102ae
    • T
      libata: clean up dummy port_ops · 182d7bba
      Tejun Heo 提交于
      Now that SFF assumptions are removed from core layer, dummy port_ops
      can be slimmed down.  Chop it down.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      182d7bba
    • T
      libata: kill ata_noop_dev_select() · c9f75b04
      Tejun Heo 提交于
      Now that SFF assumptions are separated out from non-SFF reset
      sequence, port_ops->sff_dev_select() is no longer necessary for
      non-SFF controllers.  Kill ata_noop_dev_select() and ->sff_dev_select
      initialization from base and other non-SFF port_ops.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      c9f75b04
    • 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: add qc_fill_rtf port operation · 22183bf5
      Tejun Heo 提交于
      On command completion, ata_qc_complete() directly called ops->tf_read
      to fill qc->result_tf.  This patch adds ops->qc_fill_rtf to replace
      hardcoded ops->tf_read usage.
      
      ata_sff_qc_fill_rtf() which uses ops->tf_read to fill result_tf is
      implemented and set in ata_base_port_ops and other ops tables which
      don't inherit from ata_base_port_ops, so this patch doesn't introduce
      any behavior change.
      
      ops->qc_fill_rtf() is similar to ops->sff_tf_read() but can only be
      called when a command finishes.  As some non-SFF controllers don't
      have TF registers defined unless they're associated with in-flight
      commands, this limited operation makes life easier for those drivers
      and help lifting SFF assumptions from libata core layer.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      22183bf5
    • 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: clear SError after link resume · ac371987
      Tejun Heo 提交于
      SError used to be cleared in ->postreset.  This has small hotplug race
      condition.  If a device is plugged in after reset is complete but
      postreset hasn't run yet, its hotplug event gets lost when SError is
      cleared.  This patch makes sata_link_resume() clear SError.  This
      kills the race condition and makes a lot of sense as some PMP and host
      PHYs don't work properly without SError cleared.
      
      This change makes sata_pmp_std_{pre|post}_reset()'s unnecessary as
      they become identical to ata_std counterparts.  It also simplifies
      sata_pmp_hardreset() and ahci_vt8251_hardreset().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      ac371987