summaryrefslogtreecommitdiff
path: root/sys/dev/ata/ata-all.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r215468:Alexander Motin2010-11-231-0/+19
| | | | | | | | | Make ATA_CAM wrapper to report SATA power management capabilities to CAM to make it configure device to initiate transitions if controller configured to accept them. This makes hint.ata.X.pm_level=1 mode working. Notes: svn path=/stable/8/; revision=215777
* MFC r214988:Alexander Motin2010-11-191-0/+9
| | | | | | | | Teach ahci(4), siis(4) and ATA_CAM ata(4) wrapper report to CAM residual I/O length on underruns, that often happens for some SCSI commands. Notes: svn path=/stable/8/; revision=215509
* MFC r214016:Alexander Motin2010-11-021-0/+21
| | | | | | | | | | | | | | | | Set of legacy mode SATA enchancements: - Implement proper combined mode decoding for Intel controllers to properly identify SATA and PATA channels and associate ATA channels with SATA ports. This fixes wrong reporting and in some cases hard resets to wrong SATA ports. - Improve SATA registers support to handle hot-plug events and potentially interface errors. For ICH5/6300ESB chipsets these registers accessible via PCI config space. For later ones they may be accessible via PCI BAR(5). - For controllers not generating interrupts on hot-plug events, implement periodic status polling. Use it to detect hot-plug on Intel and VIA controllers. Same probably could also be used for Serverworks and SIS. Notes: svn path=/stable/8/; revision=214671
* MFC r209883, r209944:Alexander Motin2010-07-181-4/+12
| | | | | | | | | | | Make interrupt handler check that CAM bus initialization completed before touching it. It fixes possible panic during controller attach in ATA_CAM mode. While there, slightly improve attach errors handling. Notes: svn path=/stable/8/; revision=210208
* MFC r209872:Alexander Motin2010-07-181-1/+1
| | | | | | | | | | Make hw.ata.ata_dma_check_80pin tunable affect not only device side, but also controller side cable checks. Make respective sysctl writable. PR: kern/143462 Notes: svn path=/stable/8/; revision=210204
* MFC r209664:Alexander Motin2010-07-161-2/+55
| | | | | | | | | | | Add ata(4) ability to limit initial ATA mode for devices via device hints. After boot this mode can be changed with atacontrol/camcontrol as usual. It works for both legacy and ATA_CAM wrapper mode. PR: kern/123980 Notes: svn path=/stable/8/; revision=210164
* MFC r208375, r208393:Alexander Motin2010-05-231-4/+15
| | | | | | | | Improve suspend/resume support. Make sure controller is idle on suspend and reset it on resume. Notes: svn path=/stable/8/; revision=208448
* MFC r207432:Alexander Motin2010-05-081-39/+26
| | | | | | | Add Target/LUN ID checks. Notes: svn path=/stable/8/; revision=207773
* MFC r204250:Alexander Motin2010-03-031-3/+3
| | | | | | | Fix recursive lock attempt on hot-plug event in non-ATA_CAM mode. Notes: svn path=/stable/8/; revision=204652
* MFC r204195:Alexander Motin2010-03-011-2/+10
| | | | | | | Improve output for controllers that doesn't report SATA speed. Notes: svn path=/stable/8/; revision=204528
* MFC r203376, r203384:Alexander Motin2010-02-141-3/+12
| | | | | | | | | - Give ATA/SATA SIMs info about ATAPI packet size, supported by device. - Make ATA XPT to reject longer SCSI CDBs then supported by device, or any SCSI CDBs, if device doesn't support ATAPI. Notes: svn path=/stable/8/; revision=203890
* MFC r203108:Alexander Motin2010-02-141-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Large set of CAM improvements: - Unify bus reset/probe sequence. Whenever bus attached at boot or later, CAM will automatically reset and scan it. It allows to remove duplicate code from many drivers. - Any bus, attached before CAM completed it's boot-time initialization, will equally join to the process, delaying boot if needed. - New kern.cam.boot_delay loader tunable should help controllers that are still unable to register their buses in time (such as slow USB/ PCCard/ CardBus devices), by adding one more event to wait on boot. - To allow synchronization between different CAM levels, concept of requests priorities was extended. Priorities now split between several "run levels". Device can be freezed at specified level, allowing higher priority requests to pass. For example, no payload requests allowed, until PMP driver enable port. ATA XPT negotiate transfer parameters, periph driver configure caching and so on. - Frozen requests are no more counted by request allocation scheduler. It fixes deadlocks, when frozen low priority payload requests occupying slots, required by higher levels to manage theit execution. - Two last changes were holding proper ATA reinitialization and error recovery implementation. Now it is done: SATA controllers and Port Multipliers now implement automatic hot-plug and should correctly recover from timeouts and bus resets. - Improve SCSI error recovery for devices on buses without automatic sense reporting, such as ATAPI or USB. For example, it allows CAM to wait, while CD drive loads disk, instead of immediately return error status. - Decapitalize diagnostic messages and make them more readable and sensible. - Teach PMP driver to limit maximum speed on fan-out ports. - Make boot wait for PMP scan completes, and make rescan more reliable. - Fix pass driver, to return CCB to user level in case of error. - Increase number of retries in cd driver, as device may return several UAs. Notes: svn path=/stable/8/; revision=203889
* MFC r201990:Alexander Motin2010-01-191-5/+3
| | | | | | | | - Report SATA in legacy emulation mode still as SATA. - Make ATA XPT able to handle such case. Notes: svn path=/stable/8/; revision=202616
* MFC: r200459Marius Strobl2009-12-161-4/+3
| | | | | | | | | | | Unbreak the ata_atapi() usage. Since r200171 (MFC'ed in r200432) the mode setting functions get a ata_device type device passed instead of a ata_channel one, thus ata_atapi() has to be adjusted accordingly. Reviewed by: mav Notes: svn path=/stable/8/; revision=200611
* MFC r200171, r200182, r200275, r200295, r200359:Alexander Motin2009-12-121-7/+567
| | | | | | | | | | | | | | | | | | | | | Introduce ATA_CAM kernel option, turning ata(4) controller drivers into cam(4) interface modules. When enabled, this option deprecates all ata(4) peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers (ada, cd, ...) and interfaces to be natively used instead. As side effect of this, ata(4) mode setting code was completely rewritten to make controller API more strict and permit above change. While doing this, SATA revision was separated from PATA mode. It allows DMA-incapable SATA devices to operate and makes hw.ata.(ata|atapi)_dma tunable work again. Also allow ata(4) controller drivers (except some specific or broken ones) to handle larger data transfers. Previous constraint of 64K was artificial and is not really required by PCI ATA BM specification or hardware. Submitted by: nwitehorn (powerpc part) Notes: svn path=/stable/8/; revision=200432
* MFC r199822:Alexander Motin2009-12-021-3/+0
| | | | | | | | | | | | Drop USB mass storage devices support from ata(4). It is out of the build as long as I remember, and completely superseded by better maintained umass(4). It's main idea was to optionally avoid CAM dependency for such devices, but with move ATA to CAM, it is not actual any more. No objections: hselasky@, thompsa@, arch@ Notes: svn path=/stable/8/; revision=200024
* MFC r198717:Alexander Motin2009-11-231-4/+4
| | | | | | | | | | | - Remove most of direct relations between ATA(4) peripherial and controller levels. It makes logic more transparent and is a mandatory step to wrap ATA(4) controller level into ATA-native CAM SIM. - Tune AHCI and SATA2 SiI drivers memory allocation a bit to allow bigger I/O transaction sizes without additional cost. Notes: svn path=/stable/8/; revision=199696
* MFC 196403: Temporarily revert the new-bus locking for 8.0 release.John Baldwin2009-08-201-19/+15
| | | | | | | Approved by: re (kib) Notes: svn path=/stable/8/; revision=196405
* Make the newbus subsystem Giant free by adding the new newbus sxlock.Attilio Rao2009-08-021-15/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith) Notes: svn path=/head/; revision=196037
* Restore PATA device probe order, broken by PMP support implementation,Alexander Motin2009-07-261-1/+17
| | | | | | | | | | | requesting IDENTIFY from slave device first. This order is important for proper cable type detection by master device. PR: kern/136438 Approved by: re (kib) Notes: svn path=/head/; revision=195893
* Limit IOCATAREQUEST ioctl data size to controller's maximum I/O size.Alexander Motin2009-07-161-0/+5
| | | | | | | | | | | It fixes kernel panic when requested size is too large (0xffffffff), PR: kern/136726 Approved by: re (kib) MFC after: 2 weeks Notes: svn path=/head/; revision=195724
* Last commit was in error, revert.Warner Losh2009-05-201-1/+1
| | | | Notes: svn path=/head/; revision=192479
* We no longer need to use d_thread_t, migrate to struct thread *.Warner Losh2009-05-201-1/+1
| | | | Notes: svn path=/head/; revision=192450
* Revert my ata_identify()/ata_reinit() related changes: r189166, r189091Alexander Motin2009-02-281-46/+41
| | | | | | | | | | | | | | | | | and partially r188903. Revert breaks new drives detection on reinit to the state as it was before me, but fixes series of new bugs reported by some people. Unconditional queueing of ata_completed() calls can lead to deadlock if due to timeout ata_reinit() was called at the same thread by previous ata_completed(). Calling of ata_identify() on ata_reinit() in current implementation opens numerous races and deadlocks. Problems I was touching here are still exist and should be addresed, but probably in different way. Notes: svn path=/head/; revision=189195
* Rework device probing by moving ata_getparam() call from ata_identify() toAlexander Motin2009-02-281-39/+44
| | | | | | | | | | | | | | drivers' probe routines. It allows not to sleep and so not drop Giant inside ata_identify() critical section and so avoid crash if it reentered on request timeout. Reentering of probe call checked inside of it. Give device own knowledge about it's type (ata/atapi/atapicam). It is not a good idea to ask channel status for device type inside ata_getparam(). Add softc memory deallocation on device destruction. Notes: svn path=/head/; revision=189166
* Unhide IDENTIFY command timeouts when verbose messages enabled.Alexander Motin2009-02-261-1/+3
| | | | | | | I think it should be suitable for debugging. Notes: svn path=/head/; revision=189094
* Remove direct ata_completed() call options from ata_finish(), except for theAlexander Motin2009-02-261-1/+1
| | | | | | | | | | | | | kernel dumping case. ata_completed() may initiate ata_reinit() on error, that may lead to drives attach or detach. Attach and detach are sending requests to drives and sleep waiting for results. But ata_finish() can be called directly from interrupt handler where sleeping is prohibited, so we must break this chain somewhere. This place seems to fit best. Notes: svn path=/head/; revision=189091
* Do not call devices probe/attach if there is nothing new was found.Alexander Motin2009-02-231-0/+4
| | | | Notes: svn path=/head/; revision=188936
* Remove one more place of master/slave terms usage.Alexander Motin2009-02-221-2/+1
| | | | Notes: svn path=/head/; revision=188912
* Improve ata_reinit():Alexander Motin2009-02-211-4/+37
| | | | | | | | | | | | | | | | | - protect againtst recursions, - add new devices detection using ata_identify(). Improve ata_identify(): - do not add duplicate device if device already exist. Rework SATA hot-plug events handling. Instead of unsafe duplicate implementation use common ata_reinit() to handle all state changes. All together this gives quite stable and robust cold- and hot-plug operation, invariant to false, lost and duplicate events. Notes: svn path=/head/; revision=188903
* Use channel driver's attach/detach routines instead of ata_attach()/Alexander Motin2009-02-191-8/+10
| | | | | | | | | ata_detach() to implement IOCATAATTACH/IOCATADETACH ioctls. This will permit channel drivers to properly shutdown port hardware on channel detach and init it on attach. Notes: svn path=/head/; revision=188812
* Make ch->dma.free() called symmetrically to ch->dma.alloc().Alexander Motin2009-02-181-0/+5
| | | | Notes: svn path=/head/; revision=188763
* Remove unused variable.Alexander Motin2009-02-181-2/+1
| | | | | | | Submitted by: ganbold Notes: svn path=/head/; revision=188755
* Remove useless return, that left from previous commit.Alexander Motin2009-02-171-1/+0
| | | | Notes: svn path=/head/; revision=188733
* ata_interrupt() does not need to return anything. It is not it's businessAlexander Motin2009-02-171-4/+4
| | | | | | | to report request completion, expecially when it is not reliable. Notes: svn path=/head/; revision=188731
* This is the roumored ATA modulerisation works, and it needs a little ↵Søren Schmidt2008-10-091-19/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | explanation. If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in. However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries: atacore: ATA core functionality, always needed for any ATA setup atacard: CARDBUS support atacbus: PC98 cbus support ataisa: ISA bus support atapci: PCI bus support only generic chipset support. ataahci: AHCI support, also pulled in by some vendor modules. ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia; Vendor support, ie atavia for VIA chipsets atadisk: ATA disk driver ataraid: ATA softraid driver atapicd: ATAPI cd/dvd driver atapifd: ATAPI floppy/flashdisk driver atapist: ATAPI tape driver atausb: ATA<>USB bridge atapicam: ATA<>CAM bridge This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file: device atacore device atapci device atavia And then you need the atadisk, atapicd etc lines in there just as usual. If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual. However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above. Notes: svn path=/head/; revision=183724
* Introduce a new loader tunable "hw.ata.ata_dma_check_80pin", defaulting to 1.Philip Paeps2008-08-151-0/+5
| | | | | | | | | | | | This can be used to disable the 80pin cable check on systems which forget to set the bit -- such as certain laptops and Soekris boards. PR: kern/114605 (somewhat reworked) Submitted by: marck MFC after: 1 week Notes: svn path=/head/; revision=181753
* Rearrange how to call dma.alloc() so that we have resources alloc'd when ↵Søren Schmidt2008-06-111-0/+4
| | | | | | | need but also late enough to know how many to create. Notes: svn path=/head/; revision=179717
* Dont call ata_start() when ata_reinit fails in the ioctl path.Søren Schmidt2008-05-261-1/+0
| | | | Notes: svn path=/head/; revision=179312
* devclass_get_maxunit() returns n+1 with n starting at 0.Bjoern A. Zeeb2008-04-201-4/+5
| | | | | | | | | | | | So if we have channel 0..3 devclass_get_maxunit is 4. It's never been a problem as devclass_get_device() has catched a possibly bad input. Discussed with: scottl Notes: svn path=/head/; revision=178339
* Fix the breakage that caused AHCI devices to vanish. Editor droppings :(Søren Schmidt2008-04-181-1/+3
| | | | | | | Put the ATAPI device numbering back to the old ways. Notes: svn path=/head/; revision=178300
* Go back to preallocating everything possible on init.Søren Schmidt2008-04-171-58/+7
| | | | | | | | This avoids calling busdma in the request processing path which caused a traumatic performance degradation. Allocation has be postponed to after we know how many devices we possible can have on portmulitpliers to save some space. Notes: svn path=/head/; revision=178278
* Fix badly placed '{'Søren Schmidt2008-04-111-2/+5
| | | | | | | | | Dont leak requests on busdma failure (not that we'd get anywhere anyhow). Reported by: antoine@ Notes: svn path=/head/; revision=178128
* Fix the brokenness in the former commit, sorry for the mess.Søren Schmidt2008-04-111-5/+54
| | | | | | | | | | | The problem is that the PM support is part of a much larger WIP here, but due to popular demand I decided to get some of it imported. Also I forgot the mention: HW sponsored by: Vitsch Electronics / VEHosting Notes: svn path=/head/; revision=178114
* Add experimental support for SATA Port MultipliersSøren Schmidt2008-04-101-56/+72
| | | | | | | | | | Support is working on the Silicon Image SiI3124/3132. Support is working on some AHCI chips but far from all. Remember this is WIP, so test reports and (constructive) suggestions are welcome! Notes: svn path=/head/; revision=178067
* Add a "spindown" facility to ata-disks: If no requests have been receivedPoul-Henning Kamp2008-03-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | for a configurable number of seconds, spin the disk down. Spin it back up on the next request. Notice that the timeout is only armed by a request, so to spin down a disk you may have to do: atacontrol spindown ad10 5 dd if=/dev/ad10 of=/dev/null count=1 To disable spindown, set timeout to zero: atacontrol spindown ad10 0 In order to debug any trouble caused, this code is somewhat noisy on the console. Enabling spindown on a disk containing / or /var/log/messages is not going to do anything sensible. Spinning a disk up and down all the time will wear it out, use sensibly. Approved by: sos Notes: svn path=/head/; revision=177298
* Add support for the VIA 8237SSøren Schmidt2007-10-041-1/+1
| | | | | | | | | Fix the LBA28/LBA48 crossover bug. Approved by: re@ Notes: svn path=/head/; revision=172446
* Use 'pause' in several places rather than trying to tsleep() on NULL (whichJohn Baldwin2007-02-231-3/+3
| | | | | | | | | triggers a KASSERT) or local variables. In the case of kern_ndis, the tsleep() actually used a common sleep address (curproc) making it susceptible to a premature wakeup. Notes: svn path=/head/; revision=166909
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-1/+1
| | | | | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@ Notes: svn path=/head/; revision=166901
* Update copyright headers.Søren Schmidt2007-02-211-1/+1
| | | | Notes: svn path=/head/; revision=166878