Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
|
|
Until problems are sorted.
|
|
Kill now-unused ata_dev_reread_id().
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
|
|
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>
|
|
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
|
|
- 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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Use ata_dev_id_c_string()
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
->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>
|
|
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>
|
|
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>
|
|
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|