04 Jan, 2013

1 commit

  • 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
    Cc: Jeff Garzik
    Cc: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

18 Jan, 2012

1 commit


09 Jan, 2012

1 commit

  • 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: Sergei Shtylyov
    Signed-off-by: Sonic Zhang
    Signed-off-by: Jeff Garzik

    Sergei Shtylyov
     

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
     

31 Mar, 2011

1 commit


02 Mar, 2011

2 commits

  • All checks of ATA_FLAG_NO_LEGACY have been removed by the commits
    c791c30670ea61f19eec390124128bf278e854fe ([libata] minor PCI IDE probe
    fixes and cleanups) and f0d36efdc624beb3d9e29b9ab9e9537bf0f25d5b (libata:
    update libata core layer to use devres), so I think it's time to finally
    get rid of this flag...

    Signed-off-by: Sergei Shtylyov
    Signed-off-by: Jeff Garzik

    Sergei Shtylyov
     
  • Commit 0d5ff566779f894ca9937231a181eb31e4adff0e (libata: convert to iomap)
    removed all checks of ATA_FLAG_MMIO but neglected to remove the flag itself.
    Do it now, at last...

    Signed-off-by: Sergei Shtylyov
    Signed-off-by: Jeff Garzik

    Sergei Shtylyov
     

25 Oct, 2010

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    Update broken web addresses in arch directory.
    Update broken web addresses in the kernel.
    Revert "drivers/usb: Remove unnecessary return's from void functions" for musb gadget
    Revert "Fix typo: configuation => configuration" partially
    ida: document IDA_BITMAP_LONGS calculation
    ext2: fix a typo on comment in ext2/inode.c
    drivers/scsi: Remove unnecessary casts of private_data
    drivers/s390: Remove unnecessary casts of private_data
    net/sunrpc/rpc_pipe.c: Remove unnecessary casts of private_data
    drivers/infiniband: Remove unnecessary casts of private_data
    drivers/gpu/drm: Remove unnecessary casts of private_data
    kernel/pm_qos_params.c: Remove unnecessary casts of private_data
    fs/ecryptfs: Remove unnecessary casts of private_data
    fs/seq_file.c: Remove unnecessary casts of private_data
    arm: uengine.c: remove C99 comments
    arm: scoop.c: remove C99 comments
    Fix typo configue => configure in comments
    Fix typo: configuation => configuration
    Fix typo interrest[ing|ed] => interest[ing|ed]
    Fix various typos of valid in comments
    ...

    Fix up trivial conflicts in:
    drivers/char/ipmi/ipmi_si_intf.c
    drivers/usb/gadget/rndis.c
    net/irda/irnet/irnet_ppp.c

    Linus Torvalds
     

22 Oct, 2010

2 commits


09 Aug, 2010

1 commit


26 May, 2010

1 commit

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

    Tejun Heo
     

20 May, 2010

2 commits

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

    Tejun Heo
     

18 May, 2010

1 commit

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

    Tejun Heo
     

15 May, 2010

2 commits

  • 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: Sergei Shtylyov
    Signed-off-by: Jeff Garzik

    Sergei Shtylyov
     
  • 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: Sergei Shtylyov
    Signed-off-by: Jeff Garzik

    Sergei Shtylyov
     

22 Dec, 2009

1 commit

  • By default, the PATA pins are routed to the async address lines in which
    case, no peripheral muxing needs to be done. However, if the pins get
    routed through the GPIO PORTs pins, we need to make sure to request them
    so that the muxing is properly set up.

    Signed-off-by: Sonic Zhang
    Signed-off-by: Bryan Wu
    Signed-off-by: Mike Frysinger
    Signed-off-by: Jeff Garzik

    Sonic Zhang
     

25 Mar, 2009

1 commit


29 Dec, 2008

1 commit


29 Sep, 2008

1 commit


15 Jul, 2008

1 commit

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

    Tejun Heo
     

20 May, 2008

1 commit

  • Set ATAPI host state machine to control IDE device terminate sequence.
    Some IDE harddisk may assert terminate sequence in the middle of a
    formal DMA transaction and resume later. Bit DETECT_TERM in ATAPI_CTRL
    register determines whether the ATAPI host state machine or the kernel
    driver should take care of this case.

    Signed-off-by: Sonic Zhang
    Signed-off-by: Bryan Wu
    Signed-off-by: Jeff Garzik

    Sonic Zhang
     

29 Apr, 2008

1 commit


25 Apr, 2008

2 commits

  • When count reaches 0 the postfix decrement still subtracts (to -1),
    so bfin_reset_controller() returns as if the busy flag was cleared
    while it was not.

    Signed-off-by: Roel Kluin
    Acked-by: Sonic Zhang
    Signed-off-by: Bryan Wu
    Signed-off-by: Jeff Garzik

    Roel Kluin
     
  • Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias
    is prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable
    ATA and IDE platform drivers, to re-enable auto loading.

    NOTE: both ata/pata_platform.c and ide/legacy/ide_platform.c claim
    to provide "the" platform_pata driver, and there's no build-time
    mutual exclusion mechanism. This means that configs which enable
    both drivers will make some trouble when hotplugging...

    [dbrownell@users.sourceforge.net: more drivers, registration fixes]
    Signed-off-by: Kay Sievers
    Signed-off-by: David Brownell
    Cc: Tejun Heo
    Acked-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Andrew Morton
    Signed-off-by: Jeff Garzik

    Kay Sievers
     

18 Apr, 2008

8 commits

  • Currently, SATA softresets should do link onlineness check before
    actually performing SRST protocol but it doesn't really belong to
    softreset.

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

    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: 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
     
  • ata_chk_status() just calls ops->check_status and it only adds
    confusion with other status functions. Kill it.

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

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

    Tejun Heo
     

02 Feb, 2008

4 commits


23 Jan, 2008

2 commits

  • 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
    ata_sg_clean().

    * All sg walking code has been updated. Unnecessary assertions and
    checks for conditions the core layer already guarantees are removed.

    Signed-off-by: Tejun Heo
    Cc: Jens Axboe
    Signed-off-by: Jeff Garzik

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