Commit Graph

248 Commits

Author SHA1 Message Date
Jeff Garzik f01c184569 Merge branch 'master' 2006-03-22 19:13:54 -05:00
Jeff Garzik 4d4681f6b9 [libata] fix oops on non-DMA bmdma hardware
Alan noted: "bmdma may be zero but the bmdma_irq_clear function gets
called even in this case during pure PIO operation. Check we have a
bmdma before we use it."

I fixed this by adding a check for zero.  While was I there, I fixed the
non-standard indentation of the small function's code.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-21 21:31:22 -05:00
Alan Cox 23cfce8924 [PATCH] libata: make irqtrap mode compile
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-21 21:21:32 -05:00
Alan Cox 88f93a31dc [PATCH] libata: report which drive is causing mode problems
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-21 21:21:32 -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
Albert Lee f59b0cf8a3 [PATCH] libata-dev: Remove ATA_PROT_PIO_MULT
Remove the ATA_PROT_PIO_MULT protocol.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-21 20:39:46 -05:00
Albert Lee 41ade50c4e [PATCH] libata-dev: add flush task to ata_exec_internal()
Add ata_port_flush_task() to ata_exec_internal().

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-21 20:39:46 -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 c39f5ebe0a [PATCH] libata: move IDENTIFY info printing from ata_dev_read_id() to ata_dev_configure()
Move IDENTIFY info printing from ata_dev_read_id() to
ata_dev_configure() and print only if @print_info is non-zero.  This
kills duplicate IDENTIFY info printing during probing.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-16 19:22:57 -05:00
Tejun Heo 1148c3a78a [PATCH] libata: use local *id instead of dev->id in ata_dev_configure()
dev->id is used many times in ata_dev_configure().  Use local variable
id instead for shorter notation.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-16 19:22:57 -05:00
Tejun Heo fb21f0d0ec [PATCH] libata: check Word 88 validity in ata_id_xfer_mask()
Check bit 2 of Word 53 for Word 88 validity before using Word 88 to
determine UDMA mask.  Note that the original xfer mask implementation
using ata_get_mode_mask() didn't consider bit 2 of Word 53.  This
patch introduces different (correct) behavior.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-12 12:51:11 -05:00
Tejun Heo 2044470ccc [PATCH] libata: fix class handling in ata_bus_probe()
ata_bus_probe() didn't set classes[] properly for port disabled case
of ->phy_reset() compatibility path.  This patch moves classes[]
initialization and normalization out of ->probe_reset block such that
it applies to both ->probe_reset and ->phy_reset paths.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-12 12:49:45 -05:00
Jeff Garzik 418dc1f5a8 libata: turn on ATAPI by default 2006-03-11 20:50:08 -05:00
Tejun Heo 2061a47a9b [PATCH] libata: fix missing classes[] initialization in ata_bus_probe()
ata_bus_probe() didn't initialize classes[] properly with
ATA_DEV_UNKNOWN.  As ->probe_reset() is allowed to leave @classes
alone when no device is present, this results in garbage class values.
ATM, the only affected driver is ata_piix.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 19:04:49 -05:00
Tejun Heo 75f554bc13 [PATCH] libata: kill unused xfer_mode functions
Preceding xfer_mask changes make the following functions unused.

  ata_pio_modes(), base_from_shift(), ata_pr_blacklisted(), fgb()

Kill them.  Also, as xfer_mode_str[] is now only used by
ata_mode_string(), move it into the function.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 19:03:39 -05:00
Tejun Heo a6d5a51cf1 [PATCH] libata: reimplement ata_set_mode() using xfer_mask helpers
Use xfer_mask helpers to determine transfer mode.  This rewrite also
makes transfer mode determination done before any actual
configuration.  This patch doesn't result in any functional changes.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 19:03:39 -05:00
Tejun Heo 23e71c3d3e [PATCH] libata: use xfer_mask helpers in ata_dev_set_mode()
Rewrite hardcoded xfer_mode string determination in ata_dev_set_mode()
using xfer_mask helpers.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 19:03:39 -05:00
Tejun Heo ff8854b271 [PATCH] libata: use ata_id_xfermask() in ata_dev_configure()
Replace quick & dirty max transfer mode determination in
ata_dev_configure() with ata_id_xfermask().  While at it, rename
xfer_modes variable to xfer_mask and make it unsigned int for
consistency.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 19:03:39 -05:00
Tejun Heo cb95d562e4 [PATCH] libata: add xfer_mask handling functions
Add ata_pack_xfermask(), ata_xfer_mask2mode(), ata_xfer_mode2mask(),
ata_xfer_mode2shift() and ata_id_xfermask().  These functions will be
used by following patches to simplify xfer_mask handling.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-11 19:03:39 -05: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 8061f5f0a0 [PATCH] libata: convert pio_task and packet_task to port_task
Make pio_task and atapi_packet_task use port_task.
atapi_packet_task() is moved upward such that it's right after
ata_pio_task().  This position is more natural and makes adding
prototype for ata_qc_issue_prot() unnecessary.

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 48a8a14ff1 [PATCH] libata: revalidate after transfer mode configuration
Revalidate device after transfer mode configuration.  This also makes
dev->id up-to-date.

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 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 4c2d721ab6 [PATCH] libata: add @print_info argument to ata_dev_configure()
Add @print_info argument to ata_dev_configure().  Details of
configured device is printed only when @pinfo_info is non-zero.  This
patch also reorganizes device info printing for LBA case to simplify
code (necessary as @print_info adds extra nesting around it).

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 208a9933bc [PATCH] libata: re-initialize parameters before configuring
In ata_dev_configure(), reinitialize parameters before configuring.
This change is for revalidation and hotplug.  As ata_dev_configure()
can be entered multiple times, parameters need to be reinitialized.

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 28ca5c57dc [PATCH] libata: reorganize ata_bus_probe()
Now that reset and configure are converted such that they don't modify
or disable libata core data structures, reorganize ata_bus_probe() to
reflect this change.

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 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 ffeae418c1 [PATCH] libata: separate out ata_dev_configure()
Separate out ata_dev_configure() from ata_dev_identify() such that
ata_dev_configure() only configures @dev according to passed in @id.
The function now does not disable device on failure, it just returns
appropirate error code.

As this change leaves ata_dev_identify() with only reading ID, calling
configure and disabling devices according to the results, this patch
also kills ata_dev_identify() and inlines the logic into
ata_bus_probe().

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 a9d01d2b49 [PATCH] libata: kill illegal kfree(id)
Kill kfree(id) in failure path of ata_dev_read_id().  id is not
dynamically allocated yet.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-01 14:48:42 -05:00
Jeff Garzik d2dbaad855 Merge branch 'master' 2006-03-01 14:45:47 -05:00
Jeff Garzik c3c013a2c2 [libata] Disable FUA
Until problems are sorted.
2006-02-27 22:31:19 -05:00
Tejun Heo ba70d06147 [PATCH] libata: kill ata_dev_reread_id()
Kill now-unused ata_dev_reread_id().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-20 18:56:59 -05:00
Tejun Heo 49016aca2e [PATCH] libata: separate out ata_dev_read_id()
Separate out ata_dev_read_id() from ata_dev_identify().  This is the
first half of splitting ata_dev_identify().  ata_dev_read_id() will
also be used for revalidation.  This patch does not make any behavior
change.

ata_dev_read_id() doesn't modify any of libata-internal data
structures.  It simply reads IDENTIFY page and returns error code on
failure.  INIT_DEV_PARAMS and EDD wrong class code are also handled by
this function.

Re-reading IDENTIFY after INIT_DEV_PARAMS is performed by jumping to
retry: instead of calling ata_dev_reread_id().  This is done because
1. there's retry label anyway 2. ata_dev_reread_id() cannot be used
anywhere else so there's no reason to keep it.

This function is probably the place to set transfer mode to PIO0
before IDENTIFY.  However, reset -> identify -> init_dev_params order
should be kept for pre-ATA4 devices so we cannot set transfer mode
before IDENTIFY for them.  How do we know if a device is post-ATA4
before IDENTIFY?

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-20 18:56:58 -05:00
Jeff Garzik f131883e73 Merge branch 'upstream-fixes' 2006-02-20 16:55:56 -05:00
Tejun Heo 2e242fa994 [PATCH] libata: make ata_sg_setup_one() trim zero length sg
This patch makes ata_sg_setup_one() trim sg entry (thus making
qc->n_elem zero) if padding results in zero length sg entry.

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 9ae61c6cb6 [PATCH] libata: fix WARN_ON() condition in *_fill_sg()
For ATAPI commands, padding can reduce qc->n_elem by one and thus to
zero making assert(qc->n_elem > 0)'s in ata_fill_sg() and qs_fill_sg()
fail for legal commands.  This patch fixes the assert()'s to take
qc->pad_len into account.

Although the condition check seems a bit excessive, as this part of
code isn't still stable yet, I think it's worth to keep those.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-20 16:48:17 -05:00
Tejun Heo 56497bd5f1 [PATCH] libata: fix comment regarding setting cable type
The comment above ata_std_postreset() specified that setting cable
type is the responsibility of postreset(), which isn't possible /
optimal depending on controller / driver.  This patch kills the
comment.  Setting cable type is responsibility of ->probe_reset.
libata doesn't care whether it's done in probeinit, reset or
postreset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-20 06:19:53 -05:00
Tejun Heo 6aff8f1f07 [PATCH] libata: update ata_dev_init_params()
Update ata_dev_init_params() such that it doesn't disable port
directly but return with appropriate error mask on failure.  This is
preparation for splitting ata_dev_identify().  Note that this patch
changes behavior of dev_init_params failure such that only failing
devices are taken offline not the whole port.  This change is
intended.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-20 05:07:52 -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
Jeff Garzik 5b2ffed906 Merge branch 'master' 2006-02-20 02:16:23 -05:00
Albert Lee 0565c26de7 [PATCH] libata: minor fix for 2.6.16-rc3
- Fix the array index value in ata_rwcmd_protocol() for the added FUA commands.
 - Filter out ATAPI packet command error messages in ata_pio_error()

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-17 16:29:07 -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
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
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 1fdffbce03 [libata] Move PCI IDE BMDMA-related code to new file libata-bmdma.c. 2006-02-09 05:15:27 -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
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 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 8e436af932 [PATCH] libata: fix ata_qc_issue() error handling
When ata_qc_issue() fails, the qc might have been dma mapped or not.
So, performing only ata_qc_free() results in dma map leak.  This patch
makes ata_qc_issue() mark dma map flags correctly on failure and calls
ata_qc_complete() after ata_qc_issue() fails.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 22:33:50 -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
Tejun Heo 4ba946e9d8 [PATCH] libata: fold __ata_qc_complete() into ata_qc_free()
All ata_qc_free() does is calling __ata_qc_complete() which isn't used
anywhere else.  Fold __ata_qc_complete() into ata_qc_free().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26 22:33:49 -05:00
Tejun Heo 3be680b732 [PATCH] libata: separate out ata_sata_print_link_status
Separate out sata_print_link_status() from __sata_phy_reset().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-17 19:49:10 -05:00
Alan Cox a1bd9e6857 [PATCH] libata: Code for the IRQ mask flag
Signed-off-by: Alan Cox <alan@redhat.com>

Somewhat cleaner in the resync as someone cleaned up the pio xfer users
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-17 19:37:45 -05:00
Alan Cox 9d824d0710 [PATCH] libata: Fix sector lock to apply to both drives not drive 0 twice
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-17 19:37:45 -05:00
Alan Cox 8d238e0124 [PATCH] libata: Fix heuristic typos add LBA48PIO flag and support code, add IRQ flag for next diff
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-17 19:37:45 -05:00
Alan Cox 1bc4ccfff8 [PATCH] libata: add a function to decide if we need iordy
This ought to be simple but for PIO2 we have to poke around the drive
data to get it 100% correct.

Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-17 08:25:39 -05:00
Alan Cox ffa29456cd [PATCH] libata: Pre UDMA EIDE PIO mode selection
I misread the spec when doing the original. I've tested the corrected
version with pre UDMA drives and it now picks the right modes. This is a
specific bug fix rather than an update or new feature item.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-17 08:25:39 -05:00
Arjan van de Ven 858119e159 [PATCH] Unlinline a bunch of other functions
Remove the "inline" keyword from a bunch of big functions in the kernel with
the goal of shrinking it by 30kb to 40kb

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-14 18:27:06 -08:00
Linus Torvalds d99cf9d679 Merge branch 'post-2.6.15' of git://brick.kernel.dk/data/git/linux-2.6-block
Manual fixup for merge with Jens' "Suspend support for libata", commit
ID 9b84754866.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 09:01:25 -08:00
Jens Axboe 9b84754866 [PATCH] Suspend support for libata
This patch adds suspend patch to libata, and ata_piix in particular. For
most low level drivers, they should just need to add the 4 hooks to
work. As I can only test ata_piix, I didn't enable it for more
though.

Suspend support is the single most important feature on a notebook, and
most new notebooks have sata drives. It's quite embarrassing that we
_still_ do not support this. Right now, it's perfectly possible to
suspend the drive in mid-transfer.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:36:09 -08:00
Tejun Heo 9a3dccc425 [BLOCK] add FUA support to libata
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
2006-01-06 09:56:18 +01:00
Tejun Heo b563230340 [PATCH] libata: remove unused qc->waiting
There is no user of qc->waiting left after ata_exec_internal()
changes.  Kill the field.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-13 01:34:46 -05:00
Tejun Heo 82033adf0a [PATCH] libata: remove unused functions
There is no user of ata_qc_wait_err() and ata_qc_complete_noop() after
ata_exec_internal() changes.  Remove unused functions.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-13 01:34:45 -05:00
Tejun Heo a012370322 [PATCH] libata: use ata_exec_internal()
This patch converts all users of libata internal commands to use
ata_exec_internal().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-13 01:34:45 -05:00
Tejun Heo a2a7a662f8 [PATCH] libata: implement ata_exec_internal()
This patch implements ata_exec_internal() function which performs
libata internal command execution.  Previously, this was done by each
user by manually initializing a qc, issueing it, waiting for its
completion and handling errors.  In addition to obvious code
factoring, using ata_exec_internal() fixes the following bugs.

* qc not freed on issue failure
* ap->qactive clearing could race with the next internal command
* race between timeout handling and irq
* ignoring error condition not represented in tf->status

Also, qc & hardware are not accessed anymore once it's completed,
making internal commands more conformant with general semantics.
ata_exec_internal() also makes it easy to issue internal commands from
multiple threads if that becomes necessary.

This patch only implements ata_exec_internal().  A following patch
will convert all users.

Signed-off-by: Tejun Heo <htejun@gmail.com>

--

Jeff, all patches have been regenerated against upstream branch as of
today.  (575ab52a21)

Also, I took out a debug printk from ata_exec_internal (don't know how
that one got left there).  Other than that, all patches are identical
to the previous posting.

Thanks. :-)
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-13 01:34:45 -05:00
Jeff Garzik 575ab52a21 Merge branch 'upstream-fixes' 2005-12-12 23:51:01 -05:00
Mark Lord dfa159886f [PATCH] libata-core.c: fix parameter bug on kunmap_atomic() calls
Fix incorrect pointer usage on two calls to kunmap_atomic().
This seems to happen a lot, because kunmap() wants the struct page *,
whereas kunmap_atomic() instead wants the mapped virtual address.

Signed-off-by: Mark Lord <liml@rtr.ca>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-12 23:19:28 -05:00
Albert Lee fe79e683cc [PATCH] libata: err_mask misc fix
1. ata_pio_complete():
     It seems unnecessary to wait for the clearing of the DRQ bit.
     (Waiting for BSY=0 should be enough.
     ata_ok() also checks the correctness of the status bits later.)

  2. ata_pio_block():
     - added error checking, before transfering data.
     - minor comments fix

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

============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-06 04:49:23 -05:00
Albert Lee d8fe452b3e [PATCH] libata: determine the err_mask directly in atapi_packet_task()
- set qc->err_mask directly when we found the error
  - remove the code to determine err_mask from device status

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

============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-06 04:49:23 -05:00
Albert Lee 1c8489840e [PATCH] libata: determine the err_mask when the error is found
- move "qc->err_mask |= AC_ERR_ATA_BUS" to where the error is found
  - add "assert(qc->err_mask)" to ata_pio_error() to make sure qc->err_mask was available when we enter the error state

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

============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-06 04:49:23 -05:00