1. 18 4月, 2008 7 次提交
    • T
      libata: implement and use sata_std_hardreset() · 57c9efdf
      Tejun Heo 提交于
      Implement sata_std_hardreset(), which simply wraps around
      sata_link_hardreset().  sata_std_hardreset() becomes new standard
      hardreset method for sata_port_ops and sata_sff_hardreset() moves from
      ata_base_port_ops to ata_sff_port_ops, which is where it really
      belongs.
      
      ata_is_builtin_hardreset() is added so that both
      ata_std_error_handler() and ata_sff_error_handler() skip both builtin
      hardresets if SCR isn't accessible.
      
      piix_sidpr_hardreset() in ata_piix.c is identical to
      sata_std_hardreset() in functionality and got replaced with the
      standard function.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      57c9efdf
    • T
      libata: rename SFF functions · 9363c382
      Tejun Heo 提交于
      SFF functions have confusing names.  Some have sff prefix, some have
      bmdma, some std, some pci and some none.  Unify the naming by...
      
      * SFF functions which are common to both BMDMA and non-BMDMA are
        prefixed with ata_sff_.
      
      * SFF functions which are specific to BMDMA are prefixed with
        ata_bmdma_.
      
      * SFF functions which are specific to PCI but apply to both BMDMA and
        non-BMDMA are prefixed with ata_pci_sff_.
      
      * SFF functions which are specific to PCI and BMDMA are prefixed with
        ata_pci_bmdma_.
      
      * Drop generic prefixes from LLD specific routines.  For example,
        bfin_std_dev_select -> bfin_dev_select.
      
      The following renames are noteworthy.
      
        ata_qc_issue_prot() -> ata_sff_qc_issue()
        ata_pci_default_filter() -> ata_bmdma_mode_filter()
        ata_dev_try_classify() -> ata_sff_dev_classify()
      
      This rename is in preparation of separating SFF support out of libata
      core layer.  This patch strictly renames functions and doesn't
      introduce any behavior difference.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      9363c382
    • T
      libata: implement ATA_QCFLAG_RETRY · 03faab78
      Tejun Heo 提交于
      Currently whether a command should be retried after failure is
      determined inside ata_eh_finish().  Add ATA_QCFLAG_RETRY and move the
      logic into ata_eh_autopsy().  This makes things clearer and helps
      extending retry determination logic.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      03faab78
    • T
      libata: make reset related methods proper port operations · a1efdaba
      Tejun Heo 提交于
      Currently reset methods are not specified directly in the
      ata_port_operations table.  If a LLD wants to use custom reset
      methods, it should construct and use a error_handler which uses those
      reset methods.  It's done this way for two reasons.
      
      First, the ops table already contained too many methods and adding
      four more of them would noticeably increase the amount of necessary
      boilerplate code all over low level drivers.
      
      Second, as ->error_handler uses those reset methods, it can get
      confusing.  ie. By overriding ->error_handler, those reset ops can be
      made useless making layering a bit hazy.
      
      Now that ops table uses inheritance, the first problem doesn't exist
      anymore.  The second isn't completely solved but is relieved by
      providing default values - most drivers can just override what it has
      implemented and don't have to concern itself about higher level
      callbacks.  In fact, there currently is no driver which actually
      modifies error handling behavior.  Drivers which override
      ->error_handler just wraps the standard error handler only to prepare
      the controller for EH.  I don't think making ops layering strict has
      any noticeable benefit.
      
      This patch makes ->prereset, ->softreset, ->hardreset, ->postreset and
      their PMP counterparts propoer ops.  Default ops are provided in the
      base ops tables and drivers are converted to override individual reset
      methods instead of creating custom error_handler.
      
      * ata_std_error_handler() doesn't use sata_std_hardreset() if SCRs
        aren't accessible.  sata_promise doesn't need to use separate
        error_handlers for PATA and SATA anymore.
      
      * softreset is broken for sata_inic162x and sata_sx4.  As libata now
        always prefers hardreset, this doesn't really matter but the ops are
        forced to NULL using ATA_OP_NULL for documentation purpose.
      
      * pata_hpt374 needs to use different prereset for the first and second
        PCI functions.  This used to be done by branching from
        hpt374_error_handler().  The proper way to do this is to use
        separate ops and port_info tables for each function.  Converted.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      a1efdaba
    • T
      libata: kill ata_ehi_schedule_probe() · b558eddd
      Tejun Heo 提交于
      ata_ehi_schedule_probe() was created to hide details of link-resuming
      reset magic.  Now that all the softreset workarounds are gone,
      scheduling probe is very simple - set probe_mask and request RESET.
      Kill ata_ehi_schedule_probe() and open code it.  This also increases
      consistency as ata_ehi_schedule_probe() couldn't cover individual
      device probings so they were open-coded even when the helper existed.
      
      While at it, define ATA_ALL_DEVICES as mask of all possible devices on
      a link and always use it when requesting probe on link level for
      simplicity and consistency.  Setting extra bits in the probe_mask
      doesn't hurt anybody.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      b558eddd
    • T
      libata: kill ATA_EHI_RESUME_LINK · 672b2d65
      Tejun Heo 提交于
      ATA_EHI_RESUME_LINK has two functions - promote reset to hardreset if
      ATA_LFLAG_HRST_TO_RESUME is set and preventing EH from shortcutting
      reset action when probing is requested.  The former is gone now and
      the latter can easily be achieved by making EH to perform at least one
      reset if reset is requested, which also makes more sense than
      depending on RESUME_LINK flag.
      
      As ATA_EHI_RESUME_LINK was the only EHI reset modifier, this also
      kills reset modifier handling.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      672b2d65
    • T
      libata: prefer hardreset · cf480626
      Tejun Heo 提交于
      When both soft and hard resets are available, libata preferred
      softreset till now.  The logic behind it was to be softer to devices;
      however, this doesn't really help much.  Rationales for the change:
      
      * BIOS may freeze lock certain things during boot and softreset can't
        unlock those.  This by itself is okay but during operation PHY event
        or other error conditions can trigger hardreset and the device may
        end up with different configuration.
      
        For example, after a hardreset, previously unlockable HPA can be
        unlocked resulting in different device size and thus revalidation
        failure.  Similar condition can occur during or after resume.
      
      * Certain ATAPI devices require hardreset to recover after certain
        error conditions.  On PATA, this is done by issuing the DEVICE RESET
        command.  On SATA, COMRESET has equivalent effect.  The problem is
        that DEVICE RESET needs its own execution protocol.
      
        For SFF controllers with bare TF access, it can be easily
        implemented but more advanced controllers (e.g. ahci and sata_sil24)
        require specialized implementations.  Simply using hardreset solves
        the problem nicely.
      
      * COMRESET initialization sequence is the norm in SATA land and many
        SATA devices don't work properly if only SRST is used.  For example,
        some PMPs behave this way and libata works around by always issuing
        hardreset if the host supports PMP.
      
        Like the above example, libata has developed a number of mechanisms
        aiming to promote softreset to hardreset if softreset is not going
        to work.  This approach is time consuming and error prone.
      
        Also, note that, dependingon how you read the specs, it could be
        argued that PMP fan-out ports require COMRESET to start operation.
        In fact, all the PMPs on the market except one don't work properly
        if COMRESET is not issued to fan-out ports after PMP reset.
      
      * COMRESET is an integral part of SATA connection and any working
        device should be able to handle COMRESET properly.  After all, it's
        the way to signal hardreset during reboot.  This is the most used
        and recommended (at least by the ahci spec) method of resetting
        devices.
      
      So, this patch makes libata prefer hardreset over softreset by making
      the following changes.
      
      * Rename ATA_EH_RESET_MASK to ATA_EH_RESET and use it whereever
        ATA_EH_{SOFT|HARD}RESET used to be used.  ATA_EH_{SOFT|HARD}RESET is
        now only used to tell prereset whether soft or hard reset will be
        issued.
      
      * Strip out now unneeded promote-to-hardreset logics from
        ata_eh_reset(), ata_std_prereset(), sata_pmp_std_prereset() and
        other places.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      cf480626
  2. 30 3月, 2008 1 次提交
  3. 11 3月, 2008 1 次提交
  4. 21 2月, 2008 1 次提交
    • T
      libata: implement libata.force module parameter · 33267325
      Tejun Heo 提交于
      This patch implements libata.force module parameter which can
      selectively override ATA port, link and device configurations
      including cable type, SATA PHY SPD limit, transfer mode and NCQ.
      
      For example, you can say "use 1.5Gbps for all fan-out ports attached
      to the second port but allow 3.0Gbps for the PMP device itself, oh,
      the device attached to the third fan-out port chokes on NCQ and
      shouldn't go over UDMA4" by the following.
      
       libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      33267325
  5. 23 1月, 2008 11 次提交
  6. 11 1月, 2008 2 次提交
    • T
      libata: don't normalize UNKNOWN to NONE after reset · 4ccd3329
      Tejun Heo 提交于
      After non-classifying reset, ehc->classes[] could contain
      ATA_DEV_UNKNOWN which used to be normalized to ATA_DEV_NONE for
      consistency.  However, this causes unfortunate side effect for drivers
      which have non-classifying hardresets (e.g. sata_nv) by making
      hardreset report ATA_DEV_NONE for non-classifying resets and thus
      makes EH believe that the port is unoccupied and recovery can be
      skipped.  The end result is that after a device is swapped with
      another one, the new device isn't attached after the old one is
      detached.
      
      This patch makes ata_eh_reset() not normalize UNKNOWN to NONE after
      non-classifying resets.  This fixes the above problem.  As UNKNOWN and
      NONE are handled differently by only EH hotplug logic, this doesn't
      cause other behavior changes.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Robert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4ccd3329
    • T
      libata-pmp: propagate timeout to host link · 2695e366
      Tejun Heo 提交于
      Timeout on downstream command may indicate transmission problem on
      host link.  Propagate timeouts to host link.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      2695e366
  7. 18 12月, 2007 1 次提交
  8. 02 12月, 2007 1 次提交
  9. 19 11月, 2007 1 次提交
  10. 03 11月, 2007 4 次提交
    • T
      libata: consider errors not associated with commands for speed down · dfcc173d
      Tejun Heo 提交于
      libata EH used to ignore errors not associated with commands when
      determining whether speed down is necessary or not.  This leads to the
      following problems.
      
      * Errors not associated with commands can occur indefinitely without
        libata EH taking corrective actions.
      
      * Upstream link errors don't trigger speed down when PMP is attached
        to it and commands issued to downstream device trigger errors on the
        upstream link.
      
      This patch makes ata_eh_link_autopsy() consider errors not associated
      with command for speed down.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      dfcc173d
    • T
      libata: more robust reset failure handling · 08cf69d0
      Tejun Heo 提交于
      Reset failure is a critical error.  It results in disabling the link
      requiring user intervention to re-enable it.  Make reset failure
      handling more robust such that libata EH doesn't give up too early.
      
      * Temporary glitches during hardreset may lead to classification
        failure when there's no softreset available.  Retry instead of
        giving up.
      
      * Initial softreset or follow up softreset may fail classification.
        Move classification error handling block out of followup softreset
        block such that both cases are handled and retry instead of giving
        up.  Also, on the last try, give ATA class a blind shot.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      08cf69d0
    • T
      libata: cosmetic clean up / reorganization of ata_eh_reset() · 416dc9ed
      Tejun Heo 提交于
      Clean up and reorganize ata_eh_reset() to ease further changes.
      
      * Cache ARRAY_SIZE(ata_eh_reset_timeouts) in @max_tries.
      * Cache link->flags in @lflags.
      * Move failure handling block to the end of the function and unnest
        both success and failure handling blocks.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      416dc9ed
    • T
      libata: fix timing computation in ata_eh_reset() · cd955463
      Tejun Heo 提交于
      As jiffies changes asynchronously, it needs to be cached if unchanging
      timestamp is needed.  The code in ata_eh_reset() intended to do that
      with @now but never actually did it.  Fix it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cd955463
  11. 30 10月, 2007 2 次提交
    • T
      libata: implement and use ATA_QCFLAG_QUIET · e027bd36
      Tejun Heo 提交于
      Implement ATA_QCFLAG_QUIET which indicates that there's no need to
      report if the command fails with AC_ERR_DEV and set it for passthrough
      commands.
      
      Combined with previous changes, this now makes device errors for all
      direct commands reported directly to the issuer without going through
      EH actions and reporting.
      
      Note that EH is still invoked after non-IO device errors to determine
      the nature of the error and resume command execution (some controller
      requires special care after error to continue).  It just performs
      default maintenance after error, examines what's going on, realizes
      that it's none of its business and reports the command failure without
      logging any error messages.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      e027bd36
    • T
      libata: stop being overjealous about non-IO commands · f90f0828
      Tejun Heo 提交于
      libata EH always revalidated device and retried failed command after
      error except for ATAPI CCs.  This is unnecessary and hinders with
      users issuing direct commands.  This patch makes the following
      changes.
      
      * Make sata_sil24 not request ATA_EH_REVALIDATE on device errors.
        sil24 is the only driver which does this.  All others let libata EH
        core code decide.
      
      * Don't request revalidation after device error of non-IO command.
        Revalidation doesn't really help anybody.  As ATA_EH_REVALIDATE
        isn't set by default, there's no reason to clear it after sense data
        is read.  Kill ATA_EH_REVALIDATE clearing code while at it.
      
      * Don't retry non-IO command after device error.  Device has rejected
        the command.  There's no point in retrying.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f90f0828
  12. 29 10月, 2007 4 次提交
    • K
      [libata] Link power management infrastructure · ca77329f
      Kristen Carlson Accardi 提交于
      Device Initiated Power Management, which is defined
      in SATA 2.5 can be enabled for disks which support it.
      This patch enables DIPM when the user sets the link
      power management policy to "min_power".
      
      Additionally, libata drivers can define a function
      (enable_pm) that will perform hardware specific actions to
      enable whatever power management policy the user set up
      for Host Initiated Power management (HIPM).
      This power management policy will be activated after all
      disks have been enumerated and intialized.  Drivers should
      also define disable_pm, which will turn off link power
      management, but not change link power management policy.
      
      Documentation/scsi/link_power_management_policy.txt has additional
      information.
      Signed-off-by: NKristen Carlson Accardi <kristen.c.accardi@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      ca77329f
    • T
      libata: no need to speed down if already at PIO0 · 4fb4615b
      Tejun Heo 提交于
      After reset, transfer mode is always PIO0 regardless of
      dev->xfer_mask.  Check dev->pio_mode before trying to slow down after
      configuration failure.  This prevents bogus speed down before device
      is actually configured.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Acked-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4fb4615b
    • T
      libata: relocate forcing PIO0 on reset · cdeab114
      Tejun Heo 提交于
      Forcing PIO0 on reset was done inside ata_bus_softreset(), which is a
      bit out of place as it should be applied to all resets - hard, soft
      and implementation which don't use ata_bus_softreset().  Relocate it
      such that...
      
      * For new EH, it's done in ata_eh_reset() before calling prereset.
      
      * For old EH, it's done before calling ap->ops->phy_reset() in
        ata_bus_probe().
      
      This makes PIO0 forced after all resets.  Another difference is that
      reset itself is done after PIO0 is forced.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Acked-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cdeab114
    • T
      libata: track SLEEP state and issue SRST to wake it up · 054a5fba
      Tejun Heo 提交于
      ATA devices in SLEEP mode don't respond to any commands.  SRST is
      necessary to wake it up.  Till now, when a command is issued to a
      device in SLEEP mode, the command times out, which makes EH reset the
      device and retry the command after that, causing a long delay.
      
      This patch makes libata track SLEEP state and issue SRST automatically
      if a command is about to be issued to a device in SLEEP.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Bruce Allen <ballen@gravity.phys.uwm.edu>
      Cc: Andrew Paprocki <andrew@ishiboo.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      054a5fba
  13. 25 10月, 2007 1 次提交
    • T
      libata: cosmetic clean up in ata_eh_reset() · 0e06d9ce
      Tejun Heo 提交于
      Local variable @action usage in ata_eh_reset() is a bit confusing.
      It's used only to cache ehc->i.action to test reset masks after
      clearing it; however, due to the generic name "action", it's easy to
      misinterpret the local variable as containing the selected reset
      method later.  Also, the reason for caching the original value is easy
      to miss.
      
      This patch renames @action to @tmp_action and make it buffer newly
      selected value instead to improve readability.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      0e06d9ce
  14. 24 10月, 2007 1 次提交
  15. 13 10月, 2007 2 次提交
    • J
      [libata] struct pci_dev related cleanups · 2855568b
      Jeff Garzik 提交于
      * remove pointless pci_dev_to_dev() wrapper.  Just directly reference
        the embedded struct device like everyone else does.
      
      * pata_cs5520: delete cs5520_remove_one(), it was a duplicate of
        ata_pci_remove_one()
      
      * linux/libata.h: don't bother including linux/pci.h, we don't need it.
        Simply declare 'struct pci_dev' and assume interested parties will
        include the header, as they should be doing anyway.
      
      * linux/libata.h: consolidate all CONFIG_PCI declarations into a
        single location in the header.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      2855568b
    • 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