1
0
Fork 0
Commit Graph

109 Commits (e8384607d4f395985e3cc5f82d75fc73efc2ecf0)

Author SHA1 Message Date
Tejun Heo ea1dd4e130 [PATCH] libata: clear only affected flags during ata_dev_configure()
ata_dev_configure() should not clear dynamic device flags determined
elsewhere.  Lower eight bits are reserved for feature flags, define
ATA_DFLAG_CFG_MASK and clear only those bits before configuring
device.  Without this patch, ATA_DFLAG_PIO gets turned off during
revalidation making PIO mode unuseable.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:19 -04:00
Tejun Heo 198e0fed9e [PATCH] libata: rename ATA_FLAG_PORT_DISABLED to ATA_FLAG_DISABLED
Rename ATA_FLAG_PORT_DISABLED to ATA_FLAG_DISABLED for consistency.
(ATA_FLAG_* are always about ports).

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:19 -04:00
Tejun Heo 949b38af40 [PATCH] libata: clean up constants
* Reorder ATA_DFLAG_* such that feature flags determined by
  ata_dev_configure() are on lower bits.  Reserve lower eight bits
  for this purpose and allocate dynamic flags from bit 8.

* Reorder ATA_FLAG_* such that feature flags determined during driver
  initiailization are on bits 0:15, dynamic flags on 16:23 and LLDD
  specific flags on 24:31.

* Kill trailing white space and lower-case an one line comment for
  consistency.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:19 -04:00
Tejun Heo c43c555c3a [PATCH] libata: ATA_FLAG_IN_EH is not used, kill it
Kill unused flag ATA_FLAG_IN_EH.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:19 -04:00
Tejun Heo 14d2bac187 [PATCH] libata: improve ata_bus_probe()
Improve ata_bus_probe() such that configuration failures are handled
better.  Each device is given ATA_PROBE_MAX_TRIES chances, but any
non-transient error (revalidation failure with -ENODEV, configuration
failure with -EINVAL...) disables the device directly.  Any IO error
results in SATA PHY speed down and ata_set_mode() failure lowers
transfer mode.  The last try always puts a device into PIO-0.

After each failure, the whole port is reset to make sure that the
controller and all the devices are in a known and stable state.  The
reset also applies SATA SPD configuration if necessary.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:02:57 -04:00
Tejun Heo 1c3fae4d7e [PATCH] libata: implement ap->sata_spd_limit and helpers
ap->sata_spd_limit contrains SATA PHY speed of the port.  It is
initialized to the configured value prior to probing thus preserving
BIOS configured value.  hardreset is responsible for applying SPD
limit and sata_std_hardreset() is updated to do that.  SATA SPD limit
will be used to enhance failure handling during probing and later by
EH.

This patch also normalizes some comments around affected code.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:02:57 -04:00
Tejun Heo 002c8054fa [PATCH] libata: implement ata_dev_absent()
For the time being we cannot use ata_dev_present() as it was renamed
to ata_dev_enabled() but we still need presence test.  Implement
negation of the test.  Conveniently, the negated result is needed in
more places.  This is suggested by Jeff Garzik.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:02:57 -04: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
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 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
Alan Cox 4e5ec5dba2 [PATCH] libata: BMDMA handling updates
This is the minimal patch set to enable the current code to be used with
a controller following SFF (ie any PATA and early SATA controllers)
safely without crashes if there is no BMDMA area or if BMDMA is not
assigned by the BIOS for some reason.

Simplex status is recorded but not acted upon in this change, this isn't
a problem with the current drivers as none of them are for simplex
hardware. A following diff will deal with that.

The flags in the probe structure remain ->host_set_flags although Jeff
asked me to rename them, simply because the rename would break the usual
Linux rules that old code should break when there are changes. not
compile and run and then blow up/eat your computer/etc. Renaming this
later is a trivial exercise once a better name is chosen.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:27 -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
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 acf356b12d [PATCH] libata: add per-dev pio/mwdma/udma_mask
Add per-dev pio/mwdma/udma_mask.  All transfer mode limits used to be
applied to ap->*_mask which unnecessarily restricted other devices
sharing the port.  This change will also benefit later EH speed down
and hotplug.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24 09:28:33 -05:00
Jeff Garzik f01c184569 Merge branch 'master' 2006-03-22 19:13:54 -05:00
Jeff Garzik 17bb34a3c5 [libata] add prototypes for helpers
Add prototypes for stuff recently added by Alan.
2006-03-21 21:29:21 -05:00
Brian King e46834cd2d [PATCH] libata: Add some dummy noop functions
Add some dummy noop functions for use by libata clients
that do not need to do anything. Future SAS patches will
utilize these functions.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-21 21:03:43 -05:00
Tejun Heo 30afc84cf7 [SCSI] libata: implement minimal transport template for ->eh_timed_out
SCSI midlayer has moved hostt->eh_timed_out to transport template.  As
libata doesn't need full-blown transport support yet, implement
minimal transport for libata.  No transport class or whatsoever, just
empty transport template with ->eh_timed_out hook.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-03-21 13:07:05 -06:00
Tejun Heo 1da7b0d01b [PATCH] libata: improve xfer mask constants and update ata_mode_string()
Add ATA_BITS_*, ATA_MASK_* macros and reorder xfer_mask fields such
that higher transfer mode is placed at higher order bit.  As thie
reordering breaks ata_mode_string(), this patch also rewrites
ata_mode_string().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 19:03:38 -05:00
Tejun Heo 2e755f68ee [PATCH] libata: rename ATA_FLAG_FLUSH_PIO_TASK to ATA_FLAG_FLUSH_PORT_TASK
Rename ATA_FLAG_FLUSH_PIO_TASK to ATA_FLAG_FLUSH_PORT_TASK.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 17:57:21 -05:00
Tejun Heo 507ceda003 [PATCH] libata: kill unused pio_task and packet_task
Kill unused pio_task and packet_task.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 17:57:20 -05:00
Tejun Heo 86e45b6bd6 [PATCH] libata: implement port_task
Implement port_task.  LLDD's can schedule a function to be executed
with context after specified delay.  libata core takes care of
synchronization against EH.  This is generalized form of pio_task and
packet_task which are tied to PIO hsm implementation.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 17:57:20 -05:00
Tejun Heo 623a3128aa [PATCH] libata: implement ata_dev_revalidate()
ata_dev_revalidate() re-reads IDENTIFY PAGE of the given device and
makes sure it's the same device as the configured one.  Once it's
verified that it's the same device, @dev is configured according to
newly read IDENTIFY PAGE.  Note that revalidation currently doesn't
invoke transfer mode reconfiguration.

Criteria for 'same device'

* same class (of course)
* same model string
* same serial string
* if ATA, same n_sectors (to catch geometry parameter changes)

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-05 11:09:42 -05:00
Tejun Heo 4b2f3ededc [PATCH] libata: fold ata_dev_config() into ata_dev_configure()
ata_dev_config() needs to be done everytime a device is configured.
Fold it into ata_dev_configure().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-03 17:31:04 -05:00
Tejun Heo d9572b1d5e [PATCH] libata: convert dev->id to pointer
Convert dev->id from array to pointer.  This is to accomodate
revalidation.  During revalidation, both old and new IDENTIFY pages
should be accessible and single ->id array doesn't cut it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-03 17:31:04 -05:00
Tejun Heo 597afd2140 [PATCH] libata: seperate out ata_class_present()
Seperate out ata_class_present() from ata_dev_present().  This is
useful because new reset mechanism deals with classes[] directly.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-03 15:39:54 -05:00
Jeff Garzik f131883e73 Merge branch 'upstream-fixes' 2006-02-20 16:55:56 -05:00
Tejun Heo cc1887f3d8 [PATCH] libata: fix qc->n_elem == 0 case handling in ata_qc_next_sg
This patch makes ata_for_each_sg() start with pad_sgent when
qc->n_elem is zero.  Previously, ata_for_each_sg() unconditionally
started with qc->__sg, handling the first sg to fill_sg() routines
even when the entry was invalid.  And while at it, unwind ?: in
ata_qc_next_sg() into if statement.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-20 16:48:18 -05:00
Tejun Heo 6a62a04d47 [PATCH] libata: rename ata_dev_id_[c_]string()
This patch renames ata_dev_id_[c_]string() to ata_id_[c_]string().
All other functions which read data from ATA ID data start with ata_id
and those two function names were getting too long.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-20 04:54:22 -05:00
Tejun Heo b00eec1d58 [PATCH] libata: add per-device max_sectors
If a low level driver wants to control max_sectors, it had to adjust
ap->host->max_sectors and set ATA_DFLAG_LOCK_SECTORS to tell
ata_scsi_slave_config not to override the limit.  This is not only
cumbersome but also incorrect for hosts which support more than one
devices per port.

This patch adds per-device ->max_sectors.  If the field is unset
(zero), libata core layer will adjust ->max_sectors according to
default rules.  If the field is set, libata honors the setting.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-12 14:36:30 -05:00
Tejun Heo 6e7846e9c5 [PATCH] libata: move cdb_len for host to device
cdb_len is per-device property.  Sharing cdb_len on ap results in
inaccurate configuration on revalidation and hotplugging.  This patch
makes cdb_len per-device.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-12 14:29:10 -05:00
Tejun Heo 0e949ff304 [PATCH] libata: implement ata_dev_id_c_string()
ata_dev_id_c_string() reads ATA string from the specified offset of
the given IDENTIFY PAGE and puts it in the specified buffer in trimmed
and NULL-terminated form.  The caller must supply a buffer which is
one byte larger than the maximum size of the target ID string.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-12 14:24:41 -05:00
Tejun Heo bef4a456b8 [PATCH] libata: kill assert() macro
libata assert() now has no user left.  Kill it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-11 17:51:57 -05:00
Tejun Heo 76014427e6 [PATCH] libata: inline ata_qc_complete()
This patch inlines ata_qc_complete() and uninlines __ata_qc_complete()
as suggested by Jeff Garzik.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-11 17:51:56 -05:00
Tejun Heo f29841e08f [PATCH] libata: implement ata_scsi_timed_out()
Implement ata_scsi_timed_out(), to be used as
scsi_host_template->eh_timed_out callback for all libata drivers.
Without this function, the following race exists.

If a qc completes after SCSI timer expires but before libata EH kicks
in, the qc gets completed but the scsicmd still gets passed to libata
EH resulting in ->eng_timeout invocation with NULL qc, which none is
handling properly.

This patch makes sure that scmd and qc share the same lifetime.
Original idea from Jeff Garzik <jgarzik@pobox.com>.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-10 06:50:46 -05:00
Tejun Heo 341963b909 [PATCH] libata: add ATA_QCFLAG_EH_SCHEDULED
Add ATA_QCFLAG_EH_SCHEDULED.  If this flag is set, the qc is owned by
EH and normal completion path is not allowed to finish it.  This patch
doesn't actually use this flag.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-10 06:50:45 -05:00
Tejun Heo 8a19ac89ed [PATCH] libata: implement ata_std_probeinit()
This patch implements the off-the-shelf probeinit component operation.
Currently, all it does is waking up the PHY if it's a SATA port.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 01:59:52 -05:00
Tejun Heo 7944ea9522 [PATCH] libata: add probeinit component operation to ata_drive_probe_reset()
This patch adds probeinit component operation to
ata_drive_probe_reset().  If present, this new operation is called
before performing any reset.  The operations's roll is to prepare @ap
for following probe-reset operations.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 01:59:52 -05:00
Tejun Heo c18d06f89f [PATCH] libata: EH / pio tasks synchronization
This patch makes sure that pio tasks are flushed before proceeding
with EH.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 01:18:38 -05:00
Tejun Heo dde44589bf [PATCH] libata: implement ATA_FLAG_IN_EH port flag
ATA_FLAG_IN_EH flag is set on entry to EH and cleared on completion.
This patch just sets and clears the flag.  Following patches will
build normal qc execution / EH synchronization aroung this flag.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 01:18:37 -05:00
Tejun Heo c2bd58047b [PATCH] libata: implement standard reset component operations and ->probe_reset
Implement SRST, COMRESET and standard postreset component operations
for ata_drive_probe_reset(), and use these three functions to
implement ata_std_probe_reset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-27 20:58:34 -05:00
Tejun Heo a62c0fc526 [PATCH] libata: implement ata_drive_probe_reset()
Most low level drivers share supported reset/classify actions and
sequence.  This patch implements ata_drive_probe_reset() which helps
constructing ->probe_reset from three component operations -
softreset, hardreset and postreset.  This minimizes duplicate code and
yet allows flexibility if needed. The three component operations can
also be shared by EH later.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-27 20:58:34 -05:00
Tejun Heo c19ba8af4f [PATCH] libata: new ->probe_reset operation
Add new ->probe_reset operation to ata_port_operations obsoleting
->phy_reset.  The main difference from ->phy_reset is that the new
operation is not allowed to manipulate libata internals directly.
It's not allowed to configure or disable the port or devices.  It can
only succeed or fail and classify attached devices into passed
@classes.

This change gives more control to higher level and eases sharing reset
methods with EH.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 23:20:14 -05:00
Tejun Heo 6f8b995895 [PATCH] libata: export ata_busy_sleep
Export ata_busy_sleep(), to be used by low level driver reset functions.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 23:18:47 -05:00
Tejun Heo a72ec4ce6d [PATCH] libata: implement and apply ata_eh_qc_complete/retry()
Implement ata_eh_qc_complete/retry() using scsi_eh_finish_cmd() and
scsi_eh_flush_done_q().  This removes all eh scsicmd finish hacks from
low level drivers.

This change was first suggested by Jeff Garzik.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 22:36:28 -05:00
Tejun Heo 9a3d9eb017 [PATCH] libata: return AC_ERR_* from issue functions
Return AC_ERR_* mask from issue fuctions instead of 0/-1.  This
enables things like failing a qc with AC_ERR_HSM when the device
doesn't set DRDY when the qc is about to be issued.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 22:36:27 -05:00
Tejun Heo 11a56d2439 [PATCH] libata: add detailed AC_ERR_* flags
Add detailed AC_ERR_* flags and use them.  Long-term goal is to
describe all errors with err_mask and tf combination (tf for failed
sector information, etc...).  After proper error diagnosis is
implemented, sense data should also be generated from err_mask instead
of directly from hardware tf registers as it is currently.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 22:36:27 -05:00
Tejun Heo 77853bf2b4 [PATCH] libata: make the owner of a qc responsible for freeing it
qc used to be freed automatically on command completion.  However, as
a qc can carry information about its completion status, it can be
useful to its owner/issuer after command completion.  This patch makes
freeing qc responsibility of its owner.  This simplifies
ata_exec_internal() and makes command turn-around for atapi request
sensing less hackish.

This change was originally suggested by Jeff Garzik.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 22:33:49 -05:00