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
|
|
|
|
/*-
|
2001-09-20 15:25:36 +00:00
|
|
|
|
* Copyright (c) 1998,1999,2000,2001 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "pci.h"
|
1999-10-09 19:57:13 +00:00
|
|
|
|
#include "opt_ata.h"
|
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
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include <sys/systm.h>
|
2001-03-15 15:36:25 +00:00
|
|
|
|
#include <sys/ata.h>
|
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
|
|
|
|
#include <sys/kernel.h>
|
2001-03-15 15:36:25 +00:00
|
|
|
|
#include <sys/conf.h>
|
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
|
|
|
|
#include <sys/disk.h>
|
1999-04-18 20:48:15 +00:00
|
|
|
|
#include <sys/module.h>
|
|
|
|
|
#include <sys/bus.h>
|
2000-05-05 09:59:14 +00:00
|
|
|
|
#include <sys/bio.h>
|
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
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
|
#include <sys/devicestat.h>
|
2000-01-27 19:00:51 +00:00
|
|
|
|
#include <sys/sysctl.h>
|
2000-01-24 20:45:24 +00:00
|
|
|
|
#include <machine/stdarg.h>
|
1999-04-18 20:48:15 +00:00
|
|
|
|
#include <machine/resource.h>
|
|
|
|
|
#include <machine/bus.h>
|
|
|
|
|
#include <sys/rman.h>
|
2000-02-18 20:57:33 +00:00
|
|
|
|
#ifdef __alpha__
|
|
|
|
|
#include <machine/md_var.h>
|
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
|
|
|
|
#endif
|
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
|
|
|
|
#include <dev/ata/ata-all.h>
|
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
|
|
|
|
#include <dev/ata/ata-disk.h>
|
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
|
|
|
|
#include <dev/ata/atapi-all.h>
|
|
|
|
|
|
2001-03-15 15:36:25 +00:00
|
|
|
|
/* device structures */
|
|
|
|
|
static d_ioctl_t ataioctl;
|
|
|
|
|
static struct cdevsw ata_cdevsw = {
|
|
|
|
|
/* open */ nullopen,
|
|
|
|
|
/* close */ nullclose,
|
|
|
|
|
/* read */ noread,
|
|
|
|
|
/* write */ nowrite,
|
|
|
|
|
/* ioctl */ ataioctl,
|
|
|
|
|
/* poll */ nopoll,
|
|
|
|
|
/* mmap */ nommap,
|
|
|
|
|
/* strategy */ nostrategy,
|
|
|
|
|
/* name */ "ata",
|
|
|
|
|
/* maj */ 159,
|
|
|
|
|
/* dump */ nodump,
|
|
|
|
|
/* psize */ nopsize,
|
|
|
|
|
/* flags */ 0,
|
|
|
|
|
};
|
|
|
|
|
|
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
|
|
|
|
/* prototypes */
|
2000-02-18 20:57:33 +00:00
|
|
|
|
static void ata_boot_attach(void);
|
|
|
|
|
static void ata_intr(void *);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int ata_getparam(struct ata_softc *, int, u_int8_t);
|
|
|
|
|
static int ata_service(struct ata_softc *);
|
|
|
|
|
static char *active2str(int);
|
|
|
|
|
static void bswap(int8_t *, int);
|
|
|
|
|
static void btrim(int8_t *, int);
|
|
|
|
|
static void bpack(int8_t *, int8_t *, int);
|
2001-03-15 15:36:25 +00:00
|
|
|
|
static void ata_change_mode(struct ata_softc *, int, int);
|
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
|
|
|
|
|
2001-03-19 08:04:54 +00:00
|
|
|
|
/* sysctl vars */
|
|
|
|
|
SYSCTL_NODE(_hw, OID_AUTO, ata, CTLFLAG_RD, 0, "ATA driver parameters");
|
|
|
|
|
|
2001-03-06 21:43:46 +00:00
|
|
|
|
/* global vars */
|
|
|
|
|
devclass_t ata_devclass;
|
|
|
|
|
|
1999-10-09 19:57:13 +00:00
|
|
|
|
/* local vars */
|
2000-02-18 20:57:33 +00:00
|
|
|
|
static struct intr_config_hook *ata_delayed_attach = NULL;
|
2000-12-08 20:09:00 +00:00
|
|
|
|
static MALLOC_DEFINE(M_ATA, "ATA generic", "ATA driver generic layer");
|
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
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
/* misc defines */
|
|
|
|
|
#define MASTER 0
|
|
|
|
|
#define SLAVE 1
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int
|
2000-02-18 20:57:33 +00:00
|
|
|
|
ata_probe(device_t dev)
|
|
|
|
|
{
|
2001-03-14 12:05:44 +00:00
|
|
|
|
struct ata_softc *scp;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
int rid;
|
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (!dev)
|
|
|
|
|
return ENXIO;
|
|
|
|
|
scp = device_get_softc(dev);
|
2001-03-19 08:04:54 +00:00
|
|
|
|
if (!scp)
|
2000-02-18 20:57:33 +00:00
|
|
|
|
return ENXIO;
|
2001-03-19 08:04:54 +00:00
|
|
|
|
if (scp->r_io || scp->r_altio || scp->r_irq)
|
|
|
|
|
return EEXIST;
|
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
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
/* initialize the softc basics */
|
|
|
|
|
scp->active = ATA_IDLE;
|
|
|
|
|
scp->dev = dev;
|
|
|
|
|
|
|
|
|
|
rid = ATA_IOADDR_RID;
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->r_io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
|
|
|
|
|
ATA_IOSIZE, RF_ACTIVE);
|
|
|
|
|
if (!scp->r_io)
|
2000-02-18 20:57:33 +00:00
|
|
|
|
goto failure;
|
|
|
|
|
|
2000-02-25 09:48:23 +00:00
|
|
|
|
rid = ATA_ALTADDR_RID;
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->r_altio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
|
|
|
|
|
ATA_ALTIOSIZE, RF_ACTIVE);
|
|
|
|
|
if (!scp->r_altio)
|
|
|
|
|
goto failure;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
|
|
|
|
|
rid = ATA_BMADDR_RID;
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->r_bmio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
|
|
|
|
|
ATA_BMIOSIZE, RF_ACTIVE);
|
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
|
|
|
|
if (bootverbose)
|
2000-01-24 20:45:24 +00:00
|
|
|
|
ata_printf(scp, -1, "iobase=0x%04x altiobase=0x%04x bmaddr=0x%04x\n",
|
2001-02-06 16:44:25 +00:00
|
|
|
|
(int)rman_get_start(scp->r_io),
|
|
|
|
|
(int)rman_get_start(scp->r_altio),
|
|
|
|
|
(scp->r_bmio) ? (int)rman_get_start(scp->r_bmio) : 0);
|
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
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
ata_reset(scp);
|
2000-08-16 07:09:04 +00:00
|
|
|
|
|
Nine'th update to the new ATA/ATAPI driver:
The atapi subsystem has gotten better error handeling and timeouts,
it also tries a REQUEST SENSE command when devices returns errors,
to give a little more info as to what went wrong. It might be a
little verbose for now, but I'm interested in as much feedback on
errors as possible, especially timeouts, as I'm a bit in doubt if
I've chosen resonable default values everywhere.
The disk driver has been changed a bit to prepare for tagged queing,
which is next on my list.
The disk driver has grown a dump routine, I got one implementation
from Darrell Anderson <anderson@cs.duke.edu> which also did
partial dumps (usefull on big memory machines) I left out the
partial stuff for now, and changed the rest alot to fit into the new
ad_request framework.
Some minor cleanups and rearrangements as well.
As usual USE AT YOUR OWN RISK!!, this is still pre alpha level code.
Especially the DMA support can hose your disk real bad if anything
goes wrong, again you have been warned :)
Notebook owners should be carefull that their machines dont suspend
as this might cause trouble...
But please tell me how it works for you!
Enjoy!
-Søren
1999-06-25 09:03:07 +00:00
|
|
|
|
TAILQ_INIT(&scp->ata_queue);
|
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
|
|
|
|
TAILQ_INIT(&scp->atapi_queue);
|
2000-02-18 20:57:33 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
failure:
|
2001-02-06 16:44:25 +00:00
|
|
|
|
if (scp->r_io)
|
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, scp->r_io);
|
|
|
|
|
if (scp->r_altio)
|
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID,scp->r_altio);
|
|
|
|
|
if (scp->r_bmio)
|
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, ATA_BMADDR_RID, scp->r_bmio);
|
2000-02-18 20:57:33 +00:00
|
|
|
|
if (bootverbose)
|
|
|
|
|
ata_printf(scp, -1, "probe allocation failed\n");
|
|
|
|
|
return ENXIO;
|
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
|
|
|
|
}
|
|
|
|
|
|
2001-03-06 21:43:46 +00:00
|
|
|
|
int
|
2000-02-18 20:57:33 +00:00
|
|
|
|
ata_attach(device_t dev)
|
2000-01-18 21:02:59 +00:00
|
|
|
|
{
|
2001-03-14 12:05:44 +00:00
|
|
|
|
struct ata_softc *scp;
|
2001-02-06 16:44:25 +00:00
|
|
|
|
int error, rid;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (!dev)
|
|
|
|
|
return ENXIO;
|
|
|
|
|
scp = device_get_softc(dev);
|
|
|
|
|
if (!scp)
|
2000-02-18 20:57:33 +00:00
|
|
|
|
return ENXIO;
|
|
|
|
|
|
2001-02-06 16:44:25 +00:00
|
|
|
|
rid = ATA_IRQ_RID;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
scp->r_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
|
|
|
|
|
RF_SHAREABLE | RF_ACTIVE);
|
|
|
|
|
if (!scp->r_irq) {
|
|
|
|
|
ata_printf(scp, -1, "unable to allocate interrupt\n");
|
|
|
|
|
return ENXIO;
|
|
|
|
|
}
|
2001-03-06 21:43:46 +00:00
|
|
|
|
if ((error = bus_setup_intr(dev, scp->r_irq, INTR_TYPE_BIO|INTR_ENTROPY,
|
|
|
|
|
ata_intr, scp, &scp->ih)))
|
2000-02-25 09:48:23 +00:00
|
|
|
|
return error;
|
2000-01-18 21:02:59 +00:00
|
|
|
|
|
|
|
|
|
/*
|
2000-02-18 20:57:33 +00:00
|
|
|
|
* do not attach devices if we are in early boot, this is done later
|
|
|
|
|
* when interrupts are enabled by a hook into the boot process.
|
|
|
|
|
* otherwise attach what the probe has found in scp->devices.
|
2000-01-18 21:02:59 +00:00
|
|
|
|
*/
|
2000-02-18 20:57:33 +00:00
|
|
|
|
if (!ata_delayed_attach) {
|
|
|
|
|
if (scp->devices & ATA_ATA_SLAVE)
|
|
|
|
|
if (ata_getparam(scp, ATA_SLAVE, ATA_C_ATA_IDENTIFY))
|
|
|
|
|
scp->devices &= ~ATA_ATA_SLAVE;
|
|
|
|
|
if (scp->devices & ATA_ATAPI_SLAVE)
|
|
|
|
|
if (ata_getparam(scp, ATA_SLAVE, ATA_C_ATAPI_IDENTIFY))
|
|
|
|
|
scp->devices &= ~ATA_ATAPI_SLAVE;
|
|
|
|
|
if (scp->devices & ATA_ATA_MASTER)
|
|
|
|
|
if (ata_getparam(scp, ATA_MASTER, ATA_C_ATA_IDENTIFY))
|
|
|
|
|
scp->devices &= ~ATA_ATA_MASTER;
|
|
|
|
|
if (scp->devices & ATA_ATAPI_MASTER)
|
|
|
|
|
if (ata_getparam(scp, ATA_MASTER,ATA_C_ATAPI_IDENTIFY))
|
|
|
|
|
scp->devices &= ~ATA_ATAPI_MASTER;
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
2000-02-18 20:57:33 +00:00
|
|
|
|
if (scp->devices & ATA_ATA_MASTER)
|
|
|
|
|
ad_attach(scp, ATA_MASTER);
|
|
|
|
|
if (scp->devices & ATA_ATA_SLAVE)
|
|
|
|
|
ad_attach(scp, ATA_SLAVE);
|
|
|
|
|
#endif
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
2000-02-18 20:57:33 +00:00
|
|
|
|
if (scp->devices & ATA_ATAPI_MASTER)
|
|
|
|
|
atapi_attach(scp, ATA_MASTER);
|
|
|
|
|
if (scp->devices & ATA_ATAPI_SLAVE)
|
|
|
|
|
atapi_attach(scp, ATA_SLAVE);
|
|
|
|
|
#endif
|
2000-01-18 21:02:59 +00:00
|
|
|
|
}
|
2000-02-18 20:57:33 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-06 21:43:46 +00:00
|
|
|
|
int
|
2000-02-18 20:57:33 +00:00
|
|
|
|
ata_detach(device_t dev)
|
|
|
|
|
{
|
2001-03-14 12:05:44 +00:00
|
|
|
|
struct ata_softc *scp;
|
|
|
|
|
int s;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (!dev)
|
|
|
|
|
return ENXIO;
|
|
|
|
|
scp = device_get_softc(dev);
|
|
|
|
|
if (!scp || !scp->devices)
|
2000-02-18 20:57:33 +00:00
|
|
|
|
return ENXIO;
|
2000-01-18 21:02:59 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
/* make sure channel is not busy SOS XXX */
|
|
|
|
|
s = splbio();
|
2001-03-19 08:04:54 +00:00
|
|
|
|
while (!atomic_cmpset_int(&scp->active, ATA_IDLE, ATA_CONTROL))
|
2001-03-14 12:05:44 +00:00
|
|
|
|
tsleep((caddr_t)&s, PRIBIO, "atachm", hz/4);
|
|
|
|
|
splx(s);
|
2001-03-06 21:43:46 +00:00
|
|
|
|
|
2001-02-06 16:44:25 +00:00
|
|
|
|
/* disable interrupts on devices */
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
|
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_IDS | ATA_A_4BIT);
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_SLAVE);
|
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_IDS | ATA_A_4BIT);
|
|
|
|
|
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (scp->devices & ATA_ATA_MASTER && scp->dev_softc[MASTER])
|
2001-03-14 14:00:09 +00:00
|
|
|
|
ad_detach(scp->dev_softc[MASTER], 1);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (scp->devices & ATA_ATA_SLAVE && scp->dev_softc[SLAVE])
|
2001-03-14 14:00:09 +00:00
|
|
|
|
ad_detach(scp->dev_softc[SLAVE], 1);
|
2000-01-19 07:25:46 +00:00
|
|
|
|
#endif
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (scp->devices & ATA_ATAPI_MASTER && scp->dev_softc[MASTER])
|
|
|
|
|
atapi_detach(scp->dev_softc[MASTER]);
|
|
|
|
|
if (scp->devices & ATA_ATAPI_SLAVE && scp->dev_softc[SLAVE])
|
|
|
|
|
atapi_detach(scp->dev_softc[SLAVE]);
|
2000-01-19 07:25:46 +00:00
|
|
|
|
#endif
|
2001-02-06 16:44:25 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (scp->dev_param[MASTER]) {
|
|
|
|
|
free(scp->dev_param[MASTER], M_ATA);
|
|
|
|
|
scp->dev_param[MASTER] = NULL;
|
2000-01-18 21:02:59 +00:00
|
|
|
|
}
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (scp->dev_param[SLAVE]) {
|
|
|
|
|
free(scp->dev_param[SLAVE], M_ATA);
|
|
|
|
|
scp->dev_param[SLAVE] = NULL;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
}
|
2001-03-14 12:05:44 +00:00
|
|
|
|
scp->dev_softc[MASTER] = NULL;
|
|
|
|
|
scp->dev_softc[SLAVE] = NULL;
|
|
|
|
|
scp->mode[MASTER] = ATA_PIO;
|
|
|
|
|
scp->mode[SLAVE] = ATA_PIO;
|
|
|
|
|
scp->devices = 0;
|
2001-02-06 16:44:25 +00:00
|
|
|
|
|
2000-02-25 09:48:23 +00:00
|
|
|
|
bus_teardown_intr(dev, scp->r_irq, scp->ih);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, scp->r_irq);
|
2000-02-25 09:48:23 +00:00
|
|
|
|
if (scp->r_bmio)
|
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, ATA_BMADDR_RID, scp->r_bmio);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, scp->r_altio);
|
2000-02-18 20:57:33 +00:00
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, scp->r_io);
|
2001-03-15 15:36:25 +00:00
|
|
|
|
scp->r_io = NULL;
|
|
|
|
|
scp->r_altio = NULL;
|
|
|
|
|
scp->r_bmio = NULL;
|
|
|
|
|
scp->r_irq = NULL;
|
2001-03-14 12:05:44 +00:00
|
|
|
|
scp->active = ATA_IDLE;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-06 21:43:46 +00:00
|
|
|
|
int
|
2000-02-18 20:57:33 +00:00
|
|
|
|
ata_resume(device_t dev)
|
|
|
|
|
{
|
|
|
|
|
struct ata_softc *scp = device_get_softc(dev);
|
|
|
|
|
|
|
|
|
|
ata_reinit(scp);
|
|
|
|
|
return 0;
|
2000-01-18 21:02:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-15 15:36:25 +00:00
|
|
|
|
static int
|
2001-09-12 08:38:13 +00:00
|
|
|
|
ataioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td)
|
2001-03-15 15:36:25 +00:00
|
|
|
|
{
|
2001-05-17 10:29:30 +00:00
|
|
|
|
struct ata_cmd *iocmd = (struct ata_cmd *)addr;
|
|
|
|
|
device_t device;
|
2001-08-21 11:35:47 +00:00
|
|
|
|
int error;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
|
2001-05-17 10:29:30 +00:00
|
|
|
|
if (cmd != IOCATA)
|
|
|
|
|
return ENOTTY;
|
|
|
|
|
|
|
|
|
|
if (iocmd->channel >= devclass_get_maxunit(ata_devclass))
|
|
|
|
|
return ENXIO;
|
|
|
|
|
|
|
|
|
|
if (!(device = devclass_get_device(ata_devclass, iocmd->channel)))
|
|
|
|
|
return ENODEV;
|
|
|
|
|
|
|
|
|
|
switch (iocmd->cmd) {
|
2001-03-15 15:36:25 +00:00
|
|
|
|
case ATAATTACH: {
|
|
|
|
|
/* should enable channel HW on controller that can SOS XXX */
|
2001-08-21 11:35:47 +00:00
|
|
|
|
error = ata_probe(device);
|
|
|
|
|
if (!error)
|
2001-03-15 15:36:25 +00:00
|
|
|
|
error = ata_attach(device);
|
2001-08-21 11:35:47 +00:00
|
|
|
|
return error;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ATADETACH: {
|
2001-05-17 10:29:30 +00:00
|
|
|
|
error = ata_detach(device);
|
2001-03-15 15:36:25 +00:00
|
|
|
|
/* should disable channel HW on controller that can SOS XXX */
|
2001-08-21 11:35:47 +00:00
|
|
|
|
return error;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ATAREINIT: {
|
|
|
|
|
struct ata_softc *scp;
|
|
|
|
|
int s;
|
|
|
|
|
|
|
|
|
|
scp = device_get_softc(device);
|
|
|
|
|
if (!scp)
|
2001-05-17 10:29:30 +00:00
|
|
|
|
return ENODEV;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
|
|
|
|
|
/* make sure channel is not busy SOS XXX */
|
|
|
|
|
s = splbio();
|
|
|
|
|
while (!atomic_cmpset_int(&scp->active, ATA_IDLE, ATA_ACTIVE))
|
|
|
|
|
tsleep((caddr_t)&s, PRIBIO, "atachm", hz/4);
|
|
|
|
|
error = ata_reinit(scp);
|
2001-03-19 08:04:54 +00:00
|
|
|
|
splx(s);
|
2001-08-21 11:35:47 +00:00
|
|
|
|
return error;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ATAGMODE: {
|
|
|
|
|
struct ata_softc *scp;
|
|
|
|
|
|
|
|
|
|
scp = device_get_softc(device);
|
|
|
|
|
if (!scp)
|
2001-05-17 10:29:30 +00:00
|
|
|
|
return ENODEV;
|
2001-03-21 11:44:58 +00:00
|
|
|
|
if (scp->dev_param[MASTER])
|
2001-05-17 10:29:30 +00:00
|
|
|
|
iocmd->u.mode.mode[MASTER] = scp->mode[MASTER];
|
|
|
|
|
else
|
|
|
|
|
iocmd->u.mode.mode[MASTER] = -1;
|
2001-03-21 11:44:58 +00:00
|
|
|
|
if (scp->dev_param[SLAVE])
|
2001-05-17 10:29:30 +00:00
|
|
|
|
iocmd->u.mode.mode[SLAVE] = scp->mode[SLAVE];
|
|
|
|
|
else
|
|
|
|
|
iocmd->u.mode.mode[SLAVE] = -1;
|
2001-08-21 11:35:47 +00:00
|
|
|
|
return 0;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ATASMODE: {
|
|
|
|
|
struct ata_softc *scp;
|
|
|
|
|
|
|
|
|
|
scp = device_get_softc(device);
|
|
|
|
|
if (!scp)
|
2001-05-17 10:29:30 +00:00
|
|
|
|
return ENODEV;
|
|
|
|
|
if (scp->dev_param[MASTER] && iocmd->u.mode.mode[MASTER] >= 0) {
|
|
|
|
|
ata_change_mode(scp, ATA_MASTER, iocmd->u.mode.mode[MASTER]);
|
|
|
|
|
iocmd->u.mode.mode[MASTER] = scp->mode[MASTER];
|
2001-03-21 11:44:58 +00:00
|
|
|
|
}
|
2001-05-17 10:29:30 +00:00
|
|
|
|
else
|
|
|
|
|
iocmd->u.mode.mode[MASTER] = -1;
|
|
|
|
|
|
|
|
|
|
if (scp->dev_param[SLAVE] && iocmd->u.mode.mode[SLAVE] >= 0) {
|
|
|
|
|
ata_change_mode(scp, ATA_SLAVE, iocmd->u.mode.mode[SLAVE]);
|
|
|
|
|
iocmd->u.mode.mode[SLAVE] = scp->mode[SLAVE];
|
2001-03-21 11:44:58 +00:00
|
|
|
|
}
|
2001-05-17 10:29:30 +00:00
|
|
|
|
else
|
|
|
|
|
iocmd->u.mode.mode[SLAVE] = -1;
|
2001-08-21 11:35:47 +00:00
|
|
|
|
return 0;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ATAGPARM: {
|
|
|
|
|
struct ata_softc *scp;
|
|
|
|
|
|
|
|
|
|
scp = device_get_softc(device);
|
|
|
|
|
if (!scp)
|
2001-05-17 10:29:30 +00:00
|
|
|
|
return ENODEV;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
|
2001-05-17 10:29:30 +00:00
|
|
|
|
iocmd->u.param.type[MASTER] =
|
2001-03-15 15:36:25 +00:00
|
|
|
|
scp->devices & (ATA_ATA_MASTER | ATA_ATAPI_MASTER);
|
2001-05-17 10:29:30 +00:00
|
|
|
|
iocmd->u.param.type[SLAVE] =
|
2001-03-15 15:36:25 +00:00
|
|
|
|
scp->devices & (ATA_ATA_SLAVE | ATA_ATAPI_SLAVE);
|
|
|
|
|
|
|
|
|
|
if (scp->dev_name[MASTER])
|
2001-05-17 10:29:30 +00:00
|
|
|
|
strcpy(iocmd->u.param.name[MASTER], scp->dev_name[MASTER]);
|
2001-03-15 15:36:25 +00:00
|
|
|
|
if (scp->dev_name[SLAVE])
|
2001-05-17 10:29:30 +00:00
|
|
|
|
strcpy(iocmd->u.param.name[SLAVE], scp->dev_name[SLAVE]);
|
2001-03-15 15:36:25 +00:00
|
|
|
|
|
|
|
|
|
if (scp->dev_param[MASTER])
|
2001-05-17 10:29:30 +00:00
|
|
|
|
bcopy(scp->dev_param[MASTER], &iocmd->u.param.params[MASTER],
|
2001-03-15 15:36:25 +00:00
|
|
|
|
sizeof(struct ata_params));
|
|
|
|
|
if (scp->dev_param[SLAVE])
|
2001-05-17 10:29:30 +00:00
|
|
|
|
bcopy(scp->dev_param[SLAVE], &iocmd->u.param.params[SLAVE],
|
2001-03-15 15:36:25 +00:00
|
|
|
|
sizeof(struct ata_params));
|
2001-08-21 11:35:47 +00:00
|
|
|
|
return 0;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
2001-08-30 09:47:17 +00:00
|
|
|
|
|
2001-09-01 08:47:11 +00:00
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
2001-08-30 09:47:17 +00:00
|
|
|
|
case ATAPICMD: {
|
|
|
|
|
struct ata_softc *scp;
|
|
|
|
|
struct atapi_softc *atp;
|
|
|
|
|
caddr_t buf;
|
|
|
|
|
|
|
|
|
|
scp = device_get_softc(device);
|
|
|
|
|
if (!scp)
|
|
|
|
|
return ENODEV;
|
|
|
|
|
|
|
|
|
|
if (!scp->dev_softc[iocmd->device] ||
|
|
|
|
|
!(scp->devices &
|
|
|
|
|
(iocmd->device == 0 ? ATA_ATAPI_MASTER : ATA_ATAPI_SLAVE)))
|
|
|
|
|
return ENODEV;
|
|
|
|
|
|
|
|
|
|
if (!(buf = malloc(iocmd->u.atapi.count, M_ATA, M_NOWAIT)))
|
|
|
|
|
return ENOMEM;
|
|
|
|
|
|
|
|
|
|
atp = scp->dev_softc[iocmd->device];
|
|
|
|
|
if (iocmd->u.atapi.flags & ATAPI_CMD_WRITE) {
|
|
|
|
|
error = copyin(iocmd->u.atapi.data, buf, iocmd->u.atapi.count);
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
error = atapi_queue_cmd(atp, iocmd->u.atapi.ccb,
|
|
|
|
|
buf, iocmd->u.atapi.count,
|
|
|
|
|
(iocmd->u.atapi.flags == ATAPI_CMD_READ ?
|
|
|
|
|
ATPR_F_READ : 0) | ATPR_F_QUIET,
|
|
|
|
|
iocmd->u.atapi.timeout, NULL, NULL);
|
|
|
|
|
if (error) {
|
|
|
|
|
iocmd->u.atapi.error = error;
|
|
|
|
|
bcopy(&atp->sense, iocmd->u.atapi.sense_data,
|
|
|
|
|
sizeof(struct atapi_reqsense));
|
|
|
|
|
error = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (iocmd->u.atapi.flags & ATAPI_CMD_READ)
|
|
|
|
|
error = copyout(buf, iocmd->u.atapi.data, iocmd->u.atapi.count);
|
|
|
|
|
|
|
|
|
|
free(buf, M_ATA);
|
|
|
|
|
return error;
|
|
|
|
|
}
|
2001-09-01 08:47:11 +00:00
|
|
|
|
#endif
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
2001-08-21 11:35:47 +00:00
|
|
|
|
return ENOTTY;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int
|
|
|
|
|
ata_getparam(struct ata_softc *scp, int device, u_int8_t command)
|
2000-01-18 21:02:59 +00:00
|
|
|
|
{
|
|
|
|
|
struct ata_params *ata_parm;
|
2000-01-24 20:45:24 +00:00
|
|
|
|
int retry = 0;
|
2000-01-18 21:02:59 +00:00
|
|
|
|
|
|
|
|
|
/* select drive */
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | device);
|
2000-01-18 21:02:59 +00:00
|
|
|
|
DELAY(1);
|
2000-01-24 20:45:24 +00:00
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
/* enable interrupt */
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_4BIT);
|
2000-01-25 20:14:51 +00:00
|
|
|
|
DELAY(1);
|
|
|
|
|
|
2000-01-24 20:45:24 +00:00
|
|
|
|
/* apparently some devices needs this repeated */
|
|
|
|
|
do {
|
|
|
|
|
if (ata_command(scp, device, command, 0, 0, 0, 0, 0, ATA_WAIT_INTR)) {
|
2001-10-03 08:25:11 +00:00
|
|
|
|
ata_printf(scp, device, "%s identify failed\n",
|
|
|
|
|
command == ATA_C_ATAPI_IDENTIFY ? "ATAPI" : "ATA");
|
2000-01-24 20:45:24 +00:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
2000-01-25 20:14:51 +00:00
|
|
|
|
if (retry++ > 4) {
|
2001-10-03 08:25:11 +00:00
|
|
|
|
ata_printf(scp, device, "%s identify retries exceeded\n",
|
|
|
|
|
command == ATA_C_ATAPI_IDENTIFY ? "ATAPI" : "ATA");
|
2000-01-24 20:45:24 +00:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
2000-01-25 20:14:51 +00:00
|
|
|
|
} while (ata_wait(scp, device,
|
|
|
|
|
((command == ATA_C_ATAPI_IDENTIFY) ?
|
|
|
|
|
ATA_S_DRQ : (ATA_S_READY | ATA_S_DSC | ATA_S_DRQ))));
|
2000-01-24 20:45:24 +00:00
|
|
|
|
|
2000-01-18 21:02:59 +00:00
|
|
|
|
ata_parm = malloc(sizeof(struct ata_params), M_ATA, M_NOWAIT);
|
|
|
|
|
if (!ata_parm) {
|
2001-09-20 15:25:36 +00:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof(struct ata_params)/sizeof(int16_t); i++)
|
|
|
|
|
ATA_INW(scp->r_io, ATA_DATA);
|
2000-02-18 20:57:33 +00:00
|
|
|
|
ata_printf(scp, device, "malloc for identify data failed\n");
|
2000-01-18 21:02:59 +00:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
2001-09-20 15:25:36 +00:00
|
|
|
|
|
|
|
|
|
ATA_INSW(scp->r_io, ATA_DATA, (int16_t *)ata_parm,
|
|
|
|
|
sizeof(struct ata_params)/sizeof(int16_t));
|
|
|
|
|
|
2000-01-18 21:02:59 +00:00
|
|
|
|
if (command == ATA_C_ATA_IDENTIFY ||
|
|
|
|
|
!((ata_parm->model[0] == 'N' && ata_parm->model[1] == 'E') ||
|
|
|
|
|
(ata_parm->model[0] == 'F' && ata_parm->model[1] == 'X')))
|
|
|
|
|
bswap(ata_parm->model, sizeof(ata_parm->model));
|
|
|
|
|
btrim(ata_parm->model, sizeof(ata_parm->model));
|
|
|
|
|
bpack(ata_parm->model, ata_parm->model, sizeof(ata_parm->model));
|
|
|
|
|
bswap(ata_parm->revision, sizeof(ata_parm->revision));
|
|
|
|
|
btrim(ata_parm->revision, sizeof(ata_parm->revision));
|
|
|
|
|
bpack(ata_parm->revision, ata_parm->revision, sizeof(ata_parm->revision));
|
2000-01-24 20:45:24 +00:00
|
|
|
|
scp->dev_param[ATA_DEV(device)] = ata_parm;
|
2000-01-18 21:02:59 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
static void
|
|
|
|
|
ata_boot_attach(void)
|
|
|
|
|
{
|
|
|
|
|
struct ata_softc *scp;
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int ctlr;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* run through all ata devices and look for real ATA & ATAPI devices
|
|
|
|
|
* using the hints we found in the early probe, this avoids some of
|
|
|
|
|
* the delays probing of non-exsistent devices can cause.
|
|
|
|
|
*/
|
|
|
|
|
for (ctlr=0; ctlr<devclass_get_maxunit(ata_devclass); ctlr++) {
|
|
|
|
|
if (!(scp = devclass_get_softc(ata_devclass, ctlr)))
|
|
|
|
|
continue;
|
|
|
|
|
if (scp->devices & ATA_ATA_SLAVE)
|
|
|
|
|
if (ata_getparam(scp, ATA_SLAVE, ATA_C_ATA_IDENTIFY))
|
|
|
|
|
scp->devices &= ~ATA_ATA_SLAVE;
|
|
|
|
|
if (scp->devices & ATA_ATAPI_SLAVE)
|
|
|
|
|
if (ata_getparam(scp, ATA_SLAVE, ATA_C_ATAPI_IDENTIFY))
|
|
|
|
|
scp->devices &= ~ATA_ATAPI_SLAVE;
|
|
|
|
|
if (scp->devices & ATA_ATA_MASTER)
|
|
|
|
|
if (ata_getparam(scp, ATA_MASTER, ATA_C_ATA_IDENTIFY))
|
|
|
|
|
scp->devices &= ~ATA_ATA_MASTER;
|
|
|
|
|
if (scp->devices & ATA_ATAPI_MASTER)
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (ata_getparam(scp, ATA_MASTER, ATA_C_ATAPI_IDENTIFY))
|
2000-02-18 20:57:33 +00:00
|
|
|
|
scp->devices &= ~ATA_ATAPI_MASTER;
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
2000-02-18 20:57:33 +00:00
|
|
|
|
/* now we know whats there, do the real attach, first the ATA disks */
|
|
|
|
|
for (ctlr=0; ctlr<devclass_get_maxunit(ata_devclass); ctlr++) {
|
|
|
|
|
if (!(scp = devclass_get_softc(ata_devclass, ctlr)))
|
|
|
|
|
continue;
|
|
|
|
|
if (scp->devices & ATA_ATA_MASTER)
|
|
|
|
|
ad_attach(scp, ATA_MASTER);
|
|
|
|
|
if (scp->devices & ATA_ATA_SLAVE)
|
|
|
|
|
ad_attach(scp, ATA_SLAVE);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
2000-02-18 20:57:33 +00:00
|
|
|
|
/* then the atapi devices */
|
|
|
|
|
for (ctlr=0; ctlr<devclass_get_maxunit(ata_devclass); ctlr++) {
|
|
|
|
|
if (!(scp = devclass_get_softc(ata_devclass, ctlr)))
|
|
|
|
|
continue;
|
|
|
|
|
if (scp->devices & ATA_ATAPI_MASTER)
|
|
|
|
|
atapi_attach(scp, ATA_MASTER);
|
|
|
|
|
if (scp->devices & ATA_ATAPI_SLAVE)
|
|
|
|
|
atapi_attach(scp, ATA_SLAVE);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
if (ata_delayed_attach) {
|
|
|
|
|
config_intrhook_disestablish(ata_delayed_attach);
|
|
|
|
|
free(ata_delayed_attach, M_ATA);
|
|
|
|
|
ata_delayed_attach = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-03-03 21:10:29 +00:00
|
|
|
|
static void
|
2000-02-18 20:57:33 +00:00
|
|
|
|
ata_intr(void *data)
|
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
|
|
|
|
{
|
2000-01-03 10:26:59 +00:00
|
|
|
|
struct ata_softc *scp = (struct ata_softc *)data;
|
2000-02-04 10:20:22 +00:00
|
|
|
|
|
|
|
|
|
/*
|
2001-03-06 21:43:46 +00:00
|
|
|
|
* on PCI systems we might share an interrupt line with another
|
|
|
|
|
* device or our twin ATA channel, so call scp->intr_func to figure
|
|
|
|
|
* out if it is really an interrupt we should process here
|
2000-02-04 10:20:22 +00:00
|
|
|
|
*/
|
2001-03-06 21:43:46 +00:00
|
|
|
|
if (scp->intr_func && scp->intr_func(scp))
|
|
|
|
|
return;
|
2000-01-03 10:26:59 +00:00
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
/* if drive is busy it didn't interrupt */
|
2001-03-19 08:04:54 +00:00
|
|
|
|
if (ATA_INB(scp->r_altio, ATA_ALTSTAT) & ATA_S_BUSY) {
|
|
|
|
|
DELAY(100);
|
|
|
|
|
if (!(ATA_INB(scp->r_altio, ATA_ALTSTAT) & ATA_S_DRQ))
|
|
|
|
|
return;
|
|
|
|
|
}
|
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
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
/* clear interrupt and get status */
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->status = ATA_INB(scp->r_io, ATA_STATUS);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
|
|
|
|
|
if (scp->status & ATA_S_ERROR)
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->error = ATA_INB(scp->r_io, ATA_ERROR);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
|
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
|
|
|
|
/* find & call the responsible driver to process this interrupt */
|
|
|
|
|
switch (scp->active) {
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
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
|
|
|
|
case ATA_ACTIVE_ATA:
|
2000-09-19 11:08:39 +00:00
|
|
|
|
if (!scp->running || ad_interrupt(scp->running) == ATA_OP_CONTINUES)
|
1999-11-06 16:50:21 +00:00
|
|
|
|
return;
|
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
|
|
|
|
break;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
#endif
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
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
|
|
|
|
case ATA_ACTIVE_ATAPI:
|
2000-09-19 11:08:39 +00:00
|
|
|
|
if (!scp->running || atapi_interrupt(scp->running) == ATA_OP_CONTINUES)
|
1999-11-06 16:50:21 +00:00
|
|
|
|
return;
|
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
|
|
|
|
break;
|
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
|
|
|
|
#endif
|
1999-03-05 09:43:30 +00:00
|
|
|
|
case ATA_WAIT_INTR:
|
2001-03-19 08:04:54 +00:00
|
|
|
|
case ATA_WAIT_INTR | ATA_CONTROL:
|
1999-03-05 09:43:30 +00:00
|
|
|
|
wakeup((caddr_t)scp);
|
|
|
|
|
break;
|
|
|
|
|
|
1999-11-06 16:50:21 +00:00
|
|
|
|
case ATA_WAIT_READY:
|
2001-03-19 08:04:54 +00:00
|
|
|
|
case ATA_WAIT_READY | ATA_CONTROL:
|
1999-11-06 16:50:21 +00:00
|
|
|
|
break;
|
|
|
|
|
|
1999-03-03 21:10:29 +00:00
|
|
|
|
case ATA_IDLE:
|
2000-09-19 11:08:39 +00:00
|
|
|
|
if (scp->flags & ATA_QUEUED) {
|
2001-01-14 19:36:20 +00:00
|
|
|
|
scp->active = ATA_ACTIVE; /* XXX */
|
2000-09-19 11:08:39 +00:00
|
|
|
|
if (ata_service(scp) == ATA_OP_CONTINUES)
|
|
|
|
|
return;
|
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
|
|
|
|
}
|
2000-09-19 11:08:39 +00:00
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
#ifdef ATA_DEBUG
|
|
|
|
|
{
|
|
|
|
|
static int intr_count = 0;
|
|
|
|
|
|
|
|
|
|
if (intr_count++ < 10)
|
2001-03-19 08:04:54 +00:00
|
|
|
|
ata_printf(scp, -1, "unwanted interrupt %d %sstatus = %02x\n",
|
|
|
|
|
intr_count, active2str(scp->active), scp->status);
|
2000-09-19 11:08:39 +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
|
|
|
|
#endif
|
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
|
|
|
|
}
|
2001-03-19 08:04:54 +00:00
|
|
|
|
scp->active &= ATA_CONTROL;
|
|
|
|
|
if (scp->active & ATA_CONTROL)
|
2001-03-14 12:05:44 +00:00
|
|
|
|
return;
|
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
|
|
|
|
scp->running = NULL;
|
1999-03-07 21:49:14 +00:00
|
|
|
|
ata_start(scp);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
return;
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ata_start(struct ata_softc *scp)
|
|
|
|
|
{
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
Nine'th update to the new ATA/ATAPI driver:
The atapi subsystem has gotten better error handeling and timeouts,
it also tries a REQUEST SENSE command when devices returns errors,
to give a little more info as to what went wrong. It might be a
little verbose for now, but I'm interested in as much feedback on
errors as possible, especially timeouts, as I'm a bit in doubt if
I've chosen resonable default values everywhere.
The disk driver has been changed a bit to prepare for tagged queing,
which is next on my list.
The disk driver has grown a dump routine, I got one implementation
from Darrell Anderson <anderson@cs.duke.edu> which also did
partial dumps (usefull on big memory machines) I left out the
partial stuff for now, and changed the rest alot to fit into the new
ad_request framework.
Some minor cleanups and rearrangements as well.
As usual USE AT YOUR OWN RISK!!, this is still pre alpha level code.
Especially the DMA support can hose your disk real bad if anything
goes wrong, again you have been warned :)
Notebook owners should be carefull that their machines dont suspend
as this might cause trouble...
But please tell me how it works for you!
Enjoy!
-Søren
1999-06-25 09:03:07 +00:00
|
|
|
|
struct ad_request *ad_request;
|
2000-02-04 10:20:22 +00:00
|
|
|
|
#endif
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
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
|
|
|
|
struct atapi_request *atapi_request;
|
2000-02-04 10:20:22 +00:00
|
|
|
|
#endif
|
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
|
|
|
|
|
2001-01-14 19:36:20 +00:00
|
|
|
|
if (!atomic_cmpset_int(&scp->active, ATA_IDLE, ATA_ACTIVE))
|
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
|
|
|
|
return;
|
2000-09-19 11:08:39 +00:00
|
|
|
|
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
1999-10-09 19:57:13 +00:00
|
|
|
|
/* find & call the responsible driver if anything on the ATA queue */
|
2000-03-13 12:04:58 +00:00
|
|
|
|
if (TAILQ_EMPTY(&scp->ata_queue)) {
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (scp->devices & (ATA_ATA_MASTER) && scp->dev_softc[MASTER])
|
|
|
|
|
ad_start((struct ad_softc *)scp->dev_softc[MASTER]);
|
|
|
|
|
if (scp->devices & (ATA_ATA_SLAVE) && scp->dev_softc[SLAVE])
|
|
|
|
|
ad_start((struct ad_softc *)scp->dev_softc[SLAVE]);
|
2000-03-13 12:04:58 +00:00
|
|
|
|
}
|
Nine'th update to the new ATA/ATAPI driver:
The atapi subsystem has gotten better error handeling and timeouts,
it also tries a REQUEST SENSE command when devices returns errors,
to give a little more info as to what went wrong. It might be a
little verbose for now, but I'm interested in as much feedback on
errors as possible, especially timeouts, as I'm a bit in doubt if
I've chosen resonable default values everywhere.
The disk driver has been changed a bit to prepare for tagged queing,
which is next on my list.
The disk driver has grown a dump routine, I got one implementation
from Darrell Anderson <anderson@cs.duke.edu> which also did
partial dumps (usefull on big memory machines) I left out the
partial stuff for now, and changed the rest alot to fit into the new
ad_request framework.
Some minor cleanups and rearrangements as well.
As usual USE AT YOUR OWN RISK!!, this is still pre alpha level code.
Especially the DMA support can hose your disk real bad if anything
goes wrong, again you have been warned :)
Notebook owners should be carefull that their machines dont suspend
as this might cause trouble...
But please tell me how it works for you!
Enjoy!
-Søren
1999-06-25 09:03:07 +00:00
|
|
|
|
if ((ad_request = TAILQ_FIRST(&scp->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
|
|
|
|
TAILQ_REMOVE(&scp->ata_queue, ad_request, chain);
|
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
|
|
|
|
scp->active = ATA_ACTIVE_ATA;
|
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
|
|
|
|
scp->running = ad_request;
|
2000-09-19 11:08:39 +00:00
|
|
|
|
if (ad_transfer(ad_request) == ATA_OP_CONTINUES)
|
|
|
|
|
return;
|
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
|
|
|
|
}
|
2000-09-19 11:08:39 +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
|
|
|
|
#endif
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
2000-03-18 22:42:45 +00:00
|
|
|
|
/* find & call the responsible driver if anything on the ATAPI queue */
|
2000-03-13 12:04:58 +00:00
|
|
|
|
if (TAILQ_EMPTY(&scp->atapi_queue)) {
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (scp->devices & (ATA_ATAPI_MASTER) && scp->dev_softc[MASTER])
|
|
|
|
|
atapi_start((struct atapi_softc *)scp->dev_softc[MASTER]);
|
|
|
|
|
if (scp->devices & (ATA_ATAPI_SLAVE) && scp->dev_softc[SLAVE])
|
|
|
|
|
atapi_start((struct atapi_softc *)scp->dev_softc[SLAVE]);
|
2000-03-13 12:04:58 +00:00
|
|
|
|
}
|
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
|
|
|
|
if ((atapi_request = TAILQ_FIRST(&scp->atapi_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
|
|
|
|
TAILQ_REMOVE(&scp->atapi_queue, atapi_request, chain);
|
|
|
|
|
scp->active = ATA_ACTIVE_ATAPI;
|
|
|
|
|
scp->running = atapi_request;
|
2001-04-05 11:15:24 +00:00
|
|
|
|
if (atapi_transfer(atapi_request) == ATA_OP_CONTINUES)
|
|
|
|
|
return;
|
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
|
|
|
|
#endif
|
2000-01-27 19:00:51 +00:00
|
|
|
|
scp->active = ATA_IDLE;
|
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
|
2001-03-14 12:05:44 +00:00
|
|
|
|
ata_reset(struct ata_softc *scp)
|
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
|
|
|
|
{
|
2001-03-14 12:05:44 +00:00
|
|
|
|
u_int8_t lsb, msb, ostat0, ostat1;
|
|
|
|
|
u_int8_t stat0 = ATA_S_BUSY, stat1 = ATA_S_BUSY;
|
|
|
|
|
int mask = 0, timeout;
|
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
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
/* do we have any signs of ATA/ATAPI HW being present ? */
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
|
2001-03-14 14:00:09 +00:00
|
|
|
|
DELAY(10);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ostat0 = ATA_INB(scp->r_io, ATA_STATUS);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if ((ostat0 & 0xf8) != 0xf8 && ostat0 != 0xa5)
|
|
|
|
|
mask |= 0x01;
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_SLAVE);
|
2001-03-14 14:00:09 +00:00
|
|
|
|
DELAY(10);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
ostat1 = ATA_INB(scp->r_io, ATA_STATUS);
|
|
|
|
|
if ((ostat1 & 0xf8) != 0xf8 && ostat1 != 0xa5)
|
|
|
|
|
mask |= 0x02;
|
|
|
|
|
|
|
|
|
|
scp->devices = 0;
|
|
|
|
|
if (!mask)
|
|
|
|
|
return;
|
2000-11-12 20:40:05 +00:00
|
|
|
|
|
|
|
|
|
/* in some setups we dont want to test for a slave */
|
|
|
|
|
if (scp->flags & ATA_NO_SLAVE)
|
2001-03-14 12:05:44 +00:00
|
|
|
|
mask &= ~0x02;
|
2000-11-12 20:40:05 +00:00
|
|
|
|
|
2000-11-16 10:52:00 +00:00
|
|
|
|
if (bootverbose)
|
2000-11-12 20:40:05 +00:00
|
|
|
|
ata_printf(scp, -1, "mask=%02x ostat0=%02x ostat2=%02x\n",
|
2001-03-14 12:05:44 +00:00
|
|
|
|
mask, ostat0, ostat1);
|
2000-11-12 20:40:05 +00:00
|
|
|
|
|
|
|
|
|
/* reset channel */
|
2001-10-03 08:25:11 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
|
|
|
|
|
DELAY(10);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_IDS | ATA_A_RESET);
|
2000-11-08 21:25:43 +00:00
|
|
|
|
DELAY(10000);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_IDS);
|
2000-11-08 21:25:43 +00:00
|
|
|
|
DELAY(100000);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_INB(scp->r_io, ATA_ERROR);
|
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
|
|
|
|
|
|
|
|
|
/* wait for BUSY to go inactive */
|
1999-10-09 19:57:13 +00:00
|
|
|
|
for (timeout = 0; timeout < 310000; timeout++) {
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (stat0 & ATA_S_BUSY) {
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
|
2000-11-12 20:40:05 +00:00
|
|
|
|
DELAY(10);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
stat0 = ATA_INB(scp->r_io, ATA_STATUS);
|
|
|
|
|
if (!(stat0 & ATA_S_BUSY)) {
|
2000-11-12 20:40:05 +00:00
|
|
|
|
/* check for ATAPI signature while its still there */
|
2001-03-14 12:05:44 +00:00
|
|
|
|
lsb = ATA_INB(scp->r_io, ATA_CYL_LSB);
|
|
|
|
|
msb = ATA_INB(scp->r_io, ATA_CYL_MSB);
|
2000-11-16 10:52:00 +00:00
|
|
|
|
if (bootverbose)
|
|
|
|
|
ata_printf(scp, ATA_MASTER,
|
2001-03-14 12:05:44 +00:00
|
|
|
|
"ATAPI probe %02x %02x\n", lsb, msb);
|
|
|
|
|
if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB)
|
2000-11-12 20:40:05 +00:00
|
|
|
|
scp->devices |= ATA_ATAPI_MASTER;
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (stat1 & ATA_S_BUSY) {
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_SLAVE);
|
2000-11-12 20:40:05 +00:00
|
|
|
|
DELAY(10);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
stat1 = ATA_INB(scp->r_io, ATA_STATUS);
|
|
|
|
|
if (!(stat1 & ATA_S_BUSY)) {
|
2000-11-12 20:40:05 +00:00
|
|
|
|
/* check for ATAPI signature while its still there */
|
2001-03-14 12:05:44 +00:00
|
|
|
|
lsb = ATA_INB(scp->r_io, ATA_CYL_LSB);
|
|
|
|
|
msb = ATA_INB(scp->r_io, ATA_CYL_MSB);
|
2000-11-16 10:52:00 +00:00
|
|
|
|
if (bootverbose)
|
|
|
|
|
ata_printf(scp, ATA_SLAVE,
|
2001-03-14 12:05:44 +00:00
|
|
|
|
"ATAPI probe %02x %02x\n", lsb, msb);
|
|
|
|
|
if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB)
|
2000-11-12 20:40:05 +00:00
|
|
|
|
scp->devices |= ATA_ATAPI_SLAVE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (mask == 0x01) /* wait for master only */
|
|
|
|
|
if (!(stat0 & ATA_S_BUSY))
|
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
|
|
|
|
break;
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (mask == 0x02) /* wait for slave only */
|
|
|
|
|
if (!(stat1 & ATA_S_BUSY))
|
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
|
|
|
|
break;
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (mask == 0x03) /* wait for both master & slave */
|
|
|
|
|
if (!(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY))
|
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
|
|
|
|
break;
|
2000-08-11 10:34:22 +00:00
|
|
|
|
DELAY(100);
|
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
|
|
|
|
}
|
2000-11-12 20:40:05 +00:00
|
|
|
|
DELAY(10);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_4BIT);
|
2000-11-08 19:31:39 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (stat0 & ATA_S_BUSY)
|
|
|
|
|
mask &= ~0x01;
|
|
|
|
|
if (stat1 & ATA_S_BUSY)
|
|
|
|
|
mask &= ~0x02;
|
2000-11-16 10:52:00 +00:00
|
|
|
|
if (bootverbose)
|
2001-03-14 12:05:44 +00:00
|
|
|
|
ata_printf(scp, -1, "mask=%02x stat0=%02x stat1=%02x\n",
|
|
|
|
|
mask, stat0, stat1);
|
|
|
|
|
if (!mask)
|
2000-11-08 19:31:39 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (mask & 0x01 && ostat0 != 0x00 && !(scp->devices & ATA_ATAPI_MASTER)) {
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
|
2000-11-12 20:40:05 +00:00
|
|
|
|
DELAY(10);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_ERROR, 0x58);
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_CYL_LSB, 0xa5);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
lsb = ATA_INB(scp->r_io, ATA_ERROR);
|
|
|
|
|
msb = ATA_INB(scp->r_io, ATA_CYL_LSB);
|
2000-11-16 10:52:00 +00:00
|
|
|
|
if (bootverbose)
|
2001-03-14 12:05:44 +00:00
|
|
|
|
ata_printf(scp, ATA_MASTER, "ATA probe %02x %02x\n", lsb, msb);
|
|
|
|
|
if (lsb != 0x58 && msb == 0xa5)
|
2000-11-08 19:31:39 +00:00
|
|
|
|
scp->devices |= ATA_ATA_MASTER;
|
|
|
|
|
}
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (mask & 0x02 && ostat1 != 0x00 && !(scp->devices & ATA_ATAPI_SLAVE)) {
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_SLAVE);
|
2000-11-12 20:40:05 +00:00
|
|
|
|
DELAY(10);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_ERROR, 0x58);
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_CYL_LSB, 0xa5);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
lsb = ATA_INB(scp->r_io, ATA_ERROR);
|
|
|
|
|
msb = ATA_INB(scp->r_io, ATA_CYL_LSB);
|
2000-11-16 10:52:00 +00:00
|
|
|
|
if (bootverbose)
|
2001-03-14 12:05:44 +00:00
|
|
|
|
ata_printf(scp, ATA_SLAVE, "ATA probe %02x %02x\n", lsb, msb);
|
|
|
|
|
if (lsb != 0x58 && msb == 0xa5)
|
2000-11-08 19:31:39 +00:00
|
|
|
|
scp->devices |= ATA_ATA_SLAVE;
|
|
|
|
|
}
|
2000-11-16 10:52:00 +00:00
|
|
|
|
if (bootverbose)
|
|
|
|
|
ata_printf(scp, -1, "devices=%02x\n", scp->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
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int
|
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
|
|
|
|
ata_reinit(struct ata_softc *scp)
|
|
|
|
|
{
|
2001-03-14 12:05:44 +00:00
|
|
|
|
int devices, misdev, newdev;
|
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
|
|
|
|
|
2001-03-15 15:36:25 +00:00
|
|
|
|
if (!scp->r_io || !scp->r_altio || !scp->r_irq)
|
|
|
|
|
return ENXIO;
|
2001-03-19 08:04:54 +00:00
|
|
|
|
scp->active = ATA_CONTROL;
|
1999-10-09 19:57:13 +00:00
|
|
|
|
scp->running = NULL;
|
2001-03-14 12:05:44 +00:00
|
|
|
|
devices = scp->devices;
|
|
|
|
|
ata_printf(scp, -1, "resetting devices .. ");
|
|
|
|
|
ata_reset(scp);
|
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
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if ((misdev = devices & ~scp->devices)) {
|
2001-03-15 15:36:25 +00:00
|
|
|
|
if (misdev)
|
|
|
|
|
printf("\n");
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (misdev & ATA_ATA_MASTER && scp->dev_softc[MASTER])
|
2001-03-14 14:00:09 +00:00
|
|
|
|
ad_detach(scp->dev_softc[MASTER], 0);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (misdev & ATA_ATA_SLAVE && scp->dev_softc[SLAVE])
|
2001-03-14 14:00:09 +00:00
|
|
|
|
ad_detach(scp->dev_softc[SLAVE], 0);
|
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
|
|
|
|
#endif
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (misdev & ATA_ATAPI_MASTER && scp->dev_softc[MASTER])
|
|
|
|
|
atapi_detach(scp->dev_softc[MASTER]);
|
|
|
|
|
if (misdev & ATA_ATAPI_SLAVE && scp->dev_softc[SLAVE])
|
|
|
|
|
atapi_detach(scp->dev_softc[SLAVE]);
|
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
|
|
|
|
#endif
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if (misdev & ATA_ATA_MASTER || misdev & ATA_ATAPI_MASTER) {
|
|
|
|
|
free(scp->dev_param[MASTER], M_ATA);
|
|
|
|
|
scp->dev_param[MASTER] = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (misdev & ATA_ATA_SLAVE || misdev & ATA_ATAPI_SLAVE) {
|
|
|
|
|
free(scp->dev_param[SLAVE], M_ATA);
|
|
|
|
|
scp->dev_param[SLAVE] = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((newdev = ~devices & scp->devices)) {
|
|
|
|
|
if (newdev & ATA_ATA_MASTER)
|
|
|
|
|
if (ata_getparam(scp, ATA_MASTER, ATA_C_ATA_IDENTIFY))
|
|
|
|
|
newdev &= ~ATA_ATA_MASTER;
|
|
|
|
|
if (newdev & ATA_ATA_SLAVE)
|
|
|
|
|
if (ata_getparam(scp, ATA_SLAVE, ATA_C_ATA_IDENTIFY))
|
|
|
|
|
newdev &= ~ATA_ATA_SLAVE;
|
|
|
|
|
if (newdev & ATA_ATAPI_MASTER)
|
|
|
|
|
if (ata_getparam(scp, ATA_MASTER, ATA_C_ATAPI_IDENTIFY))
|
|
|
|
|
newdev &= ~ATA_ATAPI_MASTER;
|
|
|
|
|
if (newdev & ATA_ATAPI_SLAVE)
|
|
|
|
|
if (ata_getparam(scp, ATA_SLAVE, ATA_C_ATAPI_IDENTIFY))
|
|
|
|
|
newdev &= ~ATA_ATAPI_SLAVE;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
}
|
2001-03-15 15:36:25 +00:00
|
|
|
|
if (!misdev && newdev)
|
|
|
|
|
printf("\n");
|
2001-03-14 12:05:44 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
|
|
|
|
if (newdev & ATA_ATA_MASTER && !scp->dev_softc[MASTER])
|
|
|
|
|
ad_attach(scp, ATA_MASTER);
|
|
|
|
|
else if (scp->devices & ATA_ATA_MASTER && scp->dev_softc[MASTER])
|
|
|
|
|
ad_reinit((struct ad_softc *)scp->dev_softc[MASTER]);
|
|
|
|
|
if (newdev & ATA_ATA_SLAVE && !scp->dev_softc[SLAVE])
|
|
|
|
|
ad_attach(scp, ATA_SLAVE);
|
|
|
|
|
else if (scp->devices & (ATA_ATA_SLAVE) && scp->dev_softc[SLAVE])
|
|
|
|
|
ad_reinit((struct ad_softc *)scp->dev_softc[SLAVE]);
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(DEV_ATAPICD) || defined(DEV_ATAPIFD) || defined(DEV_ATAPIST)
|
|
|
|
|
if (newdev & ATA_ATAPI_MASTER && !scp->dev_softc[MASTER])
|
|
|
|
|
atapi_attach(scp, ATA_MASTER);
|
|
|
|
|
else if (scp->devices & (ATA_ATAPI_MASTER) && scp->dev_softc[MASTER])
|
|
|
|
|
atapi_reinit((struct atapi_softc *)scp->dev_softc[MASTER]);
|
|
|
|
|
if (newdev & ATA_ATAPI_SLAVE && !scp->dev_softc[SLAVE])
|
|
|
|
|
atapi_attach(scp, ATA_SLAVE);
|
|
|
|
|
else if (scp->devices & (ATA_ATAPI_SLAVE) && scp->dev_softc[SLAVE])
|
|
|
|
|
atapi_reinit((struct atapi_softc *)scp->dev_softc[SLAVE]);
|
|
|
|
|
#endif
|
|
|
|
|
printf("done\n");
|
2001-03-19 08:04:54 +00:00
|
|
|
|
scp->active = ATA_IDLE;
|
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
|
|
|
|
ata_start(scp);
|
|
|
|
|
return 0;
|
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
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int
|
|
|
|
|
ata_service(struct ata_softc *scp)
|
|
|
|
|
{
|
|
|
|
|
/* do we have a SERVICE request from the drive ? */
|
|
|
|
|
if ((scp->status & (ATA_S_SERVICE|ATA_S_ERROR|ATA_S_DRQ)) == ATA_S_SERVICE){
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_bmio, ATA_BMSTAT_PORT,
|
|
|
|
|
ata_dmastatus(scp) | ATA_BMSTAT_INTERRUPT);
|
2001-01-29 10:01:11 +00:00
|
|
|
|
#ifdef DEV_ATADISK
|
2001-02-06 16:44:25 +00:00
|
|
|
|
if ((ATA_INB(scp->r_io, ATA_DRIVE) & ATA_SLAVE) == ATA_MASTER) {
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if ((scp->devices & ATA_ATA_MASTER) && scp->dev_softc[MASTER])
|
|
|
|
|
return ad_service((struct ad_softc *)scp->dev_softc[MASTER], 0);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2001-03-14 12:05:44 +00:00
|
|
|
|
if ((scp->devices & ATA_ATA_SLAVE) && scp->dev_softc[SLAVE])
|
|
|
|
|
return ad_service((struct ad_softc *)scp->dev_softc[SLAVE], 0);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
return ATA_OP_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
ata_wait(struct ata_softc *scp, int device, u_int8_t 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
|
|
|
|
{
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int timeout = 0;
|
2000-01-17 02:04:19 +00:00
|
|
|
|
|
1999-12-13 10:19:39 +00:00
|
|
|
|
DELAY(1);
|
2000-01-17 02:04:19 +00:00
|
|
|
|
while (timeout < 5000000) { /* timeout 5 secs */
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->status = ATA_INB(scp->r_io, ATA_STATUS);
|
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
|
|
|
|
|
|
|
|
|
/* if drive fails status, reselect the drive just to be sure */
|
2000-01-17 02:04:19 +00:00
|
|
|
|
if (scp->status == 0xff) {
|
2000-01-24 20:45:24 +00:00
|
|
|
|
ata_printf(scp, device, "no status, reselecting device\n");
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | device);
|
2001-03-14 14:00:09 +00:00
|
|
|
|
DELAY(10);
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->status = ATA_INB(scp->r_io, ATA_STATUS);
|
2001-03-14 14:00:09 +00:00
|
|
|
|
if (scp->status == 0xff)
|
|
|
|
|
return -1;
|
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
|
|
|
|
}
|
2000-01-17 02:04:19 +00:00
|
|
|
|
|
|
|
|
|
/* are we done ? */
|
|
|
|
|
if (!(scp->status & ATA_S_BUSY))
|
|
|
|
|
break;
|
|
|
|
|
|
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
|
|
|
|
if (timeout > 1000) {
|
|
|
|
|
timeout += 1000;
|
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
|
|
|
|
DELAY(1000);
|
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
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
timeout += 10;
|
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
|
|
|
|
DELAY(10);
|
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
|
|
|
|
}
|
2000-01-17 02:04:19 +00:00
|
|
|
|
}
|
|
|
|
|
if (scp->status & ATA_S_ERROR)
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->error = ATA_INB(scp->r_io, ATA_ERROR);
|
2000-01-17 02:04:19 +00:00
|
|
|
|
if (timeout >= 5000000)
|
|
|
|
|
return -1;
|
|
|
|
|
if (!mask)
|
|
|
|
|
return (scp->status & ATA_S_ERROR);
|
|
|
|
|
|
|
|
|
|
/* Wait 50 msec for bits wanted. */
|
|
|
|
|
timeout = 5000;
|
|
|
|
|
while (timeout--) {
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->status = ATA_INB(scp->r_io, ATA_STATUS);
|
2000-01-17 02:04:19 +00:00
|
|
|
|
if ((scp->status & mask) == mask) {
|
|
|
|
|
if (scp->status & ATA_S_ERROR)
|
2001-02-06 16:44:25 +00:00
|
|
|
|
scp->error = ATA_INB(scp->r_io, ATA_ERROR);
|
2000-01-17 02:04:19 +00:00
|
|
|
|
return (scp->status & ATA_S_ERROR);
|
|
|
|
|
}
|
|
|
|
|
DELAY (10);
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
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
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int
|
|
|
|
|
ata_command(struct ata_softc *scp, int device, u_int8_t command,
|
|
|
|
|
u_int16_t cylinder, u_int8_t head, u_int8_t sector,
|
|
|
|
|
u_int8_t count, u_int8_t feature, int flags)
|
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
|
|
|
|
{
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int error = 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
|
|
|
|
#ifdef ATA_DEBUG
|
2000-01-24 20:45:24 +00:00
|
|
|
|
ata_printf(scp, device, "ata_command: addr=%04x, cmd=%02x, "
|
2000-09-19 11:08:39 +00:00
|
|
|
|
"c=%d, h=%d, s=%d, count=%d, feature=%d, flags=%02x\n",
|
2001-02-06 16:44:25 +00:00
|
|
|
|
rman_get_start(scp->r_io), command, cylinder, head, sector,
|
2000-09-19 11:08:39 +00:00
|
|
|
|
count, feature, flags);
|
2001-03-19 08:04:54 +00:00
|
|
|
|
|
|
|
|
|
/* sanity checks */
|
|
|
|
|
switch(scp->active) {
|
|
|
|
|
case ATA_IDLE:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ATA_CONTROL:
|
|
|
|
|
if (flags == ATA_WAIT_INTR || flags == ATA_WAIT_READY)
|
|
|
|
|
break;
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
case ATA_ACTIVE_ATA:
|
|
|
|
|
case ATA_ACTIVE_ATAPI:
|
|
|
|
|
if (flags == ATA_IMMEDIATE)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
out:
|
|
|
|
|
printf("ata_command called %s flags=%s cmd=%02x\n",
|
|
|
|
|
active2str(scp->active), active2str(flags), command);
|
|
|
|
|
break;
|
|
|
|
|
}
|
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
|
|
|
|
#endif
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
/* disable interrupt from device */
|
|
|
|
|
if (scp->flags & ATA_QUEUED)
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_IDS | ATA_A_4BIT);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
|
|
|
|
|
/* select device */
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | device);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
|
1999-03-07 21:49:14 +00:00
|
|
|
|
/* ready to issue command ? */
|
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
|
|
|
|
if (ata_wait(scp, device, 0) < 0) {
|
2000-01-24 20:45:24 +00:00
|
|
|
|
ata_printf(scp, device,
|
|
|
|
|
"timeout waiting to give command=%02x s=%02x e=%02x\n",
|
|
|
|
|
command, scp->status, scp->error);
|
1999-10-09 19:57:13 +00:00
|
|
|
|
return -1;
|
1999-03-05 09:43:30 +00:00
|
|
|
|
}
|
2000-09-19 11:08:39 +00:00
|
|
|
|
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_FEATURE, feature);
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_COUNT, count);
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_SECTOR, sector);
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_CYL_MSB, cylinder >> 8);
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_CYL_LSB, cylinder);
|
|
|
|
|
ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | device | head);
|
1999-03-05 09:43:30 +00:00
|
|
|
|
|
|
|
|
|
switch (flags) {
|
|
|
|
|
case ATA_WAIT_INTR:
|
2001-03-14 12:05:44 +00:00
|
|
|
|
scp->active |= ATA_WAIT_INTR;
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_CMD, command);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
|
|
|
|
|
/* enable interrupt */
|
|
|
|
|
if (scp->flags & ATA_QUEUED)
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_4BIT);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
|
2001-08-10 06:37:05 +00:00
|
|
|
|
if (tsleep((caddr_t)scp, PRIBIO, "atacmd", 10 * hz) != 0) {
|
2000-01-24 20:45:24 +00:00
|
|
|
|
ata_printf(scp, device, "ata_command: timeout waiting for intr\n");
|
2001-03-14 12:05:44 +00:00
|
|
|
|
scp->active &= ~ATA_WAIT_INTR;
|
2000-09-19 11:08:39 +00:00
|
|
|
|
error = -1;
|
1999-03-07 21:49:14 +00:00
|
|
|
|
}
|
1999-03-05 09:43:30 +00:00
|
|
|
|
break;
|
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
|
|
|
|
|
1999-11-06 16:50:21 +00:00
|
|
|
|
case ATA_WAIT_READY:
|
2001-03-14 12:05:44 +00:00
|
|
|
|
scp->active |= ATA_WAIT_READY;
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_CMD, command);
|
1999-11-06 16:50:21 +00:00
|
|
|
|
if (ata_wait(scp, device, ATA_S_READY) < 0) {
|
2000-01-24 20:45:24 +00:00
|
|
|
|
ata_printf(scp, device,
|
|
|
|
|
"timeout waiting for command=%02x s=%02x e=%02x\n",
|
|
|
|
|
command, scp->status, scp->error);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
error = -1;
|
1999-11-06 16:50:21 +00:00
|
|
|
|
}
|
2001-03-14 12:05:44 +00:00
|
|
|
|
scp->active &= ~ATA_WAIT_READY;
|
1999-03-05 09:43:30 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ATA_IMMEDIATE:
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_io, ATA_CMD, command);
|
1999-03-05 09:43:30 +00:00
|
|
|
|
break;
|
1999-10-09 19:57:13 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2000-01-24 20:45:24 +00:00
|
|
|
|
ata_printf(scp, device, "DANGER: illegal interrupt flag=%s\n",
|
|
|
|
|
active2str(flags));
|
1999-03-05 09:43:30 +00:00
|
|
|
|
}
|
2000-09-19 11:08:39 +00:00
|
|
|
|
/* enable interrupt */
|
|
|
|
|
if (scp->flags & ATA_QUEUED)
|
2001-02-06 16:44:25 +00:00
|
|
|
|
ATA_OUTB(scp->r_altio, ATA_ALTSTAT, ATA_A_4BIT);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
return error;
|
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
|
|
|
|
}
|
|
|
|
|
|
2001-03-15 15:36:25 +00:00
|
|
|
|
void
|
2001-09-20 15:25:36 +00:00
|
|
|
|
ata_set_name(struct ata_softc *scp, int device, char *name, int lun)
|
2001-03-15 15:36:25 +00:00
|
|
|
|
{
|
2001-09-20 15:25:36 +00:00
|
|
|
|
scp->dev_name[ATA_DEV(device)] = malloc(strlen(name) + 4, M_ATA, M_NOWAIT);
|
2001-03-15 15:36:25 +00:00
|
|
|
|
if (scp->dev_name[ATA_DEV(device)])
|
2001-09-20 15:25:36 +00:00
|
|
|
|
sprintf(scp->dev_name[ATA_DEV(device)], "%s%d", name, lun);
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ata_free_name(struct ata_softc *scp, int device)
|
|
|
|
|
{
|
|
|
|
|
if (scp->dev_name[ATA_DEV(device)])
|
|
|
|
|
free(scp->dev_name[ATA_DEV(device)], M_ATA);
|
2001-10-03 08:25:11 +00:00
|
|
|
|
scp->dev_name[ATA_DEV(device)] = NULL;
|
2001-03-15 15:36:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
int
|
2000-09-19 11:08:39 +00:00
|
|
|
|
ata_get_lun(u_int32_t *map)
|
|
|
|
|
{
|
|
|
|
|
int lun = ffs(~*map) - 1;
|
|
|
|
|
|
|
|
|
|
*map |= (1 << lun);
|
|
|
|
|
return lun;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-06 12:41:53 +00:00
|
|
|
|
int
|
|
|
|
|
ata_test_lun(u_int32_t *map, int lun)
|
|
|
|
|
{
|
2001-02-06 12:49:33 +00:00
|
|
|
|
return (*map & (1 << lun));
|
2001-02-06 12:41:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
void
|
|
|
|
|
ata_free_lun(u_int32_t *map, int lun)
|
|
|
|
|
{
|
|
|
|
|
*map &= ~(1 << lun);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
ata_printf(struct ata_softc *scp, int device, const char * fmt, ...)
|
2000-02-18 20:57:33 +00:00
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
if (device == -1)
|
|
|
|
|
ret = printf("ata%d: ", device_get_unit(scp->dev));
|
2001-03-15 15:36:25 +00:00
|
|
|
|
else {
|
|
|
|
|
if (scp->dev_name[ATA_DEV(device)])
|
|
|
|
|
ret = printf("%s: ", scp->dev_name[ATA_DEV(device)]);
|
|
|
|
|
else
|
|
|
|
|
ret = printf("ata%d-%s: ", device_get_unit(scp->dev),
|
|
|
|
|
(device == ATA_MASTER) ? "master" : "slave");
|
|
|
|
|
}
|
2000-02-18 20:57:33 +00:00
|
|
|
|
va_start(ap, fmt);
|
|
|
|
|
ret += vprintf(fmt, ap);
|
|
|
|
|
va_end(ap);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
char *
|
|
|
|
|
ata_mode2str(int mode)
|
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
|
|
|
|
{
|
|
|
|
|
switch (mode) {
|
2000-01-27 19:00:51 +00:00
|
|
|
|
case ATA_PIO: return "BIOSPIO";
|
2000-01-03 10:26:59 +00:00
|
|
|
|
case ATA_PIO0: return "PIO0";
|
|
|
|
|
case ATA_PIO1: return "PIO1";
|
|
|
|
|
case ATA_PIO2: return "PIO2";
|
|
|
|
|
case ATA_PIO3: return "PIO3";
|
|
|
|
|
case ATA_PIO4: return "PIO4";
|
|
|
|
|
case ATA_WDMA2: return "WDMA2";
|
|
|
|
|
case ATA_UDMA2: return "UDMA33";
|
|
|
|
|
case ATA_UDMA4: return "UDMA66";
|
2000-08-06 19:51:58 +00:00
|
|
|
|
case ATA_UDMA5: return "UDMA100";
|
2000-01-27 19:00:51 +00:00
|
|
|
|
case ATA_DMA: return "BIOSDMA";
|
2000-01-03 10:26:59 +00:00
|
|
|
|
default: return "???";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int
|
|
|
|
|
ata_pio2mode(int pio)
|
2000-01-03 10:26:59 +00:00
|
|
|
|
{
|
|
|
|
|
switch (pio) {
|
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
|
|
|
|
default:
|
2000-01-03 10:26:59 +00:00
|
|
|
|
case 0: return ATA_PIO0;
|
|
|
|
|
case 1: return ATA_PIO1;
|
|
|
|
|
case 2: return ATA_PIO2;
|
|
|
|
|
case 3: return ATA_PIO3;
|
|
|
|
|
case 4: return ATA_PIO4;
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
int
|
|
|
|
|
ata_pmode(struct ata_params *ap)
|
|
|
|
|
{
|
|
|
|
|
if (ap->atavalid & ATA_FLAG_64_70) {
|
|
|
|
|
if (ap->apiomodes & 2)
|
|
|
|
|
return 4;
|
|
|
|
|
if (ap->apiomodes & 1)
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
if (ap->opiomode == 2)
|
|
|
|
|
return 2;
|
|
|
|
|
if (ap->opiomode == 1)
|
|
|
|
|
return 1;
|
|
|
|
|
if (ap->opiomode == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
ata_wmode(struct ata_params *ap)
|
|
|
|
|
{
|
|
|
|
|
if (ap->wdmamodes & 4)
|
|
|
|
|
return 2;
|
|
|
|
|
if (ap->wdmamodes & 2)
|
|
|
|
|
return 1;
|
|
|
|
|
if (ap->wdmamodes & 1)
|
|
|
|
|
return 0;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
ata_umode(struct ata_params *ap)
|
|
|
|
|
{
|
|
|
|
|
if (ap->atavalid & ATA_FLAG_88) {
|
2000-08-06 19:51:58 +00:00
|
|
|
|
if (ap->udmamodes & 0x20)
|
|
|
|
|
return 5;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
if (ap->udmamodes & 0x10)
|
2000-05-23 19:05:56 +00:00
|
|
|
|
return 4;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
if (ap->udmamodes & 0x08)
|
2000-05-23 19:05:56 +00:00
|
|
|
|
return 3;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
if (ap->udmamodes & 0x04)
|
|
|
|
|
return 2;
|
|
|
|
|
if (ap->udmamodes & 0x02)
|
|
|
|
|
return 1;
|
|
|
|
|
if (ap->udmamodes & 0x01)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static char *
|
|
|
|
|
active2str(int active)
|
1999-10-09 19:57:13 +00:00
|
|
|
|
{
|
2001-03-19 08:04:54 +00:00
|
|
|
|
static char buf[64];
|
|
|
|
|
|
|
|
|
|
bzero(buf, sizeof(buf));
|
|
|
|
|
if (active & ATA_IDLE)
|
|
|
|
|
strcat(buf, "ATA_IDLE ");
|
|
|
|
|
if (active & ATA_IMMEDIATE)
|
|
|
|
|
strcat(buf, "ATA_IMMEDIATE ");
|
|
|
|
|
if (active & ATA_WAIT_INTR)
|
|
|
|
|
strcat(buf, "ATA_WAIT_INTR ");
|
|
|
|
|
if (active & ATA_WAIT_READY)
|
|
|
|
|
strcat(buf, "ATA_WAIT_READY ");
|
|
|
|
|
if (active & ATA_ACTIVE)
|
|
|
|
|
strcat(buf, "ATA_ACTIVE ");
|
|
|
|
|
if (active & ATA_ACTIVE_ATA)
|
|
|
|
|
strcat(buf, "ATA_ACTIVE_ATA ");
|
|
|
|
|
if (active & ATA_ACTIVE_ATAPI)
|
|
|
|
|
strcat(buf, "ATA_ACTIVE_ATAPI ");
|
|
|
|
|
if (active & ATA_CONTROL)
|
|
|
|
|
strcat(buf, "ATA_CONTROL ");
|
|
|
|
|
return buf;
|
1999-10-09 19:57:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-18 21:02:59 +00:00
|
|
|
|
static void
|
2000-09-19 11:08:39 +00:00
|
|
|
|
bswap(int8_t *buf, int len)
|
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
|
|
|
|
{
|
2000-02-18 20:57:33 +00:00
|
|
|
|
u_int16_t *ptr = (u_int16_t*)(buf + len);
|
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
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
while (--ptr >= (u_int16_t*)buf)
|
|
|
|
|
*ptr = ntohs(*ptr);
|
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
|
|
|
|
}
|
|
|
|
|
|
2000-01-18 21:02:59 +00:00
|
|
|
|
static void
|
2000-09-19 11:08:39 +00:00
|
|
|
|
btrim(int8_t *buf, int len)
|
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
|
|
|
|
{
|
2000-02-18 20:57:33 +00:00
|
|
|
|
int8_t *ptr;
|
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
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
for (ptr = buf; ptr < buf+len; ++ptr)
|
|
|
|
|
if (!*ptr)
|
|
|
|
|
*ptr = ' ';
|
|
|
|
|
for (ptr = buf + len - 1; ptr >= buf && *ptr == ' '; --ptr)
|
|
|
|
|
*ptr = 0;
|
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
|
|
|
|
}
|
|
|
|
|
|
2000-01-18 21:02:59 +00:00
|
|
|
|
static void
|
2000-09-19 11:08:39 +00:00
|
|
|
|
bpack(int8_t *src, int8_t *dst, int len)
|
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
|
|
|
|
{
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int i, j, blank;
|
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
|
|
|
|
|
2000-01-24 20:45:24 +00:00
|
|
|
|
for (i = j = blank = 0 ; i < len; i++) {
|
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
|
|
|
|
if (blank && src[i] == ' ') continue;
|
|
|
|
|
if (blank && src[i] != ' ') {
|
|
|
|
|
dst[j++] = src[i];
|
|
|
|
|
blank = 0;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
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
|
|
|
|
if (src[i] == ' ') {
|
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
|
|
|
|
blank = 1;
|
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
|
|
|
|
if (i == 0)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
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
|
|
|
|
dst[j++] = src[i];
|
|
|
|
|
}
|
2000-01-24 20:45:24 +00:00
|
|
|
|
if (j < len)
|
|
|
|
|
dst[j] = 0x00;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-27 19:00:51 +00:00
|
|
|
|
static void
|
2000-09-19 11:08:39 +00:00
|
|
|
|
ata_change_mode(struct ata_softc *scp, int device, int mode)
|
2000-01-27 19:00:51 +00:00
|
|
|
|
{
|
2001-03-15 15:36:25 +00:00
|
|
|
|
int umode, wmode, pmode;
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int s = splbio();
|
2000-01-27 19:00:51 +00:00
|
|
|
|
|
2001-01-14 19:36:20 +00:00
|
|
|
|
while (!atomic_cmpset_int(&scp->active, ATA_IDLE, ATA_ACTIVE))
|
2000-01-27 19:00:51 +00:00
|
|
|
|
tsleep((caddr_t)&s, PRIBIO, "atachm", hz/4);
|
2001-01-14 19:36:20 +00:00
|
|
|
|
|
2001-03-15 15:36:25 +00:00
|
|
|
|
umode = ata_umode(ATA_PARAM(scp, device));
|
|
|
|
|
wmode = ata_wmode(ATA_PARAM(scp, device));
|
|
|
|
|
pmode = ata_pmode(ATA_PARAM(scp, device));
|
|
|
|
|
|
|
|
|
|
switch (mode & ATA_DMA_MASK) {
|
|
|
|
|
case ATA_UDMA:
|
|
|
|
|
if ((mode & ATA_MODE_MASK) < umode)
|
|
|
|
|
umode = mode & ATA_MODE_MASK;
|
|
|
|
|
break;
|
|
|
|
|
case ATA_WDMA:
|
|
|
|
|
if ((mode & ATA_MODE_MASK) < wmode)
|
|
|
|
|
wmode = mode & ATA_MODE_MASK;
|
|
|
|
|
umode = -1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (((mode & ATA_MODE_MASK) - ATA_PIO0) < pmode)
|
|
|
|
|
pmode = (mode & ATA_MODE_MASK) - ATA_PIO0;
|
|
|
|
|
umode = -1;
|
|
|
|
|
wmode = -1;
|
|
|
|
|
}
|
|
|
|
|
ata_dmainit(scp, device, pmode, wmode, umode);
|
|
|
|
|
|
2000-01-27 19:00:51 +00:00
|
|
|
|
scp->active = ATA_IDLE;
|
|
|
|
|
ata_start(scp);
|
|
|
|
|
splx(s);
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
static void
|
|
|
|
|
ata_init(void)
|
|
|
|
|
{
|
2001-03-15 15:36:25 +00:00
|
|
|
|
/* register controlling device */
|
2001-03-19 11:55:13 +00:00
|
|
|
|
make_dev(&ata_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600, "ata");
|
2001-03-15 15:36:25 +00:00
|
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
|
/* register boot attach to be run when interrupts are enabled */
|
|
|
|
|
if (!(ata_delayed_attach = (struct intr_config_hook *)
|
2000-12-26 12:05:49 +00:00
|
|
|
|
malloc(sizeof(struct intr_config_hook),
|
|
|
|
|
M_TEMP, M_NOWAIT | M_ZERO))) {
|
2000-02-18 20:57:33 +00:00
|
|
|
|
printf("ata: malloc of delayed attach hook failed\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ata_delayed_attach->ich_func = (void*)ata_boot_attach;
|
|
|
|
|
if (config_intrhook_establish(ata_delayed_attach) != 0) {
|
|
|
|
|
printf("ata: config_intrhook_establish failed\n");
|
|
|
|
|
free(ata_delayed_attach, M_TEMP);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
SYSINIT(atadev, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_init, NULL)
|