1. 31 10月, 2008 3 次提交
    • J
      libata: add whitelist for devices with known good pata-sata bridges · 9ce8e307
      Jens Axboe 提交于
      libata currently imposes a UDMA5 max transfer rate and 200 sector max
      transfer size for SATA devices that sit behind a pata-sata bridge. Lots
      of devices have known good bridges that don't need this limit applied.
      The MTRON SSD disks are such devices. Transfer rates are increased by
      20-30% with the restriction removed.
      
      So add a "blacklist" entry for the MTRON devices, with a flag indicating
      that the bridge is known good.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      9ce8e307
    • R
      libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127 · ba14a9c2
      Roland Dreier 提交于
      In ata_tf_to_lba48(), when evaluating
      
      	(tf->hob_lbal & 0xff) << 24
      
      the expression is promoted to signed int (since int can hold all values
      of u8).  However, if hob_lbal is 128 or more, then it is treated as a
      negative signed value and sign-extended when promoted to u64 to | into
      sectors, which leads to the MSB 32 bits of section getting set
      incorrectly.
      
      For example, Phillip O'Donnell <phillip.odonnell@gmail.com> reported
      that a 1.5GB drive caused:
      
          ata3.00: HPA detected: current 2930277168, native 18446744072344861488
      
      where 2930277168 == 0xAEA87B30 and 18446744072344861488 == 0xffffffffaea87b30
      which shows the problem when hob_lbal is 0xae.
      
      Fix this by adding a cast to u64, just as is used by for hob_lbah and
      hob_lbam in the function.
      Reported-by: NPhillip O'Donnell <phillip.odonnell@gmail.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      ba14a9c2
    • R
      ATA: remove excess kernel-doc notation · 5b97fbd0
      Randy Dunlap 提交于
      Remove excess kernel-doc function parameter notation from drivers/ata/:
      
      Warning(drivers/ata/libata-core.c:1622): Excess function parameter or struct member 'fn' description in 'ata_pio_queue_task'
      Warning(drivers/ata/libata-core.c:4655): Excess function parameter or struct member 'err_mask' description in 'ata_qc_complete'
      Warning(drivers/ata/ata_piix.c:751): Excess function parameter or struct member 'udma' description in 'do_pata_set_dmamode'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      5b97fbd0
  2. 28 10月, 2008 2 次提交
  3. 24 10月, 2008 1 次提交
  4. 23 10月, 2008 1 次提交
  5. 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
  6. 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
  7. 31 7月, 2008 3 次提交
  8. 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
  9. 19 6月, 2008 1 次提交
  10. 31 5月, 2008 1 次提交
  11. 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
  12. 06 5月, 2008 1 次提交
  13. 30 4月, 2008 1 次提交
  14. 25 4月, 2008 3 次提交
  15. 19 4月, 2008 1 次提交
  16. 18 4月, 2008 8 次提交
    • 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