summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-all.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove UMA allocation of ATA requests.mav2015-08-151-8/+1
| | | | | | | | After CAM replaced old ATA stack, this driver processes no more then one request at a time per channel. Using UMA after that is overkill, so replace it with simple preallocation of one request per channel. MFC after: 2 weeks
* Remove from legacy ata(4) driver support for hardware, supported by newermav2015-03-241-133/+0
| | | | | | and more functional drivers ahci(4), siis(4) and mvs(4). This removes about 3400 lines of code, unused since FreeBSD 9.0 release.
* Fix SATA Gen3 speed constants.mav2015-03-131-1/+2
| | | | MFC after: 1 week
* - With the demise of !ATA_CAM, ATA_STATIC_ID is the only ata(4) relatedmarius2013-04-061-2/+0
| | | | | | | | | option left but actually consumed by ada(4), so move it to opt_ada.h and get rid of opt_ata.h. - Fix stand-alone build of atacore(4) by adding opt_cam.h. - Use __FBSDID. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers.
* - Make ata_str2mode() static, it's not used outside of ata-all.c.marius2013-04-061-5/+1
| | | | | | | | | | - Move ata_timeout() to ata-all.c so we don't need to expose both this function and ata_cam_end_transaction() but only the former. - Move ata_cmd2str() from ata-queue.c to ata-all.c so we can get rid of the former. - Add some missing prototypes. MFC after: 3 days
* Remove some more remnants of !ATA_CAM.marius2013-04-061-11/+0
|
* Remove all legacy ATA code parts, not used since options ATA_CAM enabled inmav2013-04-041-26/+0
| | | | | | | | | most kernels before FreeBSD 9.0. Remove such modules and respective kernel options: atadisk, ataraid, atapicd, atapifd, atapist, atapicam. Remove the atacontrol utility and some man pages. Remove useless now options ATA_CAM. No objections: current@, stable@ MFC after: never
* Add some more ATA_CAM ifdefs.mav2013-04-031-6/+8
| | | | | Submitted by: marius (partially) MFC after: 1 week
* Fix command timeout caused by data underrun during fetching ATAPI sensemav2013-02-221-0/+1
| | | | | | | | data, introduced by r246713. There are two places where ata_request is filled in ATA_CAM: ata_cam_begin_transaction() and ata_cam_request_sense(). In the first case DMA should be done for addresses from the CCB. In second case, DMA should be done to the different address, the address of the sense buffer inside the CCB structure itself.
* Improve r238673 to additionally allow for odd-aligned buffers asmarius2013-02-021-0/+10
| | | | | | | | | passed in by smartd of smartmontools. While at it, hint the compiler that 32-bit PIO is the most likely case (idea from Linux) and use bus_{read,write}_stream_2(9) instead of bus_{read,write}_multi_stream_2(9) for single count reads/writes. MFC after: 1 week
* Implement CAM_ATAIO_NEEDRESULT (fetching full set of result registers) formav2012-10-261-0/+1
| | | | | | | ata(4) driver in ATA_CAM mode. That slighty improves error reporting and also should fix `smartctl -l scterc /dev/adaX` operation. MFC after: 3 weeks
* Implement SATA revision (speed) control for legacy SATA controller formav2012-10-021-0/+1
| | | | | | | both boot (via loader tunables) and run-time (via `camcontrol negotiate`). Tested to work at least on NVIDIA MCP55 chipset. H/w provided by: glebius
* - First pass at const'ifying ata(4) as appropriate.marius2012-03-211-2/+2
| | | | | | | - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers MFC after: 1 week
* Convert files to UTF-8uqs2012-01-151-1/+1
|
* Implement automatic SCSI sense fetching for ata(4) in ATA_CAM mode.mav2011-04-121-2/+3
| | | | | While it could be successfully done by CAM error recovery code, I was told by several people that it is also a SIM obligation.
* Make ATA_CAM wrapper to report SATA power management capabilities to CAM tomav2010-11-181-0/+1
| | | | | make it configure device to initiate transitions if controller configured to accept them. This makes hint.ata.X.pm_level=1 mode working.
* Set of legacy mode SATA enchancements:mav2010-10-181-8/+3
| | | | | | | | | | | | - 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.
* Fix a problem where device detection would work unreliably on Serverworksnwhitehorn2010-09-091-0/+1
| | | | | | | | | | | | K2 SATA controllers. The chip's status register must be read first, and as a long, for other registers to be correctly updated after a command, and this includes the command sequence in device detection as well as the previously handled case after interrupts. While here, clean up some previous hacks related to this controller. Reported by: many Reviewed by: mav MFC after: 3 weeks
* SATA1.x SiliconImage controllers on power-on reset TFD Status register intomav2010-09-021-0/+1
| | | | | | | value 0xff. On hot-plug this value confuses ata_generic_reset() device presence detection logic. As soon as we already know drive presence from SATA hard reset, hint ata_generic_reset() to wait for device signature until success or full timeout.
* Add ata(4) ability to limit initial ATA mode for devices via device hints.mav2010-07-031-0/+1
| | | | | | | 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
* Some revisions of the Serverworks K2 SATA controller have a datanwhitehorn2010-06-061-0/+1
| | | | | | | | | | | | | | corruption bug where if an ATA command is issued before DMA is started, data will become available to the controller before it knows what to do with it. This results in either data corruption or a controller crash. This patch remedies the problem by adopting the workaround employed by Linux and Darwin: starting the DMA engine prior to sending the ATA command. Observer on: Xserve G5 Reviewed by: mav MFC after: 1 week
* Include opt_ata.h, as some structures here depending on ATA_CAM option.mav2010-03-311-0/+2
| | | | This fixes ATA_CAM with atamvsata and probably some other drivers.
* - Give ATA/SATA SIMs info about ATAPI packet size, supported by device.mav2010-02-021-0/+1
| | | | | - Make ATA XPT to reject longer SCSI CDBs then supported by device, or any SCSI CDBs, if device doesn't support ATAPI.
* Unbreak the ata_atapi() usage. Since r200171 the mode setting functionsmarius2009-12-131-1/+1
| | | | | | | | get a ata_device type device passed instead of a ata_channel one, thus ata_atapi() has to be adjusted accordingly. Reviewed by: mav MFC after: 3 days
* MFp4:mav2009-12-061-2/+31
| | | | | | | | | | | | | | | | | | Introduce ATA_CAM kernel option, turning ata(4) controller drivers into cam(4) interface modules. When enabled, this options 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.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)
* Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)mav2009-11-081-0/+4
| | | | | | command timeout. Submitted by: keramida
* MFp4:mav2009-10-311-5/+9
| | | | | | | | - 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.
* Turn off use of ATA_A_4BIT on modern hardware. This flag was alreadynwhitehorn2009-10-291-1/+10
| | | | | | | | | | obsoleted in 1996 by ATA-2, and crashes some modern hardware like some revisions of the Serverworks K2 SATA controller. Even very ancient hardware seems not to require it. In the unlikely event this causes problems, the previous behavior can be re-enabled by defining ATA_LEGACY_SUPPORT at the top of this file. Reviewed by: Alexander Motin <mav@freebsd.org>
* Move non-PCI prototypes from ata-pci.h -> ata-all.h.raj2009-06-241-0/+13
| | | | | | | | This removes unnecessary PCI #includes dependency for systems with ATA controllers living at non-PCI buses. Submitted by: Piotr Ziecik Obtained from: Semihalf
* MFp4.mav2009-06-011-1/+16
| | | | Log supported AHCI controller capabilities.
* Improve kernel dumping reliability for busy ATA channels:mav2009-05-011-0/+1
| | | | | | | | | - Generate fake channel interrupts even if channel busy with previous request to let it finish. Without this, dumping requests were just queued and never processed. - Drop pre-dump requests queue on dumping. ATA code, working in dumping (interruptless) mode, unable to handle long request queue. Actually, to get coherent dump we anyway should do as few unrelated actions as possible.
* Add experimental support for SATA interface power management.mav2009-04-291-1/+5
| | | | | | | | | | | | | | | | | | Feature is controlled by hint.ata.X.pm_level tunable: 0 - PM disabled, old behaviour, default. 1 - device is allowed to initiate PM state change, host is passive. 2 - host initiates PARTIAL state transition every time port is idle. 3 - host initiates SLUMBER state transition every time port is idle. PARTIAL state has up to 100us (50us for me) wakeup latency, but for my ICH8M saves 0.5W of power per drive. SLUMBER state has up to 10ms (3.5ms for me) wakeup latency, but saves 0.8W of power. Modes 2 and 3 are implemented only for AHCI driver now. Interface power management is incompatible with device presence detection (host receives no signal from drive, so unable to monitor it), so later is disabled when PM is used.
* Revert my ata_identify()/ata_reinit() related changes: r189166, r189091mav2009-02-281-8/+1
| | | | | | | | | | | | | | 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.
* Rework device probing by moving ata_getparam() call from ata_identify() tomav2009-02-281-0/+8
| | | | | | | | | | | 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.
* Remove direct ata_completed() call options from ata_finish(), except for themav2009-02-261-1/+0
| | | | | | | | | | 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.
* Improve ata_reinit():mav2009-02-211-0/+1
| | | | | | | | | | | | | | - 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.
* Fix typo: s/SLUMPER/SLUMBER/mav2009-02-201-1/+1
|
* Use channel driver's attach/detach routines instead of ata_attach()/mav2009-02-191-0/+1
| | | | | | 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.
* ata_interrupt() does not need to return anything. It is not it's businessmav2009-02-171-1/+1
| | | | to report request completion, expecially when it is not reliable.
* This is the roumored ATA modulerisation works, and it needs a little ↵sos2008-10-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Introduce a new loader tunable "hw.ata.ata_dma_check_80pin", defaulting to 1.philip2008-08-151-1/+2
| | | | | | | | | 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
* Go back to preallocating everything possible on init.sos2008-04-171-18/+27
| | | | | 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.
* Fix problem with slave devices.sos2008-04-141-1/+1
| | | | | Fix or rather bring ENOMEM problems back to the state it was before. Temporarily disable PortMultipliers on AHCI devices.
* Fix identify of slave devices.sos2008-04-131-1/+1
|
* Fix the brokenness in the former commit, sorry for the mess.sos2008-04-111-6/+3
| | | | | | | | 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
* Add experimental support for SATA Port Multiplierssos2008-04-101-25/+42
| | | | | | | 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!
* Add a "spindown" facility to ata-disks: If no requests have been receivedphk2008-03-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Follow the current fashion of gratuitously stomping into otherphk2008-01-021-36/+14
| | | | | | | | | | | | peoples code with irrelevant changes[1]: Use bus_{read|write_*() instead of bus_space_{read|write}_*() for purely stylistic reasons. Due to compiler optimizations and inlining, this is for all practical purposes without effect in the compiled code. [1] NB: Approved by: sos
* Implement a workaround of the datacorruption problem on serverworks HT1000 ↵sos2007-12-131-0/+2
| | | | | | | | | chipsets. The HT1000 DMA engine seems to not always like 64K transfers and sometimes barfs data all over memory leading to instant chrash and burn. Also fix 48bit adressing issues, apparently newer chips needs 16bit writes and not the usual fifo thing. HW donated by: Travis Mikalson at TerraNovaNet
* Add generic support for chipsets that say they support AHCI. This should ↵sos2007-11-181-1/+1
| | | | | | | catch new chipsets that we dont know but that we should support. Add a few new PCI id's. Misc cleanups.
OpenPOWER on IntegriCloud