Commit Graph

1544 Commits

Author SHA1 Message Date
Tejun Heo 35e86b53b1 [PATCH] libata: dec scmd->retries for qcs with zero err_mask
qcs might get retried because of unrelated failure.  e.g. NCQ command
failure causes the whole command set to be aborted.  Decrement
scmd->retries for such retrials to avoid unnecessarily failing
commands.  Note that scmd->retries will be incremented the first time.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:20 -04:00
Tejun Heo d69cf37d53 [PATCH] libata: add @cdb to ata_exec_internal()
Add @cdb to ata_exec_internal().  It will be used by new EH.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:20 -04:00
Tejun Heo 74e6c8c394 [PATCH] libata: don't read TF directly from sense generation functions
TF register might not be directly accessible depending on errors.
e.g. TF of failed NCQ command is in log page 10h.  Make reading TF
responsibility of error handlers.  For the current EH, simply push TF
reading into qc completion functions as they are practically part of
EH.  New EH will fill qc->tf with status registers before complting
qcs.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:20 -04:00
Tejun Heo 058e55e120 [PATCH] libata: always generate sense if qc->err_mask is non-zero
Current sense generation code does not generate sense error if status
register value doesn't indicate error condition.  However, LLDD's may
indicate errors which 't show up in status register.  Completing such
qc's without generating sense results in successful completion of
failed commands.

Invoke ata_to_sense_error() regardless of status register if
qc->err_mask is not zero such that ata_to_sense_error() generates
default sense error.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:20 -04:00
Tejun Heo c91af2c87e [PATCH] libata: pass qc around intead of ap during PIO
The current code passes pointer to ap around and repeatedly performs
ata_qc_from_tag() to access the ongoing qc.  This is unnatural and
makes EH synchronization cumbersome.  Make PIO codes deal with qc
instead of ap.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:20 -04:00
Tejun Heo 2719736779 [PATCH] libata: add ATA_QCFLAG_IO
Add a new qc flag ATA_QCFLAG_IO.  This flag gets set for normal IO
commands originating from SCSI midlayer.  This information will be
used by EH to determine transfer speed reconfiguration.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:20 -04:00
Tejun Heo e8384607d4 [PATCH] libata: clear ATA_DFLAG_PIO before setting it
ata_dev_set_mode() is now responsible for managing ATA_DFLAG_PIO.
Clear it before setting it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:20 -04:00
Tejun Heo ea1dd4e130 [PATCH] libata: clear only affected flags during ata_dev_configure()
ata_dev_configure() should not clear dynamic device flags determined
elsewhere.  Lower eight bits are reserved for feature flags, define
ATA_DFLAG_CFG_MASK and clear only those bits before configuring
device.  Without this patch, ATA_DFLAG_PIO gets turned off during
revalidation making PIO mode unuseable.

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

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

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:19 -04:00
Tejun Heo 5eb45c02a9 [PATCH] libata: ata_dev_revalidate() printk update
Make sure ata_dev_revalidate() complains on failures and kill
revalidation failure message printed from ata_dev_set_mode().

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:19 -04:00
Tejun Heo d63cb4a636 [PATCH] libata: report device number when PIO fails
Report device number on PIO failure.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:09:19 -04:00
Tejun Heo 565083e1f1 [PATCH] libata: consider disabled devices in ata_dev_xfermask()
ata_bus_probe() now marks failed devices properly and leaves
meaningful transfer mode masks.  This patch makes ata_dev_xfermask()
consider disable devices when determining PIO mode to avoid violating
device selection timing.

While at it, move port-wide resttriction out of device iteration loop
and try to make the function look a bit prettier.

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

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

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:02:57 -04:00
Tejun Heo cf176e1aa9 [PATCH] libata: implement ata_down_xfermask_limit()
Implement ata_down_xfermask_limit().  This function manipulates
@dev->pio/mwdma/udma_mask such that the next lower transfer mode is
selected.  This will be used to improve ata_bus_probe() failure
handling and later by EH.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:02:57 -04:00
Tejun Heo edbabd8679 [PATCH] libata: add 5s sleep between resets
Some devices react badly if resets are performed back-to-back.  Give
devices some time to breath and tell user that we're taking a nap.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:02:57 -04:00
Tejun Heo 90dac02c08 [PATCH] libata: use SATA speed down in ata_drive_probe_reset()
Make ata_drive_probe_reset() use SATA SPD configuration.  Hardreset
will be force if speed renegotiation is necessary.  Also, if a
hardreset fails, PHY speed is stepped down and hardreset is retried
until the lowest speed is reached.

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

This patch also normalizes some comments around affected code.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02 10:02:57 -04:00
Tejun Heo 852ee16a91 [PATCH] libata: preserve SATA SPD setting over hard resets
Don't overwrite SPD setting during hard reset.  This change has the
(intended) side effect of honoring the BIOS configuration.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 14:52:08 -05:00
Tejun Heo e82cbdb9a3 [PATCH] libata: don't disable devices from ata_set_mode()
When ata_set_mode() fails on a device, make ata_set_mode() return
error code and pointer to the device instead of disabling it directly.
This gives more control to higher level driving logic.

This patch does not change the end result (configured transfer mode)
although it may make libata repeat mode configuration to the peer of a
failing device.  Later ata_bus_probe() rewrite will make full use of
this change.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 14:46:09 -05:00
Tejun Heo e8e0619f68 [PATCH] libata: reorganize ata_set_mode()
Merge ata_host_set_pio() and ata_host_set_dma() into ata_set_mode()
and use function-level *dev to iterate over devices.  This eases
soon-to-follow ata_set_mode() interface change.

While at it, kill an unnecessary comment and normalize others.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:46 -05:00
Tejun Heo 4f65977df0 [PATCH] libata: make ata_set_mode() handle no-device case properly
Make ata_set_mode() return without doing anything if there is no
device on the port.  This is in preparation for ata_bus_probe()
changes.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:46 -05:00
Tejun Heo e1211e3fa7 [PATCH] libata: implement ata_dev_enabled and disabled()
This patch renames ata_dev_present() to ata_dev_enabled() and adds
ata_dev_disabled().  This is to discern the state where a device is
present but disabled from not-present state.  This disctinction is
necessary when configuring transfer mode because device selection
timing must not be violated even if a device fails to configure.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo 9974e7cc6c [PATCH] libata: convert do_probe_reset() to ata_do_reset()
Make do_probe_reset() generic by pushing classification check into
ata_drive_probe_reset() and rename it to ata_do_reset().  This will be
used by EH reset.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo 4c360c81a6 [PATCH] libata: separate out ata_spd_string()
Separate out ata_spd_string() from sata_print_link_status().  This
will be used by SATA spd configuration routines.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo 96072e699b [PATCH] libata: make ata_bus_probe() return negative errno on failure
ata_bus_probe() uses unsigned int rc to receive negative errno and
returns the converted unsigned int value.  Convert temporary variables
to int and make ata_bus_probe() return negative errno on failure.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Tejun Heo 5bbc53f4cf [PATCH] libata: fix ata_set_mode() return value
Make ata_set_mode() return correct error value when ata_dev_set_mode()
fails.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01 12:33:45 -05:00
Linus Torvalds d21c356b08 Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  [PATCH] libata: fix ata_xfer_tbl termination
  [PATCH] libata: make ata_qc_issue complete failed qcs
  [PATCH] libata: fix ata_qc_issue failure path
  [PATCH] ata_piix: fix ich6/m_map_db
  [libata] ahci: add ATI SB600 PCI IDs
2006-03-31 12:28:01 -08:00
OGAWA Hirofumi 9b41046cd0 [PATCH] Don't pass boot parameters to argv_init[]
The boot cmdline is parsed in parse_early_param() and
parse_args(,unknown_bootoption).

And __setup() is used in obsolete_checksetup().

	start_kernel()
		-> parse_args()
			-> unknown_bootoption()
				-> obsolete_checksetup()

If __setup()'s callback (->setup_func()) returns 1 in
obsolete_checksetup(), obsolete_checksetup() thinks a parameter was
handled.

If ->setup_func() returns 0, obsolete_checksetup() tries other
->setup_func().  If all ->setup_func() that matched a parameter returns 0,
a parameter is seted to argv_init[].

Then, when runing /sbin/init or init=app, argv_init[] is passed to the app.
If the app doesn't ignore those arguments, it will warning and exit.

This patch fixes a wrong usage of it, however fixes obvious one only.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:53 -08:00
Tejun Heo be9a50c852 [PATCH] libata: fix ata_xfer_tbl termination
ata_xfer_tbl is terminated by entry with -1 as ->shift.  However,
->shift was unsigned int making the termination condition bogus.  This
patch converts ->shift and ->bits to int.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-31 10:14:42 -05:00
Tejun Heo 8e0e694a3a [PATCH] libata: make ata_qc_issue complete failed qcs
There is no reason for the issuer to diddle with a failed qc as the
issuer has complete control over when a qc gets freed (usually in
->complete_fn).  Make ata_qc_issue() responsible for completing qcs
which failed to issue.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-31 10:14:42 -05:00
Tejun Heo e4a70e76ad [PATCH] libata: fix ata_qc_issue failure path
On sg_err failure path, ata_qc_issue() doesn't mark the qc active
before returning.  This triggers WARN_ON() in __ata_qc_complete() when
the qc gets completed.  This patch moves ap->active_tag and
QCFLAG_ACTIVE setting to the top of the function.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-31 10:14:42 -05:00
Tejun Heo 79ea24e72e [PATCH] ata_piix: fix ich6/m_map_db
MAP tables of ich6 and ich6m are wrong.  Depending on port usage,
ata_piix may fail to initialize attached devices.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-31 10:14:41 -05:00
Jeff Garzik ea19006f58 Merge branch 'master' 2006-03-31 10:03:19 -05:00
Linus Torvalds ce362c0092 Merge git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6: (24 commits)
  [PARISC] Fix double free when removing HIL drivers
  [PARISC] Add atomic_sub_and_test
  [PARISC] Enabled some NLS modules in a500, b180 and c3000 defconfigs
  [PARISC] Kill duplicated EXPORT_SYMBOL warnings
  [PARISC] Move ioremap EXPORT_SYMBOL from parisc_ksyms.c
  [PARISC] Make local_t use atomic_long_t
  [PARISC] Update defconfigs
  [PARISC] Add PREEMPT support
  [PARISC] More useful readwrite lock helpers
  [PARISC] Convert HIL drivers to use input_allocate_device
  [PARISC] Fixup CONFIG_EISA a bit
  [PARISC] getsockopt should be ENTRY_COMP
  [PARISC] Remove obsolete CONFIG_DEBUG_IOREMAP
  [PARISC] Temporary FIXME for ioremapping EISA regions
  [PARISC] Enable ioremap functionality unconditionally
  [PARISC] Fix stifb with IOREMAP and a 64-bit kernel
  [PARISC] Add CONFIG_HPPA_IOREMAP to conditionally enable ioremap
  [PARISC] Add STRICT_MM_TYPECHECKS
  [PARISC] Fix IOREMAP with a 64-bit kernel
  [PARISC] Add parisc implementation of flush_kernel_dcache_page()
  ...
2006-03-30 15:04:13 -08:00
Jeff Garzik 8b316a3973 [libata] ahci: add ATI SB600 PCI IDs
From: Anatoli Antonovitch <antonovi@ati.com>

Signed-off-by: Felix Kuehling <fkuehlin@ati.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-30 17:07:32 -05:00
Helge Deller 5076c15862 [PARISC] I/O-Space must be ioremap_nocache()'d
Addresses in F-space must be accessed uncached on most parisc machines.

Signed-off-by: Helge Deller <deller@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
2006-03-30 17:48:42 +00:00
Jeff Garzik 55d8ca4f80 Merge branch 'mv-merge'
Conflicts:

	drivers/scsi/sata_mv.c
2006-03-29 19:43:31 -05:00
Mark Lord 63af2a5c59 [PATCH] sata_mv: three bug fixes
(1) A DMA transfer size of 0x10000 was not being written
as 0x0000 in the PRDs.  Fixed.

(1) The DEV_IRQ interrupt cause bit happens spuriously
during EDMA operation, and was not being ignored by the driver.
This led to various "drive busy" errors being reported,
with associated unpredictable behaviour.  Fixed.

(2) If a SATA or PCI interrupt was received with no outstanding
command, the interrupt handler still attempted to invoke
ata_qc_complete(), triggering assert()/BUG_ON() behaviour
elsewhere in libata.  Fixed.

The driver still has issues with confusion after error-recovery,
but should now  be reliable in the absence of drive errors.
I will be looking more into the error-handling bugs next.

Signed-Off-By: Mark Lord <mlord@pobox.com>

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:40:24 -05:00
Albert Lee 00b6f5e9e0 [PATCH] libata: ata_dev_init_params() fixes
ata_dev_init_params() fixes:
- Get the "heads" and "sectors" parameters from caller instead of implicitly from dev->id[].
- Return AC_ERR_INVALID instead of 0 if an invalid parameter is found

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:28 -05:00
Alan Cox 17efc5f723 [PATCH] libata: Fix interesting use of "extern" and also some bracketing
Signed-off-by: Alan Cox <alan@redhat.com>

Last of the set, just clean up some oddments. Assuming the whole set is
now ok then the remaining differences are the setup of PIO_0 at reset
and the ->data_xfer method.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:28 -05:00
Alan Cox 5444a6f405 [PATCH] libata: Simplex and other mode filtering logic
Add a field to the host_set called 'flags' (was host_set_flags changed
to suit Jeff)
Add a simplex_claimed field so we can remember who owns the DMA channel
Add a ->mode_filter() hook to allow drivers to filter modes
Add docs for mode_filter and set_mode
Filter according to simplex state
Filter cable in core

This provides the needed framework to support all the mode rules found
in the PATA world. The simplex filter deals with 'to spec' simplex DMA
systems found in older chips. The cable filter avoids duplicating the
same rules in each chip driver with PATA. Finally the mode filter is
neccessary because drive/chip combinations have errata that forbid
certain modes with some drives or types of ATA object.

Drive speed setup remains per channel for now and the filters now use
the framework Tejun put into place which cleans them up a lot from the
older libata-pata patches.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:28 -05:00
Alan Cox 692785e798 [PATCH] libata - ATA is both ATA and CFA
I think this is still needed with the new probe code (which btw seems to
be missing docs in upstream ?).

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:28 -05:00
Alan Cox e35a9e01f2 [PATCH] libata: Add ->set_mode hook for odd drivers
Some hardware doesn't want the usual mode setup logic running. This
allows the hardware driver to replace it for special cases in the least
invasive way possible.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:27 -05:00
Alan Cox 4e5ec5dba2 [PATCH] libata: BMDMA handling updates
This is the minimal patch set to enable the current code to be used with
a controller following SFF (ie any PATA and early SATA controllers)
safely without crashes if there is no BMDMA area or if BMDMA is not
assigned by the BIOS for some reason.

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

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

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 19:30:27 -05:00
Tejun Heo 05c8e0ac5c [PATCH] libata: kill trailing whitespace
Kill trailing whitespace.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29 17:19:13 -05:00
Jeff Garzik e02a4cabfc Merge branch 'master' 2006-03-29 17:18:49 -05:00
Paul Mackerras bac30d1a78 Merge ../linux-2.6 2006-03-29 13:24:50 +11:00
Alexey Dobriyan 7f927fcc2f [PATCH] Typo fixes
Fix a lot of typos.  Eyeballed by jmc@ in OpenBSD.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-28 09:16:08 -08:00
Matthias Gehre 910638ae7e [PATCH] Replace 0xff.. with correct DMA_xBIT_MASK
Replace all occurences of 0xff..  in calls to function pci_set_dma_mask()
and pci_set_consistant_dma_mask() with the corresponding DMA_xBIT_MASK from
linux/dma-mapping.h.

Signed-off-by: Matthias Gehre <M.Gehre@gmx.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-28 09:16:07 -08:00