1. 03 Jan, 2013 1 commit
    • Greg Kroah-Hartman's avatar
      Drivers: ata: remove __dev* attributes. · 0ec24914
      Greg Kroah-Hartman authored
      CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
      markings need to be removed.
      This change removes the use of __devinit, __devexit_p, __devinitdata,
      and __devexit from these drivers.
      Based on patches originally written by Bill Pemberton, but redone by me
      in order to handle some of the coding style issues better, by hand.
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Cc: Viresh Kumar <viresh.linux@gmail.com>
      Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  2. 18 Jan, 2012 1 commit
  3. 09 Jan, 2012 1 commit
    • Sergei Shtylyov's avatar
      pata_bf54x: fix BMIDE status register emulation · 909fefc2
      Sergei Shtylyov authored
      The author of this driver clearly wasn't familiar with the BMIDE specification
      (also known as SFF-8038i) when he implemented the bmdma_status() method: first,
      the interrupt bit of the BMIDE status register corresponds to nothing else but
      INTRQ signal (ATAPI_DEV_INT here); second, the error bit is only set if the
      controller encounters issue doing the bus master transfers, not on the IDE DMA
      burst termination interrupts like here (moreover, setting the error bit doesn't
      cause an interrupt).  We now need to disable all those unused interrupts...
      (The only thing I couldn't figure out is how to flush the FIFO to memory once
      the interrupt happens as required by the mentioned spec.)
      Signed-off-by: 's avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: 's avatarSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@redhat.com>
  4. 23 Jul, 2011 1 commit
    • Joe Perches's avatar
      ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> · a9a79dfe
      Joe Perches authored
      Saves text by removing nearly duplicated text format strings by
      creating ata_<foo>_printk functions and printf extension %pV.
      ata defconfig size shrinks ~5% (~8KB), allyesconfig ~2.5% (~13KB)
      Format string duplication comes from:
       #define ata_link_printk(link, lv, fmt, args...) do { \
             if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link)    \
                     printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id,   \
                            (link)->pmp , ##args); \
             else \
                     printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
             } while(0)
      Coalesce long formats.
      $ size drivers/ata/built-in.*
         text	   data	    bss	    dec	    hex	filename
       544969	  73893	 116584	 735446	  b38d6	drivers/ata/built-in.allyesconfig.ata.o
       558429	  73893	 117864	 750186	  b726a	drivers/ata/built-in.allyesconfig.dev_level.o
       141328	  14689	   4220	 160237	  271ed	drivers/ata/built-in.defconfig.ata.o
       149567	  14689	   4220	 168476	  2921c	drivers/ata/built-in.defconfig.dev_level.o
      Signed-off-by: 's avatarJoe Perches <joe@perches.com>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@pobox.com>
  5. 31 Mar, 2011 1 commit
  6. 02 Mar, 2011 2 commits
  7. 22 Oct, 2010 2 commits
  8. 09 Aug, 2010 1 commit
  9. 25 May, 2010 1 commit
  10. 19 May, 2010 2 commits
    • 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
      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
      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: 's avatarTejun Heo <tj@kernel.org>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@redhat.com>
    • 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: 's avatarTejun Heo <tj@kernel.org>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@redhat.com>
  11. 18 May, 2010 1 commit
    • Tejun Heo's avatar
      libata: kill ATA_FLAG_DISABLED · 3e4ec344
      Tejun Heo authored
      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: 's avatarTejun Heo <tj@kernel.org>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@redhat.com>
  12. 14 May, 2010 2 commits
    • Sergei Shtylyov's avatar
      libata: make sff_irq_on() method optional · e42a542b
      Sergei Shtylyov authored
      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: 's avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@redhat.com>
    • Sergei Shtylyov's avatar
      libata: introduce sff_set_devctl() method · 41dec29b
      Sergei Shtylyov authored
      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: 's avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@redhat.com>
  13. 21 Dec, 2009 1 commit
  14. 25 Mar, 2009 1 commit
  15. 29 Dec, 2008 1 commit
  16. 29 Sep, 2008 1 commit
  17. 14 Jul, 2008 1 commit
    • Tejun Heo's avatar
      libata: consistently use msecs for time durations · 341c2c95
      Tejun Heo authored
      libata has been using mix of jiffies and msecs for time druations.
      This is getting confusing.  As writing sub HZ values in jiffies is
      PITA and msecs_to_jiffies() can't be used as initializer, unify unit
      for all time durations to msecs.  So, durations are in msecs and
      deadlines are in jiffies.  ata_deadline() is added to compute deadline
      from a start time and duration in msecs.
      While at it, drop now superflous _msec suffix from arguments and
      rename @timeout to @deadline if it represents a fixed point in time
      rather than duration.
      Signed-off-by: 's avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@redhat.com>
  18. 19 May, 2008 1 commit
  19. 29 Apr, 2008 1 commit
  20. 25 Apr, 2008 2 commits
  21. 17 Apr, 2008 8 commits
    • Tejun Heo's avatar
      libata: move link onlineness check out of softreset methods · 45db2f6c
      Tejun Heo authored
      Currently, SATA softresets should do link onlineness check before
      actually performing SRST protocol but it doesn't really belong to
      This patch moves onlineness check in softreset to ata_eh_reset() and
      ata_eh_followup_srst_needed() to clean up code and help future sata_mv
      changes which need clear separation between SCR and TF accesses.
      sata_fsl is peculiar in that its softreset really isn't softreset but
      combination of hardreset and softreset.  This patch adds dummy private
      ->prereset to keep the current behavior but the driver really should
      implement separate hard and soft resets and return -EAGAIN from
      hardreset if it should be follwed by softreset.
      Signed-off-by: 's avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: 's avatarJeff Garzik <jgarzik@redhat.com>
    • Tejun Heo's avatar
      libata: rename SFF port ops · 5682ed33
      Tejun Heo authored
      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: 's avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      libata: rename SFF functions · 9363c382
      Tejun Heo authored
      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
      * 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
      * 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: 's avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      libata: kill ata_chk_status() · 6fd36390
      Tejun Heo authored
      ata_chk_status() just calls ops->check_status and it only adds
      confusion with other status functions.  Kill it.
      Signed-off-by: 's avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: 's avatarJeff Garzik <jeff@garzik.org>
    • Tejun Heo's avatar
      libata: make reset related methods proper port operations · a1efdaba
      Tejun Heo authored
      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: 's avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      libata: implement and use ops inheritance · 029cfd6b
      Tejun Heo authored
      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: 's avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      libata: implement and use SHT initializers · 68d1d07b
      Tejun Heo authored
      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: 's avatarTejun Heo <htejun@gmail.com>
    • Tejun Heo's avatar
      libata: normalize port_info, port_operations and sht tables · 6bd99b4e
      Tejun Heo authored
      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
      * 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
      * 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: 's avatarTejun Heo <htejun@gmail.com>
  22. 01 Feb, 2008 4 commits
  23. 23 Jan, 2008 2 commits
    • Tejun Heo's avatar
      libata: convert to chained sg · ff2aeb1e
      Tejun Heo authored
      libata used private sg iterator to handle padding sg.  Now that sg can
      be chained, padding can be handled using standard sg ops.  Convert to
      chained sg.
      * s/qc->__sg/qc->sg/
      * s/qc->pad_sgent/qc->extra_sg[]/.  Because chaining consumes one sg
        entry.  There need to be two extra sg entries.  The renaming is also
        for future addition of other extra sg entries.
      * Padding setup is moved into ata_sg_setup_extra() which is organized
        in a way that future addition of other extra sg entries is easy.
      * qc->orig_n_elem is unused and removed.
      * qc->n_elem now contains the number of sg entries that LLDs should
        map.  qc->mapped_n_elem is added to carry the original number of
        mapped sgs for unmapping.
      * The last sg of the original sg list is used to chain to extra sg
        list.  The original last sg is pointed to by qc->last_sg and the
        content is stored in qc->saved_last_sg.  It's restored during
      * All sg walking code has been updated.  Unnecessary assertions and
        checks for conditions the core layer already guarantees are removed.
      Signed-off-by: 's avatarTejun Heo <htejun@gmail.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: 's avatarJeff Garzik <jeff@garzik.org>
    • Tejun Heo's avatar
      libata: update ->data_xfer hook for ATAPI · 55dba312
      Tejun Heo authored
      Depending on how many bytes are transferred as a unit, PIO data
      transfer may consume more bytes than requested.  Knowing how much
      data is consumed is necessary to determine how much is left for
      draining.  This patch update ->data_xfer such that it returns the
      number of consumed bytes.
      While at it, it also makes the following changes.
      * s/adev/dev/
      * use READ/WRITE constants for rw indication
      * misc clean ups
      Signed-off-by: 's avatarTejun Heo <htejun@gmail.com>
      Signed-off-by: 's avatarJeff Garzik <jeff@garzik.org>
  24. 15 Jan, 2008 1 commit
    • Andrew Morton's avatar
      [libata] pata_bf54x: checkpatch fixes · ed722d3d
      Andrew Morton authored
      WARNING: line over 80 characters
      #36: FILE: drivers/ata/pata_bf54x.c:1512:
      +	while (bfin_port_info[board_idx].udma_mask>0 && udma_fsclk[udma_mode] > fsclk) {
      ERROR: need spaces around that '>' (ctx:VxV)
      #36: FILE: drivers/ata/pata_bf54x.c:1512:
      +	while (bfin_port_info[board_idx].udma_mask>0 && udma_fsclk[udma_mode] > fsclk) {
      total: 1 errors, 1 warnings, 19 lines checked
      Your patch has style problems, please review.  If any of these errors
      are false positives report them to the maintainer, see
      Please run checkpatch prior to sending patches
      Cc: Jeff Garzik <jeff@garzik.org>
      Cc: Sonic Zhang <sonic.zhang@analog.com>
      Cc: Tejun Heo <htejun@gmail.com>
      Cc: sonic zhang <sonic.adi@gmail.com>
      Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: 's avatarJeff Garzik <jeff@garzik.org>