History log of /freebsd-10.0-release/sys/dev/ata/ata-all.h
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 249213 06-Apr-2013 marius

- 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.


# 249203 06-Apr-2013 marius

- 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


# 249202 06-Apr-2013 marius

Remove some more remnants of !ATA_CAM.


# 249083 04-Apr-2013 mav

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


# 249052 03-Apr-2013 mav

Add some more ATA_CAM ifdefs.

Submitted by: marius (partially)
MFC after: 1 week


# 247165 22-Feb-2013 mav

Fix command timeout caused by data underrun during fetching ATAPI sense
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.


# 246257 02-Feb-2013 marius

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


# 242156 26-Oct-2012 mav

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


# 241144 02-Oct-2012 mav

Implement SATA revision (speed) control for legacy SATA controller for
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


# 233282 21-Mar-2012 marius

- First pass at const'ifying ata(4) as appropriate.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers

MFC after: 1 week


# 230132 15-Jan-2012 uqs

Convert files to UTF-8


# 220563 12-Apr-2011 mav

Implement automatic SCSI sense fetching for ata(4) in ATA_CAM mode.
While it could be successfully done by CAM error recovery code, I was
told by several people that it is also a SIM obligation.


# 215468 18-Nov-2010 mav

Make ATA_CAM wrapper to report SATA power management capabilities to CAM to
make it configure device to initiate transitions if controller configured
to accept them. This makes hint.ata.X.pm_level=1 mode working.


# 214016 18-Oct-2010 mav

Set of legacy mode SATA enchancements:
- 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.


# 212359 09-Sep-2010 nwhitehorn

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


# 212145 02-Sep-2010 mav

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.


# 209664 03-Jul-2010 mav

Add ata(4) ability to limit initial ATA mode for devices via device hints.
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


# 208870 06-Jun-2010 nwhitehorn

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


# 205967 31-Mar-2010 mav

Include opt_ata.h, as some structures here depending on ATA_CAM option.
This fixes ATA_CAM with atamvsata and probably some other drivers.


# 203376 02-Feb-2010 mav

- Give ATA/SATA SIMs info about ATAPI packet size, supported by device.
- Make ATA XPT to reject longer SCSI CDBs then supported by device, or
any SCSI CDBs, if device doesn't support ATAPI.


# 200459 12-Dec-2009 marius

Unbreak the ata_atapi() usage. Since r200171 the mode setting functions
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


# 200171 05-Dec-2009 mav

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)


# 199050 08-Nov-2009 mav

Introduce define and kernel option ATA_REQUEST_TIMEOUT to control ATA(4)
command timeout.

Submitted by: keramida


# 198717 31-Oct-2009 mav

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.


# 198582 29-Oct-2009 nwhitehorn

Turn off use of ATA_A_4BIT on modern hardware. This flag was already
obsoleted in 1996 by ATA-2, and crashes some modern hardware like some
revisions of the Serverworks K2 SATA controller. Even very ancient
hardware seems not to require it. In the unlikely event this causes
problems, the previous behavior can be re-enabled by defining
ATA_LEGACY_SUPPORT at the top of this file.

Reviewed by: Alexander Motin <mav@freebsd.org>


# 194844 24-Jun-2009 raj

Move non-PCI prototypes from ata-pci.h -> ata-all.h.

This removes unnecessary PCI #includes dependency for systems with ATA
controllers living at non-PCI buses.

Submitted by: Piotr Ziecik
Obtained from: Semihalf


# 193277 01-Jun-2009 mav

MFp4.

Log supported AHCI controller capabilities.


# 191717 01-May-2009 mav

Improve kernel dumping reliability for busy ATA channels:
- 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.


# 191674 29-Apr-2009 mav

Add experimental support for SATA interface power management.
Feature is controlled by hint.ata.X.pm_level tunable:
0 - PM disabled, old behaviour, default.
1 - device is allowed to initiate PM state change, host is passive.
2 - host initiates PARTIAL state transition every time port is idle.
3 - host initiates SLUMBER state transition every time port is idle.

PARTIAL state has up to 100us (50us for me) wakeup latency, but for my
ICH8M saves 0.5W of power per drive. SLUMBER state has up to 10ms (3.5ms
for me) wakeup latency, but saves 0.8W of power.

Modes 2 and 3 are implemented only for AHCI driver now.

Interface power management is incompatible with device presence detection
(host receives no signal from drive, so unable to monitor it), so later is
disabled when PM is used.


# 189195 28-Feb-2009 mav

Revert my ata_identify()/ata_reinit() related changes: r189166, r189091
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.


# 189166 28-Feb-2009 mav

Rework device probing by moving ata_getparam() call from ata_identify() to
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.


# 189091 26-Feb-2009 mav

Remove direct ata_completed() call options from ata_finish(), except for the
kernel dumping case.

ata_completed() may initiate ata_reinit() on error, that may lead to drives
attach or detach. Attach and detach are sending requests to drives and sleep
waiting for results. But ata_finish() can be called directly from
interrupt handler where sleeping is prohibited, so we must break this chain
somewhere. This place seems to fit best.


# 188903 21-Feb-2009 mav

Improve ata_reinit():
- protect againtst recursions,
- add new devices detection using ata_identify().

Improve ata_identify():
- do not add duplicate device if device already exist.

Rework SATA hot-plug events handling. Instead of unsafe duplicate
implementation use common ata_reinit() to handle all state changes.

All together this gives quite stable and robust cold- and hot-plug operation,
invariant to false, lost and duplicate events.


# 188867 20-Feb-2009 mav

Fix typo: s/SLUMPER/SLUMBER/


# 188812 19-Feb-2009 mav

Use channel driver's attach/detach routines instead of ata_attach()/
ata_detach() to implement IOCATAATTACH/IOCATADETACH ioctls.
This will permit channel drivers to properly shutdown port hardware on channel
detach and init it on attach.


# 188731 17-Feb-2009 mav

ata_interrupt() does not need to return anything. It is not it's business
to report request completion, expecially when it is not reliable.


# 183724 09-Oct-2008 sos

This is the roumored ATA modulerisation works, and it needs a little explanation.

If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in.

However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries:

atacore: ATA core functionality, always needed for any ATA setup

atacard: CARDBUS support
atacbus: PC98 cbus support
ataisa: ISA bus support
atapci: PCI bus support only generic chipset support.

ataahci: AHCI support, also pulled in by some vendor modules.

ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia; Vendor support, ie atavia for VIA chipsets

atadisk: ATA disk driver
ataraid: ATA softraid driver

atapicd: ATAPI cd/dvd driver
atapifd: ATAPI floppy/flashdisk driver
atapist: ATAPI tape driver

atausb: ATA<>USB bridge
atapicam: ATA<>CAM bridge

This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file:

device atacore
device atapci
device atavia

And then you need the atadisk, atapicd etc lines in there just as usual.

If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual.
However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above.


# 181753 15-Aug-2008 philip

Introduce a new loader tunable "hw.ata.ata_dma_check_80pin", defaulting to 1.
This can be used to disable the 80pin cable check on systems which forget to
set the bit -- such as certain laptops and Soekris boards.

PR: kern/114605 (somewhat reworked)
Submitted by: marck
MFC after: 1 week


# 178278 17-Apr-2008 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.


# 178203 14-Apr-2008 sos

Fix problem with slave devices.
Fix or rather bring ENOMEM problems back to the state it was before.
Temporarily disable PortMultipliers on AHCI devices.


# 178179 13-Apr-2008 sos

Fix identify of slave devices.


# 178114 11-Apr-2008 sos

Fix the brokenness in the former commit, sorry for the mess.
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


# 178067 10-Apr-2008 sos

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!


# 177298 17-Mar-2008 phk

Add a "spindown" facility to ata-disks: If no requests have been received
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


# 175059 02-Jan-2008 phk

Follow the current fashion of gratuitously stomping into other
peoples code with irrelevant changes[1]:

Use bus_{read|write_*() instead of bus_space_{read|write}_*() for
purely stylistic reasons.

Due to compiler optimizations and inlining, this is for all practical
purposes without effect in the compiled code.

[1] NB: Approved by: sos


# 174576 13-Dec-2007 sos

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


# 173734 18-Nov-2007 sos

Add generic support for chipsets that say they support AHCI. This should catch new chipsets that we dont know but that we should support.
Add a few new PCI id's.
Misc cleanups.


# 171054 26-Jun-2007 remko

Add Viking Interworks 256MB as an ata device; this might give
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).


# 168500 08-Apr-2007 sos

Hopefully unbreak the 64bit DMA support this time.


# 168430 06-Apr-2007 sos

Add support for 64bit addressing to AHCI and Marvell controllers.
Munged into ATA shape and Marvell specifics my yours truely.

Submitted by: jhb


# 167344 08-Mar-2007 sos

Cleanup the channel/phy reset code.


# 166878 21-Feb-2007 sos

Update copyright headers.


# 166773 15-Feb-2007 sos

Support AHCI chips where the ports are not consecutively numbered as in
some incarnations of the ICH8 chip.
Also fix the panic introduced by the last commit.


# 160000 28-Jun-2006 sos

Update AHCI support to be more generic.
Add support for AHCI on the VIA VT8251.


# 157329 31-Mar-2006 sos

Make the ATAPI sense data accessible when using the ioctl interface

MFC candidate.


# 156434 08-Mar-2006 sos

ATA_USB will need to hook into the delayed boot identify to have
interrupts running, so externalize it.


# 156140 01-Mar-2006 sos

Work around the deadlock that occours when ATA waits for the taskqueue
to call back for completition and something else is holding the taskqueue
waiting for ATA to return data.
This should clear up the "semaphore timeout !! DANGER Will Robinson !!"
in most situations, and log "taskqueue timeout - completing request directly"
instead, with a delayed "WARNING - freeing taskqueue zombie request" when
the taskqueue finally calls us back with the now stale request.
(It would have been nice if there was a way to remove a scheduled item from
a taskqueue, but that is not currently implemented in the kernel).

A real fix for this is in the works but wont make it to 6.1RELEASE

definite MFC candidate.


# 155959 23-Feb-2006 sos

Keep the parent device (in this case the channel) around in ata_request,
so we dont panic device removal or failure.
Clean up ata_fail_requests to prevent the queue munging to fail.


# 155479 09-Feb-2006 sos

Unbreak Promise SATAII/150 controllers caused by the DMA dump changes.


# 154515 18-Jan-2006 sos

Whitespace cleanup.


# 154507 18-Jan-2006 sos

Add support for using DMA on dump, greatly speeds up the dump process.
Add dump support in ataraid.


# 154063 05-Jan-2006 sos

Get rid of the advertising clause in the copyright.


# 153752 27-Dec-2005 sos

Fix rebuilds of arrays that got stuck.
Misc minor fixes.

Bughunting and initial fixes by Pav@ and Anton.


# 152931 29-Nov-2005 sos

Fix the ata_composite/ata_request leak when using RAID0+1.

Submitted by: Michael Butler

Minor changes to fit ATA style by me.


# 152783 25-Nov-2005 sos

When IOCATAGPARM is called, update the capabilities page that is stored
in the kernel and return the new values.


# 151002 06-Oct-2005 sos

Add support for setting the SG list segment size.
Use this for the SiI3112 workaround to get rid of the "oversized DMA" errors.

MFC to 6.0 candidate.


# 149191 17-Aug-2005 sos

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.


# 148536 29-Jul-2005 sos

Remove stale struct ata_channel declaration.

Reported by: rodrigc


# 146266 16-May-2005 sos

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.


# 146106 11-May-2005 sos

Add support for AHCI compliant ATA devices.
For now just support the Intel ICH6 as that the HW at hand.

Sponsored by: pair.com


# 145818 03-May-2005 sos

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


# 145713 30-Apr-2005 sos

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


# 145676 29-Apr-2005 sos

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.


# 145641 28-Apr-2005 sos

Rearrange the way the reset code is called.
Prepare for different looking controllers.


# 145354 21-Apr-2005 sos

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.


# 145327 20-Apr-2005 sos

Properly hook in devices found by SATA connect events.
This broke on the changes done to get atapicam happy earlier.


# 145273 19-Apr-2005 sos

CFA (Compact Flash) devices has a special config ID that fails the
normal ATA device check in ata-disk.c. Add support for the CFA magic.


# 145239 18-Apr-2005 sos

Add uma zone for composite ops.

Submitted by: des


# 145102 15-Apr-2005 sos

Move the creation of ata_channel child devices to the channel code.
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


# 145064 14-Apr-2005 sos

Read back the real taskfile register values when in 48BIT mode.


# 144861 10-Apr-2005 sos

Refine the SATA PHY code so the time consumed during probe is reduced.

Add the older nVidia nForce2 SATA chip to supported HW.


# 144790 08-Apr-2005 sos

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.


# 144707 06-Apr-2005 sos

Add support for controllers that doesn't have the usual taskfile
layout. No functional changes.


# 144330 30-Mar-2005 sos

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)


# 138617 09-Dec-2004 sos

Compensate for off by one bugs in disk firmware for 48BIT addressing cutover.


# 136233 07-Oct-2004 sos

Move the PC98 specific geometry "gunk" to geom_pc98.c where it belongs.
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.


# 136198 06-Oct-2004 sos

Fix the PC98 lockups on boot.
The interchannel locking for PC98 needed to be updated to match the
rest of the locking in ATA.


# 135819 26-Sep-2004 sos

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.


# 134698 03-Sep-2004 sos

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;


# 134380 27-Aug-2004 sos

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.


# 133637 13-Aug-2004 sos

Allow the use of a supplied function to set the PRD table. This is
needed for new chips that supports 64bit addressing.


# 133184 05-Aug-2004 sos

Try to narrow down the race window on HW that does not have ways to
poll for which channel actually pulled the irq line.


# 128767 30-Apr-2004 sos

Spring cleanup of macros


# 128183 13-Apr-2004 sos

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.


# 127019 15-Mar-2004 sos

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 :)


# 126483 02-Mar-2004 sos

Report the original command on failures that causes auto sense.
Keep the ATA_R_QUIET flag if set during autosense.


# 126397 29-Feb-2004 sos

Rearrange sense_key and sense_data to get alignment right.

Submitted by: Marcel


# 126356 28-Feb-2004 sos

Issue a request sense command automagically when ATAPI commands fail
with a valid sense key.


# 125199 29-Jan-2004 sos

Cleanups/cosmetics.


# 125159 28-Jan-2004 sos

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.


# 124720 19-Jan-2004 sos

Fix breakage on timeout/retries. The bug cause a sema to be leaked so
that the calling process would newer wakeup.


# 124534 14-Jan-2004 sos

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).


# 124403 11-Jan-2004 sos

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..


# 123034 28-Nov-2003 sos

Workaround for errata on early versions of the sii3112.

Approved by: re@


# 122484 11-Nov-2003 sos

Centralise mode setting. Instead of doing it in all subdrivers, do
it in ata-all.c where it belongs.

Prime controller HW by always setting PIO mode first in attach.


# 121310 21-Oct-2003 sos

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.


# 119453 25-Aug-2003 sos

Cleanup the dma int/alloc/free code.


# 119450 25-Aug-2003 sos

Unify prototypes.
Cosmetics.


# 119404 24-Aug-2003 sos

This is a major rework of the ATA driver (ATAng)

Restructure the way ATA/ATAPI commands are processed, use a common
ata_request structure for both. This centralises the way requests
are handled so locking is much easier to handle.

The driver is now layered much more cleanly to seperate the lowlevel
HW access so it can be tailored to specific controllers without touching
the upper layers. This is needed to support some of the newer
semi-intelligent ATA controllers showing up.

The top level drivers (disk, ATAPI devices) are more or less still
the same with just corrections to use the new interface.

Pull ATA out from under Gaint now that locking can be done in a sane way.

Add support for a the National Geode SC1100. Thanks to Soekris engineering
for sponsoring a Soekris 4801 to make this support.

Fixed alot of small bugs in the chipset code for various chips now
we are around in that corner anyways.


# 114656 04-May-2003 sos

Grap the ATA lock on all channels before suspend, this makes certain
that we have no outstanding ops in transit, which would cause problems
on resume.


# 113222 07-Apr-2003 sos

Third round of updates to the ATA driver.

More DMA cleanups, including fix for breakage on older Promise controllers.

Add more ways of getting to the ATA registers.


# 112791 29-Mar-2003 sos

Second round of updates to the ATA driver.

Clean up the DMA interface too much unneeded stuff crept in with
the busdma code back when.

Modify the ATA_IN* / ATA_OUT* macros so that resource and offset
are gotten from a table. That allows for new chipsets that doesn't
nessesarily have things ordered the good old way. This also removes
the need for the wierd PC98 resource functions.

Tested on: i386, PC98, Alpha, Sparc64


# 111188 20-Feb-2003 sos

First round off updates/fixes to the ATA driver.

This moves all chipset specific code to a new file 'ata-chipset.c'.
Extensive use of tables and pointers to avoid having the same switch
on chipset type in several places, and to allow substituting various
functions for different HW arch needs.
Added PIO mode setup and all DMA modes.
Support for all known SiS chipsets. Thanks to Christoph Kukulies for
sponsoring a nice ASUS P4S8X SiS648 based board for this work!

Tested on: i386, PC98, alpha and sparc64


# 109931 27-Jan-2003 sos

Update the code that deals with disk enclosures:

Properly handle the newer Promise SuperSwap 1000 enclosures.
Print out what kind of enclosure was found in the probe.
Misc cleanups in the enclosure handling code.

Sponsored by: Advanis Inc.


# 109529 19-Jan-2003 sos

Fix the 48bit access support for the older Promise 66/100 controllers, the
first attempt was wrong and could cause r/w timeouts.

Add yet another Promise PCI id.


# 107971 17-Dec-2002 sos

This should be the way PC98 ATA disks are seen geometry wise.

Should go into 5_0_RELEASE as well.


# 107562 03-Dec-2002 sos

Add support for the PC98 platform to the ATA driver.
This mostly consists of functionality to serialize accesses to
the two ATA channels (which can also be used to "fix" certain
PCI based controllers).
Add support for Acard controllers.
Enable the ATA driver in PC98 GENERIC, and add device hints.
Update man page with latest support.

The PC98 core team has kindly provided me with a PC98
machine that made this all possible, thanks to all that
contributed to that effort, without that this would
probably newer have been possible..

Approved by: re@


# 104299 01-Oct-2002 sos

Misc cleanups.

Pointed out by: phk/flexelint


# 95010 18-Apr-2002 sos

Fix the breakage of tagged queueing that the busdma integration
introduced. Since its now only possible to have one DMA control
block at a time, we move the setup to dmastart instead.


# 93882 05-Apr-2002 sos

Make the ATA driver compile & work on the sparc64 platform.

Initial work & code by tmm.

Lots of changes and rearrangements by yours truely to make busdma
be a little less a PITA (but I still dont like it).


# 92107 11-Mar-2002 sos

Add new support for locking an ATA channel and use that throughout
the ATA/ATAPI driver. This solves the concurrency problem with
the new GEOM code, and also cuts a good deal of the patch size
in the upcoming MFC.


# 90215 04-Feb-2002 sos

Major update of the ATA RAID code, part 1:

Overhaul of the attach/detach code and structures, there were some nasty
bugs in the old implementation. This made it possible to collapse the
ATA/ATAPI device control structures into one generic structure.

A note here, the kernel is NOT ready for detach of active devices,
it fails all over in random places, but for inactive devices it works.
However for ATA RAID this works, since the RAID abstration layer
insulates the buggy^H^H^H^H^H^Hfragile device subsystem from the
physical disks.

Proberly detect the RAID's from the BIOS, and mark critical RAID1
arrays as such, but continue if there is enough of the mirror left
to do so.

Properly fail arrays on a live system. For RAID0 that means return EIO,
and for RAID1 it means continue on the still working part of the mirror
if possible, else return EIO.
If the state changes, log this to the console.

Allow for Promise & Highpoint controllers/arrays to coexist on the
same machine. It is not possible to distribute arrays over different
makes of controllers though.

If Promise SuperSwap enclosures are used, signal disk state on the
status LED on the front.

Misc fixes that I had lying around for various minor bugs.

Sponsored by: Advanis Inc.


# 84584 06-Oct-2001 sos

Update with latest ATA/ATAPI ver 6 rev 2 items.


# 84419 03-Oct-2001 sos

Doh! committed from the wrong tree, this is the right "stuff"...


# 84413 03-Oct-2001 sos

Proberly support the Promise TX2/4.

Programming info kindly provided by Daniela Engert <dani@ngrt.de>


# 83728 20-Sep-2001 sos

Overhaul to minimize stack usage, in some places >2K was used
on the stack *blush*...


# 82053 21-Aug-2001 sos

Finally commit some of the minor things I've collected over the last month(s):

Add tagged queueing support for new IBM drives.

Add support for Yet Another Promise ATA 100 chip.

Flush disk cache on close.

Dont flush the disk cache on BIO_ORDERED anymore.

Cleanup the tests for DMA on ATAPI devices.

Allow to share ALL irq's even the std irg 14 & 15.

Fix calculation bug in end of media code on CD's.

Add REZERO on opening a CDR/CDRW.

Cleanup ataioctl a bit.


# 80203 23-Jul-2001 kris

s/adress/address/

Inspired by: OpenBSD
MFC After: 1 week


# 74450 19-Mar-2001 sos

Add sysctls for reading the tunables as suggested by des.
Minor cleanups plus checks of the ->active state.
Cosmetics.


# 74302 15-Mar-2001 sos

Provide the interface to atacontrol and associated logic.

see atacontrol(8) for more.

Also the ATA_ENABLE_ATAPI_DMA, ATA_ENABLE_WC and ATA_ENABLE_TAGS
options are gone, use the tuneables listed in ata.4 instead from
the loader (this makes it possible to switch off DMA before the
driver has to touch the devices on broken hardware).


# 74250 14-Mar-2001 sos

Refine the detach/attach code.

Proberly fail outstanding bio requests on devices that are detached.

This makes it possible to change between disk/cdrom/dvd/whathaveyou
in a notebook, just by suspending it, changing the device in the
bay (or what you model calls it), unsuspend and the ATA driver
will figure out what disappeared and properly fail those, and attach
any new devices found.


# 73897 06-Mar-2001 sos

Split out the ata probes in seperate files for each bus type.


# 72410 12-Feb-2001 sos

Dont rely on isa includes to get at the std port adresses.


# 72106 06-Feb-2001 sos

Introduce busspace instead of the good old in/out instructions.
Not pretty but it works (I hope)...


# 72094 06-Feb-2001 sos

Fix the clone functionality in atapi-cd, it didn't work for
devs other than the first, and allowed to clone a nonexistent
device..


# 70901 10-Jan-2001 sos

Add session argument to *close_disk, allowing to set session type on fixate.
Add support for different blank/erase types.

Update headers.


# 67935 30-Oct-2000 sos

Fix the PCCARD ATA breakage..
This is due to a bug that has been in there since Warneer did the
PCCARD stuff, the altioaddr is not offset 8 its offset 14 from
the base address.
Also only probe the master device, no known PCCARD ATA thingies
has a slave AFAIK..


# 67299 18-Oct-2000 sos

Minor changes to the ATA RAID support code, remove some verbosity
and put some under bootverbose..


# 67058 13-Oct-2000 sos

Get rid of the ivars entirely.


# 66326 24-Sep-2000 sos

Fix the breakage that snatched the ioports from the fdc device.

Fix promise support.


# 66070 19-Sep-2000 sos

Add support for tagged queuing on ATA drives. There is only support for
IBM's DPTA and DTLA series of drives (no other disk vendors are known
to support this) on non-Promise controllers (promise controllers lockup
when given the tagged queuing specific commands).
It gives especially master/slave comboes about 5% better performance.

Add support for the Promise ATA100 OEM chip (pdc20265)

Add support for the Cyrix 5530

Change the way status is read from the drives, use the alternate
status reg when possible.

Better support for DEVFS, the acdXtY devices are now created when needed.

Lots of little cleanups.


# 64307 06-Aug-2000 sos

Add experimental code for ATA100 support on:

Promise Ultra100 / Fasttrak100
HighPoint HPT370 controllers (fx Abit KA7-100 onboard ctrl, Abit HotRod 100)
Intel ICH2 (Intel 815E based motherboards)

So far I can read >90MB/s on the Promise and the HPT370.
I can write >64MB/s on the promise and >50MB/s on the HPT370 so it seems
writing is still done in ATA66 mode :(
The ICH2 support is untested as of yet...


# 60938 26-May-2000 jake

Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by: msmith and others


# 60833 23-May-2000 jake

Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by: phk
Reviewed by: phk
Approved by: mdodd


# 59103 09-Apr-2000 sos

Add support for ATA66 on newer revisions of the VIA 82C596


# 57771 05-Mar-2000 sos

Fix the CD driver so that the last blocks can be read even if
a blocksize != 2k is used.
Update the timeout code to try fallback to PIO if problems
arise in DMA mode.


# 57477 25-Feb-2000 sos

Add (partial) support for the Cypress ATA controller.

Call intr_teardown on detach.

Always add non masterdevice from unit 2 upwards.

Update to the pccard code, at least some cards are now working,
more testing to follow.


# 57325 18-Feb-2000 sos

Update the ata driver to take more advantage of newbus, this
was needed to make attach/detach of devices work, which is
needed for the PCCARD support.
(PCCARD support is still not working though, more to come on that)

Support the CMD646 chip which is used on many alphas, sadly only
in WDMA2 mode, as the silicon is broken beyond belief for UDMA modes.

Lots of cosmetic fixes here and there.

Sorry for the size of this megapatchfromhell but it was not
possible otherwise...

newbus patches based on work from: dfr (Doug Rabson)


# 56744 28-Jan-2000 sos

Cleanup the ata_dmainit function a bit.
Also allow BIOS setup DMA on unknown controllers.


# 56686 27-Jan-2000 sos

Add sysctl oid hw.atamodes to set the transfermodes online.


# 56607 25-Jan-2000 sos

Retry a bit more agressively on the atapi identify.

Try to support older systems reporting irq0 for the first channels.

Support sharing of the std interrupts (says peter :) )

Dont use READ_CD on normal data reads (2048 bytes), too many old drives
doesn't support this command even if the std says "shall" :(, but still
use READ_CD on all other blocksizes.

Add the geometry to the ad probe, its still usefull.


# 56558 24-Jan-2000 sos

General cleanup.

Dont be so verbose in the probe, only ONE line printed now, to get more
info boot verbose. Centralise most printf's in ata-all & ata-dma to use
the ata_printf function, it saves alot of codelines.

Repeat the identify command if drive fails the first.

Protect the timeout functions with splbio.

Dont update the transfer details before we are sure the transfer
succeded, this way they are proberly retried on errors.

Move the handling of next_writeable to userland.

Use the READ_CD command to read CD's. That enables us to read _anything_
via the normal read/write interface. This kindof obsoletes the READAUDIO
ioctl, but we keep that for now.


# 56255 18-Jan-2000 sos

Rearrange the probecode, so that 80pin cables can be identified
correctly on both master and slave.
Smash together the ata_params & atapi_params structures as they
are more or less equal anyways.
Get rid of the last SYSINIT's in here.


# 56138 17-Jan-2000 sos

Add support for the Intel 810 chipset (ICH type of chips)

Prober support for the VIA 82C686, I finally got the right datasheet.

Get rid of atapi_wait, merge it into ata_wait.

Avoid a couple of races by using asleep instead of tsleep.

Always use 16bit transfers on ISA systems.

Clear up the atapi_read/write functions.


# 55333 03-Jan-2000 sos

Add support for VIA 82C596 controller

Better shared irq handeling for Promise & HPT366 controllers

Setup prober PIO mode timings on Promise & HPT366 controllers

Update Copyright headers to be Y2K compliant :)


# 54594 14-Dec-1999 sos

Have another go at the VIA support, this time use the PCI ID form the
main component in the southbridge chip to determine which VIA chip
we are dealing with.

Try to enable DMA on generic controllers that say they has the
capability, instead of relying on the BIOS to have set it up.


# 53681 24-Nov-1999 sos

Add DMA support for the VIA 82C586 & 82C686 chips, also rearrange
to fall back to slower speeds if the faster ones fails to probe.

Log and retry request on UDMA CRC errors.

Fix a couple of warnings.


# 53029 08-Nov-1999 sos

Unbreak ATAPI on the Aladdin chipset, only DMA access worked.

Try to use a 32bit mask on the IO addresses, this fixes the alpha
and hopefully doesn't break on any i386 machines.

Try to enable both read & write cache on disks, they should be as
default, but better be sure..


# 52918 06-Nov-1999 sos

Fix IRQ allocation bug on controllers using a shared interrupt.

Fix a bug which could cause panics in ad/atapi-interrupt.

Add support for UDMA66 on Promise Ultra/Fasttrak controllers.

Get rid of ATA_IGNORE_INTR, and introduce ATA_WAIT_INTR instead.

Add a delay in the dump routine in ata-disk.c, some controllers
seem to need this. Also dont use the timeout watchdog when dumping.

Disable DMA on ATAPI devices as default, add option ATA_ENABLE_ATAPI_DMA
for those that has HW that works.

Add support for some not-up-to-spec ATAPI devices that returns data
together with completition status on data moving cmd's.


# 52067 09-Oct-1999 sos

Add support for the HPT366 chip, this is used on the Abit boards and
their HotRod controller and on SIIG PCI ultra DMA controller. These
changes also made lots of the Promise code go away, its all much more
generic this way.

Get rid of atapi_immed_cmd, instead use the queue to move atapi commands
from interrupt context if nessesary, the entire atapi layer has
gotten an overhaul.

Lots of fixes to utililize the new features in subr_disk.c etc, and
get rid of the last biots of softc arrays in the drivers, the
only one left is atadevices which cannot easily go away (yet).

Use our own malloc names, its a lot easier to track memory usage this way.

General cleanup overall.


# 51520 21-Sep-1999 sos

Ten'th update to the new ATA/ATAPI driver:

It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...

The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.

An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.

The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...

The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).

The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.

Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.

As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)

But please tell me how it works for you!

Enjoy!

-Søren


# 50842 03-Sep-1999 phk

Use micro "disk" layer in ata-disk

Reviewed by: sos


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 49614 10-Aug-1999 sos

Support DMA on ATAPI devices (finally).

This makes my system use only ~5% CPU on reading 4.5Mbyte/sec
from a CDROM, which before was limitted to 1.8Mbyte/sec due
to 100% CPU load..


# 48213 25-Jun-1999 sos

Nine'th update to the new ATA/ATAPI driver:

The atapi subsystem has gotten better error handeling and timeouts,
it also tries a REQUEST SENSE command when devices returns errors,
to give a little more info as to what went wrong. It might be a
little verbose for now, but I'm interested in as much feedback on
errors as possible, especially timeouts, as I'm a bit in doubt if
I've chosen resonable default values everywhere.

The disk driver has been changed a bit to prepare for tagged queing,
which is next on my list.

The disk driver has grown a dump routine, I got one implementation
from Darrell Anderson <anderson@cs.duke.edu> which also did
partial dumps (usefull on big memory machines) I left out the
partial stuff for now, and changed the rest alot to fit into the new
ad_request framework.

Some minor cleanups and rearrangements as well.

As usual USE AT YOUR OWN RISK!!, this is still pre alpha level code.
Especially the DMA support can hose your disk real bad if anything
goes wrong, again you have been warned :)
Notebook owners should be carefull that their machines dont suspend
as this might cause trouble...

But please tell me how it works for you!

Enjoy!

-Søren


# 45798 18-Apr-1999 sos

Update to use the new-bus framework. No functional changes.

Mostly done by Doug Rabson, minor fixes by me.


# 45095 28-Mar-1999 sos

Fourth update to the new ATA/ATAPI driver:

Well, better late than newer, but things has been hectic
around here, sorry for the long delay.

DMA support has been added to the ATA disk driver.
This only works on Intel PIIX3/4, Acer Aladdin and Promise controllers.
The promise support works without the BIOS on the board,
and timing modes are set to support up to UDMA speed. This
solves the problems with having more than one promise controller
in the same system.
There is support for "generic" DMA, that might work on other
controllers, but now you have been warned :)
More chipset specific code will come soon, I have to find testers
with the approbiate HW, more on that when I have it ready.

The system now uses its own major numbers, please run MAKEDEV
with the devices you need (ad?, acd?, afd?, ast?).
For now the disk driver will also attach to the old wd major
so one can at least boot without this step, but be warned, this
will eventually go away. The bootblocks will have to be changed
before one can boot directly from an "ad" device though.

Fixed problems:

All known hang problems should be solved
The probe code has been sligthly changed, this should solve
the reports I have lying around (I hope).

Hangs when accessing ata & atapi device on the same channel simultaniously.
A real braino in ata_start caused this, fixed.

As usual USE AT YOUR OWN RISK!!, this is still pre alpha level code.
Especially the DMA support can hose your disk real bad if anything
goes wrong, agaiin you have been warned :)

But please tell me how it works for you!

Enjoy!

-Søren


# 44566 07-Mar-1999 sos

ZIP drives should now be working, I'm not sure about LS120 drives,
reports on those most welcome!

Fixed problems:

Hang on probe on "fantom" devices.
The probe now use a timeout to avoid hangs if no interrupt
is recevied.

There has also been more general code clenaups, and some reorgs.


# 44475 05-Mar-1999 sos

Now all actual probing of both ATA & ATAPI devices are done after
interrupts are enabled, this kills the last "unwanted interrupts"
(and there is no ugly hacks like in the old driver to avoid them).
COmmand interrupt devices are now supported, this applies mostly
to older CDROM's and apparently also the ZIP.

Fixed problems:

Number of total sectors wrong on some older drives.
Fixed by not using the LBA size unless we know its valid.

There has also been more general code clenaups, some reorgs also.


# 44454 03-Mar-1999 sos

Added driver to support ATAPI floppies ie LS-120 & ZIP drives.

Added "options ATA_STATIC_ID" that wires ATA disks like the old wd driver.

Fixed problems:

Dont use more sectors/intr than the drive supports.
Fix announce of > 8.4G disks.
Dont call ad_interrupt/ad_transfer when no disks config'd.
Use the right page# for CDR write mode params.
Fix breakage when no PCI support in kernel.
Implement DEVFS stuff.

General code clenaup.


# 44380 01-Mar-1999 sos

Finally!!

The much roumored replacement for our current IDE/ATA/ATAPI is
materialising in the CVS repositories around the globe.

So what does this bring us:

A new reengineered ATA/ATAPI subsystem, that tries to overcome
most of the deficiencies with the current drivers.

It supports PCI as well as ISA devices without all the hackery
in ide_pci.c to make PCI devices look like ISA counterparts.

It doesn't have the excessive wait problem on probe, in fact you
shouldn't notice any delay when your devices are getting probed.

Probing and attaching of devices are postponed until interrupts
are enabled (well almost, not finished yet for disks), making
things alot cleaner.

Improved performance, although DMA support is still WIP and not
in this pre alpha release, worldstone is faster with the new
driver compared to the old even with DMA.

So what does it take away:

There is NO support for old MFM/RLL/ESDI disks.
There is NO support for bad144, if your disk is bad, ditch it, it has
already outgrown its internal spare sectors, and is dying.

For you to try this out, you will have to modify your kernel config
file to use the "ata" controller instead of all wdc? entries.

example:

# for a PCI only system (most modern machines)
controller ata0
device atadisk0 # ATA disks
device atapicd0 # ATAPI CDROM's
device atapist0 # ATAPI tapes

#You should add the following on ISA systems:
controller ata1 at isa? port "IO_WD1" bio irq 14
controller ata2 at isa? port "IO_WD2" bio irq 15

You can leave it all in there, the system knows how to manage.

For now this driver reuses the device entries from the old system
(that will probably change later), but remember that disks are
now numbered in the sequence they are found (like the SCSI system)
not as absolute positions as the old system.

Although I have tested this on all the systems I can get my hands on,
there might very well be gremlins in there, so use AT YOU OWN RISK!!
This is still WIP, so there are lots of rough edges and unfinished
things in there, and what I have in my lab might look very different
from whats in CVS at any given time. So please have all eventual
changes go through me, or chances are they just dissapears...

I would very much like to hear from you, both good and bad news
are very welcome.

Enjoy!!

-Søren