summaryrefslogtreecommitdiff
path: root/sys/dev/ata/ata-disk.c
Commit message (Collapse)AuthorAgeFilesLines
* Add the disk ident and a human-meaningful description (here, the disk modelNathan Whitehorn2011-02-261-0/+2
| | | | | | | | | | string) to the geom_disk config XML so that they are easily accessible from userland. MFC after: 1 week Notes: svn path=/head/; revision=219056
* Fix typos.Rebecca Cran2010-11-091-4/+4
| | | | | | | | PR: bin/148894 Submitted by: olgeni Notes: svn path=/head/; revision=215034
* Export PCI IDs of ATA/SATA controllers through CAM and ata(4) layers toAlexander Motin2010-07-251-0/+13
| | | | | | | | GEOM. This information needed for proper soft-RAID's on-disk metadata reading and writing. Notes: svn path=/head/; revision=210471
* Disable multi-sector PIO transfers if ATA_SET_MULTI command failed.Alexander Motin2010-07-131-0/+2
| | | | | | | Submitted by: Mikolaj Golub on fs@ Notes: svn path=/head/; revision=209977
* Add a safety-belt. If the identified disk has 0 blocks, don't attachWarner Losh2010-07-041-3/+8
| | | | | | | | | | it. This can happen in some cases when plugging in SD/SmartCard PC Cards with empty slots. It is better to detect this bogosity, and refuse to attach rather than panic with a division by zero (in one of many places) down stream. Notes: svn path=/head/; revision=209683
* Change ad_firmware_geom_adjust() to operate on a struct disk * only andMarius Strobl2010-05-201-3/+3
| | | | | | | | | | | | hook it up to ada(4) also. While at it, rename *ad_firmware_geom_adjust() to *ata_disk_firmware_geom_adjust() etc now that these are no longer limited to ad(4). Reviewed by: mav MFC after: 3 days Notes: svn path=/head/; revision=208349
* CFA support doesn't exclude FLUSH support.Alexander Motin2009-12-111-2/+2
| | | | | | | Submitted by: Grzegorz Bernacki Notes: svn path=/head/; revision=200414
* Limit maximum I/O size, depending on command set supported by device.Alexander Motin2009-12-101-0/+4
| | | | | | | | It is required to suppot non-LBA48 devices with MAXPHYS above 128K. Same is done in ada(4). Notes: svn path=/head/; revision=200353
* MFp4:Alexander Motin2009-12-061-3/+4
| | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=200171
* Use only lower byte of sectors_intr IDENTIFY word as sector count.Alexander Motin2009-11-241-1/+1
| | | | | | | | This fixes SET_MULTI error during boot on devices supporting less then 16 sectors per interrupt. Notes: svn path=/head/; revision=199749
* Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)Alexander Motin2009-11-081-5/+5
| | | | | | | | | command timeout. Submitted by: keramida Notes: svn path=/head/; revision=199050
* Increase ATA command timeouts. Some drives need more then 5s to spin-up.Alexander Motin2009-10-261-4/+4
| | | | | | | PR: kern/111023 Notes: svn path=/head/; revision=198486
* Remove 'ad:' prefix from disk serial number. We don't want serial numberPawel Jakub Dawidek2009-09-041-2/+2
| | | | | | | | | | to change when we reconnect the disk in a way that it is accessible through CAM for example. Discussed with: trasz Notes: svn path=/head/; revision=196822
* Improve kernel dumping reliability for busy ATA channels:Alexander Motin2009-05-011-2/+10
| | | | | | | | | | | | - 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. Notes: svn path=/head/; revision=191717
* Revert my ata_identify()/ata_reinit() related changes: r189166, r189091Alexander Motin2009-02-281-12/+0
| | | | | | | | | | | | | | | | | 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-0/+12
| | | | | | | | | | | | | | 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
* Teach device drivers' ata_reinit() methods, that there can be more then twoAlexander Motin2009-02-211-3/+2
| | | | | | | devices per channel. Notes: svn path=/head/; revision=188897
* Fix shutdown routine to return 0 and change signature from void returnWarner Losh2009-02-041-1/+2
| | | | | | | to int. Notes: svn path=/head/; revision=188126
* Fix panic and breakage for non-DMA ATA devices e.g. powermac macio cells.Peter Grehan2008-05-081-1/+1
| | | | | | | | | | | | | Handle cases where dma function pointers may be NULL, and where the max_iosize can't be derived from a DMA data structure. For the latter, revert to the prior behaviour of using DFLTPHYS for the max i/o size when there is no other data. Reviewed by: marcel No objection by: sos Notes: svn path=/head/; revision=178856
* Go back to preallocating everything possible on init.Søren Schmidt2008-04-171-3/+6
| | | | | | | | 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 the brokenness in the former commit, sorry for the mess.Søren Schmidt2008-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 Notes: svn path=/head/; revision=178114
* Add experimental support for SATA Port MultipliersSøren Schmidt2008-04-101-48/+117
| | | | | | | | | | 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-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* If the disk reports that it support the Compact Flash Association commandPoul-Henning Kamp2008-01-021-0/+9
| | | | | | | | | | | | | | | set, announce BIO_DELETE capability and issue ATA_CFA_ERASE when we get one. Once we issue more BIO_DELETE, this will improve lifetime, and possibly write speed of Flash based devices which have usable flash adaptation layers. For now, about the only usage is the newfs(1) -E flag. Approved by: sos Notes: svn path=/head/; revision=175060
* Add preliminary SATA ATAPI support for sii 3132/3124 chips.Søren Schmidt2007-11-231-0/+2
| | | | Notes: svn path=/head/; revision=173868
* Add Viking Interworks 256MB as an ata device; this might giveRemko Lodder2007-06-261-1/+2
| | | | | | | | | | | | | | | some false positives but at this moment it is better to add support then to dont have it at all (comment from Soren). PR: kern/111516 Submitted by: Thomas Nystrom <thn at saeab dot se> Approved by: re (kensmith) Approved by: imp (mentor) OK'ed by: sos (With the comment noted above about false positives). Notes: svn path=/head/; revision=171054
* File d_ident field with disk's serial number.Pawel Jakub Dawidek2007-05-061-0/+2
| | | | | | | No answer from: sos Notes: svn path=/head/; revision=169300
* Use the same timeout parameters for BIO_FLUSH as with the other commands.Ollivier Robert2007-04-261-2/+0
| | | | | | | | | | | This workaround the problem in Parallels/VMWare where the emulated drivers are slower, especially with ATA_FLUSHCACHE. The problem appears much more frequently with ZFS which use it a lot more. Approved: sos, pjd Notes: svn path=/head/; revision=169058
* Update copyright headers.Søren Schmidt2007-02-211-1/+1
| | | | Notes: svn path=/head/; revision=166878
* Implement BIO_FLUSH handling for da(4), amr(4), ata(4) and ataraid(4).Pawel Jakub Dawidek2006-10-311-0/+13
| | | | | | | Sponsored by: home.pl Notes: svn path=/head/; revision=163834
* If current_heads or current_sectors in the disk cap page are zero, dont try ↵Søren Schmidt2006-09-141-1/+2
| | | | | | | | | to use the current_ geometry. This avoids a panic with BIOS'n that sets these to zero. Notes: svn path=/head/; revision=162311
* Most platforms map the actual drive geometry to the firmware's notionWarner Losh2006-08-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | | of geometry. However, some platforms have a more complicated mapping of the firmware values to the actual values. pc98 is the only platform that currently does this. This mapping is necessary for large disks connected to pc98 boxes, as the firmware labels require do special hacks to the actual geometry for interoperability. We cannot do this all in the geom layer because of initialization issues (geom looks for an already initialized pc98 label, but we need the geometry information prior to initialization, classic chicken and egg problem). We pass the disk and the device_t to this function because the geometry mapping depends on what kind of controller is used. This hook allows platforms that want to override things to do so, and has 0 overhead on all other platforms. These patches have been in use locally for a long time, and received good feedback from the pc98 community and sos@ at various times during their development. MFC After: 1 week Notes: svn path=/head/; revision=161128
* Make the ATAPI sense data accessible when using the ioctl interfaceSøren Schmidt2006-03-311-3/+10
| | | | | | | MFC candidate. Notes: svn path=/head/; revision=157329
* Get rid of all the "long long"/"maxint" casting around in printf's.Søren Schmidt2006-03-091-5/+3
| | | | | | | | On all our platforms intmax == int64_t so simply using %j to print int64_t's is safe all over, and doesn't pullute the code. Notes: svn path=/head/; revision=156473
* Fix the build. %ju prints uintmax_t not unsigned long long (which isMax Laier2006-03-061-3/+3
| | | | | | | actually "longer" than uintmax_t for the understanding of printf). Notes: svn path=/head/; revision=156355
* Update atapi-fd to support direct devices such as disks.Søren Schmidt2006-03-051-2/+2
| | | | Notes: svn path=/head/; revision=156320
* Add support for using DMA on dump, greatly speeds up the dump process.Søren Schmidt2006-01-181-35/+13
| | | | | | | Add dump support in ataraid. Notes: svn path=/head/; revision=154507
* Get rid of the advertising clause in the copyright.Søren Schmidt2006-01-051-3/+1
| | | | Notes: svn path=/head/; revision=154063
* Normalize a significant number of kernel malloc type names:Robert Watson2005-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names. Notes: svn path=/head/; revision=151897
* Add support for working around controllers that cannot do DMA in 48bit mode.Søren Schmidt2005-08-171-2/+2
| | | | | | | | The workaround use PIO mode above ~137GB to allow using the disk. Add the Acer chips with rev < 0xc4 as first candidate. Notes: svn path=/head/; revision=149191
* Dont call ata_finish in ad_dump as that is no longer needed and causes panic.Søren Schmidt2005-06-271-10/+11
| | | | | | | | | | Dont try to enable read/write caching on devices that doesn't support it, this reduces the noise from ATA on flash devices and the like. Approved by: re@ (scottl) Notes: svn path=/head/; revision=147627
* Change the way ioctls are issue to ATA.Søren Schmidt2005-05-161-0/+8
| | | | | | | | | The most prominent part is that its now possible to issue ata_requests directly to say acd0, instead of going through the cumbersome /dev/ata device. Notes: svn path=/head/; revision=146266
* Take newbusification one step further, ie use the device_t more consequentlySøren Schmidt2005-04-301-7/+6
| | | | | | | | | | all way through the code down the layers, instead of the mix'n'match that resulted from the conversion done earlier. Sponsored by: pair.com Notes: svn path=/head/; revision=145713
* CFA (Compact Flash) devices has a special config ID that fails theSøren Schmidt2005-04-191-1/+2
| | | | | | | normal ATA device check in ata-disk.c. Add support for the CFA magic. Notes: svn path=/head/; revision=145273
* Move the creation of ata_channel child devices to the channel code.Søren Schmidt2005-04-151-30/+7
| | | | | | | | | | | | This allows to attach to the children (ATA devices) even without a driver being attached. This allows atapi-cam to do its work both with and without the pure ATAPI driver being present. ATA patches by /me ATAPI-cam pathes by Thomas Notes: svn path=/head/; revision=145102
* Change the ata_* methods to use a channel device instead of aSøren Schmidt2005-03-311-2/+2
| | | | | | | | controller device. This helps when there is no controller parent to a channel (PPC port). Notes: svn path=/head/; revision=144397
* This is the much rumoured ATA mkIII update that I've been working on.Søren Schmidt2005-03-301-225/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o ATA is now fully newbus'd and split into modules. This means that on a modern system you just load "atapci and ata" to get the base support, and then one or more of the device subdrivers "atadisk atapicd atapifd atapist ataraid". All can be loaded/unloaded anytime, but for obvious reasons you dont want to unload atadisk when you have mounted filesystems. o The device identify part of the probe has been rewritten to fix the problems with odd devices the old had, and to try to remove so of the long delays some HW could provoke. Also probing is done without the need for interrupts, making earlier probing possible. o SATA devices can be hot inserted/removed and devices will be created/ removed in /dev accordingly. NOTE: only supported on controllers that has this feature: Promise and Silicon Image for now. On other controllers the usual atacontrol detach/attach dance is still needed. o Support for "atomic" composite ATA requests used for RAID. o ATA RAID support has been rewritten and and now supports these metadata formats: "Adaptec HostRAID" "Highpoint V2 RocketRAID" "Highpoint V3 RocketRAID" "Intel MatrixRAID" "Integrated Technology Express" "LSILogic V2 MegaRAID" "LSILogic V3 MegaRAID" "Promise FastTrak" "Silicon Image Medley" "FreeBSD PseudoRAID" o Update the ioctl API to match new RAID levels etc. o Update atacontrol to know about the new RAID levels etc NOTE: you need to recompile atacontrol with the new sys/ata.h, make world will take care of that. NOTE2: that rebuild is done differently from the old system as the rebuild is now done piggybacked on read requests to the array, so atacontrol simply starts a background "dd" to rebuild the array. o The reinit code has been worked over to be much more robust. o The timeout code has been overhauled for races. o Support of new chipsets. o Lots of fixes for bugs found while doing the modulerization and reviewing the old code. Missing or changed features from current ATA: o atapi-cd no longer has support for ATAPI changers. Todays its much cheaper and alot faster to copy those CD images to disk and serve them from there. Besides they dont seem to be made anymore, maybe for that exact reason. o ATA RAID can only read metadata from all the above metadata formats, not write all of them (Promise and Highpoint V2 so far). This means that arrays can be picked up from the BIOS, but they cannot be created from FreeBSD. There is more to it than just the missing write metadata support, those formats are not unique to a given controller like Promise and Highpoint formats, instead they exist for several types, and even worse, some controllers can have different formats and its impossible to tell which one. The outcome is that we cannot reliably create the metadata of those formats and be sure the controller BIOS will understand it. However write support is needed to update/fail/rebuild the arrays properly so it sits fairly high on the TODO list. o So far atapicam is not supported with these changes. When/if this will change is up to the maintainer of atapi-cam so go there for questions. HW donated by: Webveveriet AS HW donated by: Frode Nordahl HW donated by: Yahoo! HW donated by: Sentex Patience by: Vife and my boys (and even the cats) Notes: svn path=/head/; revision=144330
* Use BUS_PROBE_DEFAULT for pci probe return valueWarner Losh2005-03-051-0/+30
| | | | Notes: svn path=/head/; revision=143163
* Compensate for off by one bugs in disk firmware for 48BIT addressing cutover.Søren Schmidt2004-12-091-1/+1
| | | | Notes: svn path=/head/; revision=138617
* Move the PC98 specific geometry "gunk" to geom_pc98.c where it belongs.Søren Schmidt2004-10-071-5/+1
| | | | | | | | | | | This also adds support for bigger disks on the controller I have access to, and maybe others if I understood the adhoc methods used on those. Those with more PC98 bigdrive controllers it is hereby invited to add/fix support for those in geom_pc98.c and not using #ifdef PC98 all over the place. Notes: svn path=/head/; revision=136233