summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-all.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r286814, r286816: Remove UMA allocation of ATA requests.mav2015-08-291-28/+2
| | | | | | 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 r286448: Disable 32-bit PIO for 6Gbit/s Intel SATA controllers.mav2015-08-221-0/+1
| | | | | | | | | | | For some reason 32-bit PIO writes are not working on 6Gbit/s Intel SATA ports, while 16/32-bit PIO reads and 16-bit PIO writes are working fine. 3Gbit/s ports on the same controllers have no this problem. Workaround this by disabling 32-bit PIO for all Intel controllers that may have 6Gbit/s ports. It halves PIO performance from 6MB/s to 3MB/s, but who bother about speed of such rare and slow mode, which is also highly discouraged by SATA specifications?
* MFC r280393: Reduce priority of ATA/SATA drivers.mav2015-04-061-1/+1
| | | | | Legacy ata(4) -> BUS_PROBE_LOW_PRIORITY; more functional ahci(4), siis(4), mvs(4) -> BUS_PROBE_DEFAULT; BUS_PROBE_VENDOR leave for vendor drivers.
* MFC 264389: Fix the style of ata_interrupt_locked().ian2014-05-171-13/+11
|
* MFC Alexander Motin's direct dispatch, multi-queue, and finer-grainedscottl2014-01-071-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | locking support for CAM r256826: Fix several target mode SIMs to not blindly clear ccb_h.flags field of ATIO CCBs. Not all CCB flags there belong to them. r256836: Remove hard limit on number of BIOs handled with one ATA TRIM request. r256843: Merge CAM locking changes from the projects/camlock branch to radically reduce lock congestion and improve SMP scalability of the SCSI/ATA stack, preparing the ground for the coming next GEOM direct dispatch support. r256888: Unconditionally acquire periph reference on CCB allocation failure. r256895: Fix memory and references leak due to unfreed path. r256960: Move CAM_UNQUEUED_INDEX setting to the last moment and under the periph lock. This fixes race condition with cam_periph_ccbwait(), causing use-after-free. r256975: Minor (mostly cosmetical) addition to r256960. r257054: Some microoptimizations for da and ada drivers: - Replace ordered_tag_count counter with single flag; - From da remove outstanding_cmds counter, duplicating pending_ccbs list; - From da_softc remove unused links field. r257482: Fix lock recursion, triggered by `smartctl -a /dev/adaX`. r257501: Make getenv_*() functions and respectively TUNABLE_*_FETCH() macros not allocate memory and so not require sleepable environment. getenv() has already used on-stack temporary storage, so just use it more rationally. getenv_string() receives buffer as argument, so don't need another one. r257914: Some CAM locks polishing: - Fix LOR and possible lock recursion when handling high-power commands. Introduce new lock to protect left power quota and list of frozen devices. - Correct locking around xpt periph creation. - Remove seems never used XPT_FLAG_OPEN xpt periph flag. Again, Netflix assisted with testing the merge, but all of the credit goes to Alexander and iX Systems. Submitted by: mav Sponsored by: iX Systems
* MFC r256304grehan2013-10-111-1/+1
| | | | | | | Allow the legacy CDROM device to be accessed in a FreeBSD guest, while still using enlightened drivers for other block devices. Approved by: re@ (gjb)
* - With the demise of !ATA_CAM, ATA_STATIC_ID is the only ata(4) relatedmarius2013-04-061-1/+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-3/+151
| | | | | | | | | | - 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
* Unbreak ATA_NO_48BIT_DMA with ATA_CAM by treating 48-bit DMA as anmarius2013-04-061-7/+23
| | | | | | | optional property with PATA transport. Reviewed by: mav MFC after: 3 days
* Remove all legacy ATA code parts, not used since options ATA_CAM enabled inmav2013-04-041-997/+1
| | | | | | | | | 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-1/+7
| | | | | 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.
* Only four specific ATA PIO commands transfer several sectors per DRQ blockmav2012-11-011-2/+10
| | | | | | (interrupt). All other ATA PIO commands transfer one sector or 512 bytes at one time. Hardcode these exceptions in ata(4) with ATA_CAM option. This fixes timeout of READ LOG EXT command used by `smartctl -x /dev/adaX`.
* Implement CAM_ATAIO_NEEDRESULT (fetching full set of result registers) formav2012-10-261-0/+2
| | | | | | | 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/+9
| | | | | | | 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
* Fix typo in bzero length argument during sense fetching.mav2012-07-211-1/+1
| | | | | | For me it at least fixed CD burning in PIO mode. MFC after: 3 days
* Partially revert r236666:mav2012-06-101-1/+1
| | | | | | | | | | | Return PROTO_ATA protocol in response to XPT_PATH_INQ. smartmontools uses it to identify ATA devices and I don't know any other place now where it is important. It could probably use XPT_GDEV_TYPE instead for more accurate protocol information, but let it live for now. Reported by: matthew MFC after: 3 days
* ATA/SATA controllers have no idea about protocol of the connected devicemav2012-06-061-2/+2
| | | | | | | until transport will do some probe actions (at least soft reset). Make ATA/SATA SIMs to not report bogus and confusing PROTO_ATA protocol. Make ATA/SATA transport to fill that gap by reporting protocol to SIM with XPT_SET_TRAN_SETTINGS and patching XPT_GET_TRAN_SETTINGS results if needed.
* Make legacy ATA to not call device_add_child() with unit number butmav2012-05-281-1/+1
| | | | | | without driver name. This fixed legacy ATA breakage by r235978. MFC after: 1 week
* Add two functions xpt_batch_start() and xpt_batch_done() to the CAM SIM KPImav2012-05-121-0/+2
| | | | | | | | | to allow drivers to handle request completion directly without passing them to the CAM SWI thread removing extra context switch. Modify all ATA/SATA drivers to use them. Reviewed by: gibbs, ken MFC after: 2 weeks
* - First pass at const'ifying ata(4) as appropriate.marius2012-03-211-1/+1
| | | | | | | - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers MFC after: 1 week
* Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap itmarius2012-03-211-2/+40
| | | | | | | | | | | | | | | along with functions, SYSCTLs and tunables that are not used with ATA_CAM in #ifndef ATA_CAM, similar to the existing #ifdef'ed ATA_CAM code for the other way around. This makes it easier to understand which parts of ata(4) actually are used in the new world order and to later on remove the !ATA_CAM bits. It also makes it obvious that there is something fishy with the C-bus front-end as well as in the ATP850 support, as these used ATA_LOCKING which is defunct in the ATA_CAM case. When fixing the former, ATA_LOCKING probably needs to be brought back in some form or other. Reviewed by: mav MFC after: 1 week
* Convert files to UTF-8uqs2012-01-151-1/+1
|
* 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)
OpenPOWER on IntegriCloud