1. 09 Jul, 2007 1 commit
    • Mikael Pettersson's avatar
      sata_sil24: sil24_interrupt() micro-optimisation · 825cd6dd
      Mikael Pettersson authored
      sil24_interrupt() loads host->ports[i] into a local variable,
      validates it, and then loads the value again in the call to
      sil24_host_intr(). This patch replaces the second load by a
      reference to the local variable.
      This is safe since no side-effects have occurred since the
      initial load. It also improves readability since it makes
      it clear that the parameter to sil24_host_intr() is the same
      value which was just validated.
      Signed-off-by: default avatarMikael Pettersson <mikpe@it.uu.se>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
  2. 22 May, 2007 1 commit
  3. 16 May, 2007 1 commit
    • Tejun Heo's avatar
      libata-acpi: add ATA_FLAG_ACPI_SATA port flag · 3cadbcc0
      Tejun Heo authored
      Whether a controller needs IDE or SATA ACPI hierarchy is determined by
      the programming interface of the controller not by whether the
      controller is SATA or PATA, or it supports slave device or not.  This
      patch adds ATA_FLAG_ACPI_SATA port flags which tells libata-acpi that
      the port needs SATA ACPI nodes, and sets the flag for ahci and
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
  4. 11 May, 2007 1 commit
    • Tejun Heo's avatar
      libata: reimplement suspend/resume support using sdev->manage_start_stop · 9666f400
      Tejun Heo authored
      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
      * 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: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
  5. 01 May, 2007 1 commit
    • Tejun Heo's avatar
      libata: add deadline support to prereset and reset methods · d4b2bab4
      Tejun Heo authored
      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
      * 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
        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
      * To be on the safe side, deadline is set to 40s for the time being.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
  6. 28 Apr, 2007 3 commits
    • Tejun Heo's avatar
      libata: convert the remaining SATA drivers to new init model · 4447d351
      Tejun Heo authored
      Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
      sata_sx4, sata_vsc and sata_inic162x to new init model.
      Now that host and ap are available during intialization, functions are
      converted to take either host or ap instead of low level parameters
      which were inevitable for functions shared between init and other
      paths.  This simplifies code quite a bit.
      * init_one()'s now follow more consistent init order
      * ahci_setup_port() and ahci_host_init() collapsed into
        ahci_init_one() for init order consistency
      * sata_vsc uses port_info instead of setting fields manually
      * in sata_svw, k2_board_info converted to port_info (info is now in
        port flags).  port number is honored now.
      Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
    • Tejun Heo's avatar
      libata: improve AC_ERR_DEV handling for ->post_internal_cmd · a51d644a
      Tejun Heo authored
      ->post_internal_cmd is simplified EH for internal commands.  Its
      primary mission is to stop the controller such that no rogue memory
      access or other activities occur after the internal command is
      released.  It may provide error diagnostics by setting qc->err_mask
      but this hasn't been a requirement.
      To ignore SETXFER failure for CFA devices, libata needs to know
      whether a command was failed by the device or for any other reason.
      ie. internal command needs to get AC_ERR_DEV right.
      This patch makes the following changes to AC_ERR_DEV handling and
      ->post_internal_cmd semantics to accomodate this need and simplify
      callback implementation.
      1. As long as the correct bits in the result TF registers are set,
         there is no need to set AC_ERR_DEV explicitly.  libata EH core
         takes care of that for both normal and internal commands.
      2. The only requirement for ->post_internal_cmd() is to put the
         controller into quiescent state.  It needs not to set any err_mask.
      3. ata_exec_internal_sg() performs minimal error analysis such that
         AC_ERR_DEV is automatically set as long as result_tf is filled
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
    • Alan Cox Cox's avatar
      libata: dev_config does not need ap and adev passing · cd0d3bbc
      Alan Cox Cox authored
      It used to be impossible to get from ata_device to ata_port but that is
      no longer true. Various methods have been cleaned up over time but
      dev_config still takes both and most users don't need both anyway. Tidy
      this one up
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
  7. 19 Mar, 2007 1 commit
  8. 02 Mar, 2007 2 commits
  9. 26 Feb, 2007 1 commit
  10. 09 Feb, 2007 4 commits
    • Akira Iguchi's avatar
      libata: add another IRQ calls (libata drivers) · 246ce3b6
      Akira Iguchi authored
      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: default avatarKou Ishizaki <kou.ishizaki@toshiba.co.jp>
      Signed-off-by: default avatarAkira Iguchi <akira2.iguchi@toshiba.co.jp>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
    • Tejun Heo's avatar
      libata: convert to iomap · 0d5ff566
      Tejun Heo authored
      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
      * 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: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
    • Tejun Heo's avatar
      libata: update libata LLDs to use devres · 24dc5f33
      Tejun Heo authored
      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: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
    • Tejun Heo's avatar
      libata: handle pci_enable_device() failure while resuming · 553c4aa6
      Tejun Heo authored
      Handle pci_enable_device() failure while resuming.  This patch kills
      the "ignoring return value of 'pci_enable_device'" warning message and
      propagates __must_check through ata_pci_device_do_resume().
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
  11. 02 Dec, 2006 2 commits
  12. 05 Oct, 2006 1 commit
    • David Howells's avatar
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells authored
      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
      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:
      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
      Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
  13. 28 Sep, 2006 1 commit
  14. 24 Aug, 2006 2 commits
    • Jeff Garzik's avatar
      libata: Grand renaming. · cca3974e
      Jeff Garzik authored
      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
      ata_port->host is reused for different purpose but this field is used
      inside libata core proper and of different type.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
    • Alexey Dobriyan's avatar
      [PATCH] CONFIG_PM=n slim: drivers/scsi/sata_sil* · 281d426c
      Alexey Dobriyan authored
      Remove some code which is unneeded if CONFIG_PM=n.
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
  15. 10 Aug, 2006 2 commits
  16. 04 Aug, 2006 1 commit
  17. 06 Jul, 2006 3 commits
  18. 02 Jul, 2006 1 commit
  19. 27 Jun, 2006 1 commit
  20. 12 Jun, 2006 1 commit
  21. 05 Jun, 2006 1 commit
  22. 31 May, 2006 5 commits
    • Tejun Heo's avatar
      [PATCH] sata_sil24: convert to new probing mechanism and add hotplug support · 0542925b
      Tejun Heo authored
      Convert to new probing mechanism and add hotplug support by enabling
      PORT_IRQ_PHYRDY_CHG, marking ehi for hotplug and scheduling EH on
      Sil3124/32 family of controllers don't have any mechanism to wait for
      the first D2H FIS after hotplug, so ATA_FLAG_SKIP_D2H_BSY is used.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      [PATCH] libata-hp: hook warmplug · ccf68c34
      Tejun Heo authored
      Hook transportt->user_scan() and hostt->slave_destroy().
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      [PATCH] sata_sil24: update sil24_hardreset() · e8e008e7
      Tejun Heo authored
      Use phy debouncing instead of unconditional wait after DEV_RST and
      make sil24_hardreset() to request followup SRST as that's the only way
      to wait for !BSY.  Note that the original implementation never worked
      - if the cached status was !BSY, ata_busy_sleep() finished
      immediately; otherwise, it timed out regardless of the actual device
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      [PATCH] sata_sil24: rename PORT_PRB to PORT_LRAM and add PORT_LRAM_SLOT_SZ · 135da345
      Tejun Heo authored
      PORT_PRB is a misnomer as the area also contains other stuff.  Rename
      it to PORT_LRAM and add PORT_LRAM_SLOT_SZ.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      [PATCH] libata-hp-prep: add prereset() method and implement ata_std_prereset() · f5914a46
      Tejun Heo authored
      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: default avatarTejun Heo <htejun@gmail.com>
  23. 15 May, 2006 3 commits
    • Tejun Heo's avatar
      [PATCH] sata_sil24: implement NCQ support · aee10a03
      Tejun Heo authored
      Implement NCQ support.  Sil24 has 31 command slots and all of them are
      used for NCQ command queueing.  libata guarantees that no other
      command is in progress when it issues an internal command, so always
      use tag 0 for internal commands.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      [PATCH] sata_sil24: convert to new EH · 88ce7550
      Tejun Heo authored
      Convert sata_sil24 to new EH.
      * When port is frozen, IRQ for the port is masked.
      * sil24_softreset() doesn't need to mangle with IRQ mask anymore.
        libata ensures that the port is frozen during reset.
      * Only turn on interrupts which are handled by interrupt handler and
        EH.  As we don't handle SDB notify yet, turn it off. DEV_XCHG and
        UNK_FIS are handled by EH and thus turned on.
      * sil24_softreset() usually fails to recover the port after DEV_XCHG.
        ATA_PORT_HARDRESET is used as recovery action for DEV_XCHG.
      * sil24 may be invoked without any active command.  e.g. DEV_XCHG irq
        occuring while no qc in progress still triggers EH and will reset
        the port and revalidate attached device.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      [PATCH] libata: use ATA printk helpers · f15a1daf
      Tejun Heo authored
      Use ATA printk helpers.
      Signed-off-by: default avatarTejun Heo <htejun@gmail.com>