summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-all.c
Commit message (Collapse)AuthorAgeFilesLines
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+1
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Add a "kern.features.ata_cam" sysctl in the kernel when the ATA_CAM kernelrodrigc2011-10-091-0/+3
| | | | | | | | | | | | | | | | | | | | | option is defined. This sysctl can be queried by feature_present(3). Query for this feature in /sbin/atacontrol and /usr/sbin/burncd. If these utilities detect that ATA_CAM is enabled, then these utilities will error out. These utilities are compatible with the old ATA driver, but are incomptible with the new ATA_CAM driver. By erroring out, we give end-users an idea as to what remedies to use, and reduce the need for them to file PR's. For atacontrol, camcontrol must be used instead, and for burncd, alternative utilties from the ports collection must be used such as sysutils/cdrtools. In future, maybe someone can re-write burncd to work with ATA_CAM, but at least for now, we give a somewhat useful error message to end users. PR: 160979 Reviewed by: jh, Arnaud Lacombe <lacombar at gmail dot com> Reported by: Joe Barbish <fbsd8 at a1poweruser dot com> MFC after: 3 days
* Fix a typo in a comment.wxs2011-10-061-1/+1
| | | | Approved by: kib@
* Use periodic status polling added at r214671 only in ATA_CAM mode. Legacymav2011-04-211-7/+13
| | | | mode won't receive much benefit from it due to its hot-plug limitations.
* Implement automatic SCSI sense fetching for ata(4) in ATA_CAM mode.mav2011-04-121-2/+78
| | | | | 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/+19
| | | | | make it configure device to initiate transitions if controller configured to accept them. This makes hint.ata.X.pm_level=1 mode working.
* Teach ahci(4), siis(4) and ATA_CAM ata(4) wrapper report to CAM residualmav2010-11-081-0/+9
| | | | I/O length on underruns, that often happens for some SCSI commands.
* Set of legacy mode SATA enchancements:mav2010-10-181-0/+21
| | | | | | | | | | | | - 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.
* Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers tomav2010-07-251-1/+10
| | | | | GEOM. This information needed for proper soft-RAID's on-disk metadata reading and writing.
* Revert and remake r209883:mav2010-07-121-9/+15
| | | | | | | | | | Do not grab lock while setting up interrupt, as it causes LOR with allocation code. Instead make interrupt handler check that CAM bus initialization completed before touching it. While there, slightly improve attach errors handling. Reported by: kib
* On attach, grab channel lock before setting up interrupt. This fixes crashmav2010-07-101-3/+5
| | | | | in ATA_CAM mode if phy connect event arrive before CAM bus initialization completed.
* Make hw.ata.ata_dma_check_80pin tunable affect not only device side, butmav2010-07-101-1/+1
| | | | | | also controller side cable checks. Make respective sysctl writable. PR: kern/143462
* Add ata(4) ability to limit initial ATA mode for devices via device hints.mav2010-07-031-2/+55
| | | | | | | 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
* Improve suspend/resume support. Make sure controller is idle on suspendmav2010-05-211-4/+15
| | | | and reset it on resume.
* Add Target/LUN ID checks.mav2010-04-301-39/+26
|
* Fix recursive lock attempt on hot-plug event in non-ATA_CAM mode.mav2010-02-231-3/+3
|
* Improve output for controllers that doesn't report SATA speed.mav2010-02-221-2/+10
|
* - Give ATA/SATA SIMs info about ATAPI packet size, supported by device.mav2010-02-021-3/+12
| | | | | - Make ATA XPT to reject longer SCSI CDBs then supported by device, or any SCSI CDBs, if device doesn't support ATAPI.
* MFp4: Large set of CAM inprovements.mav2010-01-281-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* - Report SATA in legacy emulation mode still as SATA.mav2010-01-101-5/+3
| | | | - Make ATA XPT able to handle such case.
* Unbreak the ata_atapi() usage. Since r200171 the mode setting functionsmarius2009-12-131-4/+3
| | | | | | | | 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
* Add module dependency for cam if configured as ATA_CAM.takawata2009-12-101-0/+3
|
* MFp4:mav2009-12-061-7/+564
| | | | | | | | | | | | | | | | | | 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)
* Drop USB mass storage devices support from ata(4). It is out of the build asmav2009-11-261-3/+0
| | | | | | | | 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@
* MFp4:mav2009-10-311-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.
* Temporarily revert the new-bus locking for 8.0 release. It will bejhb2009-08-201-19/+15
| | | | | | reintroduced after HEAD is reopened for commits by re@. Approved by: re (kib), attilio
* Make the newbus subsystem Giant free by adding the new newbus sxlock.attilio2009-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)
* Restore PATA device probe order, broken by PMP support implementation,mav2009-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)
* Limit IOCATAREQUEST ioctl data size to controller's maximum I/O size.mav2009-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
* Last commit was in error, revert.imp2009-05-201-1/+1
|
* We no longer need to use d_thread_t, migrate to struct thread *.imp2009-05-201-1/+1
|
* Revert my ata_identify()/ata_reinit() related changes: r189166, r189091mav2009-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.
* Rework device probing by moving ata_getparam() call from ata_identify() tomav2009-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.
* Unhide IDENTIFY command timeouts when verbose messages enabled.mav2009-02-261-1/+3
| | | | I think it should be suitable for debugging.
* Remove direct ata_completed() call options from ata_finish(), except for themav2009-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.
* Do not call devices probe/attach if there is nothing new was found.mav2009-02-231-0/+4
|
* Remove one more place of master/slave terms usage.mav2009-02-221-2/+1
|
* Improve ata_reinit():mav2009-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.
* Use channel driver's attach/detach routines instead of ata_attach()/mav2009-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.
* Make ch->dma.free() called symmetrically to ch->dma.alloc().mav2009-02-181-0/+5
|
* Remove unused variable.mav2009-02-181-2/+1
| | | | Submitted by: ganbold
* Remove useless return, that left from previous commit.mav2009-02-171-1/+0
|
* ata_interrupt() does not need to return anything. It is not it's businessmav2009-02-171-4/+4
| | | | 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-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.
* Introduce a new loader tunable "hw.ata.ata_dma_check_80pin", defaulting to 1.philip2008-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
* Rearrange how to call dma.alloc() so that we have resources alloc'd when ↵sos2008-06-111-0/+4
| | | | need but also late enough to know how many to create.
* Dont call ata_start() when ata_reinit fails in the ioctl path.sos2008-05-261-1/+0
|
* devclass_get_maxunit() returns n+1 with n starting at 0.bz2008-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
* Fix the breakage that caused AHCI devices to vanish. Editor droppings :(sos2008-04-181-1/+3
| | | | Put the ATAPI device numbering back to the old ways.
* Go back to preallocating everything possible on init.sos2008-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.
OpenPOWER on IntegriCloud