aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/libata-core.c
AgeCommit message (Collapse)Author
2006-06-23[libata] conversion to new debug scheme, part 1 of $NBorislav Petkov
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 Garzik
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 Lee
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 Garzik
Conflicts: drivers/scsi/libata-core.c drivers/scsi/libata-scsi.c include/linux/pci_ids.h
2006-06-19Improve SATA core suspend/resumeLinus Torvalds
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 Garzik
2006-06-12[PATCH] libata: add host_set->next for legacy two host_sets case, take #3Tejun Heo
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 Heo
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, forrest
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 Garzik
Suggested by Jarek P.
2006-06-11[PATCH] libata: Setup nbytes in ata_sg_init_oneBrian King
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 Petkov
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
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 Petkov
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 Garzik
Conflicts: drivers/scsi/libata-core.c
2006-05-28[PATCH] the latest consensus libata resume fixMark Lord
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 Cox
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 Cox
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 Cox
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 Garzik
Conflicts: drivers/scsi/libata-core.c
2006-05-24[PATCH] libata: add pio flush for via atapi (was: Re: TR: ASUS A8V Deluxe, ↵Albert Lee
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 Lee
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 Lee
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 Garzik
Conflicts: drivers/scsi/libata-core.c
2006-05-20[PATCH] libata-core: fix current kernel-doc warningsRandy Dunlap
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 Heo
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 Heo
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 Heo
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 Heo
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 Heo
* 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 Heo
Conflicts: drivers/scsi/libata-core.c include/linux/libata.h
2006-05-15[PATCH] libata-eh: implement BMDMA EHTejun Heo
Implement stock BMDMA error handling methods. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-05-15[PATCH] libata-eh: implement new EHTejun Heo
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 Heo
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 Heo
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 Heo
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>