1. 13 10月, 2007 13 次提交
    • T
      libata: use ata_exec_internal() for PMP register access · b06ce3e5
      Tejun Heo 提交于
      PMP registers used to be accessed with dedicated accessors ->pmp_read
      and ->pmp_write.  During reset, those callbacks are called with the
      port frozen so they should be able to run without depending on
      interrupt delivery.  To achieve this, they were implemented polling.
      
      However, as resetting the host port makes the PMP to isolate fan-out
      ports until SError.X is cleared, resetting fan-out ports while port is
      frozen doesn't buy much additional safety.
      
      This patch updates libata PMP support such that PMP registers are
      accessed using regular ata_exec_internal() mechanism and kills
      ->pmp_read/write() callbacks.  The following changes are made.
      
      * PMP access helpers - sata_pmp_read_init_tf(), sata_pmp_read_val(),
        sata_pmp_write_init_tf() are folded into sata_pmp_read/write() which
        are now standalone PMP register access functions.
      
      * sata_pmp_read/write() returns err_mask instead of rc.  This is
        consistent with other functions which issue internal commands and
        allows more detailed error reporting.
      
      * ahci interrupt handler is modified to ignore BAD_PMP and
        spurious/illegal completion IRQs while reset is in progress.  These
        conditions are expected during reset.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      b06ce3e5
    • T
      sata_sil24: implement PORT_RST · 23818034
      Tejun Heo 提交于
      As DEV_RST (hardreset) sometimes fail to recover the controller
      (especially after PMP DMA CS errata).  In such cases, perform PORT_RST
      prior to DEV_RST.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      23818034
    • T
      sata_sil24: implement PMP support · 3454dc69
      Tejun Heo 提交于
      Implement PMP support.  sil24 supports full FIS-switching.  However,
      it has a PMP DMA CS errata which requires port-wide resetting if
      commands are outstanding to three or more devices when an error occurs
      on one of them.
      
      ATAPI commands often result in CHECK SENSE and it's crucial to not
      reset them before fetching sense data.  Unfortunately, ATAPI CHECK
      SENSE causes a lot of problem if command is outstanding to any other
      device usually resulting in port-wide reset.  So, sata_sil24
      implements sil24_qc_defer() which guarantees ATAPI command is run by
      itself.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      3454dc69
    • T
      libata-pmp-prep: implement sata_async_notification() · 7d77b247
      Tejun Heo 提交于
      AN serves multiple purposes.  For ATAPI, it's used for media change
      notification.  For PMP, for downstream PHY status change notification.
      Implement sata_async_notification() which demultiplexes AN.
      
      To avoid unnecessary port events, ATAPI AN is not enabled if PMP is
      attached but SNTF is not available.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      7d77b247
    • T
      libata-pmp-prep: implement ops->qc_defer() · 31cc23b3
      Tejun Heo 提交于
      Controllers which support PMP have various restrictions on which
      combinations of commands are allowed to what number of devices
      concurrently.  This patch implements ops->qc_defer() which determines
      whether a qc can be issued at the moment or should be deferred.
      
      If the function returns ATA_DEFER_LINK, the qc will be deferred until
      a qc completes on the link.  If ATA_DEFER_PORT, until a qc completes
      on any link.  The defer conditions are advisory and in general
      ATA_DEFER_LINK can be considered as lower priority deferring than
      ATA_DEFER_PORT.
      
      ops->qc_defer() replaces fixed ata_scmd_need_defer().  For standard
      NCQ/non-NCQ exclusion, ata_std_qc_defer() is implemented.  ahci and
      sata_sil24 are converted to use ata_std_qc_defer().
      
      ops->qc_defer() is heavier than the original mechanism because full qc
      is prepped before determining to defer it, but various information is
      needed to determine defer conditinos and fully translating a qc is the
      only way to supply such information in generic manner.
      
      IMHO, this shouldn't cause any noticeable performance issues as
      
      * for most cases deferring occurs rarely (except for NCQ-aware
        cmd-switching PMP)
      * translation itself isn't that expensive
      * once deferred the command won't be repeated until another command
        completes which usually is a very long time cpu-wise.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      31cc23b3
    • T
      libata: misc updates for AN · 854c73a2
      Tejun Heo 提交于
      Update AN support in preparation of PMP support.
      
      * s/ata_id_has_AN/ata_id_has_atapi_AN/
      * add AN enabled reporting during configuration
      * add err_mask to AN configuration failure reporting
      * update LOCKING comment for ata_scsi_media_change_notify()
      * check whether ATA dev is attached to SCSI dev ata_scsi_media_change_notify()
      * set ATA_FLAG_AN in ahci and sata_sil24
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      854c73a2
    • T
      libata: implement and use ata_port_desc() to report port configuration · cbcdd875
      Tejun Heo 提交于
      Currently, port configuration reporting has the following problems.
      
      * iomapped address is reported instead of raw address
      * report contains irrelevant fields or lacks necessary fields for
        non-SFF controllers.
      * host->irq/irq2 are there just for reporting and hacky.
      
      This patch implements and uses ata_port_desc() and
      ata_port_pbar_desc().  ata_port_desc() is almost identical to
      ata_ehi_push_desc() except that it takes @ap instead of @ehi, has no
      locking requirement, can only be used during host initialization and "
      " is used as separator instead of ", ".  ata_port_pbar_desc() is a
      helper to ease reporting of a PCI BAR or an offsetted address into it.
      
      LLD pushes whatever description it wants using the above two
      functions.  The accumulated description is printed on host
      registration after "[S/P]ATA max MAX_XFERMODE ".
      
      SFF init helpers and ata_host_activate() automatically add
      descriptions for addresses and irq respectively, so only LLDs which
      isn't standard SFF need to add custom descriptions.  In many cases,
      such controllers need to report different things anyway.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cbcdd875
    • J
      [libata] Remove ->port_disable() hook · ac8869d5
      Jeff Garzik 提交于
      It was always set to ata_port_disable().  Removed the hook, and replaced
      the very few ap->ops->port_disable() callsites with direct calls to
      ata_port_disable().
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      ac8869d5
    • J
      [libata] Remove ->irq_ack() hook, and ata_dummy_irq_on() · 6d32d30f
      Jeff Garzik 提交于
      * ->irq_ack() is redundant to what the irq handler already
        performs... chk-status + irq-clear.  Furthermore, it is only
        called in one place, when screaming-irq-debugging is enabled,
        so we don't want to bother with a hook just for that.
      
      * ata_dummy_irq_on() is only ever used in drivers that have
        no callpath reaching ->irq_on().  Remove .irq_on hook from
        those drivers, and the now-unused ata_dummy_irq_on()
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6d32d30f
    • T
      libata-link: make two port flags HRST_TO_RESUME and SKIP_D2H_BSY link flags · 0c88758b
      Tejun Heo 提交于
      HRST_TO_RESUME and SKIP_D2H_BSY are link attributes.  Move them to
      ata_link->flags.  This will allow host and PMP links to have different
      attributes.  ata_port_info->link_flags is added and used by LLDs to
      specify these flags during initialization.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      0c88758b
    • T
      libata-link: linkify reset · cc0680a5
      Tejun Heo 提交于
      Make reset methods and related functions deal with ata_link instead of
      ata_port.
      
      * ata_do_reset()
      * ata_eh_reset()
      * all prereset/reset/postreset methods and related functions
      
      This patch introduces no behavior change.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cc0680a5
    • T
      libata-link: linkify PHY-related functions · 936fd732
      Tejun Heo 提交于
      Make the following PHY-related functions to deal with ata_link instead
      of ata_port.
      
      * sata_print_link_status()
      * sata_down_spd_limit()
      * ata_set_sata_spd_limit() and friends
      * sata_link_debounce/resume()
      * sata_scr_valid/read/write/write_flush()
      * ata_link_on/offline()
      
      This patch introduces no behavior change.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      936fd732
    • T
      libata-link: introduce ata_link · 9af5c9c9
      Tejun Heo 提交于
      Introduce ata_link.  It abstracts PHY and sits between ata_port and
      ata_device.  This new level of abstraction is necessary to support
      SATA Port Multiplier, which basically adds a bunch of links (PHYs) to
      a ATA host port.  Fields related to command execution, spd_limit and
      EH are per-link and thus moved to ata_link.
      
      This patch only defines the host link.  Multiple link handling will be
      added later.  Also, a lot of ap->link derefences are added but many of
      them will be removed as each part is converted to deal directly with
      ata_link instead of ata_port.
      
      This patch introduces no behavior change.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: James Bottomley <James.Bottomley@SteelEye.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9af5c9c9
  2. 26 9月, 2007 1 次提交
    • T
      sata_sil24: fix IRQ clearing race when PCIX_IRQ_WOC is used · 228f47b9
      Tejun Heo 提交于
      When PCIX_IRQ_WOC is used, sil24 has an inherent race condition
      between clearing IRQ pending and reading IRQ status.  If IRQ pending
      is cleared after reading IRQ status, there's possibility of lost IRQ.
      If IRQ pending is cleared before reading IRQ status, spurious IRQs
      will occur.
      
      sata_sil24 till now cleared IRQ pending after reading IRQ status thus
      losing IRQs on machines where PCIX_IRQ_WOC was used.  Reverse the
      order and ignore spurious IRQs if PCIX_IRQ_WOC.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      228f47b9
  3. 31 8月, 2007 1 次提交
  4. 20 7月, 2007 6 次提交
  5. 10 7月, 2007 2 次提交
  6. 22 5月, 2007 1 次提交
  7. 16 5月, 2007 1 次提交
    • T
      libata-acpi: add ATA_FLAG_ACPI_SATA port flag · 3cadbcc0
      Tejun Heo 提交于
      Whether a controller needs IDE or SATA ACPI hierarchy is determined by
      the programming interface of the controller not by whether the
      controller is SATA or PATA, or it supports slave device or not.  This
      patch adds ATA_FLAG_ACPI_SATA port flags which tells libata-acpi that
      the port needs SATA ACPI nodes, and sets the flag for ahci and
      sata_sil24.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      3cadbcc0
  8. 12 5月, 2007 1 次提交
    • T
      libata: reimplement suspend/resume support using sdev->manage_start_stop · 9666f400
      Tejun Heo 提交于
      Reimplement suspend/resume support using sdev->manage_start_stop.
      
      * Device suspend/resume is now SCSI layer's responsibility and the
        code is simplified a lot.
      
      * DPM is dropped.  This also simplifies code a lot.  Suspend/resume
        status is port-wide now.
      
      * ata_scsi_device_suspend/resume() and ata_dev_ready() removed.
      
      * Resume now has to wait for disk to spin up before proceeding.  I
        couldn't find easy way out as libata is in EH waiting for the
        disk to be ready and sd is waiting for EH to complete to issue
        START_STOP.
      
      * sdev->manage_start_stop is set to 1 in ata_scsi_slave_config().
        This fixes spindown on shutdown and suspend-to-disk.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9666f400
  9. 01 5月, 2007 1 次提交
    • T
      libata: add deadline support to prereset and reset methods · d4b2bab4
      Tejun Heo 提交于
      Add @deadline to prereset and reset methods and make them honor it.
      ata_wait_ready() which directly takes @deadline is implemented to be
      used as the wait function.  This patch is in preparation for EH timing
      improvements.
      
      * ata_wait_ready() never does busy sleep.  It's only used from EH and
        no wait in EH is that urgent.  This function also prints 'be
        patient' message automatically after 5 secs of waiting if more than
        3 secs is remaining till deadline.
      
      * ata_bus_post_reset() now fails with error code if any of its wait
        fails.  This is important because earlier reset tries will have
        shorter timeout than the spec requires.  If a device fails to
        respond before the short timeout, reset should be retried with
        longer timeout rather than silently ignoring the device.
      
        There are three behavior differences.
      
        1. Timeout is applied to both devices at once, not separately.  This
           is more consistent with what the spec says.
      
        2. When a device passes devchk but fails to become ready before
           deadline.  Previouly, post_reset would just succeed and let
           device classification remove the device.  New code fails the
           reset thus causing reset retry.  After a few times, EH will give
           up disabling the port.
      
        3. When slave device passes devchk but fails to become accessible
           (TF-wise) after reset.  Original code disables dev1 after 30s
           timeout and continues as if the device doesn't exist, while the
           patched code fails reset.  When this happens, new code fails
           reset on whole port rather than proceeding with only the primary
           device.
      
        If the failing device is suffering transient problems, new code
        retries reset which is a better behavior.  If the failing device is
        actually broken, the net effect is identical to it, but not to the
        other device sharing the channel.  In the previous code, reset would
        have succeeded after 30s thus detecting the working one.  In the new
        code, reset fails and whole port gets disabled.  IMO, it's a
        pathological case anyway (broken device sharing bus with working
        one) and doesn't really matter.
      
      * ata_bus_softreset() is changed to return error code from
        ata_bus_post_reset().  It used to return 0 unconditionally.
      
      * Spin up waiting is to be removed and not converted to honor
        deadline.
      
      * To be on the safe side, deadline is set to 40s for the time being.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d4b2bab4
  10. 29 4月, 2007 3 次提交
    • T
      libata: convert the remaining SATA drivers to new init model · 4447d351
      Tejun Heo 提交于
      Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
      sata_sx4, sata_vsc and sata_inic162x to new init model.
      
      Now that host and ap are available during intialization, functions are
      converted to take either host or ap instead of low level parameters
      which were inevitable for functions shared between init and other
      paths.  This simplifies code quite a bit.
      
      * init_one()'s now follow more consistent init order
      
      * ahci_setup_port() and ahci_host_init() collapsed into
        ahci_init_one() for init order consistency
      
      * sata_vsc uses port_info instead of setting fields manually
      
      * in sata_svw, k2_board_info converted to port_info (info is now in
        port flags).  port number is honored now.
      
      Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4447d351
    • T
      libata: improve AC_ERR_DEV handling for ->post_internal_cmd · a51d644a
      Tejun Heo 提交于
      ->post_internal_cmd is simplified EH for internal commands.  Its
      primary mission is to stop the controller such that no rogue memory
      access or other activities occur after the internal command is
      released.  It may provide error diagnostics by setting qc->err_mask
      but this hasn't been a requirement.
      
      To ignore SETXFER failure for CFA devices, libata needs to know
      whether a command was failed by the device or for any other reason.
      ie. internal command needs to get AC_ERR_DEV right.
      
      This patch makes the following changes to AC_ERR_DEV handling and
      ->post_internal_cmd semantics to accomodate this need and simplify
      callback implementation.
      
      1. As long as the correct bits in the result TF registers are set,
         there is no need to set AC_ERR_DEV explicitly.  libata EH core
         takes care of that for both normal and internal commands.
      
      2. The only requirement for ->post_internal_cmd() is to put the
         controller into quiescent state.  It needs not to set any err_mask.
      
      3. ata_exec_internal_sg() performs minimal error analysis such that
         AC_ERR_DEV is automatically set as long as result_tf is filled
         correctly.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a51d644a
    • A
      libata: dev_config does not need ap and adev passing · cd0d3bbc
      Alan 提交于
      It used to be impossible to get from ata_device to ata_port but that is
      no longer true. Various methods have been cleaned up over time but
      dev_config still takes both and most users don't need both anyway. Tidy
      this one up
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cd0d3bbc
  11. 19 3月, 2007 1 次提交
  12. 03 3月, 2007 1 次提交
  13. 02 3月, 2007 1 次提交
  14. 26 2月, 2007 1 次提交
  15. 10 2月, 2007 4 次提交
    • A
      libata: add another IRQ calls (libata drivers) · 246ce3b6
      Akira Iguchi 提交于
      This patch is against each libata driver.
      
      Two IRQ calls are added in ata_port_operations.
      - irq_on() is used to enable interrupts.
      - irq_ack() is used to acknowledge a device interrupt.
      
      In most drivers, ata_irq_on() and ata_irq_ack() are used for
      irq_on and irq_ack respectively.
      
      In some drivers (ex: ahci, sata_sil24) which cannot use them
      as is, ata_dummy_irq_on() and ata_dummy_irq_ack() are used.
      Signed-off-by: NKou Ishizaki <kou.ishizaki@toshiba.co.jp>
      Signed-off-by: NAkira Iguchi <akira2.iguchi@toshiba.co.jp>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      246ce3b6
    • T
      libata: convert to iomap · 0d5ff566
      Tejun Heo 提交于
      Convert libata core layer and LLDs to use iomap.
      
      * managed iomap is used.  Pointer to pcim_iomap_table() is cached at
        host->iomap and used through out LLDs.  This basically replaces
        host->mmio_base.
      
      * if possible, pcim_iomap_regions() is used
      
      Most iomap operation conversions are taken from Jeff Garzik
      <jgarzik@pobox.com>'s iomap branch.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      0d5ff566
    • T
      libata: update libata LLDs to use devres · 24dc5f33
      Tejun Heo 提交于
      Update libata LLDs to use devres.  Core layer is already converted to
      support managed LLDs.  This patch simplifies initialization and fixes
      many resource related bugs in init failure and detach path.  For
      example, all converted drivers now handle ata_device_add() failure
      gracefully without excessive resource rollback code.
      
      As most resources are released automatically on driver detach, many
      drivers don't need or can do with much simpler ->{port|host}_stop().
      In general, stop callbacks are need iff port or host needs to be given
      commands to shut it down.  Note that freezing is enough in many cases
      and ports are automatically frozen before being detached.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      24dc5f33
    • T
      libata: handle pci_enable_device() failure while resuming · 553c4aa6
      Tejun Heo 提交于
      Handle pci_enable_device() failure while resuming.  This patch kills
      the "ignoring return value of 'pci_enable_device'" warning message and
      propagates __must_check through ata_pci_device_do_resume().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      553c4aa6
  16. 02 12月, 2006 2 次提交