aboutsummaryrefslogtreecommitdiff
path: root/drivers/ata/libata-scsi.c
AgeCommit message (Collapse)Author
2007-10-23[libata] checkpatch-inspired cleanupsJeff Garzik
Tackle the relatively sane complaints of checkpatch --file. The vast majority is indentation and whitespace changes, the rest are * #include fixes * printk KERN_xxx prefix addition * BSS/initializer cleanups Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-22[SG] Update drivers to use sg helpersJens Axboe
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-16Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-blockLinus Torvalds
* 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block: (63 commits) Fix memory leak in dm-crypt SPARC64: sg chaining support SPARC: sg chaining support PPC: sg chaining support PS3: sg chaining support IA64: sg chaining support x86-64: enable sg chaining x86-64: update pci-gart iommu to sg helpers x86-64: update nommu to sg helpers x86-64: update calgary iommu to sg helpers swiotlb: sg chaining support i386: enable sg chaining i386 dma_map_sg: convert to using sg helpers mmc: need to zero sglist on init Panic in blk_rq_map_sg() from CCISS driver remove sglist_len remove blk_queue_max_phys_segments in libata revert sg segment size ifdefs Fixup u14-34f ENABLE_SG_CHAINING qla1280: enable use_sg_chaining option ...
2007-10-16remove blk_queue_max_phys_segments in libataFUJITA Tomonori
LIBATA_MAX_PRD is the maximum number of DMA scatter/gather elements permitted by the HBA's DMA engine. It's properly set to q->max_hw_segments via the sg_tablesize parameter. libata shouldn't call blk_queue_max_phys_segments. Now LIBATA_MAX_PRD is equal to SCSI_MAX_PHYS_SEGMENTS by default (both is 128), so everything is fine. But if they are changed, some code (like the scsi mid layer, sg chaining, etc) might not work properly. (Addition from Jens) The basic issue is that the physical segment setting is purely a driver issue. And since SCSI is managing the sglist, libata has no business changing the setting. All libata should care about is the hw segment setting. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-15docbook: fix libata contentRandy Dunlap
Fix libata docbook warnings. Warning(linux-2.6.23-git8//drivers/ata/libata-scsi.c:3251): No description found for parameter 'dev' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-15libata: fix revalidation issuing after configuration commandsTejun Heo
After commands which can change device configuration, EH is scheduled to revalidate and reconfigure the device. Host link was incorrectly used unconditionally when scheduling EH action. This resulted in bogus revalidation request and mismatched configuration between device and driver. Fix it. This bug was reported by Igor Durdanovic. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Igor Durdanovic <idurdanovic@comcast.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata_scsi: Fix ATAPI transfer lengthsAlan Cox
Some controller variants snoop the ATAPI length value for Packet transfers to do state machine and FIFO management. Thus we want to set it properly, even for cases where it is otherwise meaningless. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-pmp-prep: implement sata_async_notification()Tejun Heo
AN serves multiple purposes. For ATAPI, it's used for media change notification. For PMP, for downstream PHY status change notification. Implement sata_async_notification() which demultiplexes AN. To avoid unnecessary port events, ATAPI AN is not enabled if PMP is attached but SNTF is not available. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-pmp-prep: implement ATA_HORKAGE_SKIP_PMTejun Heo
Some pseudo devices fail PM commands unnecessarily aborting system suspend. Implement ATA_HORKAGE_SKIP_PM which makes libata skip PM commands for these devices. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-pmp-prep: implement ops->qc_defer()Tejun Heo
Controllers which support PMP have various restrictions on which combinations of commands are allowed to what number of devices concurrently. This patch implements ops->qc_defer() which determines whether a qc can be issued at the moment or should be deferred. If the function returns ATA_DEFER_LINK, the qc will be deferred until a qc completes on the link. If ATA_DEFER_PORT, until a qc completes on any link. The defer conditions are advisory and in general ATA_DEFER_LINK can be considered as lower priority deferring than ATA_DEFER_PORT. ops->qc_defer() replaces fixed ata_scmd_need_defer(). For standard NCQ/non-NCQ exclusion, ata_std_qc_defer() is implemented. ahci and sata_sil24 are converted to use ata_std_qc_defer(). ops->qc_defer() is heavier than the original mechanism because full qc is prepped before determining to defer it, but various information is needed to determine defer conditinos and fully translating a qc is the only way to supply such information in generic manner. IMHO, this shouldn't cause any noticeable performance issues as * for most cases deferring occurs rarely (except for NCQ-aware cmd-switching PMP) * translation itself isn't that expensive * once deferred the command won't be repeated until another command completes which usually is a very long time cpu-wise. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata: misc updates for ANTejun Heo
Update AN support in preparation of PMP support. * s/ata_id_has_AN/ata_id_has_atapi_AN/ * add AN enabled reporting during configuration * add err_mask to AN configuration failure reporting * update LOCKING comment for ata_scsi_media_change_notify() * check whether ATA dev is attached to SCSI dev ata_scsi_media_change_notify() * set ATA_FLAG_AN in ahci and sata_sil24 Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12[libata] SCSI: simulator version, not device version, belongs in VPDJeff Garzik
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12[libata] SCSI: clean up R/W recovery mode pageJeff Garzik
Clear ARRE, we don't do auto-reallocation on reads, just on writes. Also, hardcode the size of the array using RW_RECOVERY_MPAGE_LEN, following the style of the surrounding code. Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12[libata] SCSI: improve FORMAT UNIT; minor code cleanupsJeff Garzik
* SAT specifies that FORMAT UNIT should be translated into a series of READ and WRITE commands that zero the ATA device. That is far too cumbersome to bother with. Since we don't actually format the device, the old behavior of always returning success was inaccurate. Change FORMAT UNIT from returning success immediately (old behavior) to always returning an error (new behavior). * Add some comments around SYNCHRONIZE CACHE * Shuffle scsi command code around a bit, so that things are close to alphabetic order. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-12[libata] Slightly improved no-op REQUEST SENSE, SEND DIAGNOSTICJeff Garzik
A few pedantic apps care about missing or lame "mandatory" SCSI commands, so REQUEST SENSE -- as we autosense, R.S. just returns zeroes SEND DIAGNOSTIC -- our default (no-op) self-test succeeds, all other requests for testing fail. Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12[libata] SCSI: support INQUIRY page 89h (ATA info page)Jeff Garzik
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-scsi: convert to use the data buffer accessorsBoaz Harrosh
simple search-and-replace of direct scsi_cmnd access to use the data buffer accessors. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-scsi: Remove !use_sg code pathsBoaz Harrosh
This is a minimal patch needed to remove use of !use_sg but it is not a complete clean up of the !use_sg paths. Libata-core still has the qc->flags & ATA_QCFLAG_SG and !qc->n_elem code paths. Perhaps an ata maintainer would have a go at it. - TODO: further cleanup of qc->flags & ATA_QCFLAG_SG and !qc->n_elem code paths in libata-core - TODO: Use scsi_dma_{map,unmap} where applicable. Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12[libata] ahci: send event when AN receivedKristen Carlson Accardi
When we get an SDB FIS with the 'N' bit set, we should send an event to user space to indicate that there has been a media change. This will be done via the scsi device. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata: add support for ATA_16 on ATAPIMark Lord
Add support for issuing ATA_16 passthru commands to ATAPI devices managed by libata. It requires the previous CDB length fix patch. A boot/module parameter, "atapi_passthru16=0" can be used to globally disable this feature, if ever desired. tj: restructured __ata_scsi_queuecmd() according to Jeff's suggestion. Signed-off-by: Mark Lord <liml@rtr.ca> Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-link: update hotplug to handle PMP linksTejun Heo
Update hotplug to handle PMP links. When PMP is attached, the PMP number corresponds to C of SCSI H:C:I:L. While at it, change argument to ata_find_dev() to @devno from @id to avoid confusion with SCSI device ID. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-link: implement and use link/device iteratorsTejun Heo
Multiple links and different number of devices per link should be considered to iterate over links and devices. This patch implements and uses link and device iterators - ata_port_for_each_link() and ata_link_for_each_dev() - and ata_link_max_devices(). This change makes a lot of functions iterate over only possible devices instead of from dev 0 to dev ATA_MAX_DEVICES. All such changes have been examined and nothing should be broken. While at it, add a separating comment before device helpers to distinguish them better from link helpers and others. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-link: introduce ata_linkTejun Heo
Introduce ata_link. It abstracts PHY and sits between ata_port and ata_device. This new level of abstraction is necessary to support SATA Port Multiplier, which basically adds a bunch of links (PHYs) to a ATA host port. Fields related to command execution, spd_limit and EH are per-link and thus moved to ata_link. This patch only defines the host link. Multiple link handling will be added later. Also, a lot of ap->link derefences are added but many of them will be removed as each part is converted to deal directly with ata_link instead of ata_port. This patch introduces no behavior change. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-07-24[BLOCK] Get rid of request_queue_t typedefJens Axboe
Some of the code has been gradually transitioned to using the proper struct request_queue, but there's lots left. So do a full sweet of the kernel and get rid of this typedef and replace its uses with the proper type. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-07-20libata: improve SCSI scan failure handlingTejun Heo
SCSI scan may fail due to memory allocation failure even if EH is not in progress. Due to use of GFP_ATOMIC in SCSI scan path, allocation failure isn't too rare especially while probing multiple devices at once which is the case when a bunch of devices are connected to PMP. This patch moves SCSI scan failure detetion logic from ata_scsi_hotplug() to ata_scsi_scan_host() and implement synchronous scan behavior. The synchronous path sleeps briefly and repeats SCSI scan if some devices aren't attached properly. It contains robust retry loop to minimize the chance of device misdetection during boot and falls back to async retry if everything fails. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-07-09libata: Support chips with 64K PRD quirkAlan Cox
Add ata_dumb_qc_prep and supporting logic so that a driver can just specify it needs to be helped in this area. 64K entries are split as with drivers/ide. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-06-27libata: call ata_check_atapi_dma() with qc better preparedTejun Heo
In atapi_xlat(), prepare qc better before calling ata_check_atapi_dma() such that ata_check_atapi_dma() can use info from qc. While at it, reformat weird looking if/else block in the function. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-06-09libata passthru: update cached device paramtersAlbert Lee
INIT_DEV_PARAMS and SET_MULTI_MODE change the device parameters cached by libata. Re-read IDENTIFY DEVICE info and update the cached device paramters when seeing these commands. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-06-09libata passthru: always enforce correct DEV bitAlbert Lee
Always enforce correct DEV bit since we know which drive the command is targeted. SAT demands to ignore the DEV bit, too. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-06-09libata passthru: map UDMA protocolsAlbert Lee
Map the ATA passthru UDMA protocols to ATA_PROT_DMA. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-06-09libata passthru: support PIO multi commandsAlbert Lee
support the pass through of PIO multi commands. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-06-09libata passthru: update protocol numbersAlbert Lee
Update the ATA passthru protocol numbers according to the new spec. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-25[libata] Fix decoding of 6-byte commandsJeff Garzik
The code for parsing 6-byte SCSI command LBAs missed the top 5 bits (the MSB). Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-17libata: remove libata.spindown_compatTejun Heo
With STANDBYDOWN tracking added, libata.spindown_compat isn't necessary anymore. If userspace shutdown(8) issues STANDBYNOW, libata warns. If userspace shutdown(8) doesn't issue STANDBYNOW, libata does the right thing. Userspace can tell whether kernel supports spindown by testing whether sysfs node manage_start_stop exists as before. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-16libata: track spindown status and skip spindown_compat if possibleTejun Heo
Our assumption that most distros issue STANDBYNOW seems wrong. The upstream sysvinit and thus many distros including gentoo and opensuse don't take any action for libata disks on spindown. We can skip compat handling for these distros so that they don't need to update anything to take advantage of kernel-side shutdown. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-16libata: fix shutdown warning message printingTejun Heo
Unlocking ap->lock and ssleeping don't work because SCSI commands can be issued from completion path without context. Reimplement delayed completion by allowing translation functions to override qc->scsidone(), storing the original completion function to scmd->scsi_done() and overriding qc->scsidone() with a function which schedules delayed invocation of scmd->scsi_done(). This isn't pretty at all but all the ugly parts are thankfully contained in the stop translation path where the compat feature is implemented. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-11libata: implement libata.spindown_compatTejun Heo
Now that libata uses sd->manage_start_stop, libata spins down disk on shutdown. In an attempt to compensate libata's previous shortcoming, some distros sync and spin down disks attached via libata in their shutdown(8). Some disks spin back up just to spin down again on STANDBYNOW1 if the command is issued when the disk is spun down, so this double spinning down causes problem. This patch implements module parameter libata.spindown_compat which, when set to one (default value), prevents libata from spinning down disks on shutdown thus avoiding double spinning down. Note that libata spins down disks for suspend to mem and disk, so with libata.spindown_compat set to one, disks should be properly spun down in all cases without modifying shutdown(8). shutdown(8) should be fixed eventually. Some drive do spin up on SYNCHRONZE_CACHE even when their cache is clean. Those disks currently spin up briefly when sd tries to shutdown the device and then the machine powers off immediately, which can't be good for the head. We can't skip SYNCHRONIZE_CACHE during shudown as it can be dangerous data integrity-wise. So, this spindown_compat parameter is already scheduled for removal by the end of the next year and here's what shutdown(8) should do. * Check whether /sys/modules/libata/parameters/spindown_compat exists. If it does, write 0 to it. * For each libata harddisk { * Check whether /sys/class/scsi_disk/h:c:i:l/manage_start_stop exists. Iff it doesn't, synchronize cache and spin the disk down as before. } The above procedure will make shutdown(8) work properly with kernels before this change, ones with this workaround and later ones without it. To accelerate shutdown(8) updates, if the compat mode is in use, this patch prints BIG FAT warning for five seconds during shutdown (the optimal interval to annoy the user just the right amount discovered by hours of tireless usability testing). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-05-11libata: reimplement suspend/resume support using sdev->manage_start_stopTejun Heo
Reimplement suspend/resume support using sdev->manage_start_stop. * Device suspend/resume is now SCSI layer's responsibility and the code is simplified a lot. * DPM is dropped. This also simplifies code a lot. Suspend/resume status is port-wide now. * ata_scsi_device_suspend/resume() and ata_dev_ready() removed. * Resume now has to wait for disk to spin up before proceeding. I couldn't find easy way out as libata is in EH waiting for the disk to be ready and sd is waiting for EH to complete to issue START_STOP. * sdev->manage_start_stop is set to 1 in ata_scsi_slave_config(). This fixes spindown on shutdown and suspend-to-disk. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-28libata: separate out ata_host_alloc() and ata_host_register()Tejun Heo
Reorganize ata_host_alloc() and its subroutines into the following three functions. * ata_host_alloc() : allocates host and its ports. shost is not registered automatically. * ata_scsi_add_hosts() : allocates and adds shosts associated with an ATA host. Used by ata_host_register(). * ata_host_register() : takes a fully initialized ata_host structure and registers it to libata layer and probes it. Only ata_host_alloc() and ata_host_register() are exported. ata_device_add() is rewritten using the above functions. This patch does not introduce any observable behavior change. Things worth mentioning. * print_id is assigned at registration time and LLDs are allowed to overallocate ports and reduce host->n_ports during initialization. ata_host_register() will throw away unused ports automatically. * All SCSI host initialization stuff now resides in ata_scsi_add_hosts() in libata-scsi.c, where it should be. * ipr is now the only user of ata_host_init(). Either kill it by converting ipr to use ata_host_alloc() and friends or rename and move it to libata-scsi.c Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-28libata: add support for READ/WRITE LONGMark Lord
The READ/WRITE LONG commands are theoretically obsolete, but the majority of drives in existance still implement them. The WRITE_LONG and WRITE_LONG_ONCE commands are of particular interest for fault injection testing -- eg. creating "media errors" at specific locations on a disk. The fussy bit is that these commands require a non-standard sector size, usually 520 bytes instead of 512. This patch adds support to libata for READ/WRITE LONG commands issued via SG_IO/ATA_16. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-28RESEND: libata: check cdb len per dev instead of per hostMark Lord
Resending, with s/printk/DPRINTK/ as pointed out by Alan. Fix libata to perform CDB len validation per device rather than per host. This way, validation still works when we have a mix of 12-byte and 16-byte devices on a common host interface. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-04libata bugfix: preserve LBA bit for HDIO_DRIVE_TASKMark Lord
Preserve the LBA bit in the DevSel/Head register for HDIO_DRIVE_TASK. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-03-02libata: add CONFIG_PM to libata core layerTejun Heo
Conditionalize all PM related stuff in libata core layer using CONFIG_PM. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-21libata: s/ap->id/ap->print_id/gTejun Heo
ata_port has two different id fields - id and port_no. id is system-wide 1-based unique id for the port while port_no is 0-based host-wide port number. The former is primarily used to identify the ATA port to the user in printk messages while the latter is used in various places in libata core and LLDs to index the port inside the host. The two fields feel quite similar and sometimes ap->id is used in place of ap->port_no, which is very difficult to spot. This patch renames ap->id to ap->print_id to reduce the possibility of such bugs. Some printk messages are adjusted such that id string (ata%u[.%u]) isn't printed twice and/or to use ata_*_printk() instead of hardcoded id format. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-21libata: fix ata_scsi_change_queue_depth()Tejun Heo
Fix ata_scsi_change_queue_depth() such that... * NCQ on/off is exactly determined using the same logic as the issue path. * queue depth is adjusted to 1 if NCQ is not enabled. * -EINVAL is returned if requested action is ignored due to limitations. This fixes the bug which allows queue depth to be increased on blacklisted NCQ hosts/devices. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-21libata: fix ata_scmd_need_defer()Tejun Heo
Fix ata_scmd_need_defer() such that... * whether NCQ is used or not is exactly determined using the same criteria as the issue path. * defer-check is performed in all cases. This fixes race condition where turning off NCQ on the fly causes non-NCQ commands sneak into NCQ phase. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-21libata: fix probe_ent alloc/free bugsTejun Heo
ata_probe_ent_alloc() had a temporary hack such that devm_kzalloc() was used for allocation if devres had been previously initialized on the device; otherwise, plain kzalloc() was used. This was to make the code useable from both the old and devres-aware libata drivers during transition. This hack made ata_sas_port_alloc() unable to determine how the probe_ent is allocated, causing double free in some cases. Remove the now-unneeded hack and make ata_sas_port_alloc() use devm_kfree(). Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-21libata bugfix: HDIO_DRIVE_TASKMark Lord
I was trying to use HDIO_DRIVE_TASK for something today, and discovered that the libata implementation does not copy over the upper four LBA bits from args[6]. This is serious, as any tools using this ioctl would have their commands applied to the wrong sectors on the drive, possibly resulting in disk corruption. Ideally, newer apps should use SG_IO/ATA_16 directly, avoiding this bug. But with libata poised to displace drivers/ide, better compatibility here is a must. This patch fixes libata to use the upper four LBA bits passed in from the ioctl. The original drivers/ide implementation copies over all bits except for the master/slave select bit. With this patch, libata will copy only the four high-order LBA bits, just in case there are assumptions elsewhere in libata (?). Signed-Off-By: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-09libata: update libata core layer to use devresTejun Heo
Update libata core layer to use devres. * ata_device_add() acquires all resources in managed mode. * ata_host is allocated as devres associated with ata_host_release. * Port attached status is handled as devres associated with ata_host_attach_release(). * Initialization failure and host removal is handedl by releasing devres group. * Except for ata_scsi_release() removal, LLD interface remains the same. Some functions use hacky is_managed test to support both managed and unmanaged devices. These will go away once all LLDs are updated to use devres. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-02-09libata: implement HDIO_GET_IDENTITYTejun Heo
'hdparm -I' doesn't work with ATAPI devices and sg_sat is not widely spread yet leaving no easy way to access ATAPI IDENTIFY data. Implement HDIO_GET_IDENTITY such that at least 'hdparm -i' works. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>