15 Oct, 2011

3 commits


24 Jul, 2011

1 commit

  • Saves text by removing nearly duplicated text format strings by
    creating ata__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: Joe Perches
    Signed-off-by: Jeff Garzik

    Joe Perches
     

13 Nov, 2010

1 commit


26 Aug, 2010

1 commit


04 Dec, 2009

3 commits


06 Jun, 2009

1 commit

  • The basic problem here that pata_legacy attaches the host, sees if it found
    any devices and detaches it if none were found. With async probing, it's not
    waiting until discovery is finished before deciding it has no devices and
    trying the detach leading to this warning:

    ata1: PATA max PIO4 cmd 0x1f0 ctl 0x3f6 irq 14
    ------------[ cut here ]------------
    WARNING: at drivers/ata/libata-core.c:6222 ata_host_detach+0x75/0x90()
    Modules linked in:
    Pid: 1, comm: swapper Not tainted 2.6.30-rc7 #1
    Call Trace:
    [] ? ata_host_detach+0x75/0x90
    [] ? ata_host_detach+0x75/0x90
    [] ? warn_slowpath_common+0x45/0x80
    [] ? warn_slowpath_null+0xa/0x10
    [] ? ata_host_detach+0x75/0x90
    [] ? legacy_init+0x44e/0x87f
    [] ? legacy_init+0x0/0x87f
    [] ? _stext+0x21/0x140
    [] ? proc_register+0x2f/0x190
    [] ? create_proc_entry+0x5c/0xc0
    [] ? register_irq_proc+0x6e/0x90
    [] ? kernel_init+0x6e/0xbf
    [] ? kernel_init+0x0/0xbf
    [] ? kernel_thread_helper+0x7/0x10
    ---[ end trace ef1ee36e873ae3a0 ]---

    Because it detaches before the probe is complete.

    One way to fix it would be to put an async_synchronize_full() before looking
    for devices, which this patch does. A better way might be to separate libata
    into its own domain and only wait for that.

    Reported-by: Mikael Pettersson
    Signed-off-by: James Bottomley
    Signed-off-by: Jeff Garzik

    James Bottomley
     

18 Apr, 2009

1 commit

  • fix those errors:

    drivers/ata/pata_legacy.c: In function ‘pdc_data_xfer_vlb’:
    drivers/ata/pata_legacy.c:289: error: ‘ap’ undeclared (first use in this function)
    drivers/ata/pata_legacy.c:289: error: (Each undeclared identifier is reported only once
    drivers/ata/pata_legacy.c:289: error: for each function it appears in.)
    drivers/ata/pata_legacy.c: At top level:
    drivers/ata/pata_legacy.c:869: error: ‘ATA_PFLAG_PIO32_CHANGE’ undeclared here (not in a
    +function)
    make[2]: *** [drivers/ata/pata_legacy.o] Error 1
    make[1]: *** [drivers/ata] Error 2

    Signed-off-by: Zhenwen Xu
    Acked-by: Alan Cox
    Signed-off-by: Jeff Garzik

    Zhenwen Xu
     

17 Apr, 2009

2 commits

  • 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: Alan Cox
    Signed-off-by: Jeff Garzik

    Alan Cox
     
  • When pata_legacy can't detect any device, it unregisters the
    platform_device and fails detection. However, it forgets to detach
    ata host triggering weird failures as the host later gets freed by
    devres while still attached. Fix it.

    Signed-off-by: Tejun Heo
    Reported-by: Peter Zijlstra
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

25 Mar, 2009

1 commit


26 Feb, 2009

1 commit


29 Dec, 2008

2 commits

  • Signed-off-by: Qinghuang Feng

    Qinghuang Feng
     
  • There currently are the following looping constructs.

    * __ata_port_for_each_link() for all available links
    * ata_port_for_each_link() for edge links
    * ata_link_for_each_dev() for all devices
    * ata_link_for_each_dev_reverse() for all devices in reverse order

    Now there's a need for looping construct which is similar to
    __ata_port_for_each_link() but iterates over PMP links before the host
    link. Instead of adding another one with long name, do the following
    cleanup.

    * Implement and export ata_link_next() and ata_dev_next() which take
    @mode parameter and can be used to build custom loop.
    * Implement ata_for_each_link() and ata_for_each_dev() which take
    looping mode explicitly.

    The following iteration modes are implemented.

    * ATA_LITER_EDGE : loop over edge links
    * ATA_LITER_HOST_FIRST : loop over all links, host link first
    * ATA_LITER_PMP_FIRST : loop over all links, PMP links first

    * ATA_DITER_ENABLED : loop over enabled devices
    * ATA_DITER_ENABLED_REVERSE : loop over enabled devices in reverse order
    * ATA_DITER_ALL : loop over all devices
    * ATA_DITER_ALL_REVERSE : loop over all devices in reverse order

    This change removes exlicit device enabledness checks from many loops
    and makes it clear which ones are iterated over in which direction.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

28 Oct, 2008

1 commit


15 Jul, 2008

1 commit

  • drivers/ata/pata_qdi.c:142:9: warning: incorrect type in assignment (different base types)
    drivers/ata/pata_qdi.c:142:9: expected unsigned int [unsigned] [usertype] pad
    drivers/ata/pata_qdi.c:142:9: got restricted __le32 [usertype]
    drivers/ata/pata_qdi.c:146:15: warning: cast to restricted __le32

    drivers/ata/pata_winbond.c:110:9: warning: incorrect type in assignment (different base types)
    drivers/ata/pata_winbond.c:110:9: expected unsigned int [unsigned] [usertype] pad
    drivers/ata/pata_winbond.c:110:9: got restricted __le32 [usertype]
    drivers/ata/pata_winbond.c:114:15: warning: cast to restricted __le32

    drivers/ata/pata_legacy.c:310:9: warning: incorrect type in assignment (different base types)
    drivers/ata/pata_legacy.c:310:9: expected unsigned int [unsigned] [usertype] pad
    drivers/ata/pata_legacy.c:310:9: got restricted __le32 [usertype]
    drivers/ata/pata_legacy.c:314:15: warning: cast to restricted __le32
    drivers/ata/pata_legacy.c:752:11: warning: cast to restricted __le32
    drivers/ata/pata_legacy.c:756:9: warning: incorrect type in assignment (different base types)
    drivers/ata/pata_legacy.c:756:9: expected unsigned int [unsigned] [addressable] [assigned] [usertype] pad
    drivers/ata/pata_legacy.c:756:9: got restricted __le32 [usertype]

    Signed-off-by: Harvey Harrison
    Signed-off-by: Jeff Garzik

    Harvey Harrison
     

20 May, 2008

1 commit

  • Use the kernel-provided clamp_val() macro.

    FIT was always applied to a member of struct ata_timing (unsigned short)
    and two constants. clamp_val will not cast to short anymore.

    Signed-off-by: Harvey Harrison
    Cc: Jeff Garzik
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Jeff Garzik

    Harvey Harrison
     

18 Apr, 2008

5 commits

  • 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: Tejun Heo

    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: Tejun Heo

    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: Tejun Heo

    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: Tejun Heo

    Tejun Heo
     
  • ->irq_clear() is used to clear IRQ bit of a SFF controller and isn't
    useful for drivers which don't use libata SFF HSM implementation.
    However, it's a required callback and many drivers implement their own
    noop version as placeholder. This patch implements ata_noop_irq_clear
    and use it to replace those custom placeholders.

    Also, SFF drivers which don't support BMDMA don't need to use
    ata_bmdma_irq_clear(). It becomes noop if BMDMA address isn't
    initialized. Convert them to use ata_noop_irq_clear().

    Signed-off-by: Tejun Heo

    Tejun Heo
     

21 Feb, 2008

1 commit

  • Use ld_qdi and ld_winbond to avoid shadowing static int
    variables qdi and winbond. The ld_ prefix refers to
    legacy_data.

    drivers/ata/pata_legacy.c:777:21: warning: symbol 'qdi' shadows an earlier one
    drivers/ata/pata_legacy.c:128:12: originally declared here
    drivers/ata/pata_legacy.c:811:21: warning: symbol 'qdi' shadows an earlier one
    drivers/ata/pata_legacy.c:128:12: originally declared here
    drivers/ata/pata_legacy.c:848:21: warning: symbol 'qdi' shadows an earlier one
    drivers/ata/pata_legacy.c:128:12: originally declared here
    drivers/ata/pata_legacy.c:882:21: warning: symbol 'qdi' shadows an earlier one
    drivers/ata/pata_legacy.c:128:12: originally declared here
    drivers/ata/pata_legacy.c:1040:21: warning: symbol 'winbond' shadows an earlier one
    drivers/ata/pata_legacy.c:129:12: originally declared here

    Signed-off-by: Harvey Harrison
    Signed-off-by: Jeff Garzik

    Harvey Harrison
     

16 Feb, 2008

1 commit


12 Feb, 2008

1 commit


23 Jan, 2008

4 commits

  • This puts winbond VLB in with the other ISA/VLB support and means we can
    lose pata_winbond.c. With all the VLB/ISA probe in one space (and out of
    the core libata) this makes legacy probing work sanely.

    Also switch to devm_ for resource handling on the ports post probe

    Signed-off-by: Alan Cox
    Signed-off-by: Jeff Garzik

    Alan Cox
     
  • Update the legacy driver so it can handle VLB ports nicely, and has an
    internal structure for nailing new ISA/VLB forms in. Anyone got an ALI14xx
    and a spare day ;)

    Also adds an "all" parameter so you can load this driver after all the PCI
    ones in a boot time kernel and tell it to grab anything ST412 compatible
    even if it is an unknown PCI device. That allows libata to offer the same
    "just get me a disk somehow" fallback that old IDE did.

    Obsoletes pata_qdi.

    Signed-off-by: Alan Cox
    Cc: Tejun Heo
    Cc: Jeff Garzik
    Signed-off-by: Andrew Morton
    Signed-off-by: Jeff Garzik

    Alan Cox
     
  • Cc: Jeff Garzik
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Jeff Garzik

    Andrew Morton
     
  • 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: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

16 Jan, 2008

1 commit

  • In pata_legacy and pata_winbond we've got bugs - cpu_to_le16() instead
    of cpu_to_le32(). Fortunately, both affected suckers are VLB, thus
    l-e-only, so we might get away with that unless we hit it with slop == 3
    (hadn't checked if playing with badly aligned sg could trigger that).
    Still buggy... Moreover, pata_legacy, pata_winbond and pata_qdi forgot to
    initialize pad on the write side of 32bit case in their ->data_xfer().
    Hopefully the hardware does't care, but still, sending uninitialized
    data to it...

    Signed-off-by: Al Viro
    Signed-off-by: Jeff Garzik

    Al Viro
     

13 Oct, 2007

6 commits

  • Currently, port configuration reporting has the following problems.

    * iomapped address is reported instead of raw address
    * report contains irrelevant fields or lacks necessary fields for
    non-SFF controllers.
    * host->irq/irq2 are there just for reporting and hacky.

    This patch implements and uses ata_port_desc() and
    ata_port_pbar_desc(). ata_port_desc() is almost identical to
    ata_ehi_push_desc() except that it takes @ap instead of @ehi, has no
    locking requirement, can only be used during host initialization and "
    " is used as separator instead of ", ". ata_port_pbar_desc() is a
    helper to ease reporting of a PCI BAR or an offsetted address into it.

    LLD pushes whatever description it wants using the above two
    functions. The accumulated description is printed on host
    registration after "[S/P]ATA max MAX_XFERMODE ".

    SFF init helpers and ata_host_activate() automatically add
    descriptions for addresses and irq respectively, so only LLDs which
    isn't standard SFF need to add custom descriptions. In many cases,
    such controllers need to report different things anyway.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • It was always set to ata_port_disable(). Removed the hook, and replaced
    the very few ap->ops->port_disable() callsites with direct calls to
    ata_port_disable().

    Signed-off-by: Jeff Garzik

    Jeff Garzik
     
  • * ->irq_ack() is redundant to what the irq handler already
    performs... chk-status + irq-clear. Furthermore, it is only
    called in one place, when screaming-irq-debugging is enabled,
    so we don't want to bother with a hook just for that.

    * ata_dummy_irq_on() is only ever used in drivers that have
    no callpath reaching ->irq_on(). Remove .irq_on hook from
    those drivers, and the now-unused ata_dummy_irq_on()

    Signed-off-by: Jeff Garzik

    Jeff Garzik
     
  • Make the following functions deal with ata_link instead of ata_port.

    * ata_set_mode()
    * ata_eh_autopsy() and related functions
    * ata_eh_report() and related functions
    * suspend/resume related functions
    * ata_eh_recover() and related functions

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Multiple links and different number of devices per link should be
    considered to iterate over links and devices. This patch implements
    and uses link and device iterators - ata_port_for_each_link() and
    ata_link_for_each_dev() - and ata_link_max_devices().

    This change makes a lot of functions iterate over only possible
    devices instead of from dev 0 to dev ATA_MAX_DEVICES. All such
    changes have been examined and nothing should be broken.

    While at it, add a separating comment before device helpers to
    distinguish them better from link helpers and others.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Introduce ata_link. It abstracts PHY and sits between ata_port and
    ata_device. This new level of abstraction is necessary to support
    SATA Port Multiplier, which basically adds a bunch of links (PHYs) to
    a ATA host port. Fields related to command execution, spd_limit and
    EH are per-link and thus moved to ata_link.

    This patch only defines the host link. Multiple link handling will be
    added later. Also, a lot of ap->link derefences are added but many of
    them will be removed as each part is converted to deal directly with
    ata_link instead of ata_port.

    This patch introduces no behavior change.

    Signed-off-by: Tejun Heo
    Cc: James Bottomley
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

22 May, 2007

1 commit