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
1999-03-01 21:19:19 +00:00
|
|
|
|
/*-
|
2003-02-20 20:02:32 +00:00
|
|
|
|
* Copyright (c) 1998 - 2003 S<EFBFBD>ren Schmidt <sos@FreeBSD.org>
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer,
|
|
|
|
|
* without modification, immediately at the beginning of the file.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
|
* $FreeBSD$
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* ATA register defines */
|
|
|
|
|
#define ATA_DATA 0x00 /* data register */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
|
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
1999-09-21 19:50:40 +00:00
|
|
|
|
#define ATA_ERROR 0x01 /* (R) error register */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
#define ATA_E_ILI 0x01 /* illegal length */
|
1999-11-24 21:40:05 +00:00
|
|
|
|
#define ATA_E_NM 0x02 /* no media */
|
1999-10-09 19:57:13 +00:00
|
|
|
|
#define ATA_E_ABORT 0x04 /* command aborted */
|
1999-11-24 21:40:05 +00:00
|
|
|
|
#define ATA_E_MCR 0x08 /* media change request */
|
|
|
|
|
#define ATA_E_IDNF 0x10 /* ID not found */
|
|
|
|
|
#define ATA_E_MC 0x20 /* media changed */
|
|
|
|
|
#define ATA_E_UNC 0x40 /* uncorrectable data */
|
|
|
|
|
#define ATA_E_ICRC 0x80 /* UDMA crc error */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
#define ATA_E_MASK 0x0f /* error mask */
|
|
|
|
|
#define ATA_SK_MASK 0xf0 /* sense key mask */
|
|
|
|
|
#define ATA_SK_NO_SENSE 0x00 /* no specific sense key info */
|
|
|
|
|
#define ATA_SK_RECOVERED_ERROR 0x10 /* command OK, data recovered */
|
|
|
|
|
#define ATA_SK_NOT_READY 0x20 /* no access to drive */
|
|
|
|
|
#define ATA_SK_MEDIUM_ERROR 0x30 /* non-recovered data error */
|
|
|
|
|
#define ATA_SK_HARDWARE_ERROR 0x40 /* non-recoverable HW failure */
|
|
|
|
|
#define ATA_SK_ILLEGAL_REQUEST 0x50 /* invalid command param(s) */
|
|
|
|
|
#define ATA_SK_UNIT_ATTENTION 0x60 /* media changed */
|
|
|
|
|
#define ATA_SK_DATA_PROTECT 0x70 /* write protect */
|
|
|
|
|
#define ATA_SK_BLANK_CHECK 0x80 /* blank check */
|
|
|
|
|
#define ATA_SK_VENDOR_SPECIFIC 0x90 /* vendor specific skey */
|
|
|
|
|
#define ATA_SK_COPY_ABORTED 0xa0 /* copy aborted */
|
|
|
|
|
#define ATA_SK_ABORTED_COMMAND 0xb0 /* command aborted, try again */
|
|
|
|
|
#define ATA_SK_EQUAL 0xc0 /* equal */
|
|
|
|
|
#define ATA_SK_VOLUME_OVERFLOW 0xd0 /* volume overflow */
|
|
|
|
|
#define ATA_SK_MISCOMPARE 0xe0 /* data dont match the medium */
|
|
|
|
|
#define ATA_SK_RESERVED 0xf0
|
1999-10-09 19:57:13 +00:00
|
|
|
|
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
#define ATA_FEATURE 0x01 /* (W) feature register */
|
|
|
|
|
#define ATA_F_DMA 0x01 /* enable DMA */
|
|
|
|
|
#define ATA_F_OVL 0x02 /* enable overlap */
|
|
|
|
|
|
|
|
|
|
#define ATA_COUNT 0x02 /* (W) sector count */
|
|
|
|
|
#define ATA_IREASON 0x02 /* (R) interrupt reason */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
#define ATA_I_CMD 0x01 /* cmd (1) | data (0) */
|
|
|
|
|
#define ATA_I_IN 0x02 /* read (1) | write (0) */
|
|
|
|
|
#define ATA_I_RELEASE 0x04 /* released bus (1) */
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
#define ATA_I_TAGMASK 0xf8 /* tag mask */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
|
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
1999-09-21 19:50:40 +00:00
|
|
|
|
#define ATA_SECTOR 0x03 /* sector # */
|
|
|
|
|
#define ATA_CYL_LSB 0x04 /* cylinder# LSB */
|
|
|
|
|
#define ATA_CYL_MSB 0x05 /* cylinder# MSB */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
#define ATA_DRIVE 0x06 /* Sector/Drive/Head register */
|
2001-07-23 12:05:27 +00:00
|
|
|
|
#define ATA_D_LBA 0x40 /* use LBA addressing */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
#define ATA_D_IBM 0xa0 /* 512 byte sectors, ECC */
|
|
|
|
|
|
|
|
|
|
#define ATA_CMD 0x07 /* command register */
|
|
|
|
|
|
|
|
|
|
#define ATA_STATUS 0x07 /* status register */
|
|
|
|
|
#define ATA_S_ERROR 0x01 /* error */
|
|
|
|
|
#define ATA_S_INDEX 0x02 /* index */
|
|
|
|
|
#define ATA_S_CORR 0x04 /* data corrected */
|
|
|
|
|
#define ATA_S_DRQ 0x08 /* data request */
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
#define ATA_S_DSC 0x10 /* drive seek completed */
|
1999-10-09 19:57:13 +00:00
|
|
|
|
#define ATA_S_SERVICE 0x10 /* drive needs service */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
#define ATA_S_DWF 0x20 /* drive write fault */
|
1999-10-09 19:57:13 +00:00
|
|
|
|
#define ATA_S_DMA 0x20 /* DMA ready */
|
|
|
|
|
#define ATA_S_READY 0x40 /* drive ready */
|
|
|
|
|
#define ATA_S_BUSY 0x80 /* busy */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_ALTSTAT 0x08 /* alternate status register */
|
2000-09-24 18:19:43 +00:00
|
|
|
|
#define ATA_ALTOFFSET 0x206 /* alternate registers offset */
|
2000-10-30 09:36:40 +00:00
|
|
|
|
#define ATA_PCCARD_ALTOFFSET 0x0e /* do for PCCARD devices */
|
2002-12-03 20:20:44 +00:00
|
|
|
|
#define ATA_PC98_ALTOFFSET 0x10c /* do for PC98 devices */
|
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
1999-09-21 19:50:40 +00:00
|
|
|
|
#define ATA_A_IDS 0x02 /* disable interrupts */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
#define ATA_A_RESET 0x04 /* RESET controller */
|
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
1999-09-21 19:50:40 +00:00
|
|
|
|
#define ATA_A_4BIT 0x08 /* 4 head bits */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* ATAPI misc defines */
|
|
|
|
|
#define ATAPI_MAGIC_LSB 0x14
|
|
|
|
|
#define ATAPI_MAGIC_MSB 0xeb
|
|
|
|
|
#define ATAPI_P_READ (ATA_S_DRQ | ATA_I_IN)
|
|
|
|
|
#define ATAPI_P_WRITE (ATA_S_DRQ)
|
|
|
|
|
#define ATAPI_P_CMDOUT (ATA_S_DRQ | ATA_I_CMD)
|
|
|
|
|
#define ATAPI_P_DONEDRQ (ATA_S_DRQ | ATA_I_CMD | ATA_I_IN)
|
|
|
|
|
#define ATAPI_P_DONE (ATA_I_CMD | ATA_I_IN)
|
|
|
|
|
#define ATAPI_P_ABORT 0
|
|
|
|
|
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
/* misc defines */
|
2001-02-12 10:18:59 +00:00
|
|
|
|
#define ATA_PRIMARY 0x1f0
|
|
|
|
|
#define ATA_SECONDARY 0x170
|
2003-02-20 20:02:32 +00:00
|
|
|
|
#define ATA_PC98_BANK 0x432
|
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
1999-09-21 19:50:40 +00:00
|
|
|
|
#define ATA_IOSIZE 0x08
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_PC98_IOSIZE 0x10
|
2001-02-06 16:44:25 +00:00
|
|
|
|
#define ATA_ALTIOSIZE 0x01
|
|
|
|
|
#define ATA_BMIOSIZE 0x08
|
2003-02-20 20:02:32 +00:00
|
|
|
|
#define ATA_PC98_BANKIOSIZE 0x01
|
2001-03-06 21:43:46 +00:00
|
|
|
|
#define ATA_IOADDR_RID 0
|
|
|
|
|
#define ATA_ALTADDR_RID 1
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_BMADDR_RID 0x20
|
2002-12-03 20:20:44 +00:00
|
|
|
|
#define ATA_PC98_ALTADDR_RID 8
|
|
|
|
|
#define ATA_PC98_BANKADDR_RID 9
|
|
|
|
|
|
2001-03-06 21:43:46 +00:00
|
|
|
|
#define ATA_IRQ_RID 0
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
#define ATA_DEV(device) ((device == ATA_MASTER) ? 0 : 1)
|
2001-03-06 21:43:46 +00:00
|
|
|
|
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
/* busmaster DMA related defines */
|
|
|
|
|
#define ATA_DMA_ENTRIES 256
|
|
|
|
|
#define ATA_DMA_EOT 0x80000000
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_BMCMD_PORT 0x09
|
2001-10-06 11:07:04 +00:00
|
|
|
|
#define ATA_BMCMD_START_STOP 0x01
|
|
|
|
|
#define ATA_BMCMD_WRITE_READ 0x08
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
|
2003-04-07 14:12:12 +00:00
|
|
|
|
#define ATA_BMCTL_PORT 0x09
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_BMDEVSPEC_0 0x0a
|
|
|
|
|
#define ATA_BMSTAT_PORT 0x0b
|
2001-10-06 11:07:04 +00:00
|
|
|
|
#define ATA_BMSTAT_ACTIVE 0x01
|
|
|
|
|
#define ATA_BMSTAT_ERROR 0x02
|
|
|
|
|
#define ATA_BMSTAT_INTERRUPT 0x04
|
|
|
|
|
#define ATA_BMSTAT_MASK 0x07
|
|
|
|
|
#define ATA_BMSTAT_DMA_MASTER 0x20
|
|
|
|
|
#define ATA_BMSTAT_DMA_SLAVE 0x40
|
|
|
|
|
#define ATA_BMSTAT_DMA_SIMPLEX 0x80
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_BMDEVSPEC_1 0x0c
|
|
|
|
|
#define ATA_BMDTP_PORT 0x0d
|
|
|
|
|
|
2003-04-07 14:12:12 +00:00
|
|
|
|
#define ATA_IDX_ADDR 0x0e
|
|
|
|
|
#define ATA_IDX_DATA 0x0f
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_MAX_RES 0x10
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
#define ATA_INTR_FLAGS (INTR_MPSAFE|INTR_TYPE_BIO|INTR_ENTROPY)
|
|
|
|
|
#define ATA_OP_CONTINUES 0
|
|
|
|
|
#define ATA_OP_FINISHED 1
|
|
|
|
|
|
|
|
|
|
struct ata_request {
|
|
|
|
|
struct ata_device *device; /* ptr to device softc */
|
|
|
|
|
void *driver; /* driver specific */
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
struct {
|
|
|
|
|
u_int8_t command; /* command reg */
|
|
|
|
|
u_int8_t feature; /* feature reg */
|
|
|
|
|
u_int64_t lba; /* lba reg */
|
|
|
|
|
u_int16_t count; /* count reg */
|
|
|
|
|
} ata;
|
|
|
|
|
struct {
|
|
|
|
|
u_int8_t ccb[16]; /* ATAPI command block */
|
|
|
|
|
} atapi;
|
|
|
|
|
} u;
|
|
|
|
|
|
|
|
|
|
u_int8_t status; /* ATA status */
|
|
|
|
|
u_int8_t error; /* ATA error */
|
|
|
|
|
u_int8_t dmastat; /* DMA status */
|
|
|
|
|
|
|
|
|
|
u_int32_t bytecount; /* bytes to transfer */
|
|
|
|
|
u_int32_t transfersize; /* bytes pr transfer */
|
|
|
|
|
u_int32_t donecount; /* bytes transferred */
|
|
|
|
|
caddr_t data; /* pointer to data buf */
|
|
|
|
|
int flags;
|
|
|
|
|
#define ATA_R_DONE 0x0001
|
|
|
|
|
#define ATA_R_CONTROL 0x0002
|
|
|
|
|
#define ATA_R_READ 0x0004
|
|
|
|
|
#define ATA_R_WRITE 0x0008
|
|
|
|
|
|
|
|
|
|
#define ATA_R_ATAPI 0x0010
|
|
|
|
|
#define ATA_R_QUIET 0x0020
|
|
|
|
|
#define ATA_R_DMA 0x0040
|
|
|
|
|
|
|
|
|
|
#define ATA_R_ORDERED 0x0100
|
|
|
|
|
#define ATA_R_AT_HEAD 0x0200
|
|
|
|
|
#define ATA_R_REQUEUE 0x0400
|
|
|
|
|
#define ATA_R_SKIPSTART 0x0800
|
|
|
|
|
|
2003-08-25 09:01:49 +00:00
|
|
|
|
void (*callback)(struct ata_request *request);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
int retries; /* retry count */
|
|
|
|
|
int timeout; /* timeout for this cmd */
|
|
|
|
|
struct callout_handle timeout_handle; /* handle for untimeout */
|
|
|
|
|
int result; /* result error code */
|
|
|
|
|
struct task task; /* task management */
|
|
|
|
|
TAILQ_ENTRY(ata_request) sequence; /* sequence management */
|
|
|
|
|
TAILQ_ENTRY(ata_request) chain; /* list management */
|
|
|
|
|
};
|
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
1999-03-28 18:57:20 +00:00
|
|
|
|
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
/* structure describing an ATA/ATAPI device */
|
|
|
|
|
struct ata_device {
|
|
|
|
|
struct ata_channel *channel;
|
|
|
|
|
int unit; /* unit number */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
#define ATA_MASTER 0x00
|
|
|
|
|
#define ATA_SLAVE 0x10
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
|
|
|
|
|
char *name; /* device name */
|
|
|
|
|
struct ata_params *param; /* ata param structure */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
void *softc; /* ptr to softc for device */
|
2003-08-25 09:01:49 +00:00
|
|
|
|
void (*attach)(struct ata_device *atadev);
|
|
|
|
|
void (*detach)(struct ata_device *atadev);
|
|
|
|
|
void (*start)(struct ata_device *atadev);
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
int flags;
|
|
|
|
|
#define ATA_D_USE_CHS 0x0001
|
|
|
|
|
#define ATA_D_DETACHING 0x0002
|
|
|
|
|
#define ATA_D_MEDIA_CHANGED 0x0004
|
2003-01-27 09:04:29 +00:00
|
|
|
|
#define ATA_D_ENC_PRESENT 0x0008
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
|
|
|
|
|
int cmd; /* last cmd executed */
|
2003-02-20 20:02:32 +00:00
|
|
|
|
int mode; /* transfermode */
|
2003-08-25 09:01:49 +00:00
|
|
|
|
void (*setmode)(struct ata_device *atadev, int mode);
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* structure for holding DMA address data */
|
|
|
|
|
struct ata_dmaentry {
|
|
|
|
|
u_int32_t base;
|
|
|
|
|
u_int32_t count;
|
|
|
|
|
};
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
/* structure holding DMA related information */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
struct ata_dma {
|
2003-03-29 13:37:09 +00:00
|
|
|
|
bus_dma_tag_t dmatag; /* parent DMA tag */
|
|
|
|
|
bus_dma_tag_t cdmatag; /* control DMA tag */
|
|
|
|
|
bus_dmamap_t cdmamap; /* control DMA map */
|
|
|
|
|
bus_dma_tag_t ddmatag; /* data DMA tag */
|
|
|
|
|
bus_dmamap_t ddmamap; /* data DMA map */
|
|
|
|
|
struct ata_dmaentry *dmatab; /* DMA transfer table */
|
|
|
|
|
bus_addr_t mdmatab; /* bus address of dmatab */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
u_int32_t alignment; /* DMA engine alignment */
|
2003-11-28 19:01:28 +00:00
|
|
|
|
u_int32_t boundary; /* DMA engine boundary */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
u_int32_t max_iosize; /* DMA engine max IO size */
|
2003-10-21 19:20:37 +00:00
|
|
|
|
u_int32_t cur_iosize; /* DMA engine current IO size */
|
2003-03-29 13:37:09 +00:00
|
|
|
|
int flags;
|
|
|
|
|
#define ATA_DMA_ACTIVE 0x01 /* DMA transfer in progress */
|
|
|
|
|
#define ATA_DMA_READ 0x02 /* transaction is a read */
|
|
|
|
|
|
2003-08-25 11:13:04 +00:00
|
|
|
|
void (*alloc)(struct ata_channel *ch);
|
2003-08-25 09:01:49 +00:00
|
|
|
|
void (*free)(struct ata_channel *ch);
|
2003-10-21 19:20:37 +00:00
|
|
|
|
int (*load)(struct ata_device *atadev, caddr_t data, int32_t count,int dir);
|
|
|
|
|
int (*unload)(struct ata_channel *ch);
|
|
|
|
|
int (*start)(struct ata_channel *ch);
|
2003-08-25 09:01:49 +00:00
|
|
|
|
int (*stop)(struct ata_channel *ch);
|
2003-03-29 13:37:09 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* structure holding lowlevel functions */
|
|
|
|
|
struct ata_lowlevel {
|
2003-08-25 09:01:49 +00:00
|
|
|
|
void (*reset)(struct ata_channel *ch);
|
|
|
|
|
int (*transaction)(struct ata_request *request);
|
|
|
|
|
void (*interrupt)(void *channel);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
/* structure holding resources for an ATA channel */
|
|
|
|
|
struct ata_resource {
|
|
|
|
|
struct resource *res;
|
|
|
|
|
int offset;
|
2003-02-20 20:02:32 +00:00
|
|
|
|
};
|
|
|
|
|
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
/* structure describing an ATA channel */
|
|
|
|
|
struct ata_channel {
|
1999-04-18 20:48:15 +00:00
|
|
|
|
struct device *dev; /* device handle */
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
int unit; /* channel number */
|
2003-03-29 13:37:09 +00:00
|
|
|
|
struct ata_resource r_io[ATA_MAX_RES];/* I/O resources */
|
2000-02-18 20:57:33 +00:00
|
|
|
|
struct resource *r_irq; /* interrupt of this channel */
|
2000-02-25 09:48:23 +00:00
|
|
|
|
void *ih; /* interrupt handle */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
struct ata_lowlevel hw; /* lowlevel HW functions */
|
|
|
|
|
struct ata_dma *dma; /* DMA data / functions */
|
2003-02-20 20:02:32 +00:00
|
|
|
|
int flags; /* channel flags */
|
2001-10-06 11:07:04 +00:00
|
|
|
|
#define ATA_NO_SLAVE 0x01
|
|
|
|
|
#define ATA_USE_16BIT 0x02
|
2002-12-17 16:26:22 +00:00
|
|
|
|
#define ATA_USE_PC98GEOM 0x04
|
|
|
|
|
#define ATA_ATAPI_DMA_RO 0x08
|
2003-08-24 09:22:26 +00:00
|
|
|
|
#define ATA_48BIT_ACTIVE 0x10
|
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
1999-09-21 19:50:40 +00:00
|
|
|
|
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
struct ata_device device[2]; /* devices on this channel */
|
|
|
|
|
#define MASTER 0x00
|
|
|
|
|
#define SLAVE 0x01
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int devices; /* what is present */
|
1999-08-10 21:59:58 +00:00
|
|
|
|
#define ATA_ATA_MASTER 0x01
|
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
1999-09-21 19:50:40 +00:00
|
|
|
|
#define ATA_ATA_SLAVE 0x02
|
|
|
|
|
#define ATA_ATAPI_MASTER 0x04
|
|
|
|
|
#define ATA_ATAPI_SLAVE 0x08
|
1999-08-10 21:59:58 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
int state; /* ATA channel state control */
|
2001-03-14 12:05:44 +00:00
|
|
|
|
#define ATA_IDLE 0x0000
|
2003-08-24 09:22:26 +00:00
|
|
|
|
#define ATA_ACTIVE 0x0001
|
|
|
|
|
#define ATA_CONTROL 0x0002
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
|
2003-02-20 20:02:32 +00:00
|
|
|
|
void (*locking)(struct ata_channel *, int);
|
2002-12-03 20:20:44 +00:00
|
|
|
|
#define ATA_LF_LOCK 0x0001
|
|
|
|
|
#define ATA_LF_UNLOCK 0x0002
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
struct mtx queue_mtx;
|
|
|
|
|
TAILQ_HEAD(, ata_request) ata_queue; /* head of ATA queue */
|
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
1999-09-21 19:50:40 +00:00
|
|
|
|
void *running; /* currently running request */
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* ATAPI request sense structure */
|
|
|
|
|
struct atapi_sense {
|
|
|
|
|
u_int8_t error_code :7; /* current or deferred errors */
|
|
|
|
|
u_int8_t valid :1; /* follows ATAPI spec */
|
|
|
|
|
u_int8_t segment; /* Segment number */
|
|
|
|
|
u_int8_t sense_key :4; /* sense key */
|
|
|
|
|
u_int8_t reserved2_4 :1; /* reserved */
|
|
|
|
|
u_int8_t ili :1; /* incorrect length indicator */
|
|
|
|
|
u_int8_t eom :1; /* end of medium */
|
|
|
|
|
u_int8_t filemark :1; /* filemark */
|
|
|
|
|
u_int32_t cmd_info __packed; /* cmd information */
|
|
|
|
|
u_int8_t sense_length; /* additional sense len (n-7) */
|
|
|
|
|
u_int32_t cmd_specific_info __packed; /* additional cmd spec info */
|
|
|
|
|
u_int8_t asc; /* additional sense code */
|
|
|
|
|
u_int8_t ascq; /* additional sense code qual */
|
|
|
|
|
u_int8_t replaceable_unit_code; /* replaceable unit code */
|
|
|
|
|
u_int8_t sk_specific :7; /* sense key specific */
|
|
|
|
|
u_int8_t sksv :1; /* sense key specific info OK */
|
|
|
|
|
u_int8_t sk_specific1; /* sense key specific */
|
|
|
|
|
u_int8_t sk_specific2; /* sense key specific */
|
|
|
|
|
};
|
|
|
|
|
|
2003-01-27 09:04:29 +00:00
|
|
|
|
/* disk bay/enclosure related */
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
#define ATA_LED_OFF 0x00
|
|
|
|
|
#define ATA_LED_RED 0x01
|
|
|
|
|
#define ATA_LED_GREEN 0x02
|
|
|
|
|
#define ATA_LED_ORANGE 0x03
|
2003-01-27 09:04:29 +00:00
|
|
|
|
#define ATA_LED_MASK 0x03
|
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.
2002-02-04 19:23:40 +00:00
|
|
|
|
|
2000-10-13 11:21:27 +00:00
|
|
|
|
/* externs */
|
2000-02-18 20:57:33 +00:00
|
|
|
|
extern devclass_t ata_devclass;
|
2002-12-03 20:20:44 +00:00
|
|
|
|
extern struct intr_config_hook *ata_delayed_attach;
|
2003-11-11 14:55:36 +00:00
|
|
|
|
extern int ata_wc;
|
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
1999-03-01 21:19:19 +00:00
|
|
|
|
|
|
|
|
|
/* public prototypes */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* ata-all.c: */
|
2003-08-25 09:01:49 +00:00
|
|
|
|
int ata_probe(device_t dev);
|
|
|
|
|
int ata_attach(device_t dev);
|
|
|
|
|
int ata_detach(device_t dev);
|
|
|
|
|
int ata_suspend(device_t dev);
|
|
|
|
|
int ata_resume(device_t dev);
|
|
|
|
|
int ata_printf(struct ata_channel *ch, int device, const char *fmt, ...) __printflike(3, 4);
|
|
|
|
|
int ata_prtdev(struct ata_device *atadev, const char *fmt, ...) __printflike(2, 3);
|
|
|
|
|
void ata_set_name(struct ata_device *atadev, char *name, int lun);
|
|
|
|
|
void ata_free_name(struct ata_device *atadev);
|
|
|
|
|
int ata_get_lun(u_int32_t *map);
|
|
|
|
|
int ata_test_lun(u_int32_t *map, int lun);
|
|
|
|
|
void ata_free_lun(u_int32_t *map, int lun);
|
|
|
|
|
char *ata_mode2str(int mode);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
int ata_pmode(struct ata_params *ap);
|
|
|
|
|
int ata_wmode(struct ata_params *ap);
|
|
|
|
|
int ata_umode(struct ata_params *ap);
|
|
|
|
|
int ata_limit_mode(struct ata_device *atadev, int mode, int maxmode);
|
|
|
|
|
|
|
|
|
|
/* ata-queue.c: */
|
|
|
|
|
int ata_reinit(struct ata_channel *ch);
|
|
|
|
|
void ata_start(struct ata_channel *ch);
|
|
|
|
|
struct ata_request *ata_alloc_request(void);
|
|
|
|
|
void ata_free_request(struct ata_request *request);
|
|
|
|
|
int ata_controlcmd(struct ata_device *atadev, u_int8_t command, u_int16_t feature, u_int64_t lba, u_int16_t count);
|
|
|
|
|
int ata_atapicmd(struct ata_device *atadev, u_int8_t *ccb, caddr_t data, int count, int flags, int timeout);
|
|
|
|
|
void ata_queue_request(struct ata_request *request);
|
|
|
|
|
void ata_finish(struct ata_request *request);
|
|
|
|
|
char *ata_cmd2str(struct ata_request *request);
|
|
|
|
|
|
|
|
|
|
/* ata-lowlevel.c: */
|
|
|
|
|
void ata_generic_hw(struct ata_channel *ch);
|
|
|
|
|
|
|
|
|
|
/* subdrivers */
|
2003-08-25 09:01:49 +00:00
|
|
|
|
void ad_attach(struct ata_device *atadev);
|
|
|
|
|
void acd_attach(struct ata_device *atadev);
|
|
|
|
|
void afd_attach(struct ata_device *atadev);
|
|
|
|
|
void ast_attach(struct ata_device *atadev);
|
|
|
|
|
void atapi_cam_attach_bus(struct ata_channel *ch);
|
|
|
|
|
void atapi_cam_detach_bus(struct ata_channel *ch);
|
|
|
|
|
void atapi_cam_reinit_bus(struct ata_channel *ch);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
|
2002-03-11 21:04:32 +00:00
|
|
|
|
/* macros for locking a channel */
|
2002-12-03 20:20:44 +00:00
|
|
|
|
#define ATA_LOCK_CH(ch, value) \
|
2003-08-24 09:22:26 +00:00
|
|
|
|
atomic_cmpset_acq_int(&(ch)->state, ATA_IDLE, (value))
|
2002-03-11 21:04:32 +00:00
|
|
|
|
|
2002-12-03 20:20:44 +00:00
|
|
|
|
#define ATA_SLEEPLOCK_CH(ch, value) \
|
2003-08-24 09:22:26 +00:00
|
|
|
|
while (!atomic_cmpset_acq_int(&(ch)->state, ATA_IDLE, (value))) \
|
2002-03-11 21:04:32 +00:00
|
|
|
|
tsleep((caddr_t)&(ch), PRIBIO, "atalck", 1);
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
#define ATA_FORCELOCK_CH(ch, value) atomic_store_rel_int(&(ch)->state, (value))
|
2002-03-11 21:04:32 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
#define ATA_UNLOCK_CH(ch) atomic_store_rel_int(&(ch)->state, ATA_IDLE)
|
2002-03-11 21:04:32 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
/* macros to hide busspace uglyness */
|
2001-02-06 16:44:25 +00:00
|
|
|
|
#define ATA_INB(res, offset) \
|
|
|
|
|
bus_space_read_1(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), (offset))
|
2003-03-29 13:37:09 +00:00
|
|
|
|
|
2001-02-06 16:44:25 +00:00
|
|
|
|
#define ATA_INW(res, offset) \
|
|
|
|
|
bus_space_read_2(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), (offset))
|
|
|
|
|
#define ATA_INL(res, offset) \
|
|
|
|
|
bus_space_read_4(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), (offset))
|
|
|
|
|
#define ATA_INSW(res, offset, addr, count) \
|
|
|
|
|
bus_space_read_multi_2(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), \
|
|
|
|
|
(offset), (addr), (count))
|
2002-04-05 13:13:56 +00:00
|
|
|
|
#define ATA_INSW_STRM(res, offset, addr, count) \
|
|
|
|
|
bus_space_read_multi_stream_2(rman_get_bustag((res)), \
|
2003-02-20 20:02:32 +00:00
|
|
|
|
rman_get_bushandle((res)), \
|
2002-04-05 13:13:56 +00:00
|
|
|
|
(offset), (addr), (count))
|
2001-02-06 16:44:25 +00:00
|
|
|
|
#define ATA_INSL(res, offset, addr, count) \
|
|
|
|
|
bus_space_read_multi_4(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), \
|
|
|
|
|
(offset), (addr), (count))
|
2002-04-05 13:13:56 +00:00
|
|
|
|
#define ATA_INSL_STRM(res, offset, addr, count) \
|
|
|
|
|
bus_space_read_multi_stream_4(rman_get_bustag((res)), \
|
2003-02-20 20:02:32 +00:00
|
|
|
|
rman_get_bushandle((res)), \
|
2002-04-05 13:13:56 +00:00
|
|
|
|
(offset), (addr), (count))
|
2001-02-06 16:44:25 +00:00
|
|
|
|
#define ATA_OUTB(res, offset, value) \
|
|
|
|
|
bus_space_write_1(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), (offset), (value))
|
|
|
|
|
#define ATA_OUTW(res, offset, value) \
|
|
|
|
|
bus_space_write_2(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), (offset), (value))
|
|
|
|
|
#define ATA_OUTL(res, offset, value) \
|
|
|
|
|
bus_space_write_4(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), (offset), (value))
|
|
|
|
|
#define ATA_OUTSW(res, offset, addr, count) \
|
|
|
|
|
bus_space_write_multi_2(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), \
|
|
|
|
|
(offset), (addr), (count))
|
2002-04-05 13:13:56 +00:00
|
|
|
|
#define ATA_OUTSW_STRM(res, offset, addr, count) \
|
|
|
|
|
bus_space_write_multi_stream_2(rman_get_bustag((res)), \
|
2003-02-20 20:02:32 +00:00
|
|
|
|
rman_get_bushandle((res)), \
|
2002-04-05 13:13:56 +00:00
|
|
|
|
(offset), (addr), (count))
|
2001-02-06 16:44:25 +00:00
|
|
|
|
#define ATA_OUTSL(res, offset, addr, count) \
|
|
|
|
|
bus_space_write_multi_4(rman_get_bustag((res)), \
|
|
|
|
|
rman_get_bushandle((res)), \
|
|
|
|
|
(offset), (addr), (count))
|
2002-04-05 13:13:56 +00:00
|
|
|
|
#define ATA_OUTSL_STRM(res, offset, addr, count) \
|
|
|
|
|
bus_space_write_multi_stream_4(rman_get_bustag((res)), \
|
2003-02-20 20:02:32 +00:00
|
|
|
|
rman_get_bushandle((res)), \
|
2002-04-05 13:13:56 +00:00
|
|
|
|
(offset), (addr), (count))
|
2003-04-07 14:12:12 +00:00
|
|
|
|
|
|
|
|
|
#define ATA_IDX_SET(ch, idx) \
|
|
|
|
|
ATA_OUTB(ch->r_io[ATA_IDX_ADDR].res, ch->r_io[ATA_IDX_ADDR].offset, \
|
|
|
|
|
ch->r_io[idx].offset)
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_INB(ch, idx) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_INB(ch->r_io[idx].res, ch->r_io[idx].offset) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_INB(ch->r_io[ATA_IDX_DATA].res, ch->r_io[ATA_IDX_DATA].offset)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_INW(ch, idx) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_INW(ch->r_io[idx].res, ch->r_io[idx].offset) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_INW(ch->r_io[ATA_IDX_DATA].res, ch->r_io[ATA_IDX_DATA].offset)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_INL(ch, idx) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_INL(ch->r_io[idx].res, ch->r_io[idx].offset) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_INL(ch->r_io[ATA_IDX_DATA].res, ch->r_io[ATA_IDX_DATA].offset)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_INSW(ch, idx, addr, count) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_INSW(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_INSW(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, addr, count)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_INSW_STRM(ch, idx, addr, count) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_INSW_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_INSW_STRM(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, addr, count)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_INSL(ch, idx, addr, count) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_INSL(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_INSL(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, addr, count)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_INSL_STRM(ch, idx, addr, count) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_INSL_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_INSL_STRM(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, addr, count)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_OUTB(ch, idx, value) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_OUTB(ch->r_io[idx].res, ch->r_io[idx].offset, value) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_OUTB(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, value)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_OUTW(ch, idx, value) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_OUTW(ch->r_io[idx].res, ch->r_io[idx].offset, value) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_OUTW(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, value)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_OUTL(ch, idx, value) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_OUTL(ch->r_io[idx].res, ch->r_io[idx].offset, value) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_OUTL(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, value)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_OUTSW(ch, idx, addr, count) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_OUTSW(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_OUTSW(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, addr, count)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_OUTSW_STRM(ch, idx, addr, count) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_OUTSW_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_OUTSW_STRM(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, addr, count)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_OUTSL(ch, idx, addr, count) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_OUTSL(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_OUTSL(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, addr, count)))
|
|
|
|
|
|
2003-03-29 13:37:09 +00:00
|
|
|
|
#define ATA_IDX_OUTSL_STRM(ch, idx, addr, count) \
|
2003-04-07 14:12:12 +00:00
|
|
|
|
((ch->r_io[idx].res) \
|
|
|
|
|
? ATA_OUTSL_STRM(ch->r_io[idx].res, ch->r_io[idx].offset, addr, count) \
|
|
|
|
|
: (ATA_IDX_SET(ch, idx), \
|
|
|
|
|
ATA_OUTSL_STRM(ch->r_io[ATA_IDX_DATA].res, \
|
|
|
|
|
ch->r_io[ATA_IDX_DATA].offset, addr, count)))
|