21 May, 2019

1 commit

  • Add SPDX license identifiers to all files which:

    - Have no license information of any form

    - Have MODULE_LICENCE("GPL*") inside which was used in the initial
    scan/conversion to ignore the file

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

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
     

14 Feb, 2014

1 commit


07 Dec, 2013

1 commit

  • Replace direct inclusions of , and
    , which are incorrect, with
    inclusions and remove some inclusions of those files that aren't
    necessary.

    First of all, , and
    should not be included directly from any files that are built for
    CONFIG_ACPI unset, because that generally leads to build warnings about
    undefined symbols in !CONFIG_ACPI builds. For CONFIG_ACPI set,
    includes those files and for CONFIG_ACPI unset it
    provides stub ACPI symbols to be used in that case.

    Second, there are ordering dependencies between those files that always
    have to be met. Namely, it is required that be included
    prior to so that the acpi_pci_root declarations the
    latter depends on are always there. And which provides
    basic ACPICA type declarations should always be included prior to any other
    ACPI headers in CONFIG_ACPI builds. That also is taken care of including
    as appropriate.

    Signed-off-by: Lv Zheng
    Cc: Greg Kroah-Hartman
    Cc: Matthew Garrett
    Cc: Tony Luck
    Cc: "H. Peter Anvin"
    Acked-by: Bjorn Helgaas (drivers/pci stuff)
    Acked-by: Konrad Rzeszutek Wilk (Xen stuff)
    Signed-off-by: Rafael J. Wysocki

    Lv Zheng
     

24 Aug, 2013

1 commit

  • Binding ACPI handle to SCSI device has several drawbacks, namely:
    1 During ATA device initialization time, ACPI handle will be needed
    while SCSI devices are not created yet. So each time ACPI handle is
    needed, instead of retrieving the handle by ACPI_HANDLE macro,
    a namespace scan is performed to find the handle for the corresponding
    ATA device. This is inefficient, and also expose a restriction on
    calling path not holding any lock.
    2 The binding to SCSI device tree makes code complex, while at the same
    time doesn't bring us any benefit. All ACPI handlings are still done
    in ATA module, not in SCSI.

    Rework the ATA ACPI binding code to bind ACPI handle to ATA transport
    devices(ATA port and ATA device). The binding needs to be done only once,
    since the ATA transport devices do not go away with hotplug. And due to
    this, the flush_work call in hotplug handler for ATA bay is no longer
    needed.

    Tested on an Intel test platform for binding and runtime power off for
    ODD(ZPODD) and hard disk; on an ASUS S400C for binding and normal boot
    and S3, where its SATA port node has _SDD and _GTF control methods when
    configured as an AHCI controller and its PATA device node has _GTF
    control method when configured as an IDE controller. SATA PMP binding
    and ATA hotplug is not tested.

    Signed-off-by: Aaron Lu
    Tested-by: Dirk Griesbach
    Signed-off-by: Tejun Heo

    Aaron Lu
     

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
     

29 Jun, 2012

1 commit

  • Now that we have the ability to directly glue the ACPI namespace to the
    driver model in libata, we don't need the custom code to handle the same
    thing. Remove it and migrate the functions over to the new code.

    Signed-off-by: Matthew Garrett
    Signed-off-by: Holger Macht
    Signed-off-by: Lin Ming
    Signed-off-by: Jeff Garzik

    Matthew Garrett
     

24 Jul, 2011

1 commit


02 Mar, 2011

1 commit

  • These flags are marked as obsolete and the checks for them have been removed
    by commit 294440887b32c58d220fb54b73b7a58079b78f20 (libata-sff: kill unused
    ata_bus_reset()), so I think it's time to finally get rid of them...

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

    Sergei Shtylyov
     

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

2 commits

  • Separate out ata_bmdma_qc_issue() from ata_sff_qc_issue() such that
    ata_sff_qc_issue() only deals with non-BMDMA SFF protocols (PIO and
    nodata) while ata_bmdma_qc_issue() deals with the BMDMA protocols and
    uses ata_sff_qc_issue() for non-DMA commands. All the users are
    updated accordingly.

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

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

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
     

08 Mar, 2010

1 commit


02 Mar, 2010

1 commit

  • This allows parallel scan and the like to be set without having to stop
    using the existing full helper functions. This patch merely adds the argument
    and fixes up the callers. It doesn't undo the special cases already in the
    tree or add any new parallel callers.

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

    Alan Cox
     

09 Feb, 2010

1 commit

  • In particular, several occurances of funny versions of 'success',
    'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
    'beginning', 'desirable', 'separate' and 'necessary' are fixed.

    Signed-off-by: Daniel Mack
    Cc: Joe Perches
    Cc: Junio C Hamano
    Signed-off-by: Jiri Kosina

    Daniel Mack
     

25 Mar, 2009

1 commit


31 Dec, 2008

1 commit


28 Oct, 2008

1 commit


22 Aug, 2008

1 commit

  • Dave Müller sent a diff for the pata_oldpiix that highlighted a problem
    where a lot of the ATA drivers assume dma_mode == 0 means "no DMA" while
    the core code uses 0xFF.

    This turns out to have other consequences such as code doing >= XFER_UDMA_0
    also catching 0xFF as UDMAlots. Fortunately it doesn't generally affect
    set_dma_mode, although some drivers call back into their own set mode code
    from other points.

    Having been through the drivers I've added helpers for using_udma/using_mwdma
    dma_enabled so that people don't open code ranges that may change (eg if UDMA8
    appears somewhere)

    Thanks to David for the initial bits
    [and added fix for pata_oldpiix from and signed-off-by Dave Mueller
    -jg]

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

    Alan Cox
     

06 May, 2008

1 commit

  • A couple of distributions (Fedora, Ubuntu) were having weird problems with the
    ATI IXP series PATA controllers being reported as simplex. At the heart of
    the problem is that both distros ignored the recommendations to load pata_acpi
    and ata_generic *AFTER* specific host drivers.

    The underlying cause however is that if you D3 and then D0 an ATI IXP it
    helpfully throws away some configuration and won't let you rewrite it.

    Add checks to ata_generic and pata_acpi to pin ATIIXP devices. Possibly the
    real answer here is to quirk them and pin them, but right now we can't do that
    before they've been pcim_enable()'d by a driver.

    I'm indebted to David Gero for this. His bug report not only reported the
    problem but identified the cause correctly and he had tested the right values
    to prove what was going on

    [If you backport this for 2.6.24 you will need to pull in the 2.6.25
    removal of the bogus WARN_ON() in pcim_enagle]

    Signed-off-by: Alan Cox
    Tested-by: David Gero
    Signed-off-by: Andrew Morton
    Signed-off-by: Jeff Garzik

    Alan Cox
     

18 Apr, 2008

5 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
     

16 Feb, 2008

1 commit


23 Jan, 2008

2 commits

  • libata-acpi is using separate timing tables for transfer modes
    although libata-core has the complete ata_timing table. Implement
    ata_timing_cycle2mode() to look for matching mode given transfer type
    and cycle duration and use it in libata-acpi and pata_acpi to replace
    private timing tables.

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

    Tejun Heo
     
  • Finding out matching transfer mode from ACPI GTM values is useful for
    other purposes too. Separate out the function and timing tables from
    pata_acpi::pacpi_discover_modes().

    Other than checking shared-configuration bit after doing
    ata_acpi_gtm() in pacpi_discover_modes() which should be safe, this
    patch doesn't introduce any behavior change.

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

    Tejun Heo
     

29 Oct, 2007

1 commit


18 Oct, 2007

1 commit


13 Oct, 2007

1 commit

  • On a cable there may be
    eighty wires or perhaps forty
    and we learn about its type
    In the world of ACPI

    So we call the GTM
    And we find the the timing rate
    And we look through it to see
    If eighty wire it must be

    Timing lives in ACPI routines
    ACPI routines, ACPI routines
    Timing lives in ACPI routines
    ACPI routes ACPI routines

    And the drivers last you see
    Picking up unknown pci ids
    and the code begins to work

    Timing lives in ACPI routines
    ACPI routines, ACPI routines
    Timing lives in ACPI routines
    ACPI routes ACPI routines

    [Full speed ahead, Mr Hacker, full speed ahead]
    Full speed over here sir!
    Checking Cable, checking cable
    Aye aye, 80 wire,
    Heaven heaven]

    If we use ACPI (ACPI)
    Every box (every box) has all we need (has all we need)
    Cable type (cable type) and mode timing (mode timing)
    In our ATA (in our ATA) subroutines (subroutines, ha ha)

    Timing lives in ACPI routines
    ACPI routines, ACPI routines
    Timing lives in ACPI routines
    ACPI routes ACPI routines
    Timing lives in ACPI routines
    ACPI routines, ACPI routines
    Timing lives in ACPI routines
    ACPI routes ACPI routines

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

    Alan Cox