Commit Graph

315 Commits

Author SHA1 Message Date
Jeff Garzik 8e181c14f2 Merge branch 'upstream' 2006-04-01 15:17:56 -05:00
Tejun Heo 852ee16a91 [PATCH] libata: preserve SATA SPD setting over hard resets
Don't overwrite SPD setting during hard reset.  This change has the
(intended) side effect of honoring the BIOS configuration.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 14:52:08 -05:00
Tejun Heo e82cbdb9a3 [PATCH] libata: don't disable devices from ata_set_mode()
When ata_set_mode() fails on a device, make ata_set_mode() return
error code and pointer to the device instead of disabling it directly.
This gives more control to higher level driving logic.

This patch does not change the end result (configured transfer mode)
although it may make libata repeat mode configuration to the peer of a
failing device.  Later ata_bus_probe() rewrite will make full use of
this change.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 14:46:09 -05:00
Albert Lee eee6c32f5f [PATCH] libata-dev: handle DRQ=1 ERR=1 (revised)
Handle DRQ=1 ERR=1 situation. Revised according to what IDE try_to_flush_leftover_data() does.

Changes:
 - For ATA PIO writes and ATAPI devices, just stop the HSM and let EH handle it.
 - For ATA PIO reads, read only one block of junk data and then let EH handle it.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 14:29:21 -05:00
Jeff Garzik 6e07e16404 Merge branch 'upstream' 2006-04-01 14:29:12 -05:00
Tejun Heo e8e0619f68 [PATCH] libata: reorganize ata_set_mode()
Merge ata_host_set_pio() and ata_host_set_dma() into ata_set_mode()
and use function-level *dev to iterate over devices.  This eases
soon-to-follow ata_set_mode() interface change.

While at it, kill an unnecessary comment and normalize others.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:46 -05:00
Tejun Heo 4f65977df0 [PATCH] libata: make ata_set_mode() handle no-device case properly
Make ata_set_mode() return without doing anything if there is no
device on the port.  This is in preparation for ata_bus_probe()
changes.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:46 -05:00
Tejun Heo e1211e3fa7 [PATCH] libata: implement ata_dev_enabled and disabled()
This patch renames ata_dev_present() to ata_dev_enabled() and adds
ata_dev_disabled().  This is to discern the state where a device is
present but disabled from not-present state.  This disctinction is
necessary when configuring transfer mode because device selection
timing must not be violated even if a device fails to configure.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo 9974e7cc6c [PATCH] libata: convert do_probe_reset() to ata_do_reset()
Make do_probe_reset() generic by pushing classification check into
ata_drive_probe_reset() and rename it to ata_do_reset().  This will be
used by EH reset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo 4c360c81a6 [PATCH] libata: separate out ata_spd_string()
Separate out ata_spd_string() from sata_print_link_status().  This
will be used by SATA spd configuration routines.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo 96072e699b [PATCH] libata: make ata_bus_probe() return negative errno on failure
ata_bus_probe() uses unsigned int rc to receive negative errno and
returns the converted unsigned int value.  Convert temporary variables
to int and make ata_bus_probe() return negative errno on failure.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo 5bbc53f4cf [PATCH] libata: fix ata_set_mode() return value
Make ata_set_mode() return correct error value when ata_dev_set_mode()
fails.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo be9a50c852 [PATCH] libata: fix ata_xfer_tbl termination
ata_xfer_tbl is terminated by entry with -1 as ->shift.  However,
->shift was unsigned int making the termination condition bogus.  This
patch converts ->shift and ->bits to int.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-31 10:14:42 -05:00
Tejun Heo 8e0e694a3a [PATCH] libata: make ata_qc_issue complete failed qcs
There is no reason for the issuer to diddle with a failed qc as the
issuer has complete control over when a qc gets freed (usually in
->complete_fn).  Make ata_qc_issue() responsible for completing qcs
which failed to issue.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-31 10:14:42 -05:00
Tejun Heo e4a70e76ad [PATCH] libata: fix ata_qc_issue failure path
On sg_err failure path, ata_qc_issue() doesn't mark the qc active
before returning.  This triggers WARN_ON() in __ata_qc_complete() when
the qc gets completed.  This patch moves ap->active_tag and
QCFLAG_ACTIVE setting to the top of the function.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-31 10:14:42 -05:00
Albert Lee 08a556db91 [PATCH] libata-dev: print out information for ATAPI devices with CDB interrupts
print out information for ATAPI devices with CDB interrupts

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-31 10:07:06 -05:00
Jeff Garzik 4f0e7c51ae Merge branch 'upstream'
Conflicts:

	drivers/scsi/sata_mv.c
2006-03-29 19:59:39 -05:00
Albert Lee 00b6f5e9e0 [PATCH] libata: ata_dev_init_params() fixes
ata_dev_init_params() fixes:
- Get the "heads" and "sectors" parameters from caller instead of implicitly from dev->id[].
- Return AC_ERR_INVALID instead of 0 if an invalid parameter is found

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:28 -05:00
Alan Cox 17efc5f723 [PATCH] libata: Fix interesting use of "extern" and also some bracketing
Signed-off-by: Alan Cox <alan@redhat.com>

Last of the set, just clean up some oddments. Assuming the whole set is
now ok then the remaining differences are the setup of PIO_0 at reset
and the ->data_xfer method.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:28 -05:00
Alan Cox 5444a6f405 [PATCH] libata: Simplex and other mode filtering logic
Add a field to the host_set called 'flags' (was host_set_flags changed
to suit Jeff)
Add a simplex_claimed field so we can remember who owns the DMA channel
Add a ->mode_filter() hook to allow drivers to filter modes
Add docs for mode_filter and set_mode
Filter according to simplex state
Filter cable in core

This provides the needed framework to support all the mode rules found
in the PATA world. The simplex filter deals with 'to spec' simplex DMA
systems found in older chips. The cable filter avoids duplicating the
same rules in each chip driver with PATA. Finally the mode filter is
neccessary because drive/chip combinations have errata that forbid
certain modes with some drives or types of ATA object.

Drive speed setup remains per channel for now and the filters now use
the framework Tejun put into place which cleans them up a lot from the
older libata-pata patches.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:28 -05:00
Alan Cox 692785e798 [PATCH] libata - ATA is both ATA and CFA
I think this is still needed with the new probe code (which btw seems to
be missing docs in upstream ?).

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:28 -05:00
Alan Cox e35a9e01f2 [PATCH] libata: Add ->set_mode hook for odd drivers
Some hardware doesn't want the usual mode setup logic running. This
allows the hardware driver to replace it for special cases in the least
invasive way possible.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:27 -05:00
Jeff Garzik 74d89c1673 Merge branch 'upstream' 2006-03-29 17:24:55 -05:00
Albert Lee 52a3220599 [PATCH] libata-dev: wait idle after reading the last data block
Some CD-ROM drives are slow to clear DRQ, after the last data block
is read by PIO. Use ata_wait_idle() after reading the last data block.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:22:36 -05:00
Albert Lee 71601958f7 [PATCH] libata-dev: fix the device err check sequence (respin)
Current irq-pio checks ERR bit and stops on ERR before it does anything else.
This behavior doesn't look right.
The DRQ bit should take higher precedence than the ERR bit.

Changes:
- Let the HSM do the data transfer whenever the
  device asks for DRQ bit, even if the ERR bit is set.
- For DRQ=1 ERR=1, don't trust the data

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:22:36 -05:00
Albert Lee 999bb6f426 [PATCH] libata-dev: irq-pio minor fixes (respin)
irq-pio minor fixes for printk() and comments.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:22:36 -05:00
Albert Lee c234fb00ea [PATCH] libata-dev: Make the the in_wq check as an inline function
Make the the in_wq check easier to read as an inline function.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:54 -05:00
Albert Lee c2bbc55161 [PATCH] libata-dev: ata_check_atapi_dma() fix for ATA_FLAG_PIO_POLLING LLDDs
ata_check_atapi_dma() fix for LLDDs with the ATA_FLAG_PIO_POLLING flag.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:54 -05:00
Albert Lee 27cdadef6d [PATCH] libata-dev: Cleanup unused enums/functions
Cleanup the following unused functions:
- ata_pio_poll()
- ata_pio_complete()
- ata_pio_first_block()
- ata_pio_block()
- ata_pio_error()
ap->pio_task_timeout and other enums.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:54 -05:00
Albert Lee a1af37344f [PATCH] libata-dev: Convert ata_pio_task() to use the new ata_hsm_move()
Convert ata_pio_task() to use the new ata_hsm_move().

Changes:
- refactor ata_pio_task() to poll device status register and
- call the new ata_hsm_move() when device indicates it is not BSY.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:54 -05:00
Albert Lee bb5cb290f0 [PATCH] libata-dev: Let ata_hsm_move() work with both irq-pio and polling pio
Let ata_hsm_move() work with both irq-pio and polling pio codepath.

Changes:
- add a new parameter "in_wq" for polling pio
- add return value "poll_next" to tell polling pio task whether the HSM is finished
- merge code from ata_pio_first_block() to the HSM_ST_FIRST state.
- call ata_poll_qc_complete() if called from the workqueue

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:54 -05:00
Albert Lee 6912ccd5a4 [PATCH] libata-dev: Minor fix for ata_hsm_move() to work with ata_host_intr()
Minor fix for ata_hsm_move() to work with ata_host_intr().
Changes:
- WARN_ON() and comment fix
- Make the HSM_ST_LAST device status checking more rigid.
- Treat unknown HSM state as BUG().

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:53 -05:00
Albert Lee e2cec77117 [PATCH] libata-dev: Move out the HSM code from ata_host_intr()
Move out the irq-pio HSM code from ata_host_intr() to the new ata_hsm_move() function verbatim.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:53 -05:00
Albert Lee 19d5d7309a [PATCH] libata-dev: Remove atapi_packet_task()
atapi_packet_task() was replaced by ata_pio_task().
Remove the unused atapi_packet_task().

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:53 -05:00
Albert Lee 13ee4628ce [PATCH] libata-dev: Fix merge problem with upstream
Fix merge problem with upstream.
Changes:
1. add missing dev->cdb_len = 16 for ATA devices
2. use ata_pio_task instead of atapi_packet_task

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:53 -05:00
Albert Lee cf2f7689f9 [PATCH] libata-dev: Remove trailing whitespaces
Remove trailing whitespaces.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:21:53 -05:00
Tejun Heo 05c8e0ac5c [PATCH] libata: kill trailing whitespace
Kill trailing whitespace.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:19:13 -05:00
Tejun Heo 600511e86b [PATCH] libata: add FIXME above ata_dev_xfermask()
Add FIXME above ata_dev_xfermask noting that the current
implementation limits all transfer modes to the fastest of the slowest
device on a port which isn't necessary.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 23:08:36 -05:00
Tejun Heo 298a41ca41 [PATCH] libata: cosmetic changes in ata_bus_softreset()
ata_bus_softreset() should return AC_ERR_* on failure not arbitrary
positive number.  While at it, reformat comment above it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 23:04:29 -05:00
Jeff Garzik 4bbf7bc4c7 Merge branch 'upstream'
Conflicts:

	drivers/scsi/libata-core.c
2006-03-24 12:29:39 -05:00
Tejun Heo aec5c3c1a9 [PATCH] libata: kill E.D.D.
E.D.D. has no user in-tree and mostly useless.  Kill it.  For possible
out-of-tree users, add a nice warning message and error handling if
LLDD doesn't report any useable reset mechanism (and thus tries to use
E.D.D.).

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 12:24:33 -05:00
Brian King 2f1f610b62 [PATCH] libata: Remove dependence on host_set->dev for SAS
Remove some of the dependence on the host_set struct
in preparation for supporting SAS HBAs. Adds a struct device
pointer to the ata_port struct.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 10:18:43 -05:00
Jeff Garzik 2e9edbf815 [libata] export ata_dev_pair; trim trailing whitespace
Mostly, trim trailing whitespace.

Also:
* export ata_dev_pair
* move ata_dev_classify export closer to ata_dev_pair export
2006-03-24 09:56:57 -05:00
Alan Cox ebdfca6eb1 [PATCH] libata: add ata_dev_pair helper
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 09:52:32 -05:00
Nigel Cunningham 082776e4be [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
At the moment libata doesn't pass pm_message_t down ata_device_suspend.
This causes drives to be powered down when we just want a freeze,
causing unnecessary wear and tear. This patch gets pm_message_t passed
down so that it can be used to determine whether to power down the
drive.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 drivers/scsi/libata-core.c |    5 +++--
 drivers/scsi/libata-scsi.c |    4 ++--
 drivers/scsi/scsi_sysfs.c  |    2 +-
 include/linux/libata.h     |    4 ++--
 include/scsi/scsi_host.h   |    2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 09:51:36 -05:00
Tejun Heo 83206a2903 [PATCH] libata: make ata_set_mode() responsible for failure handling
Make ata_set_mode() responsible for determining whether to take port
or device offline on failure.  ata_dev_set_xfermode() and
ata_dev_set_mode() indicate error to the caller instead of disabling
port directly on failure.  Also, for consistency, ata_dev_present()
check is done in ata_set_mode() instead of ata_dev_set_mode().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 09:39:57 -05:00
Tejun Heo fcef978f9d [PATCH] libata: use ata_dev_disable() in ata_bus_probe()
We may or may not disable a device after ata_dev_configure() fails.
Kill 'not supported, ignoring' message in ata_dev_configure() and use
ata_dev_disable() in ata_bus_probe().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 09:39:57 -05:00
Tejun Heo 0b8efb0a16 [PATCH] libata: implement ata_dev_disable()
This patch implements ata_dev_disable() which prints a warning message
and takes @dev offline.  Currently, this is done by explicitly
incrementing dev->class with case-by-case warning messages.  Giving
user clear indication when libata gives up will be more important as
libata will be doing more retries.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 09:39:57 -05:00
Tejun Heo 1f7dd3e9d6 [PATCH] libata: check if port is disabled after internal command
libata core is being changed to disallow port/device disable on lower
layers.  However, some LLDDs (sata_mv) directly disable port on
command failure.  This patch makes ata_exec_internal() check whether a
port got disabled after an internal command.  If it is, AC_ERR_SYSTEM
is added to err_mask and the port gets re-enabled.

As internal command failure results in device disable for drivers
which don't implement newer reset/EH callbacks, this change results in
no behavior change for single device per port controllers.  For
slave-possible LLDDs which disable port on command failure, (1) such
drivers don't exist currently, (2) issuing command to the other device
of once-disabled port shouldn't result in catastrophe even if such
driver exists.  So, this should be enough as a temporary measure.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 09:39:57 -05:00
Tejun Heo 5a52913955 [PATCH] libata: make per-dev transfer mode limits per-dev
Now that each ata_device has xfer masks, per-dev limits can be made
per-dev instead of per-port.  Make per-dev limits per-dev.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 09:28:33 -05:00