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

9 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
     
  • 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
     
  • ->irq_clear() is used to clear IRQ bit of a SFF controller and isn't
    useful for drivers which don't use libata SFF HSM implementation.
    However, it's a required callback and many drivers implement their own
    noop version as placeholder. This patch implements ata_noop_irq_clear
    and use it to replace those custom placeholders.

    Also, SFF drivers which don't support BMDMA don't need to use
    ata_bmdma_irq_clear(). It becomes noop if BMDMA address isn't
    initialized. Convert them to use ata_noop_irq_clear().

    Signed-off-by: Tejun Heo

    Tejun Heo
     

06 Feb, 2008

1 commit


23 Jan, 2008

1 commit


29 Oct, 2007

2 commits

  • Signed-off-by: Jeff Garzik

    Jeff Garzik
     
  • On certain device/controller combination, 0xff status is asserted
    after reset and doesn't get cleared during 150ms post-reset wait. As
    0xff status is interpreted as no device (for good reasons), this can
    lead to misdetection on such cases.

    This patch implements ata_wait_after_reset() which replaces the 150ms
    sleep and waits upto ATA_TMOUT_FF_WAIT if status is 0xff.
    ATA_TMOUT_FF_WAIT is currently 800ms which is enough for
    HHD424020F7SV00 to get detected but not enough for Quantum GoVault
    drive which is known to take upto 2s.

    Without parallel probing, spending 2s on 0xff port would incur too
    much delay on ata_piix's which use 0xff to indicate empty port and
    doesn't have SCR register, so GoVault needs to wait till parallel
    probing.

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

    Tejun Heo
     

13 Oct, 2007

6 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
     
  • 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
     

31 Aug, 2007

1 commit


20 Jul, 2007

1 commit


10 Jul, 2007

2 commits


02 Jul, 2007

1 commit


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
     

01 May, 2007

2 commits

  • For PATA, 0xff status indicates empty port. For SATA, it depends on
    how the controller emulates status register. On some controllers,
    0xff is used to represent broken link or certain stage during reset.

    libata currently deals SATA the same. This hasn't caused any problem
    because problematic situations usually only occur after hotplug or
    other link disruption events and libata blindly waited for the device
    to spin up and settle after hotplug giving the link and device
    whatever time to go through those stages.

    libata is going to replace unconditional spinup wait with generic
    timed sequence of resets, so not only getting 0xff handling right for
    SATA is, well, the right thing to do, it's much more important now.

    This patch makes the following changes.

    * Make ata_bus_softreset() return -ENODEV if any of its wait fails
    due to 0xff status.

    * Fail soft/hardreset if status wait returns -ENODEV indicating 0xff
    status while SStatus says the link is online. e.g. Reset fails if
    status is 0xff after reset when SStatus reports the linke is online.
    If SCR registers are not available, everything is the same as
    before.

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

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

1 commit

  • 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