1. 22 5月, 2007 2 次提交
  2. 18 5月, 2007 2 次提交
  3. 12 5月, 2007 2 次提交
    • T
      libata: clean up SFF init mess · 1626aeb8
      Tejun Heo 提交于
      The intention of using port_mask in SFF init helpers was to eventually
      support exoctic configurations such as combination of legacy and
      native port on the same controller.  This never became actually
      necessary and the related code always has been subtly broken one way
      or the other.  Now that new init model is in place, there is no reason
      to make common helpers capable of handling all corner cases.  Exotic
      cases can simply dealt within LLDs as necessary.
      
      This patch removes port_mask handling in SFF init helpers.  SFF init
      helpers don't take n_ports argument and interpret it into port_mask
      anymore.  All information is carried via port_info.  n_ports argument
      is dropped and always two ports are allocated.  LLD can tell SFF to
      skip certain port by marking it dummy.  Note that SFF code has been
      treating unuvailable ports this way for a long time until recent
      breakage fix from Linus and is consistent with how other drivers
      handle with unavailable ports.
      
      This fixes 1-port legacy host handling still broken after the recent
      native mode fix and simplifies SFF init logic.  The following changes
      are made...
      
      * ata_pci_init_native_host() and ata_init_legacy_host() both now try
        to initialized whatever they can and mark failed ports dummy.  They
        return 0 if any port is successfully initialized.
      
      * ata_pci_prepare_native_host() and ata_pci_init_one() now doesn't
        take n_ports argument.  All info should be specified via port_info
        array.  Always two ports are allocated.
      
      * ata_pci_init_bmdma() exported to be used by LLDs in exotic cases.
      
      * port_info handling in all LLDs are standardized - all port_info
        arrays are const stack variable named ppi.  Unless the second port
        is different from the first, its port_info is specified as NULL
        (tells libata that it's identical to the last non-NULL port_info).
      
      * pata_hpt37x/hpt3x2n: don't modify static variable directly.  Make an
        on-stack copy instead as ata_piix does.
      
      * pata_uli: It has 4 ports instead of 2.  Don't use
        ata_pci_prepare_native_host().  Allocate the host explicitly and use
        init helpers.  It's simple enough.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1626aeb8
    • 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
  4. 10 5月, 2007 1 次提交
    • R
      sata_nv: fix ADMA freeze/thaw/irq_clear issues · 53014e25
      Robert Hancock 提交于
      This patch fixes some problems with ADMA-capable controllers with
      regard to freeze, thaw and irq_clear libata callbacks. Freeze and
      thaw didn't switch the ADMA-specific interrupts on or off, and more
      critically the irq_clear function didn't respect the restriction that
      the notifier clear registers for both ports have to be written at
      the same time even when only one port is being cleared. This could
      result in timeouts on one port when error handling (i.e. as a result
      of hotplug) occurred on the other port.
      
      As well, this fixes some issues in the interrupt handler: we shouldn't
      check any ADMA status if the port has ADMA switched off because of
      an ATAPI device, and it also checks to see if any ADMA interrupt has
      been raised even when we are in port-register mode.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      53014e25
  5. 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
  6. 29 4月, 2007 2 次提交
  7. 09 3月, 2007 1 次提交
    • R
      sata_nv: revert use of notifiers for now · 8ba5e4cb
      Robert Hancock 提交于
      Commit 721449bf added support for using the
      ADMA notifier bits to determine which commands to check for completion.
      However there have been reports that this causes command timeouts in certain
      cases. This is still being investigated. In addition, apparently the notifiers
      won't work if ADMA is disabled on the other port as a result of an ATAPI device
      being connected, and we don't handle this case properly.
      
      For now, just restore the previous behavior of checking all active commands
      to see if they are complete, without relying on the notifiers.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      8ba5e4cb
  8. 03 3月, 2007 1 次提交
  9. 26 2月, 2007 1 次提交
  10. 23 2月, 2007 2 次提交
    • R
      sata_nv: complain on spurious completion notifiers · 2a54cf76
      Robert Hancock 提交于
      Recently Tejun wrote a patch to ahci.c to make it raise a HSM violation
      if the drive attempted to complete a tag that wasn't outstanding. We could
      run into the same problem with sata_nv ADMA. This adds code to raise a HSM
      violation error if the controller gives us a notifier tag that isn't
      outstanding, since the drive may be issuing spurious completions.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      2a54cf76
    • R
      sata_nv: kill old private BMDMA helper functions · f5ecac2d
      Robert Hancock 提交于
      sata_nv implemented its own copies of the BMDMA helper functions for ADMA,
      since the ADMA BMDMA status registers are PIO while the other registers
      are MMIO, and this was the only way to handle this previously. Now that
      we have iomap support, the standard routines should just work, so use them.
      The only thing we need to override as far as ADMA and BMDMA is the
      post_internal_cmd callback, where we should only call ata_post_internal_cmd
      if we are in port-register mode.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f5ecac2d
  11. 21 2月, 2007 7 次提交
  12. 16 2月, 2007 1 次提交
  13. 10 2月, 2007 9 次提交
    • R
      sata_nv: propagate ata_pci_device_do_resume return value · ce053fa8
      Robert Hancock 提交于
      ata_pci_device_do_resume can fail if the PCI device couldn't be re-enabled.
       Update sata_nv to propagate the return value from this call and to not try
      to do any other resume activities if it fails.  Fixes a compile warning.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      ce053fa8
    • R
      sata_nv: wait for response on entering/leaving ADMA mode · a2cfe81a
      Robert Hancock 提交于
      Update sata_nv to wait for the controller to indicate via the status
      register that it has entered the requested state when switching between
      ADMA mode and register mode.  This issue came up recently when debugging
      some problems with cache flush command timeouts and while it didn't appear
      to fix that problem, this is something we should likely be doing in any
      case.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Cc: Tejun Heo <htejun@gmail.com>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a2cfe81a
    • R
      sata_nv: use ADMA for NODATA commands · 382a6652
      Robert Hancock 提交于
      Some problems showed up recently with cache flush commands timing out on
      sata_nv.  Previously these commands were always handled by transitioning to
      legacy mode from ADMA mode first.  The timeout problem was worked around
      already by a change to the interrupt handling code for legacy mode, but for
      non-data commands like these it appears we can handle them in ADMA mode, so
      the switch to legacy mode is not needed.
      
      This patch changes the behavior so that we use ADMA mode to submit
      interrupt-driven commands with ATA_PROT_NODATA protocol.  In addition to
      avoiding the problem mentioned above entirely, this avoids the overhead of
      switching to legacy mode and back to ADMA mode for handling cache flushes.
      When handling non-DMA-mapped commands, we leave the APRD blank and clear
      the NV_CPB_CTL_APRD_VALID field in the CPB so the controller does not
      attempt to read it.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Cc: Jeff Garzik <jeff@garzik.org>
      Cc: Tejun Heo <htejun@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      382a6652
    • R
      sata_nv: cleanup ADMA error handling · 5bd28a4b
      Robert Hancock 提交于
      This cleans up a few issues with the error handling in sata_nv in ADMA mode
      to make it more consistent with other NCQ-capable drivers like ahci and
      sata_sil24:
      
      - When a command failed, we would effectively set AC_ERR_DEV on the
        queued command always.  In the case of NCQ commands this prevents libata
        from doing a log page query to determine the details of the failed
        command, since it thinks we've already analyzed.  Just set flags in the
        port ehi->err_mask, then freeze or abort and let libata figure out what
        went wrong.
      
      - The code handled NV_ADMA_STAT_CPBERR as a "really bad error" which
        caused it to set error flags on every queued command.  I don't know
        exactly what this flag means (no docs, grr!) but from what I can guess
        from the standard ADMA spec, it just means that one or more of the CPBs
        had an error, so we just need to go through and do our normal checks in
        this case.
      
      - In the error_handler function the code would always dump the state of
        all the CPBs.  This output seems redundant at this point since libata
        already dumps the state of all active commands on errors (and it also
        triggers at times when it shouldn't, like when suspending).  Take this
        out.
      
      [akpm@osdl.org: many coding-style fixes]
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Cc: Jeff Garzik <jeff@garzik.org>
      Cc: Tejun Heo <htejun@gmail.com>
      Cc: Allen Martin <AMartin@nvidia.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      5bd28a4b
    • 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
    • R
      sata_nv: add suspend/resume support v3 (Resubmit) · cdf56bcf
      Robert Hancock 提交于
      Thoughts from Jeff & company on merging the patch below into libata-dev?
      This has been in the -mm tree for over a month now, I haven't heard any
      complaints about regressions..
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cdf56bcf
    • J
      [libata] trim trailing whitespace · f20b16ff
      Jeff Garzik 提交于
      Most of these contributed by that mysterious figger known as A.C.
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f20b16ff
  14. 24 1月, 2007 1 次提交
    • R
      sata_nv: don't rely on NV_INT_DEV indication with ADMA · f740d168
      Robert Hancock 提交于
      Several people reported issues with certain drive commands timing out on
      sata_nv controllers running in ADMA mode. The commands in question were
      non-DMA-mapped commands, usually FLUSH CACHE or FLUSH CACHE EXT.
      
       From experimentation it appears that the NV_INT_DEV indication isn't
      always set when a legitimate command completion interrupt is received on
      a legacy-mode command, at least not on these controllers in ADMA mode.
      When a command is pending on the port, force the flag on always in the
      irq_stat value before calling nv_host_intr so that the drive busy state
      is always checked by ata_host_intr.
      
      This also fixes some questionable code in nv_host_intr which called
      ata_check_status when a command was pending and ata_host_intr returned
      "unhandled". If the device interrupted at just the wrong time this could
      cause interrupts to be lost.
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f740d168
  15. 21 12月, 2006 1 次提交
  16. 03 12月, 2006 1 次提交
  17. 02 12月, 2006 3 次提交
  18. 01 11月, 2006 1 次提交
  19. 05 10月, 2006 1 次提交
    • D
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells 提交于
      Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
      of passing regs around manually through all ~1800 interrupt handlers in the
      Linux kernel.
      
      The regs pointer is used in few places, but it potentially costs both stack
      space and code to pass it around.  On the FRV arch, removing the regs parameter
      from all the genirq function results in a 20% speed up of the IRQ exit path
      (ie: from leaving timer_interrupt() to leaving do_IRQ()).
      
      Where appropriate, an arch may override the generic storage facility and do
      something different with the variable.  On FRV, for instance, the address is
      maintained in GR28 at all times inside the kernel as part of general exception
      handling.
      
      Having looked over the code, it appears that the parameter may be handed down
      through up to twenty or so layers of functions.  Consider a USB character
      device attached to a USB hub, attached to a USB controller that posts its
      interrupts through a cascaded auxiliary interrupt controller.  A character
      device driver may want to pass regs to the sysrq handler through the input
      layer which adds another few layers of parameter passing.
      
      I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
      main part of the code on FRV and i386, though I can't test most of the drivers.
      I've also done partial conversion for powerpc and MIPS - these at least compile
      with minimal configurations.
      
      This will affect all archs.  Mostly the changes should be relatively easy.
      Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
      
      	struct pt_regs *old_regs = set_irq_regs(regs);
      
      And put the old one back at the end:
      
      	set_irq_regs(old_regs);
      
      Don't pass regs through to generic_handle_irq() or __do_IRQ().
      
      In timer_interrupt(), this sort of change will be necessary:
      
      	-	update_process_times(user_mode(regs));
      	-	profile_tick(CPU_PROFILING, regs);
      	+	update_process_times(user_mode(get_irq_regs()));
      	+	profile_tick(CPU_PROFILING);
      
      I'd like to move update_process_times()'s use of get_irq_regs() into itself,
      except that i386, alone of the archs, uses something other than user_mode().
      
      Some notes on the interrupt handling in the drivers:
      
       (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
           the input_dev struct.
      
       (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
           something different depending on whether it's been supplied with a regs
           pointer or not.
      
       (*) Various IRQ handler function pointers have been moved to type
           irq_handler_t.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
      7d12e780