1. 10 9月, 2010 1 次提交
  2. 02 7月, 2010 1 次提交
    • T
      libata: take advantage of cmwq and remove concurrency limitations · ad72cf98
      Tejun Heo 提交于
      libata has two concurrency related limitations.
      
      a. ata_wq which is used for polling PIO has single thread per CPU.  If
         there are multiple devices doing polling PIO on the same CPU, they
         can't be executed simultaneously.
      
      b. ata_aux_wq which is used for SCSI probing has single thread.  In
         cases where SCSI probing is stalled for extended period of time
         which is possible for ATAPI devices, this will stall all probing.
      
      #a is solved by increasing maximum concurrency of ata_wq.  Please note
      that polling PIO might be used under allocation path and thus needs to
      be served by a separate wq with a rescuer.
      
      #b is solved by using the default wq instead and achieving exclusion
      via per-port mutex.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJeff Garzik <jgarzik@pobox.com>
      ad72cf98
  3. 03 6月, 2010 1 次提交
    • T
      libata: implement on-demand HPA unlocking · d8d9129e
      Tejun Heo 提交于
      Implement ata_scsi_unlock_native_capacity() which will be called
      through SCSI layer when block layer notices that partitions on a
      device extend beyond the end of the device.  It requests EH to unlock
      HPA, waits for completion and returns the current device capacity.
      
      This allows libata to unlock HPA on demand instead of having to decide
      whether to unlock upfront.  Unlocking on demand is safer than
      unlocking by upfront because some BIOSes write private data to the
      area beyond HPA limit.  This was suggested by Ben Hutchings.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Suggested-by: NBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d8d9129e
  4. 26 5月, 2010 5 次提交
    • T
      libata: implement dump_id force param · 43c9c591
      Tejun Heo 提交于
      Add dump_id libata.force parameter.  If specified, libata dumps full
      IDENTIFY data during device configuration.  This is to aid debugging.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Larry Baker <baker@usgs.gov>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      43c9c591
    • T
      libata-sff: make BMDMA optional · 9a7780c9
      Tejun Heo 提交于
      Make BMDMA optional depending on new config variable CONFIG_ATA_BMDMA.
      In Kconfig, drivers are grouped into five groups - non-SFF native, SFF
      w/ custom DMA interface, SFF w/ BMDMA, PIO-only SFF, and generic
      fallback / legacy ones.  Kconfig and Makefile are reorganized
      according to the groups and ordered alphabetically inside each group.
      
      ata_ioports.bmdma_addr and ata_port.bmdma_prd[_dma] are put into
      CONFIG_ATA_BMDMA, as are all bmdma related ops, variables and
      functions.
      
      This increase the binary size slightly when BMDMA is enabled but on
      both native-only and PIO-only configurations the size is slightly
      reduced.  Either way, the size difference is insignificant.  This
      change is more meaningful to signify the separation between SFF and
      BMDMA and as a tool to verify the separation.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      9a7780c9
    • T
      libata-sff: separate out BMDMA init · 1c5afdf7
      Tejun Heo 提交于
      Separate out ata_pci_bmdma_prepare_host() and ata_pci_bmdma_init_one()
      from their SFF counterparts.  SFF ones no longer try to initialize
      BMDMA or set PCI master.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      1c5afdf7
    • T
      libata-sff: separate out BMDMA irq handler · c3b28894
      Tejun Heo 提交于
      Separate out BMDMA irq handler from SFF irq handler.  The misnamed
      host_intr() functions are renamed to ata_sff_port_intr() and
      ata_bmdma_port_intr().  Common parts are factored into
      __ata_sff_port_intr() and __ata_sff_interrupt() and used by sff and
      bmdma interrupt routines.
      
      All BMDMA drivers now use ata_bmdma_interrupt() or
      ata_bmdma_port_intr() while all non-BMDMA SFF ones use
      ata_sff_interrupt() or ata_sff_port_intr().
      
      For now, ata_pci_sff_init_one() uses ata_bmdma_interrupt() as it's
      used by both SFF and BMDMA drivers.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c3b28894
    • T
      libata-sff: ata_sff_irq_clear() is BMDMA specific · 37f65b8b
      Tejun Heo 提交于
      ata_sff_irq_clear() is BMDMA specific.  Rename it to
      ata_bmdma_irq_clear(), move it to ata_bmdma_port_ops and make
      ->sff_irq_clear() optional.
      
      Note: ata_bmdma_irq_clear() is actually only needed by ata_piix and
            possibly by sata_sil.  This should be moved to respective low
            level drivers later.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      37f65b8b
  5. 20 5月, 2010 8 次提交
    • T
      libata-sff: separate out BMDMA qc_issue · 360ff783
      Tejun Heo 提交于
      Separate out ata_bmdma_qc_issue() from ata_sff_qc_issue() such that
      ata_sff_qc_issue() only deals with non-BMDMA SFF protocols (PIO and
      nodata) while ata_bmdma_qc_issue() deals with the BMDMA protocols and
      uses ata_sff_qc_issue() for non-DMA commands.  All the users are
      updated accordingly.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      360ff783
    • T
      libata-sff: prd is BMDMA specific · f60d7011
      Tejun Heo 提交于
      struct ata_prd and ap->prd are BMDMA specific.  Add bmdma_ prefix to
      them and move them inside CONFIG_ATA_SFF.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f60d7011
    • T
      libata-sff: ata_sff_[dumb_]qc_prep are BMDMA specific · f47451c4
      Tejun Heo 提交于
      Both qc_prep functions deal only with BMDMA PRD setup and PIO only SFF
      drivers don't need them.  Rename to ata_bmdma_[dumb_]qc_prep() and
      relocate.
      
      All usages are renamed except for pdc_adma and sata_qstor.  Those two
      drivers are not BMDMA drivers and don't need to call BMDMA qc_prep
      functions.  Calls to ata_sff_qc_prep() in the two drivers are removed.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      f47451c4
    • T
      libata-sff: separate out BMDMA EH · fe06e5f9
      Tejun Heo 提交于
      Some of error handling logic in ata_sff_error_handler() and all of
      ata_sff_post_internal_cmd() are for BMDMA.  Create
      ata_bmdma_error_handler() and ata_bmdma_post_internal_cmd() and move
      BMDMA part into those.
      
      While at it, change DMA protocol check to ata_is_dma(), fix
      post_internal_cmd to call ap->ops->bmdma_stop instead of directly
      calling ata_bmdma_stop() and open code hardreset selection so that
      ata_std_error_handler() doesn't have to know about sff hardreset.
      
      As these two functions are BMDMA specific, there's no reason to check
      for bmdma_addr before calling bmdma methods if the protocol of the
      failed command is DMA.  sata_mv and pata_mpc52xx now don't need to set
      .post_internal_cmd to ATA_OP_NULL and pata_icside and sata_qstor don't
      need to set it to their bmdma_stop routines.
      
      ata_sff_post_internal_cmd() becomes noop and is removed.
      
      This fixes p3 described in clean-up-BMDMA-initialization patch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      fe06e5f9
    • T
      libata-sff: port_task is SFF specific · c429137a
      Tejun Heo 提交于
      port_task is tightly bound to the standard SFF PIO HSM implementation.
      Using it for any other purpose would be error-prone and there's no
      such user and if some drivers need such feature, it would be much
      better off using its own.  Move it inside CONFIG_ATA_SFF and rename it
      to sff_pio_task.
      
      The only function which is exposed to the core layer is
      ata_sff_flush_pio_task() which is renamed from ata_port_flush_task()
      and now also takes care of resetting hsm_task_state to HSM_ST_IDLE,
      which is possible as it's now specific to PIO HSM.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c429137a
    • T
      libata-sff: ap->[last_]ctl are SFF specific · 5fe7454a
      Tejun Heo 提交于
      ap->[last_]ctl are specific to SFF controllers.  Put them inside
      CONFIG_ATA_SFF and move initialization into ata_sff_port_init().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      5fe7454a
    • T
      libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo() · 8244cd05
      Tejun Heo 提交于
      ->drain_fifo() is SFF specific.  Rename and relocate it.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      8244cd05
    • T
      libata-sff: clean up BMDMA initialization · c7087652
      Tejun Heo 提交于
      When BMDMA initialization failed or BMDMA was not available for
      whatever reason, bmdma_addr was left at zero and used as an indication
      that BMDMA shouldn't be used.  This leads to the following problems.
      
      p1. For BMDMA drivers which don't use traditional BMDMA register,
          ata_bmdma_mode_filter() incorrectly inhibits DMA modes.  Those
          drivers either have to inherit from ata_sff_port_ops or clear
          ->mode_filter explicitly.
      
      p2. non-BMDMA drivers call into BMDMA PRD table allocation.  It
          doesn't actually allocate PRD table if bmdma_addr is not
          initialized but is still confusing.
      
      p3. For BMDMA drivers which don't use traditional BMDMA register, some
          methods might not be invoked as expected (e.g. bmdma_stop from
          ata_sff_post_internal_cmd()).
      
      p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops
          worrying libata core might call into one of them.
      
      These problems are caused by the muddy line between SFF and BMDMA and
      the assumption that all BMDMA controllers initialize bmdma_addr.
      
      This patch fixes p1 and p2 by removing the bmdma_addr assumption and
      moving prd allocation to BMDMA port start.  Later patches will fix the
      remaining issues.
      
      This patch improves BMDMA initialization such that
      
      * When BMDMA register initialization fails, falls back to PIO instead
        of failing.  ata_pci_bmdma_init() never fails now.
      
      * When ata_pci_bmdma_init() falls back to PIO, it clears
        ap->mwdma_mask and udma_mask instead of depending on
        ata_bmdma_mode_filter().  This makes ata_bmdma_mode_filter()
        unnecessary thus resolving p1.
      
      * ata_port_start() which actually is BMDMA specific is moved to
        ata_bmdma_port_start().  ata_port_start() and ata_sff_port_start()
        are killed.
      
      * ata_sff_port_start32() is moved and renamed to
        ata_bmdma_port_start32().
      
      Drivers which no longer call into PRD table allocation are...
      
        pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all
        drivers which inherit from ata_sff_port_ops.
      
      pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD
      but is a BMDMA controller and doesn't have custom port_start like
      other such controllers.
      
      Note that with the previous patch which makes all and only BMDMA
      drivers inherit from ata_bmdma_port_ops, this change doesn't break
      drivers which need PRD table.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c7087652
  6. 18 5月, 2010 2 次提交
    • T
      libata-sff: reorder SFF/BMDMA functions · 9f2f7210
      Tejun Heo 提交于
      Reorder functions such that SFF and BMDMA functions are grouped.
      While at it, s/BMDMA/SFF in a few comments where it actually meant
      SFF.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      9f2f7210
    • T
      libata: kill ATA_FLAG_DISABLED · 3e4ec344
      Tejun Heo 提交于
      ATA_FLAG_DISABLED is only used by drivers which don't use
      ->error_handler framework and is largely broken.  Its only meaningful
      function is to make irq handlers skip processing if the flag is set,
      which is largely useless and even harmful as it makes those ports more
      likely to cause IRQ storms.
      
      Kill ATA_FLAG_DISABLED and makes the callers disable attached devices
      instead.  ata_port_probe() and ata_port_disable() which manipulate the
      flag are also killed.
      
      This simplifies condition check in IRQ handlers.  While updating IRQ
      handlers, remove ap NULL check as libata guarantees consecutive port
      allocation (unoccupied ports are initialized with dummies) and
      long-obsolete ATA_QCFLAG_ACTIVE check (checked by ata_qc_from_tag()).
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3e4ec344
  7. 15 5月, 2010 4 次提交
    • S
      libata: make sff_irq_on() method optional · e42a542b
      Sergei Shtylyov 提交于
      Now, with the introduction of the sff_set_devctl() method, we can
      use it in sff_irq_on() method too -- that way its implementations
      in 'pata_bf54x' and 'pata_scc' become virtually identical to
      ata_sff_irq_on().  The sff_irq_on() method now becomes quite
      superfluous, and the only reason not to remove it completely is
      the existence of the 'pata_octeon_cf' driver which implements it
      as an empty function. Just make the method optional then, with
      ata_sff_irq_on() becoming generic taskfile-bound function, still
      global for the 'pata_bf54x' driver to be able to call it from its
      thaw() and postreset() methods.
      
      While at it, make the sff_irq_on() method and ata_sff_irq_on() return
      'void' as the result is always ignored anyway.
      Signed-off-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      e42a542b
    • S
      libata: introduce sff_set_devctl() method · 41dec29b
      Sergei Shtylyov 提交于
      The set of libata's taskfile access methods is clearly incomplete as
      it lacks a method to write to the device control register -- which
      forces drivers like 'pata_bf54x' and 'pata_scc' to implement more
      "high level" (and more weighty) methods like freeze() and postreset().
      
      So, introduce the optional sff_set_devctl() method which the drivers
      only have to implement if the standard iowrite8() can't be used (just
      like the existing sff_check_altstatus() method) and make use of it
      in the freeze() and postreset() method implementations (I could also
      have used it in softreset() method but it also reads other taskfile
      registers without using tf_read() making that quite pointless);
      this makes freeze() method implementations in the 'pata_bf54x' and
      'pata_scc' methods virtually identical to ata_sff_freeze(), so we
      can get rid of them completely.
      Signed-off-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      41dec29b
    • T
      libata: use longer 0xff wait if parallel scan is enabled · b48d58f5
      Tejun Heo 提交于
      There are some SATA devices which take relatively long to get out of
      0xff status after reset.  In libata, this timeout is determined by
      ATA_TMOUT_FF_WAIT.  Quantum GoVault is the worst requring about 2s for
      reliable detection.  However, because 2s 0xff timeout can introduce
      rather long spurious delay during boot, libata has been compromising
      at the next longest timeout of 800ms for HHD424020F7SV00 iVDR drive.
      
      Now that parallel scan is in place for common drivers, libata can
      afford 2s 0xff timeout.  Use 2s 0xff timeout if parallel scan is
      enabled.
      
      Please note that the chance of spurious wait is pretty slim w/ working
      SCR access so this will only affect SATA controllers w/o SCR access
      which isn't too common these days.
      
      Please read the following thread for more information on the GoVault
      drive.
      
        http://thread.gmane.org/gmane.linux.ide/14545/focus=14663Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Gary Hade <garyhade@us.ibm.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      b48d58f5
    • S
      libata-sff: kill unused ata_bus_reset() · 29444088
      Sergei Shtylyov 提交于
      ... since I see no callers of it.
      Signed-off-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      29444088
  8. 06 4月, 2010 1 次提交
  9. 02 3月, 2010 2 次提交
    • A
      libata: Pass host flags into the pci helper · 16ea0fc9
      Alan Cox 提交于
      This allows parallel scan and the like to be set without having to stop
      using the existing full helper functions. This patch merely adds the argument
      and fixes up the callers. It doesn't undo the special cases already in the
      tree or add any new parallel callers.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      16ea0fc9
    • T
      libata: implement spurious irq handling for SFF and apply it to piix · 27943620
      Tejun Heo 提交于
      Traditional IDE interface sucks in that it doesn't have a reliable IRQ
      pending bit, so if the controller raises IRQ while the driver is
      expecting it not to, the IRQ won't be cleared and eventually the IRQ
      line will be killed by interrupt subsystem.  Some controllers have
      non-standard mechanism to indicate IRQ pending so that this condition
      can be detected and worked around.
      
      This patch adds an optional operation ->sff_irq_check() which will be
      called for each port from the ata_sff_interrupt() if an unexpected
      interrupt is received.  If the operation returns %true,
      ->sff_check_status() and ->sff_irq_clear() will be cleared for the
      port.  Note that this doesn't mark the interrupt as handled so it
      won't prevent IRQ subsystem from killing the IRQ if this mechanism
      fails to clear the spurious IRQ.
      
      This patch also implements ->sff_irq_check() for ata_piix.  Note that
      this adds slight overhead to shared IRQ operation as IRQs which are
      destined for other controllers will trigger extra register accesses to
      check whether IDE interrupt is pending but this solves rare screaming
      IRQ cases and for some curious reason also helps weird BIOS related
      glitch on Samsung n130 as reported in bko#14314.
      
        http://bugzilla.kernel.org/show_bug.cgi?id=14314
      
      * piix_base_ops dropped as suggested by Sergei.
      
      * Spurious IRQ detection doesn't kick in anymore if polling qc is in
        progress.  This provides less protection but some controllers have
        possible data corruption issues if the wrong register is accessed
        while a command is in progress.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NJohannes Stezenbach <js@sig21.net>
      Reported-by: NHans Werner <hwerner4@gmx.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      27943620
  10. 13 1月, 2010 1 次提交
  11. 05 12月, 2009 1 次提交
    • M
      [SCSI] modify change_queue_depth to take in reason why it is being called · e881a172
      Mike Christie 提交于
      This patch modifies scsi_host_template->change_queue_depth so that
      it takes an argument indicating why it is being called. This will be
      used so that if a LLD needs to do some extra processing when
      handling queue fulls or later ramp ups, it can do so.
      
      This is a simple port of the drivers setting a change_queue_depth
      callback. In the patch I just have these LLDs adjust the queue depth
      if the user was requesting it.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      
      [Vasu.Dev: v2
      	Also converted pmcraid_change_queue_depth and then verified
      all modules compile  using "make allmodconfig" for any new build
      warnings on X86_64.
      
      	Updated original description after combing two original
      patches from Mike to make this patch git bisectable.]
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      [jejb: fixed up 53c700]
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      e881a172
  12. 04 12月, 2009 1 次提交
  13. 03 12月, 2009 1 次提交
    • T
      libata: retry failed FLUSH if device didn't fail it · 6013efd8
      Tejun Heo 提交于
      If ATA device failed FLUSH, it means that the device failed to write
      out some amount of data and the error needs to be reported to upper
      layers. As retries can't recover the lost data, FLUSH failures need to
      be reported immediately in general.
      
      However, if FLUSH fails due to transmission errors, the FLUSH needs to
      be retried; otherwise, filesystems may switch to RO mode and/or raid
      array may drop a drive for a random transmission glitch.
      
      This condition can be rather easily reproduced on certain ahci
      controllers which go through a PHY event after powersave mode switch +
      ext4 combination.  Powersave mode switch is often closely followed by
      flush from the filesystem failing the FLUSH with ATA bus error which
      makes the filesystem code believe that data is lost and drop to RO
      mode.  This was reported in the following bugzilla bug.
      
        http://bugzilla.kernel.org/show_bug.cgi?id=14543
      
      This patch makes libata EH retry FLUSH if it wasn't failed by the
      device.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NAndrey Vihrov <andrey.vihrov@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6013efd8
  14. 06 10月, 2009 3 次提交
  15. 02 9月, 2009 2 次提交
  16. 29 7月, 2009 1 次提交
  17. 15 7月, 2009 1 次提交
  18. 17 4月, 2009 1 次提交
    • A
      ata: Report 16/32bit PIO as best we can · e3cf95dd
      Alan Cox 提交于
      The legacy old IDE ioctl API for this is a bit primitive so we try
      and map stuff sensibly onto it.
      
      - Set PIO over DMA devices to report 32bit
      - Add ability to change the PIO32 settings if the controller permits it
      - Add that functionality into the sff drivers
      - Add that functionality into the VLB legacy driver
      - Turn on the 32bit PIO on the ninja32 and add support there
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      e3cf95dd
  19. 30 3月, 2009 1 次提交
  20. 25 3月, 2009 2 次提交