1. 18 4月, 2008 3 次提交
    • T
      libata: kill unused ata_flush_cache() · d8b81b80
      Tejun Heo 提交于
      ata_flush_code() hasn't been in use for quite some time now.  Kill it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d8b81b80
    • T
      libata: make ata_tf_to_lba[48]() generic · a5987e0a
      Tejun Heo 提交于
      ata_tf_to_lba[48]() currently return LBA in tf + 1 for
      ata_read_native_max_address().  Make them return LBA and make it
      global so that it can be used to read LBA off TF for other purposes.
      ata_read_native_max_address() now adds 1 itself.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a5987e0a
    • T
      libata: reorganize SFF related stuff · 624d5c51
      Tejun Heo 提交于
      * Move SFF related functions from libata-core.c to libata-sff.c.
      
        ata_[bmdma_]sff_port_ops, ata_devchk(), ata_dev_try_classify(),
        ata_std_dev_select(), ata_tf_to_host(), ata_busy_sleep(),
        ata_wait_after_reset(), ata_wait_ready(), ata_bus_post_reset(),
        ata_bus_softreset(), ata_bus_reset(), ata_std_softreset(),
        sata_std_hardreset(), ata_fill_sg(), ata_fill_sg_dumb(),
        ata_qc_prep(), ata_dump_qc_prep(), ata_data_xfer(),
        ata_data_xfer_noirq(), ata_pio_sector(), ata_pio_sectors(),
        atapi_send_cdb(), __atapi_pio_bytes(), atapi_pio_bytes(),
        ata_hsm_ok_in_wq(), ata_hsm_qc_complete(), ata_hsm_move(),
        ata_pio_task(), ata_qc_issue_prot(), ata_host_intr(),
        ata_interrupt(), ata_std_ports()
      
      * Make ata_pio_queue_task() global as it's now called from
        libata-sff.c.
      
      * Move SFF related stuff in include/linux/libata.h and
        drivers/ata/libata.h into one place.  While at it, move timing
        constants into the global enum definition and fortify comments a
        bit.
      
      This patch strictly moves stuff around and as such doesn't cause any
      functional difference.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      624d5c51
  2. 26 2月, 2008 1 次提交
  3. 21 2月, 2008 1 次提交
    • T
      libata: implement libata.force module parameter · 33267325
      Tejun Heo 提交于
      This patch implements libata.force module parameter which can
      selectively override ATA port, link and device configurations
      including cable type, SATA PHY SPD limit, transfer mode and NCQ.
      
      For example, you can say "use 1.5Gbps for all fan-out ports attached
      to the second port but allow 3.0Gbps for the PMP device itself, oh,
      the device attached to the third fan-out port chokes on NCQ and
      shouldn't go over UDMA4" by the following.
      
       libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      33267325
  4. 23 1月, 2008 3 次提交
    • T
      libata: move ata_set_mode() to libata-eh.c · 6f1d1e3a
      Tejun Heo 提交于
      Move ata_set_mode() to libata-eh.c.  ata_set_mode() is surely an EH
      action and will be more tightly coupled with the rest of error
      handling.  Move it to libata-eh.c.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6f1d1e3a
    • S
      libata-acpi: add ACPI _PSx method · bd3adca5
      Shaohua Li 提交于
      ACPI spec (ver 3.0a, p289) requires IDE power on/off executes ACPI _PSx
      methods. As recently most PATA drivers use libata, this patch adds _PSx
      method support in libata. ACPI spec doesn't mention if SATA requires the
      same _PSx method.
      Signed-off-by: NShaohua Li <shaohua.li@intel.com>
      Acked-by: NLen Brown <len.brown@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      bd3adca5
    • A
      libata: Disable ATA8-ACS proposed Trusted Computing features by default · ae8d4ee7
      Alan Cox 提交于
      Historically word 48 in the identify data was used to mean 32bit I/O
      was supported for VLB IDE etc. ATA8 reassigns this word to the Trusted
      Computing Group, where it is used for TCG features. This means that
      an ATA8 TCG drive is going to trigger 32bit I/O on some systems which
      will be funny.
      
      Anyway we need to sort this out ready for ATA8 so:
      - Reorder the ata.h header a bit so the ata_version function occurs early
        in it
      - Make dword_io check the ATA version
      - Add an ATA8 version checking TCG presence test
      
      While we are at it the current drafts have a flaw where it may not be
      possible to disable TCG features at boot (and opt out of the trusted
      model) as TCG intends because it relies on presence of a different
      optional feature (DCS). Handle this in software by refusing the TCG
      commands if libata.allow_tpm is not set. (We must make it possible
      as some environments such as proprietary VDR devices will doubtless
      want to use it to lock up content)
      
      Finally as with CPRM print a warning so that the user knows they may
      not be able to full access and use the device.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      ae8d4ee7
  5. 18 12月, 2007 1 次提交
  6. 29 10月, 2007 1 次提交
    • K
      [libata] Link power management infrastructure · ca77329f
      Kristen Carlson Accardi 提交于
      Device Initiated Power Management, which is defined
      in SATA 2.5 can be enabled for disks which support it.
      This patch enables DIPM when the user sets the link
      power management policy to "min_power".
      
      Additionally, libata drivers can define a function
      (enable_pm) that will perform hardware specific actions to
      enable whatever power management policy the user set up
      for Host Initiated Power management (HIPM).
      This power management policy will be activated after all
      disks have been enumerated and intialized.  Drivers should
      also define disable_pm, which will turn off link power
      management, but not change link power management policy.
      
      Documentation/scsi/link_power_management_policy.txt has additional
      information.
      Signed-off-by: NKristen Carlson Accardi <kristen.c.accardi@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      ca77329f
  7. 13 10月, 2007 11 次提交
  8. 20 7月, 2007 2 次提交
    • T
      libata: implement EH fast drain · 5ddf24c5
      Tejun Heo 提交于
      In most cases, when EH is scheduled, all in-flight commands are
      aborted causing EH to kick in immediately.  However, in some cases
      (especially with PMP), it's unclear which commands are affected by the
      error condition and although aborting all in-flight commands work, it
      isn't optimal and may cause unnecessary disruption.  On the other
      hand, waiting for in-flight commands to drain themselves can take up
      to 30seconds.
      
      This patch implements EH fast drain to handle such situations.  It
      gives in-flight commands some time to finish up but doesn't wait for
      too long.  After EH is scheduled, fast drain timer is started and if
      no other completion occurs in ATA_EH_FASTDRAIN_INTERVAL all in-flight
      commands are aborted.  If any completion occurred in the interval, the
      port is given another interval to finish up itself.
      
      Currently ATA_EH_FASTDRAIN_INTERVAL is 3 secs which should be enough
      for finishing up most commands.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      5ddf24c5
    • T
      libata: improve SCSI scan failure handling · 1ae46317
      Tejun Heo 提交于
      SCSI scan may fail due to memory allocation failure even if EH is not
      in progress.  Due to use of GFP_ATOMIC in SCSI scan path, allocation
      failure isn't too rare especially while probing multiple devices at
      once which is the case when a bunch of devices are connected to PMP.
      
      This patch moves SCSI scan failure detetion logic from
      ata_scsi_hotplug() to ata_scsi_scan_host() and implement synchronous
      scan behavior.  The synchronous path sleeps briefly and repeats SCSI
      scan if some devices aren't attached properly.  It contains robust
      retry loop to minimize the chance of device misdetection during boot
      and falls back to async retry if everything fails.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1ae46317
  9. 10 7月, 2007 3 次提交
    • T
      libata-acpi: implement _GTM/_STM support · 64578a3d
      Tejun Heo 提交于
      Implement _GTM/_STM support.  acpi_gtm is added to ata_port which
      stores _GTM parameters over suspend/resume cycle.  A new hook
      ata_acpi_on_suspend() is responsible for storing _GTM parameters
      during suspend.  _STM is executed in ata_acpi_on_resume().  With this
      change, invoking _GTF is safe on IDE hierarchy and acpi_sata check
      before _GTF is removed.
      
      ata_acpi_gtm() and ata_acpi_stm() implementation is taken from Alan
      Cox's pata_acpi implementation.  ata_acpi_gtm() is fixed such that the
      result parameter is not shifted by sizeof(union acpi_object).
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      64578a3d
    • 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
  10. 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
  11. 16 5月, 2007 1 次提交
  12. 12 5月, 2007 3 次提交
    • 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-acpi: s/CONFIG_SATA_ACPI/CONFIG_ATA_ACPI/ · e92351bb
      Tejun Heo 提交于
      ACPI applies to both SATA and PATA.  Drop the 'S' from the config
      variable.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      e92351bb
    • 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
  13. 29 4月, 2007 2 次提交
    • T
      libata: kill probe_ent and related helpers · 6bfff31e
      Tejun Heo 提交于
      All drivers are converted to new init model.  Kill probe_ent,
      ata_device_add() and ata_pci_init_native_mode().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6bfff31e
    • T
      libata: separate out ata_host_alloc() and ata_host_register() · f3187195
      Tejun Heo 提交于
      Reorganize ata_host_alloc() and its subroutines into the following
      three functions.
      
      * ata_host_alloc() : allocates host and its ports.  shost is not
        registered automatically.
      
      * ata_scsi_add_hosts() : allocates and adds shosts associated with an
        ATA host.  Used by ata_host_register().
      
      * ata_host_register() : takes a fully initialized ata_host structure
        and registers it to libata layer and probes it.
      
      Only ata_host_alloc() and ata_host_register() are exported.
      ata_device_add() is rewritten using the above functions.  This patch
      does not introduce any observable behavior change.  Things worth
      mentioning.
      
      * print_id is assigned at registration time and LLDs are allowed to
        overallocate ports and reduce host->n_ports during initialization.
        ata_host_register() will throw away unused ports automatically.
      
      * All SCSI host initialization stuff now resides in
        ata_scsi_add_hosts() in libata-scsi.c, where it should be.
      
      * ipr is now the only user of ata_host_init().  Either kill it by
        converting ipr to use ata_host_alloc() and friends or rename and
        move it to libata-scsi.c
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f3187195
  14. 28 3月, 2007 1 次提交
  15. 21 2月, 2007 3 次提交
    • A
      SiS warning fixes · 4bb64fb9
      Alan 提交于
      Somehow the sis_info133 external definition ended up in libata.h and that
      was included by both drivers.  However libata.h contains libata-* specific
      internals and clashing defines like DRV_NAME so this makes a mess.  Move
      the extern into the C file and remove the warnings
      
      [akpm@linux-foundation.org: create sis.h to avoid extern-decl-in-C]
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4bb64fb9
    • T
      libata: kill ATA_DNXFER_ANY · 909706a2
      Tejun Heo 提交于
      ATA_DNXFER_ANY isn't used anymore.  Kill it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      909706a2
    • T
      libata: improve ata_down_xfermask_limit() · 458337db
      Tejun Heo 提交于
      Make ata_down_xfermask_limit() accept @sel instead of @force_pio0.
      @sel selects how the xfermask limit will be adjusted.  The following
      selectors are defined.
      
      * ATA_DNXFER_PIO	: only speed down PIO
      * ATA_DNXFER_DMA	: only speed down DMA, don't cause transfer mode change
      * ATA_DNXFER_40C	: apply 40c cable limit
      * ATA_DNXFER_FORCE_PIO	: force PIO
      * ATA_DNXFER_FORCE_PIO0	: force PIO0 (same as original with @force_pio0 == 1)
      * ATA_DNXFER_ANY	: same as original with @force_pio0 == 0
      
      Currently, only ANY and FORCE_PIO0 are used to maintain the original
      behavior.  Other selectors will be used later to improve EH speed down
      sequence.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      458337db
  16. 17 2月, 2007 2 次提交
  17. 10 2月, 2007 1 次提交