Commit Graph

1337 Commits

Author SHA1 Message Date
Al Viro ac2f217baf typo in sata_fsl
it's ata_link, not ata_linke

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 10:03:31 -07:00
Roel Kluin f9d4249172 pata_bf54x: decrease count first.
When count reaches 0 the postfix decrement still subtracts (to -1),
so bfin_reset_controller() returns as if the busy flag was cleared
while it was not.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:26:28 -04:00
Mark Lord 85afb93457 sata_mv: re-enable hotplug, update TODO list
Re-enable hotplug, now that the interrupt/error handling are mostly sane.
Also update the TODO list at the top.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:26:22 -04:00
Mark Lord 8d07379d25 sata_mv: leave SError bits untouched in mv_err_intr
Here it is again, minus the checkpatch.pl complaint:

Rework mv_err_intr() to leave the SError bits as-is,
so that libata-eh has a chance to see/use them.

We originally thought that clearing them here was necessary
before writing back to edma_err_cause (per the Marvell datasheets),
but we will end up reseting the chip regardless in those cases.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:26:14 -04:00
Mark Lord 8f767f8a02 sata_mv: more interrupt handling rework
Continue fixing the interrupt handling logic.

Get rid of mv_intr_pio(), by using ata_sff_host_intr() for PIO..

Add a mv_unexpected_intr() catch-all for "impossible" scenarios,
where we get an interrupt that shouldn't have happened
(never seen in testing, but just in case..).

Rearrange the logic so that we always process completed
response queue entries before looking for other events,
This avoids having to re-issue commands that had already succeeded.

As part of this, we split out some duplicated functionality
into a new function, mv_get_active_qc().

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:26:06 -04:00
Mark Lord a3718c1f23 sata_mv: tidy host controller interrupt handling
Tidy up host controller interrupt handling, by moving the weirdo
bit shifting from mv_interrupt() to mv_host_intr().

This lets us take advantage of the MV_PORT_TO_SHIFT_AND_HARDPORT() macro
from an earlier patch to greatly simplify the port numbering logic.

Also, defer reading the hc_irq_cause (one per hc) until it is
actually proven to be needed.  This may save a microsecond or
so per interrupt, on average (a later patchset will further reduce
unnecessary register reads throughout the driver).

Apart from that, we still leave the actual IRQ handling logic alone.
Subsequent patches in this series will address that.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:25:57 -04:00
Mark Lord fcfb1f77ce sata_mv: simplify request/response queue handling
Try and simplify handling of the request/response queues.

Maintain the cached copies of queue indexes in a fully-masked state,
rather than having each use of them have to do the masking.

Split off handling of a single crpb response into a separate function,
to reduce complexity in the main mv_process_crpb_entries() routine.

Ignore the rarely-valid error bits from the crpb status field,
as we already handle that information in mv_err_intr().

For now, preserve the rest of the original logic.
A later patch will deal with fixing that separately.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:25:48 -04:00
Mark Lord 1cfd19aeb8 sata_mv: simplify freeze/thaw bit-shift calculations
Introduce the MV_PORT_TO_SHIFT_AND_HARDPORT() macro,
to centralize/simplify various scattered bits of logic
for calculating bit shifts and the like.

Some of the places that do this get it wrong, too,
so consolidating the algorithm at one place will help
keep the code correct.

For now, we use the new macro in mv_eh_{freeze,thaw}.
A subsequent patch will re-use this in the interrupt handlers

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:25:36 -04:00
Mark Lord f9f7fe014f sata_mv mask all interrupt coalescing bits
Ignore *all* interrupt coalescing bits on all controllers,
not just some of each.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:11:41 -04:00
Mark Lord 352fab701c sata_mv more cosmetics
More cosmetic cleanups prior to the interrupt/error handling logic changes.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:11:40 -04:00
Dan McGee 01ce2601e4 ata_piix: add Asus Eee 701 controller to short cable list
The drive is directly soldered to the controller, so there is no cable at
all. Remove the 40-wire assumption so the drive can operate at max speed.

Before patch:
$ dd if=/dev/sda of=/dev/null bs=2M count=64 iflag=direct
134217728 bytes (134 MB) copied, 5.29612 s, 25.3 MB/s

After patch:
$ dd if=/dev/sda of=/dev/null bs=2M count=64 iflag=direct
134217728 bytes (134 MB) copied, 3.94955 s, 34.0 MB/s

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:11:39 -04:00
Mark Lord a6116c9e60 libata-eh set tf flags in NCQ EH result_tf
Fix mis-reporting of NCQ errors by ensuring that result_tf->flags
is properly initialized in libata-eh.  This allows ata_gen_ata_sense()
to report the failed block number correctly to SCSI after a media error
during NCQ.

This patch may also be a candidate for backporting to earlier kernels.
Without this fix, SCSI will fail I/O on the entire request rather
than just the bad sector.  That can be bad for a request that was
merged from many independent read reads from different tasks.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 01:11:37 -04:00
Adrian Bunk 1dc55e8761 make sata_set_spd_needed() static
sata_set_spd_needed() can now become static.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 00:46:11 -04:00
Adrian Bunk 6bdb4fc9f9 make sata_print_link_status() static
sata_print_link_status() can now become static.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 00:46:09 -04:00
Adrian Bunk 66a9099e02 libata-acpi.c: remove unneeded #if's
These #if's are unneeded since they:
- did anyway not handle the CONFIG_ACPI_DOCK_MODULE case correctly and
- this is already handled in include/acpi/acpi_drivers.h and
- it's now correctly handled in kconfig.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 00:45:52 -04:00
Tejun Heo a0b9f4bc1e sata_nv: make hardreset return -EAGAIN on success
sata_nv hardreset can't classify but was left out while unifying
follow-up SRST request mechanism[1].  This caused detection failures
on those controllers.  Fix it.

Reported and bisected by Roland Dreier, Petr Vandrovec and Marc
Dionne.  Thanks guys.

[1] 305d2a1ab1

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
Cc: Marc Dionne <marc.c.dionne@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 00:45:48 -04:00
Tejun Heo 15fe982e42 ahci: retry enabling AHCI a few times before spitting out WARN_ON()
Some chips need AHCI_EN set more than once to actually set it.  Try a
few times before giving up and spitting out WARN_ON().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Peer Chen <pchen@nvidia.com>
Cc: Volker Armin Hemmann <volker.armin.hemmann@tu-clausthal.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 00:45:13 -04:00
Tejun Heo 411cb3869a libata: make WARN_ON conditions in ata_sff_hsm_move() more strict
WARN_ON()'s in ata_hsm_move() was too liberal and got triggerred when
it shouldn't (e.g. hotplug events at the right moment).  As the HSM
only deals with device errors and state machine violations, make it
check only against them.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Mark Lord <liml@rtr.ca>
Cc: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 00:45:09 -04:00
Kay Sievers 458622fcdc ATA/IDE: fix platform driver hotplug/coldplug
Since 43cc71eed1, the platform modalias
is prefixed with "platform:".  Add MODULE_ALIAS() to the hotpluggable
ATA and IDE platform drivers, to re-enable auto loading.

NOTE: both ata/pata_platform.c and ide/legacy/ide_platform.c claim
to provide "the" platform_pata driver, and there's no build-time
mutual exclusion mechanism.  This means that configs which enable
both drivers will make some trouble when hotplugging...

[dbrownell@users.sourceforge.net: more drivers, registration fixes]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Tejun Heo <htejun@gmail.com>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-25 00:45:04 -04:00
Tejun Heo 8e5443a098 sata_sis: SCR accessors return -EINVAL when requested SCR isn't available
sis_scr_cfg_read() can't access SError and was incorrectly returning
-1 instead of -EINVAL.  This went unnoticed because SError used to be
cleared in @postreset() and it didn't care about how scr_read() failed
but commit ac371987 moved SError clearing into sata_link_resume() and
SCR access failure other than -EINVAL is considered an error condition
and exposes the incorrect return value bug as detection failure.  Fix
it.

Also, scsi_scr_cfg_write() was incorrectly returning 0 after it
ignored the request to write to SError.  Make it also return -EINVAL.

This was bisected and reported by Patrick McHardy.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-24 23:42:47 -04:00
Harvey Harrison 2b4221bb54 libata: functions with definition should not be extern
Noticed by sparse
drivers/ata/libata-core.c:3380:12: warning: function 'ata_wait_after_reset' with external linkage has definition

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-24 23:42:26 -04:00
Linus Torvalds e80ab411e5 Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits)
  SCSI: convert struct class_device to struct device
  DRM: remove unused dev_class
  IB: rename "dev" to "srp_dev" in srp_host structure
  IB: convert struct class_device to struct device
  memstick: convert struct class_device to struct device
  driver core: replace remaining __FUNCTION__ occurrences
  sysfs: refill attribute buffer when reading from offset 0
  PM: Remove destroy_suspended_device()
  Firmware: add iSCSI iBFT Support
  PM: Remove legacy PM (fix)
  Kobject: Replace list_for_each() with list_for_each_entry().
  SYSFS: Explicitly include required header file slab.h.
  Driver core: make device_is_registered() work for class devices
  PM: Convert wakeup flag accessors to inline functions
  PM: Make wakeup flags available whenever CONFIG_PM is set
  PM: Fix misuse of wakeup flag accessors in serial core
  Driver core: Call device_pm_add() after bus_add_device() in device_add()
  PM: Handle device registrations during suspend/resume
  block: send disk "change" event for rescan_partitions()
  sysdev: detect multiple driver registrations
  ...

Fixed trivial conflict in include/linux/memory.h due to semaphore header
file change (made irrelevant by the change to mutex).
2008-04-21 15:49:58 -07:00
Linus Torvalds 429f731dea Merge branch 'semaphore' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc
* 'semaphore' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc:
  Deprecate the asm/semaphore.h files in feature-removal-schedule.
  Convert asm/semaphore.h users to linux/semaphore.h
  security: Remove unnecessary inclusions of asm/semaphore.h
  lib: Remove unnecessary inclusions of asm/semaphore.h
  kernel: Remove unnecessary inclusions of asm/semaphore.h
  include: Remove unnecessary inclusions of asm/semaphore.h
  fs: Remove unnecessary inclusions of asm/semaphore.h
  drivers: Remove unnecessary inclusions of asm/semaphore.h
  net: Remove unnecessary inclusions of asm/semaphore.h
  arch: Remove unnecessary inclusions of asm/semaphore.h
2008-04-21 15:41:27 -07:00
Tony Jones ee959b00c3 SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller...

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-19 19:10:33 -07:00
Russell King cf816ecb53 Merge branch 'merge-fixes' into devel 2008-04-19 17:17:34 +01:00
Russell King adf6d34e46 Merge branch 'omap2-upstream' into devel 2008-04-19 17:17:29 +01:00
Matthew Wilcox d3135846f6 drivers: Remove unnecessary inclusions of asm/semaphore.h
None of these files use any of the functionality promised by
asm/semaphore.h.  It's possible that they rely on it dragging in some
unrelated header file, but I can't build all these files, so we'll have
fix any build failures as they come up.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
2008-04-18 22:16:32 -04:00
Linus Torvalds 2cca775bae Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (137 commits)
  [SCSI] iscsi: bidi support for iscsi_tcp
  [SCSI] iscsi: bidi support at the generic libiscsi level
  [SCSI] iscsi: extended cdb support
  [SCSI] zfcp: Fix error handling for blocked unit for send FCP command
  [SCSI] zfcp: Remove zfcp_erp_wait from slave destory handler to fix deadlock
  [SCSI] zfcp: fix 31 bit compile warnings
  [SCSI] bsg: no need to set BSG_F_BLOCK bit in bsg_complete_all_commands
  [SCSI] bsg: remove minor in struct bsg_device
  [SCSI] bsg: use better helper list functions
  [SCSI] bsg: replace kobject_get with blk_get_queue
  [SCSI] bsg: takes a ref to struct device in fops->open
  [SCSI] qla1280: remove version check
  [SCSI] libsas: fix endianness bug in sas_ata
  [SCSI] zfcp: fix compiler warning caused by poking inside new semaphore (linux-next)
  [SCSI] aacraid: Do not describe check_reset parameter with its value
  [SCSI] aacraid: Fix down_interruptible() to check the return value
  [SCSI] sun3_scsi_vme: add MODULE_LICENSE
  [SCSI] st: rename flush_write_buffer()
  [SCSI] tgt: use KMEM_CACHE macro
  [SCSI] initio: fix big endian problems for auto request sense
  ...
2008-04-18 11:25:31 -07:00
James Bottomley 855d854a33 libata: fix boot panic with SATAPI devices on non-SFF HBAs
The kernel now panics reliably on boot if you have a SATAPI device
connected.

The problem was introduced by the libata merge trying to pull out all
the SFF code into a separate module.  Unfortunately, if you're a satapi
device you usually need to call atapi_request_sense, which has a bare
invocation of a SFF callback which is NULL on non-SFF HBAs.  Fix this by
making the call conditional.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-18 11:20:42 -07:00
Shaohua Li 48feb3c419 ata-acpi: don't call _GTF for disabled drive
I got below log after a S3 resume in a ASUS A6VC laptop. The system has
only one IDE drive. It appears there is no reason calling _GTF for
disabled drive.

ACPI Error (dsopcode-0483): Attempt to CreateField of length zero [20070126]
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.IDE0.RATA] (Node df822a7c), AE_AML_OPERAND_VALUE
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.IDE0.CHN1.DRV0._GTF] (Node df822bd0), AE_AML_OPERAND_VALUE
ata2.00: _GTF evaluation failed (AE 0x3006)
ACPI Error (dsopcode-0483): Attempt to CreateField of length zero [20070126]
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.IDE0.RATA] (Node df822a7c), AE_AML_OPERAND_VALUE
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.IDE0.CHN1.DRV1._GTF] (Node df822b94), AE_AML_OPERAND_VALUE
ata2.01: _GTF evaluation failed (AE 0x3006)

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:56:29 -04:00
Mark Lord 094e50b2f7 sata_mv add temporary 3 second init delay for SiliconImage PMs
sata_mv does not yet fully support hotplug (coming soon, though).
This means that the driver may not find a Silicon Image port-multiplier
when first loaded, because those devices take in exceess of 3 seconds
to sync up the SATA PHY (most devices do this in mere microseconds).

So, as a short-term interim measure, here we insert a 3-second pause
on initial driver load, once per controller board (not once per port!),
to allow the Silicon Image port-multipliers to be detected later.

This will be removed again (soon!) once hotplug is fully implemented/working.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:56:25 -04:00
Mark Lord 8a74f1a468 sata_mv remove redundant edma init code
Remove unnecessary edma init code from port_start.
This sequence gets done later on the first I/O to the port.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:56:21 -04:00
Mark Lord e49856d82a sata_mv add basic port multiplier support
Add basic port-multiplier support to sata_mv.
This works in Command-based-switching mode for Gen-II chipsets,
and in FIS-based-switching mode for Gen-IIe chipsets.

Error handling remains at the primary port level for now
(works okay, but not great).  This will get fixed in a subsequent
patch series for IRQ/EH handling fixes.  There are also some
known NCQ/PMP errata to be dealt with in the near future,
once we have this basic PMP support in place.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:56:19 -04:00
Mark Lord 02c1f32f1c sata_mv fix SOC flags, enable NCQ on SOC
The System-On-Chip (SOC) core supports all of the same
features as the other recent Marvell chips,
including NCQ and IRQ coalescing.

Fix the chip_soc flags to enable these capabilities
(note that the driver currently does nothing special
for IRQ coalescing, though).

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:56:16 -04:00
Mark Lord 40f0bc2d77 sata_mv disable hotplug for now
Disable hot plug/unplug detection in sata_mv for now.
It is currently broken, and also interferes with PMP support.

This will get fixed in a subsequent patch series.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:56:12 -04:00
Mark Lord 17c5aab5b3 sata_mv cosmetics
More cosmetic cleanups to unclutter the changes needed for PMP support.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:56:08 -04:00
Mark Lord 0d8be5cbff sata_mv hardreset rework
Rework and simplify sata_mv's hardreset code to take advantage of
libata improvements since it was first coded.

Also, get rid of the now unnecessary prereset, postreset, and phy_reset
functions.

This patch also paves the way for subsequent pmp support patches,
which will follow once this one passes muster.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:56:05 -04:00
Jeff Garzik f3360ebffa [libata] improve Kconfig help text for new PMP, SFF options 2008-04-17 15:55:24 -04:00
Tejun Heo 4f7faa3f2b libata: make EH fail gracefully if no reset method is available
When no reset method is available, libata currently oopses.  Although
the condition can't happen unless there's a bug in a low level driver,
oopsing isn't the best way to report the error condition.  Complain,
dump stack and fail reset instead.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:44:26 -04:00
Alan Cox b93fda1235 libata: Be a bit more slack about early devices
We have a certain number of 'ATA' emulations often on CF or other flash
devices that are at best "loosely based" on the CF 1.1 standard. These
devices report themselves as disk but don't support the ATA minimal
command set only the CF 1.1 set.

Relax the PIO checking for devices reporting ATA rev 0, or no iordy
support, or CFA. Rework the code a bit as it was already messy and this
made it quite ugly.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:44:25 -04:00
Alan Cox f792068e43 libata: cable logic
The cable detect isolation patch inadvertently removed 40 wire short
cable handling. Put it back

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:44:25 -04:00
Tejun Heo 45db2f6c95 libata: move link onlineness check out of softreset methods
Currently, SATA softresets should do link onlineness check before
actually performing SRST protocol but it doesn't really belong to
softreset.

This patch moves onlineness check in softreset to ata_eh_reset() and
ata_eh_followup_srst_needed() to clean up code and help future sata_mv
changes which need clear separation between SCR and TF accesses.

sata_fsl is peculiar in that its softreset really isn't softreset but
combination of hardreset and softreset.  This patch adds dummy private
->prereset to keep the current behavior but the driver really should
implement separate hard and soft resets and return -EAGAIN from
hardreset if it should be follwed by softreset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:44:25 -04:00
Tejun Heo 2a0c15ca39 libata: kill dead code paths in reset path
Some code paths which had been made obsolete by recent reset
simplification were still around.  Kill them.

* ata_eh_reset() checked for ATA_DEV_UNKNOWN to determine
  classification failure.  This is no longer applicable.

* ata_do_reset() should convert ATA_DEV_UNKNOWN to ATA_DEV_NONE
  regardless of reset result (e.g. -EAGAIN).

* LLDs don't need to convert ATA_DEV_UNKNOWN to ATA_DEV_NONE.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17 15:44:25 -04:00
Stephen Rothwell e50e3ce5e7 pata_scc: fix build breakage
drivers/ata/pata_scc.c: In function 'scc_bus_softreset':
drivers/ata/pata_scc.c:594: error: 'deadlien' undeclared (first use in this function)
drivers/ata/pata_scc.c:594: error: (Each undeclared identifier is reported only once
drivers/ata/pata_scc.c:594: error: for each function it appears in.)

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-04-17 15:44:25 -04:00
Tejun Heo 88fcd56275 libata: make PMP support optional
Make PMP support optional by adding CONFIG_SATA_PMP and leaving out
libata-pmp.c if it isn't set.  PMP helpers return constant values if
PMP support is not enabled and PMP declarations alias non-PMP
counterparts.  This makes the compiler to leave out PMP related part
out and LLDs to use non-PMP counterparts automatically.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17 15:44:25 -04:00
Tejun Heo 071f44b1d2 libata: implement PMP helpers
Implement helpers to test whether PMP is supported, attached and
determine pmp number to use when issuing SRST to a link.  While at it,
move ata_is_host_link() so that it's together with the two new PMP
helpers.

This change simplifies LLDs and helps making PMP support optional.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17 15:44:25 -04:00
Tejun Heo 48515f6c00 libata: separate PMP support code from core code
Most of PMP support code is already in libata-pmp.c.  All that are in
libata-core.c are sata_pmp_port_ops and EXPORTs.  Move them to
libata-pmp.c.  Also, collect PMP related prototypes and declarations
in header files and move them right above of SFF stuff.

This change is to make PMP support optional.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17 15:44:25 -04:00
Tejun Heo 127102aea2 libata: make SFF support optional
Now that SFF support is completely separated out from the core layer,
it can be made optional.  Add CONFIG_ATA_SFF and let SFF drivers
depend on it.  If CONFIG_ATA_SFF isn't set, all codes in libata-sff.c
and data structures for SFF support are disabled.  This saves good
number of bytes for small systems.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17 15:44:24 -04:00
Tejun Heo 350756f6da libata: don't use ap->ioaddr in non-SFF drivers
ap->ioaddr is to carry addresses for TF and BMDMA registers of a SFF
controller, don't abuse it in non-SFF controllers.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17 15:44:24 -04:00
Tejun Heo 182d7bbac3 libata: clean up dummy port_ops
Now that SFF assumptions are removed from core layer, dummy port_ops
can be slimmed down.  Chop it down.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17 15:44:24 -04:00