Commit Graph

143 Commits

Author SHA1 Message Date
Tejun Heo dde44589bf [PATCH] libata: implement ATA_FLAG_IN_EH port flag
ATA_FLAG_IN_EH flag is set on entry to EH and cleared on completion.
This patch just sets and clears the flag.  Following patches will
build normal qc execution / EH synchronization aroung this flag.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-02-09 01:18:37 -05:00
Jeff Garzik 18ee361004 Merge branch 'master' 2006-02-02 01:12:54 -05:00
Jens Axboe 48bdc8ec4a [LIBATA] Blacklist certain Maxtor firmware revisions for FUA support
It looks like they are either discarding or corrupting data when the FUA
command is used, bad.

Signed-off-by: Jens Axboe <axboe@suse.de>
2006-01-30 16:09:35 +01: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 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 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
Jeff Garzik 0825788ff2 Merge branch 'upstream' 2006-01-17 10:26:28 -05: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
Jeff Garzik 02f693c711 Merge branch 'upstream' 2006-01-03 10:59:55 -05:00
Jeff Garzik a18ceba7b4 Merge branch 'master' 2006-01-03 10:58:53 -05:00
Tony Battersby fd71da468d [PATCH] fix libata inquiry VPD for ATAPI devices
The following patch prevents libata from incorrectly modifying inquiry
VPD pages and command support data from ATAPI devices.  I have tested
the patch with a SATA ATAPI tape drive on an AHCI controller.

Patch is against kernel 2.4.32 with 2.4.32-libata1.patch applied.

Anthony J. Battersby
Cybernetics

Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-24 10:02:24 -05:00
Jeff Garzik e7fb585940 Merge branch 'upstream' 2005-12-13 22:22:41 -05:00
Jeff Garzik e508a391a0 Merge branch 'upstream-fixes' 2005-12-13 02:30:04 -05:00
Jeff Garzik 50630195bb [libata] mark certain hardware (or drivers) with a no-atapi flag
Some hardware does not support the PACKET command at all.
Other hardware supports ATAPI, but the driver does something nasty such
as calling BUG() when an ATAPI command is issued.

For these such cases, we mark them with a new flag, ATA_FLAG_NO_ATAPI.

Initial version contributed by Ben Collins.
2005-12-13 02:29:45 -05:00
Jeff Garzik 80c7af4074 Merge branch 'upstream' 2005-12-13 01:46:20 -05:00
Albert Lee a22e2eb071 [PATCH] libata: move err_mask to ata_queued_cmd
- remove err_mask from the parameter list of the complete functions
  - move err_mask to ata_queued_cmd
  - initialize qc->err_mask when needed
  - for each function call to ata_qc_complete(), replace the err_mask parameter with qc->err_mask.

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

===============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-06 04:49:22 -05:00
Jeff Garzik 451ec6ab31 Merge branch 'master' 2005-12-06 04:14:13 -05:00
Jeff Garzik 4ef679e6ca Merge branch 'upstream-fixes' 2005-12-03 20:34:14 -05:00
Tejun Heo 9a40525788 [PATCH] libata: fix ata_scsi_pass_thru error handling
This patch makes ata_scsi_pass_thru() properly set result code and
sense data on translation failures.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-03 20:31:16 -05:00
Arjan van de Ven 98ac62defe [PATCH] mark several libata datastructures const
Hi,

the patch below marks several libata (and libata-driver) structures
const so that they end up in the .rodata segment and don't false-share
cachelines with things that get dirtied often.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-12-01 02:29:35 -05:00
Jeff Garzik 85a07029aa Merge branch 'upstream' 2005-11-18 11:42:40 -05:00
Jeff Garzik c6e6e666cb [libata] REQUEST SENSE handling fixes
- Move ATAPI check-condition handling out of the timeout handler
- Use multi-qc-issue feature to issue REQUEST SENSE ATAPI PACKET
  command upon receiving an ATAPI check-condition.

This cleans things up a lot, and eliminates a nasty recursion bug.
2005-11-14 14:50:05 -05:00
Mark Lord dcc2d1e7f0 [libata passthru] address slave devices correctly 2005-11-13 16:22:06 -05:00
Jeff Garzik 0da36b3467 Merge branch 'master' 2005-11-11 23:38:52 -05:00
Mike Christie 85837ebdd7 [PATCH] kill libata scsi_wait_req usage (make libata compile with scsi-misc changes)
scsi_wait_req does not exist any more in the SCSI layer.  This patch
makes it so libata can compile again.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-11 14:57:05 -08:00
Alan Cox f51750d5ea [PATCH] libata: Note a nasty ATA quirk
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-11-10 07:30:37 -05:00
Jeff Garzik 8006fdd6dc Merge branch 'upstream' 2005-11-09 01:37:34 -05:00
Randy Dunlap 8e8b77dd48 [PATCH] libata kernel-doc fixes
Fix all reported kernel-doc errors in libata.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-11-09 01:10:55 -05:00
Jeff Garzik 193515d51c [libata] eliminate use of drivers/scsi/scsi.h compatibility header/defines 2005-11-07 00:59:37 -05:00
Jeff Garzik 18ce920a6e Merge branch 'master' 2005-11-05 15:44:48 -05:00
Jeff Garzik c4811b151b Merge branch 'upstream' 2005-10-30 23:33:54 -05:00
Jeff Garzik ce1eeb95fc Merge branch 'upstream' 2005-10-30 23:32:03 -05:00
Jeff Garzik 005a5a06a6 [libata] locking rewrite (== fix)
A lot of power packed into a little patch.

This change eliminates the sharing between our controller-wide spinlock
and the SCSI core's Scsi_Host lock.  As the locking in libata was
already highly compartmentalized, always referencing our own lock, and
never scsi_host::host_lock.

As a side effect, this change eliminates a deadlock from calling
scsi_finish_command() while inside our spinlock.
2005-10-30 23:31:48 -05:00
Jeff Garzik 054ee8fd39 Merge branch 'upstream' 2005-10-30 04:50:22 -05:00
Jeff Garzik d2927cbe40 Merge branch 'upstream' 2005-10-30 04:46:16 -05:00
Jeff Garzik a7dac447bb [libata] change ata_qc_complete() to take error mask as second arg
The second argument to ata_qc_complete() was being used for two
purposes: communicate the ATA Status register to the completion
function, and indicate an error.  On legacy PCI IDE hardware, the latter
is often implicit in the former.  On more modern hardware, the driver
often completely emulated a Status register value, passing ATA_ERR as an
indication that something went wrong.

Now that previous code changes have eliminated the need to use drv_stat
arg to communicate the ATA Status register value, we can convert it to a
mask of possible error classes.

This will lead to more flexible error handling in the future.
2005-10-30 04:44:42 -05:00
Jeff Garzik 9359ede748 Merge branch 'upstream' 2005-10-30 01:59:10 -05:00
Jeff Garzik 5615ca7906 Merge branch 'upstream' 2005-10-28 21:32:01 -04:00
Douglas Gilbert 00ac37f508 [libata scsi] MODE SELECT, strengthen mode sense
- move default mode pages to the front of libata-scsi.c
    so various functions can access them
  - partial annotation of these pages, point out divergence
    from sat-r06
  - replace various mode page magic numbers with defines
  - strengthen MODE SENSE command decoding: handle DBD
    bit in cdb, yield block descriptor (per sat-r06) and
    handle mode sub pages

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-28 15:58:28 -04:00
Jeff Garzik 96b88fb850 Merge branch 'master' 2005-10-28 12:31:34 -04:00
Jeff Garzik 35ebbae283 Merge branch 'master' 2005-10-28 12:30:29 -04:00
Jeff Garzik 7a9f8f93d2 Merge branch 'master' 2005-10-28 12:29:23 -04:00
Jeff Garzik 057ace5e79 libata: const-ification bombing run
Enforce access rules where appropriate.

If the compiler is smart enough, this may buy us an optimization or two
as a side effect.
2005-10-22 14:27:05 -04:00
Jeff Garzik b194b4250c Merge branch 'upstream' 2005-10-18 21:52:42 -04:00
Jeff Garzik 77501f3cb6 Merge branch 'upstream' 2005-10-18 18:30:58 -04:00
Albert Lee c6a33e2464 [PATCH] libata CHS: LBA28/LBA48 optimization (revise #6)
- add lba_28_ok() and lba_48_ok() to ata.h.
     - check ending block number instead of staring block number.
     - use lba_28_ok() for CHS range check
     - LBA28/LBA48 optimization

Suggested by Mark Lord and Alan Cox.

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

=====
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-18 17:18:16 -04:00
Albert Lee 8cbd6df1f0 [PATCH] libata CHS: calculate read/write commands and protocol on the fly (revise #6)
- merge ata_prot_to_cmd() and ata_dev_set_protocol() as
       ata_rwcmd_protocol()
     - pave road for read/write multiple support
     - remove usage of pre-cached command and protocol values and call
       ata_rwcmd_protocol() instead

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

==============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-18 17:16:13 -04:00
Albert Lee 07506697d1 [PATCH] libata CHS: move the initialization of taskfile LBA flags (revise #6)
move the initialization of taskfile LBA flags
     "ATA_TFLAG_LBA" and "ATA_TFLAG_LBA48 flags"
   to the SCSI translation functions

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

=============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-18 17:16:13 -04:00
Jeff Garzik c4052da6f0 Merge branch 'upstream' 2005-10-09 11:16:14 -04:00
Jeff Garzik 422fa08e53 [libata passthru] update ATAPI completion for new error handling 2005-10-09 10:49:34 -04:00
Jeff Garzik ffe75ef650 Merge branch 'upstream' 2005-10-09 10:40:44 -04:00
Douglas Gilbert ae00651020 [libata scsi] improve scsi error handling with ata_scsi_set_sense()
- change "xlat" and "fill" actors in libata-scsi so
    they are responsible for SCSI status and sense data
    when they return 1. This allows GOOD status or a
    specialized error to be set.
  - yield an error for mode sense requests for saved
    values [sat-r06]
  - remove static inlines for ata_bad_scsiop() and
    ata_bad_cdb() which are no longer used

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-09 09:09:35 -04:00
Douglas Gilbert 845c5834d0 [libata scsi] add ata_scsi_set_sense helper
- add extern ata_scsi_set_sense() to build SCSI
    fixed sense data and corresponding SCSI status

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-09 08:55:41 -04:00
Jeff Garzik 0e5dec478c [libata passthru] add (DRIVER_SENSE << 24) to all check-conditions 2005-10-06 09:40:20 -04:00
Jeff Garzik e12669e774 libata: minor cleanups
A few code shuffles, to make merging future code easier.

Add (DRIVER_SENSE << 24) to certain result codes, as noted by Douglas
Gilbert.
2005-10-05 18:39:23 -04:00
Jeff Garzik a939c96315 libata: move atapi_request_sense() to libata-scsi module
No content changes, just moving code around.
2005-10-05 17:09:16 -04:00
Jeff Garzik a15dbeb477 libata: ATAPI command completion tweaks and notes
1) note urgent bug, that completes command twice

2) only fix up INQUIRY data if the SCSI version is zero (typically
indicates ATAPI MMC-ish device)

3) if there is a problem on the ATA bus, don't bother with REQUEST
SENSE, just directly handle the error based on Status/Error registers.
2005-10-05 15:02:14 -04:00
Jeff Garzik cedc9a478d libata: fix ATAPI DMA alignment issues
ATAPI needs to be padded to next 4 byte boundary, if misaligned.

Original work by me, many fixes from Tejun Heo.
2005-10-05 07:13:30 -04:00
Jeff Garzik 643736a58d Merge branch 'scsi-scan' 2005-10-04 14:24:04 -04:00
Jeff Raubitschek 54dac83c42 [libata passthru] fix leak on error 2005-10-04 10:21:19 -04:00
Albert Lee 9d5b130213 [libata scsi] add CHS support to ata_scsi_start_stop_xlat() 2005-10-04 08:48:17 -04:00
Albert Lee 3aef52311b [libata scsi] tidy up SCSI lba and xfer len calculations
move the redundant SCSI lba and transfer length calculation code from
ata_scsi_verify_xlat() and ata_scsi_rw_xlat() to common functions.
2005-10-04 08:47:43 -04:00
Albert Lee c187c4b58a libata: minor whitespace, comment, debug message updates 2005-10-04 08:46:51 -04:00
Jeff Garzik 3f19ee8cb3 [libata] improve device scan even more
Since our max_lun is unconditionally set to 1, we might as well
hardcode a LUN 0 probe, rather than a wildcard LUN scan.

The ide-scsi driver sets max_lun to a value greater than under
certain conditions:

        if ((drive->id->last_lun & 0x7) != 7)
                host->max_lun = (drive->id->last_lun & 0x7) + 1;
        else
                host->max_lun = 1;

last_lun is Word 126 of IDENTIFY PACKET DEVICE, marked as obsolete
and undocumented in non-ancient specs.  We'll leave it out for now.
Should the need arise to support multi-LUN ATAPI devices, we'll
probably want to add the above code.

Finally, there have been reports of REPORT LUNS commands locking up
ATAPI drives.  Eliminating the wildcard LUN scan could help reduce
the trouble from problematic drives.
2005-10-03 21:36:41 -04:00
Jeff Garzik 644dd0cc49 [libata] improve device scan
Replace SCSI's legacy "bang at the door" method of probing with one
directly controlled by the underlying ATA transport layer.

We now only call scsi_scan_target() for devices we find, rather than
probing every possible channel/id within a certain range.
2005-10-03 15:55:19 -04:00
Jeff Garzik 142e27fc8a Merge /spare/repo/linux-2.6/ 2005-09-08 05:41:28 -04:00
Jeff Garzik c324b44c34 Merge /spare/repo/linux-2.6/ 2005-09-08 05:39:55 -04:00
Jeff Garzik 6f10623304 [libata] fix ATAPI-enable typo
Dumb typo spotted by Mark Lord.
2005-08-30 21:52:18 -04:00
Jeff Garzik 1623c81eec [libata] allow ATAPI to be enabled with new atapi_enabled module option
ATAPI is getting close to being ready.  To increase exposure, we enable
the code in the upstream kernel, but default it to off (present
behavior).  Users must pass atapi_enabled=1 as a module option (if
module) or on the kernel command line (if built in) to turn on
discovery of their ATAPI devices.
2005-08-30 03:37:42 -04:00
Jeff Garzik 76b2bf9b4d Merge libata branch 'chs-support' to latest upstream kernel. 2005-08-29 19:24:43 -04:00
Jeff Garzik da61396d24 Merge upstream kernel into libata 'passthru' branch 2005-08-29 19:01:43 -04:00
Jeff Garzik 2fca877b68 /spare/repo/libata-dev branch 'v2.6.13' 2005-08-29 16:12:36 -04:00
Jeff Garzik 70d374ea99 Merge /spare/repo/linux-2.6/ 2005-08-29 15:59:42 -04:00
Jeff Garzik af36d7f0df [libata] license change, other bits
- changes license of all code from OSL+GPL to plain ole GPL
  - except for NVIDIA, who hasn't yet responded about sata_nv
  - copyright holders were already contacted privately

- adds info in each driver about where hardware/protocol docs may be
  obtained

- where I have made major contributions, updated copyright dates
2005-08-28 20:18:39 -04:00
Jeff Garzik 135932651f [libata scsi] fix read/write translation edge cases
Fix bugs for unlikely edge cases noticed by Douglas Gilbert:

- When READ(6)/WRITE(6) sector count == 0, treat it as 256 sectors

- For other READ(x)/WRITE(x), when sector count == 0, error.
  We don't support successfully completing zero-length transfers at
  this time.
2005-08-27 04:20:12 -04:00
Douglas Gilbert 972dcafb6d [libata scsi] add START STOP UNIT translation 2005-08-11 03:35:53 -04:00
Jeff Garzik 2f058256cb Merge /spare/repo/linux-2.6/ 2005-08-10 13:46:28 -04:00
Tejun Heo 42517438f9 libata: fix EH-related lockup by properly cleaning EH command list
Yet another hack due to the fact that libata is the only user of SCSI's
->eh_strategy_handler() hook.
2005-08-10 13:38:27 -04:00
Philip Pokorny 0c144d0d03 [PATCH] libata fix read capacity handling for more than 2TB
This is a multi-part message in MIME format.
2005-06-27 00:47:48 -04:00
Jeff Garzik 0274aa2506 libata: Update 'passthru' branch for latest libata 2005-06-22 13:50:56 -04:00
Jeff Garzik 80bd6d7f5e Merge /spare/repo/linux-2.6/ 2005-06-22 13:10:49 -04:00
Jeff Garzik ff40c6d3d1 Merge upstream kernel changes into 'C/H/S support' branch of libata. 2005-06-22 13:07:28 -04:00
Jeff Garzik 0cba632b73 libata: doc updates 2005-05-30 19:49:12 -04:00
949d33e70f Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git branch HEAD 2005-05-26 01:47:10 -04:00
John W. Linville f85bdb9ce9 [PATCH] libata: stop setting sdev->host->max_sectors for lba48 drives
Avoid changing sdev->host->max_sectors because it can prevent use of
non-lba48 drives on other ports of the same adapter.

Signed-off-by: Stuart Hayes <stuart_hayes@Dell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2005-05-15 18:01:22 -04:00
Jeff Garzik b095518ef5 [libata] ATA passthru (arbitrary ATA command execution)
Authors:
Brett Russ <russb@emc.com>
John W. Linville <linville@tuxdriver.com>
Andy Warner <andyw@pobox.com>
2005-05-12 15:45:22 -04:00
Albert Lee 8bf62ecee5 [libata] C/H/S support, for older devices 2005-05-12 15:29:42 -04:00
be7db055dd [PATCH] remove old scsi data direction macros
these have been wrappers for the generic dma direction bits since 2.5.x.
This patch converts the few remaining drivers and removes the macros.

Arjan noticed there's some hunk in here that shouldn't.  Updated patch
below:

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-04-18 13:49:58 -05:00
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00