Commit Graph

170 Commits

Author SHA1 Message Date
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
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
Albert Lee c14b8331ec [PATCH] libata: minor patch before moving err_mask
- add qc to ata_pio_poll()
  - reorder the initialization of qc in ata_pio_complete()

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
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 656563e32c [libata] Print out SATA speed, if link is up
Make the SATA phy probe messages a bit more informative.

Note this only applies to drivers that use __sata_phy_reset(),
which excludes some drivers.
2005-11-20 03:36:45 -05:00
Jeff Garzik 64f043d807 [libata] add timeout to commands for which we call wait_completion() 2005-11-17 10:50:01 -05:00
Albert Lee 75b1f2f865 [PATCH] libata: honor the transfer cycle time speficied by the EIDE device
The following code segment is not functional because the transfer cycle time speficied by
  the EIDE device is later overwritten by ata_timing_quantize():

	/*
	 * If the drive is an EIDE drive, it can tell us it needs extended
	 * PIO/MW_DMA cycle timing.
	 */
	if (adev->id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
		memset(&p, 0, sizeof(p));
		(snip)
		ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B);
               <== uninitialized "t" is used here
	}

	/*
	 * Convert the timing to bus clock counts.
	 */
	ata_timing_quantize(s, t, T, UT);  <== t is overwritten by quantized s

  The patch has been submitted for ide-timing.h before:
  http://marc.theaimsgroup.com/?l=linux-ide&m=110820013425454&w=2
  Resubmitted for libata.

Changes:
  - Minor fix to honor the following transfer cycle time speficied by the device
    - id[65]: Minimum Multiword DMA transfer cycle time per word
    - id[67]: Minimum PIO transfer cycle time without flow control
    - id[68]: Minimum PIO transfer cycle time with IORDY

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

=======
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-11-16 07:59:22 -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
Jeff Garzik 2c13b7cee0 [libata] minor fixes, new helpers
- in ata_dev_identify(), don't assume that all devices are either
  ATA or ATAPI.  In the future, this code will see port multipliers
  and other devices.
- make a debugging printk less verbose
- add new helper ata_qc_reinit()
- add new helper BPRINTK() and port flag ATA_FLAG_DEBUGMSG, for
  fine-grained debugging use.
2005-11-14 14:14:16 -05:00
Jeff Garzik e1410f2d95 [libata] fix bugs in ATAPI padding DMA mapping code
The ATAPI pad-to-next-32bit-boundary code modifies the scatterlist's
length variable, sometimes to zero.  x86-64 platform would oops if a
zero-length scatterlist entry was asked to be mapped.  Work around this
by ensuring that we never DMA-map a zero length buffer or SG entry.
2005-11-14 14:06:26 -05:00
Mark Lord e12a1be6e8 [PATCH] libata: fix comments on ata_tf_from_fis()
Fix description on comments for ata_tf_from_fis().

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-11-13 16:19:26 -05:00
Alan Cox e99f8b5efe [PATCH] libata: propogate host private data from probe function
This will let me chop the code size of several drivers right down. In
many cases the actual private data is very useful and constant for a
given host controller so being able to just pass it at probe time would
be very useful indeed (eg with the via driver would could pass the udma
clocking and reduce the code size, or with the AMD one the UDMA
multiplier and the offset)

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-11-11 08:19:55 -05:00
Albert Lee 7c3983357f [PATCH] libata: if condition fix for ata_dev_identify()
- if condition fix for ata_dev_identify()
  - ata_pio_poll() minor cleanup.

Changes:
   - Use (dev->class == ATA_DEV_ATA) for ata_dev_identify()
     since "qc->tf.command" has been overwritten by the device status
   - Use HSM_ST_TMOUT directly in ata_pio_poll()

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

============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-11-09 01:23:22 -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
Tejun Heo 537a95d935 [libata] restore sg on DMA mapping failure 2005-11-05 14:29:01 -05:00
Jeff Garzik 6037d6bbdf [libata] ATAPI pad allocation fixes/cleanup
Use ata_pad_{alloc,free} in two drivers, to factor out common code.

Add ata_pad_{alloc,free} to two other drivers, which needed the padding
but had not been updated.
2005-11-04 22:08:00 -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 e533825447 [libata] ata_tf_to_host cleanups
Integrate ata_exec() and ata_tf_to_host() into their only caller,
ata_bus_edd().

Rename ata_tf_to_host_nolock() to ata_tf_to_host().

This makes locking a bit easier to review, and may help pave the way for
future changes.
2005-10-30 21:37:17 -05:00
Jeff Garzik 95dbf5c4be Merge branch 'master' 2005-10-30 20:24:34 -05:00
Jeff Garzik 0f0d519269 [libata] fix legacy IDE probing
ata_pci_init_one() receives an array of struct ata_port_info.  Recent
updates to the code had always obtained port information from
array element 0, rather than array element N.

Change to avoid hardcoding port_info[0], thereby restoring proper
hardware information to secondary legacy ports.
2005-10-30 06:41:29 -05:00
Jeff Garzik 054ee8fd39 Merge branch 'upstream' 2005-10-30 04:50:22 -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 f0612bbc41 Merge branch 'upstream' 2005-10-30 01:58:18 -05:00
Jeff Garzik 81cfb8864c Merge branch 'master' 2005-10-30 01:56:31 -05:00
Jeff Garzik 0169e284f6 [libata] remove ata_chk_err(), ->check_err() hook.
We now depend on ->tf_read() to provide us with the contents
of the Error shadow register.
2005-10-29 21:25:10 -04:00
David Hardeman 378f058cc4 [PATCH] Use sg_set_buf/sg_init_one where applicable
This patch uses sg_set_buf/sg_init_one in some places where it was
duplicated.

Signed-off-by: David Hardeman <david@2gen.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Greg KH <greg@kroah.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2005-10-30 11:19:43 +11:00
Jeff Garzik b0c4e148bd Merge branch 'master' 2005-10-29 17:49:12 -04:00
Randy Dunlap 57f3bda88a [PATCH] libata-core cleanups (updated)
libata-core cleanups:
- use kzalloc() instead of kmalloc() + memset();
- use one exit path in ata_device_add();

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-29 14:10:06 -04:00
Jeff Garzik ac19bff25b [libata] ensure ->tf_read() hook reads Status and Error registers
We want ->tf_read() to get a complete snapshot of all taskfile
registers, without requiring the callers to manually call
ata_chk_status() and ata_chk_err() themselves.

This also fixes a minor bug in sata_vsc where the lower bits of the
feature register were incorrectly placed in the HOB (high order bits)
portion of struct ata_taskfile.
2005-10-29 13:58:21 -04:00
Jeff Garzik 7a9f8f93d2 Merge branch 'master' 2005-10-28 12:29:23 -04:00
Alan Cox 91190758d4 [libata] ata_timing fix 2005-10-26 12:17:46 -04:00
Randy Dunlap 6f0ef4fa57 [PATCH] libata kernel-doc fixes
Correct some function names in kernel-doc.
Add some kernel-doc descriptions.
Fix some typos.
Remove a few blank lines.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-25 01:44:30 -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
Alan Cox 452503f993 Add ide-timing functionality to libata.
This is needed for full AMD and VIA drivers and possibly more. Functions
to turn actual clocking and cycle timings into register values. Also to
merge shared timings to compute an optimal timing set.

Built from the drivers/ide version by Vojtech Pavlik

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-21 19:01:32 -04:00
Alan Cox 11e29e2151 libata: handle early device PIO modes correctly 2005-10-21 18:46:32 -04:00
Jeff Garzik b194b4250c Merge branch 'upstream' 2005-10-18 21:52:42 -04:00
Albert Lee 59a10b172f [PATCH] libata CHS: reread device identify info (revise #6)
problem:
      id[53-58] might be changed after initializing device CHS settings.

changes:
    - call ata_dev_reread_id() to reread the identify device info,
      after initializing device CHS settings.

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

============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-10-18 17:16:14 -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 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 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 67846b3017 libata: add ata_ratelimit(), use it in AHCI driver irq handler 2005-10-05 02:58:32 -04:00
Jeff Garzik 643736a58d Merge branch 'scsi-scan' 2005-10-04 14:24:04 -04:00
Alan Cox 47a8659380 libata: bitmask based pci init functions for one or two ports
This redoes the n_ports logic I proposed before as a bitmask.
ata_pci_init_native_mode is now used with a mask allowing for mixed mode
stuff later on. ata_pci_init_legacy_port is called with port number and
does one port now not two. Instead it is called twice by the ata init
logic which cleans both of them up.

There are stil limits in the original code left over

- IRQ/port mapping for legacy mode should be arch specific values
- You can have one legacy mode IDE adapter per PCI root bridge on some systems
- Doesn't handle mixed mode devices yet (but is now a lot closer to it)
2005-10-04 08:09:19 -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 64f09c98d7 /spare/repo/libata-dev branch 'chs-support' 2005-09-28 12:11:15 -04:00
Albert Lee 14be71f4c5 [PATCH] libata: rename host states
Changes:
s/PIO_ST_/HSM_ST_/ and s/pio_task_state/hsm_task_state/.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-28 11:58:39 -04:00
Albert Lee ee500aabf1 [PATCH] libata: indent and whitespace change
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-28 11:57:29 -04:00
Jeff Garzik 98ed72deeb Merge /spare/repo/linux-2.6/ 2005-09-24 00:26:49 -04:00
Jeff Garzik 536f809802 Merge /spare/repo/linux-2.6/ 2005-09-23 19:03:21 -04:00
Jeff Garzik 7fb6ec287a [libata] fix PIO completion race
Make sure we that completion is the final action we take; prior to this
change, another CPU may have changed ap->pio_task_state before we tested
it a final time.

Spotted by, and original patch by Albert Lee @ IBM.

Also includes a minor optimization:  eliminate a ton of unnecessary
queue_work() calls, simply by jumping to the beginning of the FSM
function ata_pio_task().
2005-09-16 06:01:48 -04:00
Alan Cox 17b14451fd [PATCH] PATCH: remove function for non-PCI as requested
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-16 02:39:01 -04:00
Jeff Garzik 142e27fc8a Merge /spare/repo/linux-2.6/ 2005-09-08 05:41:28 -04:00
Jeff Garzik 344babaa9d [kernel-doc] fix various DocBook build problems/warnings
Most serious is fixing include/sound/pcm.h, which breaks the DocBook
build.

The other stuff is just filling in things that cause warnings.
2005-09-07 01:15:17 -04:00
Jeff Garzik d0bd99299b /spare/repo/libata-dev branch 'iomap-try3' 2005-09-05 05:20:33 -04:00
Jeff Garzik 374b187357 [libata] update several drivers to use pci_iomap()/pci_iounmap() 2005-08-30 05:42:52 -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 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
Alan Cox b73fc89f6d [PATCH] libata: regularize dma_start/stop arguments
Needed for a few PATA drivers.

Also fix up a wrong comment.
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-08-26 17:36:26 -04:00
Alan Cox 31433ea369 [PATCH] libata: typo
You spelt heuristic wrongly. Also reformatted to 80 columns,
ignore the diff and fix the typo if you prefer that.
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-08-26 17:36:25 -04:00
Jeff Garzik b8f6153ee4 libata: fix EH locking
Wrap ata_qc_complete() calls in EH context in spinlocks, to prevent
races (mainly in ATAPI code paths).
2005-08-25 22:01:20 -04:00
Jeff Garzik 4887f76ec3 /spare/repo/libata-dev branch 'upstream-fixes' 2005-08-23 03:35:44 -04:00
Jeff Garzik 6885433c25 libata: release prep (bump versions, etc.)
- bump versions where necessary
- remove two duplicated+outdated doc comments
- add MODULE_VERSION() to AHCI driver
2005-08-23 02:53:51 -04:00
Tejun Heo 40e8c82c74 [PATCH] libata: implement ata_poll_qc_complete and use it in polling functions
[PATCH libata-dev-2.6:upstream] implement ata_poll_qc_complete and use it in polling functions

 Previously, libata polling functions turned irq back on and completed
qc commands without holding host lock.  This creates a race condition
between the polling task and interrupts from other ports on the same
host set or spurious interrupt from itself.

 This patch implements ata_poll_qc_complete which enables irq and
completes qc atomically and convert all polling functions.

 Note: atapi_packet_task() didn't use to turn irq back on or clear
ATA_FLAG_NOINTR on error exits.  This patch makes it use
ata_poll_qc_complete which does both.

 Note: With this change, ALL invocations of ata_qc_complete() are now
done under host_set lock.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-08-23 01:05:55 -04:00
Tejun Heo c138950371 [PATCH] fix atapi_packet_task vs. intr race (take 2)
Interrupts from devices sharing the same IRQ could cause
ata_host_intr to finish commands being processed by atapi_packet_task
if the commands are using ATA_PROT_ATAPI_NODATA or ATA_PROT_ATAPI_DMA
protocol.  This is because libata interrupt handler is unaware that
interrupts are not expected during that period.  This patch adds
ATA_FLAG_NOINTR flag to tell the interrupt handler that we're not
expecting interrupts.

 Note that once proper HSM is implemented for interrupt-driven PIO,
this should be merged into it and this flag will be removed.

 ahci.c is a different kind of beast, so it's left alone.

* The following drivers use ata_qc_issue_prot and ata_interrupt, so
  changes in libata core will do.

  ata_piix sata_sil sata_svw sata_via sata_sis sata_uli

* The following drivers use ata_qc_issue_prot and custom intr handler.
  They need this change to work correctly.

  sata_nv sata_vsc

* The following drivers use custom issue function and intr handler.
  Currently all custom issue functions don't support ATAPI, so this
  change is irrelevant, updated for consistency and to avoid later
  mistakes.

  sata_promise sata_qstor sata_sx4

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-08-23 01:05:55 -04:00
Albert Lee 3f3791d300 [PATCH] libata: Clear ATA_QCFLAG_ACTIVE flag before calling the completion callback
Description:
  After calling the completion callback, the libata error handler might be
running and getting atapi sense data. Clearing the ATA_QCFLAG_ACTIVE flag
at this point might interfere with the libata error handler.

Changes:
   - Clear the ATA_QCFLAG_ACTIVE flag before calling the completion callback
     (and also before the error handler)
   - Add some comment

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-08-23 01:03:38 -04:00
Jeff Garzik 443d089703 /spare/repo/libata-dev branch 'upstream-fixes' 2005-08-23 00:59:54 -04:00
Albert Lee 563a6e1fb0 [PATCH] libata handle the case when device returns/needs extra data
PATCH 2/2:  handle the case when device returns/needs extra data

Description:
   Sometimes the device returns/needs extra data than expected.

Changes:
   Modify __atapi_pio_bytes() to handle the case where device returns/needs extra data.
     - for read case, discard trailing data from the device
     - for write case, padding zero data to the device

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-08-12 02:44:20 -04:00
Albert Lee 6ae4cfb571 [PATCH] libata ata_data_xfer() fix
PATCH 1/2: ata_data_xfer() fix

Changes:
   - Modify ata_mmio_data_xfer() and ata_pio_data_xfer() to handle odd-lengthed buffer.
   - Add some function comments

This patch does not reuse ap->pad as alignment buffer since
using local variable seems good enough.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-08-12 02:44:20 -04:00
Jeff Garzik 8a60a07129 libata: trim trailing whitespace.
Also, fixup a tabs-to-spaces block of code in ata_piix.
2005-07-31 13:13:24 -04:00
Linus Torvalds 2d986010ad Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-for-linus-2.6 2005-07-26 13:28:47 -07:00
Tejun Heo 62ba2841f2 [PATCH] libata: lengthen COMMRESET delay
This patch lengthens the delay between DET setting and clearing for
COMMRESET from 400us to 1ms.  I couldn't find any requiremen regarding
the duration of COMMRESET in SATA I/II specs but AHCI-1.1 10.4.2
states that it should be at least 1ms.

Signed-off-by: Tejun Heo <htejun@gmail.com>
2005-06-28 00:05:57 -04:00