1. 25 7月, 2013 1 次提交
  2. 25 6月, 2013 1 次提交
    • A
      libata-acpi: add back ACPI based hotplug functionality · 44521527
      Aaron Lu 提交于
      Commit 30dcf76a "libata: migrate ACPI code over to new bindings"
      mistakenly dropped the code to register hotplug notificaion handler
      for ATA port/devices, causing regression for people using ATA bay,
      as kernel bug #59871 shows.
      
      Fix this by adding back the hotplug notification handler registration
      code.  Since this code has to be run once and notification needs to
      be installed on every ATA port/devices handle no matter if there is
      actual device attached, we can't do this in binding time for ATA
      device ACPI handle, as the binding only occurs when a SCSI device is
      created, i.e. there is device attached.  So introduce the
      ata_acpi_hotplug_init() function to loop scan all ATA ACPI handles
      and if it is available, install the notificaion handler for it during
      ATA init time.
      
      With the ATA ACPI handle binding to SCSI device tree, it is possible
      now that when the SCSI hotplug work removes the SCSI device, the ACPI
      unbind function will find that the corresponding ACPI device has
      already been deleted by dock driver, causing a scaring message like:
      [  128.263966] scsi 4:0:0:0: Oops, 'acpi_handle' corrupt
      Fix this by waiting for SCSI hotplug task finish in our notificaion
      handler, so that the removal of ACPI device done in ACPI unbind
      function triggered by the removal of SCSI device is run earlier when
      ACPI device is still available.
      
      [rjw: Rebased]
      References: https://bugzilla.kernel.org/show_bug.cgi?id=59871Reported-bisected-and-tested-by: NDirk Griesbach <spamthis@freenet.de>
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Cc: 3.6+ <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      44521527
  3. 22 1月, 2013 3 次提交
    • A
      libata: handle power transition of ODD · 21334205
      Aaron Lu 提交于
      When ata port is runtime suspended, it will check if the ODD attched to
      it is a zero power(ZP) capable ODD and if the ZP capable ODD is in zero
      power ready state. And if this is not the case, the highest acpi state
      will be limited to ACPI_STATE_D3_HOT to avoid powering off the ODD. And
      if the ODD can be powered off, runtime wake capability needs to be
      enabled and powered_off flag will be set to let resume code knows that
      the ODD was in powered off state.
      
      And on resume, before it is powered on, if it was powered off during
      suspend, runtime wake capability needs to be disabled. After it is
      recovered, the ODD is considered functional, post power on processing
      like eject tray if the ODD is drawer type is done, and several ZPODD
      related fields will also be reset.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      21334205
    • A
      libata: check zero power ready status for ZPODD · 3dc67440
      Aaron Lu 提交于
      Per the Mount Fuji spec, the ODD is considered zero power ready when:
        - For slot type ODD, no media inside;
        - For tray type ODD, no media inside and tray closed.
      
      The information can be retrieved by either the returned information of
      command GET_EVENT_STATUS_NOTIFICATION(the command is used to poll for
      media event) or sense code.
      
      The information provided by the media status byte is not accurate, it
      is possible that after a new disc is just inserted, the status byte
      still returns media not present. So this information can not be used as
      the deciding factor, we use sense code to decide if zpready status is
      true.
      
      When we first sensed the ODD in the zero power ready state, the
      zp_sampled will be set and timestamp will be recoreded. And after ODD
      stayed in this state for some pre-defined period, the ODD is considered
      as power off ready and the zp_ready flag will be set. The zp_ready flag
      serves as the deciding factor other code will use to see if power off is
      OK for the ODD.
      
      The Mount Fuji spec suggests a delay should be used here, to avoid the
      case user ejects the ODD and then instantly inserts a new one again, so
      that we can avoid a power transition. And some ODDs may be slow to place
      its head to the home position after disc is ejected, so a delay here is
      generally a good idea. And the delay time can be changed via the module
      param zpodd_poweroff_delay.
      
      The zero power ready status check is performed in the ata port's runtime
      suspend code path, when port is not frozen yet, as we need to issue some
      IOs to the ODD.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3dc67440
    • A
      libata: identify and init ZPODD devices · afe75951
      Aaron Lu 提交于
      The ODD can be enabled for ZPODD if the following three conditions are
      satisfied:
      1 The ODD supports device attention;
      2 The platform can runtime power off the ODD through ACPI;
      3 The ODD is either slot type or drawer type.
      For such ODDs, zpodd_init is called and a new structure is allocated for
      it to store ZPODD related stuffs.
      
      And the zpodd_dev_enabled function is used to test if ZPODD is currently
      enabled for this ODD.
      
      A new config CONFIG_SATA_ZPODD is added to selectively build ZPODD code.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      afe75951
  4. 13 9月, 2012 1 次提交
    • S
      ahci: implement aggressive SATA device sleep support · 65fe1f0f
      Shane Huang 提交于
      Device Sleep is a feature as described in AHCI 1.3.1 Technical Proposal.
      This feature enables an HBA and SATA storage device to enter the DevSleep
      interface state, enabling lower power SATA-based systems.
      
      Aggressive Device Sleep enables the HBA to assert the DEVSLP signal as
      soon as there are no commands outstanding to the device and the port
      specific Device Sleep idle timer has expired. This enables autonomous
      entry into the DevSleep interface state without waiting for software
      in power sensitive systems.
      
      This patch enables Aggressive Device Sleep only if both host controller
      and device support it.
      
      Tested on AMD reference board together with Device Sleep supported device
      sample.
      Signed-off-by: NShane Huang <shane.huang@amd.com>
      Reviewed-by: NAaron Lu <aaron.lwe@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      65fe1f0f
  5. 26 7月, 2012 1 次提交
  6. 29 6月, 2012 3 次提交
  7. 13 4月, 2012 1 次提交
  8. 01 3月, 2012 1 次提交
  9. 20 2月, 2012 1 次提交
    • D
      [SCSI] libsas: execute transport link resets with libata-eh via host workqueue · 81c757bc
      Dan Williams 提交于
      Link resets leave ata affiliations intact, so arrange for libsas to make
      an effort to avoid dropping the device due to a slow-to-recover link.
      Towards this end carry out reset in the host workqueue so that it can
      check for ata devices and kick the reset request to libata.  Hard
      resets, in contrast, bypass libata since they are meant for associating
      an ata device with another initiator in the domain (tears down
      affiliations).
      
      Need to add a new transport_sas_phy_reset() since the current
      sas_phy_reset() is a utility function to libsas lldds.  They are not
      prepared for it to loop back into eh.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      81c757bc
  10. 09 1月, 2012 1 次提交
  11. 02 3月, 2011 1 次提交
  12. 14 2月, 2011 1 次提交
    • J
      [SCSI] libata: plumb sas port scan into standard libata paths · 1f723867
      James Bottomley 提交于
      The function ata_sas_port_init() has always really done its own thing.
      However, as a precursor to moving to the libata new eh, it has to be
      properly using the standard libata scan paths.  This means separating
      the current libata scan paths into pieces which can be shared with
      libsas and pieces which cant (really just the async call and the host
      scan).
      
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      1f723867
  13. 22 10月, 2010 6 次提交
    • T
      libata: implement cross-port EH exclusion · c0c362b6
      Tejun Heo 提交于
      In libata, the non-EH code paths should always take and release
      ap->lock explicitly when accessing hardware or shared data structures.
      However, once EH is active, it's assumed that the port is owned by EH
      and EH methods don't explicitly take ap->lock unless race from irq
      handler or other code paths are expected.  However, libata EH didn't
      guarantee exclusion among EHs for ports of the same host.  IOW,
      multiple EHs may execute in parallel on multiple ports of the same
      controller.
      
      In many cases, especially in SATA, the ports are completely
      independent of each other and this doesn't cause problems; however,
      there are cases where different ports share the same resource, which
      lead to obscure timing related bugs such as the one fixed by commit
      213373cf (ata_piix: fix locking around SIDPR access).
      
      This patch implements exclusion among EHs of the same host.  When EH
      begins, it acquires per-host EH ownership by calling ata_eh_acquire().
      When EH finishes, the ownership is released by calling
      ata_eh_release().  EH ownership is also released whenever the EH
      thread goes to sleep from ata_msleep() or explicitly and reacquired
      after waking up.
      
      This ensures that while EH is actively accessing the hardware, it has
      exclusive access to it while allowing EHs to interleave and progress
      in parallel as they hit waiting stages, which dominate the time spent
      in EH.  This achieves cross-port EH exclusion without pervasive and
      fragile changes while still allowing parallel EH for the most part.
      
      This was first reported by yuanding02@gmail.com more than three years
      ago in the following bugzilla.  :-)
      
        https://bugzilla.kernel.org/show_bug.cgi?id=8223Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Reported-by: yuanding02@gmail.com
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c0c362b6
    • T
      libata: implement LPM support for port multipliers · 6c8ea89c
      Tejun Heo 提交于
      Port multipliers can do DIPM on fan-out links fine.  Implement support
      for it.  Tested w/ SIMG 57xx and marvell PMPs.  Both the host and
      fan-out links enter power save modes nicely.
      
      SIMG 37xx and 47xx report link offline on SStatus causing EH to detach
      the devices.  Blacklisted.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6c8ea89c
    • T
      libata: reimplement link power management · 6b7ae954
      Tejun Heo 提交于
      The current LPM implementation has the following issues.
      
      * Operation order isn't well thought-out.  e.g. HIPM should be
        configured after IPM in SControl is properly configured.  Not the
        other way around.
      
      * Suspend/resume paths call ata_lpm_enable/disable() which must only
        be called from EH context directly.  Also, ata_lpm_enable/disable()
        were called whether LPM was in use or not.
      
      * Implementation is per-port when it should be per-link.  As a result,
        it can't be used for controllers with slave links or PMP.
      
      * LPM state isn't managed consistently.  After a link reset for
        whatever reason including suspend/resume the actual LPM state would
        be reset leaving ap->lpm_policy inconsistent.
      
      * Generic/driver-specific logic boundary isn't clear.  Currently,
        libahci has to mangle stuff which libata EH proper should be
        handling.  This makes the implementation unnecessarily complex and
        fragile.
      
      * Tied to ALPM.  Doesn't consider DIPM only cases and doesn't check
        whether the device allows HIPM.
      
      * Error handling isn't implemented.
      
      Given the extent of mismatch with the rest of libata, I don't think
      trying to fix it piecewise makes much sense.  This patch reimplements
      LPM support.
      
      * The new implementation is per-link.  The target policy is still
        port-wide (ap->target_lpm_policy) but all the mechanisms and states
        are per-link and integrate well with the rest of link abstraction
        and can work with slave and PMP links.
      
      * Core EH has proper control of LPM state.  LPM state is reconfigured
        when and only when reconfiguration is necessary.  It makes sure that
        LPM state is reset when probing for new device on the link.
        Controller agnostic logic is now implemented in libata EH proper and
        driver implementation only has to deal with controller specifics.
      
      * Proper error handling.  LPM config failure is attributed to the
        device on the link and LPM is disabled for the link if it fails
        repeatedly.
      
      * ops->enable/disable_pm() are replaced with single ops->set_lpm()
        which takes @policy and @hints.  This simplifies driver specific
        implementation.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6b7ae954
    • T
      libata: implement sata_link_scr_lpm() and make ata_dev_set_feature() global · 1152b261
      Tejun Heo 提交于
      Link power management is about to be reimplemented.  Prepare for it.
      
      * Implement sata_link_scr_lpm().
      
      * Drop static from ata_dev_set_feature() and make it available to
        other libata files.
      
      * Trivial whitespace adjustments.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      1152b261
    • T
      libata: clean up lpm related symbols and sysfs show/store functions · c93b263e
      Tejun Heo 提交于
      Link power management related symbols are in confusing state w/ mixed
      usages of lpm, ipm and pm.  This patch cleans up lpm related symbols
      and sysfs show/store functions as follows.
      
      * lpm states - NOT_AVAILABLE, MIN_POWER, MAX_PERFORMANCE and
        MEDIUM_POWER are renamed to ATA_LPM_UNKNOWN and
        ATA_LPM_{MIN|MAX|MED}_POWER.
      
      * Pre/postfixes are unified to lpm.
      
      * sysfs show/store functions for link_power_management_policy were
        curiously named get/put and unnecessarily complex.  Renamed to
        show/store and simplified.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c93b263e
    • G
      [libata] Add ATA transport class · d9027470
      Gwendal Grignou 提交于
      This is a scheleton for libata transport class.
      All information is read only, exporting information from libata:
      - ata_port class: one per ATA port
      - ata_link class: one per ATA port or 15 for SATA Port Multiplier
      - ata_device class: up to 2 for PATA link, usually one for SATA.
      Signed-off-by: NGwendal Grignou <gwendal@google.com>
      Reviewed-by: NGrant Grundler <grundler@google.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d9027470
  14. 02 7月, 2010 1 次提交
    • T
      libata: take advantage of cmwq and remove concurrency limitations · ad72cf98
      Tejun Heo 提交于
      libata has two concurrency related limitations.
      
      a. ata_wq which is used for polling PIO has single thread per CPU.  If
         there are multiple devices doing polling PIO on the same CPU, they
         can't be executed simultaneously.
      
      b. ata_aux_wq which is used for SCSI probing has single thread.  In
         cases where SCSI probing is stalled for extended period of time
         which is possible for ATAPI devices, this will stall all probing.
      
      #a is solved by increasing maximum concurrency of ata_wq.  Please note
      that polling PIO might be used under allocation path and thus needs to
      be served by a separate wq with a rescuer.
      
      #b is solved by using the default wq instead and achieving exclusion
      via per-port mutex.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJeff Garzik <jgarzik@pobox.com>
      ad72cf98
  15. 20 5月, 2010 3 次提交
    • T
      libata-sff: separate out BMDMA EH · fe06e5f9
      Tejun Heo 提交于
      Some of error handling logic in ata_sff_error_handler() and all of
      ata_sff_post_internal_cmd() are for BMDMA.  Create
      ata_bmdma_error_handler() and ata_bmdma_post_internal_cmd() and move
      BMDMA part into those.
      
      While at it, change DMA protocol check to ata_is_dma(), fix
      post_internal_cmd to call ap->ops->bmdma_stop instead of directly
      calling ata_bmdma_stop() and open code hardreset selection so that
      ata_std_error_handler() doesn't have to know about sff hardreset.
      
      As these two functions are BMDMA specific, there's no reason to check
      for bmdma_addr before calling bmdma methods if the protocol of the
      failed command is DMA.  sata_mv and pata_mpc52xx now don't need to set
      .post_internal_cmd to ATA_OP_NULL and pata_icside and sata_qstor don't
      need to set it to their bmdma_stop routines.
      
      ata_sff_post_internal_cmd() becomes noop and is removed.
      
      This fixes p3 described in clean-up-BMDMA-initialization patch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      fe06e5f9
    • T
      libata-sff: port_task is SFF specific · c429137a
      Tejun Heo 提交于
      port_task is tightly bound to the standard SFF PIO HSM implementation.
      Using it for any other purpose would be error-prone and there's no
      such user and if some drivers need such feature, it would be much
      better off using its own.  Move it inside CONFIG_ATA_SFF and rename it
      to sff_pio_task.
      
      The only function which is exposed to the core layer is
      ata_sff_flush_pio_task() which is renamed from ata_port_flush_task()
      and now also takes care of resetting hsm_task_state to HSM_ST_IDLE,
      which is possible as it's now specific to PIO HSM.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c429137a
    • T
      libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init() · 270390e1
      Tejun Heo 提交于
      In preparation of proper SFF/BMDMA separation, introduce
      ata_sff_init/exit() and ata_sff_port_init().  These functions
      currently don't do anything.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      270390e1
  16. 15 5月, 2010 1 次提交
  17. 06 10月, 2009 1 次提交
  18. 02 9月, 2009 1 次提交
    • R
      libata: add command name parsing for error output · 6521148c
      Robert Hancock 提交于
      This patch improve libata's output for error/notification messages
      to allow easier comprehension and debugging:
      
      When ATAPI commands issued through the SCSI layer fail, use SCSI
      functions to print the CDB in human-readable form instead of just
      dumping out the CDB in hex.
      
      Print out the name of the failed command (as defined by the ATA
      specification) in error handling output along with the raw register
      contents.
      
      When reporting status of ACPI taskfile commands executed on resume,
      also output the names of the commands being executed (or not) in
      readable form.
      
      Since the extra data for printing command names increases kernel
      size slightly, a config option has been added to allow disabling
      command name output (as well as some of the error register parsing)
      for those highly sensitive to kernel text size.
      Signed-off-by: NRobert Hancock <hancockrwd@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6521148c
  19. 25 3月, 2009 1 次提交
  20. 03 2月, 2009 2 次提交
  21. 11 11月, 2008 1 次提交
    • 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
  22. 24 10月, 2008 1 次提交
  23. 09 10月, 2008 1 次提交
  24. 29 9月, 2008 1 次提交
    • 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
  25. 31 7月, 2008 1 次提交
    • T
      libata: update atapi disable handling · 2486fa56
      Tejun Heo 提交于
      Global and per-LLD ATAPI disable checks were done in the command issue
      path probably because it was left out during EH conversion.  On
      affected machines, this can cause lots of warning messages.  Move them
      to where they belong - the probing path.
      
      Reported by Chunbo Luo.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Chunbo Luo <chunbo.luo@windriver.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      2486fa56
  26. 15 7月, 2008 1 次提交
    • 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
  27. 19 6月, 2008 1 次提交
  28. 29 4月, 2008 1 次提交