1. 03 5月, 2007 2 次提交
  2. 02 5月, 2007 1 次提交
  3. 01 5月, 2007 6 次提交
    • J
      [libata reset-seq] build and merge fixes · 27c78b37
      Jeff Garzik 提交于
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      27c78b37
    • T
      libata: reimplement reset sequencing · 31daabda
      Tejun Heo 提交于
      libata previously depended upon waits in prereset to get resets after
      hotplug right for both spin up and device ready wait.  This was
      necessary both for reliablity and speed as reset was likely to fail if
      initiated too early and each try usually took more than 30secs to
      fail.  Previous patches fixed the reliability part by fixing status
      and SCR handling in resets.  This patch remedies the speed part by
      improving reset sequencing.
      
      Prereset waiting timeout is adjusted to 10s because spinup wait is
      replaced by reset sequencing and !BSY wait is not as important as
      before.  During boot or module loading where the drive is already
      fully spun up, !BSY wait succeeds immediately, so 10s should be enough
      in most cases.  It matters after hotplugging or other error
      conditions, but in those cases, !BSY wait in prereset simply can't be
      relied upon due to the varied and weird behaviors ATA controllers and
      devices show.
      
      Reset is now driven by ata_eh_reset_timeouts[] table which contains
      timeouts for each reset try.  The first reset can be softreset but the
      following ones are always hardreset if available.  Each timeout
      defines deadline for the reset try.  If a reset try fails, reset is
      retried with the next timeout till the end of the timeout table is
      reached.  If a reset try fails before the timeout with error, libata
      waits till the deadline of the failed try before retrying.
      
      IOW, the timeout table defines timetable of reset tries such that the
      n'th try always begins at least after the sum of all previous timeouts
      has passed.  The current timetable defines 4 tries and takes around 1
      minute.
      
      @0	: First try.  This should succeed most of the time during boot.
      @10	: 10s is enough to spin up most consumer harddrives.  Give it
      	  another shot.
      @20	: 20s should spin up > 99% of working drives.  This has 30s
      	  timeout for retarded devices needing long idleness post reset.
      @55	: Final try with 5s timeout just in case.
      
      The above timetable is trade off between not annoying the device too
      much with frequent resets and taking reasonable amount of time in most
      cases.  Some controllers may do better with shorter timeouts while
      others may fare better with longer but we just can't rely upon LLD
      writers to test each controller with wide variety of devices using
      various scenarios.  We need default behavior which reasonably fits
      most cases.
      
      I've tested the above timetable on a dozen SATA controllers and a few
      PATA controllers with about a dozen different drives from all major
      vendors and 4 different ODDs from three different vendors for both
      boot and hotplug (if available) cases.
      
      Boot probing is not affected unless the device is broken in which
      cases new code gives up on the port after a minute rather than five or
      nine minutes.  When hotplugging, most devices get detected on the
      first or second try.  Multi-platter drives with long spin up time
      which sometimes took > 40 secs with the original code, now usually
      comes up during the second try and at least right after the third try
      @20.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      31daabda
    • T
      libata: improve ata_std_prereset() · b8cffc6a
      Tejun Heo 提交于
      This patch updates ata_std_prereset() as follows.
      
      * Don't fail on phy resume failure.  Just whine and continue.  Failure
        from prereset makes libata abort whole reset sequence and give up
        the port, so prereset() should be best effort.  This is more
        important with the coming EH updates as prereset() will be called
        with shorter timeout.
      
      * If ata_wait_ready() fails, whine and request hardreset instead.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      b8cffc6a
    • T
      libata: improve 0xff status handling · 9b89391c
      Tejun Heo 提交于
      For PATA, 0xff status indicates empty port.  For SATA, it depends on
      how the controller emulates status register.  On some controllers,
      0xff is used to represent broken link or certain stage during reset.
      
      libata currently deals SATA the same.  This hasn't caused any problem
      because problematic situations usually only occur after hotplug or
      other link disruption events and libata blindly waited for the device
      to spin up and settle after hotplug giving the link and device
      whatever time to go through those stages.
      
      libata is going to replace unconditional spinup wait with generic
      timed sequence of resets, so not only getting 0xff handling right for
      SATA is, well, the right thing to do, it's much more important now.
      
      This patch makes the following changes.
      
      * Make ata_bus_softreset() return -ENODEV if any of its wait fails
        due to 0xff status.
      
      * Fail soft/hardreset if status wait returns -ENODEV indicating 0xff
        status while SStatus says the link is online.  e.g. Reset fails if
        status is 0xff after reset when SStatus reports the linke is online.
        If SCR registers are not available, everything is the same as
        before.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9b89391c
    • 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
    • L
      libata: honour host controllers that want just one host · dc87c398
      Linus Torvalds 提交于
      The Marvell IDE interface on my machine would hit a BUG_ON() in
      lib/iomem.c because it was calling ata_pci_init_one() specifying just a
      single port on the host, but that would actually end up trying to
      initialize two ports, the second one with bogus information.
      
      This fixes "ata_pci_init_one()" so that it actually passes down the
      n_ports variable that it got from the low-level driver to the host
      allocation routine ("ata_host_alloc_pinfo()"), which results in the ATA
      layer actually having the correct port number information.
      
      And in order to make it all work, I also needed to fix a few places that
      had incorrectly hard-coded the fact that a host always had exactly two
      ports (both ata_pci_init_bmdma() and ata_request_legacy_irqs() would
      just always iterate over both ports).
      Acked-by: NJeff Garzik <jeff@garzik.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dc87c398
  4. 29 4月, 2007 31 次提交
    • M
      SPIN_LOCK_UNLOCKED cleanup in drivers/ata/pata_winbond.c · 22503631
      Milind Arun Choudhary 提交于
      remove SPIN_LOCK_UNLOCKED, use DEFINE_SPINLOCK instead
      Signed-off-by: NMilind Arun Choudhary <milindchoudhary@gmail.com>
      Acked-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      22503631
    • A
      drivers/ata/pata_cmd640.c: fix build with CONFIG_PM=n · 4b22afd7
      Andrew Morton 提交于
      This is grubby, but all the ata drivers do it this way.
      
      Would it not be better to do
      
      #define ata_scsi_device_resume NULL
      
      in libata.h, remove all those ifdefs?
      
      (updated version, ug, ug)
      
      Cc: Jeff Garzik <jeff@garzik.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Tejun Heo <htejun@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4b22afd7
    • A
      pata_hpt37x: Further small fixes · a4734468
      Alan Cox 提交于
      Further HPT37x changes
      
      - No 66MHz 370/370A
      - Remove dead special case check now we use the DPLL (as per the IDE driver)
      
      Pointed out by Sergei
      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>
      a4734468
    • A
      pata_hpt3x2n: Add HPT371N support and other bits · 28e21c8c
      Alan Cox 提交于
      Yes its no longer 3x2n but 3xxn, I can rename it if you want Jeff
      
      - Don't reset both ports each time (Sergei)
      - If we can't get a DPLL then abort entirely
      - Use ioport access for clock (from drivers/ide)
      - Add HPT371N support (from drivers/ide)
      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>
      28e21c8c
    • A
      ata: printk warning fixes · bd1d5ec6
      Andrew Morton 提交于
      drivers/ata/libata-core.c: In function 'ata_hpa_resize':
      drivers/ata/libata-core.c:986: warning: format '%lld' expects type 'long long int', but argument 5 has type 'u64'
      drivers/ata/libata-core.c:986: warning: format '%lld' expects type 'long long int', but argument 6 has type 'u64'
      drivers/ata/libata-core.c:990: warning: format '%lld' expects type 'long long int', but argument 4 has type 'u64'
      drivers/ata/libata-core.c:990: warning: format '%lld' expects type 'long long int', but argument 5 has type 'u64'
      drivers/ata/libata-core.c:1003: warning: format '%lld' expects type 'long long int', but argument 4 has type 'u64'
      
      Also fix various 80-col bustage.
      
      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>
      bd1d5ec6
    • T
      libata: separate ATA_EHI_DID_RESET into DID_SOFTRESET and DID_HARDRESET · 0d64a233
      Tejun Heo 提交于
      Separate ATA_EHI_DID_RESET into ATA_EHI_DID_SOFTRESET and
      ATA_EHI_DID_HARDRESET.  ATA_EHI_DID_RESET is redefined as OR of the
      two flags.  This patch doesn't introduce any behavior change.  This
      will be used later to determine whether _SDD is necessary or not.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      0d64a233
    • T
      ahci: consolidate common port flags · 1188c0d8
      Tejun Heo 提交于
      Consolidate common port flags into AHCI_FLAG_COMMON.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1188c0d8
    • A
      ata_timing: ensure t->cycle is always correct · 4f701d1e
      Alan Cox 提交于
      Russell King hit a case where quantisation errors accumulated such that
      the cycle time was shorter than rather than equal to the active/recovery
      time. The code already knows how to stretch times to fit the cycle time
      but does not know about the reverse.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4f701d1e
    • T
      libata: add missing call to ->cable_detect() in new EH path · c1c4e8d5
      Tejun Heo 提交于
      ->cable_detect() used to be called on by the old ata_bus_probe() path.
      Add invocation to ata_eh_revalidate_and_attach() right after IDENTIFYs
      are done.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      c1c4e8d5
    • T
      pata_amd: remove contamination added during cable_detect conversion · abcfa88b
      Tejun Heo 提交于
      This is added by added by cff63dfceb52c564fe1ba5394d50ab7d599a11b9
       - pata: cable methods.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      abcfa88b
    • M
      libata: Handle drives that require a spin-up command before first access · 169439c2
      Mark Lord 提交于
      (S)ATA drives can be configured for "power-up in standby",
      a mode whereby a specific "spin up now!" command is required
      before the first media access.
      
      Currently, a drive with this feature enabled can not be used at all
      with libata, and once in this mode, the drive becomes a doorstop.
      
      The older drivers/ide subsystem at least enumerates the drive,
      so that it can be woken up after the fact from a userspace HDIO_*
      command, but not libata.
      
      This patch adds support to libata for the "power-up in standby"
      mode where a "spin up now!" command (SET_FEATURES) is needed.
      With this, libata will recognize such drives, spin them up,
      and then re-IDENTIFY them if necessary to get a full/complete
      set of drive features data.
      
      Drives in this state are determined by looking for
      special values in id[2], as documented in the current ATA specs.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      169439c2
    • A
      libata: HPA support · 1e999736
      Alan Cox 提交于
      Signed-off-by: NAlan Cox <alan@redhat.com>
      
      Add support for ignoring the BIOS HPA result (off by default) and setting
      the disk to the full available size unless already frozen.
      
      Tested with various platforms/disks and confirmed to work with the
      Macintosh (which broke earlier) and ata_piix (breakage due to the LBA48
      readback that Tejun fixed).
      
      For normal users this brings us, I believe, to feature parity with old IDE
      (and of course more featured in some areas too).
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1e999736
    • 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: convert the remaining PATA drivers to new init model · 5d728824
      Tejun Heo 提交于
      Convert pdc_adma, pata_cs5520, pata_isapnp, pata_ixp4xx_cf,
      pata_legacy, pata_mpc52xx, pata_mpiix, pata_pcmcia, pata_pdc2027x,
      pata_platform, pata_qdi, pata_scc and pata_winbond to new init model.
      
      * init_one()'s now follow more consistent init order
      
      * cs5520 now registers one host with two ports, not two hosts.  If any
        of the two ports are disabled, it's made dummy as other drivers do.
      
      Tested pdc_adma and pata_legacy.  Both are as broken as before.  The
      rest are compile tested only.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      5d728824
    • T
      libata: convert the remaining SATA drivers to new init model · 4447d351
      Tejun Heo 提交于
      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: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4447d351
    • T
      libata: convert ata_pci_init_native_mode() users to new init model · 9a829ccf
      Tejun Heo 提交于
      Convert drivers which use ata_pci_init_native_mode() to new init
      model.  ata_pci_init_native_host() is used instead.  sata_nv, sata_uli
      and sata_sis are in this category.
      
      Tested on nVidia Corporation CK804 Serial ATA Controller [10de:0054]
      in both BMDMA and ADMA mode.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9a829ccf
    • T
      libata: convert drivers with combined SATA/PATA ports to new init model · eca25dca
      Tejun Heo 提交于
      Convert sata_via and sata_promise to new init model.  Both controllers
      can have combined configuration (SATA + PATA) and used twisted
      initialization method (modifying port in ->port_start) to overcome
      probe_ent limitations.
      
      This patch converts both drivers to new init model in which such
      configuration is natively supported.
      
      * promise: Combined pata port now uses separate port_info entry right
        after the sata counterpart entry.
      
      * promise: Controller configuration is discerned using ap->flags.
        This simplifies init path and makes it look more like other LLDs.
      
      * via: Both SATA and PATA ports in vt6421 are represented in their
        own port_info structure.
      
      Tested on PDC20375 (SATA150 TX2plus) [105a:3375] and PDC40775 (SATA
      300 TX2plus) [105a:3d73].  Couldn't test via cuz my c3 won't boot the
      current kernel.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      eca25dca
    • T
      libata: add init helpers including ata_pci_prepare_native_host() · 21b0ad4f
      Tejun Heo 提交于
      These will be used to convert LLDs to new init model.
      
      * Add irq_handler field to port_info.  In new init model, requesting
        IRQ is LLD's responsibility and libata doesn't need to know about
        irq_handler.  Most LLDs can simply register their irq_handler but
        some need different irq_handler depending on specific chip.  The
        added port_info->irq_handler field can be used by LLDs to select
        the matching IRQ handler in such cases.
      
      * Add ata_dummy_port_info.
      
      * Implement ata_pci_prepare_native_host(), a helper to alloc ATA host,
        acquire all resources and init the host in one go.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      21b0ad4f
    • T
      libata: convert native PCI host handling to new init model · d491b27b
      Tejun Heo 提交于
      Convert native PCI host handling to alloc-init-register model.  New
      function ata_pci_init_native_host() follows the new init model and
      replaces ata_pci_init_native_mode().  As there are remaining LLD
      users, the old function isn't removed yet.
      
      ata_pci_init_one() is reimplemented using the new function and now
      fully converted to new init model.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d491b27b
    • T
      libata: convert legacy PCI host handling to new init model · 0f834de3
      Tejun Heo 提交于
      Convert legacy PCI host handling to alloc-init-register model.
      ata_init_legacy_host(), ata_request_legacy_irqs() and
      ata_pci_init_bmdma() are separated out and follow the new init model.
      
      The two legacy handling functions use separate ata_legacy_devres
      instead of generic devm_* resources.  This reduces devres overhead for
      legacy hosts which was a bit high because it didn't use PCI/iomap
      merged resoruces.
      
      ata_pci_init_one() is rewritten in terms of the aboved functions but
      native mode handling is still using the old method.  Conversion will
      be completed when native mode handling is updated.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      0f834de3
    • T
      libata: implement ata_host_alloc_pinfo() and ata_host_register() · f5cda257
      Tejun Heo 提交于
      Implement ata_host_alloc_pinfo() and ata_host_register().  These helpers
      will be used in the following patches to adopt new init model.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f5cda257
    • 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
    • T
      libata: separate out ata_host_start() · ecef7253
      Tejun Heo 提交于
      Separate out ata_host_start() from ata_device_add().  ata_host_start()
      calls ->port_start on each port if available and freezes the port.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      ecef7253
    • T
      libata: allocate ap separately from shost · 4911487a
      Tejun Heo 提交于
      Don't embed ap inside shost.  Allocate it separately and point it back
      from shosts's hostdata.  This makes port allocation more flexible and
      allows regular ATA and SAS share host alloc/init paths.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4911487a
    • T
      ahci: add PCI ID for new VIA chip · bf335542
      Tejun Heo 提交于
      Add PCI ID for new VIA chip.  Original patch is from Maarten Vanraes.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Maarten Vanraes <maarten.vanraes@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      bf335542
    • T
      libata: kill type mismatch compile warning · 03ec52de
      Tejun Heo 提交于
      kill the following compile warning.
      
      drivers/ata/libata-core.c:1786: warning: comparison of distinct pointer types lacks a cast
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      03ec52de
    • C
      ahci.c: remove non-existing SB600 raid id (re-send) · c65ec1c2
      Conke Hu 提交于
          SB600 RAID and SB600 SATA is the same controller and share the
      same PCI ID 0x4380. There is no such PCI ID 0x4381.
      Signed-off-by: NConke Hu <conke.hu@gmail.com>
       ---------
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      c65ec1c2
    • T
      libata: improve AC_ERR_DEV handling for ->post_internal_cmd · a51d644a
      Tejun Heo 提交于
      ->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
         correctly.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a51d644a
    • T
      libata: fix native mode disabled port handling · 55a6adee
      Tejun Heo 提交于
      Disabled port handling in ata_pci_init_native_mode() is slightly
      broken in that it may end up using the wrong port_info.  This patch
      updates it such that disables ports are made dummy as done in the
      legacy and other cases.
      
      While at it, fix indentation in ata_resources_present().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      55a6adee
    • T
      ahci: move port_map handling to ahci_save_initial_config() · 17199b18
      Tejun Heo 提交于
      Move cross checking between port_map and cap.n_ports into
      ahci_save_initial_config().  After save_initial_config is done,
      hpriv->port_map is always setup properly.
      
      Tested on JMB363, ICH7 and ICH8 (with dummy ports).
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      17199b18
    • T
      ahci: implement ata_save/restore_initial_config() · d447df14
      Tejun Heo 提交于
      There are several registers which describe how the controller is
      configured.  These registers are sometimes implemented as r/w
      registers which are configured by firmware and get cleared on
      controller reset or after suspend/resume cycle.  ahci saved and
      restored those values inside ahci_reset_controller() which is a bit
      messy and doesn't work over suspend/resume cycle.
      
      This patch implements ahci_save/restore_initial_config().  The save
      function is called during driver initialization and saves cap and
      port_map to hpriv.  The restore function is called after the
      controller is reset to restore the initial values.
      
      Sometimes the initial firmware values are inconsistent and need to be
      fixed up.  This is handled by ahci_save_initial_config().  For this,
      there are two versions of saved registers.  One to write back to the
      hardware register, the other to use during driver operation.  This is
      necessary to keep ahci's behavior unchanged (write back fixed up
      port_map while keeping cap as-is).
      
      This patch makes ahci save the register values once before the first
      controller reset, not after it's been reset.  Also, the same stored
      values are used written back after each reset, so the register values
      are properly recovered after suspend/resume cycle.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d447df14