1. 23 1月, 2008 4 次提交
  2. 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
  3. 18 12月, 2007 1 次提交
  4. 02 12月, 2007 1 次提交
  5. 19 11月, 2007 1 次提交
  6. 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
  7. 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
  8. 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
  9. 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
  10. 24 10月, 2007 1 次提交
  11. 13 10月, 2007 19 次提交
    • 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
    • T
      libata: implement ATA_PFLAG_RESETTING · afaa5c37
      Tejun Heo 提交于
      Implement ATA_PFLAG_RESETTING.  This flag is set while reset is in
      progress.  It's set before prereset is called and cleared after reset
      fails or postreset is finished.
      
      This flag itself doesn't have any function.  It will be used by LLDs
      to tell whether reset is in progress if it needs to behave differently
      during reset.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      afaa5c37
    • T
      libata: add @timeout to ata_exec_internal[_sg]() · 2b789108
      Tejun Heo 提交于
      Add @timeout argument to ata_exec_internal[_sg]().  If 0, default
      timeout ata_probe_timeout is used.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      2b789108
    • T
      libata: wrap schedule_timeout_uninterruptible() in loop · 90738683
      Tejun Heo 提交于
      Tasks in uninterruptible sleep might be woken up by unrelated events
      and should check whether the condition it was waiting for has actually
      triggered.  Wrap schedule_timeout_uninterruptible() in loop to achieve
      it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      90738683
    • T
      libata: skip suppress reporting if ATA_EHI_QUIET · 94ff3d54
      Tejun Heo 提交于
      ATA_EHI_NO_AUTOPSY and ATA_EHI_QUIET are used during initial probing
      to skip exception analysis and reporting.  Usually, there's nothing to
      report but on some allowed but rare corner cases (e.g. phy status
      changed interrupt when IRQ is enabled on frozen port - this happens if
      IRQ pending status isn't cleared in the IRQ router or controller)
      exception messages get printed.
      
      Skip reporting if ATA_EHI_QUIET is set.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      94ff3d54
    • R
      libata: add human-readable error value decoding · 1333e194
      Robert Hancock 提交于
      This adds human-readable decoding of the ATA status and error registers
      (similar to what drivers/ide does) as well as the SATA Serror register
      to libata error handling output.  This prevents the need to pore
      through standards documents to figure out the meaning of the bits
      in these registers when looking at error reports.  Some bits that
      drivers/ide decoded are not decoded here, since the bits are either
      command-dependent or obsolete, and properly parsing them would add
      too much complexity.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      
      [edited slightly to make output a bit more symmetric]
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1333e194
    • T
      libata-pmp: hook PMP support and enable it · 633273a3
      Tejun Heo 提交于
      Hook PMP support into libata and enable it.  Connect SCR and probing
      functions, and update ata_dev_classify() to detect PMP.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      633273a3
    • T
      libata-pmp: update ata_eh_reset() for PMP · 3495de73
      Tejun Heo 提交于
      PMP always requires SRST to be enabled.  Also, hardreset reports
      classification code from the first device when PMP is attached, not
      from the PMP.  Update ata_eh_reset() such that followup softreset is
      performed if the controller is PMP capable and the host link is being
      reset.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      3495de73
    • 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 EH fast-fail path · 668108d7
      Tejun Heo 提交于
      If PMP itself becomes inaccessible while trying to link a downstream
      link, spending time to recover the downstream link doesn't make any
      sense.  Make EH skip retry and fail fast if -ERESTART is received.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      668108d7
    • T
      libata-pmp-prep: implement ATA_LFLAG_DISABLED · f9df58cb
      Tejun Heo 提交于
      Implement ATA_LFLAG_DISABLED.  The flag indicates the link is disabled
      due to EH recovery failure.  While a link is disabled, no EH action is
      taken on the link and suspend/resume become noop too.
      
      This will be used by PMP links to manage failed links.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f9df58cb
    • T
      libata-pmp-prep: implement ATA_LFLAG_NO_RETRY · fd995f70
      Tejun Heo 提交于
      Some PMP links are connected to internal pseudo devices which may come
      and go depending on situation.  There's no reason to try hard to
      recover them.  ATA_LFLAG_NO_RETRY tells EH to not retry if the device
      attached to the link fails.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      fd995f70
    • T
      libata-pmp-prep: implement ATA_LFLAG_NO_SRST, ASSUME_ATA and ASSUME_SEMB · ae791c05
      Tejun Heo 提交于
      Some links on some PMPs locks up on SRST and/or report incorrect
      device signature.  Implement ATA_LFLAG_NO_SRST, ASSUME_ATA and
      ASSUME_SEMB to handle these quirky links.  NO_SRST makes EH avoid
      SRST.  ASSUME_ATA and SEMB forces class code to ATA and SEMB_UNSUP
      respectively.  Note that SEMB isn't currently supported yet so the
      _UNSUP variant is used.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      ae791c05
    • T
      libata-pmp-prep: implement qc_defer helpers · da917d69
      Tejun Heo 提交于
      Implement ap->nr_active_links (the number of links with active qcs),
      ap->excl_link (pointer to link which can be used by ->qc_defer and is
      cleared when a qc with ATA_QCFLAG_CLEAR_EXCL completes), and
      ata_link_active().
      
      These can be used by ->qc_defer() to implement proper command
      exclusion.  This set of helpers seem enough for both sil24 (ATAPI
      exclusion needed) and cmd-switching PMP.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      da917d69
    • T
      libata-pmp-prep: make a number of functions global to libata · fb7fd614
      Tejun Heo 提交于
      Make a number of functions from libata-core.c and libata-eh.c global
      to libata (drivers/ata/libata.h).  These will be used by PMP.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      fb7fd614
    • T
      libata-pmp-prep: add @new_class to ata_dev_revalidate() · 422c9daa
      Tejun Heo 提交于
      Consider newly found class code while revalidating.  PMP resetting
      always results in valid class code and issuing PMP commands to
      ATA/ATAPI device isn't very attractive.  Add @new_class to
      ata_dev_revalidate() and check class code for revalidation.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      422c9daa
    • T
      libata: move EH repeat reporting into ata_eh_report() · a1e10f7e
      Tejun Heo 提交于
      EH is sometimes repeated without any error or action.  For example,
      this happens when probing IDENTIFY fails because of a phantom device.
      In these cases, all the repeated EH does is making sure there is no
      unhandled error or pending action and return.  This repeation is
      necessary to avoid losing any event which occurred while EH was in
      progress.
      
      Unfortunately, this dry run causes annonying "EH pending after
      completion" message.  This patch moves the repeat reporting into
      ata_eh_report() such that it's more compact and skipped on dry runs.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Mikael Pettersson <mikep@it.uu.se>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a1e10f7e
    • 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