Commit Graph

205 Commits

Author SHA1 Message Date
Jeff Garzik 3875e1945b Merge branch 'upstream' 2006-02-13 00:13:48 -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 8eabd02c24 [PATCH] libata: make ata_dev_knobble() per-device
ata_dev_knobble() unconditionally used the first device of the port to
determine whether a device is bridged or not.  This causes bridge
limit to be incorrectly applied or unapplied for hosts with slave
devices (e.g. ata_piix).

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 61eb066aff [PATCH] libata: don't do EDD handling if ->probe_reset is used
EDD is never used with ->probe_reset.  Don't handle EDD special case
in ata_dev_identify if ->probe_reset is in use.

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 0bd3300ac9 [PATCH] libata: make ata_dump_id() take @id instead of @dev
Make ata_dump_id() take @id instead of @dev.  This is preparation for
splitting ata_dev_identify().

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 3d2ca91095 [PATCH] libata: separate out ata_id_major_version()
Separate out ATA major version calculation from ata_dev_identify()
into ata_id_major_version().  It's preparation for splitting
ata_dev_identify().

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 2940740bca [PATCH] libata: separate out ata_id_n_sectors()
Separate out n_sectors calculation into ata_id_n_sectors() from
ata_dev_identify().  This will be used by revalidation.

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 2e02671daa [PATCH] libata: use ata_dev_id_c_string()
Use ata_dev_id_c_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 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 06ab78222b [PATCH] libata: allow ->probe_reset to return ATA_DEV_UNKNOWN
This patch makes ata_bus_probe() normalize classes[] returned by
->probe_reset such that ->probe_reset can return ATA_DEV_UNKNOWN.
This eases implementation of ->probe_reset's which don't directly use
ata_drive_probe_reset().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-12 13:57:22 -05:00
Jeff Garzik 587005de14 [libata irq-pio] s/assert/WARN_ON/ 2006-02-11 18:17:32 -05:00
Jeff Garzik 1cb9d721d9 Merge branch 'upstream' 2006-02-11 18:02:04 -05:00
Tejun Heo a46314744d [PATCH] libata: convert assert(X)'s in libata core layer to WARN_ON(!X)'s
In an effort to kill libata-specific assert() and use generic
WARN_ON(), this patch converts all assert(X)'s in libata core layer to
WARN_ON(!X)'s.  Most conversions are straight-forward logical negation
exception for the followings.

* In libata-core.c:ata_fill_sg(),
  assert(qc->n_elem > 0) is converted to WARN_ON(qc->n_elem == 0) because
  qc->n_elem is unsigned and unsigned <= 0 is weird.

* In libata-scsi.c:ata_gen_ata_desc/fixed_sense(),
  assert(NULL != qc->ap->ops->tf_read) is converted to
  WARN_ON(qc->ap->ops->tf_read == NULL), as there are no other users of
  'constant cond var' style in libata.

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 ac7c6d596e [PATCH] libata: kill SError clearing in sata_std_hardreset().
Don't clear SError in sata_std_hardreset().  This makes hardreset act
identically to ->phy_reset register-wise.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-10 10:30:11 -05:00
Tejun Heo 3a39746a52 [PATCH] libata: make new reset act identical to ->phy_reset register-wise
This patch makes std component operations act identical to ->phy_reset
register-wise except for SError clearing on sata_std_hardreset.

Note that if a driver only implements/uses hardreset, it should not
use ata_std_probeinit() to avoid extra sata_phy_resume() and
ata_busy_sleep() compared to ->phy_reset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-10 10:30:11 -05:00
Jeff Garzik ca7d5e42d7 Merge branch 'upstream' 2006-02-10 07:09:37 -05:00
Tejun Heo f637902015 [PATCH] libata: kill NULL qc handling from ->eng_timeout callbacks
->eng_timeout cannot be invoked with NULL qc anymore.  Add an
assertion in ata_scsi_error() and kill NULL qc handling from all
->eng_timeout callbacks.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-10 06:50:47 -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
Jeff Garzik a081975002 Merge branch 'upstream' 2006-02-09 05:15:47 -05:00
Jeff Garzik 1fdffbce03 [libata] Move PCI IDE BMDMA-related code to new file libata-bmdma.c. 2006-02-09 05:15:27 -05:00
Jeff Garzik 41232d3eca [libata] build fix after merging some pre-packet_task-removal code 2006-02-09 04:52:55 -05:00
Jeff Garzik 99b3738fbf Merge branch 'upstream' 2006-02-09 04:28:13 -05:00
Albert Lee 332b5a52f2 [PATCH] libata-dev: Minor comment fix
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>

===
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 04:26:13 -05:00
Albert Lee 555a896506 [PATCH] libata-dev: Use new AC_ERR_* flags
- Use new AC_ERR_* flags as done in Tejun's patches
  - In ata_qc_timeout(), replace ac_err_mask(drv_stat) with AC_ERR_TIMEOUT.
    This makes time out handler always report error to upper layer.
    Otherwise if the drv_stat looks good, libata might falsely report OK to the upper layer.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>

===
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 04:26:13 -05:00
Albert Lee 20ea079e58 [PATCH] libata-dev: Use new ata_queue_pio_task() for PIO polling task
- Use new ata_queue_pio_task() for PIO polling task.
  - Remove the unused ata_queue_packet_task() function.
    (irq-pio had merged the 2 queues into one.)

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>

===
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 04:26:12 -05:00
Albert Lee aef9d533da [PATCH] libata-dev: Fix array index value in ata_rwcmd_protocol()
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>

===
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 04:26:12 -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 7a7921e866 [PATCH] libata: separate out sata_phy_resume() from sata_std_hardreset()
This patch separates out sata_phy_resume() from sata_std_hardreset().
The function will later be used by probeinit callback.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 01:52:54 -05:00
Tejun Heo b911fc3ae0 [PATCH] libata: fix ata_std_probe_reset() SATA detection
ap->cbl is initialized during postreset and thus unknown on entry to
ata_std_probe_reset().  This patch makes ata_std_probe_reset() use
ATA_FLAG_SATA flag instead of ap->cbl to detect SATA port.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 01:52:53 -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
Randy Dunlap c893a3ae49 Various libata documentation updates.
This is a merger of libata docs + cleanups from
Martin Waitz <tali@admingilde.org> and me.

From: Randy Dunlap <rdunlap@xenotime.net>
From: Martin Waitz <tali@admingilde.org>

Fix libata kernel-doc comments to match code.
Add some function parameters to kernel-doc.
Fix some typos/spellos.
Put comments in <= 80 columns.
Make one DPRINTK string unique.
Fix sparse cast warnings.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-28 13:15:32 -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
Jeff Garzik f6ef65e6d0 Merge branch 'upstream-2.6.17' 2006-01-27 02:45:00 -05:00
Jeff Garzik 7103c7bc86 Merge branch 'tmp' 2006-01-27 02:39:25 -05:00
Jeff Garzik b4d28889f7 Merge branch 'tmp' 2006-01-27 02:37:46 -05:00
Jeff Garzik 7dfb869c8e Merge branch 'tmp' 2006-01-27 02:36:14 -05:00
Jeff Garzik 628e386e27 Merge branch 'tmp' 2006-01-27 02:29:20 -05:00
Jeff Garzik 8dd2e3bd57 Merge branch 'tmp' 2006-01-27 02:26:46 -05:00
Jeff Garzik 2af5920b81 Merge branch 'master' 2006-01-27 02:20:42 -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 b4dc7623c1 [PATCH] libata: modify ata_dev_try_classify
Make ata_dev_try_classify take @r_err to store tf error register value
on completion and return device class instead of directly manipulating
dev->class.  This is preparation for new reset mechanism.

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 9506437921 [PATCH] libata: create pio/atapi task queueing wrappers
Wrap pio/atapi task queueing in correspondingly named functions.  This
change doesn't change anything.  It's preparation for follow-up
pio-task/eh sync patch.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 23:01:29 -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 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