aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-08-12libata: OCZ Vertex can't do HPATejun Heo1-0/+3
OCZ Vertex SSD can't do HPA and not in a usual way. It reports HPA, allows unlocking but then fails all IOs which fall in the unlocked area. Quirk it so that HPA unlocking is not used for the device. Reported by Daniel Perup in bnc#522414. https://bugzilla.novell.com/show_bug.cgi?id=522414 Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Daniel Perup <probe@spray.se> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-07-28libata: accept late unlocking of HPATejun Heo1-7/+23
On certain configurations, HPA isn't or can't be unlocked during probing but it somehow ends up unlocked afterwards. In the following thread, the problem can be reliably reproduced after resuming from STR. The BIOS turns on HPA during boot but forgets to do it during resume. http://thread.gmane.org/gmane.linux.kernel/858310 This patch updates libata revalidation such that it considers native n_sectors. If the device size has increased to match native n_sectors, it's assumed that HPA has been unlocked involuntarily and the device is recognized as the same one. This should be fairly safe while nicely working around the problem. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Christof Warlich <christof@warlich.name> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-07-14libata: implement and use HORKAGE_NOSETXFER, take#2Tejun Heo1-2/+18
PIONEER DVD-RW DVRTD08 times out SETXFER if no media is present. The device is SATA and simply skipping SETXFER works around the problem. Implement ATA_HORKAGE_NOSETXFER and apply it to the device. Reported by Moritz Rigler in the following thread. http://thread.gmane.org/gmane.linux.ide/36790 and by Lars in bko#9540. Updated to whine and ignore NOSETXFER if PATA component is detected as suggested by Alan Cox. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Moritz Rigler <linux-ide@momail.e4ward.com> Reported-by: Lars <lars21ce@gmx.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-06-23libata: don't set IORDY for resetTejun Heo1-4/+9
Before issuing reset, libata configures xfermode to PIO0 which makes some drivers turn on IORDY which may cause the controller to lock up if the port is not occupied. IORDY isn't necessary at this point anyway. Make ata_pio_need_iordy() return zero if it's being called for reset. This fixes bko#11703. Reported and tracked down by Daniel Gnoutcheff and Constantine Gavrilov. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Daniel Gnoutcheff <gnoutchd@union.edu> Cc: Constantine Gavrilov <constantine.gavrilov@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-06-23[libata] beautify module parametersEvgeni Golov1-6/+6
1. add defaults to description where possible 2. add value definition (off=0, on=1) where missing v2: reformatted as per request by Jeff Garzik <jgarzik@pobox.com> "Enable foo (0=off, 1=on [default])" Signed-off-by: Evgeni Golov <sargentd@die-welt.net> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-06-10[libata] get rid of ATA_MAX_QUEUE loop in ata_qc_complete_multiple() v2Jens Axboe1-6/+5
We very rarely (if ever) complete more than one command in the sactive mask at the time, even for extremely high IO rates. So looping over the entire range of possible tags is pointless, instead use __ffs() to just find the completed tags directly. Updated to clear the tag from the done_mask instead of shifting done_mask down as suggested by From: Tejun Heo <htejun@gmail.com> Verified with a user space tester to produce the same results. Signed-off-by: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-05-11libata: fix suspend/resume for ATA SEMB devicesBorislav Petkov1-1/+3
79b42babbac2a5a522b8e269fb2811b6e1063030 fixed identifying ATA devices reporting 3c/c3 signature which belongs to SEMB devices now. However, suspending the machine with such device (WDC WD2500AAJS-6 01.0) fails with the following: hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4 hda: UDMA/100 mode selected hdb: host max PIO4 wanted PIO255(auto-tune) selected PIO4 hdb: UDMA/66 mode selected sd 1:0:0:0: [sda] Starting disk ata5: SATA link down (SStatus 0 SControl 300) ata1: SATA link down (SStatus 0 SControl 300) ata3: SATA link down (SStatus 0 SControl 300) ata6: SATA link down (SStatus 0 SControl 300) ata2: softreset failed (device not ready) ata2: failed due to HW bug, retry pmp=0 ata4: softreset failed (device not ready) ata4: failed due to HW bug, retry pmp=0 ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300) ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300) ata2.00: class mismatch 1 != 7 ata2.00: revalidation failed (errno=-19) ata2: limiting SATA link speed to 1.5 Gbps ata4.00: configured for UDMA/133 ata2: softreset failed (device not ready) ata2: failed due to HW bug, retry pmp=0 ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 310) ata2.00: class mismatch 1 != 7 ata2.00: revalidation failed (errno=-19) ata2.00: disabled sd 1:0:0:0: rejecting I/O to offline device sd 1:0:0:0: [sda] START_STOP FAILED sd 1:0:0:0: [sda] Result: hostbyte=0x01 driverbyte=0x00 PM: Device 1:0:0:0 failed to thaw: error 65536 sd 3:0:0:0: [sdb] Starting disk due to a class mismatch in ata_dev_revalidate(). Fix it by adding the ATA_DEV_SEMB device class to the check. CC: Tejun Heo <htejun@gmail.com> Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-04-16libata: use ATA_ID_CFA_*Sergei Shtylyov1-3/+4
Use ATA_ID_CFA_* constants for CFA specific identify data words 162 and 163. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-04-16libata: handle SEMB signature betterTejun Heo1-2/+16
WDC WD1600JS-62MHB5 successfully hits the window between ATA/ATAPI-7 and Serial ATA II standards and reports 3c/c3 signature which now is assigned to SEMB. Make ata_dev_classify() report ATA_DEV_SEMB on the sig and let ata_dev_read_id() work around it by trying IDENTIFY once. This fixes bko#11579. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: David Haun <drhaun88@gmail.com> Reported-by: Lars Wirzenius <liw@liw.fi> Reported-by: Juan Manuel <jmcarranza@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-04-13ata: fix obviously wrong commentVegard Nossum1-3/+1
Also remove the now-useless debug printouts which are supposed to tell us when the scan starts and ends. Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-03-24[libata] More robust parsing for IDENTIFY DEVICE multi_count fieldMark Lord1-2/+11
Make libata more robust when parsing the multi_count field from a drive's identify data. This prevents us from attempting to use dubious multi_count values ad infinitum. Reset dev->multi_count to zero and reprobe it each time through this routine, as it can change on device reset. Also ensure that the reported "maximum" value is valid and is a power of two, and that the reported "count" value is valid and also a power of two. And that the "count" value is not greater than the "maximum" value. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-03-24[libata] Export ata_pio_queue_task() so that it can be used from sata_mv.Mark Lord1-0/+1
Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-03-05libata: Don't trust current capacity values in identify words 57-58Robert Hancock1-4/+6
Hanno Böck reported a problem where an old Conner CP30254 240MB hard drive was reported as 1.1TB in capacity by libata: http://lkml.org/lkml/2009/2/13/134 This was caused by libata trusting the drive's reported current capacity in sectors in identify words 57 and 58 if the drive does not support LBA and the current CHS translation values appear valid. Unfortunately it seems older ATA specs were vague about what this field should contain and a number of drives used values with wrong byte order or that were totally bogus. There's no unique information that it conveys and so we can just calculate the number of sectors from the reported current CHS values. While we're at it, clean up this function to use named constants for the identify word values. Signed-off-by: Robert Hancock <hancockrwd@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-03-05libata: fix dma_unmap_sg misuseFUJITA Tomonori1-2/+2
libata passes the returned value of dma_map_sg() to dma_unmap_sg(),which is the misuse of dma_unmap_sg(). DMA-mapping.txt says: To unmap a scatterlist, just call: pci_unmap_sg(pdev, sglist, nents, direction); Again, make sure DMA activity has already finished. PLEASE NOTE: The 'nents' argument to the pci_unmap_sg call must be the _same_ one you passed into the pci_map_sg call, it should _NOT_ be the 'count' value _returned_ from the pci_map_sg call. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-02-02libata: implement HORKAGE_1_5_GBPS and apply it to WD My BookTejun Heo1-0/+41
3Gbps is often much more prone to transmission failures. It's usually okay to let EH handle speed down after transmission failures but some WD My Book drives completely shutdown after certain transmission failures and after it only power cycling can revive them. Combined with the fact that external drives often end up with cable assembly which is longer than usual and more likely to have intervening gender, this makes these drives very likely to shutdown under certain configurations virtually rendering them unusable. This patch implements HOARKGE_1_5_GBPS and applies it to WD My Book such that 1.5Gbps is forced once the device is identified. Please take a look at the following bz for related reports. http://bugzilla.kernel.org/show_bug.cgi?id=9913 Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-02-02libata: add @spd_limit to sata_down_spd_limit()Tejun Heo1-5/+20
Add @spd_limit to sata_down_spd_limit() so that the caller can specify the SPD limit it wants. This parameter doesn't get in the way even when it's too low. The closest possible limit is applied. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-02-02libata: clear dev->ering in smarter wayTejun Heo1-2/+2
dev->ering used to be cleared together with the rest of ata_device in ata_dev_init() which is called whenever a probing event occurs. dev->ering is about to be used to track probing failures so it needs to remain persistent over multiple porbing events. This patch achieves this by doing the following. * Instead of CLEAR_OFFSET, define CLEAR_BEGIN and CLEAR_END and only clear between BEGIN and END. ering is moved after END. The split of persistent area is to allow hotter items remain at the head. * ering is explicitly cleared on ata_dev_disable() and when device attach succeeds. So, ering is persistent throug a device's life time (unless explicitly cleared of course) and also through periods inbetween disablement of an attached device and successful detection of the next one. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-02-02libata: check onlineness before using SPD in sata_down_spd_limit()Tejun Heo1-3/+8
sata_down_spd_limit() should check whether the link is online before using the SPD value to determine how to limit the link speed. Factor out onlineness test and test it from sata_down_spd_limit(). Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-02-02libata: move ata_dev_disable() to libata-eh.cTejun Heo1-12/+0
ata_dev_disable() is about to be more tightly integrated into EH logic. Move it to libata-eh.c. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-02-02libata: fix kernel-doc warningsRandy Dunlap1-2/+1
Fix libata kernel-doc warnings: Warning(linux-next-20090120//drivers/ata/libata-core.c:4720): Excess function parameter 'dev' description in 'ata_qc_new' Warning(linux-next-20090120//drivers/ata/libata-scsi.c:428): No description found for parameter 'ap' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-01-16libata: Add another column to the ata_timing table.David Daney1-35/+37
The forthcoming OCTEON SOC Compact Flash driver needs an additional timing value that was not available in the ata_timing table. I add a new column for dmack_hold time. The values were obtained from the Compact Flash specification Rev 4.1. Signed-off-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-01-16[libata] get-identity ioctl: Fix use of invalid memory pointerJeff Garzik1-1/+0
for SAS drivers. Caught by Ke Wei (and team?) at Marvell. Also, move the ata_scsi_ioctl export to libata-scsi.c, as that seems to be the general trend. Acked-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-01-10libata: only ports >= 0 need to synchronizeArjan van de Ven1-1/+3
In a discussio with Jeff Garzik, he mentioned that the serialization for the libata port probes only needs to be within the domain of a host. This means that for the first port of each host (with ID 0), we don't need to wait, so we can relax our serialization a little. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-10libata: Add a per-host flag to opt-in into parallel port probesArjan van de Ven1-0/+9
This patch adds a per host flag that allows drivers to opt in into having its busses scanned in parallel. Drivers that do not set this flag get their ports scanned in the "original" sequence. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-09libata: use WARN_ON_ONCE on hot pathsTejun Heo1-8/+8
Convert WARN_ON() on command issue/completion paths to WARN_ON_ONCE() so that libata doesn't spam the machine even when one of those conditions triggers repeatedly. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-08libata: Add special ata_pio_need_iordy() handling for Compact Flash.David Daney1-0/+4
According to the Compact Flash specification r4.1, PIO modes 5 and 6 do not use iordy. Signed-off-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-01-08[libata] ahci: Add SATA GEN3 related messagesShane Huang1-0/+1
The present AHCI driver seems to support SATA GEN 3 speed, but the related messages should be modified. Signed-off-by: Shane Huang <shane.huang@amd.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-01-07fastboot: Make libata initialization even more asyncArjan van de Ven1-9/+7
As suggested by Linus: Don't do the libata init in 2 separate steps with a global sync inbetween, but do it as one async step, with a local sync before registering the device. This cuts the boottime on my machine with 2 sata controllers down significantly, and it seems to work. Would be nice if the libata folks take a good look at this patch though.. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
2009-01-07fastboot: make the libata port scan asynchronousArjan van de Ven1-38/+46
This patch makes the libata port scanning asynchronous (per device). There is a synchronization point before doing the actual disk scan so that device ordering is not affected. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
2008-12-29libata: blacklist NCQ on OCZ CORE 2 SSD (resend)Lubomir Bulej1-0/+1
The patchlet below blacklists NCQ on OCZ CORE v2 SSD drive(s). Even though the drive advertises NCQ support with queue depth 1, it responds with all-zeroes FIS to NCQ commands which triggers ata error handling several times before the kernel decides to disable NCQ on the drive. Signed-off-by: Lubomir Bulej <lubomir.bulej@dsrg.mff.cuni.cz> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-12-28[libata] Update kernel-doc comments to match source codeQinghuang Feng1-1/+0
Signed-off-by: Qinghuang Feng <qhfeng.kernel@gmail.com>
2008-12-28libata: perform port detach in EHTejun Heo1-19/+4
ata_port_detach() first made sure EH saw ATA_PFLAG_UNLOADING and then assumed EH context belongs to it and performed detach operation itself. However, UNLOADING doesn't disable all of EH and this could lead to problems including triggering WARN_ON()'s in EH path. This patch makes port detach behave more like other EH actions such that ata_port_detach() requests EH to detach and waits for completion. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-12-28libata: when restoring SControl during detach do the PMP links firstTejun Heo1-1/+1
When restoring SControl during detach, PMP links should be handled first as changing SControl of the host link can affect SCR access of PMP links. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-12-28libata: beef up iteratorsTejun Heo1-61/+122
There currently are the following looping constructs. * __ata_port_for_each_link() for all available links * ata_port_for_each_link() for edge links * ata_link_for_each_dev() for all devices * ata_link_for_each_dev_reverse() for all devices in reverse order Now there's a need for looping construct which is similar to __ata_port_for_each_link() but iterates over PMP links before the host link. Instead of adding another one with long name, do the following cleanup. * Implement and export ata_link_next() and ata_dev_next() which take @mode parameter and can be used to build custom loop. * Implement ata_for_each_link() and ata_for_each_dev() which take looping mode explicitly. The following iteration modes are implemented. * ATA_LITER_EDGE : loop over edge links * ATA_LITER_HOST_FIRST : loop over all links, host link first * ATA_LITER_PMP_FIRST : loop over all links, PMP links first * ATA_DITER_ENABLED : loop over enabled devices * ATA_DITER_ENABLED_REVERSE : loop over enabled devices in reverse order * ATA_DITER_ALL : loop over all devices * ATA_DITER_ALL_REVERSE : loop over all devices in reverse order This change removes exlicit device enabledness checks from many loops and makes it clear which ones are iterated over in which direction. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-12-16libata: fix Seagate NCQ+FLUSH blacklistTejun Heo1-6/+59
Due to miscommunication, P/N was mistaken as firmware revision strings. Update it. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-12-01libata: blacklist Seagate drives which time out FLUSH_CACHE when used with NCQTejun Heo1-0/+21
Some recent Seagate harddrives have firmware bug which causes FLUSH CACHE to timeout under certain circumstances if NCQ is being used. This can be worked around by disabling NCQ and fixed by updating the firmware. Implement ATA_HORKAGE_FIRMWARE_UPDATE and blacklist these devices. The wiki page has been updated to contain information on this issue. http://ata.wiki.kernel.org/index.php/Known_issues Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-11libata: Avoid overflow in ata_tf_read_block() when tf->hba_lbal > 127Roland Dreier1-1/+1
Phillip O'Donnell <phillip.odonnell@gmail.com> pointed out that the same sign extension bug that was fixed in commit ba14a9c2 ("libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127") also appears to exist in ata_tf_read_block(). Fix this by adding a cast to u64. Signed-off-by: Roland Dreier <rolandd@cisco.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-10libata: revert convert-to-block-tagging patchesTejun Heo1-6/+60
This patch reverts the following three commits which convert libata to use block layer tagging. 43a49cbdf31e812c0d8f553d433b09b421f5d52c e013e13bf605b9e6b702adffbe2853cfc60e7806 2fca5ccf97d2c28bcfce44f5b07d85e74e3cd18e Although using block layer tagging is the right direction, due to the tight coupling among tag number, data structure allocation and hardware command slot allocation, libata doesn't work correctly with the current conversion. The biggest problem is guaranteeing that tag 0 is always used for non-NCQ commands. Due to the way blk-tag is implemented and how SCSI starts and finishes requests, such guarantee can't be made. I'm not sure whether this would actually break any low level driver but it doesn't look like a good idea to break such assumption given the frailty of ATA controllers. So, for the time being, keep using the old dumb in-libata qc allocation. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Jens Axobe <jens.axboe@oracle.com> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-04libata: mask off DET when restoring SControl for detachTejun Heo1-1/+1
libata restores SControl on detach; however, trying to restore non-zero DET can cause undeterministic behavior including PMP device going offline till power cycling. Mask off DET when restoring SControl. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-04libata: implement ATA_HORKAGE_ATAPI_MOD16_DMA and apply itTejun Heo1-1/+3
libata always uses PIO for ATAPI commands when the number of bytes to transfer isn't multiple of 16 but quantum DAT72 chokes on odd bytes PIO transfers. Implement a horkage to skip the mod16 check and apply it to the quantum device. This is reported by John Clark in the following thread. http://thread.gmane.org/gmane.linux.ide/34748 Signed-off-by: Tejun Heo <tj@kernel.org> Cc: John Clark <clarkjc@runbox.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-10-31libata: add whitelist for devices with known good pata-sata bridgesJens Axboe1-0/+7
libata currently imposes a UDMA5 max transfer rate and 200 sector max transfer size for SATA devices that sit behind a pata-sata bridge. Lots of devices have known good bridges that don't need this limit applied. The MTRON SSD disks are such devices. Transfer rates are increased by 20-30% with the restriction removed. So add a "blacklist" entry for the MTRON devices, with a flag indicating that the bridge is known good. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-10-31libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127Roland Dreier1-1/+1
In ata_tf_to_lba48(), when evaluating (tf->hob_lbal & 0xff) << 24 the expression is promoted to signed int (since int can hold all values of u8). However, if hob_lbal is 128 or more, then it is treated as a negative signed value and sign-extended when promoted to u64 to | into sectors, which leads to the MSB 32 bits of section getting set incorrectly. For example, Phillip O'Donnell <phillip.odonnell@gmail.com> reported that a 1.5GB drive caused: ata3.00: HPA detected: current 2930277168, native 18446744072344861488 where 2930277168 == 0xAEA87B30 and 18446744072344861488 == 0xffffffffaea87b30 which shows the problem when hob_lbal is 0xae. Fix this by adding a cast to u64, just as is used by for hob_lbah and hob_lbam in the function. Reported-by: Phillip O'Donnell <phillip.odonnell@gmail.com> Signed-off-by: Roland Dreier <rolandd@cisco.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-10-31ATA: remove excess kernel-doc notationRandy Dunlap1-2/+0
Remove excess kernel-doc function parameter notation from drivers/ata/: Warning(drivers/ata/libata-core.c:1622): Excess function parameter or struct member 'fn' description in 'ata_pio_queue_task' Warning(drivers/ata/libata-core.c:4655): Excess function parameter or struct member 'err_mask' description in 'ata_qc_complete' Warning(drivers/ata/ata_piix.c:751): Excess function parameter or struct member 'udma' description in 'do_pata_set_dmamode' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-10-27libata: add missing kernel-docRandy Dunlap1-0/+1
Fix libata missing kernel-doc: Warning(lin2628-rc2//drivers/ata/libata-core.c:4562): No description found for parameter 'tag' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-10-27libata: fix device iteration bugsTejun Heo1-15/+19
There were several places where only enabled devices should be iterated over but device enabledness wasn't checked. * IDENTIFY data 40 wire check in cable_is_40wire() * xfer_mode/ncq_enabled saving in ata_scsi_error() * DUBIOUS_XFER handling in ata_set_mode() While at it, reformat comments in cable_is_40wire(). Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-10-23libata: switch to using block layer tagging supportJens Axboe1-60/+6
libata currently has a pretty dumb ATA_MAX_QUEUE loop for finding a free tag to use. Instead of fixing that up, convert libata to using block layer tagging - gets rid of code in libata, and is also much faster. Signed-off-by: Jens Axboe <jens.axboe@oracle.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-22libata: initialize port_task when !CONFIG_ATA_SFFTejun Heo1-0/+2
ap->port_task was not initialized if !CONFIG_ATA_SFF later triggering lockdep warning. Make sure it's initialized. Reported by Larry Finger. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-09-29libata: Implement disk shock protection supportElias Oltmanns1-0/+1
On user request (through sysfs), the IDLE IMMEDIATE command with UNLOAD FEATURE as specified in ATA-7 is issued to the device and processing of the request queue is stopped thereafter until the specified timeout expires or user space asks to resume normal operation. This is supposed to prevent the heads of a hard drive from accidentally crashing onto the platter when a heavy shock is anticipated (like a falling laptop expected to hit the floor). In fact, the whole port stops processing commands until the timeout has expired in order to avoid any resets due to failed commands on another device. Signed-off-by: Elias Oltmanns <eo@nebensachen.de> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-09-29libata: implement slave_linkTejun Heo1-23/+179
Explanation taken from the comment of ata_slave_link_init(). In libata, a port contains links and a link contains devices. There is single host link but if a PMP is attached to it, there can be multiple fan-out links. On SATA, there's usually a single device connected to a link but PATA and SATA controllers emulating TF based interface can have two - master and slave. However, there are a few controllers which don't fit into this abstraction too well - SATA controllers which emulate TF interface with both master and slave devices but also have separate SCR register sets for each device. These controllers need separate links for physical link handling (e.g. onlineness, link speed) but should be treated like a traditional M/S controller for everything else (e.g. command issue, softreset). slave_link is libata's way of handling this class of controllers without impacting core layer too much. For anything other than physical link handling, the default host link is used for both master and slave. For physical link handling, separate @ap->slave_link is used. All dirty details are implemented inside libata core layer. From LLD's POV, the only difference is that prereset, hardreset and postreset are called once more for the slave link, so the reset sequence looks like the following. prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) -> softreset(M) -> postreset(M) -> postreset(S) Note that softreset is called only for the master. Softreset resets both M/S by definition, so SRST on master should handle both (the standard method will work just fine). As slave_link excludes PMP support and only code paths which deal with the attributes of physical link are affected, all the changes are localized to libata.h, libata-core.c and libata-eh.c. * ata_is_host_link() updated so that slave_link is considered as host link too. * iterator extended to iterate over the slave_link when using the underbarred version. * force param handling updated such that devno 16 is mapped to the slave link/device. * ata_link_on/offline() updated to return the combined result from master and slave link. ata_phys_link_on/offline() are the direct versions. * EH autopsy and report are performed separately for master slave links. Reset is udpated to implement the above described reset sequence. Except for reset update, most changes are minor, many of them just modifying dev->link to ata_dev_phys_link(dev) or using phys online test instead. After this update, LLDs can take full advantage of per-dev SCR registers by simply turning on slave link. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-09-29libata: misc updates to prepare for slave linkTejun Heo1-8/+8
* Add ATA_EH_ALL_ACTIONS. * Make sata_link_{on|off}_line() return bool instead of int. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>