1. 23 6月, 2006 1 次提交
    • T
      [PATCH] libata: implement per-dev EH action mask eh_info->dev_action[] · 47005f25
      Tejun Heo 提交于
      Currently, the only per-dev EH action is REVALIDATE.  EH used to
      exploit ehi->dev to do selective revalidation on a ATA bus.  However,
      this is a bit hacky and makes it impossible to request selective
      revalidation from outside of EH or add another per-dev EH action.
      
      This patch adds per-dev EH action mask eh_info->dev_action[] and
      update EH to use this field for REVALIDATE.  Note that per-dev actions
      can still be specified at port-level and it has the same effect of
      specifying the action for all devices on the port.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      47005f25
  2. 12 6月, 2006 2 次提交
    • T
      [PATCH] libata: add host_set->next for legacy two host_sets case, take #3 · f0eb62b8
      Tejun Heo 提交于
      For a legacy ATA controller, libata registers two separate host sets.
      There was no connection between the two hosts making it impossible to
      traverse all ports related to the controller.  This patch adds
      host_set->next which points to the second host_set and makes
      ata_pci_remove_one() remove all associated host_sets.
      
      * On device removal, all ports hanging off the device are properly
        detached.  Prior to this patch, ports on the first host_set weren't
        detached casuing oops on driver unloading.
      
      * On device removal, both host_sets are properly freed
      
      This will also be used by new power management code to suspend and
      resume all ports of a controller.  host_set/port representation will
      be improved to handle legacy controllers better and this host_set
      linking will go away with it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f0eb62b8
    • J
  3. 11 6月, 2006 1 次提交
  4. 31 5月, 2006 14 次提交
    • T
      [PATCH] libata-hp: killl ops->probe_reset · 52783c5d
      Tejun Heo 提交于
      Now that all drivers implementing new EH are converted to new probing
      mechanism, ops->probe_reset doesn't have any user.  Kill it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      52783c5d
    • 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 warmplug · 83c47bcb
      Tejun Heo 提交于
      Implement warmplug.  User-initiated unplug can be detected by
      hostt->slave_destroy() and plug by transportt->user_scan().  This
      patch only implements the two callbacks.  The next function will hook
      them.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      83c47bcb
    • 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: export ata_hsm_move() · 9a1004d0
      Tejun Heo 提交于
      ata_hsm_move() will be used by LLDDs which depend on standard PIO HSM
      but implement their own interrupt handlers.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      9a1004d0
    • 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-hp-prep: implement sata_phy_debounce() · d7bb4cc7
      Tejun Heo 提交于
      With hotplug, PHY always needs to be debounced before a reset as any
      reset might find new devices.  Extract PHY waiting code from
      sata_phy_resume() and extend it to include SStatus debouncing.  Note
      that sata_phy_debounce() is superset of what used to be done inside
      sata_phy_resume().
      
      Three default debounce timing parameters are defined to be used by
      hot/boot plug.  As resume failure during probing will be properly
      handled as errors, timeout doesn't have to be long as before.
      probeinit() uses the same timeout to retain the original behavior.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      d7bb4cc7
    • T
      [PATCH] libata-hp-prep: store attached SCSI device · 3edebac4
      Tejun Heo 提交于
      Add device persistent field dev->sdev and store the attached SCSI
      device.  With hotplug, libata needs to know the attached SCSI device
      to offline and detach it, but scsi_device_lookup() cannot be used
      because libata will reuse SCSI ID numbers - dead but not gone devices
      (due to zombie opens, etc...) interfere with the lookup.
      
      dev->sdev doesn't hold reference to the SCSI device.  It's cleared
      when the SCSI device goes away.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      3edebac4
    • T
      [PATCH] libata-hp-prep: implement ap->hw_sata_spd_limit · 5a04bf4b
      Tejun Heo 提交于
      Add ap->hw_sata_spd_limit and initialize it once during the boot
      initialization (or driver load initialization).  ap->sata_spd_limit is
      reset to ap->hw_sata_spd_limit on hotplug.  This prevents spd limits
      introduced by earlier devices from affecting new devices.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      5a04bf4b
    • T
      [PATCH] libata-hp-prep: make some ata_device fields persistent · 72fa4b74
      Tejun Heo 提交于
      Lifetimes of some fields span over device plugging/unplugging.  This
      patch moves such persistent fields to the top of ata_device and
      separate them with ATA_DEVICE_CLEAR_OFFSET.  Fields above the offset
      are initialized once during host initializatino while all other fields
      are cleared before hotplugging.  Currently ->ap, devno and part of
      flags are persistent.
      
      Note that flags is partially cleared while holding host_set lock.
      This is to synchronize with later warm plug implementation which will
      record hotplug request in dev->flags.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      72fa4b74
    • T
      [PATCH] libata-hp-prep: add flags and eh_info/context fields for hotplug · abdda733
      Tejun Heo 提交于
      Add hotplug related flags and eh_info/context fields.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      abdda733
    • 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: shift host flag constants · 7395acb2
      Tejun Heo 提交于
      Nudge host flag constants to make a room after ATA_FLAG_EH_PENDING.
      New EH flag will be added.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      7395acb2
  5. 27 5月, 2006 1 次提交
  6. 24 5月, 2006 2 次提交
  7. 20 5月, 2006 1 次提交
  8. 15 5月, 2006 18 次提交
    • T
      [PATCH] libata-ncq: implement NCQ device configuration · a6e6ce8e
      Tejun Heo 提交于
      Now that all NCQ related stuff are in place, implement NCQ device
      configuration and bump ATA_MAX_QUEUE to 32 thus activating NCQ
      support.
      
      Original implementation is from Jens Axboe.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      a6e6ce8e
    • T
      [PATCH] libata-ncq: implement ap->qc_active, ap->sactive and complete helper · dedaf2b0
      Tejun Heo 提交于
      Add ap->qc_active and ap->sactive, mask of all active qcs and libata's
      view of the SActive register, respectively.  Also, implement
      ata_qc_complete_multiple() which takes new qc_active mask and complete
      multiple qcs according to the mask.
      
      These will be used to track NCQ commands and complete them.  The
      distinction between ap->qc_active and ap->sactive is also useful for
      later PM implementation.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      dedaf2b0
    • T
      [PATCH] libata-ncq: rename ap->qactive to ap->qc_allocated · 6cec4a39
      Tejun Heo 提交于
      Rename ap->qactive to ap->qc_allocated.  This is to accomodate
      addition of ap->qc_active, mask of active qcs.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      6cec4a39
    • T
      [PATCH] libata-ncq: add NCQ related ATA/libata constants and macros · 88e49034
      Tejun Heo 提交于
      Add NCQ related ATA/libata constants and macros.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      88e49034
    • T
      [PATCH] libata-eh: implement BMDMA EH · 6d97dbd7
      Tejun Heo 提交于
      Implement stock BMDMA error handling methods.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      6d97dbd7
    • 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: add ATA and libata flags for new EH · 9be1e979
      Tejun Heo 提交于
      Add ATA and libata flags to be used by new EH.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      9be1e979
    • 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
    • T
      [PATCH] libata-eh-fw: implement ata_port_schedule_eh() and ata_port_abort() · 7b70fc03
      Tejun Heo 提交于
      ata_port_schedule_eh() directly schedules EH for @ap without
      associated qc.  Once EH scheduled, no further qc is allowed and EH
      kicks in as soon as all currently active qc's are drained.
      
      ata_port_abort() schedules all currently active commands for EH by
      qc_completing them with ATA_QCFLAG_FAILED set.  If ata_port_abort()
      doesn't find any qc to abort, it directly schedule EH using
      ata_port_schedule_eh().
      
      These two functions provide ways to invoke EH for conditions which
      aren't directly related to any specfic qc.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      7b70fc03
    • T
      [PATCH] libata-eh-fw: implement new EH scheduling via error completion · f686bcb8
      Tejun Heo 提交于
      There are several ways a qc can get schedule for EH in new EH.  This
      patch implements one of them - completing a qc with ATA_QCFLAG_FAILED
      set or with non-zero qc->err_mask.  ALL such qc's are examined by EH.
      
      New EH schedules a qc for EH from completion iff ->error_handler is
      implemented, qc is marked as failed or qc->err_mask is non-zero and
      the command is not an internal command (internal cmd is handled via
      ->post_internal_cmd).  The EH scheduling itself is performed by asking
      SCSI midlayer to schedule EH for the specified scmd.
      
      For drivers implementing old-EH, nothing changes.  As this change
      makes ata_qc_complete() rather large, it's not inlined anymore and
      __ata_qc_complete() is exported to other parts of libata for later
      use.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      f686bcb8
    • T
      [PATCH] libata-eh-fw: update ata_qc_from_tag() to enforce normal/EH qc ownership · f69499f4
      Tejun Heo 提交于
      New EH framework has clear distinction about who owns a qc.  Every qc
      starts owned by normal execution path - PIO, interrupt or whatever.
      When an exception condition occurs which affects the qc, the qc gets
      scheduled for EH.  Note that some events (say, link lost and regained,
      command timeout) may schedule qc's which are not directly related but
      could have been affected for EH too.  Scheduling for EH is atomic
      w.r.t. ap->host_set->lock and once schedule for EH, normal execution
      path is not allowed to access the qc in whatever way.  (PIO
      synchronization acts a bit different and will be dealt with later)
      
      This patch make ata_qc_from_tag() check whether a qc is active and
      owned by normal path before returning it.  If conditions don't match,
      NULL is returned and thus access to the qc is denied.
      __ata_qc_from_tag() is the original ata_qc_from_tag() and is used by
      libata core/EH layers to access inactive/failed qc's.
      
      This change is applied only if the associated LLDD implements new EH
      as indicated by non-NULL ->error_handler
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      f69499f4
    • T
      [PATCH] libata-eh-fw: use special reserved tag and qc for internal commands · 2ab7db1f
      Tejun Heo 提交于
      New EH may issue internal commands to recover from error while failed
      qc's are still hanging around.  To allow such usage, reserve tag
      ATA_MAX_QUEUE-1 for internal command.  This also makes it easy to tell
      whether a qc is for internal command or not.  ata_tag_internal() test
      implements this test.
      
      To avoid breaking existing drivers, ata_exec_internal() uses
      ATA_TAG_INTERNAL only for drivers which implement ->error_handler.
      For drivers using old EH, tag 0 is used.  Note that this makes
      ata_tag_internal() test valid only when ->error_handler is
      implemented.  This is okay as drivers on old EH should not and does
      not have any reason to use ata_tag_internal().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      2ab7db1f
    • T
      [PATCH] libata-eh-fw: add flags and operations for new EH · 9ec957f2
      Tejun Heo 提交于
      Add ATA_FLAG_EH_{PENDING|FROZEN}, ATA_ATA_QCFLAG_{FAILED|SENSE_VALID}
      and ops->freeze, thaw, error_handler, post_internal_cmd() for new EH.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      9ec957f2
    • T
      [PATCH] libata: implement ATA printk helpers · 61440db6
      Tejun Heo 提交于
      Implement ata_{port|dev}_printk() which prefixes the message with
      proper identification string.  This change is necessary for later PM
      support because devices and links should be identified differently
      depending on how they are attached.
      
      This also helps unifying device id strings.  Currently, there are two
      forms in use (P is the port number D device number) - 'ataP(D):', and
      'ataP: dev D '.  These macros also make it harder to forget proper ID
      string (e.g. printing only port number when a device is in question).
      
      Debug message handling can be integrated into these printk macros by
      passing debug type and level via @lv.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      61440db6
    • T
      [PATCH] libata: use dev->ap · 3373efd8
      Tejun Heo 提交于
      Use dev->ap where possible and eliminate superflous @ap from functions
      and structures.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      3373efd8