1. 26 5月, 2010 2 次提交
    • 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
  2. 20 5月, 2010 5 次提交
    • 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: 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
  3. 18 5月, 2010 1 次提交
    • 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
  4. 15 5月, 2010 1 次提交
  5. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  6. 26 2月, 2010 1 次提交
  7. 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
  8. 16 10月, 2009 1 次提交
  9. 12 8月, 2009 1 次提交
    • T
      sata_nv: MSI support, disabled by default · 51c89499
      Tony Vroon 提交于
      At least the nVidia MCP55 controller quite happily supports MSI.
      This adds an option to use it. It is disabled by default.
      As per feedback by Robert Hancock, it will honour the user
      request as the kernel will not enable MSI where the controller
      or the specific system configuration do not support it.
      Signed-off-by: NTony Vroon <tony@linx.net>
      Cc: Robert Hancock <hancockrwd@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      51c89499
  10. 10 6月, 2009 1 次提交
    • T
      sata_nv: use hardreset only for post-boot probing · 7f4774b3
      Tejun Heo 提交于
      When I thought it was finally defeated, it came back with vengeance.
      The failure cases are ever more convoluted.  Now there is a single
      combination which fails boot probing - MCP5x + Intel SSD and there are
      two hotplug failure reports on different flavors where softreset fails
      to bring up the device.
      
      Through the many bug reports after the switch to hardreset, the
      following patterns emerged.
      
      - Softreset during boot always works.
      
      - Hardreset during boot sometimes fails to bring up the link on
        certain comibnations and device signature acquisition is unreliable.
      
      - Hardreset is often necessary after hotplug.
      
      It looks like the old behavior of preferring softreset was somehow
      pretty close to the working reset protocol although it could have lost
      a device during phy error handling by issuing hardreset.
      
      This patch implements nv_hardreset() which kicks in only for post-boot
      (!LOADING) device probing resets.  This should be able to work around
      all known problem cases.  This isn't perfect but given the various
      hardreset quirks on these controllers, I think this is as good as it
      can get.
      
      Tested on mcp5x (swncq), nf3 and ck804 for all both boot, warm and
      hot probing cases.
      
      Kudos to all the bug reporters and their painful hours with these damn
      controllers.  ;-)
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Robert Hancock <hancockr@shaw.ca>
      Reported-by: NDavid Lang <david@lang.hm>
      Reported-by: NSamo Vodopivec <lament.email.si@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      7f4774b3
  11. 25 3月, 2009 2 次提交
  12. 05 3月, 2009 1 次提交
  13. 17 2月, 2009 1 次提交
  14. 03 2月, 2009 1 次提交
  15. 26 1月, 2009 2 次提交
  16. 04 11月, 2008 1 次提交
    • T
      sata_nv: fix generic, nf2/3 detection regression · 3c324283
      Tejun Heo 提交于
      All three flavors of sata_nv's are different in how their hardreset
      behaves.
      
      * generic: Hardreset is not reliable.  Link often doesn't come online
        after hardreset.
      
      * nf2/3: A little bit better - link comes online with longer debounce
        timing.  However, nf2/3 can't reliable wait for the first D2H
        Register FIS, so it can't wait for device readiness or classify the
        device after hardreset.  Follow-up SRST required.
      
      * ck804: Hardreset finally works.
      
      The core layer change to prefer hardreset and follow up changes
      exposed the above issues and caused various detection regressions for
      all three flavors.  This patch, hopefully, fixes all the known issues
      and should make sata_nv error handling more reliable.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3c324283
  17. 29 9月, 2008 2 次提交
  18. 09 9月, 2008 1 次提交
    • T
      sata_nv: disable hardreset for generic · 2fd673ec
      Tejun Heo 提交于
      of them being unifying probing, hotplug and EH reset paths uniform.
      Previously, broken hardreset could go unnoticed as it wasn't used
      during probing but when something goes wrong or after hotplug the
      problem will surface and bite hard.
      
      OSDL bug 11195 reports that sata_nv generic flavor falls into this
      category.  Hardreset itself succeeds but PHY stays offline after
      hardreset.  I tried longer debounce timing but the result was the
      same.
      
        http://bugzilla.kernel.org/show_bug.cgi?id=11195
      
      So, it seems we'll have to drop hardreset from the generic flavor.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Peer Chen <pchen@nvidia.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      2fd673ec
  19. 25 4月, 2008 1 次提交
  20. 18 4月, 2008 11 次提交
    • T
      libata: rename SFF port ops · 5682ed33
      Tejun Heo 提交于
      Add sff_ prefix to SFF specific port ops.
      
      This rename is in preparation of separating SFF support out of libata
      core layer.  This patch strictly renames ops and doesn't introduce any
      behavior difference.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      5682ed33
    • T
      libata: rename SFF functions · 9363c382
      Tejun Heo 提交于
      SFF functions have confusing names.  Some have sff prefix, some have
      bmdma, some std, some pci and some none.  Unify the naming by...
      
      * SFF functions which are common to both BMDMA and non-BMDMA are
        prefixed with ata_sff_.
      
      * SFF functions which are specific to BMDMA are prefixed with
        ata_bmdma_.
      
      * SFF functions which are specific to PCI but apply to both BMDMA and
        non-BMDMA are prefixed with ata_pci_sff_.
      
      * SFF functions which are specific to PCI and BMDMA are prefixed with
        ata_pci_bmdma_.
      
      * Drop generic prefixes from LLD specific routines.  For example,
        bfin_std_dev_select -> bfin_dev_select.
      
      The following renames are noteworthy.
      
        ata_qc_issue_prot() -> ata_sff_qc_issue()
        ata_pci_default_filter() -> ata_bmdma_mode_filter()
        ata_dev_try_classify() -> ata_sff_dev_classify()
      
      This rename is in preparation of separating SFF support out of libata
      core layer.  This patch strictly renames functions and doesn't
      introduce any behavior difference.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      9363c382
    • 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
    • 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
    • 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: 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: 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
  21. 06 2月, 2008 1 次提交
    • R
      sata_nv: fix ATAPI issues with memory over 4GB (v7) · 8959d300
      Robert Hancock 提交于
      This fixes some problems with ATAPI devices on nForce4 controllers in ADMA mode
      on systems with memory located above 4GB. We need to delay setting the 64-bit
      DMA mask until the PRD table and padding buffer are allocated so that they don't
      get allocated above 4GB and break legacy mode (which is needed for ATAPI
      devices). Also, if either port is in ATAPI mode we need to set the DMA mask
      for the PCI device to 32-bit to ensure that the IOMMU code properly bounces
      requests above 4GB, as it appears setting the bounce limit does not guarantee
      that we will not try to map requests above this point.
      
      Reported to fix https://bugzilla.redhat.com/show_bug.cgi?id=351451Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      8959d300
  22. 02 2月, 2008 1 次提交
    • R
      sata_nv: fix for completion handling · a1fe7824
      Robert Hancock 提交于
      This patch is based on an original patch from Kuan Luo of NVIDIA,
      posted under subject "fixed a bug of adma in rhel4u5 with HDS7250SASUN500G".
      His description follows. I've reworked it a bit to avoid some unnecessary
      repeated checks but it should be functionally identical.
      
      "The patch is to solve the error message "ata1: CPB flags CMD err,
      flags=0x11" when testing HDS7250SASUN500G in rhel4u5.
      I tested this hd in 2.6.24-rc7 which needed to remove the mask in
      blacklist to run the ncq and the same error also showed up.
      
      I traced the  bug and found that the interrupt finished a command (for
      example, tag=0) when the driver got that adma status is
      NV_ADMA_STAT_DONE  and  cpb->resp_flags is NV_CPB_RESP_DONE.
      However, For this hd, the drive maybe didn't clear bit 0 at this moment.
      It meaned the hardware  had not completely finished the command.
      If at the same time  the driver freed the command(tag 0) and sended
      another command (tag 0), the error happened.
      
      The notifier register is 32-bit register containing notifier value.
      Value is bit vector containing one bit per tag number (0-31) in
      corresponding bit positions (bit 0 is for tag 0, etc). When bit is set
      then ADMA indicates that command with corresponding tag number completed
      execution.
      
      So i added the check notifier code. Sometimes i saw that the notifier
      reg set some bits  , but the adma status set NV_ADMA_STAT_CMD_COMPLETE
      ,not NV_ADMA_STAT_DONE. So i added the NV_ADMA_STAT_CMD_COMPLETE check
      code."
      Signed-off-by: NRobert Hancock <hancockr@shaw.ca>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a1fe7824