1. 10 7月, 2007 4 次提交
    • A
      libata: Support chips with 64K PRD quirk · d26fc955
      Alan Cox 提交于
      Add ata_dumb_qc_prep and supporting logic so that a driver can just
      specify it needs to be helped in this area. 64K entries are split
      as with drivers/ide.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d26fc955
    • T
      libata: replace ap->cbl tests with ATA_FLAG_SATA tests · a16abc0b
      Tejun Heo 提交于
      ap->cbl == ATA_CBL_SATA indicates SATA cable while ap->flags &
      ATA_FLAG_SATA indicates SATA host port.  Till now they always gave the
      same result but SATA/PATA bridge handling will change that.  Switch to
      ATA_FLAG_SATA test if we're testing for host port type.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a16abc0b
    • T
      libata: reimplement ACPI invocation · 6746544c
      Tejun Heo 提交于
      This patch reimplements ACPI invocation such that, instead of
      exporting ACPI details to the rest of libata, ACPI event handlers -
      ata_acpi_on_resume() and ata_acpi_on_devcfg() - are used.  These two
      functions are responsible for determining whether specific ACPI method
      is used and when.
      
      On resume, _GTF is scheduled by setting ATA_DFLAG_ACPI_PENDING device
      flag.  This is done this way to avoid performing the action on wrong
      device device (device swapping while suspended).
      
      On every ata_dev_configure(), ata_acpi_on_devcfg() is called, which
      performs _SDD and _GTF.  _GTF is performed only after resuming and, if
      SATA, hardreset as the ACPI spec specifies.  As _GTF may contain
      arbitrary commands, IDENTIFY page is re-read after _GTF taskfiles are
      executed.
      
      If one of ACPI methods fails, ata_acpi_on_devcfg() retries on the
      first failure.  If it fails again on the second try, ACPI is disabled
      on the device.  Note that successful configuration clears ACPI failed
      status.
      
      With all feature checks moved to the above two functions,
      do_drive_set_taskfiles() is trivial and thus collapsed into
      ata_acpi_exec_tfs(), which is now static and converted to return the
      number of executed taskfiles to be used by ata_acpi_on_resume().  As
      failures are handled properly, ata_acpi_push_id() now returns -errno
      on errors instead of unconditional zero.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6746544c
    • T
      libata-acpi: implement ata_acpi_associate() · fafbae87
      Tejun Heo 提交于
      * Add acpi_handle to ata_host and ata_port.  Rename
        ata_device->obj_handle to ->acpi_handle and move it above such that
        it doesn't get cleared on reconfiguration.
      
      * Replace ACPI node association which ata_acpi_associate() which is
        called once during host initialization.  Unlike the previous
        implementation, ata_acpi_associate() uses ATA_FLAG_ACPI_SATA to
        choose between IDE or SATA ACPI hierarchy and uses simple child look
        up instead of recursive walk to match the nodes.  This is way safer
        and simpler.  Please read the following message for more info.
      
        http://article.gmane.org/gmane.linux.ide/17554Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      fafbae87
  2. 03 7月, 2007 1 次提交
    • T
      libata: fix assigned IRQ reporting · 4031826b
      Tejun Heo 提交于
      host->irq and host->irq2 should be set before ata_host_register() for
      IRQ reporting to work.  Move up host->irq assignment in
      ata_host_activate() and add it to ata_pci_init_one() native path and
      pata_cs5520.
      
      The port info printing in ata_host_register() doesn't fit all the
      different controllers.  It should probably be moved out to LLDs with
      some helpers in the future.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4031826b
  3. 02 7月, 2007 2 次提交
  4. 27 6月, 2007 4 次提交
  5. 21 6月, 2007 2 次提交
  6. 11 6月, 2007 2 次提交
    • T
      libata: limit post SRST nsect/lbal wait to ~100ms · e141d999
      Tejun Heo 提交于
      After SRST, libata used to wait for nsect/lbal to be set to 1/1 for
      the slave device.  However, some ATAPI devices don't set nsect/lbal
      after SRST and the wait itself isn't too useful as we're gonna wait
      for !BSY right after that anyway.
      
      Before reset-seq update, nsect/lbal wait failure used to be ignored
      and caused 30sec delay during detection.  After reset-seq, all
      timeouts are considered error conditions making libata fail to detect
      such ATAPI devices.
      
      This patch limits nsect/lbal wait to around 100ms.  This should give
      acceptable behavior to such ATAPI devices while not disturbing the
      heavily used code path too much.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      e141d999
    • T
      libata: force PIO on IOMEGA ZIP 250 ATAPI · 5acd50f6
      Tejun Heo 提交于
      IOMEGA ZIP 250 ATAPI claims MWDMA0 support but fails SETXFERMODE if
      asked to configure itself to MWDMA0.  Force PIO.
      
      This fixes bugzilla bug#8497.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Calvin Walton <calvin.walton@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      5acd50f6
  7. 10 6月, 2007 6 次提交
  8. 05 6月, 2007 1 次提交
    • T
      libata: always use polling SETXFER · 464cf177
      Tejun Heo 提交于
      Several people have reported LITE-ON LTR-48246S detection failed
      because SETXFER fails.  It seems the device raises IRQ too early after
      SETXFER.  This is controller independent.  The same problem has been
      reported for different controllers.
      
      So, now we have pata_via where the controller raises IRQ before it's
      ready after SETXFER and a device which does similar thing.  This patch
      makes libata always execute SETXFER via polling.  As this only happens
      during EH, performance impact is nil.  Setting ATA_TFLAG_POLLING is
      also moved from issue hot path to ata_dev_set_xfermode() - the only
      place where SETXFER can be issued.
      
      Note that ATA_TFLAG_POLLING applies only to drivers which implement
      SFF TF interface and use libata HSM.  More advanced controllers ignore
      the flag.  This doesn't matter for this fix as SFF TF controllers are
      the problematic ones.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      464cf177
  9. 28 5月, 2007 1 次提交
  10. 25 5月, 2007 2 次提交
  11. 22 5月, 2007 4 次提交
  12. 18 5月, 2007 1 次提交
    • T
      libata: remove libata.spindown_compat · d9aca22c
      Tejun Heo 提交于
      With STANDBYDOWN tracking added, libata.spindown_compat isn't
      necessary anymore.  If userspace shutdown(8) issues STANDBYNOW, libata
      warns.  If userspace shutdown(8) doesn't issue STANDBYNOW, libata does
      the right thing.  Userspace can tell whether kernel supports spindown
      by testing whether sysfs node manage_start_stop exists as before.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d9aca22c
  13. 16 5月, 2007 2 次提交
    • T
      libata: during revalidation, check n_sectors after device is configured · 6ddcd3b0
      Tejun Heo 提交于
      Device might be resized during ata_dev_configure() due to HPA or
      (later) ACPI _GTF.  Currently it's worked around by caching n_sectors
      before turning off HPA.  The cached original size is overwritten if
      the device is reconfigured without being hardreset - which always
      happens after configuring trasnfer mode.  If the device gets hardreset
      for some reason after that, revalidation fails with -ENODEV.
      
      This patch makes size checking more robust by moving n_sectors check
      from ata_dev_reread_id() to ata_dev_revalidate() after the device is
      fully configured.  No matter what happens during configuration, a
      device must have the same n_sectors after fully configured to be
      treated as the same device.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6ddcd3b0
    • T
      libata: separate out ata_dev_reread_id() · fe30911b
      Tejun Heo 提交于
      Separate out ata_dev_reread_id() from ata_dev_revalidate().
      ata_dev_reread_id() reads IDENTIFY page and determines whether the
      same device is still there.  ata_dev_revalidate() reconfigures after
      reread completes.  This will be used by ACPI update.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      fe30911b
  14. 12 5月, 2007 6 次提交
    • T
      libata-acpi: clean up parameters and misc stuff · 3a32a8e9
      Tejun Heo 提交于
      This patch cleans up libata-acpi such that it looks similar to other
      libata files.  This patch doesn't introuce any behavior changes.
      
      * make libata-acpi functions take ata_device instead of ata_port +
        device index
      * s/atadev/dev/
      * de-indent local variable declarations
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      3a32a8e9
    • T
      libata: fallback to the other IDENTIFY on device error, take#2 · 54936f8b
      Tejun Heo 提交于
      It seems the world isn't as frank as we thought and some devices lie
      about who they are.  Fallback to the other IDENTIFY if IDENTIFY is
      aborted by the device.  As this is the strategy used by IDE for a long
      time, it shouldn't cause too much problem.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: William Thompson <wt@electro-mechanical.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      54936f8b
    • T
      libata: ignore EH scheduling during initialization · f4d6d004
      Tejun Heo 提交于
      libata enables SCSI host during ATA host activation which happens
      after IRQ handler is registered and IRQ is enabled.  All ATA ports are
      in frozen state when IRQ is enabled but frozen ports may raise limited
      number of IRQs after being frozen - IOW, ->freeze() is not responsible
      for clearing pending IRQs.  During normal operation, the IRQ handler
      is responsible for clearing spurious IRQs on frozen ports and it
      usually doesn't require any extra code.
      
      Unfortunately, during host initialization, the IRQ handler can end up
      scheduling EH for a port whose SCSI host isn't initialized yet.  This
      results in OOPS in the SCSI midlayer.  This is relatively short window
      and scheduling EH for probing is the first thing libata does after
      initialization, so ignoring EH scheduling until initialization is
      complete solves the problem nicely.
      
      This problem was spotted by Berck E. Nash in the following thread.
      
        http://thread.gmane.org/gmane.linux.kernel/519412Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Berck E. Nash <flyboy@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f4d6d004
    • 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: implement libata.spindown_compat · 920a4b10
      Tejun Heo 提交于
      Now that libata uses sd->manage_start_stop, libata spins down disk on
      shutdown.  In an attempt to compensate libata's previous shortcoming,
      some distros sync and spin down disks attached via libata in their
      shutdown(8).  Some disks spin back up just to spin down again on
      STANDBYNOW1 if the command is issued when the disk is spun down, so
      this double spinning down causes problem.
      
      This patch implements module parameter libata.spindown_compat which,
      when set to one (default value), prevents libata from spinning down
      disks on shutdown thus avoiding double spinning down.  Note that
      libata spins down disks for suspend to mem and disk, so with
      libata.spindown_compat set to one, disks should be properly spun down
      in all cases without modifying shutdown(8).
      
      shutdown(8) should be fixed eventually.  Some drive do spin up on
      SYNCHRONZE_CACHE even when their cache is clean.  Those disks
      currently spin up briefly when sd tries to shutdown the device and
      then the machine powers off immediately, which can't be good for the
      head.  We can't skip SYNCHRONIZE_CACHE during shudown as it can be
      dangerous data integrity-wise.
      
      So, this spindown_compat parameter is already scheduled for removal by
      the end of the next year and here's what shutdown(8) should do.
      
        * Check whether /sys/modules/libata/parameters/spindown_compat
          exists.  If it does, write 0 to it.
      
        * For each libata harddisk {
      	* Check whether /sys/class/scsi_disk/h:c:i:l/manage_start_stop
      	  exists.  Iff it doesn't, synchronize cache and spin the disk
      	  down as before.
        }
      
      The above procedure will make shutdown(8) work properly with kernels
      before this change, ones with this workaround and later ones without
      it.
      
      To accelerate shutdown(8) updates, if the compat mode is in use, this
      patch prints BIG FAT warning for five seconds during shutdown (the
      optimal interval to annoy the user just the right amount discovered by
      hours of tireless usability testing).
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      920a4b10
    • 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
  15. 10 5月, 2007 2 次提交