02 Sep, 2009

1 commit


29 Jul, 2009

1 commit

  • host->ports[] always contain pointers to valid port structures since
    a "dummy port" structure is used in case if there is no physical port.

    This patch takes care of two entries from Dan's list:

    drivers/ata/sata_sil.c +535 sil_interrupt(13) warning: variable derefenced before check 'ap'
    drivers/ata/sata_mv.c +2517 mv_unexpected_intr(6) warning: variable derefenced before check 'ap'

    and of another needless NULL pointer check in pata_octeon_cf.c.

    Reported-by: Dan Carpenter
    Cc: corbet@lwn.net
    Cc: eteo@redhat.com
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Jeff Garzik

    Bartlomiej Zolnierkiewicz
     

10 Jun, 2009

1 commit


25 Mar, 2009

1 commit


03 Feb, 2009

1 commit

  • I tried compiling 2.6.29-rc1 and 2.6.29-rc3 with libata debugging enabled
    and got the following error:

    CC [M] drivers/ata/sata_sil.o
    drivers/ata/sata_sil.c: In function 'sil_fill_sg':
    drivers/ata/sata_sil.c:327: error: 'pi' undeclared (first use in this function)
    drivers/ata/sata_sil.c:327: error: (Each undeclared identifier is reported only once
    drivers/ata/sata_sil.c:327: error: for each function it appears in.)
    make[2]: *** [drivers/ata/sata_sil.o] Error 1
    make[1]: *** [drivers/ata] Error 2
    make: *** [drivers] Error 2

    include/linux/libata.h has the following enabled:

    #define ATA_DEBUG
    #define ATA_VERBOSE_DEBUG
    #define ATA_IRQ_TRAP

    This fixes the compilation.

    Signed-off-by: Jeff Garzik

    Pasi Kärkkäinen
     

30 Jan, 2009

1 commit

  • Commit e57db7b (SATA Sil: Blacklist system that spins off disks during ACPI power off)
    breaks build like the following, in both cases when CONFIG_DMI set or not.

    drivers/ata/sata_sil.c: In function 'sil_broken_system_poweroff':
    drivers/ata/sata_sil.c:713: error: implicit declaration of function 'dmi_first_match'
    drivers/ata/sata_sil.c:713: warning: initialization makes pointer from integer without a cast

    sata_sil.c should include dmi.h

    Signed-off-by: Alexander Beregalov
    Signed-off-by: Linus Torvalds

    Alexander Beregalov
     

27 Jan, 2009

1 commit

  • Some notebooks from HP have the problem that their BIOSes attempt to
    spin down hard drives before entering ACPI system states S4 and S5.
    This leads to a yo-yo effect during system power-off shutdown and the
    last phase of hibernation when the disk is first spun down by the
    kernel and then almost immediately turned on and off by the BIOS.
    This, in turn, may result in shortening the disk's life times.

    To prevent this from happening we can blacklist the affected systems
    using DMI information.

    Blacklist HP nx6325 that uses the sata_sil driver.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jeff Garzik

    Rafael J. Wysocki
     

29 Dec, 2008

2 commits

  • This implements support for the Large Block Transfer feature found in Silicon
    Image 311x controllers. This allows transferring bigger contiguous chunks of
    data from system memory and avoids the 64KB boundary restriction of standard
    SFF controllers.

    This is based on a patch from Jeff Garzik (from the sii-lbt branch of
    libata-dev) but includes a few bug fixes: Since the bmdma2 register does not
    implement the status bits, the original bmdma register must be used except
    where the bmdma2 register is required. As well the DMA boundary should be
    31-bit instead of 32-bit since the top bit of the length field is still
    required for the PRD end-of-table flag.

    Signed-off-by: Robert Hancock
    Signed-off-by: Jeff Garzik

    Robert Hancock
     
  • 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
     

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
     

18 Apr, 2008

7 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
     
  • 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
     
  • 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
     
  • Now that hardreset is the preferred method of resetting, there's no
    need for ATA_LFLAG_HRST_TO_RESUME flag. Kill it.

    Signed-off-by: Tejun Heo

    Tejun Heo
     

23 Jan, 2008

1 commit

  • Implement protocol tests - ata_is_atapi(), ata_is_nodata(),
    ata_is_pio(), ata_is_dma(), ata_is_ncq() and ata_is_data() and use
    them to replace is_atapi_taskfile() and hard coded protocol tests.

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

    Tejun Heo
     

18 Dec, 2007

2 commits

  • link->eh_info.serror is used to cache SError for controllers which
    need it cleared from interrupt handler to clear IRQ. It also should
    be cleared after reset just like SError itself.

    Make ata_std_postreset() clear link->eh_info.serror too and update
    sata_sil such that it doesn't care about bookkeeping the value.

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

    Tejun Heo
     
  • Interestingly, sata_sil raises spurious interrupts if it's coupled
    with Sil SATA_PATA bridge. Currently, sata_sil interrupt handler is
    strict about spurious interrupts and freezes the port when it occurs.
    This patch makes it more forgiving.

    * On SATA PHY event interrupt, serror value is checked to see whether
    it really is PHYRDY CHG event. If not, SATA PHY event interrupt is
    ignored.

    * If ATA interrupt occurs while no command is in progress, it's
    cleared and ignored.

    This fixes bugzilla bug 9505.

    http://bugzilla.kernel.org/show_bug.cgi?id=9505

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

    Tejun Heo
     

29 Oct, 2007

1 commit


13 Oct, 2007

7 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
     
  • HRST_TO_RESUME and SKIP_D2H_BSY are link attributes. Move them to
    ata_link->flags. This will allow host and PMP links to have different
    attributes. ata_port_info->link_flags is added and used by LLDs to
    specify these flags during initialization.

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

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

31 Aug, 2007

1 commit


20 Jul, 2007

1 commit


10 Jul, 2007

2 commits


22 May, 2007

1 commit


12 May, 2007

1 commit

  • Reimplement suspend/resume support using sdev->manage_start_stop.

    * Device suspend/resume is now SCSI layer's responsibility and the
    code is simplified a lot.

    * DPM is dropped. This also simplifies code a lot. Suspend/resume
    status is port-wide now.

    * ata_scsi_device_suspend/resume() and ata_dev_ready() removed.

    * Resume now has to wait for disk to spin up before proceeding. I
    couldn't find easy way out as libata is in EH waiting for the
    disk to be ready and sd is waiting for EH to complete to issue
    START_STOP.

    * sdev->manage_start_stop is set to 1 in ata_scsi_slave_config().
    This fixes spindown on shutdown and suspend-to-disk.

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

    Tejun Heo
     

29 Apr, 2007

3 commits

  • Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
    sata_sx4, sata_vsc and sata_inic162x to new init model.

    Now that host and ap are available during intialization, functions are
    converted to take either host or ap instead of low level parameters
    which were inevitable for functions shared between init and other
    paths. This simplifies code quite a bit.

    * init_one()'s now follow more consistent init order

    * ahci_setup_port() and ahci_host_init() collapsed into
    ahci_init_one() for init order consistency

    * sata_vsc uses port_info instead of setting fields manually

    * in sata_svw, k2_board_info converted to port_info (info is now in
    port flags). port number is honored now.

    Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.

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

    Tejun Heo
     
  • Now that we have ata_do_set_mode() available for drivers to use we don't
    actually need ->post_set_mode() as the driver can wrap set_mode nicely
    and do stuff before or after (eg PCMCIA needs before), so we can kill off
    a method in all the structs

    While I was at it I added kernel-doc to the function involved.

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

    Alan Cox
     
  • It used to be impossible to get from ata_device to ata_port but that is
    no longer true. Various methods have been cleaned up over time but
    dev_config still takes both and most users don't need both anyway. Tidy
    this one up

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

    Alan
     

03 Mar, 2007

1 commit


26 Feb, 2007

1 commit


25 Feb, 2007

1 commit

  • sata_sil used to trigger HSM error if IRQ occurs during polling
    command. This didn't matter because polling wasn't used in sata_sil.
    However, as of 2.6.20, all IDENTIFYs are performed by polling and
    device detection sometimes fails due to spurious IRQ. This patch
    makes sata_sil ignore and clear spurious IRQ while executing commands
    by polling.

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

    Tejun Heo