23 Apr, 2020

1 commit


01 Nov, 2019

1 commit

  • In case a driver wants to return an error from qc_prep, return enum
    ata_completion_errors. sata_mv is one of those drivers -- see the next
    patch. Other drivers return the newly defined AC_ERR_OK.

    [v2] use enum ata_completion_errors and AC_ERR_OK.

    Signed-off-by: Jiri Slaby
    Cc: Jens Axboe
    Cc: linux-ide@vger.kernel.org
    Signed-off-by: Jens Axboe

    Jiri Slaby
     

27 Aug, 2019

1 commit


31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    released under gpl v2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 15 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Steve Winslow
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528171438.895196075@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

23 Jan, 2019

1 commit

  • When a host driver sets a maximum segment size we should not only propagate
    that setting to the block layer, which can merge segments, but also to the
    DMA mapping layer which can merge segments as well.

    Fixes: 50c2e9107f ("scsi: introduce a max_segment_size host_template parameters")
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

11 Oct, 2018

1 commit


13 Jun, 2017

1 commit


08 Apr, 2015

1 commit

  • Replace occurences of the pci api by appropriate call to the dma api.

    A simplified version of the semantic patch that finds this problem is as
    follows: (http://coccinelle.lip6.fr)

    @deprecated@
    idexpression id;
    position p;
    @@

    (
    pci_dma_supported@p ( id, ...)
    |
    pci_alloc_consistent@p ( id, ...)
    )

    @bad1@
    idexpression id;
    position deprecated.p;
    @@
    ...when != &id->dev
    when != pci_get_drvdata ( id )
    when != pci_enable_device ( id )
    (
    pci_dma_supported@p ( id, ...)
    |
    pci_alloc_consistent@p ( id, ...)
    )

    @depends on !bad1@
    idexpression id;
    expression direction;
    position deprecated.p;
    @@

    (
    - pci_dma_supported@p ( id,
    + dma_supported ( &id->dev,
    ...
    + , GFP_ATOMIC
    )
    |
    - pci_alloc_consistent@p ( id,
    + dma_alloc_coherent ( &id->dev,
    ...
    + , GFP_ATOMIC
    )
    )

    Signed-off-by: Quentin Lambert
    Signed-off-by: Tejun Heo

    Quentin Lambert
     

10 May, 2014

1 commit

  • This patch fixes host drivers to use CONFIG_PM_SLEEP instead of CONFIG_PM
    where applicable. Benefits of this change:

    * unused code is not being compiled in for CONFIG_PM=y, CONFIG_PM_SLEEP=n
    and CONFIG_PM_RUNTIME=y configurations

    * easier transition to use struct dev_pm_ops and SIMPLE_DEV_PM_OPS() in
    the future

    * more consistent code (there are host drivers which are using the correct
    CONFIG_PM_SLEEP checks already)

    The patch leaves the core libata code and ->port_[suspend,resume] support
    in sata_[inic162x,nv,sil24].c alone for now.

    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Tejun Heo

    Bartlomiej Zolnierkiewicz
     

23 Jul, 2013

1 commit

  • sata_inic162x never reached a state where it's reliable enough for
    production use and data corruption is a relatively common occurrence.
    Make the driver generate warning about the issues and mark the Kconfig
    option as experimental.

    If the situation doesn't improve, we'd be better off making it depend
    on CONFIG_BROKEN. Let's wait for several cycles and see if the kernel
    message draws any attention.

    Signed-off-by: Tejun Heo
    Reported-by: Martin Braure de Calignon
    Reported-by: Ben Hutchings
    Reported-by: risc4all@yahoo.com

    Tejun Heo
     

03 Jun, 2013

1 commit

  • Use the wrapper function for getting the driver data using pci_dev
    instead of using dev_get_drvdata() with &pdev->dev, so we can directly
    pass a struct pci_dev. This is a purely cosmetic change.

    Signed-off-by: Jingoo Han
    Signed-off-by: Tejun Heo

    Jingoo Han
     

29 Nov, 2012

1 commit


26 Jul, 2012

1 commit

  • This patch converts the drivers in drivers/ata/* to use module_pci_driver()
    macro which makes the code smaller and a bit simpler.

    Signed-off-by: Axel Lin
    Cc: Alan Cox
    Cc: Jeff Garzik
    Cc: Mikael Pettersson
    Cc: Mark Lord
    Cc: Jeremy Higdon
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Jeff Garzik

    Axel Lin
     

24 Jul, 2011

3 commits

  • Use a single mechanism to show driver version.
    Reduces text a tiny bit too.

    Remove uses of static int printed_version
    Add and use ata_print_version(const struct device *, const char *ver)
    and ata_print_version_once.

    $ size drivers/ata/built-in.*
    text data bss dec hex filename
    544969 73893 116584 735446 b38d6 drivers/ata/built-in.allyesconfig.ata.o
    543870 73893 116592 734355 b34ad drivers/ata/built-in.allyesconfig.print_once.o
    141328 14689 4220 160237 271ed drivers/ata/built-in.defconfig.ata.o
    141212 14689 4220 160121 27179 drivers/ata/built-in.defconfig.print_once.o

    Signed-off-by: Joe Perches
    Signed-off-by: Jeff Garzik

    Joe Perches
     
  • 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
     
  • Saves a bit of text as the call takes fewer args.

    Coalesce a few formats.
    Convert a few bare printks to pr_cont.

    $ size drivers/ata/built-in.o*
    text data bss dec hex filename
    558429 73893 117864 750186 b726a drivers/ata/built-in.o.allyesconfig.new
    559574 73893 117888 751355 b76fb drivers/ata/built-in.o.allyesconfig.old
    149567 14689 4220 168476 2921c drivers/ata/built-in.o.defconfig.new
    149851 14689 4220 168760 29338 drivers/ata/built-in.o.defconfig.old

    Signed-off-by: Joe Perches
    Signed-off-by: Jeff Garzik

    Joe Perches
     

22 Oct, 2010

1 commit


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
     

18 May, 2010

2 commits

  • sata_inic162x doesn't use PRD anymore. No need to initialize it.

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

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

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

02 Sep, 2009

1 commit


07 Apr, 2009

1 commit


25 Mar, 2009

1 commit


29 Sep, 2008

1 commit

  • Logically, SCR access ops should take @link; however, there was no
    compelling reason to convert all SCR access ops when adding @link
    abstraction as there's one-to-one mapping between a port and a non-PMP
    link. However, that assumption won't hold anymore with the scheduled
    addition of slave link.

    Make SCR access ops per-link.

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

    Tejun Heo
     

14 Sep, 2008

1 commit


06 May, 2008

10 commits

  • sata_inic162x is now ready for production use. Bump the version,
    explain what's working and what's not and drop EXPERIMENTAL.

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

    Tejun Heo
     
  • When attached to cardbus, mmio region is at BAR 1. Other than that,
    everything else is the same. Add support for it.

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

    Tejun Heo
     
  • sata_inic162x now doesn't use any SFF features. Remove all SFF
    related stuff.

    * Mask unsolicited ATA interrupts. This removes our primary source of
    spurious interrupts and spurious interrupt handling can be tightened
    up. There's no need to clear ATA interrupts by reading status
    register either.

    * Don't dance with IDMA_CTL_ATA_NIEN and simplify accesses to
    IDMA_CTL.

    * Inherit from sata_port_ops instead of ata_sff_port_ops.

    * Don't initialize or use ioaddr. There's no need to map BAR0-4
    anymore.

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

    Tejun Heo
     
  • Use IDMA for ATAPI commands. Write and some misc commands time out
    when executed using ATAPI_PROT_DMA but ATAPI_PROT_PIO works fine. As
    PIO is driven by DMA too, it doesn't make any noticeable difference
    for native SATA devices. inic_check_atapi_dma() is implemented to
    force PIO for those ATAPI commands.

    After this change, sata_inic162x issues all commands using IDMA.

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

    Tejun Heo
     
  • Use IDMA for PIO and non-data commands. This allows sata_inic162x to
    safely drive LBA48 devices. Kill inic_dev_config() which contains
    code to reject LBA48 devices.

    With this change, status checking in inic_qc_issue() to avoid hard
    lock up after hotplug can go away too.

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

    Tejun Heo
     
  • sata_inic162x doesn't use BMDMA anymore. Kill bmdma related stuff.

    * prdctl manipulation

    * port IRQ mask manipulation

    * inherit ATA_BASE_SHT instead of ATA_BMDMA_SHT

    * BMDMA methods

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

    Tejun Heo
     
  • The modified driver on initio site has enough clue on how to use IDMA.
    Use IDMA for ATA_PROT_DMA.

    * LBA48 now works as long as it uses DMA (LBA48 devices still aren't
    allowed as it can destroy data if PIO is used for any reason).

    * No need to mask IRQs for read DMAs as IDMA_DONE is properly raised
    after transfer to memory is actually completed. There will be some
    spurious interrupts but host_intr will handle it correctly and
    manipulating port IRQ mask interacts badly with the other port for
    some reason, so command type dependent port IRQ masking is not used
    anymore.

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

    Tejun Heo
     
  • inic162x can't reliably read back TF or at least we don't know how to
    do it yet. The only values which seem reliable are status and error.
    This patch updates access to TF.

    * implement inic_tf_read() which reads the TF area in mmio area

    * implement custom inic_qc_fill_rtf() which only returns true if
    status indicates device error. it'll be returning bogus addresses
    for device errors but it'll be able to report why it failed at
    least.

    * implement custom inic_check_ready() and use ata_wait_after_reset()
    instead of the SFF version.

    * use inic_tf_read() for classification.

    This is not perfect but it fixes hotplug detection failure and at
    least makes the driver report 0's instead of random garbages while
    reporting valid status and error for device errors.

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

    Tejun Heo
     
  • * add a bunch of constants, most are from the datasheet, a few
    undocumented ones are from initio's modified driver

    * HCTL_PWRDWN is bit 12 not 13

    This is in preparation of further inic162x updates.

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

    Tejun Heo
     
  • * use larger indents for structure member definitions

    * kill unused variable @addr in inic_scr_write()

    * kill unnecessary flushes in inic_freeze/thaw()

    * kill buggy explicit kfree() on devres managed port private data

    This is in preparation of further inic162x updates.

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

    Tejun Heo
     

18 Apr, 2008

4 commits

  • Some code paths which had been made obsolete by recent reset
    simplification were still around. Kill them.

    * ata_eh_reset() checked for ATA_DEV_UNKNOWN to determine
    classification failure. This is no longer applicable.

    * ata_do_reset() should convert ATA_DEV_UNKNOWN to ATA_DEV_NONE
    regardless of reset result (e.g. -EAGAIN).

    * LLDs don't need to convert ATA_DEV_UNKNOWN to ATA_DEV_NONE.

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

    Tejun Heo
     
  • Previously, post-softreset readiness is waited as follows.

    1. ata_sff_wait_after_reset() waits for 150ms and then for
    ATA_TMOUT_FF_WAIT if status is 0xff and other conditions meet.

    2. ata_bus_softreset() finishes with -ENODEV if status is still 0xff.
    If not, continue to #3.

    3. ata_bus_post_reset() waits readiness of dev0 and/or dev1 depending
    on devmask using ata_sff_wait_ready().

    And for post-hardreset readiness,

    1. ata_sff_wait_after_reset() waits for 150ms and then for
    ATA_TMOUT_FF_WAIT if status is 0xff and other conditions meet.

    2. sata_sff_hardreset waits for device readiness using
    ata_sff_wait_ready().

    This patch merges and unifies post-reset readiness waits into
    ata_sff_wait_ready() and ata_sff_wait_after_reset().

    ATA_TMOUT_FF_WAIT handling is merged into ata_sff_wait_ready(). If TF
    status is 0xff, link status is unknown and the port is SATA, it will
    continue polling till ATA_TMOUT_FF_WAIT.

    ata_sff_wait_after_reset() is updated to perform the following steps.

    1. waits for 150ms.

    2. waits for dev0 readiness using ata_sff_wait_ready(). Note that
    this is done regardless of devmask, as ata_sff_wait_ready() handles
    0xff status correctly, this preserves the original behavior except
    that it may wait longer after softreset if link is online but
    status is 0xff. This behavior change is very unlikely to cause any
    actual difference and is intended. It brings softreset behavior to
    that of hardreset.

    3. waits for dev1 readiness just the same way ata_bus_post_reset() did.

    Now both soft and hard resets call ata_sff_wait_after_reset() after
    reset to wait for readiness after resets. As
    ata_sff_wait_after_reset() contains calls to ->sff_dev_select(),
    explicit call near the end of sata_sff_hardreset() is removed.

    This change makes reset implementation simpler and more consistent.

    While at it, make the magical 150ms wait post-reset wait duration a
    constant and ata_sff_wait_ready() and ata_sff_wait_after_reset() take
    @link instead of @ap. This is to make them consistent with other
    reset helpers and ease core changes.

    pata_scc is updated accordingly.

    Signed-off-by: Tejun Heo

    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