1. 02 12月, 2006 1 次提交
    • T
      [PATCH] libata: implement ATA_EHI_PRINTINFO · efdaedc4
      Tejun Heo 提交于
      Implement ehi flag ATA_EHI_PRINTINFO.  This flag is set when device
      configuration needs to print out device info.  This used to be handled
      by @print_info argument to ata_dev_configure() but LLDs also need to
      know about it in ->dev_config() callback.
      
      This patch replaces @print_info w/ ATA_EHI_PRINTINFO and make sata_sil
      print workaround messages only on the initial configuration.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      efdaedc4
  2. 27 9月, 2006 1 次提交
  3. 24 8月, 2006 1 次提交
    • J
      libata: Grand renaming. · cca3974e
      Jeff Garzik 提交于
      The biggest change is that ata_host_set is renamed to ata_host.
      
      * ata_host_set			=> ata_host
      * ata_probe_ent->host_flags	=> ata_probe_ent->port_flags
      * ata_probe_ent->host_set_flags	=> ata_probe_ent->_host_flags
      * ata_host_stats		=> ata_port_stats
      * ata_port->host		=> ata_port->scsi_host
      * ata_port->host_set		=> ata_port->host
      * ata_port_info->host_flags	=> ata_port_info->flags
      * ata_(.*)host_set(.*)\(\)	=> ata_\1host\2()
      
      The leading underscore in ata_probe_ent->_host_flags is to avoid
      reusing ->host_flags for different purpose.  Currently, the only user
      of the field is libata-bmdma.c and probe_ent itself is scheduled to be
      removed.
      
      ata_port->host is reused for different purpose but this field is used
      inside libata core proper and of different type.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cca3974e
  4. 10 8月, 2006 1 次提交
  5. 20 7月, 2006 3 次提交
    • T
      [PATCH] libata: improve EH action and EHI flag handling · 13abf50d
      Tejun Heo 提交于
      Update ata_eh_about_to_do() and ata_eh_done() to improve EH action and
      EHI flag handling.
      
      * There are two types of EHI flags - one which expires on successful
        EH and the other which expires on a successful reset.  Make this
        distinction clear.
      
      * Unlike other EH actions, reset actions are represented by two EH
        action masks and a EHI modifier.  Implement correct about_to_do/done
        semantics for resets.  That is, prior to reset, related EH info is
        sucked in from ehi and cleared, and after reset is complete, related
        EH info in ehc is cleared.
      
      These changes improve consistency and remove unnecessary EH actions
      caused by stale EH action masks and EHI flags.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      13abf50d
    • T
      [PATCH] libata: fix eh_skip_recovery condition · 7c8c2cff
      Tejun Heo 提交于
      * (ata_dev_absent() || ata_dev_ready()) test doesn't indicate
        SUSPENDED state properly.  Fix it.
      
      * Link resuming resets shouldn't be skipped.  Don't skip recovery on
        EHI_RESUME_LINK.  This doesn't matter for host ports as EHI_RESUME
        always coincides with EHI_HOTPLUGGED which makes attached disabled
        devices vacant.  However, PMP reset causes non-hotplug link-resuming
        resets which shouldn't be skipped.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      7c8c2cff
    • T
      [PATCH] libata: fix autopsy ehc->i.action and ehc->i.dev handling · 4528e4da
      Tejun Heo 提交于
      Commit 0662c58b updated
      ata_eh_autopsy() to OR determined action to ehc->i.action to preserve
      action mask set directly into ehc->i.action by nested functions.  This
      broke action mask clearing on SENSE_VALID case causing revalidation
      and EH complete message on successful ATAPI CC.
      
      This patch removes two local variables - action and failed_dev - which
      cache ehc->i.action and ehc->i.dev respectively, and make the function
      directly modify ehc->i.* fields to remove aliasing issues.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4528e4da
  6. 06 7月, 2006 6 次提交
    • T
      [PATCH] libata: reimplement controller-wide PM · 500530f6
      Tejun Heo 提交于
      Reimplement controller-wide PM.  ata_host_set_suspend/resume() are
      defined to suspend and resume a host_set.  While suspended, EHs for
      all ports in the host_set are pegged using ATA_FLAG_SUSPENDED and
      frozen.
      
      Because SCSI device hotplug is done asynchronously against the rest of
      libata EH and the same mutex is used when adding new device, suspend
      cannot wait for hotplug to complete.  So, if SCSI device hotplug is in
      progress, suspend fails with -EBUSY.
      
      In most cases, host_set resume is followed by device resume.  As each
      resume operation requires a reset, a single host_set-wide resume
      operation may result in multiple resets.  To avoid this, resume waits
      upto 1 second giving PM to request resume for devices.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      500530f6
    • T
      [PATCH] libata: implement PM EH actions · 02670bf3
      Tejun Heo 提交于
      Implement two PM per-dev EH actions - ATA_EH_SUSPEND and
      ATA_EH_RESUME.  Each action puts the target device into suspended mode
      and resumes from it respectively.
      
      Once a device is put to suspended mode, no EH operations other than
      RESUME is allowed on the device.  The device will stay suspended till
      it gets resumed and thus reset and revalidated.  To implement this, a
      new device state helper - ata_dev_ready() - is implemented and used in
      EH action implementations to make them operate only on attached &
      running devices.
      
      If all possible devices on a port are suspended, reset is skipped too.
      This prevents spurious events including hotplug events from disrupting
      suspended devices.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      02670bf3
    • T
      [PATCH] libata: implement ATA_EHI_NO_AUTOPSY and QUIET · 1cdaf534
      Tejun Heo 提交于
      Implement ATA_EHI_NO_AUTOPSY and QUIET.  These used to be implied by
      ATA_PFLAG_LOADING, but new power management and PMP support need to
      use these separately.  e.g. Suspend/resume operations shouldn't print
      full EH messages and resume shouldn't be recorded as an error.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1cdaf534
    • T
      [PATCH] libata: replace ap_lock w/ ap->lock in ata_scsi_error() · e30349d2
      Tejun Heo 提交于
      ap_lock was used because &ap->host_set->lock was too long and used a
      lot.  Now that &ap->host_set->lock is replaced with ap->lock, there's
      no reason to keep ap_lock.
      
      [ed. note: that's not entirely true.  ap_lock is a local variable,
      caching the results of a de-ref.  In theory, if the compiler is smart
      enough, this patch is cosmetic.  However, since this is not a fast
      path (it is the error path), this patch is nonetheless acceptable,
      even though it _may_ introduce a performance regression.]
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      e30349d2
    • T
      [PATCH] libata: fix ehc->i.action setting in ata_eh_autopsy() · 0662c58b
      Tejun Heo 提交于
      ata_eh_autopsy() used to directly assign determined action mask to
      ehc->i.action thus overriding actions set by some of nested analyze
      functions.  This patch makes ata_eh_autopsy() add action masks just as
      it's done in other places.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      0662c58b
    • T
      [PATCH] libata: add ap->pflags and move core dynamic flags to it · b51e9e5d
      Tejun Heo 提交于
      ap->flags is way too clamped.  Separate out core dynamic flags to
      ap->pflags.  ATA_FLAG_DISABLED is a dynamic flag but left alone as
      it's referenced by a lot of LLDs and it's gonna be removed once all
      LLDs are converted to new EH.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      b51e9e5d
  7. 27 6月, 2006 3 次提交
  8. 23 6月, 2006 2 次提交
  9. 12 6月, 2006 3 次提交
  10. 11 6月, 2006 1 次提交
  11. 31 5月, 2006 10 次提交
    • T
      [PATCH] libata-hp: move ata_do_reset() to libata-eh.c · d87fa38e
      Tejun Heo 提交于
      With ops->probe_init() gone, no user is left in libata-core.c.  Move
      ata_do_reset() to libata-eh.c and make it static.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      d87fa38e
    • T
      [PATCH] libata-hp: update unload-unplug · 720ba126
      Tejun Heo 提交于
      Update unload unplug - driver unloading / PCI removal.  This is done
      by ata_port_detach() which short-circuits EH, disables all devices and
      freezes the port.  With this patch, EH and unloading/unplugging are
      properly synchronized.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      720ba126
    • T
      [PATCH] libata-hp: implement bootplug · 3e706399
      Tejun Heo 提交于
      Implement bootplug - boot probing via hotplug path.  While loading,
      ata_host_add() simply schedules probing and invokes EH.  After EH
      completes, ata_host_add() scans and assicates them with SCSI devices.
      EH path is slightly modified to handle this (e.g. no autopsy during
      bootplug).  The SCSI part is left in ata_host_add() because it's
      shared with legacy path and to keep probing order as before (ATA scan
      all ports in host_set then attach all).
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      3e706399
    • T
      [PATCH] libata-hp: implement SCSI part of hotplug · 580b2102
      Tejun Heo 提交于
      Implement SCSI part of hotplug.
      
      This must be done in a separate context as SCSI makes use of EH during
      probing.  SCSI scan fails silently if EH is in progress.  In such
      cases, libata pauses briefly and retries until every device is
      attached.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      580b2102
    • T
      [PATCH] libata-hp: implement hotplug · 084fe639
      Tejun Heo 提交于
      Implement ATA part of hotplug.  To avoid probing broken devices over
      and over again, disabled devices are not automatically detached.  They
      are detached only if probing is requested for the device or the
      associated port is offline.  Also, to avoid infinite probing loop,
      Each device is probed only once per EH run.
      
      As SATA PHY status is fragile, devices are detached only after it has
      used up its recovery chances unless explicitly requested by LLDD or
      user (LLDD may request direct detach if, for example, it supports cold
      presence detection).
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      084fe639
    • T
      [PATCH] libata-hp: implement ata_eh_detach_dev() · 0ea035a3
      Tejun Heo 提交于
      Implement ata_eh_detach_dev().  This function is responsible for
      detaching an ATA device and offlining the associated SCSI device
      atomically so that the detached device is not accessed after ATA
      detach is complete.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      0ea035a3
    • T
      [PATCH] libata-hp-prep: implement followup softreset handling · 664faf09
      Tejun Heo 提交于
      In some cases, hardreset must be followed by SRST.
      
      * some controllers can't classify with hardreset
      * some controllers can't wait for !BSY after hardreset (LLDD should
        explicitly request followup softreset by returning -EAGAIN)
      * (later) PM needs SRST w/ PMP==15 to operate after hardreset
      
      To handle above cases, this patch implements follow-up softreset.
      After a hardreset, ata_eh_reset() checks whether any of above
      conditions are met and do a follow-up softreset if necessary.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      664faf09
    • T
      [PATCH] libata-hp-prep: add prereset() method and implement ata_std_prereset() · f5914a46
      Tejun Heo 提交于
      With hotplug, every reset might be a probing reset and thus something
      similar to probe_init() is needed.  prereset() method is called before
      a series of resets to a port and is the counterpart of postreset().
      prereset() can tell EH to use different type of reset or skip reset by
      modifying ehc->i.action.
      
      This patch also implements ata_std_prereset().  Most controllers
      should be able to use this function directly or with some wrapping.
      After hotplug, different controllers need different actions to resume
      the PHY and detect the newly attached device.  Controllers can be
      categorized as follows.
      
      * Controllers which can wait for the first D2H FIS after hotplug.
        Note that if the waiting is implemented by polling TF status, there
        needs to be a way to set BSY on PHY status change.  It can be
        implemented by hardware or with the help of the driver.
      
      * Controllers which can wait for the first D2H FIS after sending
        COMRESET.  These controllers need to issue COMRESET to wait for the
        first FIS.  Note that the received D2H FIS could be the first D2H
        FIS after POR (power-on-reset) or D2H FIS in response to the
        COMRESET.  Some controllers use COMRESET as TF status
        synchronization point and clear TF automatically (sata_sil).
      
      * Controllers which cannot wait for the first D2H FIS reliably.
        Blindly issuing SRST to spinning-up device often results in command
        issue failure or timeout, causing extended delay.  For these
        controllers, ata_std_prereset() explicitly waits ATA_SPINUP_WAIT
        (currently 8s) to give newly attached device time to spin up, then
        issues reset.  Note that failing to getting ready in ATA_SPINUP_WAIT
        is not critical.  libata will retry.  So, the timeout needs to be
        long enough to spin up most devices.
      
      LLDDs can tell ata_std_prereset() which of above action is needed with
      ATA_FLAG_HRST_TO_RESUME and ATA_FLAG_SKIP_D2H_BSY flags.  These flags
      are PHY-specific property and will be moved to ata_link later.
      
      While at it, this patch unifies function typedef's such that they all
      have named arguments.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      f5914a46
    • T
      [PATCH] libata: implement ata_eh_wait() · c6cf9e99
      Tejun Heo 提交于
      Implement ata_eh_wait().  On return from this function, it's
      guaranteed that the EH which was pending or in progress when the
      function was called is complete - including the tailing part of SCSI
      EH.  This will be used by hotplug and others to synchronize with EH.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      c6cf9e99
    • T
      [PATCH] libata: set PIO-0 after successful EH reset · 20952b69
      Tejun Heo 提交于
      Set ata_device->pio_mode to XFER_PIO_0 after a successful reset.  This
      is to keep EH resets consistent with probe resets as updated by the
      commit b6079ca4.  Note that, with
      soon-to-follow hotplug update, EH resets will include probe resets.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      20952b69
  12. 20 5月, 2006 2 次提交
    • T
      [PATCH] SCSI: make scsi_implement_eh() generic API for SCSI transports · f8bbfc24
      Tejun Heo 提交于
      libata implemented a feature to schedule EH without an associated EH
      by manipulating shost->host_eh_scheduled in ata_scsi_schedule_eh()
      directly.  Move this function to scsi_error.c and rename it to
      scsi_schedule_eh().  It is now an exported API for SCSI transports and
      exported via new header file drivers/scsi/scsi_transport_api.h
      
      This patch also de-export scsi_eh_wakeup() which was exported
      specifically for ata_scsi_schedule_eh().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f8bbfc24
    • T
      [PATCH] libata: enforce default EH actions · a20f33ff
      Tejun Heo 提交于
      LLDDs rely on libata that certain EH actions are automatically taken
      on some errors.  If the port is frozen or one or more qc's have failed
      with HSM violation or timeout, softreset is enforced (LLDD can ask for
      storonger EH action at will).  If any other error condition exists,
      libata EH always revalidates.
      
      This behavior existed in earlier revisions of new EH but lost during
      development process.  This patch restores it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a20f33ff
  13. 15 5月, 2006 6 次提交
    • T
      [PATCH] libata-ncq: update EH to handle NCQ · e8ee8451
      Tejun Heo 提交于
      Update EH to handle NCQ.  ata_eh_autopsy() is updated to call
      ata_eh_analyze_ncq_error() which reads log page 10h on NCQ device
      error and updates eh_context accordingly.  ata_eh_report() is updated
      to report SActive.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      e8ee8451
    • T
      [PATCH] libata-eh: implement new EH · 022bdb07
      Tejun Heo 提交于
      Implement new EH.  The exported interface is ata_do_eh() which is to
      be called from ->error_handler and performs the following steps to
      recover the failed port.
      
      ata_eh_autopsy() : analyze SError/TF, determine the cause of failure
      		   and required recovery actions and record it in
      		   ap->eh_context
      ata_eh_report()	 : report the failure to user
      ata_eh_recover() : perform recovery actions described in ap->eh_context
      ata_eh_finish()	 : finish failed qcs
      
      LLDDs can customize error handling by modifying eh_context before
      calling ata_do_eh() or, if necessary, doing so inbetween each major
      steps by calling each step explicitly.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      022bdb07
    • T
      [PATCH] libata-eh: implement ata_eh_info and ata_eh_context · f3e81b19
      Tejun Heo 提交于
      struct ata_eh_info serves as the communication channel between
      execution path and EH.  Execution path describes detected error
      condition in ap->eh_info and EH recovers the port using it.  To avoid
      missing error conditions detected during EH, EH makes its own copy of
      eh_info and clears it on entry allowing error info to accumulate
      during EH.
      
      Most EH states including EH's copy of eh_info are stored in
      ap->eh_context (struct ata_eh_context) which is owned by EH and thus
      doesn't require any synchronization to access and alter.  This
      standardized context makes it easy to integrate various parts of EH
      and extend EH to handle multiple links (for PM).
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      f3e81b19
    • T
      [PATCH] libata-eh: implement dev->ering · 0c247c55
      Tejun Heo 提交于
      This patch implements ata_ering and uses it to define dev->ering.
      
      ata_ering is a ring buffer which records libata errors - whether a
      command was for normar IO request, err_mask and timestamp.  Errors are
      recorded per-device in dev->ering.  This will be used by EH to
      determine recovery actions.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      0c247c55
    • T
      [PATCH] libata-eh-fw: update ata_scsi_error() for new EH · ad9e2762
      Tejun Heo 提交于
      Update ata_scsi_error() for new EH.  ata_scsi_error() is responsible
      for claiming timed out qcs and invoking ->error_handler in safe and
      synchronized manner.  As the state of the controller is unknown if a
      qc has timed out, the port is frozen in such cases.
      
      Note that ata_scsi_timed_out() isn't used for new EH.  This is because
      a timed out qc cannot be claimed by EH without freezing the port and
      freezing the port in ata_scsi_timed_out() results in unnecessary
      abortion of other active qcs.  ata_scsi_timed_out() can be removed
      once all drivers are converted to new EH.
      
      While at it, add 'TODO: kill' comments to old EH functions.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      ad9e2762
    • T
      [PATCH] libata-eh-fw: implement freeze/thaw · e3180499
      Tejun Heo 提交于
      Freezing is performed atomic w.r.t. host_set->lock and once frozen
      LLDD is not allowed to access the port or any qc on it.  Also, libata
      makes sure that no new qc gets issued to a frozen port.
      
      A frozen port is thawed after a reset operation completes
      successfully, so reset methods must do its job while the port is
      frozen.  During initialization all ports get frozen before requesting
      IRQ, so reset methods are always invoked on a frozen port.
      
      Optional ->freeze and ->thaw operations notify LLDD that the port is
      being frozen and thawed, respectively.  LLDD can disable/enable
      hardware interrupt in these callbacks if the controller's IRQ mask can
      be changed dynamically.  If the controller doesn't allow such
      operation, LLDD can check for frozen state in the interrupt handler
      and ack/clear interrupts unconditionally while frozen.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      e3180499