1. 19 May, 2010 8 commits
    • Tejun Heo's avatar
      libata-sff: ata_sff_[dumb_]qc_prep are BMDMA specific · f47451c4
      Tejun Heo authored
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      f47451c4
    • Tejun Heo's avatar
      libata-sff: separate out BMDMA EH · fe06e5f9
      Tejun Heo authored
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      fe06e5f9
    • Tejun Heo's avatar
      libata-sff: port_task is SFF specific · c429137a
      Tejun Heo authored
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      c429137a
    • Tejun Heo's avatar
      libata-sff: ap->[last_]ctl are SFF specific · 5fe7454a
      Tejun Heo authored
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      5fe7454a
    • Tejun Heo's avatar
      libata-sff: rename ap->ops->drain_fifo() to sff_drain_fifo() · 8244cd05
      Tejun Heo authored
      ->drain_fifo() is SFF specific.  Rename and relocate it.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      8244cd05
    • Tejun Heo's avatar
      libata-sff: introduce ata_sff_init/exit() and ata_sff_port_init() · 270390e1
      Tejun Heo authored
      In preparation of proper SFF/BMDMA separation, introduce
      ata_sff_init/exit() and ata_sff_port_init().  These functions
      currently don't do anything.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      270390e1
    • Tejun Heo's avatar
      libata-sff: clean up BMDMA initialization · c7087652
      Tejun Heo authored
      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: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      c7087652
    • Tejun Heo's avatar
      libata-sff: clean up inheritance in several drivers · 8930ff25
      Tejun Heo authored
      1. pata_cmd640 is PIO only.  Inherit from sff.
      
      2. pata_macio is BMDMA.  Inherit from bmdma and drop explicit
         bmdma_mode_filter() setting.
      
      3. In sata_mv, unlike mv5, mv6 is BMDMA.  Inherit from bmdma and
         don't clear ->post_internal_cmd().
      
      4. bf54x and icside are quasi-BMDMA controllers which don't use the
         standard BMDMA registers so they don't initialize bmdma_addr and
         inherit from sff to avoid the default mode_filter which disables
         DMA modes if bmdma_addr is not initialized.
      
      For 2 and 3, this patch makes the drivers explicitly specify
      ->mode_filter to ATA_OP_NULL while inheriting from ata_bmdma_port_ops.
      These will be removed by the next patch.
      
      This patch makes all and only BMDMA drivers inherit from
      ata_bmdma_port_ops to ease further SFF/BMDMA separation.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      8930ff25
  2. 18 May, 2010 3 commits
  3. 15 May, 2010 8 commits
  4. 14 May, 2010 21 commits