1. 08 1月, 2009 2 次提交
  2. 29 12月, 2008 5 次提交
    • L
      libata: blacklist NCQ on OCZ CORE 2 SSD (resend) · 5ccfca97
      Lubomir Bulej 提交于
      The patchlet below blacklists NCQ on OCZ CORE v2 SSD drive(s). Even
      though the drive advertises NCQ support with queue depth 1, it responds
      with all-zeroes FIS to NCQ commands which triggers ata error handling
      several times before the kernel decides to disable NCQ on the drive.
      Signed-off-by: NLubomir Bulej <lubomir.bulej@dsrg.mff.cuni.cz>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      5ccfca97
    • Q
      bd353ffd
    • T
      libata: perform port detach in EH · ece180d1
      Tejun Heo 提交于
      ata_port_detach() first made sure EH saw ATA_PFLAG_UNLOADING and then
      assumed EH context belongs to it and performed detach operation
      itself.  However, UNLOADING doesn't disable all of EH and this could
      lead to problems including triggering WARN_ON()'s in EH path.
      
      This patch makes port detach behave more like other EH actions such
      that ata_port_detach() requests EH to detach and waits for completion.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      ece180d1
    • T
      libata: when restoring SControl during detach do the PMP links first · ad74e4c1
      Tejun Heo 提交于
      When restoring SControl during detach, PMP links should be handled
      first as changing SControl of the host link can affect SCR access of
      PMP links.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      ad74e4c1
    • 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
  3. 16 12月, 2008 1 次提交
  4. 02 12月, 2008 1 次提交
  5. 11 11月, 2008 2 次提交
    • R
      libata: Avoid overflow in ata_tf_read_block() when tf->hba_lbal > 127 · 44901a96
      Roland Dreier 提交于
      Phillip O'Donnell <phillip.odonnell@gmail.com> pointed out that the same
      sign extension bug that was fixed in commit ba14a9c2 ("libata: Avoid
      overflow in ata_tf_to_lba48() when tf->hba_lbal > 127") also appears to
      exist in ata_tf_read_block().  Fix this by adding a cast to u64.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      44901a96
    • T
      libata: revert convert-to-block-tagging patches · 8a8bc223
      Tejun Heo 提交于
      This patch reverts the following three commits which convert libata to
      use block layer tagging.
      
       43a49cbd
       e013e13b
       2fca5ccf
      
      Although using block layer tagging is the right direction, due to the
      tight coupling among tag number, data structure allocation and
      hardware command slot allocation, libata doesn't work correctly with
      the current conversion.
      
      The biggest problem is guaranteeing that tag 0 is always used for
      non-NCQ commands.  Due to the way blk-tag is implemented and how SCSI
      starts and finishes requests, such guarantee can't be made.  I'm not
      sure whether this would actually break any low level driver but it
      doesn't look like a good idea to break such assumption given the
      frailty of ATA controllers.
      
      So, for the time being, keep using the old dumb in-libata qc
      allocation.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Jens Axobe <jens.axboe@oracle.com>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8a8bc223
  6. 04 11月, 2008 2 次提交
  7. 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
  8. 28 10月, 2008 2 次提交
  9. 24 10月, 2008 1 次提交
  10. 23 10月, 2008 1 次提交
  11. 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
  12. 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
  13. 31 7月, 2008 3 次提交
  14. 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
  15. 19 6月, 2008 1 次提交
  16. 31 5月, 2008 1 次提交
  17. 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
  18. 06 5月, 2008 1 次提交