13 Oct, 2007

13 commits

  • PMP registers used to be accessed with dedicated accessors ->pmp_read
    and ->pmp_write. During reset, those callbacks are called with the
    port frozen so they should be able to run without depending on
    interrupt delivery. To achieve this, they were implemented polling.

    However, as resetting the host port makes the PMP to isolate fan-out
    ports until SError.X is cleared, resetting fan-out ports while port is
    frozen doesn't buy much additional safety.

    This patch updates libata PMP support such that PMP registers are
    accessed using regular ata_exec_internal() mechanism and kills
    ->pmp_read/write() callbacks. The following changes are made.

    * PMP access helpers - sata_pmp_read_init_tf(), sata_pmp_read_val(),
    sata_pmp_write_init_tf() are folded into sata_pmp_read/write() which
    are now standalone PMP register access functions.

    * sata_pmp_read/write() returns err_mask instead of rc. This is
    consistent with other functions which issue internal commands and
    allows more detailed error reporting.

    * ahci interrupt handler is modified to ignore BAD_PMP and
    spurious/illegal completion IRQs while reset is in progress. These
    conditions are expected during reset.

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

    Tejun Heo
     
  • As DEV_RST (hardreset) sometimes fail to recover the controller
    (especially after PMP DMA CS errata). In such cases, perform PORT_RST
    prior to DEV_RST.

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

    Tejun Heo
     
  • Implement PMP support. sil24 supports full FIS-switching. However,
    it has a PMP DMA CS errata which requires port-wide resetting if
    commands are outstanding to three or more devices when an error occurs
    on one of them.

    ATAPI commands often result in CHECK SENSE and it's crucial to not
    reset them before fetching sense data. Unfortunately, ATAPI CHECK
    SENSE causes a lot of problem if command is outstanding to any other
    device usually resulting in port-wide reset. So, sata_sil24
    implements sil24_qc_defer() which guarantees ATAPI command is run by
    itself.

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

    Tejun Heo
     
  • AN serves multiple purposes. For ATAPI, it's used for media change
    notification. For PMP, for downstream PHY status change notification.
    Implement sata_async_notification() which demultiplexes AN.

    To avoid unnecessary port events, ATAPI AN is not enabled if PMP is
    attached but SNTF is not available.

    Signed-off-by: Tejun Heo
    Cc: Kriten Carlson Accardi
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Controllers which support PMP have various restrictions on which
    combinations of commands are allowed to what number of devices
    concurrently. This patch implements ops->qc_defer() which determines
    whether a qc can be issued at the moment or should be deferred.

    If the function returns ATA_DEFER_LINK, the qc will be deferred until
    a qc completes on the link. If ATA_DEFER_PORT, until a qc completes
    on any link. The defer conditions are advisory and in general
    ATA_DEFER_LINK can be considered as lower priority deferring than
    ATA_DEFER_PORT.

    ops->qc_defer() replaces fixed ata_scmd_need_defer(). For standard
    NCQ/non-NCQ exclusion, ata_std_qc_defer() is implemented. ahci and
    sata_sil24 are converted to use ata_std_qc_defer().

    ops->qc_defer() is heavier than the original mechanism because full qc
    is prepped before determining to defer it, but various information is
    needed to determine defer conditinos and fully translating a qc is the
    only way to supply such information in generic manner.

    IMHO, this shouldn't cause any noticeable performance issues as

    * for most cases deferring occurs rarely (except for NCQ-aware
    cmd-switching PMP)
    * translation itself isn't that expensive
    * once deferred the command won't be repeated until another command
    completes which usually is a very long time cpu-wise.

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

    Tejun Heo
     
  • Update AN support in preparation of PMP support.

    * s/ata_id_has_AN/ata_id_has_atapi_AN/
    * add AN enabled reporting during configuration
    * add err_mask to AN configuration failure reporting
    * update LOCKING comment for ata_scsi_media_change_notify()
    * check whether ATA dev is attached to SCSI dev ata_scsi_media_change_notify()
    * set ATA_FLAG_AN in ahci and sata_sil24

    Signed-off-by: Tejun Heo
    Cc: Kriten Carlson Accardi
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • 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 reset methods and related functions deal with ata_link instead of
    ata_port.

    * ata_do_reset()
    * ata_eh_reset()
    * all prereset/reset/postreset methods and related functions

    This patch introduces no behavior change.

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

    Tejun Heo
     
  • Make the following PHY-related functions to deal with ata_link instead
    of ata_port.

    * sata_print_link_status()
    * sata_down_spd_limit()
    * ata_set_sata_spd_limit() and friends
    * sata_link_debounce/resume()
    * sata_scr_valid/read/write/write_flush()
    * ata_link_on/offline()

    This patch introduces no behavior change.

    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
     

26 Sep, 2007

1 commit

  • When PCIX_IRQ_WOC is used, sil24 has an inherent race condition
    between clearing IRQ pending and reading IRQ status. If IRQ pending
    is cleared after reading IRQ status, there's possibility of lost IRQ.
    If IRQ pending is cleared before reading IRQ status, spurious IRQs
    will occur.

    sata_sil24 till now cleared IRQ pending after reading IRQ status thus
    losing IRQs on machines where PCIX_IRQ_WOC was used. Reverse the
    order and ignore spurious IRQs if PCIX_IRQ_WOC.

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

    Tejun Heo
     

31 Aug, 2007

1 commit


20 Jul, 2007

6 commits


10 Jul, 2007

2 commits

  • The ATA_UDMAx masks are self-documenting, and far better than manually
    writing in the hex mask.

    Note that pata_it8213 mask differed from the comment. Added a FIXME there.

    Signed-off-by: Jeff Garzik

    Jeff Garzik
     
  • sil24_interrupt() loads host->ports[i] into a local variable,
    validates it, and then loads the value again in the call to
    sil24_host_intr(). This patch replaces the second load by a
    reference to the local variable.

    This is safe since no side-effects have occurred since the
    initial load. It also improves readability since it makes
    it clear that the parameter to sil24_host_intr() is the same
    value which was just validated.

    Signed-off-by: Mikael Pettersson
    Signed-off-by: Jeff Garzik

    Mikael Pettersson
     

22 May, 2007

1 commit


16 May, 2007

1 commit

  • Whether a controller needs IDE or SATA ACPI hierarchy is determined by
    the programming interface of the controller not by whether the
    controller is SATA or PATA, or it supports slave device or not. This
    patch adds ATA_FLAG_ACPI_SATA port flags which tells libata-acpi that
    the port needs SATA ACPI nodes, and sets the flag for ahci and
    sata_sil24.

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

    Tejun Heo
     

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
     

01 May, 2007

1 commit

  • Add @deadline to prereset and reset methods and make them honor it.
    ata_wait_ready() which directly takes @deadline is implemented to be
    used as the wait function. This patch is in preparation for EH timing
    improvements.

    * ata_wait_ready() never does busy sleep. It's only used from EH and
    no wait in EH is that urgent. This function also prints 'be
    patient' message automatically after 5 secs of waiting if more than
    3 secs is remaining till deadline.

    * ata_bus_post_reset() now fails with error code if any of its wait
    fails. This is important because earlier reset tries will have
    shorter timeout than the spec requires. If a device fails to
    respond before the short timeout, reset should be retried with
    longer timeout rather than silently ignoring the device.

    There are three behavior differences.

    1. Timeout is applied to both devices at once, not separately. This
    is more consistent with what the spec says.

    2. When a device passes devchk but fails to become ready before
    deadline. Previouly, post_reset would just succeed and let
    device classification remove the device. New code fails the
    reset thus causing reset retry. After a few times, EH will give
    up disabling the port.

    3. When slave device passes devchk but fails to become accessible
    (TF-wise) after reset. Original code disables dev1 after 30s
    timeout and continues as if the device doesn't exist, while the
    patched code fails reset. When this happens, new code fails
    reset on whole port rather than proceeding with only the primary
    device.

    If the failing device is suffering transient problems, new code
    retries reset which is a better behavior. If the failing device is
    actually broken, the net effect is identical to it, but not to the
    other device sharing the channel. In the previous code, reset would
    have succeeded after 30s thus detecting the working one. In the new
    code, reset fails and whole port gets disabled. IMO, it's a
    pathological case anyway (broken device sharing bus with working
    one) and doesn't really matter.

    * ata_bus_softreset() is changed to return error code from
    ata_bus_post_reset(). It used to return 0 unconditionally.

    * Spin up waiting is to be removed and not converted to honor
    deadline.

    * To be on the safe side, deadline is set to 40s for the time being.

    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
     
  • ->post_internal_cmd is simplified EH for internal commands. Its
    primary mission is to stop the controller such that no rogue memory
    access or other activities occur after the internal command is
    released. It may provide error diagnostics by setting qc->err_mask
    but this hasn't been a requirement.

    To ignore SETXFER failure for CFA devices, libata needs to know
    whether a command was failed by the device or for any other reason.
    ie. internal command needs to get AC_ERR_DEV right.

    This patch makes the following changes to AC_ERR_DEV handling and
    ->post_internal_cmd semantics to accomodate this need and simplify
    callback implementation.

    1. As long as the correct bits in the result TF registers are set,
    there is no need to set AC_ERR_DEV explicitly. libata EH core
    takes care of that for both normal and internal commands.

    2. The only requirement for ->post_internal_cmd() is to put the
    controller into quiescent state. It needs not to set any err_mask.

    3. ata_exec_internal_sg() performs minimal error analysis such that
    AC_ERR_DEV is automatically set as long as result_tf is filled
    correctly.

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

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

19 Mar, 2007

1 commit


03 Mar, 2007

1 commit


02 Mar, 2007

1 commit


26 Feb, 2007

1 commit


10 Feb, 2007

4 commits

  • This patch is against each libata driver.

    Two IRQ calls are added in ata_port_operations.
    - irq_on() is used to enable interrupts.
    - irq_ack() is used to acknowledge a device interrupt.

    In most drivers, ata_irq_on() and ata_irq_ack() are used for
    irq_on and irq_ack respectively.

    In some drivers (ex: ahci, sata_sil24) which cannot use them
    as is, ata_dummy_irq_on() and ata_dummy_irq_ack() are used.

    Signed-off-by: Kou Ishizaki
    Signed-off-by: Akira Iguchi
    Signed-off-by: Jeff Garzik

    Akira Iguchi
     
  • Convert libata core layer and LLDs to use iomap.

    * managed iomap is used. Pointer to pcim_iomap_table() is cached at
    host->iomap and used through out LLDs. This basically replaces
    host->mmio_base.

    * if possible, pcim_iomap_regions() is used

    Most iomap operation conversions are taken from Jeff Garzik
    's iomap branch.

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

    Tejun Heo
     
  • Update libata LLDs to use devres. Core layer is already converted to
    support managed LLDs. This patch simplifies initialization and fixes
    many resource related bugs in init failure and detach path. For
    example, all converted drivers now handle ata_device_add() failure
    gracefully without excessive resource rollback code.

    As most resources are released automatically on driver detach, many
    drivers don't need or can do with much simpler ->{port|host}_stop().
    In general, stop callbacks are need iff port or host needs to be given
    commands to shut it down. Note that freezing is enough in many cases
    and ports are automatically frozen before being detached.

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

    Tejun Heo
     
  • Handle pci_enable_device() failure while resuming. This patch kills
    the "ignoring return value of 'pci_enable_device'" warning message and
    propagates __must_check through ata_pci_device_do_resume().

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

    Tejun Heo
     

02 Dec, 2006

2 commits