Parent Directory
|
Revision Log
| Links to HEAD: | (view) (download) (annotate) |
| Sticky Revision: |
ata: clean up empty lines in .c and .h files
Use a void * argument to callout handlers instead of timeout_t casts. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22684
sys/dev: further adoption of SPDX licensing ID tags. Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
Small typo.
Add unmapped I/O support to ata(4) driver. Main problem there was PIO mode support, that required KVA mapping. Handle that case using recently added pmap_quick_enter_page(9) KPI, mapping data pages to KVA one at a time.
Fix several typos PR: kern/176054 Submitted by: Christoph Mallon <christoph.mallon@gmx.de> MFC after: 3 days
- With the demise of !ATA_CAM, ATA_STATIC_ID is the only ata(4) related 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. - 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 all legacy ATA code parts, not used since options ATA_CAM enabled in 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
Improve r238673 to additionally allow for odd-aligned buffers as 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) for 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
Remove bogus break statements. Obtained from: DragonFly
Use 16bit PIO instead of 32bit in case of misaligned buffer. It fixes kernel panic during CD write with cdrecord on sparc64.
Convert files to UTF-8
Make PATA-like soft-reset in ata(4) more strict in checking disk signature. It allows to avoid false positive device detection under Xen, that caused long probe delays due to subsequent IDENTIFY command timeouts. MFC after: 1 month
Mark command submission timeouts as timeouts. This should trigger device resets and increase chances of getting device back again.
Add support for odd-sized PIO transfers, sometimes used by ATAPI.
Fix a problem where device detection would work unreliably on Serverworks 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 into 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.
Some revisions of the Serverworks K2 SATA controller have a data 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
MFp4: 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)
MFp4: - 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.
Fix panic and breakage for non-DMA ATA devices e.g. powermac macio cells. 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
Go back to preallocating everything possible on init. 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. Fix or rather bring ENOMEM problems back to the state it was before. Temporarily disable PortMultipliers on AHCI devices.
Add experimental support for SATA Port Multipliers 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!
Implement a workaround of the datacorruption problem on serverworks HT1000 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 support for 64bit addressing to AHCI and Marvell controllers. Munged into ATA shape and Marvell specifics my yours truely. Submitted by: jhb
Update copyright headers.
Add preliminary support for the Serverworks HT1000 chip. HW sponsored by: Yahoo!
Add support for using DMA on dump, greatly speeds up the dump process. Add dump support in ataraid.
Get rid of the advertising clause in the copyright.
Dont use the BUS_DMA_ALLOCNOW flag. Instead use BUS_DMA_NOWAIT and return ENOMEM to the upper layers if we run out of memory. This solves part of the trouble with running on >4GB memory systems.
Fix two identical harmless typos in ata error messages: s/issueing/issuing/ PR: kern/89481 Submitted by: John Nielsen Approved by: sos MFC after: 1 week
Dont wait for READY on ATAPI_IDENTIFY. Fixes the losage of some ATAPI device that reported failed probing with "timeout waiting for read DRQ".
Harden the hotplug support for SATA devices. This also fixes a few races that was present in the timeout/detach code. Sponsored by: pair.com
Add support for working around controllers that cannot do DMA in 48bit mode. The workaround use PIO mode above ~137GB to allow using the disk. Add the Acer chips with rev < 0xc4 as first candidate.
Change the way ioctls are issue to ATA. 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.
Fix more ATAPI breakage. Apparently some devices are very picky on details :)
Fix ATAPI DMA. We need to set the proper flags for DMA modes.
Reshape the dma code to be a bit more flexible so it can cope with new HW that has new and different demands. Fix a few nits in former commit in this cleanup crusade. Sponsored by: pair.com
Update on the last commit, the dma* funciton needs to be called with a channel device, not an ata device, or we'll be out of luck in reset/timeout where we dont have a device.
Take newbusification one step further, ie use the device_t more consequently 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
Now that probing is working in the new fashion, we need to go back to having ata_getparm issue an ata_request and not fool around with the HW on its own. Needed for new HW support.
Rearrange the way the reset code is called. Prepare for different looking controllers.
Rehash the timeout code to make it more simple. This also removes the warning timeout on the taskqueues stalling as I'm tired of getting ATA error reports for problems in other parts ;) Misc cosmetic and comment cleanups now we are here.
Read back the real taskfile register values when in 48BIT mode.
Generalise the SATA PHY handling code so it wont be duplicated for each SATA chip. Promise and Silicon Image are the current candidates for this.
Add support for controllers that doesn't have the usual taskfile layout. No functional changes.
Fix a buglet that caused slaves to be nondetected.
Change the ata_* methods to use a channel device instead of a controller device. This helps when there is no controller parent to a channel (PPC port).
This is the much rumoured ATA mkIII update that I've been working on.
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)
Whitespace nit. Clarifies which body this line belongs to.
Handle PIO timeouts in ata_end_transaction() by immediately returning. Failure to do this will result in following ata_pio_read() calls walking off the end of the read buffer. This resolves the "memory modified after free" panics common with Thinkpads and CD/DVD drives. Submitted by: Nate Lawson <nate AT root.org>
In ata_generic_reset() while waiting for both master & slave to become idle the 'mask' variable could be set to 0, resulting in the timeout loop running for the full 31 seconds. Handling this case eliminates long hangs on resume on some systems. Submitted by: Nate Lawson <nate AT root.org>
Loosen the probe a bit. Try to get out of probing as early as possible on (hopefully) vacant channels.
Compensate for off by one bugs in disk firmware for 48BIT addressing cutover.
Return ATA register values in the request struct when ATAREQUEST returns.
Remove the old ATA_*LOCK_CH macros that used atomic ops and use mutexes instead. This closes the last (known) race issues in ATA which should fix the various hangs etc seen on heavy loaded systems. Change from using timeout functions to using callout functions in the timeout code. This together with above closes the race that could happen if timeout and device interrupt occured simultaniously. Also fix the possible recursion in ata_reinit() on very dodgy devices that could take us down in the probe.
Introduce ata_udelay() that uses tsleep instead of DELAY if possible. In places where we have long delays that doesn't depend on too accurate timing, use ata_udelay() instead of DELAY() so we dont uselessly spin the CPU if not nessesary;
remove unused prototype
Fix the handling of "inflight" requests when doing reinit's. Add missing untimeout that would get lost in handling of some error situations, and caused what looked like random timeouts afterwards when the timeout fired.
Improve (hopefully) on the workaround code for devices that doesn't interrupt when command is done, ie some ATAPI CD drives with no media loaded.
Correct the last commit so it works in error situations as well.
Fix a panic in ata_generic_transaction(). The DMA pointer of the channel was being unconditionally dereferenced but was NULL for PIO requests. Check the request flags for a DMA transaction before dereferencing. Reported by: ceri Tested by: Radek Kozlowski <radek -at- raadradd.com>
Try to narrow down the race window on HW that does not have ways to poll for which channel actually pulled the irq line.
Refine the wait for ATAPI_RESET. Properly wait for not busy and introduce a timeout for devices not setting busy (as they should). Leave a printf in there that states how long the wait was, as I'd like to get an idea of the variations here. The time needed seems also to be affected by whether a medium is present or not.
Dont expect interrupt from ATAPI_RESET, it doesn't deliver one.
Back out the last change as that broke some SATA devices. Now we are cleaing up remove a few lines of unused code.
Dont retry on devices that left the system. Ignore "fake" devices that has 0x7f status.
Rip out the too verbose "spurious interrupt" printf's, they dont serve a purpose any longer.
Spring cleanup of macros
Reduce the time spent looking for devices on channels that return what looks like garbage.
Move a verbose printf before the first exit so we get a chance to see what was there.
Add support for the Promise command sequencer present on all modern Promise controllers (PDC203** PDC206**). This also adds preliminary support for the Promise SX4/SX4000 but *only* as a "normal" Promise ATA controller (ATA RAID's are supported though but only RAID0, RAID1 and RAID0+1). This cuts off yet another 5-8% of the command overhead on promise controllers, making them the fastest we have ever had support for. Work is now continuing to add support for this in ATA RAID, to accellerate ATA RAID quite a bit on these controllers, and especially the SX4/SX4000 series as they have quite a few tricks in there.. This commit also adds a few fixes to the SATA code needed for proper support.
Add support for detaching PCI controllers. This adds support for cardbus ATA/SATA controllers. I get roughly the same transfer speeds as on true PCI controllers. Nice to be able to add a couble of "real" disks to a laptop :)
Only register interrupt as seen if it was a real HW interrupt.
Move the enabling of interrupt back to where it was some time ago. This apparently was what broke the boot with some devices (liteon).
Use the biotask functionality in GEOM to put finished requests on instead of taskqueue_swi. This shaves from 1 to 10% of the overhead. Overhaul the locking once more, there was a few possible races that are now closed.
Use UMA instead of plain malloc for getting ATA request storage. This gives +10% performance on simple tests, so definitly worth it. A few percent more could be had by not using M_ZERO'd alloc's, but we then need to clear fields all over the place to be safe, and that was deemed not worth the trouble (and it makes life dangerous).
Overhaul of the timeout/reinit framework. This should clear up most of the leftovers from the old version that really doesn't work anymore. Add a reset function for host-end of the ATA channel. This is needed for the SiI3112 in order to whack it back to reality if a device locks up the SATA interface (thereby preventing that we can reset the device). The result is that ATA now recovers from the timeouts that happens with the SiI3112A and more or less all disks based on old PATA electronics with a Marvell PATA->SATA converter. This includes lots of the popular SATA dongles and the WDC Raptor disks..
Finetune last commit, we need to take care of empty channels.
Fix for the missing slave problem. Approved by: re@
On ATA control commands return the registers in the request.
Properly unload the DMA SG list on errors.
Fix the DMA problem that most severely hit on the DS3112a SATA chip in connection with Marvell based SATA->PATA dongles. The problem was caused by a combination of things working together to make it hard to spot... The ATA driver has always started the ATA command, then build the SG list for DMA and then finally started the DMA engine. While this is according to specs, it poses a potential problem as some controllers apparently do not allow for unlimitted time between starting the ATA command and starting the DMA engine. At about the same time as ATAng was committed there were lots of other changes applied, some of which was locking in parts that causes the busdma load functions to take significantly longer to load the SG list. This pushed the time spent between starting the ATA command and starting the DMA engine over the hill for some controllers (especially the Silicon Image DS3112a) and caused what looked like lost interrupts. The solution is to get all the SG list work or rather all busdma related stuff done before we even try to start anything. This has the nice side effect of seperating busdma out the way it should be, so the working of the ATA machinery is not cluttered up with busdma droppings, making the code easier to read and understand.
Up delay from 10 to 100ms after reset, this helps some slow devices get their act together before we start probing.
Fix the bug that prevented DMA from working on old Acer chips. Found by: Andrew Gallatin <gallatin@cs.duke.edu> Pointy hat to: sos
Properly get out of transaction() if setting up the transfer fails.
Fix the problem with accessing certain FLASH devices. The problem was that accessing the status reg could occour too fast, confusing the logic in the flash part. Could not have been located without: HW donated by: Jonas Bülow <jonas@servicefactory.se>
Dont reject a master device if it said slave failed.
Cosmetics
Be a bit more restrictive in the probe so we dont hang around on empty channels in most cases.
When ignoring interrupts (due to no running request set) then try to grap the channel so we can read status (and clear an evt pending interrupt).
Rearrange the probe a bit first try ATAPI signatures then ATA.
Try a bit harder to probe disks that doesn't quite set BUSY right.
#ifdef out the vague ATA disk detection code causing fake ATA disks to be found on some systems. Hopefully this doesn't loose any real ATA disks...
Handle shared channels better. Try to avoid the spurios interrupts better.
Rearrange the probe code yet again.
Be more carefull on nulling the ATAPI magic for fake slave. Skip polling devices that keeps returning 0xff early (ie no HW there).
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.
| ViewVC Help | |
| Powered by ViewVC 1.1.27 |