15 Oct, 2011

1 commit


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
     

26 May, 2010

1 commit

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

    Tejun Heo
     

20 May, 2010

1 commit

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

    Tejun Heo
     

02 Mar, 2010

2 commits


03 Dec, 2009

1 commit

  • Making the new stuff work broke some of the old chipsets. We need to go
    back to the old set up values for these it seems. Unfortunately even with
    documentation this is basically a mix of cargoculting and guesswork.

    Chased down to the exact line by Gianluca.

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

    Alan Cox
     

06 Oct, 2009

1 commit


06 Jun, 2009

1 commit

  • Some ALi devices report simplex if they have been disabled and re-enabled, and
    restoring the byte does not work. Ignore it - the needed supporting logic is
    already present for the SATA ULi ports.

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

    Alan Cox
     

25 Mar, 2009

1 commit


16 Jan, 2009

1 commit


09 Jan, 2009

3 commits


28 Oct, 2008

1 commit


31 Jul, 2008

1 commit

  • The ali_init_one() function does a search for an isa_bridge,
    but then fails to release it if the revision information was
    not correctly found.

    the problem comes from:
    isa_bridge = pci_get_device(...);
    if (isa_bridge && ...) {
    pci_dev_put(isa_bridge);
    }

    where the pci_dev_put() is never called if isa_bridge
    was valid but the extra checks on the chip-revision
    fail to match.

    Signed-off-by: Ben Dooks
    Signed-off-by: Jeff Garzik

    Ben Dooks
     

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

7 commits

  • 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
     
  • port_info->private_data is currently used for two purposes - to record
    private data about the port_info or to specify host->private_data to
    use when allocating ata_host.

    This overloading is confusing and counter-intuitive in that
    port_info->private_data becomes host->private_data instead of
    port->private_data. In addition, port_info and host don't correspond
    to each other 1-to-1. Currently, the first non-NULL
    port_info->private_data is used.

    This patch makes port_info->private_data just be what it is -
    private_data for the port_info where LLD can jot down extra info.
    libata no longer sets host->private_data to the first non-NULL
    port_info->private_data, @host_priv argument is added to
    ata_pci_init_one() instead. LLDs which use ata_pci_init_one() can use
    this argument to pass in pointer to host private data. LLDs which
    don't should use init-register model anyway and can initialize
    host->private_data directly.

    Adding @host_priv instead of using init-register model for LLDs which
    use ata_pci_init_one() is suggested by Alan Cox.

    Signed-off-by: Tejun Heo
    Cc: Alan Cox

    Tejun Heo
     
  • ata_pci_init_one() is the only function which uses ops->irq_handler
    and pi->sht. Other initialization functions take the same information
    as arguments. This causes confusion and duplicate unused entries in
    structures.

    Make ata_pci_init_one() take sht as an argument and use ata_interrupt
    implicitly. All current users use ata_interrupt and if different irq
    handler is necessary open coding ata_pci_init_one() using
    ata_prepare_sff_host() and ata_activate_sff_host can be done under ten
    lines including error handling and driver which requires custom
    interrupt handler is likely to require custom initialization anyway.

    As ata_pci_init_one() was the last user of ops->irq_handler, this
    patch also kills the field.

    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
     
  • PCI device should be powered up or powered up before its PCI regsiters
    are accessed. Although PCI configuration register access is allowed
    in D3hot, PCI device is free to reset its status when transiting from
    D3hot to D0 causing configuration data to change.

    Many libata SFF drivers which use ata_pci_init_one() read and update
    configuration registers before calling ata_pci_init_one() which
    enables the PCI device. Also, in resume paths, some drivers access
    registers without resuming the PCI device.

    This patch adds a call to pcim_enable_device() in init path if
    register is accessed before calling ata_pci_init_one() and make resume
    paths first resume PCI devices, access PCI configuration regiters then
    resume ATA host.

    While at it...

    * cmd640 was strange in that it set ->resume even when CONFIG_PM is
    not. This is by-product of minimal build fix. Updated.

    * In cs5530, Don't BUG() on reinit failure. Just whine and fail
    resume.

    Signed-off-by: Tejun Heo

    Tejun Heo
     

12 Apr, 2008

1 commit


04 Apr, 2008

1 commit

  • ATAPI DMA just doesn't work reliably on pata_ali. The IDE driver can
    do it but for some mysterious reason, pata_ali can't. This patch
    disables it by default and makes the driver whine during
    initialization. "pata_ali.atapi_dma" parameter is added so that user
    can bypass the workaround.

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

    Tejun Heo
     

17 Mar, 2008

1 commit


23 Jan, 2008

1 commit


24 Nov, 2007

3 commits


13 Oct, 2007

3 commits


10 Oct, 2007

1 commit

  • Three main sets of changes:

    1) dmi_get_system_info() return value should have been marked const,
    since callers should not be changing that data.

    2) const-ify DMI internals, since DMI firmware tables should,
    whenever possible, be marked const to ensure we never ever write to
    that data area.

    3) const-ify DMI API, to enable marking tables const where possible
    in low-level drivers.

    And if we're really lucky, this might enable some additional
    optimizations on the part of the compiler.

    The bulk of the changes are #2 and #3, which are interrelated. #1 could
    have been a separate patch, but it was so small compared to the others,
    it was easier to roll it into this changeset.

    Signed-off-by: Jeff Garzik

    Jeff Garzik
     

12 Sep, 2007

1 commit


31 Aug, 2007

1 commit


25 Jul, 2007

1 commit


12 Jul, 2007

1 commit

  • Instead of all drivers reading pci config space to get the revision
    ID, they can now use the pci_device->revision member.

    This exposes some issues where drivers where reading a word or a dword
    for the revision number, and adding useless error-handling around the
    read. Some drivers even just read it for no purpose of all.

    In devices where the revision ID is being copied over and used in what
    appears to be the equivalent of hotpath, I have left the copy code
    and the cached copy as not to influence the driver's performance.

    Compile tested with make all{yes,mod}config on x86_64 and i386.

    Signed-off-by: Auke Kok
    Acked-by: Dave Jones
    Signed-off-by: Greg Kroah-Hartman

    Auke Kok
     

10 Jul, 2007

1 commit