/[base]/head/sys/dev/ata/ata-lowlevel.c
ViewVC logotype

Log of /head/sys/dev/ata/ata-lowlevel.c

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:


Revision 365115 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 1 21:40:47 2020 UTC (3 years, 10 months ago) by mjg
File length: 29082 byte(s)
Diff to previous 355426
ata: clean up empty lines in .c and .h files


Revision 355426 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 5 18:47:29 2019 UTC (4 years, 6 months ago) by jhb
File length: 29091 byte(s)
Diff to previous 326255
Use a void * argument to callout handlers instead of timeout_t casts.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D22684


Revision 326255 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 27 14:52:40 2017 UTC (6 years, 7 months ago) by pfg
File length: 29103 byte(s)
Diff to previous 297402
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.


Revision 297402 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 29 23:33:44 2016 UTC (8 years, 3 months ago) by pfg
File length: 29051 byte(s)
Diff to previous 286415
Small typo.


Revision 286415 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 7 14:38:26 2015 UTC (8 years, 10 months ago) by mav
File length: 29050 byte(s)
Diff to previous 250576
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.


Revision 250576 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 12 16:43:26 2013 UTC (11 years, 1 month ago) by eadler
File length: 26901 byte(s)
Diff to previous 249213
Fix several typos

PR:		kern/176054
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
MFC after:	3 days


Revision 249213 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 6 19:12:49 2013 UTC (11 years, 2 months ago) by marius
File length: 26902 byte(s)
Diff to previous 249203
- 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.


Revision 249203 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 6 15:02:06 2013 UTC (11 years, 2 months ago) by marius
File length: 26923 byte(s)
Diff to previous 249083
- 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


Revision 249083 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 4 07:12:24 2013 UTC (11 years, 3 months ago) by mav
File length: 26916 byte(s)
Diff to previous 246257
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


Revision 246257 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 2 21:57:06 2013 UTC (11 years, 5 months ago) by marius
File length: 27739 byte(s)
Diff to previous 242156
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


Revision 242156 - (view) (download) (annotate) - [select for diffs]
Modified Fri Oct 26 20:03:08 2012 UTC (11 years, 8 months ago) by mav
File length: 26859 byte(s)
Diff to previous 240627
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


Revision 240627 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 18 02:19:43 2012 UTC (11 years, 9 months ago) by kevlo
File length: 26602 byte(s)
Diff to previous 238673
Remove bogus break statements.

Obtained from:	DragonFly


Revision 238673 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 21 14:59:43 2012 UTC (11 years, 11 months ago) by mav
File length: 26611 byte(s)
Diff to previous 230132
Use 16bit PIO instead of 32bit in case of misaligned buffer.
It fixes kernel panic during CD write with cdrecord on sparc64.


Revision 230132 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jan 15 13:23:18 2012 UTC (12 years, 5 months ago) by uqs
File length: 26671 byte(s)
Diff to previous 220911
Convert files to UTF-8


Revision 220911 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 21 07:26:14 2011 UTC (13 years, 2 months ago) by mav
File length: 26670 byte(s)
Diff to previous 214896
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


Revision 214896 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 6 19:11:49 2010 UTC (13 years, 7 months ago) by mav
File length: 26618 byte(s)
Diff to previous 214880
Mark command submission timeouts as timeouts. This should trigger device
resets and increase chances of getting device back again.


Revision 214880 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 6 14:22:50 2010 UTC (13 years, 7 months ago) by mav
File length: 26513 byte(s)
Diff to previous 212359
Add support for odd-sized PIO transfers, sometimes used by ATAPI.


Revision 212359 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 9 13:17:30 2010 UTC (13 years, 9 months ago) by nwhitehorn
File length: 26128 byte(s)
Diff to previous 212145
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


Revision 212145 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 2 11:18:43 2010 UTC (13 years, 10 months ago) by mav
File length: 25924 byte(s)
Diff to previous 208870
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.


Revision 208870 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jun 6 14:09:48 2010 UTC (14 years ago) by nwhitehorn
File length: 26089 byte(s)
Diff to previous 200171
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


Revision 200171 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 6 00:10:13 2009 UTC (14 years, 6 months ago) by mav
File length: 25804 byte(s)
Diff to previous 198717
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)


Revision 198717 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 31 13:24:14 2009 UTC (14 years, 8 months ago) by mav
File length: 25610 byte(s)
Diff to previous 178856
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.


Revision 178856 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 8 17:55:44 2008 UTC (16 years, 1 month ago) by grehan
File length: 25791 byte(s)
Diff to previous 178278
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


Revision 178278 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 17 12:29:35 2008 UTC (16 years, 2 months ago) by sos
File length: 25755 byte(s)
Diff to previous 178203
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.


Revision 178203 - (view) (download) (annotate) - [select for diffs]
Modified Mon Apr 14 18:34:24 2008 UTC (16 years, 2 months ago) by sos
File length: 25751 byte(s)
Diff to previous 178067
Fix problem with slave devices.
Fix or rather bring ENOMEM problems back to the state it was before.
Temporarily disable PortMultipliers on AHCI devices.


Revision 178067 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 10 13:05:05 2008 UTC (16 years, 2 months ago) by sos
File length: 25771 byte(s)
Diff to previous 174576
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!


Revision 174576 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 13 11:47:36 2007 UTC (16 years, 6 months ago) by sos
File length: 25977 byte(s)
Diff to previous 168430
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


Revision 168430 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 6 16:18:59 2007 UTC (17 years, 3 months ago) by sos
File length: 25426 byte(s)
Diff to previous 166878
Add support for 64bit addressing to AHCI and Marvell controllers.
Munged into ATA shape and Marvell specifics my yours truely.

Submitted by: jhb


Revision 166878 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 21 19:07:19 2007 UTC (17 years, 4 months ago) by sos
File length: 25425 byte(s)
Diff to previous 160096
Update copyright headers.


Revision 160096 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 4 20:36:03 2006 UTC (18 years ago) by sos
File length: 25425 byte(s)
Diff to previous 154507
Add preliminary support for the Serverworks HT1000 chip.

HW sponsored by:	Yahoo!


Revision 154507 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 18 09:14:55 2006 UTC (18 years, 5 months ago) by sos
File length: 25424 byte(s)
Diff to previous 154063
Add support for using DMA on dump, greatly speeds up the dump process.
Add dump support in ataraid.


Revision 154063 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 5 21:27:19 2006 UTC (18 years, 6 months ago) by sos
File length: 25136 byte(s)
Diff to previous 153142
Get rid of the advertising clause in the copyright.


Revision 153142 - (view) (download) (annotate) - [select for diffs]
Modified Mon Dec 5 22:31:55 2005 UTC (18 years, 7 months ago) by sos
File length: 25288 byte(s)
Diff to previous 152883
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.


Revision 152883 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 28 13:23:15 2005 UTC (18 years, 7 months ago) by keramida
File length: 25238 byte(s)
Diff to previous 150311
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


Revision 150311 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 19 07:35:42 2005 UTC (18 years, 9 months ago) by sos
File length: 25240 byte(s)
Diff to previous 150129
Dont wait for READY on ATAPI_IDENTIFY.
Fixes the losage of some ATAPI device that reported failed probing with
"timeout waiting for read DRQ".


Revision 150129 - (view) (download) (annotate) - [select for diffs]
Modified Wed Sep 14 12:45:06 2005 UTC (18 years, 9 months ago) by sos
File length: 25154 byte(s)
Diff to previous 149191
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


Revision 149191 - (view) (download) (annotate) - [select for diffs]
Modified Wed Aug 17 15:00:33 2005 UTC (18 years, 10 months ago) by sos
File length: 25135 byte(s)
Diff to previous 146266
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.


Revision 146266 - (view) (download) (annotate) - [select for diffs]
Modified Mon May 16 13:07:27 2005 UTC (19 years, 1 month ago) by sos
File length: 25119 byte(s)
Diff to previous 146176
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.


Revision 146176 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 13 07:58:05 2005 UTC (19 years, 1 month ago) by sos
File length: 25475 byte(s)
Diff to previous 146096
Fix more ATAPI breakage.
Apparently some devices are very picky on details :)


Revision 146096 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 11 12:41:35 2005 UTC (19 years, 1 month ago) by sos
File length: 25334 byte(s)
Diff to previous 145818
Fix ATAPI DMA. We need to set the proper flags for DMA modes.


Revision 145818 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 3 07:55:07 2005 UTC (19 years, 2 months ago) by sos
File length: 25261 byte(s)
Diff to previous 145769
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


Revision 145769 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 1 12:24:45 2005 UTC (19 years, 2 months ago) by sos
File length: 26370 byte(s)
Diff to previous 145713
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.


Revision 145713 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 30 16:22:07 2005 UTC (19 years, 2 months ago) by sos
File length: 26415 byte(s)
Diff to previous 145676
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


Revision 145676 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 29 11:30:03 2005 UTC (19 years, 2 months ago) by sos
File length: 26207 byte(s)
Diff to previous 145641
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.


Revision 145641 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 28 22:08:08 2005 UTC (19 years, 2 months ago) by sos
File length: 29877 byte(s)
Diff to previous 145354
Rearrange the way the reset code is called.
Prepare for different looking controllers.


Revision 145354 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 21 11:13:39 2005 UTC (19 years, 2 months ago) by sos
File length: 30034 byte(s)
Diff to previous 145064
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.


Revision 145064 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 14 08:48:45 2005 UTC (19 years, 2 months ago) by sos
File length: 29684 byte(s)
Diff to previous 144790
Read back the real taskfile register values when in 48BIT mode.


Revision 144790 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 8 09:37:47 2005 UTC (19 years, 2 months ago) by sos
File length: 29033 byte(s)
Diff to previous 144707
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.


Revision 144707 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 6 10:22:56 2005 UTC (19 years, 3 months ago) by sos
File length: 29166 byte(s)
Diff to previous 144591
Add support for controllers that doesn't have the usual taskfile
layout.  No functional changes.


Revision 144591 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 3 13:03:53 2005 UTC (19 years, 3 months ago) by sos
File length: 29154 byte(s)
Diff to previous 144397
Fix a buglet that caused slaves to be nondetected.


Revision 144397 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 31 15:05:40 2005 UTC (19 years, 3 months ago) by sos
File length: 29105 byte(s)
Diff to previous 144330
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).


Revision 144330 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 30 12:03:40 2005 UTC (19 years, 3 months ago) by sos
File length: 29133 byte(s)
Diff to previous 143172
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)


Revision 143172 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 6 10:17:30 2005 UTC (19 years, 4 months ago) by njl
File length: 25014 byte(s)
Diff to previous 142974
Whitespace nit.  Clarifies which body this line belongs to.


Revision 142974 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 2 03:59:28 2005 UTC (19 years, 4 months ago) by mdodd
File length: 25011 byte(s)
Diff to previous 142972
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>


Revision 142972 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 2 03:34:51 2005 UTC (19 years, 4 months ago) by mdodd
File length: 24901 byte(s)
Diff to previous 139261
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>


Revision 139261 - (view) (download) (annotate) - [select for diffs]
Modified Fri Dec 24 13:38:25 2004 UTC (19 years, 6 months ago) by sos
File length: 24823 byte(s)
Diff to previous 138617
Loosen the probe a bit.
Try to get out of probing as early as possible on (hopefully) vacant
channels.


Revision 138617 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 9 07:31:06 2004 UTC (19 years, 6 months ago) by sos
File length: 24555 byte(s)
Diff to previous 138043
Compensate for off by one bugs in disk firmware for 48BIT addressing cutover.


Revision 138043 - (view) (download) (annotate) - [select for diffs]
Modified Wed Nov 24 10:47:26 2004 UTC (19 years, 7 months ago) by sos
File length: 24546 byte(s)
Diff to previous 135819
Return ATA register values in the request struct when ATAREQUEST returns.


Revision 135819 - (view) (download) (annotate) - [select for diffs]
Modified Sun Sep 26 11:48:43 2004 UTC (19 years, 9 months ago) by sos
File length: 24491 byte(s)
Diff to previous 134698
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.


Revision 134698 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 3 12:10:44 2004 UTC (19 years, 10 months ago) by sos
File length: 25431 byte(s)
Diff to previous 134413
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;


Revision 134413 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 27 22:14:45 2004 UTC (19 years, 10 months ago) by sos
File length: 25324 byte(s)
Diff to previous 134380
remove unused prototype


Revision 134380 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 27 14:48:32 2004 UTC (19 years, 10 months ago) by sos
File length: 25416 byte(s)
Diff to previous 133834
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.


Revision 133834 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 16 09:32:35 2004 UTC (19 years, 10 months ago) by sos
File length: 25169 byte(s)
Diff to previous 133266
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.


Revision 133266 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 7 12:49:28 2004 UTC (19 years, 10 months ago) by sos
File length: 25310 byte(s)
Diff to previous 133235
Correct the last commit so it works in error situations as well.


Revision 133235 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 6 22:23:53 2004 UTC (19 years, 11 months ago) by njl
File length: 25329 byte(s)
Diff to previous 133184
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>


Revision 133184 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 5 21:13:41 2004 UTC (19 years, 11 months ago) by sos
File length: 25299 byte(s)
Diff to previous 132606
Try to narrow down the race window on HW that does not have ways to
poll for which channel actually pulled the irq line.


Revision 132606 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 24 19:03:28 2004 UTC (19 years, 11 months ago) by sos
File length: 25199 byte(s)
Diff to previous 132582
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.


Revision 132582 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 23 17:01:47 2004 UTC (19 years, 11 months ago) by sos
File length: 24977 byte(s)
Diff to previous 130340
Dont expect interrupt from ATAPI_RESET, it doesn't deliver one.


Revision 130340 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 11 07:39:15 2004 UTC (20 years ago) by sos
File length: 24677 byte(s)
Diff to previous 129935
Back out the last change as that broke some SATA devices.
Now we are cleaing up remove a few lines of unused code.


Revision 129935 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 1 11:34:46 2004 UTC (20 years, 1 month ago) by sos
File length: 24818 byte(s)
Diff to previous 129347
Dont retry on devices that left the system.
Ignore "fake" devices that has 0x7f status.


Revision 129347 - (view) (download) (annotate) - [select for diffs]
Modified Mon May 17 17:53:12 2004 UTC (20 years, 1 month ago) by sos
File length: 24759 byte(s)
Diff to previous 128767
Rip out the too verbose "spurious interrupt" printf's, they dont serve
a purpose any longer.


Revision 128767 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 30 16:21:34 2004 UTC (20 years, 2 months ago) by sos
File length: 25139 byte(s)
Diff to previous 128686
Spring cleanup of macros


Revision 128686 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 27 15:52:08 2004 UTC (20 years, 2 months ago) by sos
File length: 25152 byte(s)
Diff to previous 128437
Reduce the time spent looking for devices on channels that return
what looks like garbage.


Revision 128437 - (view) (download) (annotate) - [select for diffs]
Modified Mon Apr 19 18:29:43 2004 UTC (20 years, 2 months ago) by sos
File length: 25156 byte(s)
Diff to previous 128183
Move a verbose printf before the first exit so we get a chance
to see what was there.


Revision 128183 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 13 09:44:20 2004 UTC (20 years, 2 months ago) by sos
File length: 25156 byte(s)
Diff to previous 127019
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.


Revision 127019 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 15 12:03:48 2004 UTC (20 years, 3 months ago) by sos
File length: 25369 byte(s)
Diff to previous 126072
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 :)


Revision 126072 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 21 16:55:10 2004 UTC (20 years, 4 months ago) by sos
File length: 25346 byte(s)
Diff to previous 125328
Only register interrupt as seen if it was a real HW interrupt.


Revision 125328 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 2 15:49:01 2004 UTC (20 years, 5 months ago) by sos
File length: 25301 byte(s)
Diff to previous 125159
Move the enabling of interrupt back to where it was some time ago.
This apparently was what broke the boot with some devices (liteon).


Revision 125159 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 28 20:38:51 2004 UTC (20 years, 5 months ago) by sos
File length: 25303 byte(s)
Diff to previous 124534
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.


Revision 124534 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 14 21:26:35 2004 UTC (20 years, 5 months ago) by sos
File length: 25295 byte(s)
Diff to previous 124403
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).


Revision 124403 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jan 11 22:08:34 2004 UTC (20 years, 5 months ago) by sos
File length: 25275 byte(s)
Diff to previous 123421
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..


Revision 123421 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 10 23:06:24 2003 UTC (20 years, 6 months ago) by sos
File length: 25713 byte(s)
Diff to previous 123127
Finetune last commit, we need to take care of empty channels.


Revision 123127 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 3 15:32:53 2003 UTC (20 years, 7 months ago) by sos
File length: 25677 byte(s)
Diff to previous 121910
Fix for the missing slave problem.

Approved by: re@


Revision 121910 - (view) (download) (annotate) - [select for diffs]
Modified Sun Nov 2 22:04:53 2003 UTC (20 years, 8 months ago) by sos
File length: 25630 byte(s)
Diff to previous 121311
On ATA control commands return the registers in the request.


Revision 121311 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 21 19:25:20 2003 UTC (20 years, 8 months ago) by sos
File length: 25331 byte(s)
Diff to previous 121310
Properly unload the DMA SG list on errors.


Revision 121310 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 21 19:20:37 2003 UTC (20 years, 8 months ago) by sos
File length: 25202 byte(s)
Diff to previous 121277
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.


Revision 121277 - (view) (download) (annotate) - [select for diffs]
Modified Mon Oct 20 13:44:33 2003 UTC (20 years, 8 months ago) by sos
File length: 25183 byte(s)
Diff to previous 120938
Up delay from 10 to 100ms after reset, this helps some slow devices
get their act together before we start probing.


Revision 120938 - (view) (download) (annotate) - [select for diffs]
Modified Thu Oct 9 14:33:06 2003 UTC (20 years, 8 months ago) by sos
File length: 25150 byte(s)
Diff to previous 120881
Fix the bug that prevented DMA from working on old Acer chips.

Found by: Andrew Gallatin <gallatin@cs.duke.edu>
Pointy hat to: sos


Revision 120881 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 7 13:45:56 2003 UTC (20 years, 9 months ago) by sos
File length: 25099 byte(s)
Diff to previous 120628
Properly get out of transaction() if setting up the transfer fails.


Revision 120628 - (view) (download) (annotate) - [select for diffs]
Modified Wed Oct 1 09:58:19 2003 UTC (20 years, 9 months ago) by sos
File length: 25164 byte(s)
Diff to previous 120279
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>


Revision 120279 - (view) (download) (annotate) - [select for diffs]
Modified Sat Sep 20 08:38:33 2003 UTC (20 years, 9 months ago) by sos
File length: 25121 byte(s)
Diff to previous 120204
Dont reject a master device if it said slave failed.


Revision 120204 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 18 16:44:54 2003 UTC (20 years, 9 months ago) by sos
File length: 25103 byte(s)
Diff to previous 120203
Cosmetics


Revision 120203 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 18 16:43:08 2003 UTC (20 years, 9 months ago) by sos
File length: 25126 byte(s)
Diff to previous 120128
Be a bit more restrictive in the probe so we dont hang around
on empty channels in most cases.


Revision 120128 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 16 15:21:37 2003 UTC (20 years, 9 months ago) by sos
File length: 25312 byte(s)
Diff to previous 120127
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).


Revision 120127 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 16 15:16:36 2003 UTC (20 years, 9 months ago) by sos
File length: 25410 byte(s)
Diff to previous 119953
Rearrange the probe a bit first try ATAPI signatures then ATA.


Revision 119953 - (view) (download) (annotate) - [select for diffs]
Modified Wed Sep 10 09:57:16 2003 UTC (20 years, 9 months ago) by sos
File length: 25178 byte(s)
Diff to previous 119879
Try a bit harder to probe disks that doesn't quite set BUSY right.


Revision 119879 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 8 08:36:46 2003 UTC (20 years, 9 months ago) by sos
File length: 25022 byte(s)
Diff to previous 119878
#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...


Revision 119878 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 8 08:32:25 2003 UTC (20 years, 9 months ago) by sos
File length: 25009 byte(s)
Diff to previous 119651
Handle shared channels better.
Try to avoid the spurios interrupts better.


Revision 119651 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 1 11:13:21 2003 UTC (20 years, 10 months ago) by sos
File length: 24844 byte(s)
Diff to previous 119523
Rearrange the probe code yet again.


Revision 119523 - (view) (download) (annotate) - [select for diffs]
Added Thu Aug 28 09:15:05 2003 UTC (20 years, 10 months ago) by sos
File length: 24519 byte(s)
Diff to previous 119501
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.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27