1. 18 4月, 2008 29 次提交
    • J
      [libata] sata_nv: disable ADMA by default · 06993d22
      Jeff Garzik 提交于
      Continues to have open issues, and engineering support is extremely difficult
      to come by, according to fellow NVIDIA engineers.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      06993d22
    • A
      libata annotations · 826cd156
      Al Viro 提交于
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      826cd156
    • T
      ata_piix: kill ich6_sata_ahci and clean up · 9c0bf675
      Tejun Heo 提交于
      ich6_sata_ahci and ich6_sata are identical.  Kill ich6_sata_ahci and
      drop _ahci postfixes from controller ids, which doesn't really mean
      anything at this point.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9c0bf675
    • T
      ata_piix: don't attach to ICH6M in ahci mode · 5016d7d2
      Tejun Heo 提交于
      ata_piix when attached to ICH6M in AHCI mode doesn't provide any
      benefit over using ahci and has detection problems.  Don't let
      ata_piix claim ICH6M if it's in AHCI mode.
      
      This change makes ICH6R the only one which ata_piix can attach to even
      when it's in ahci mode which is necessary as some devices don't work
      properly under ahci mode.  Drop PIIX_FLAG_AHCI and match the
      controller directly so that piix_disable_ahci() is called only for it.
      
      This change makes PIIX_SCC no longer used and it gets dropped too.
      
      This fixes bz 9491.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Robert M. Albrecht <romal@gmx.de>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      5016d7d2
    • T
      pata_scc: fix compile warning · c1796d98
      Tejun Heo 提交于
      Missed one during mass conversion (dc14c0c5).  Fix it.  Spotted by
      Stephen Rothwell.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      c1796d98
    • A
      libata: isolate and rework cable logic · 15a5551c
      Alan Cox 提交于
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      15a5551c
    • Z
      ata: SWNCQ should be enabled by default · d21279f4
      Zoltan Boszormenyi 提交于
      Signed-off-by: NZoltan Boszormenyi <zboszor@dunaweb.hu>
      Cc: Robert Hancock <hancockr@shaw.ca>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d21279f4
    • H
      pata_amd: fix sparse warning · d9c74fbe
      Harvey Harrison 提交于
      Current code is essentially choosing between dividing by 1 or
      dividing by two, make the conditions a little more obvious.
      
      As a bonus, removes a sparse error:
      drivers/ata/pata_amd.c:59:11: warning: symbol '__x' shadows an earlier one
      drivers/ata/pata_amd.c:59:11: originally declared here
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d9c74fbe
    • T
      libata: kill ata_chk_status() · 6fd36390
      Tejun Heo 提交于
      ata_chk_status() just calls ops->check_status and it only adds
      confusion with other status functions.  Kill it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6fd36390
    • T
      libata: kill ata_chk_status() call from ata_dev_configure() · 3d5a3d67
      Tejun Heo 提交于
      ata_dev_configure() isn't tied to any controller interface except for
      the probe debug message printing at the end of the function.  Kill the
      message.
      
      This is to help separating out SFF support from core layer.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      3d5a3d67
    • T
      libata: move ata_pci_default_filter() out of CONFIG_PCI · 071ce34d
      Tejun Heo 提交于
      ata_pci_default_filter() doesn't really have anything to do with PCI.
      It's generally applicable to BMDMA controllers.  Move it out of
      CONFIG_PCI.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      071ce34d
    • 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
    • T
      libata: reorder functions in libata-sff.c · 272f7884
      Tejun Heo 提交于
      Reorder functions in drivers/ata/libata-sff.c such that functions
      generally follow ops table order and init functions come last.  This
      is in preparation of SFF cleanup.
      
      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>
      272f7884
    • T
      libata: drop ata_dev_select() from ata_dev_read_id · 21572ea5
      Tejun Heo 提交于
      There is no reason to issue device select in read_id, it will be done
      by ops->qc_issue() when IDENTIFY[_PACKET] is issued via
      ata_exec_internal().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      21572ea5
    • T
      libata: make reset related methods proper port operations · a1efdaba
      Tejun Heo 提交于
      Currently reset methods are not specified directly in the
      ata_port_operations table.  If a LLD wants to use custom reset
      methods, it should construct and use a error_handler which uses those
      reset methods.  It's done this way for two reasons.
      
      First, the ops table already contained too many methods and adding
      four more of them would noticeably increase the amount of necessary
      boilerplate code all over low level drivers.
      
      Second, as ->error_handler uses those reset methods, it can get
      confusing.  ie. By overriding ->error_handler, those reset ops can be
      made useless making layering a bit hazy.
      
      Now that ops table uses inheritance, the first problem doesn't exist
      anymore.  The second isn't completely solved but is relieved by
      providing default values - most drivers can just override what it has
      implemented and don't have to concern itself about higher level
      callbacks.  In fact, there currently is no driver which actually
      modifies error handling behavior.  Drivers which override
      ->error_handler just wraps the standard error handler only to prepare
      the controller for EH.  I don't think making ops layering strict has
      any noticeable benefit.
      
      This patch makes ->prereset, ->softreset, ->hardreset, ->postreset and
      their PMP counterparts propoer ops.  Default ops are provided in the
      base ops tables and drivers are converted to override individual reset
      methods instead of creating custom error_handler.
      
      * ata_std_error_handler() doesn't use sata_std_hardreset() if SCRs
        aren't accessible.  sata_promise doesn't need to use separate
        error_handlers for PATA and SATA anymore.
      
      * softreset is broken for sata_inic162x and sata_sx4.  As libata now
        always prefers hardreset, this doesn't really matter but the ops are
        forced to NULL using ATA_OP_NULL for documentation purpose.
      
      * pata_hpt374 needs to use different prereset for the first and second
        PCI functions.  This used to be done by branching from
        hpt374_error_handler().  The proper way to do this is to use
        separate ops and port_info tables for each function.  Converted.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      a1efdaba
    • T
      libata: kill port_info->sht and ->irq_handler · 95947193
      Tejun Heo 提交于
      libata core layer doesn't care about sht or ->irq_handler.  Those are
      only of interest to the LLD during initialization.  This is confusing
      and has caused several drivers to have duplicate unused initializers
      for these fields.
      
      Currently only sata_nv uses these fields.  Make sata_nv use
      ->private_data, which is supposed to carry LLD-specific information,
      instead and kill ->sht and ->irq_handler.  nv_pi_priv structure is
      defined and struct literals are used to initialize private_data.
      Notational overhead is negligible.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      95947193
    • T
      libata: stop overloading port_info->private_data · 887125e3
      Tejun Heo 提交于
      port_info->private_data is currently used for two purposes - to record
      private data about the port_info or to specify host->private_data to
      use when allocating ata_host.
      
      This overloading is confusing and counter-intuitive in that
      port_info->private_data becomes host->private_data instead of
      port->private_data.  In addition, port_info and host don't correspond
      to each other 1-to-1.  Currently, the first non-NULL
      port_info->private_data is used.
      
      This patch makes port_info->private_data just be what it is -
      private_data for the port_info where LLD can jot down extra info.
      libata no longer sets host->private_data to the first non-NULL
      port_info->private_data, @host_priv argument is added to
      ata_pci_init_one() instead.  LLDs which use ata_pci_init_one() can use
      this argument to pass in pointer to host private data.  LLDs which
      don't should use init-register model anyway and can initialize
      host->private_data directly.
      
      Adding @host_priv instead of using init-register model for LLDs which
      use ata_pci_init_one() is suggested by Alan Cox.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      887125e3
    • T
      libata: make ata_pci_init_one() not use ops->irq_handler and pi->sht · 1bd5b715
      Tejun Heo 提交于
      ata_pci_init_one() is the only function which uses ops->irq_handler
      and pi->sht.  Other initialization functions take the same information
      as arguments.  This causes confusion and duplicate unused entries in
      structures.
      
      Make ata_pci_init_one() take sht as an argument and use ata_interrupt
      implicitly.  All current users use ata_interrupt and if different irq
      handler is necessary open coding ata_pci_init_one() using
      ata_prepare_sff_host() and ata_activate_sff_host can be done under ten
      lines including error handling and driver which requires custom
      interrupt handler is likely to require custom initialization anyway.
      
      As ata_pci_init_one() was the last user of ops->irq_handler, this
      patch also kills the field.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      1bd5b715
    • T
      libata: implement and use ops inheritance · 029cfd6b
      Tejun Heo 提交于
      libata lets low level drivers build ata_port_operations table and
      register it with libata core layer.  This allows low level drivers
      high level of flexibility but also burdens them with lots of
      boilerplate entries.
      
      This becomes worse for drivers which support related similar
      controllers which differ slightly.  They share most of the operations
      except for a few.  However, the driver still needs to list all
      operations for each variant.  This results in large number of
      duplicate entries, which is not only inefficient but also error-prone
      as it becomes very difficult to tell what the actual differences are.
      
      This duplicate boilerplates all over the low level drivers also make
      updating the core layer exteremely difficult and error-prone.  When
      compounded with multi-branched development model, it ends up
      accumulating inconsistencies over time.  Some of those inconsistencies
      cause immediate problems and fixed.  Others just remain there dormant
      making maintenance increasingly difficult.
      
      To rectify the problem, this patch implements ata_port_operations
      inheritance.  To allow LLDs to easily re-use their own ops tables
      overriding only specific methods, this patch implements poor man's
      class inheritance.  An ops table has ->inherits field which can be set
      to any ops table as long as it doesn't create a loop.  When the host
      is started, the inheritance chain is followed and any operation which
      isn't specified is taken from the nearest ancestor which has it
      specified.  This operation is called finalization and done only once
      per an ops table and the LLD doesn't have to do anything special about
      it other than making the ops table non-const such that libata can
      update it.
      
      libata provides four base ops tables lower drivers can inherit from -
      base, sata, pmp, sff and bmdma.  To avoid overriding these ops
      accidentaly, these ops are declared const and LLDs should always
      inherit these instead of using them directly.
      
      After finalization, all the ops table are identical before and after
      the patch except for setting .irq_handler to ata_interrupt in drivers
      which didn't use to.  The .irq_handler doesn't have any actual effect
      and the field will soon be removed by later patch.
      
      * sata_sx4 is still using old style EH and currently doesn't take
        advantage of ops inheritance.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      029cfd6b
    • T
      libata: implement and use SHT initializers · 68d1d07b
      Tejun Heo 提交于
      libata lets low level drivers build scsi_host_template and register it
      to the SCSI layer.  This allows low level drivers high level of
      flexibility but also burdens them with lots of boilerplate entries.
      
      This patch implements SHT initializers which can be used to initialize
      all the boilerplate entries in a sht.  Three variants of them are
      implemented - BASE, BMDMA and NCQ - for different types of drivers.
      Note that entries can be overriden by putting individual initializers
      after the helper macro.
      
      All sht tables are identical before and after this patch.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      68d1d07b
    • T
      libata: normalize port_info, port_operations and sht tables · 6bd99b4e
      Tejun Heo 提交于
      Over the time, port info, ops and sht structures developed quite a bit
      of inconsistencies.  This patch updates drivers.
      
      * Enable/disable_pm callbacks added to all ahci ops tables.
      
      * Every driver for SFF controllers now uses ata_sff_port_start()
        instead of ata_port_start() unless the driver has custom
        implementation.
      
      * Every driver for SFF controllers now uses ata_pci_default_filter()
        unless the driver has custom implementation.
      
      * Removed an odd port_info->sht initialization from ata_piix.c.
        Likely a merge byproduct.
      
      * A port which has ATA_FLAG_SATA set doesn't need to set cable_detect
        to ata_cable_sata().  Remove it from via and mv port ops.
      
      * Some drivers had unnecessary .max_sectors initialization which is
        ignored and was missing .slave_destroy callback.  Fixed.
      
      * Removed unnecessary sht initializations port_info's.
      
      * Removed onsolete scsi device suspend/resume callbacks from
        pata_bf54x.
      
      * No reason to set ata_pci_default_filter() and bmdma functions for
        PIO-only drivers.  Remove those callbacks and replace
        ata_bmdma_irq_clear with ata_noop_irq_clear.
      
      * pata_platform sets port_start to ata_dummy_ret0.  port_start can
        just be set to NULL.
      
      * sata_fsl supports NCQ but was missing qc_defer.  Fixed.
      
      * pata_rb600_cf implements dummy port_start.  Removed.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      6bd99b4e
    • T
      libata: implement and use ata_noop_irq_clear() · 358f9a77
      Tejun Heo 提交于
      ->irq_clear() is used to clear IRQ bit of a SFF controller and isn't
      useful for drivers which don't use libata SFF HSM implementation.
      However, it's a required callback and many drivers implement their own
      noop version as placeholder.  This patch implements ata_noop_irq_clear
      and use it to replace those custom placeholders.
      
      Also, SFF drivers which don't support BMDMA don't need to use
      ata_bmdma_irq_clear().  It becomes noop if BMDMA address isn't
      initialized.  Convert them to use ata_noop_irq_clear().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      358f9a77
    • T
      libata: reorganize ata_port_operations · c1bc899f
      Tejun Heo 提交于
      Over the time, ops in ata_port_operations has become a bit confusing.
      Reorganize.  SFF/BMDMA ops are separated into separate a group as they
      will be taken out of ata_port_operations later.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      c1bc899f
    • T
      libata: PCI device should be powered up before being accessed · f08048e9
      Tejun Heo 提交于
      PCI device should be powered up or powered up before its PCI regsiters
      are accessed.  Although PCI configuration register access is allowed
      in D3hot, PCI device is free to reset its status when transiting from
      D3hot to D0 causing configuration data to change.
      
      Many libata SFF drivers which use ata_pci_init_one() read and update
      configuration registers before calling ata_pci_init_one() which
      enables the PCI device.  Also, in resume paths, some drivers access
      registers without resuming the PCI device.
      
      This patch adds a call to pcim_enable_device() in init path if
      register is accessed before calling ata_pci_init_one() and make resume
      paths first resume PCI devices, access PCI configuration regiters then
      resume ATA host.
      
      While at it...
      
      * cmd640 was strange in that it set ->resume even when CONFIG_PM is
        not.  This is by-product of minimal build fix.  Updated.
      
      * In cs5530, Don't BUG() on reinit failure.  Just whine and fail
        resume.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      f08048e9
    • T
      libata: kill ata_ehi_schedule_probe() · b558eddd
      Tejun Heo 提交于
      ata_ehi_schedule_probe() was created to hide details of link-resuming
      reset magic.  Now that all the softreset workarounds are gone,
      scheduling probe is very simple - set probe_mask and request RESET.
      Kill ata_ehi_schedule_probe() and open code it.  This also increases
      consistency as ata_ehi_schedule_probe() couldn't cover individual
      device probings so they were open-coded even when the helper existed.
      
      While at it, define ATA_ALL_DEVICES as mask of all possible devices on
      a link and always use it when requesting probe on link level for
      simplicity and consistency.  Setting extra bits in the probe_mask
      doesn't hurt anybody.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      b558eddd
    • T
      libata: kill ATA_LFLAG_SKIP_D2H_BSY · 8cebf274
      Tejun Heo 提交于
      Some controllers can't reliably record the initial D2H FIS after SATA
      link is brought online for whatever reason.  Advanced controllers
      which don't have traditional TF register based interface often have
      this problem as they don't really have the TF registers to update
      while the controller and link are being initialized.
      
      SKIP_D2H_BSY works around the problem by skipping the wait for device
      readiness before issuing SRST, so for such controllers libata issues
      SRST blindly and hopes for the best.
      
      Now that libata defaults to hardreset, this workaround is no longer
      necessary.  For controllers which have support for hardreset, SRST is
      never issued by itself.  It is only issued as follow-up SRST for
      device classification and PMP initialization, so there's no need to
      wait for it from prereset.
      
      Kill ATA_LFLAG_SKIP_D2H_BSY.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      8cebf274
    • T
      libata: kill ATA_EHI_RESUME_LINK · 672b2d65
      Tejun Heo 提交于
      ATA_EHI_RESUME_LINK has two functions - promote reset to hardreset if
      ATA_LFLAG_HRST_TO_RESUME is set and preventing EH from shortcutting
      reset action when probing is requested.  The former is gone now and
      the latter can easily be achieved by making EH to perform at least one
      reset if reset is requested, which also makes more sense than
      depending on RESUME_LINK flag.
      
      As ATA_EHI_RESUME_LINK was the only EHI reset modifier, this also
      kills reset modifier handling.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      672b2d65
    • T
      libata: kill ATA_LFLAG_HRST_TO_RESUME · d692abd9
      Tejun Heo 提交于
      Now that hardreset is the preferred method of resetting, there's no
      need for ATA_LFLAG_HRST_TO_RESUME flag.  Kill it.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      d692abd9
    • T
      libata: prefer hardreset · cf480626
      Tejun Heo 提交于
      When both soft and hard resets are available, libata preferred
      softreset till now.  The logic behind it was to be softer to devices;
      however, this doesn't really help much.  Rationales for the change:
      
      * BIOS may freeze lock certain things during boot and softreset can't
        unlock those.  This by itself is okay but during operation PHY event
        or other error conditions can trigger hardreset and the device may
        end up with different configuration.
      
        For example, after a hardreset, previously unlockable HPA can be
        unlocked resulting in different device size and thus revalidation
        failure.  Similar condition can occur during or after resume.
      
      * Certain ATAPI devices require hardreset to recover after certain
        error conditions.  On PATA, this is done by issuing the DEVICE RESET
        command.  On SATA, COMRESET has equivalent effect.  The problem is
        that DEVICE RESET needs its own execution protocol.
      
        For SFF controllers with bare TF access, it can be easily
        implemented but more advanced controllers (e.g. ahci and sata_sil24)
        require specialized implementations.  Simply using hardreset solves
        the problem nicely.
      
      * COMRESET initialization sequence is the norm in SATA land and many
        SATA devices don't work properly if only SRST is used.  For example,
        some PMPs behave this way and libata works around by always issuing
        hardreset if the host supports PMP.
      
        Like the above example, libata has developed a number of mechanisms
        aiming to promote softreset to hardreset if softreset is not going
        to work.  This approach is time consuming and error prone.
      
        Also, note that, dependingon how you read the specs, it could be
        argued that PMP fan-out ports require COMRESET to start operation.
        In fact, all the PMPs on the market except one don't work properly
        if COMRESET is not issued to fan-out ports after PMP reset.
      
      * COMRESET is an integral part of SATA connection and any working
        device should be able to handle COMRESET properly.  After all, it's
        the way to signal hardreset during reboot.  This is the most used
        and recommended (at least by the ahci spec) method of resetting
        devices.
      
      So, this patch makes libata prefer hardreset over softreset by making
      the following changes.
      
      * Rename ATA_EH_RESET_MASK to ATA_EH_RESET and use it whereever
        ATA_EH_{SOFT|HARD}RESET used to be used.  ATA_EH_{SOFT|HARD}RESET is
        now only used to tell prereset whether soft or hard reset will be
        issued.
      
      * Strip out now unneeded promote-to-hardreset logics from
        ata_eh_reset(), ata_std_prereset(), sata_pmp_std_prereset() and
        other places.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      cf480626
  2. 17 4月, 2008 7 次提交
  3. 16 4月, 2008 4 次提交