aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
AgeCommit message (Collapse)AuthorFilesLines
2006-08-10Move libata to drivers/ata.Jeff Garzik1-6098/+0
2006-08-10[PATCH] libata: kill unused hard_port_no and legacy_modeTejun Heo1-1/+0
Kill unused probe_ent/ap->hard_port_no and probe_ent->legacy_mode. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-10[PATCH] libata: use dummy port for stolen legacy portsTejun Heo1-2/+0
Use dummy port for stolen legacy ports. This makes ap->port_no always equal ap->hard_port_no. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-10[PATCH] libata: implement dummy portTejun Heo1-10/+51
Implement dummy port which can be requested by setting appropriate bit in probe_ent->dummy_port_mask. The dummy port is used as placeholder for stolen legacy port. This allows libata to guarantee that index_of(ap) == ap->port_no == actual_device_port_no, and thus to remove error-prone ap->hard_port_no. As it's used only when one port of a legacy controller is reserved by some other entity (e.g. IDE), the focus is on keeping the added *code* complexity at minimum, so dummy port allocates all libata core resources and acts as a normal port. It just has all dummy port_ops. This patch only implements dummy port. The following patch will make libata use it for stolen legacy ports. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-10[PATCH] libata: rework legacy handling to remove much of the cruftAlan Cox1-23/+36
Kill host_set->next Fix simplex support Allow per platform setting of IDE legacy bases Some of this can be tidied further later on, in particular all the legacy port gunge belongs as a PCI quirk/PCI header decode to understand the special legacy IDE rules in the PCI spec. Longer term Jeff also wants to move the request_irq/free_irq out of core which will make this even cleaner. tj: folded in three followup patches - ata_piix-fix, broken-arch-fix and fix-new-legacy-handling, and separated per-dev xfermask into separate patch preceding this one. Folded in fixes are... * ata_piix-fix: fix build failure due to host_set->next removal * broken-arch-fix: add missing include/asm-*/libata-portmap.h * fix-new-legacy-handling: * In ata_pci_init_legacy_port(), probe_num was incorrectly incremented during initialization of the secondary port and probe_ent->n_ports was incorrectly fixed to 1. * Both legacy ports ended up having the same hard_port_no. * When printing port information, both legacy ports printed the first irq. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-10[PATCH] libata: implement per-dev xfermaskTejun Heo1-29/+11
Implement per-dev xfermask. libata used to determine xfermask per-port - the fastest mode of the slowest device on the port. This patch enables per-dev xfermask. Original patch is from Alan Cox <alan@redhat.com>. The following changes are made by me. * simplex warning message is added * remove disabled device handling code which is never invoked (originally for choosing port-wide lowest PIO mode) Cc: Alan Cox <alan@redhat.com> Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-10[PATCH] [libata] Kill 'count' var in ata_device_add()Jeff Garzik1-13/+7
Eliminate redundant loop variable 'count' Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-10[PATCH] [libata] some function renamingJeff Garzik1-11/+10
s/ata_host_add/ata_port_add/ s/ata_host_init/ata_port_init/ libata naming got stuck in the middle of a Great Renaming: ata_host -> ata_port ata_host_set -> ata_host To eliminate confusion, let's just give up for now, and simply ensure that things are internally consistent. Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-10[PATCH] libata: update ata_host_init() and rename it to ata_port_init_shost()Tejun Heo1-20/+13
Update ata_host_init() such that it only initializes SCSI host related stuff and doesn't call into ata_port_init(), and rename it to ata_port_init_shost(). Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-09[PATCH] libata: Add support for SATA attachment to SAS adaptersBrian King1-1/+1
The following patch enhances libata to allow SAS device drivers to utilize libata to talk to SATA devices. It introduces some new APIs which allow libata to be used without allocating a virtual scsi host. New APIs: ata_sas_port_alloc - Allocate an ata_port ata_sas_port_init - Initialize an ata_port (probe device, etc) ata_sas_port_destroy - Free an ata_port allocated by ata_sas_port_alloc ata_sas_slave_configure - configure scsi device ata_sas_queuecmd - queue a scsi command, similar to ata_scsi_queuecomand These new APIs can be used either directly by a SAS LLDD or could be used by the SAS transport class. Possible usage for a SAS LLDD would be: scsi_scan_host target_alloc ata_sas_port_alloc slave_alloc ata_sas_port_init slave_configure ata_sas_slave_configure Commands received by the LLDD for SATA devices would call ata_sas_queuecmd. Device teardown would occur with: slave_destroy port_disable target_destroy ata_sas_port_destroy Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-08-09[PATCH] libata: Move ata_probe_ent_alloc to libata_coreBrian King1-0/+25
Move ata_probe_ent_alloc to libata-core. It will also be used by future SAS/SATA integration patches. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-08-09[PATCH] libata: Add ata_port_initBrian King1-15/+34
Separate out the ata_port initialization from ata_host_init so that it can be used in future SAS patches. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-08-09[PATCH] libata: Add ata_host_set_initBrian King1-4/+24
Add ata_host_set_init in preparation for SAS attached SATA. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-08-08Merge branch 'upstream-fixes' into upstreamJeff Garzik1-26/+8
2006-08-05[PATCH] libata: fix ata_device_add() error pathTejun Heo1-4/+4
In the error path, ata_device_add() * dereferences null host_set->ports[] element. * calls scsi_remove_host() on not-yet-added shost. This patch fixes both bugs. The first problem was spotted and initial patch submitted by Dave Jones <davej@redhat.com>. The second problem was mentioned and fixed by Jeff Garzik <jgarzik@pobox.com> in a larger cleanup patch. Cc: Dave Jones <davej@redhat.com> Cc: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-05[PATCH] [libata] manually inline ata_host_remove()Jeff Garzik1-25/+6
(tj: this is for the following ata_device_add() fix) Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-08-05[PATCH] libata: fix ata_port_detach() for old EH portsTejun Heo1-1/+2
ata_prot_detach() did nothing for old EH ports and thus SCSI hosts associated with those ports are left dangling after they are detached leaving stale devices and causing oops eventually. Make ata_port_detach() remove SCSI hosts for old EH ports. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-07-29[PATCH] libata: cosmetic changes to PM functionsTejun Heo1-6/+6
Unify pm_message_t argument to the new-style @mesg. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata-core.c: restore configuration boot messages in ↵Borislav Petkov1-5/+5
ata_dev_configure(), v2 This one looks better, IMHO. This restores the default libata configuration messages printed during booting. Signed-off-by: <petkov@math.uni-muenster.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata: reimplement controller-wide PMTejun Heo1-5/+160
Reimplement controller-wide PM. ata_host_set_suspend/resume() are defined to suspend and resume a host_set. While suspended, EHs for all ports in the host_set are pegged using ATA_FLAG_SUSPENDED and frozen. Because SCSI device hotplug is done asynchronously against the rest of libata EH and the same mutex is used when adding new device, suspend cannot wait for hotplug to complete. So, if SCSI device hotplug is in progress, suspend fails with -EBUSY. In most cases, host_set resume is followed by device resume. As each resume operation requires a reset, a single host_set-wide resume operation may result in multiple resets. To avoid this, resume waits upto 1 second giving PM to request resume for devices. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata: reimplement per-dev PMTejun Heo1-84/+0
Reimplement per-dev PM. The original implementation directly put the device into suspended mode and didn't synchronize w/ EH operations including hotplug. This patch reimplements ata_scsi_device_suspend() and ata_scsi_device_resume() such that they request EH to perform the respective operations. Both functions synchronize with hotplug such that it doesn't operate on detached devices. Suspend waits for completion but resume just issues request and returns. This allows parallel wake up of devices and thus speeds up system resume. Due to sdev detach synchronization, it's not feasible to separate out EH requesting from sdev handling; thus, ata_device_suspend/resume() are removed and everything is implemented in the respective libata-scsi functions. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata: implement PM EH actionsTejun Heo1-2/+3
Implement two PM per-dev EH actions - ATA_EH_SUSPEND and ATA_EH_RESUME. Each action puts the target device into suspended mode and resumes from it respectively. Once a device is put to suspended mode, no EH operations other than RESUME is allowed on the device. The device will stay suspended till it gets resumed and thus reset and revalidated. To implement this, a new device state helper - ata_dev_ready() - is implemented and used in EH action implementations to make them operate only on attached & running devices. If all possible devices on a port are suspended, reset is skipped too. This prevents spurious events including hotplug events from disrupting suspended devices. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata: implement ATA_EHI_NO_AUTOPSY and QUIETTejun Heo1-2/+4
Implement ATA_EHI_NO_AUTOPSY and QUIET. These used to be implied by ATA_PFLAG_LOADING, but new power management and PMP support need to use these separately. e.g. Suspend/resume operations shouldn't print full EH messages and resume shouldn't be recorded as an error. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata: clean up debounce parameters and improve parameter selectionTejun Heo1-14/+11
The names of predefined debounce timing parameters didn't exactly match their usages. Rename to more generic names and implement param selection helper sata_ehc_deb_timing() which uses EHI_HOTPLUGGED to select params. Combined with the previous EHI_RESUME_LINK differentiation, this makes parameter selection accurate. e.g. user scan resumes link but normal deb param is used instead of hotplug param. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata: implement ATA_EHI_RESUME_LINKTejun Heo1-7/+8
Implement ATA_EHI_RESUME_LINK, which indicates that the link needs to be resumed. This used to be implied by ATA_EHI_HOTPLUGGED. However, hotplug isn't the only event which requires link resume and separating this out allows other places to request link resume. This differentiation also allows better debounce timing selection. This patch converts user scan to use ATA_EHI_RESUME_LINK. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata: add ap->pflags and move core dynamic flags to itTejun Heo1-12/+12
ap->flags is way too clamped. Separate out core dynamic flags to ap->pflags. ATA_FLAG_DISABLED is a dynamic flag but left alone as it's referenced by a lot of LLDs and it's gonna be removed once all LLDs are converted to new EH. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-05[PATCH] libata: Conditionally set host->max_cmd_lenBrian King1-6/+15
In preparation for SAS attached SATA devices, which will not have a libata scsi_host, only setup host->max_cmd_len if ap->host exists. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-07-03[PATCH] lockdep: annotate on-stack completionsIngo Molnar1-1/+1
lockdep needs to have the waitqueue lock initialized for on-stack waitqueues implicitly initialized by DECLARE_COMPLETION(). Annotate on-stack completions accordingly. Has no effect on non-lockdep kernels. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30Remove obsolete #include <linux/config.h>Jörn Engel1-1/+0
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-27Merge branch 'upstream-linus' of ↵Linus Torvalds1-57/+94
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] ata_piix: add ICH6/7/8 to Kconfig [PATCH] sata_sil: disable hotplug interrupts on two ATI IXPs [PATCH] libata: cosmetic updates [PATCH] ata: add some NVIDIA chipset IDs [PATCH] libata reduce timeouts [PATCH] libata: implement ata_port_max_devices() [PATCH] libata: make two functions global [PATCH] libata: update ata_do_simple_cmd() [PATCH] libata: move ata_do_simple_cmd() below ata_exec_internal() [PATCH] libata: clear EH action on device detach [PATCH] libata: implement and use ata_deh_dev_action() [PATCH] libata: move ata_eh_clear_action() upward [PATCH] libata.h needs scatterlist.h [libata] sata_vsc: partially revert a PCI ID-related commit [libata] Bump versions
2006-06-27[PATCH] spin/rwlock init cleanupsIngo Molnar1-1/+1
locking init cleanups: - convert " = SPIN_LOCK_UNLOCKED" to spin_lock_init() or DEFINE_SPINLOCK() - convert rwlocks in a similar manner this patch was generated automatically. Motivation: - cleanliness - lockdep needs control of lock initialization, which the open-coded variants do not give - it's also useful for -rt and for lock debugging in general Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-26[PATCH] libata: cosmetic updatesTejun Heo1-29/+32
Cosmetic updates in libata-core.c. * trim trailing whitespaces * break lines which are over 80 column * kill unnecessary braces * make indentation consistent Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-26[PATCH] libata reduce timeoutsAndrew Morton1-1/+6
From: Andrew Morton <akpm@osdl.org> Provide a module parameter to override the default 30-second-per-device SATA probing timeout. Cc: Tejun Heo <htejun@gmail.com> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-26[PATCH] libata: make two functions globalTejun Heo1-2/+2
Make ata_do_simple_cmd() and ata_flush_cache() global. These will be used from libata-eh.c. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-26[PATCH] libata: update ata_do_simple_cmd()Tejun Heo1-14/+43
* the function has always returned AC_ERR_* masks not -errno but its return type was int. Make return type unsigned int. * don't print error message automatically. it's the caller's responsibility. * add header comment Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-26[PATCH] libata: move ata_do_simple_cmd() below ata_exec_internal()Tejun Heo1-23/+23
Move ata_do_simple_cmd() below ata_exec_internal() for consistency. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-23[libata] conversion to new debug scheme, part 1 of $NBorislav Petkov1-26/+47
The first 25% of libata-core.c converted to the new debugging scheme. Signed-off-by: <petkov@math.uni-muenster.de> (with addition of ATA_MSG_WARN to standard msg_enable by me) Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-22[libata] Add host lock to struct ata_portJeff Garzik1-27/+28
Prepare for changes required to support SATA devices attached to SAS HBAs. For these devices we don't want to use host_set at all, since libata will not be the owner of struct scsi_host. Signed-off-by: Brian King <brking@us.ibm.com> (with slight merge modifications made by...) Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-22[PATCH] libata-dev: move the CDB-intr DMA blacklistingAlbert Lee1-10/+9
Move the DMA blacklisting of the CDB-intr devices from ata_check_atapi_dma() to ata_dma_blacklisted(), where it makes more sense. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-22Merge branch 'master' into upstreamJeff Garzik1-0/+1
Conflicts: drivers/scsi/libata-core.c drivers/scsi/libata-scsi.c include/linux/pci_ids.h
2006-06-19Improve SATA core suspend/resumeLinus Torvalds1-0/+1
Doing a full ata_busy_sleep() seems to get suspend and resume working fine on the Apple Mac Mini, at least. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-13[libata] Update docs to reflect current driver APIJeff Garzik1-1/+1
2006-06-12[PATCH] libata: add host_set->next for legacy two host_sets case, take #3Tejun Heo1-0/+4
For a legacy ATA controller, libata registers two separate host sets. There was no connection between the two hosts making it impossible to traverse all ports related to the controller. This patch adds host_set->next which points to the second host_set and makes ata_pci_remove_one() remove all associated host_sets. * On device removal, all ports hanging off the device are properly detached. Prior to this patch, ports on the first host_set weren't detached casuing oops on driver unloading. * On device removal, both host_sets are properly freed This will also be used by new power management code to suspend and resume all ports of a controller. host_set/port representation will be improved to handle legacy controllers better and this host_set linking will go away with it. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12[PATCH] libata: fix comment above ata_exec_internal()Tejun Heo1-1/+3
Add RETURNS comment above ata_exec_internal() and kill extra blank line. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-12[PATCH] Snoop SET FEATURES - WRITE CACHE ENABLE/DISABLE command(v5)zhao, forrest1-0/+1
This patch makes libata snoop 'SET FEATURES - WRITE CACHE ENABLE/DISABLE' command, executing requisite revalidation processes to update cached data. Signed-off-by: Forrest Zhao <forrest.zhao@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-11libata: more verbose request_irq() failureJeff Garzik1-2/+7
Suggested by Jarek P.
2006-06-11[PATCH] libata: Setup nbytes in ata_sg_init_oneBrian King1-0/+1
Setup nbytes in ata_sg_init_one to the total transfer length of the command. This is needed by some HBAs that need to know the total transfer length of each command. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-06-11libata: Adjust initial debugging levels through preprocessor defines.Borislav Petkov1-1/+9
Signed-off-by: <petkov@uni-muenster.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-31[PATCH] libata-hp: move ata_do_reset() to libata-eh.cTejun Heo1-28/+0
With ops->probe_init() gone, no user is left in libata-core.c. Move ata_do_reset() to libata-eh.c and make it static. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp: killl ops->probe_resetTejun Heo1-174/+13
Now that all drivers implementing new EH are converted to new probing mechanism, ops->probe_reset doesn't have any user. Kill it. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp: update unload-unplugTejun Heo1-6/+61
Update unload unplug - driver unloading / PCI removal. This is done by ata_port_detach() which short-circuits EH, disables all devices and freezes the port. With this patch, EH and unloading/unplugging are properly synchronized. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp: implement bootplugTejun Heo1-15/+34
Implement bootplug - boot probing via hotplug path. While loading, ata_host_add() simply schedules probing and invokes EH. After EH completes, ata_host_add() scans and assicates them with SCSI devices. EH path is slightly modified to handle this (e.g. no autopsy during bootplug). The SCSI part is left in ata_host_add() because it's shared with legacy path and to keep probing order as before (ATA scan all ports in host_set then attach all). Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp: implement warmplugTejun Heo1-0/+1
Implement warmplug. User-initiated unplug can be detected by hostt->slave_destroy() and plug by transportt->user_scan(). This patch only implements the two callbacks. The next function will hook them. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp: implement SCSI part of hotplugTejun Heo1-0/+1
Implement SCSI part of hotplug. This must be done in a separate context as SCSI makes use of EH during probing. SCSI scan fails silently if EH is in progress. In such cases, libata pauses briefly and retries until every device is attached. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata: export ata_hsm_move()Tejun Heo1-3/+3
ata_hsm_move() will be used by LLDDs which depend on standard PIO HSM but implement their own interrupt handlers. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp-prep: add prereset() method and implement ata_std_prereset()Tejun Heo1-0/+85
With hotplug, every reset might be a probing reset and thus something similar to probe_init() is needed. prereset() method is called before a series of resets to a port and is the counterpart of postreset(). prereset() can tell EH to use different type of reset or skip reset by modifying ehc->i.action. This patch also implements ata_std_prereset(). Most controllers should be able to use this function directly or with some wrapping. After hotplug, different controllers need different actions to resume the PHY and detect the newly attached device. Controllers can be categorized as follows. * Controllers which can wait for the first D2H FIS after hotplug. Note that if the waiting is implemented by polling TF status, there needs to be a way to set BSY on PHY status change. It can be implemented by hardware or with the help of the driver. * Controllers which can wait for the first D2H FIS after sending COMRESET. These controllers need to issue COMRESET to wait for the first FIS. Note that the received D2H FIS could be the first D2H FIS after POR (power-on-reset) or D2H FIS in response to the COMRESET. Some controllers use COMRESET as TF status synchronization point and clear TF automatically (sata_sil). * Controllers which cannot wait for the first D2H FIS reliably. Blindly issuing SRST to spinning-up device often results in command issue failure or timeout, causing extended delay. For these controllers, ata_std_prereset() explicitly waits ATA_SPINUP_WAIT (currently 8s) to give newly attached device time to spin up, then issues reset. Note that failing to getting ready in ATA_SPINUP_WAIT is not critical. libata will retry. So, the timeout needs to be long enough to spin up most devices. LLDDs can tell ata_std_prereset() which of above action is needed with ATA_FLAG_HRST_TO_RESUME and ATA_FLAG_SKIP_D2H_BSY flags. These flags are PHY-specific property and will be moved to ata_link later. While at it, this patch unifies function typedef's such that they all have named arguments. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp-prep: implement sata_phy_debounce()Tejun Heo1-14/+93
With hotplug, PHY always needs to be debounced before a reset as any reset might find new devices. Extract PHY waiting code from sata_phy_resume() and extend it to include SStatus debouncing. Note that sata_phy_debounce() is superset of what used to be done inside sata_phy_resume(). Three default debounce timing parameters are defined to be used by hot/boot plug. As resume failure during probing will be properly handled as errors, timeout doesn't have to be long as before. probeinit() uses the same timeout to retain the original behavior. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp-prep: make probing related functions globalTejun Heo1-3/+3
Hotplug will be implemented in libata-eh.c. Make ata_dev_read_id() and ata_dev_configure() global. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp-prep: add ata_aux_wqTejun Heo1-0/+9
It's best to run ATA hotplug from EH but attaching SCSI devices needs working EH. ata_aux_wq is used to give SCSI hotplug operations a separate context. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp-prep: implement ap->hw_sata_spd_limitTejun Heo1-9/+12
Add ap->hw_sata_spd_limit and initialize it once during the boot initialization (or driver load initialization). ap->sata_spd_limit is reset to ap->hw_sata_spd_limit on hotplug. This prevents spd limits introduced by earlier devices from affecting new devices. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp-prep: make some ata_device fields persistentTejun Heo1-2/+12
Lifetimes of some fields span over device plugging/unplugging. This patch moves such persistent fields to the top of ata_device and separate them with ATA_DEVICE_CLEAR_OFFSET. Fields above the offset are initialized once during host initializatino while all other fields are cleared before hotplugging. Currently ->ap, devno and part of flags are persistent. Note that flags is partially cleared while holding host_set lock. This is to synchronize with later warm plug implementation which will record hotplug request in dev->flags. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata-hp-prep: implement ata_dev_init()Tejun Heo1-5/+21
Move initialization of struct ata_device into ata_dev_init() in preparation for hotplug. This patch calls ata_dev_init() from ata_host_init() and thus makes no functional difference. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-31[PATCH] libata: implement ata_eh_wait()Tejun Heo1-0/+1
Implement ata_eh_wait(). On return from this function, it's guaranteed that the EH which was pending or in progress when the function was called is complete - including the tailing part of SCSI EH. This will be used by hotplug and others to synchronize with EH. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-29libata debugging: set initial dbg valueBorislav Petkov1-0/+1
This patch sets the prerequisites for the new debugging scheme that more or less resembles Donald Becker's net driver example. This one liner doesn't change any functionality beside setting the appropriate debug level for the msg_enable control in the ata_port struct, which will be later used by the ata_msg_* macros to control the amount of debug information sent to printk. Signed-off-by: <petkov@uni-muenster.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-28Merge branch 'upstream-fixes' into upstreamJeff Garzik1-0/+3
Conflicts: drivers/scsi/libata-core.c
2006-05-28[PATCH] the latest consensus libata resume fixMark Lord1-0/+1
Okay, just to sum things up. This forces libata to wait for up to 2 seconds for BUSY|DRQ to clear on resume before continuing. [jgarzik adds...] During testing we never saw DRQ asserted, but nonetheless (a) this works and (b) testing for DRQ won't hurt. Signed-off-by: Mark Lord <liml@rtr.ca> Acked-by: Jens Axboe <axboe@suse.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-26[PATCH] libata: add pio_data_xfer_noirqAlan Cox1-0/+25
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-24[PATCH] PATCH: libata. Add ->data_xfer methodAlan Cox1-45/+18
We need to pass the device in order to do per device checks such as 32bit I/O enables. With the changes to include dev->ap we now don't have to add parameters however just clean them up. Also add data_xfer methods to the existing drivers except ata_piix (which is in the other block of patches). If you reject the piix one just add a data_xfer to it... Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-24[PATCH] libata: PIO 0Alan Cox1-0/+6
Ensure the pio_mode is always setup. Don't do any setup on the controller b just ensure the mode reporting is valid to avoid tons of special cases in PATA driver code when mode switching on the fly. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-24Merge branch 'upstream-fixes' into upstreamJeff Garzik1-1/+3
Conflicts: drivers/scsi/libata-core.c
2006-05-24[PATCH] libata: add pio flush for via atapi (was: Re: TR: ASUS A8V Deluxe, ↵Albert Lee1-0/+5
x86_64) Backport the "pio flush" from the libata major update to 2.6.17 for via atapi. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-20[PATCH] libata: use qc->result_tf for temp taskfile storageAlbert Lee1-4/+10
Use qc->result_tf for temp taskfile storage. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-20[PATCH] libata: Fix the HSM error_mask mapping (was: Re: libata-tj and SMART)Albert Lee1-7/+24
Fix the HSM error_mask mapping. Changes: - Better mapping in ac_err_mask() - In HSM_ST_FIRST ans HSM_ST state, check ATA_ERR|ATA_DF and map it to AC_ERR_DEV instead of AC_ERR_HSM. - In HSM_ST_FIRST and HSM_ST state, map DRQ=1 ERR=1 to AC_ERR_HSM. - For PIO data in and DRQ=1 ERR=1, add check after the junk data block is read. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-20Merge branch 'upstream-fixes' into upstreamJeff Garzik1-2/+6
Conflicts: drivers/scsi/libata-core.c
2006-05-20[PATCH] libata-core: fix current kernel-doc warningsRandy Dunlap1-0/+6
Fix all current kernel-doc warnings. Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-15[PATCH] libata-ncq: implement NCQ device configurationTejun Heo1-2/+29
Now that all NCQ related stuff are in place, implement NCQ device configuration and bump ATA_MAX_QUEUE to 32 thus activating NCQ support. Original implementation is from Jens Axboe. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-ncq: implement NCQ command translation and exclusionTejun Heo1-0/+1
This patch implements NCQ command translation and exclusion. Note that NCQ commands don't use ata_rwcmd_protocol() to choose ATA command. This is because, unlike non-NCQ RW commands, NCQ commands can only be used for NCQ protocol and FUA handling is done with a flag rather than separate command. NCQ enabled device will have queue depth larger than one but no two non-NCQ commands can be issued simultaneously, neither can a non-NCQ command and NCQ commands. This patch makes ata_scsi_translate() return SCSI_MLQUEUE_DEVICE_BUSY if such exclusion is necessary. SCSI midlayer will retry the command later. As SCSI midlayer always retries once a command completes, this doesn't incur unnecessary delays and as most commands will be NCQ ones for NCQ device, so the overhead should be negligible. Initial implementation is from Jens Axboe and using SCSI_MLQUEUE_DEVICE_BUSY for exclusion is suggested by Jeff Garzik. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-ncq: implement ap->qc_active, ap->sactive and complete helperTejun Heo1-2/+79
Add ap->qc_active and ap->sactive, mask of all active qcs and libata's view of the SActive register, respectively. Also, implement ata_qc_complete_multiple() which takes new qc_active mask and complete multiple qcs according to the mask. These will be used to track NCQ commands and complete them. The distinction between ap->qc_active and ap->sactive is also useful for later PM implementation. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-ncq: rename ap->qactive to ap->qc_allocatedTejun Heo1-3/+3
Rename ap->qactive to ap->qc_allocated. This is to accomodate addition of ap->qc_active, mask of active qcs. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: fix irq-pio mergeTejun Heo1-46/+52
* kill ata_poll_qc_complete() and implement/use ata_hsm_qc_complete() which completes qcs in new EH compliant manner from HSM * don't print error message from ata_hsm_move(). it's responsibility of EH. * kill ATA_FLAG_NOINTR usage in bmdma EH Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15Merge branch 'irq-pio'Tejun Heo1-308/+495
Conflicts: drivers/scsi/libata-core.c include/linux/libata.h
2006-05-15[PATCH] libata-eh: implement BMDMA EHTejun Heo1-0/+5
Implement stock BMDMA error handling methods. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh: implement new EHTejun Heo1-0/+1
Implement new EH. The exported interface is ata_do_eh() which is to be called from ->error_handler and performs the following steps to recover the failed port. ata_eh_autopsy() : analyze SError/TF, determine the cause of failure and required recovery actions and record it in ap->eh_context ata_eh_report() : report the failure to user ata_eh_recover() : perform recovery actions described in ap->eh_context ata_eh_finish() : finish failed qcs LLDDs can customize error handling by modifying eh_context before calling ata_do_eh() or, if necessary, doing so inbetween each major steps by calling each step explicitly. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh-fw: update ata_exec_internal() for new EHTejun Heo1-7/+23
Update ata_exec_internal() such that it uses new EH framework. ->post_internal_cmd() is always invoked regardless of completion status. Also, when ata_exec_internal() detects a timeout condition and new EH is in place, it freezes the port as timeout for normal commands would do. Note that ata_port_flush_task() is called regardless of wait_for_completion status. This is necessary as exceptions unrelated to the qc can abort the qc, in which case PIO task could still be running after the wait for completion returns. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh-fw: implement new EH scheduling from PIOTejun Heo1-4/+19
PIO executes without holding host_set lock, so it cannot be synchronized using the same mechanism as interrupt driven execution. port_task framework makes sure that EH is not entered until PIO task is flushed, so PIO task can be sure the qc in progress won't go away underneath it. One thing it cannot be sure of is whether the qc has already been scheduled for EH by another exception condition while host_set lock was released. This patch makes ata_poll_qc-complete() handle such conditions properly and make it freeze the port if HSM violation is detected during PIO execution. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh-fw: implement freeze/thawTejun Heo1-2/+24
Freezing is performed atomic w.r.t. host_set->lock and once frozen LLDD is not allowed to access the port or any qc on it. Also, libata makes sure that no new qc gets issued to a frozen port. A frozen port is thawed after a reset operation completes successfully, so reset methods must do its job while the port is frozen. During initialization all ports get frozen before requesting IRQ, so reset methods are always invoked on a frozen port. Optional ->freeze and ->thaw operations notify LLDD that the port is being frozen and thawed, respectively. LLDD can disable/enable hardware interrupt in these callbacks if the controller's IRQ mask can be changed dynamically. If the controller doesn't allow such operation, LLDD can check for frozen state in the interrupt handler and ack/clear interrupts unconditionally while frozen. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh-fw: implement ata_port_schedule_eh() and ata_port_abort()Tejun Heo1-0/+2
ata_port_schedule_eh() directly schedules EH for @ap without associated qc. Once EH scheduled, no further qc is allowed and EH kicks in as soon as all currently active qc's are drained. ata_port_abort() schedules all currently active commands for EH by qc_completing them with ATA_QCFLAG_FAILED set. If ata_port_abort() doesn't find any qc to abort, it directly schedule EH using ata_port_schedule_eh(). These two functions provide ways to invoke EH for conditions which aren't directly related to any specfic qc. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh-fw: implement new EH scheduling via error completionTejun Heo1-1/+61
There are several ways a qc can get schedule for EH in new EH. This patch implements one of them - completing a qc with ATA_QCFLAG_FAILED set or with non-zero qc->err_mask. ALL such qc's are examined by EH. New EH schedules a qc for EH from completion iff ->error_handler is implemented, qc is marked as failed or qc->err_mask is non-zero and the command is not an internal command (internal cmd is handled via ->post_internal_cmd). The EH scheduling itself is performed by asking SCSI midlayer to schedule EH for the specified scmd. For drivers implementing old-EH, nothing changes. As this change makes ata_qc_complete() rather large, it's not inlined anymore and __ata_qc_complete() is exported to other parts of libata for later use. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh-fw: update ata_qc_from_tag() to enforce normal/EH qc ownershipTejun Heo1-2/+2
New EH framework has clear distinction about who owns a qc. Every qc starts owned by normal execution path - PIO, interrupt or whatever. When an exception condition occurs which affects the qc, the qc gets scheduled for EH. Note that some events (say, link lost and regained, command timeout) may schedule qc's which are not directly related but could have been affected for EH too. Scheduling for EH is atomic w.r.t. ap->host_set->lock and once schedule for EH, normal execution path is not allowed to access the qc in whatever way. (PIO synchronization acts a bit different and will be dealt with later) This patch make ata_qc_from_tag() check whether a qc is active and owned by normal path before returning it. If conditions don't match, NULL is returned and thus access to the qc is denied. __ata_qc_from_tag() is the original ata_qc_from_tag() and is used by libata core/EH layers to access inactive/failed qc's. This change is applied only if the associated LLDD implements new EH as indicated by non-NULL ->error_handler Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh-fw: use special reserved tag and qc for internal commandsTejun Heo1-3/+29
New EH may issue internal commands to recover from error while failed qc's are still hanging around. To allow such usage, reserve tag ATA_MAX_QUEUE-1 for internal command. This also makes it easy to tell whether a qc is for internal command or not. ata_tag_internal() test implements this test. To avoid breaking existing drivers, ata_exec_internal() uses ATA_TAG_INTERNAL only for drivers which implement ->error_handler. For drivers using old EH, tag 0 is used. Note that this makes ata_tag_internal() test valid only when ->error_handler is implemented. This is okay as drivers on old EH should not and does not have any reason to use ata_tag_internal(). Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh-fw: clear SError in ata_std_postreset()Tejun Heo1-0/+6
Clear SError in ata_std_postreset(). This is to clear SError bits which get set during reset. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: use ATA printk helpersTejun Heo1-107/+92
Use ATA printk helpers. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: use dev->apTejun Heo1-85/+75
Use dev->ap where possible and eliminate superflous @ap from functions and structures. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: add dev->apTejun Heo1-0/+1
Add dev->ap which points back to the port the device belongs to. This makes it unnecessary to pass @ap for silly reasons (e.g. printks). Also, this change is necessary to accomodate later PM support which will introduce ATA link inbetween port and device. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: use new SCR and on/offline functionsTejun Heo1-47/+60
Use new SCR and on/offline functions. Note that for LLDD which know it implements SCR callbacks, SCR functions are guaranteed to succeed and ata_port_online() == !ata_port_offline(). Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: implement new SCR handling and port on/offline functionsTejun Heo1-0/+143
Implement ata_scr_{valid|read|write|write_flush}() and ata_port_{online|offline}(). These functions replace scr_{read|write}() and sata_dev_present(). Major difference between between the new SCR functions and the old ones is that the new ones have a way to signal error to the caller. This makes handling SCR-available and SCR-unavailable cases in the same path easier. Also, it eases later PM implementation where SCR access can fail due to various reasons. ata_port_{online|offline}() functions return 1 only when they are affirmitive of the condition. e.g. if SCR is unaccessible or presence cannot be determined for other reasons, these functions return 0. So, ata_port_online() != !ata_port_offline(). This distinction is useful in many exception handling cases. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: init ap->cbl to ATA_CBL_SATA earlyTejun Heo1-3/+6
Init ap->cbl to ATA_CBL_SATA in ata_host_init(). This is necessary for soon-to-follow SCR handling function changes. LLDDs are free to change ap->cbl during probing. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: implement qc->result_tfTejun Heo1-2/+2
Add qc->result_tf and ATA_QCFLAG_RESULT_TF. This moves the responsibility of loading result TF from post-compltion path to qc execution path. qc->result_tf is loaded if explicitly requested or the qc failsa. This allows more efficient completion implementation and correct handling of result TF for controllers which don't have global TF representation such as sil3124/32. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: remove postreset handling from ata_do_reset()Tejun Heo1-9/+10
Make ata_do_reset() deal only with reset. postreset is now the responsibility of the caller. This is simpler and eases later prereset addition. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: move ->set_mode() handling into ata_set_mode()Tejun Heo1-14/+15
Move ->set_mode() handlng into ata_set_mode(). Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: use preallocated buffersTejun Heo1-24/+8
It's not a very good idea to allocate memory during EH. Use statically allocated buffer for dev->id[] and add 512byte buffer ap->sector_buf. This buffer is owned by EH (or probing) and to be used as temporary buffer for various purposes (IDENTIFY, NCQ log page 10h, PM GSCR block). Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: hold host_set lock while finishing internal qcTejun Heo1-0/+5
Hold host_set lock while finishing internal qc. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: clear ap->active_tag atomically w.r.t. command completionTejun Heo1-2/+3
ap->active_tag was cleared in ata_qc_free(). This left ap->active_tag dangling after ata_qc_complete(). Spurious interrupts inbetween could incorrectly access the qc. Clear active_tag in ata_qc_complete(). This change is necessary for later EH changes. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: fix ->phy_reset class code handling in ata_bus_probe()Tejun Heo1-2/+4
ata_bus_probe() doesn't clear dev->class after ->phy_reset(). This can result in falsely enabled devices if probing fails. Clear dev->class to ATA_DEV_UNKNOWN after fetching it. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: unexport ata_scsi_error()Tejun Heo1-1/+0
While moving ata_scsi_error() from LLDD sht to libata transportt, EXPORT_SYMBOL_GPL() entry was left out. Kill it. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata: rename ata_down_sata_spd_limit() and friendsTejun Heo1-16/+16
Rename ata_down_sata_spd_limit() and friends to sata_down_spd_limit() and likewise for simplicity & consistency. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-04-12Merge branch 'upstream'Jeff Garzik1-43/+83
2006-04-11[PATCH] libata: export ata_set_sata_spd()Tejun Heo1-1/+2
This will be used by LLDD hardreset implementation. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-11[PATCH] libata: cosmetic update to ata_bus_probe()Tejun Heo1-5/+5
Move ata_set_mode() failure handling outside of ap->ops->set_mode if clause such that it can handle ap->ops->set_mode failures after it's updated. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-11[PATCH] libata: disable failed devices only once in ata_bus_probe()Tejun Heo1-5/+7
Devices which consumed all their changes used to be disabled every iteration. This causes unnecessary noise in the console output. Disable once and leave alone. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-11[PATCH] libata: implement ata_wait_register()Tejun Heo1-0/+47
As waiting for some register bits to change seems to be a common operation shared by some controllers, implement helper function ata_wait_register(). This function also takes care of register write flushing. Note that the condition is inverted, the wait is over when the masked value does NOT match @val. As we're waiting for bits to change, this test is more powerful and allows the function to be used in more places. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-11[PATCH] libata: make reset methods complain when they failTejun Heo1-3/+5
Make reset methods complain loud when they fail. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-11[PATCH] libata: kill @verbose from ata_reset_fn_tTejun Heo1-24/+12
@verbose was added to ata_reset_fn_t because AHCI complained during probing if no device was attached to the port. However, muting failure message isn't the correct approach. Reset methods are responsible for detecting no device condition and finishing successfully. Now that AHCI softreset is fixed, kill @verbose. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-11[PATCH] libata: set default cbl in probeinitTejun Heo1-5/+5
Make setting CBL type responsibility of probeinit. This allows using only ap->cbl == ATA_CBL_SATA test in all other parts. Without this, ata_down_sata_spd_limit() doesn't work during probe reset. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-11libata: Add helper ata_shost_to_port()Jeff Garzik1-2/+2
2006-04-10[PATCH] move ->eh_strategy_handler to the transport classChristoph Hellwig1-1/+0
Overriding the whole EH code is a per-transport, not per-host thing. Move ->eh_strategy_handler to the transport class, same as ->eh_timed_out. Downside is that scsi_host_alloc can't check for the total lack of EH anymore, but the transition period from old EH where we needed it is long gone already. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-04Merge branch 'upstream'Jeff Garzik1-0/+4
2006-04-04[PATCH] libata: convert ATAPI_ENABLE_DMADIR to module parameterAlbert Lee1-0/+4
Convert the ATAPI_ENABLE_DMADIR compile time option needed by some SATA-PATA bridge to runtime module parameter. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-04[PATCH] libata-dev: irq-pio minor fix 2Albert Lee1-9/+6
irq-pio minor fix 2: - Use qc as data for ata_pio_task(). Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-04[PATCH] libata-dev: irq-pio minor fixAlbert Lee1-4/+4
irq-pio minor fix: - remove the redundant hsm_task_state = HSM_ST_IDLE - add devno to printk() as done in upstream Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02Merge branch 'upstream'Jeff Garzik1-5/+8
2006-04-02[PATCH] libata: print SControl in SATA link status info messageTejun Heo1-5/+8
Now that libata mangles with SControl, it's helpful to print out SControl in link status message. Add it. Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02[libata] irq-pio: Fix merge mistakeJeff Garzik1-95/+0
2006-04-02Merge branch 'upstream'Jeff Garzik1-79/+329
Conflicts: drivers/scsi/libata-core.c drivers/scsi/pdc_adma.c drivers/scsi/sata_mv.c drivers/scsi/sata_nv.c drivers/scsi/sata_promise.c drivers/scsi/sata_qstor.c drivers/scsi/sata_sx4.c drivers/scsi/sata_vsc.c include/linux/libata.h
2006-04-02[PATCH] libata: make some libata-core routines externTejun Heo1-17/+12
Make libata-core routines which will be used by EH implementation extern. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02[PATCH] libata: separate out libata-eh.cTejun Heo1-97/+5
A lot of EH codes are about to be added to libata. Separate out libata-eh.c. ata_scsi_timed_out(), ata_scsi_error(), ata_qc_timeout(), ata_eng_timeout(), ata_eh_qc_complete() and ata_eh_qc_retry() are moved. No code is changed by this patch. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-02[PATCH] libata: add @cdb to ata_exec_internal()Tejun Heo1-5/+8
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[PATCH] libata: pass qc around intead of ap during PIOTejun Heo1-45/+26
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[PATCH] libata: clear ATA_DFLAG_PIO before setting itTejun Heo1-0/+1
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[PATCH] libata: clear only affected flags during ata_dev_configure()Tejun Heo1-1/+1
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[PATCH] libata: rename ATA_FLAG_PORT_DISABLED to ATA_FLAG_DISABLEDTejun Heo1-9/+9
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[PATCH] libata: ata_dev_revalidate() printk updateTejun Heo1-13/+10
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[PATCH] libata: report device number when PIO failsTejun Heo1-1/+2
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[PATCH] libata: consider disabled devices in ata_dev_xfermask()Tejun Heo1-11/+23
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[PATCH] libata: improve ata_bus_probe()Tejun Heo1-16/+49
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[PATCH] libata: implement ata_down_xfermask_limit()Tejun Heo1-0/+52
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[PATCH] libata: add 5s sleep between resetsTejun Heo1-1/+14
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[PATCH] libata: use SATA speed down in ata_drive_probe_reset()Tejun Heo1-4/+12
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[PATCH] libata: implement ap->sata_spd_limit and helpersTejun Heo1-4/+139
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-01Merge branch 'upstream'Jeff Garzik1-29/+49
2006-04-01[PATCH] libata: preserve SATA SPD setting over hard resetsTejun Heo1-3/+9
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[PATCH] libata: don't disable devices from ata_set_mode()Tejun Heo1-26/+40
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[PATCH] libata-dev: handle DRQ=1 ERR=1 (revised)Albert Lee1-14/+32
Handle DRQ=1 ERR=1 situation. Revised according to what IDE try_to_flush_leftover_data() does. Changes: - For ATA PIO writes and ATAPI devices, just stop the HSM and let EH handle it. - For ATA PIO reads, read only one block of junk data and then let EH handle it. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-04-01Merge branch 'upstream'Jeff Garzik1-108/+97
2006-04-01[PATCH] libata: reorganize ata_set_mode()Tejun Heo1-56/+35
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[PATCH] libata: make ata_set_mode() handle no-device case properlyTejun Heo1-1/+4
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[PATCH] libata: implement ata_dev_enabled and disabled()Tejun Heo1-12/+12
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[PATCH] libata: convert do_probe_reset() to ata_do_reset()Tejun Heo1-13/+16
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[PATCH] libata: separate out ata_spd_string()Tejun Heo1-9/+14
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[PATCH] libata: make ata_bus_probe() return negative errno on failureTejun Heo1-3/+3
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[PATCH] libata: fix ata_set_mode() return valueTejun Heo1-1/+2
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-03-31[PATCH] libata: fix ata_xfer_tbl terminationTejun Heo1-1/+1
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[PATCH] libata: make ata_qc_issue complete failed qcsTejun Heo1-11/+9
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[PATCH] libata: fix ata_qc_issue failure pathTejun Heo1-3/+3
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[PATCH] libata-dev: print out information for ATAPI devices with CDB interruptsAlbert Lee1-3/+8
print out information for ATAPI devices with CDB interrupts Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29Merge branch 'upstream'Jeff Garzik1-12/+45
Conflicts: drivers/scsi/sata_mv.c
2006-03-29[PATCH] libata: ata_dev_init_params() fixesAlbert Lee1-6/+8
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[PATCH] libata: Fix interesting use of "extern" and also some bracketingAlan Cox1-2/+2
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[PATCH] libata: Simplex and other mode filtering logicAlan Cox1-2/+29
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[PATCH] libata - ATA is both ATA and CFAAlan Cox1-1/+1
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[PATCH] libata: Add ->set_mode hook for odd driversAlan Cox1-1/+5
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-29Merge branch 'upstream'Jeff Garzik1-5/+8
2006-03-29[PATCH] libata-dev: wait idle after reading the last data blockAlbert Lee1-1/+1
Some CD-ROM drives are slow to clear DRQ, after the last data block is read by PIO. Use ata_wait_idle() after reading the last data block. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: fix the device err check sequence (respin)Albert Lee1-6/+38
Current irq-pio checks ERR bit and stops on ERR before it does anything else. This behavior doesn't look right. The DRQ bit should take higher precedence than the ERR bit. Changes: - Let the HSM do the data transfer whenever the device asks for DRQ bit, even if the ERR bit is set. - For DRQ=1 ERR=1, don't trust the data Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: irq-pio minor fixes (respin)Albert Lee1-4/+5
irq-pio minor fixes for printk() and comments. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Make the the in_wq check as an inline functionAlbert Lee1-6/+28
Make the the in_wq check easier to read as an inline function. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: ata_check_atapi_dma() fix for ATA_FLAG_PIO_POLLING LLDDsAlbert Lee1-0/+10
ata_check_atapi_dma() fix for LLDDs with the ATA_FLAG_PIO_POLLING flag. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Cleanup unused enums/functionsAlbert Lee1-279/+0
Cleanup the following unused functions: - ata_pio_poll() - ata_pio_complete() - ata_pio_first_block() - ata_pio_block() - ata_pio_error() ap->pio_task_timeout and other enums. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Convert ata_pio_task() to use the new ata_hsm_move()Albert Lee1-32/+28
Convert ata_pio_task() to use the new ata_hsm_move(). Changes: - refactor ata_pio_task() to poll device status register and - call the new ata_hsm_move() when device indicates it is not BSY. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Let ata_hsm_move() work with both irq-pio and polling pioAlbert Lee1-6/+81
Let ata_hsm_move() work with both irq-pio and polling pio codepath. Changes: - add a new parameter "in_wq" for polling pio - add return value "poll_next" to tell polling pio task whether the HSM is finished - merge code from ata_pio_first_block() to the HSM_ST_FIRST state. - call ata_poll_qc_complete() if called from the workqueue Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Minor fix for ata_hsm_move() to work with ata_host_intr()Albert Lee1-11/+13
Minor fix for ata_hsm_move() to work with ata_host_intr(). Changes: - WARN_ON() and comment fix - Make the HSM_ST_LAST device status checking more rigid. - Treat unknown HSM state as BUG(). Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Move out the HSM code from ata_host_intr()Albert Lee1-100/+106
Move out the irq-pio HSM code from ata_host_intr() to the new ata_hsm_move() function verbatim. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Remove atapi_packet_task()Albert Lee1-73/+0
atapi_packet_task() was replaced by ata_pio_task(). Remove the unused atapi_packet_task(). Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Fix merge problem with upstreamAlbert Lee1-2/+3
Fix merge problem with upstream. Changes: 1. add missing dev->cdb_len = 16 for ATA devices 2. use ata_pio_task instead of atapi_packet_task Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata-dev: Remove trailing whitespacesAlbert Lee1-3/+3
Remove trailing whitespaces. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-29[PATCH] libata: kill trailing whitespaceTejun Heo1-1/+1
Kill trailing whitespace. Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: add FIXME above ata_dev_xfermask()Tejun Heo1-0/+4
Add FIXME above ata_dev_xfermask noting that the current implementation limits all transfer modes to the fastest of the slowest device on a port which isn't necessary. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: cosmetic changes in ata_bus_softreset()Tejun Heo1-5/+4
ata_bus_softreset() should return AC_ERR_* on failure not arbitrary positive number. While at it, reformat comment above it. Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24Merge branch 'upstream'Jeff Garzik1-158/+175
Conflicts: drivers/scsi/libata-core.c
2006-03-24[PATCH] libata: kill E.D.D.Tejun Heo1-85/+13
E.D.D. has no user in-tree and mostly useless. Kill it. For possible out-of-tree users, add a nice warning message and error handling if LLDD doesn't report any useable reset mechanism (and thus tries to use E.D.D.). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: Remove dependence on host_set->dev for SASBrian King1-6/+7
Remove some of the dependence on the host_set struct in preparation for supporting SAS HBAs. Adds a struct device pointer to the ata_port struct. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[libata] export ata_dev_pair; trim trailing whitespaceJeff Garzik1-24/+25
Mostly, trim trailing whitespace. Also: * export ata_dev_pair * move ata_dev_classify export closer to ata_dev_pair export
2006-03-24[PATCH] libata: add ata_dev_pair helperAlan Cox1-0/+17
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.Nigel Cunningham1-2/+3
At the moment libata doesn't pass pm_message_t down ata_device_suspend. This causes drives to be powered down when we just want a freeze, causing unnecessary wear and tear. This patch gets pm_message_t passed down so that it can be used to determine whether to power down the drive. Signed-off-by: Nigel Cunningham <nigel@suspend2.net> drivers/scsi/libata-core.c | 5 +++-- drivers/scsi/libata-scsi.c | 4 ++-- drivers/scsi/scsi_sysfs.c | 2 +- include/linux/libata.h | 4 ++-- include/scsi/scsi_host.h | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: make ata_set_mode() responsible for failure handlingTejun Heo1-20/+36
Make ata_set_mode() responsible for determining whether to take port or device offline on failure. ata_dev_set_xfermode() and ata_dev_set_mode() indicate error to the caller instead of disabling port directly on failure. Also, for consistency, ata_dev_present() check is done in ata_set_mode() instead of ata_dev_set_mode(). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: use ata_dev_disable() in ata_bus_probe()Tejun Heo1-3/+1
We may or may not disable a device after ata_dev_configure() fails. Kill 'not supported, ignoring' message in ata_dev_configure() and use ata_dev_disable() in ata_bus_probe(). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: implement ata_dev_disable()Tejun Heo1-0/+9
This patch implements ata_dev_disable() which prints a warning message and takes @dev offline. Currently, this is done by explicitly incrementing dev->class with case-by-case warning messages. Giving user clear indication when libata gives up will be more important as libata will be doing more retries. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: check if port is disabled after internal commandTejun Heo1-0/+16
libata core is being changed to disallow port/device disable on lower layers. However, some LLDDs (sata_mv) directly disable port on command failure. This patch makes ata_exec_internal() check whether a port got disabled after an internal command. If it is, AC_ERR_SYSTEM is added to err_mask and the port gets re-enabled. As internal command failure results in device disable for drivers which don't implement newer reset/EH callbacks, this change results in no behavior change for single device per port controllers. For slave-possible LLDDs which disable port on command failure, (1) such drivers don't exist currently, (2) issuing command to the other device of once-disabled port shouldn't result in catastrophe even if such driver exists. So, this should be enough as a temporary measure. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: make per-dev transfer mode limits per-devTejun Heo1-1/+1
Now that each ata_device has xfer masks, per-dev limits can be made per-dev instead of per-port. Make per-dev limits per-dev. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: add per-dev pio/mwdma/udma_maskTejun Heo1-18/+25
Add per-dev pio/mwdma/udma_mask. All transfer mode limits used to be applied to ap->*_mask which unnecessarily restricted other devices sharing the port. This change will also benefit later EH speed down and hotplug. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24[PATCH] libata: implement ata_unpack_xfermask()Tejun Heo1-0/+23
Implement ata_unpack_xfermask(). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-24Merge branch 'upstream'Jeff Garzik1-313/+119
Conflicts: drivers/scsi/sata_vsc.c
2006-03-23[libata] Move some bmdma-specific code to libata-bmdma.cJeff Garzik1-234/+0
No code changes, just moving code between files.
2006-03-22[PATCH] libata: do not ignore PIO-only devicesTejun Heo1-7/+0
As libata now can do PIO, don't ignore PIO-only devices. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-22[PATCH] libata: Symbol exportsAlan Cox1-0/+2
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-22[PATCH] Update libata DMA blacklist to cover versions, and resync with IDE layerAlan Cox1-35/+59
Not much to say here except that some drives have fixed and bad firmware Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-22[PATCH] libata: Fix a drive detection problemAlan Cox1-0/+10
The current code follows the spec but uses an overlong delay. This would be great if the hardware did. Several vendors however forget the D7 pulldown. Fortunately 0xFF isnt a sane reset state so we can use it to skip detection as is done in drivers/ide. (ie this is a tested solution over a long time) Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-22Merge branch 'master'Jeff Garzik1-1/+2
2006-03-21[libata] fix oops on non-DMA bmdma hardwareJeff Garzik1-7/+10
Alan noted: "bmdma may be zero but the bmdma_irq_clear function gets called even in this case during pure PIO operation. Check we have a bmdma before we use it." I fixed this by adding a check for zero. While was I there, I fixed the non-standard indentation of the small function's code. Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-21[PATCH] libata: make irqtrap mode compileAlan Cox1-1/+1
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>