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
|
|
|
/*-
|
2012-01-15 13:23:18 +00:00
|
|
|
* Copyright (c) 1998 - 2008 Sø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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-08-24 17:55:58 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
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>
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
#include <sys/module.h>
|
2003-08-24 09:22:26 +00:00
|
|
|
#include <sys/endian.h>
|
2003-10-10 11:00:06 +00:00
|
|
|
#include <sys/ctype.h>
|
2001-03-15 15:36:25 +00:00
|
|
|
#include <sys/conf.h>
|
1999-04-18 20:48:15 +00:00
|
|
|
#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>
|
2000-01-27 19:00:51 +00:00
|
|
|
#include <sys/sysctl.h>
|
2004-01-14 21:26:35 +00:00
|
|
|
#include <sys/sema.h>
|
2003-08-24 09:22:26 +00:00
|
|
|
#include <sys/taskqueue.h>
|
2004-01-14 21:26:35 +00:00
|
|
|
#include <vm/uma.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>
|
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>
|
2010-07-25 15:43:52 +00:00
|
|
|
#include <dev/pci/pcivar.h>
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
#include <ata_if.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
|
|
|
|
2009-12-06 00:10:13 +00:00
|
|
|
#include <cam/cam.h>
|
|
|
|
#include <cam/cam_ccb.h>
|
|
|
|
#include <cam/cam_sim.h>
|
|
|
|
#include <cam/cam_xpt_sim.h>
|
|
|
|
#include <cam/cam_debug.h>
|
2001-03-15 15:36:25 +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
|
|
|
/* prototypes */
|
2009-12-06 00:10:13 +00:00
|
|
|
static void ataaction(struct cam_sim *sim, union ccb *ccb);
|
|
|
|
static void atapoll(struct cam_sim *sim);
|
2009-02-21 22:57:26 +00:00
|
|
|
static void ata_conn_event(void *, int);
|
2009-12-06 00:10:13 +00:00
|
|
|
static void ata_interrupt_locked(void *data);
|
2010-10-18 11:30:13 +00:00
|
|
|
static void ata_periodic_poll(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
|
|
|
|
2003-11-11 14:55:36 +00:00
|
|
|
/* global vars */
|
2005-10-31 15:41:29 +00:00
|
|
|
MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer");
|
2005-05-16 13:07:27 +00:00
|
|
|
int (*ata_raid_ioctl_func)(u_long cmd, caddr_t data) = NULL;
|
2003-11-11 14:55:36 +00:00
|
|
|
devclass_t ata_devclass;
|
2008-04-17 12:29:35 +00:00
|
|
|
uma_zone_t ata_request_zone;
|
2008-08-15 10:55:11 +00:00
|
|
|
int ata_dma_check_80pin = 1;
|
2003-11-11 14:55:36 +00:00
|
|
|
|
2001-03-19 08:04:54 +00:00
|
|
|
/* sysctl vars */
|
2011-11-07 15:43:11 +00:00
|
|
|
static SYSCTL_NODE(_hw, OID_AUTO, ata, CTLFLAG_RD, 0, "ATA driver parameters");
|
2008-08-15 10:55:11 +00:00
|
|
|
TUNABLE_INT("hw.ata.ata_dma_check_80pin", &ata_dma_check_80pin);
|
|
|
|
SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma_check_80pin,
|
2010-07-10 13:46:14 +00:00
|
|
|
CTLFLAG_RW, &ata_dma_check_80pin, 1,
|
2008-08-15 10:55:11 +00:00
|
|
|
"Check for 80pin cable before setting ATA DMA mode");
|
Add a "kern.features.ata_cam" sysctl in the kernel when the ATA_CAM kernel
option is defined. This sysctl can be queried by feature_present(3).
Query for this feature in /sbin/atacontrol and /usr/sbin/burncd.
If these utilities detect that ATA_CAM is enabled, then these utilities
will error out. These utilities are compatible with the old ATA
driver, but are incomptible with the new ATA_CAM driver. By erroring out,
we give end-users an idea as to what remedies to use, and reduce the need for them
to file PR's. For atacontrol, camcontrol must be used instead,
and for burncd, alternative utilties from the ports collection must be used
such as sysutils/cdrtools.
In future, maybe someone can re-write burncd to work with ATA_CAM,
but at least for now, we give a somewhat useful error message to end users.
PR: 160979
Reviewed by: jh, Arnaud Lacombe <lacombar at gmail dot com>
Reported by: Joe Barbish <fbsd8 at a1poweruser dot com>
MFC after: 3 days
2011-10-09 21:42:02 +00:00
|
|
|
FEATURE(ata_cam, "ATA devices are accessed through the cam(4) driver");
|
Finally!!
The much roumored replacement for our current IDE/ATA/ATAPI is
materialising in the CVS repositories around the globe.
So what does this bring us:
A new reengineered ATA/ATAPI subsystem, that tries to overcome
most of the deficiencies with the current drivers.
It supports PCI as well as ISA devices without all the hackery
in ide_pci.c to make PCI devices look like ISA counterparts.
It doesn't have the excessive wait problem on probe, in fact you
shouldn't notice any delay when your devices are getting probed.
Probing and attaching of devices are postponed until interrupts
are enabled (well almost, not finished yet for disks), making
things alot cleaner.
Improved performance, although DMA support is still WIP and not
in this pre alpha release, worldstone is faster with the new
driver compared to the old even with DMA.
So what does it take away:
There is NO support for old MFM/RLL/ESDI disks.
There is NO support for bad144, if your disk is bad, ditch it, it has
already outgrown its internal spare sectors, and is dying.
For you to try this out, you will have to modify your kernel config
file to use the "ata" controller instead of all wdc? entries.
example:
# for a PCI only system (most modern machines)
controller ata0
device atadisk0 # ATA disks
device atapicd0 # ATAPI CDROM's
device atapist0 # ATAPI tapes
#You should add the following on ISA systems:
controller ata1 at isa? port "IO_WD1" bio irq 14
controller ata2 at isa? port "IO_WD2" bio irq 15
You can leave it all in there, the system knows how to manage.
For now this driver reuses the device entries from the old system
(that will probably change later), but remember that disks are
now numbered in the sequence they are found (like the SCSI system)
not as absolute positions as the old system.
Although I have tested this on all the systems I can get my hands on,
there might very well be gremlins in there, so use AT YOU OWN RISK!!
This is still WIP, so there are lots of rough edges and unfinished
things in there, and what I have in my lab might look very different
from whats in CVS at any given time. So please have all eventual
changes go through me, or chances are they just dissapears...
I would very much like to hear from you, both good and bad news
are very welcome.
Enjoy!!
-Søren
1999-03-01 21:19:19 +00:00
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
/*
|
|
|
|
* newbus device interface related functions
|
|
|
|
*/
|
2000-09-19 11:08:39 +00:00
|
|
|
int
|
2000-02-18 20:57:33 +00:00
|
|
|
ata_probe(device_t dev)
|
|
|
|
{
|
2004-08-12 08:20:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ata_attach(device_t dev)
|
|
|
|
{
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
2004-08-12 08:20:36 +00:00
|
|
|
int error, rid;
|
2009-12-06 00:10:13 +00:00
|
|
|
struct cam_devq *devq;
|
2010-07-03 14:14:42 +00:00
|
|
|
const char *res;
|
|
|
|
char buf[64];
|
|
|
|
int i, mode;
|
2004-08-12 08:20:36 +00:00
|
|
|
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
/* check that we have a virgin channel to attach */
|
|
|
|
if (ch->r_irq)
|
|
|
|
return EEXIST;
|
2004-08-12 08:20:36 +00:00
|
|
|
|
2000-02-18 20:57:33 +00:00
|
|
|
/* initialize the softc basics */
|
2003-08-24 09:22:26 +00:00
|
|
|
ch->dev = dev;
|
2004-09-26 11:48:43 +00:00
|
|
|
ch->state = ATA_IDLE;
|
|
|
|
bzero(&ch->state_mtx, sizeof(struct mtx));
|
|
|
|
mtx_init(&ch->state_mtx, "ATA state lock", NULL, MTX_DEF);
|
2009-02-21 22:57:26 +00:00
|
|
|
TASK_INIT(&ch->conntask, 0, ata_conn_event, dev);
|
2009-12-06 00:10:13 +00:00
|
|
|
for (i = 0; i < 16; i++) {
|
2012-10-02 22:03:21 +00:00
|
|
|
ch->user[i].revision = 0;
|
|
|
|
snprintf(buf, sizeof(buf), "dev%d.sata_rev", i);
|
|
|
|
if (resource_int_value(device_get_name(dev),
|
|
|
|
device_get_unit(dev), buf, &mode) != 0 &&
|
|
|
|
resource_int_value(device_get_name(dev),
|
|
|
|
device_get_unit(dev), "sata_rev", &mode) != 0)
|
|
|
|
mode = -1;
|
|
|
|
if (mode >= 0)
|
|
|
|
ch->user[i].revision = mode;
|
2009-12-06 00:10:13 +00:00
|
|
|
ch->user[i].mode = 0;
|
2010-07-03 14:14:42 +00:00
|
|
|
snprintf(buf, sizeof(buf), "dev%d.mode", i);
|
|
|
|
if (resource_string_value(device_get_name(dev),
|
|
|
|
device_get_unit(dev), buf, &res) == 0)
|
|
|
|
mode = ata_str2mode(res);
|
|
|
|
else if (resource_string_value(device_get_name(dev),
|
|
|
|
device_get_unit(dev), "mode", &res) == 0)
|
|
|
|
mode = ata_str2mode(res);
|
|
|
|
else
|
|
|
|
mode = -1;
|
|
|
|
if (mode >= 0)
|
|
|
|
ch->user[i].mode = mode;
|
2009-12-06 00:10:13 +00:00
|
|
|
if (ch->flags & ATA_SATA)
|
|
|
|
ch->user[i].bytecount = 8192;
|
|
|
|
else
|
|
|
|
ch->user[i].bytecount = MAXPHYS;
|
2010-11-18 19:28:45 +00:00
|
|
|
ch->user[i].caps = 0;
|
2009-12-06 00:10:13 +00:00
|
|
|
ch->curr[i] = ch->user[i];
|
2013-04-06 13:39:02 +00:00
|
|
|
if (ch->flags & ATA_SATA) {
|
|
|
|
if (ch->pm_level > 0)
|
|
|
|
ch->user[i].caps |= CTS_SATA_CAPS_H_PMREQ;
|
|
|
|
if (ch->pm_level > 1)
|
|
|
|
ch->user[i].caps |= CTS_SATA_CAPS_D_PMREQ;
|
|
|
|
} else {
|
|
|
|
if (!(ch->flags & ATA_NO_48BIT_DMA))
|
|
|
|
ch->user[i].caps |= CTS_ATA_CAPS_H_DMA48;
|
|
|
|
}
|
2009-12-06 00:10:13 +00:00
|
|
|
}
|
2010-10-18 11:30:13 +00:00
|
|
|
callout_init(&ch->poll_callout, 1);
|
2000-02-18 20:57:33 +00:00
|
|
|
|
2008-06-11 06:44:58 +00:00
|
|
|
/* allocate DMA resources if DMA HW present*/
|
|
|
|
if (ch->dma.alloc)
|
|
|
|
ch->dma.alloc(dev);
|
|
|
|
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
/* setup interrupt delivery */
|
2001-02-06 16:44:25 +00:00
|
|
|
rid = ATA_IRQ_RID;
|
2004-03-17 17:50:55 +00:00
|
|
|
ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
|
|
|
|
RF_SHAREABLE | RF_ACTIVE);
|
Major update of the ATA RAID code, part 1:
Overhaul of the attach/detach code and structures, there were some nasty
bugs in the old implementation. This made it possible to collapse the
ATA/ATAPI device control structures into one generic structure.
A note here, the kernel is NOT ready for detach of active devices,
it fails all over in random places, but for inactive devices it works.
However for ATA RAID this works, since the RAID abstration layer
insulates the buggy^H^H^H^H^H^Hfragile device subsystem from the
physical disks.
Proberly detect the RAID's from the BIOS, and mark critical RAID1
arrays as such, but continue if there is enough of the mirror left
to do so.
Properly fail arrays on a live system. For RAID0 that means return EIO,
and for RAID1 it means continue on the still working part of the mirror
if possible, else return EIO.
If the state changes, log this to the console.
Allow for Promise & Highpoint controllers/arrays to coexist on the
same machine. It is not possible to distribute arrays over different
makes of controllers though.
If Promise SuperSwap enclosures are used, signal disk state on the
status LED on the front.
Misc fixes that I had lying around for various minor bugs.
Sponsored by: Advanis Inc.
2002-02-04 19:23:40 +00:00
|
|
|
if (!ch->r_irq) {
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
device_printf(dev, "unable to allocate interrupt\n");
|
2000-02-18 20:57:33 +00:00
|
|
|
return ENXIO;
|
|
|
|
}
|
2007-02-23 12:19:07 +00:00
|
|
|
if ((error = bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL,
|
2009-02-17 21:17:21 +00:00
|
|
|
ata_interrupt, ch, &ch->ih))) {
|
2010-07-12 12:16:11 +00:00
|
|
|
bus_release_resource(dev, SYS_RES_IRQ, rid, ch->r_irq);
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
device_printf(dev, "unable to setup interrupt\n");
|
2010-07-12 12:16:11 +00:00
|
|
|
return error;
|
2002-03-03 15:36:21 +00:00
|
|
|
}
|
2000-01-18 21:02:59 +00:00
|
|
|
|
2011-04-21 09:02:19 +00:00
|
|
|
if (ch->flags & ATA_PERIODIC_POLL)
|
|
|
|
callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
|
2010-07-12 12:16:11 +00:00
|
|
|
mtx_lock(&ch->state_mtx);
|
2009-12-06 00:10:13 +00:00
|
|
|
/* Create the device queue for our SIM. */
|
|
|
|
devq = cam_simq_alloc(1);
|
|
|
|
if (devq == NULL) {
|
|
|
|
device_printf(dev, "Unable to allocate simq\n");
|
|
|
|
error = ENOMEM;
|
|
|
|
goto err1;
|
|
|
|
}
|
|
|
|
/* Construct SIM entry */
|
|
|
|
ch->sim = cam_sim_alloc(ataaction, atapoll, "ata", ch,
|
|
|
|
device_get_unit(dev), &ch->state_mtx, 1, 0, devq);
|
|
|
|
if (ch->sim == NULL) {
|
|
|
|
device_printf(dev, "unable to allocate sim\n");
|
2010-07-12 12:16:11 +00:00
|
|
|
cam_simq_free(devq);
|
2009-12-06 00:10:13 +00:00
|
|
|
error = ENOMEM;
|
2010-07-12 12:16:11 +00:00
|
|
|
goto err1;
|
2009-12-06 00:10:13 +00:00
|
|
|
}
|
|
|
|
if (xpt_bus_register(ch->sim, dev, 0) != CAM_SUCCESS) {
|
|
|
|
device_printf(dev, "unable to register xpt bus\n");
|
|
|
|
error = ENXIO;
|
|
|
|
goto err2;
|
|
|
|
}
|
|
|
|
if (xpt_create_path(&ch->path, /*periph*/NULL, cam_sim_path(ch->sim),
|
|
|
|
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
|
|
|
|
device_printf(dev, "unable to create path\n");
|
|
|
|
error = ENXIO;
|
|
|
|
goto err3;
|
|
|
|
}
|
|
|
|
mtx_unlock(&ch->state_mtx);
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
err3:
|
|
|
|
xpt_bus_deregister(cam_sim_path(ch->sim));
|
|
|
|
err2:
|
|
|
|
cam_sim_free(ch->sim, /*free_devq*/TRUE);
|
2010-07-12 12:16:11 +00:00
|
|
|
ch->sim = NULL;
|
2009-12-06 00:10:13 +00:00
|
|
|
err1:
|
2010-07-12 12:16:11 +00:00
|
|
|
bus_release_resource(dev, SYS_RES_IRQ, rid, ch->r_irq);
|
2009-12-06 00:10:13 +00:00
|
|
|
mtx_unlock(&ch->state_mtx);
|
2010-10-18 11:30:13 +00:00
|
|
|
if (ch->flags & ATA_PERIODIC_POLL)
|
|
|
|
callout_drain(&ch->poll_callout);
|
2009-12-06 00:10:13 +00:00
|
|
|
return (error);
|
2000-02-18 20:57:33 +00:00
|
|
|
}
|
|
|
|
|
2001-03-06 21:43:46 +00:00
|
|
|
int
|
2000-02-18 20:57:33 +00:00
|
|
|
ata_detach(device_t dev)
|
|
|
|
{
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
2004-05-20 14:49:12 +00:00
|
|
|
|
2005-09-14 12:45:06 +00:00
|
|
|
/* check that we have a valid channel to detach */
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
if (!ch->r_irq)
|
2000-02-18 20:57:33 +00:00
|
|
|
return ENXIO;
|
2000-01-18 21:02:59 +00:00
|
|
|
|
2006-02-25 17:27:33 +00:00
|
|
|
/* grap the channel lock so no new requests gets launched */
|
|
|
|
mtx_lock(&ch->state_mtx);
|
|
|
|
ch->state |= ATA_STALL_QUEUE;
|
|
|
|
mtx_unlock(&ch->state_mtx);
|
2010-10-18 11:30:13 +00:00
|
|
|
if (ch->flags & ATA_PERIODIC_POLL)
|
|
|
|
callout_drain(&ch->poll_callout);
|
2013-04-04 07:12:24 +00:00
|
|
|
|
2009-02-21 22:57:26 +00:00
|
|
|
taskqueue_drain(taskqueue_thread, &ch->conntask);
|
2004-07-12 10:50:50 +00:00
|
|
|
|
2009-12-06 00:10:13 +00:00
|
|
|
mtx_lock(&ch->state_mtx);
|
|
|
|
xpt_async(AC_LOST_DEVICE, ch->path, NULL);
|
|
|
|
xpt_free_path(ch->path);
|
|
|
|
xpt_bus_deregister(cam_sim_path(ch->sim));
|
|
|
|
cam_sim_free(ch->sim, /*free_devq*/TRUE);
|
2010-07-12 12:16:11 +00:00
|
|
|
ch->sim = NULL;
|
2009-12-06 00:10:13 +00:00
|
|
|
mtx_unlock(&ch->state_mtx);
|
|
|
|
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
/* release resources */
|
Major update of the ATA RAID code, part 1:
Overhaul of the attach/detach code and structures, there were some nasty
bugs in the old implementation. This made it possible to collapse the
ATA/ATAPI device control structures into one generic structure.
A note here, the kernel is NOT ready for detach of active devices,
it fails all over in random places, but for inactive devices it works.
However for ATA RAID this works, since the RAID abstration layer
insulates the buggy^H^H^H^H^H^Hfragile device subsystem from the
physical disks.
Proberly detect the RAID's from the BIOS, and mark critical RAID1
arrays as such, but continue if there is enough of the mirror left
to do so.
Properly fail arrays on a live system. For RAID0 that means return EIO,
and for RAID1 it means continue on the still working part of the mirror
if possible, else return EIO.
If the state changes, log this to the console.
Allow for Promise & Highpoint controllers/arrays to coexist on the
same machine. It is not possible to distribute arrays over different
makes of controllers though.
If Promise SuperSwap enclosures are used, signal disk state on the
status LED on the front.
Misc fixes that I had lying around for various minor bugs.
Sponsored by: Advanis Inc.
2002-02-04 19:23:40 +00:00
|
|
|
bus_teardown_intr(dev, ch->r_irq, ch->ih);
|
|
|
|
bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq);
|
|
|
|
ch->r_irq = NULL;
|
2009-02-18 21:12:48 +00:00
|
|
|
|
|
|
|
/* free DMA resources if DMA HW present*/
|
|
|
|
if (ch->dma.free)
|
|
|
|
ch->dma.free(dev);
|
|
|
|
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
mtx_destroy(&ch->state_mtx);
|
2003-08-24 09:22:26 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-02-21 22:57:26 +00:00
|
|
|
static void
|
|
|
|
ata_conn_event(void *context, int dummy)
|
|
|
|
{
|
MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
|
|
|
device_t dev = (device_t)context;
|
2010-02-23 16:39:53 +00:00
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
|
|
|
union ccb *ccb;
|
2009-02-21 22:57:26 +00:00
|
|
|
|
MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
|
|
|
mtx_lock(&ch->state_mtx);
|
2010-07-12 12:16:11 +00:00
|
|
|
if (ch->sim == NULL) {
|
|
|
|
mtx_unlock(&ch->state_mtx);
|
|
|
|
return;
|
|
|
|
}
|
MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
|
|
|
ata_reinit(dev);
|
2010-07-12 12:16:11 +00:00
|
|
|
if ((ccb = xpt_alloc_ccb_nowait()) == NULL)
|
MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
|
|
|
return;
|
|
|
|
if (xpt_create_path(&ccb->ccb_h.path, NULL,
|
|
|
|
cam_sim_path(ch->sim),
|
|
|
|
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
|
|
|
|
xpt_free_ccb(ccb);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
xpt_rescan(ccb);
|
2010-07-12 12:16:11 +00:00
|
|
|
mtx_unlock(&ch->state_mtx);
|
2009-02-21 22:57:26 +00:00
|
|
|
}
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
int
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
ata_reinit(device_t dev)
|
2003-08-24 09:22:26 +00:00
|
|
|
{
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
2005-09-14 12:45:06 +00:00
|
|
|
struct ata_request *request;
|
2004-09-26 11:48:43 +00:00
|
|
|
|
MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
|
|
|
xpt_freeze_simq(ch->sim, 1);
|
2009-12-06 00:10:13 +00:00
|
|
|
if ((request = ch->running)) {
|
|
|
|
ch->running = NULL;
|
|
|
|
if (ch->state == ATA_ACTIVE)
|
|
|
|
ch->state = ATA_IDLE;
|
|
|
|
callout_stop(&request->callout);
|
|
|
|
if (ch->dma.unload)
|
|
|
|
ch->dma.unload(request);
|
|
|
|
request->result = ERESTART;
|
|
|
|
ata_cam_end_transaction(dev, request);
|
|
|
|
}
|
|
|
|
/* reset the controller HW, the channel and device(s) */
|
|
|
|
ATA_RESET(dev);
|
|
|
|
/* Tell the XPT about the event */
|
|
|
|
xpt_async(AC_BUS_RESET, ch->path, NULL);
|
MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
|
|
|
xpt_release_simq(ch->sim, TRUE);
|
2009-12-06 00:10:13 +00:00
|
|
|
return(0);
|
2000-02-18 20:57:33 +00:00
|
|
|
}
|
|
|
|
|
2003-05-04 09:34:14 +00:00
|
|
|
int
|
|
|
|
ata_suspend(device_t dev)
|
|
|
|
{
|
|
|
|
struct ata_channel *ch;
|
|
|
|
|
2005-04-21 11:13:39 +00:00
|
|
|
/* check for valid device */
|
2003-05-04 09:34:14 +00:00
|
|
|
if (!dev || !(ch = device_get_softc(dev)))
|
|
|
|
return ENXIO;
|
2004-08-12 08:20:36 +00:00
|
|
|
|
2011-04-21 09:02:19 +00:00
|
|
|
if (ch->flags & ATA_PERIODIC_POLL)
|
|
|
|
callout_drain(&ch->poll_callout);
|
2010-05-21 13:29:28 +00:00
|
|
|
mtx_lock(&ch->state_mtx);
|
|
|
|
xpt_freeze_simq(ch->sim, 1);
|
|
|
|
while (ch->state != ATA_IDLE)
|
|
|
|
msleep(ch, &ch->state_mtx, PRIBIO, "atasusp", hz/100);
|
|
|
|
mtx_unlock(&ch->state_mtx);
|
2009-12-06 00:10:13 +00:00
|
|
|
return(0);
|
2003-05-04 09:34:14 +00:00
|
|
|
}
|
|
|
|
|
2001-03-06 21:43:46 +00:00
|
|
|
int
|
2000-02-18 20:57:33 +00:00
|
|
|
ata_resume(device_t dev)
|
|
|
|
{
|
2010-05-21 13:29:28 +00:00
|
|
|
struct ata_channel *ch;
|
2002-12-03 20:20:44 +00:00
|
|
|
int error;
|
|
|
|
|
2005-04-21 11:13:39 +00:00
|
|
|
/* check for valid device */
|
2010-05-21 13:29:28 +00:00
|
|
|
if (!dev || !(ch = device_get_softc(dev)))
|
2002-12-03 20:20:44 +00:00
|
|
|
return ENXIO;
|
|
|
|
|
2010-05-21 13:29:28 +00:00
|
|
|
mtx_lock(&ch->state_mtx);
|
|
|
|
error = ata_reinit(dev);
|
|
|
|
xpt_release_simq(ch->sim, TRUE);
|
|
|
|
mtx_unlock(&ch->state_mtx);
|
2011-04-21 09:02:19 +00:00
|
|
|
if (ch->flags & ATA_PERIODIC_POLL)
|
|
|
|
callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
return error;
|
2003-08-24 09:22:26 +00:00
|
|
|
}
|
2003-03-22 12:18:20 +00:00
|
|
|
|
2009-02-17 21:17:21 +00:00
|
|
|
void
|
2004-09-26 11:48:43 +00:00
|
|
|
ata_interrupt(void *data)
|
2009-12-06 00:10:13 +00:00
|
|
|
{
|
|
|
|
struct ata_channel *ch = (struct ata_channel *)data;
|
|
|
|
|
|
|
|
mtx_lock(&ch->state_mtx);
|
2012-05-12 13:55:36 +00:00
|
|
|
xpt_batch_start(ch->sim);
|
2009-12-06 00:10:13 +00:00
|
|
|
ata_interrupt_locked(data);
|
2012-05-12 13:55:36 +00:00
|
|
|
xpt_batch_done(ch->sim);
|
2009-12-06 00:10:13 +00:00
|
|
|
mtx_unlock(&ch->state_mtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ata_interrupt_locked(void *data)
|
2004-09-26 11:48:43 +00:00
|
|
|
{
|
|
|
|
struct ata_channel *ch = (struct ata_channel *)data;
|
2004-10-13 15:16:35 +00:00
|
|
|
struct ata_request *request;
|
2004-09-26 11:48:43 +00:00
|
|
|
|
2004-10-13 15:16:35 +00:00
|
|
|
do {
|
2006-01-18 09:14:55 +00:00
|
|
|
/* ignore interrupt if its not for us */
|
|
|
|
if (ch->hw.status && !ch->hw.status(ch->dev))
|
|
|
|
break;
|
|
|
|
|
2004-10-13 15:16:35 +00:00
|
|
|
/* do we have a running request */
|
2005-09-14 12:45:06 +00:00
|
|
|
if (!(request = ch->running))
|
2004-10-13 15:16:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
ATA_DEBUG_RQ(request, "interrupt");
|
|
|
|
|
2006-01-18 09:14:55 +00:00
|
|
|
/* safetycheck for the right state */
|
2006-02-25 17:27:33 +00:00
|
|
|
if (ch->state == ATA_IDLE) {
|
2005-09-14 12:45:06 +00:00
|
|
|
device_printf(request->dev, "interrupt on idle channel ignored\n");
|
2004-10-13 15:16:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
/*
|
2006-03-09 10:24:03 +00:00
|
|
|
* we have the HW locks, so end the transaction for this request
|
2005-04-21 11:13:39 +00:00
|
|
|
* if it finishes immediately otherwise wait for next interrupt
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
*/
|
2004-10-13 15:16:35 +00:00
|
|
|
if (ch->hw.end_transaction(request) == ATA_OP_FINISHED) {
|
2004-09-26 11:48:43 +00:00
|
|
|
ch->running = NULL;
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
if (ch->state == ATA_ACTIVE)
|
2004-09-26 11:48:43 +00:00
|
|
|
ch->state = ATA_IDLE;
|
2009-12-06 00:10:13 +00:00
|
|
|
ata_cam_end_transaction(ch->dev, request);
|
2009-02-17 21:17:21 +00:00
|
|
|
return;
|
2004-09-26 11:48:43 +00:00
|
|
|
}
|
2004-10-13 15:16:35 +00:00
|
|
|
} while (0);
|
2009-12-06 00:10:13 +00:00
|
|
|
}
|
|
|
|
|
2010-10-18 11:30:13 +00:00
|
|
|
static void
|
|
|
|
ata_periodic_poll(void *data)
|
|
|
|
{
|
|
|
|
struct ata_channel *ch = (struct ata_channel *)data;
|
|
|
|
|
|
|
|
callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch);
|
|
|
|
ata_interrupt(ch);
|
|
|
|
}
|
|
|
|
|
2009-12-06 00:10:13 +00:00
|
|
|
void
|
|
|
|
ata_print_cable(device_t dev, u_int8_t *who)
|
|
|
|
{
|
|
|
|
device_printf(dev,
|
|
|
|
"DMA limited to UDMA33, %s found non-ATA66 cable\n", who);
|
|
|
|
}
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
/*
|
|
|
|
* misc support functions
|
|
|
|
*/
|
2005-04-06 10:22:56 +00:00
|
|
|
void
|
2005-04-30 16:22:07 +00:00
|
|
|
ata_default_registers(device_t dev)
|
2005-04-06 10:22:56 +00:00
|
|
|
{
|
2005-04-30 16:22:07 +00:00
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
|
|
|
|
2005-04-06 10:22:56 +00:00
|
|
|
/* fill in the defaults from whats setup already */
|
|
|
|
ch->r_io[ATA_ERROR].res = ch->r_io[ATA_FEATURE].res;
|
|
|
|
ch->r_io[ATA_ERROR].offset = ch->r_io[ATA_FEATURE].offset;
|
|
|
|
ch->r_io[ATA_IREASON].res = ch->r_io[ATA_COUNT].res;
|
|
|
|
ch->r_io[ATA_IREASON].offset = ch->r_io[ATA_COUNT].offset;
|
|
|
|
ch->r_io[ATA_STATUS].res = ch->r_io[ATA_COMMAND].res;
|
|
|
|
ch->r_io[ATA_STATUS].offset = ch->r_io[ATA_COMMAND].offset;
|
|
|
|
ch->r_io[ATA_ALTSTAT].res = ch->r_io[ATA_CONTROL].res;
|
|
|
|
ch->r_io[ATA_ALTSTAT].offset = ch->r_io[ATA_CONTROL].offset;
|
|
|
|
}
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
void
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
ata_udelay(int interval)
|
2000-09-19 11:08:39 +00:00
|
|
|
{
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
/* for now just use DELAY, the timer/sleep subsytems are not there yet */
|
|
|
|
if (1 || interval < (1000000/hz) || ata_delayed_attach)
|
|
|
|
DELAY(interval);
|
|
|
|
else
|
2007-02-23 16:25:08 +00:00
|
|
|
pause("ataslp", interval/(1000000/hz));
|
2000-09-19 11:08:39 +00:00
|
|
|
}
|
2004-05-20 14:49:12 +00:00
|
|
|
|
2009-12-06 00:10:13 +00:00
|
|
|
const char *
|
2000-09-19 11:08:39 +00:00
|
|
|
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) {
|
2005-08-29 18:19:06 +00:00
|
|
|
case -1: return "UNSUPPORTED";
|
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";
|
2003-02-20 20:02:32 +00:00
|
|
|
case ATA_WDMA0: return "WDMA0";
|
|
|
|
case ATA_WDMA1: return "WDMA1";
|
2000-01-03 10:26:59 +00:00
|
|
|
case ATA_WDMA2: return "WDMA2";
|
2003-02-20 20:02:32 +00:00
|
|
|
case ATA_UDMA0: return "UDMA16";
|
|
|
|
case ATA_UDMA1: return "UDMA25";
|
2000-01-03 10:26:59 +00:00
|
|
|
case ATA_UDMA2: return "UDMA33";
|
2003-02-20 20:02:32 +00:00
|
|
|
case ATA_UDMA3: return "UDMA40";
|
2000-01-03 10:26:59 +00:00
|
|
|
case ATA_UDMA4: return "UDMA66";
|
2000-08-06 19:51:58 +00:00
|
|
|
case ATA_UDMA5: return "UDMA100";
|
2001-10-06 11:07:04 +00:00
|
|
|
case ATA_UDMA6: return "UDMA133";
|
2003-05-18 16:43:08 +00:00
|
|
|
case ATA_SA150: return "SATA150";
|
2005-08-12 16:54:11 +00:00
|
|
|
case ATA_SA300: return "SATA300";
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
default:
|
|
|
|
if (mode & ATA_DMA_MASK)
|
|
|
|
return "BIOSDMA";
|
|
|
|
else
|
|
|
|
return "BIOSPIO";
|
2000-01-03 10:26:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-03 14:14:42 +00:00
|
|
|
int
|
|
|
|
ata_str2mode(const char *str)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!strcasecmp(str, "PIO0")) return (ATA_PIO0);
|
|
|
|
if (!strcasecmp(str, "PIO1")) return (ATA_PIO1);
|
|
|
|
if (!strcasecmp(str, "PIO2")) return (ATA_PIO2);
|
|
|
|
if (!strcasecmp(str, "PIO3")) return (ATA_PIO3);
|
|
|
|
if (!strcasecmp(str, "PIO4")) return (ATA_PIO4);
|
|
|
|
if (!strcasecmp(str, "WDMA0")) return (ATA_WDMA0);
|
|
|
|
if (!strcasecmp(str, "WDMA1")) return (ATA_WDMA1);
|
|
|
|
if (!strcasecmp(str, "WDMA2")) return (ATA_WDMA2);
|
|
|
|
if (!strcasecmp(str, "UDMA0")) return (ATA_UDMA0);
|
|
|
|
if (!strcasecmp(str, "UDMA16")) return (ATA_UDMA0);
|
|
|
|
if (!strcasecmp(str, "UDMA1")) return (ATA_UDMA1);
|
|
|
|
if (!strcasecmp(str, "UDMA25")) return (ATA_UDMA1);
|
|
|
|
if (!strcasecmp(str, "UDMA2")) return (ATA_UDMA2);
|
|
|
|
if (!strcasecmp(str, "UDMA33")) return (ATA_UDMA2);
|
|
|
|
if (!strcasecmp(str, "UDMA3")) return (ATA_UDMA3);
|
|
|
|
if (!strcasecmp(str, "UDMA44")) return (ATA_UDMA3);
|
|
|
|
if (!strcasecmp(str, "UDMA4")) return (ATA_UDMA4);
|
|
|
|
if (!strcasecmp(str, "UDMA66")) return (ATA_UDMA4);
|
|
|
|
if (!strcasecmp(str, "UDMA5")) return (ATA_UDMA5);
|
|
|
|
if (!strcasecmp(str, "UDMA100")) return (ATA_UDMA5);
|
|
|
|
if (!strcasecmp(str, "UDMA6")) return (ATA_UDMA6);
|
|
|
|
if (!strcasecmp(str, "UDMA133")) return (ATA_UDMA6);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
This is the roumored ATA modulerisation works, and it needs a little explanation.
If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in.
However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries:
atacore: ATA core functionality, always needed for any ATA setup
atacard: CARDBUS support
atacbus: PC98 cbus support
ataisa: ISA bus support
atapci: PCI bus support only generic chipset support.
ataahci: AHCI support, also pulled in by some vendor modules.
ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia; Vendor support, ie atavia for VIA chipsets
atadisk: ATA disk driver
ataraid: ATA softraid driver
atapicd: ATAPI cd/dvd driver
atapifd: ATAPI floppy/flashdisk driver
atapist: ATAPI tape driver
atausb: ATA<>USB bridge
atapicam: ATA<>CAM bridge
This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file:
device atacore
device atapci
device atavia
And then you need the atadisk, atapicd etc lines in there just as usual.
If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual.
However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above.
2008-10-09 12:56:57 +00:00
|
|
|
int
|
2009-12-13 00:13:21 +00:00
|
|
|
ata_atapi(device_t dev, int target)
|
This is the roumored ATA modulerisation works, and it needs a little explanation.
If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in.
However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries:
atacore: ATA core functionality, always needed for any ATA setup
atacard: CARDBUS support
atacbus: PC98 cbus support
ataisa: ISA bus support
atapci: PCI bus support only generic chipset support.
ataahci: AHCI support, also pulled in by some vendor modules.
ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia; Vendor support, ie atavia for VIA chipsets
atadisk: ATA disk driver
ataraid: ATA softraid driver
atapicd: ATAPI cd/dvd driver
atapifd: ATAPI floppy/flashdisk driver
atapist: ATAPI tape driver
atausb: ATA<>USB bridge
atapicam: ATA<>CAM bridge
This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file:
device atacore
device atapci
device atavia
And then you need the atadisk, atapicd etc lines in there just as usual.
If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual.
However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above.
2008-10-09 12:56:57 +00:00
|
|
|
{
|
2009-12-13 00:13:21 +00:00
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
This is the roumored ATA modulerisation works, and it needs a little explanation.
If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in.
However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries:
atacore: ATA core functionality, always needed for any ATA setup
atacard: CARDBUS support
atacbus: PC98 cbus support
ataisa: ISA bus support
atapci: PCI bus support only generic chipset support.
ataahci: AHCI support, also pulled in by some vendor modules.
ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia; Vendor support, ie atavia for VIA chipsets
atadisk: ATA disk driver
ataraid: ATA softraid driver
atapicd: ATAPI cd/dvd driver
atapifd: ATAPI floppy/flashdisk driver
atapist: ATAPI tape driver
atausb: ATA<>USB bridge
atapicam: ATA<>CAM bridge
This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file:
device atacore
device atapci
device atavia
And then you need the atadisk, atapicd etc lines in there just as usual.
If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual.
However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above.
2008-10-09 12:56:57 +00:00
|
|
|
|
2009-12-13 00:13:21 +00:00
|
|
|
return (ch->devices & (ATA_ATAPI_MASTER << target));
|
This is the roumored ATA modulerisation works, and it needs a little explanation.
If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in.
However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries:
atacore: ATA core functionality, always needed for any ATA setup
atacard: CARDBUS support
atacbus: PC98 cbus support
ataisa: ISA bus support
atapci: PCI bus support only generic chipset support.
ataahci: AHCI support, also pulled in by some vendor modules.
ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia; Vendor support, ie atavia for VIA chipsets
atadisk: ATA disk driver
ataraid: ATA softraid driver
atapicd: ATAPI cd/dvd driver
atapifd: ATAPI floppy/flashdisk driver
atapist: ATAPI tape driver
atausb: ATA<>USB bridge
atapicam: ATA<>CAM bridge
This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file:
device atacore
device atapci
device atavia
And then you need the atadisk, atapicd etc lines in there just as usual.
If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual.
However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above.
2008-10-09 12:56:57 +00:00
|
|
|
}
|
|
|
|
|
2013-04-03 14:10:37 +00:00
|
|
|
static void
|
2009-12-06 00:10:13 +00:00
|
|
|
ata_cam_begin_transaction(device_t dev, union ccb *ccb)
|
|
|
|
{
|
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
|
|
|
struct ata_request *request;
|
|
|
|
|
|
|
|
if (!(request = ata_alloc_request())) {
|
|
|
|
device_printf(dev, "FAILURE - out of memory in start\n");
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
xpt_done(ccb);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
bzero(request, sizeof(*request));
|
|
|
|
|
|
|
|
/* setup request */
|
|
|
|
request->dev = NULL;
|
|
|
|
request->parent = dev;
|
|
|
|
request->unit = ccb->ccb_h.target_id;
|
|
|
|
if (ccb->ccb_h.func_code == XPT_ATA_IO) {
|
|
|
|
request->data = ccb->ataio.data_ptr;
|
|
|
|
request->bytecount = ccb->ataio.dxfer_len;
|
|
|
|
request->u.ata.command = ccb->ataio.cmd.command;
|
|
|
|
request->u.ata.feature = ((uint16_t)ccb->ataio.cmd.features_exp << 8) |
|
|
|
|
(uint16_t)ccb->ataio.cmd.features;
|
|
|
|
request->u.ata.count = ((uint16_t)ccb->ataio.cmd.sector_count_exp << 8) |
|
|
|
|
(uint16_t)ccb->ataio.cmd.sector_count;
|
|
|
|
if (ccb->ataio.cmd.flags & CAM_ATAIO_48BIT) {
|
|
|
|
request->flags |= ATA_R_48BIT;
|
|
|
|
request->u.ata.lba =
|
|
|
|
((uint64_t)ccb->ataio.cmd.lba_high_exp << 40) |
|
|
|
|
((uint64_t)ccb->ataio.cmd.lba_mid_exp << 32) |
|
|
|
|
((uint64_t)ccb->ataio.cmd.lba_low_exp << 24);
|
|
|
|
} else {
|
|
|
|
request->u.ata.lba =
|
|
|
|
((uint64_t)(ccb->ataio.cmd.device & 0x0f) << 24);
|
|
|
|
}
|
|
|
|
request->u.ata.lba |= ((uint64_t)ccb->ataio.cmd.lba_high << 16) |
|
|
|
|
((uint64_t)ccb->ataio.cmd.lba_mid << 8) |
|
|
|
|
(uint64_t)ccb->ataio.cmd.lba_low;
|
2012-10-26 20:03:08 +00:00
|
|
|
if (ccb->ataio.cmd.flags & CAM_ATAIO_NEEDRESULT)
|
|
|
|
request->flags |= ATA_R_NEEDRESULT;
|
2009-12-06 00:10:13 +00:00
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE &&
|
|
|
|
ccb->ataio.cmd.flags & CAM_ATAIO_DMA)
|
|
|
|
request->flags |= ATA_R_DMA;
|
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
|
|
|
|
request->flags |= ATA_R_READ;
|
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT)
|
|
|
|
request->flags |= ATA_R_WRITE;
|
2012-11-01 00:09:01 +00:00
|
|
|
if (ccb->ataio.cmd.command == ATA_READ_MUL ||
|
|
|
|
ccb->ataio.cmd.command == ATA_READ_MUL48 ||
|
|
|
|
ccb->ataio.cmd.command == ATA_WRITE_MUL ||
|
|
|
|
ccb->ataio.cmd.command == ATA_WRITE_MUL48) {
|
|
|
|
request->transfersize = min(request->bytecount,
|
|
|
|
ch->curr[ccb->ccb_h.target_id].bytecount);
|
|
|
|
} else
|
|
|
|
request->transfersize = min(request->bytecount, 512);
|
2009-12-06 00:10:13 +00:00
|
|
|
} else {
|
|
|
|
request->data = ccb->csio.data_ptr;
|
|
|
|
request->bytecount = ccb->csio.dxfer_len;
|
|
|
|
bcopy((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
|
|
|
|
ccb->csio.cdb_io.cdb_ptr : ccb->csio.cdb_io.cdb_bytes,
|
|
|
|
request->u.atapi.ccb, ccb->csio.cdb_len);
|
|
|
|
request->flags |= ATA_R_ATAPI;
|
2010-02-02 11:09:28 +00:00
|
|
|
if (ch->curr[ccb->ccb_h.target_id].atapi == 16)
|
|
|
|
request->flags |= ATA_R_ATAPI16;
|
2009-12-06 00:10:13 +00:00
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE &&
|
|
|
|
ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA)
|
|
|
|
request->flags |= ATA_R_DMA;
|
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)
|
|
|
|
request->flags |= ATA_R_READ;
|
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT)
|
|
|
|
request->flags |= ATA_R_WRITE;
|
2012-11-01 00:09:01 +00:00
|
|
|
request->transfersize = min(request->bytecount,
|
|
|
|
ch->curr[ccb->ccb_h.target_id].bytecount);
|
2009-12-06 00:10:13 +00:00
|
|
|
}
|
|
|
|
request->retries = 0;
|
|
|
|
request->timeout = (ccb->ccb_h.timeout + 999) / 1000;
|
|
|
|
callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED);
|
|
|
|
request->ccb = ccb;
|
2013-02-22 21:43:21 +00:00
|
|
|
request->flags |= ATA_R_DATA_IN_CCB;
|
2009-12-06 00:10:13 +00:00
|
|
|
|
|
|
|
ch->running = request;
|
|
|
|
ch->state = ATA_ACTIVE;
|
|
|
|
if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) {
|
|
|
|
ch->running = NULL;
|
|
|
|
ch->state = ATA_IDLE;
|
|
|
|
ata_cam_end_transaction(dev, request);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-12 09:55:24 +00:00
|
|
|
static void
|
|
|
|
ata_cam_request_sense(device_t dev, struct ata_request *request)
|
|
|
|
{
|
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
|
|
|
union ccb *ccb = request->ccb;
|
|
|
|
|
|
|
|
ch->requestsense = 1;
|
|
|
|
|
2012-07-21 08:19:43 +00:00
|
|
|
bzero(request, sizeof(*request));
|
2011-04-12 09:55:24 +00:00
|
|
|
request->dev = NULL;
|
|
|
|
request->parent = dev;
|
|
|
|
request->unit = ccb->ccb_h.target_id;
|
|
|
|
request->data = (void *)&ccb->csio.sense_data;
|
|
|
|
request->bytecount = ccb->csio.sense_len;
|
|
|
|
request->u.atapi.ccb[0] = ATAPI_REQUEST_SENSE;
|
|
|
|
request->u.atapi.ccb[4] = ccb->csio.sense_len;
|
|
|
|
request->flags |= ATA_R_ATAPI;
|
|
|
|
if (ch->curr[ccb->ccb_h.target_id].atapi == 16)
|
|
|
|
request->flags |= ATA_R_ATAPI16;
|
|
|
|
if (ch->curr[ccb->ccb_h.target_id].mode >= ATA_DMA)
|
|
|
|
request->flags |= ATA_R_DMA;
|
|
|
|
request->flags |= ATA_R_READ;
|
|
|
|
request->transfersize = min(request->bytecount,
|
|
|
|
ch->curr[ccb->ccb_h.target_id].bytecount);
|
|
|
|
request->retries = 0;
|
|
|
|
request->timeout = (ccb->ccb_h.timeout + 999) / 1000;
|
|
|
|
callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED);
|
|
|
|
request->ccb = ccb;
|
|
|
|
|
|
|
|
ch->running = request;
|
|
|
|
ch->state = ATA_ACTIVE;
|
|
|
|
if (ch->hw.begin_transaction(request) == ATA_OP_FINISHED) {
|
|
|
|
ch->running = NULL;
|
|
|
|
ch->state = ATA_IDLE;
|
|
|
|
ata_cam_end_transaction(dev, request);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ata_cam_process_sense(device_t dev, struct ata_request *request)
|
|
|
|
{
|
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
|
|
|
union ccb *ccb = request->ccb;
|
|
|
|
int fatalerr = 0;
|
|
|
|
|
|
|
|
ch->requestsense = 0;
|
|
|
|
|
|
|
|
if (request->flags & ATA_R_TIMEOUT)
|
|
|
|
fatalerr = 1;
|
|
|
|
if ((request->flags & ATA_R_TIMEOUT) == 0 &&
|
|
|
|
(request->status & ATA_S_ERROR) == 0 &&
|
|
|
|
request->result == 0) {
|
|
|
|
ccb->ccb_h.status |= CAM_AUTOSNS_VALID;
|
|
|
|
} else {
|
|
|
|
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
|
|
|
|
ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ata_free_request(request);
|
|
|
|
xpt_done(ccb);
|
|
|
|
/* Do error recovery if needed. */
|
|
|
|
if (fatalerr)
|
|
|
|
ata_reinit(dev);
|
|
|
|
}
|
|
|
|
|
2009-12-06 00:10:13 +00:00
|
|
|
void
|
|
|
|
ata_cam_end_transaction(device_t dev, struct ata_request *request)
|
|
|
|
{
|
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
|
|
|
union ccb *ccb = request->ccb;
|
|
|
|
int fatalerr = 0;
|
|
|
|
|
2011-04-12 09:55:24 +00:00
|
|
|
if (ch->requestsense) {
|
|
|
|
ata_cam_process_sense(dev, request);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-12-06 00:10:13 +00:00
|
|
|
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
|
|
|
|
if (request->flags & ATA_R_TIMEOUT) {
|
|
|
|
xpt_freeze_simq(ch->sim, 1);
|
|
|
|
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
|
|
|
|
ccb->ccb_h.status |= CAM_CMD_TIMEOUT | CAM_RELEASE_SIMQ;
|
|
|
|
fatalerr = 1;
|
|
|
|
} else if (request->status & ATA_S_ERROR) {
|
|
|
|
if (ccb->ccb_h.func_code == XPT_ATA_IO) {
|
|
|
|
ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR;
|
|
|
|
} else {
|
|
|
|
ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR;
|
|
|
|
ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND;
|
|
|
|
}
|
|
|
|
} else if (request->result == ERESTART)
|
|
|
|
ccb->ccb_h.status |= CAM_REQUEUE_REQ;
|
|
|
|
else if (request->result != 0)
|
|
|
|
ccb->ccb_h.status |= CAM_REQ_CMP_ERR;
|
|
|
|
else
|
|
|
|
ccb->ccb_h.status |= CAM_REQ_CMP;
|
|
|
|
if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP &&
|
|
|
|
!(ccb->ccb_h.status & CAM_DEV_QFRZN)) {
|
|
|
|
xpt_freeze_devq(ccb->ccb_h.path, 1);
|
|
|
|
ccb->ccb_h.status |= CAM_DEV_QFRZN;
|
|
|
|
}
|
|
|
|
if (ccb->ccb_h.func_code == XPT_ATA_IO &&
|
|
|
|
((request->status & ATA_S_ERROR) ||
|
|
|
|
(ccb->ataio.cmd.flags & CAM_ATAIO_NEEDRESULT))) {
|
|
|
|
struct ata_res *res = &ccb->ataio.res;
|
|
|
|
res->status = request->status;
|
|
|
|
res->error = request->error;
|
|
|
|
res->lba_low = request->u.ata.lba;
|
|
|
|
res->lba_mid = request->u.ata.lba >> 8;
|
|
|
|
res->lba_high = request->u.ata.lba >> 16;
|
|
|
|
res->device = request->u.ata.lba >> 24;
|
|
|
|
res->lba_low_exp = request->u.ata.lba >> 24;
|
|
|
|
res->lba_mid_exp = request->u.ata.lba >> 32;
|
|
|
|
res->lba_high_exp = request->u.ata.lba >> 40;
|
|
|
|
res->sector_count = request->u.ata.count;
|
|
|
|
res->sector_count_exp = request->u.ata.count >> 8;
|
|
|
|
}
|
2010-11-08 15:36:15 +00:00
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
|
|
|
|
if (ccb->ccb_h.func_code == XPT_ATA_IO) {
|
|
|
|
ccb->ataio.resid =
|
|
|
|
ccb->ataio.dxfer_len - request->donecount;
|
|
|
|
} else {
|
|
|
|
ccb->csio.resid =
|
|
|
|
ccb->csio.dxfer_len - request->donecount;
|
|
|
|
}
|
|
|
|
}
|
2011-04-12 09:55:24 +00:00
|
|
|
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR &&
|
|
|
|
(ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0)
|
|
|
|
ata_cam_request_sense(dev, request);
|
|
|
|
else {
|
|
|
|
ata_free_request(request);
|
|
|
|
xpt_done(ccb);
|
|
|
|
}
|
2009-12-06 00:10:13 +00:00
|
|
|
/* Do error recovery if needed. */
|
|
|
|
if (fatalerr)
|
|
|
|
ata_reinit(dev);
|
|
|
|
}
|
|
|
|
|
2010-04-30 08:37:00 +00:00
|
|
|
static int
|
|
|
|
ata_check_ids(device_t dev, union ccb *ccb)
|
|
|
|
{
|
|
|
|
struct ata_channel *ch = device_get_softc(dev);
|
|
|
|
|
|
|
|
if (ccb->ccb_h.target_id > ((ch->flags & ATA_NO_SLAVE) ? 0 : 1)) {
|
|
|
|
ccb->ccb_h.status = CAM_TID_INVALID;
|
|
|
|
xpt_done(ccb);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
if (ccb->ccb_h.target_lun != 0) {
|
|
|
|
ccb->ccb_h.status = CAM_LUN_INVALID;
|
|
|
|
xpt_done(ccb);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2009-12-06 00:10:13 +00:00
|
|
|
static void
|
|
|
|
ataaction(struct cam_sim *sim, union ccb *ccb)
|
|
|
|
{
|
2010-07-25 15:43:52 +00:00
|
|
|
device_t dev, parent;
|
2009-12-06 00:10:13 +00:00
|
|
|
struct ata_channel *ch;
|
|
|
|
|
|
|
|
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ataaction func_code=%x\n",
|
|
|
|
ccb->ccb_h.func_code));
|
|
|
|
|
|
|
|
ch = (struct ata_channel *)cam_sim_softc(sim);
|
|
|
|
dev = ch->dev;
|
|
|
|
switch (ccb->ccb_h.func_code) {
|
|
|
|
/* Common cases first */
|
|
|
|
case XPT_ATA_IO: /* Execute the requested I/O operation */
|
|
|
|
case XPT_SCSI_IO:
|
2010-04-30 08:37:00 +00:00
|
|
|
if (ata_check_ids(dev, ccb))
|
|
|
|
return;
|
2009-12-06 00:10:13 +00:00
|
|
|
if ((ch->devices & ((ATA_ATA_MASTER | ATA_ATAPI_MASTER)
|
|
|
|
<< ccb->ccb_h.target_id)) == 0) {
|
|
|
|
ccb->ccb_h.status = CAM_SEL_TIMEOUT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (ch->running)
|
|
|
|
device_printf(dev, "already running!\n");
|
|
|
|
if (ccb->ccb_h.func_code == XPT_ATA_IO &&
|
|
|
|
(ccb->ataio.cmd.flags & CAM_ATAIO_CONTROL) &&
|
|
|
|
(ccb->ataio.cmd.control & ATA_A_RESET)) {
|
|
|
|
struct ata_res *res = &ccb->ataio.res;
|
|
|
|
|
|
|
|
bzero(res, sizeof(*res));
|
|
|
|
if (ch->devices & (ATA_ATA_MASTER << ccb->ccb_h.target_id)) {
|
|
|
|
res->lba_high = 0;
|
|
|
|
res->lba_mid = 0;
|
|
|
|
} else {
|
|
|
|
res->lba_high = 0xeb;
|
|
|
|
res->lba_mid = 0x14;
|
|
|
|
}
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ata_cam_begin_transaction(dev, ccb);
|
2010-04-30 08:37:00 +00:00
|
|
|
return;
|
2009-12-06 00:10:13 +00:00
|
|
|
case XPT_EN_LUN: /* Enable LUN as a target */
|
|
|
|
case XPT_TARGET_IO: /* Execute target I/O request */
|
|
|
|
case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
|
|
|
|
case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
|
|
|
|
case XPT_ABORT: /* Abort the specified CCB */
|
|
|
|
/* XXX Implement */
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
break;
|
|
|
|
case XPT_SET_TRAN_SETTINGS:
|
|
|
|
{
|
|
|
|
struct ccb_trans_settings *cts = &ccb->cts;
|
|
|
|
struct ata_cam_device *d;
|
|
|
|
|
2010-04-30 08:37:00 +00:00
|
|
|
if (ata_check_ids(dev, ccb))
|
|
|
|
return;
|
2009-12-06 00:10:13 +00:00
|
|
|
if (cts->type == CTS_TYPE_CURRENT_SETTINGS)
|
|
|
|
d = &ch->curr[ccb->ccb_h.target_id];
|
|
|
|
else
|
|
|
|
d = &ch->user[ccb->ccb_h.target_id];
|
2010-01-10 09:20:56 +00:00
|
|
|
if (ch->flags & ATA_SATA) {
|
2009-12-06 00:10:13 +00:00
|
|
|
if (cts->xport_specific.sata.valid & CTS_SATA_VALID_REVISION)
|
|
|
|
d->revision = cts->xport_specific.sata.revision;
|
2010-02-02 11:09:28 +00:00
|
|
|
if (cts->xport_specific.sata.valid & CTS_SATA_VALID_MODE) {
|
2009-12-06 00:10:13 +00:00
|
|
|
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
|
|
|
d->mode = ATA_SETMODE(ch->dev,
|
|
|
|
ccb->ccb_h.target_id,
|
|
|
|
cts->xport_specific.sata.mode);
|
|
|
|
} else
|
|
|
|
d->mode = cts->xport_specific.sata.mode;
|
|
|
|
}
|
2010-02-02 11:09:28 +00:00
|
|
|
if (cts->xport_specific.sata.valid & CTS_SATA_VALID_BYTECOUNT)
|
2009-12-06 00:10:13 +00:00
|
|
|
d->bytecount = min(8192, cts->xport_specific.sata.bytecount);
|
2010-02-02 11:09:28 +00:00
|
|
|
if (cts->xport_specific.sata.valid & CTS_SATA_VALID_ATAPI)
|
|
|
|
d->atapi = cts->xport_specific.sata.atapi;
|
2010-11-18 19:28:45 +00:00
|
|
|
if (cts->xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
|
|
|
|
d->caps = cts->xport_specific.sata.caps;
|
2009-12-06 00:10:13 +00:00
|
|
|
} else {
|
|
|
|
if (cts->xport_specific.ata.valid & CTS_ATA_VALID_MODE) {
|
|
|
|
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
|
|
|
d->mode = ATA_SETMODE(ch->dev,
|
|
|
|
ccb->ccb_h.target_id,
|
|
|
|
cts->xport_specific.ata.mode);
|
|
|
|
} else
|
|
|
|
d->mode = cts->xport_specific.ata.mode;
|
|
|
|
}
|
|
|
|
if (cts->xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT)
|
|
|
|
d->bytecount = cts->xport_specific.ata.bytecount;
|
2010-02-02 11:09:28 +00:00
|
|
|
if (cts->xport_specific.ata.valid & CTS_ATA_VALID_ATAPI)
|
|
|
|
d->atapi = cts->xport_specific.ata.atapi;
|
2013-04-06 13:39:02 +00:00
|
|
|
if (cts->xport_specific.ata.valid & CTS_ATA_VALID_CAPS)
|
|
|
|
d->caps = cts->xport_specific.ata.caps;
|
2009-12-06 00:10:13 +00:00
|
|
|
}
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XPT_GET_TRAN_SETTINGS:
|
|
|
|
{
|
|
|
|
struct ccb_trans_settings *cts = &ccb->cts;
|
|
|
|
struct ata_cam_device *d;
|
|
|
|
|
2010-04-30 08:37:00 +00:00
|
|
|
if (ata_check_ids(dev, ccb))
|
|
|
|
return;
|
2009-12-06 00:10:13 +00:00
|
|
|
if (cts->type == CTS_TYPE_CURRENT_SETTINGS)
|
|
|
|
d = &ch->curr[ccb->ccb_h.target_id];
|
|
|
|
else
|
|
|
|
d = &ch->user[ccb->ccb_h.target_id];
|
2012-06-06 06:52:51 +00:00
|
|
|
cts->protocol = PROTO_UNSPECIFIED;
|
2009-12-06 00:10:13 +00:00
|
|
|
cts->protocol_version = PROTO_VERSION_UNSPECIFIED;
|
2010-01-10 09:20:56 +00:00
|
|
|
if (ch->flags & ATA_SATA) {
|
2009-12-06 00:10:13 +00:00
|
|
|
cts->transport = XPORT_SATA;
|
|
|
|
cts->transport_version = XPORT_VERSION_UNSPECIFIED;
|
2010-02-22 10:45:40 +00:00
|
|
|
cts->xport_specific.sata.valid = 0;
|
2009-12-06 00:10:13 +00:00
|
|
|
cts->xport_specific.sata.mode = d->mode;
|
|
|
|
cts->xport_specific.sata.valid |= CTS_SATA_VALID_MODE;
|
|
|
|
cts->xport_specific.sata.bytecount = d->bytecount;
|
|
|
|
cts->xport_specific.sata.valid |= CTS_SATA_VALID_BYTECOUNT;
|
|
|
|
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
|
|
|
cts->xport_specific.sata.revision =
|
|
|
|
ATA_GETREV(dev, ccb->ccb_h.target_id);
|
2010-02-22 10:45:40 +00:00
|
|
|
if (cts->xport_specific.sata.revision != 0xff) {
|
|
|
|
cts->xport_specific.sata.valid |=
|
|
|
|
CTS_SATA_VALID_REVISION;
|
|
|
|
}
|
2010-11-18 19:28:45 +00:00
|
|
|
cts->xport_specific.sata.caps =
|
|
|
|
d->caps & CTS_SATA_CAPS_D;
|
|
|
|
if (ch->pm_level) {
|
|
|
|
cts->xport_specific.sata.caps |=
|
|
|
|
CTS_SATA_CAPS_H_PMREQ;
|
|
|
|
}
|
|
|
|
cts->xport_specific.sata.caps &=
|
|
|
|
ch->user[ccb->ccb_h.target_id].caps;
|
2010-02-22 10:45:40 +00:00
|
|
|
} else {
|
2009-12-06 00:10:13 +00:00
|
|
|
cts->xport_specific.sata.revision = d->revision;
|
2010-02-22 10:45:40 +00:00
|
|
|
cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION;
|
2010-11-18 19:28:45 +00:00
|
|
|
cts->xport_specific.sata.caps = d->caps;
|
2010-02-22 10:45:40 +00:00
|
|
|
}
|
2013-04-06 13:39:02 +00:00
|
|
|
cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS;
|
2010-02-02 11:09:28 +00:00
|
|
|
cts->xport_specific.sata.atapi = d->atapi;
|
|
|
|
cts->xport_specific.sata.valid |= CTS_SATA_VALID_ATAPI;
|
2009-12-06 00:10:13 +00:00
|
|
|
} else {
|
|
|
|
cts->transport = XPORT_ATA;
|
|
|
|
cts->transport_version = XPORT_VERSION_UNSPECIFIED;
|
2010-02-22 10:45:40 +00:00
|
|
|
cts->xport_specific.ata.valid = 0;
|
2009-12-06 00:10:13 +00:00
|
|
|
cts->xport_specific.ata.mode = d->mode;
|
|
|
|
cts->xport_specific.ata.valid |= CTS_ATA_VALID_MODE;
|
|
|
|
cts->xport_specific.ata.bytecount = d->bytecount;
|
|
|
|
cts->xport_specific.ata.valid |= CTS_ATA_VALID_BYTECOUNT;
|
2013-04-06 13:39:02 +00:00
|
|
|
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
|
|
|
cts->xport_specific.ata.caps =
|
|
|
|
d->caps & CTS_ATA_CAPS_D;
|
|
|
|
if (!(ch->flags & ATA_NO_48BIT_DMA))
|
|
|
|
cts->xport_specific.ata.caps |=
|
|
|
|
CTS_ATA_CAPS_H_DMA48;
|
|
|
|
cts->xport_specific.ata.caps &=
|
|
|
|
ch->user[ccb->ccb_h.target_id].caps;
|
|
|
|
} else
|
|
|
|
cts->xport_specific.ata.caps = d->caps;
|
|
|
|
cts->xport_specific.ata.valid |= CTS_ATA_VALID_CAPS;
|
2010-02-02 11:09:28 +00:00
|
|
|
cts->xport_specific.ata.atapi = d->atapi;
|
|
|
|
cts->xport_specific.ata.valid |= CTS_ATA_VALID_ATAPI;
|
2009-12-06 00:10:13 +00:00
|
|
|
}
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case XPT_RESET_BUS: /* Reset the specified SCSI bus */
|
|
|
|
case XPT_RESET_DEV: /* Bus Device Reset the specified SCSI device */
|
|
|
|
ata_reinit(dev);
|
|
|
|
ccb->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
break;
|
|
|
|
case XPT_TERM_IO: /* Terminate the I/O process */
|
|
|
|
/* XXX Implement */
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
break;
|
|
|
|
case XPT_PATH_INQ: /* Path routing inquiry */
|
|
|
|
{
|
|
|
|
struct ccb_pathinq *cpi = &ccb->cpi;
|
|
|
|
|
2010-07-25 15:43:52 +00:00
|
|
|
parent = device_get_parent(dev);
|
2009-12-06 00:10:13 +00:00
|
|
|
cpi->version_num = 1; /* XXX??? */
|
|
|
|
cpi->hba_inquiry = PI_SDTR_ABLE;
|
|
|
|
cpi->target_sprt = 0;
|
|
|
|
cpi->hba_misc = PIM_SEQSCAN;
|
|
|
|
cpi->hba_eng_cnt = 0;
|
|
|
|
if (ch->flags & ATA_NO_SLAVE)
|
|
|
|
cpi->max_target = 0;
|
|
|
|
else
|
|
|
|
cpi->max_target = 1;
|
|
|
|
cpi->max_lun = 0;
|
|
|
|
cpi->initiator_id = 0;
|
|
|
|
cpi->bus_id = cam_sim_bus(sim);
|
|
|
|
if (ch->flags & ATA_SATA)
|
|
|
|
cpi->base_transfer_speed = 150000;
|
|
|
|
else
|
|
|
|
cpi->base_transfer_speed = 3300;
|
|
|
|
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
|
|
|
|
strncpy(cpi->hba_vid, "ATA", HBA_IDLEN);
|
|
|
|
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
|
|
|
cpi->unit_number = cam_sim_unit(sim);
|
2010-01-10 09:20:56 +00:00
|
|
|
if (ch->flags & ATA_SATA)
|
2009-12-06 00:10:13 +00:00
|
|
|
cpi->transport = XPORT_SATA;
|
|
|
|
else
|
|
|
|
cpi->transport = XPORT_ATA;
|
|
|
|
cpi->transport_version = XPORT_VERSION_UNSPECIFIED;
|
2012-06-10 11:17:14 +00:00
|
|
|
cpi->protocol = PROTO_ATA;
|
2009-12-06 00:10:13 +00:00
|
|
|
cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
|
|
|
|
cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS;
|
2010-07-25 15:43:52 +00:00
|
|
|
if (device_get_devclass(device_get_parent(parent)) ==
|
|
|
|
devclass_find("pci")) {
|
|
|
|
cpi->hba_vendor = pci_get_vendor(parent);
|
|
|
|
cpi->hba_device = pci_get_device(parent);
|
|
|
|
cpi->hba_subvendor = pci_get_subvendor(parent);
|
|
|
|
cpi->hba_subdevice = pci_get_subdevice(parent);
|
|
|
|
}
|
2009-12-06 00:10:13 +00:00
|
|
|
cpi->ccb_h.status = CAM_REQ_CMP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
ccb->ccb_h.status = CAM_REQ_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
2010-04-30 08:37:00 +00:00
|
|
|
xpt_done(ccb);
|
2009-12-06 00:10:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
atapoll(struct cam_sim *sim)
|
|
|
|
{
|
|
|
|
struct ata_channel *ch = (struct ata_channel *)cam_sim_softc(sim);
|
|
|
|
|
|
|
|
ata_interrupt_locked(ch);
|
|
|
|
}
|
2005-04-29 11:30:03 +00:00
|
|
|
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
/*
|
|
|
|
* module handeling
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
ata_module_event_handler(module_t mod, int what, void *arg)
|
2000-02-18 20:57:33 +00:00
|
|
|
{
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
|
|
|
|
switch (what) {
|
|
|
|
case MOD_LOAD:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case MOD_UNLOAD:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return EOPNOTSUPP;
|
2000-02-18 20:57:33 +00:00
|
|
|
}
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
}
|
2004-01-11 22:08:34 +00:00
|
|
|
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
static moduledata_t ata_moduledata = { "ata", ata_module_event_handler, NULL };
|
|
|
|
DECLARE_MODULE(ata, ata_moduledata, SI_SUB_CONFIGURE, SI_ORDER_SECOND);
|
|
|
|
MODULE_VERSION(ata, 1);
|
2009-12-10 16:55:16 +00:00
|
|
|
MODULE_DEPEND(ata, cam, 1, 1, 1);
|
2003-05-02 13:47:44 +00:00
|
|
|
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
static void
|
|
|
|
ata_init(void)
|
|
|
|
{
|
2005-04-18 16:01:56 +00:00
|
|
|
ata_request_zone = uma_zcreate("ata_request", sizeof(struct ata_request),
|
|
|
|
NULL, NULL, NULL, NULL, 0, 0);
|
2000-02-18 20:57:33 +00:00
|
|
|
}
|
2005-04-18 16:01:56 +00:00
|
|
|
SYSINIT(ata_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_init, NULL);
|
This is the much rumoured ATA mkIII update that I've been working on.
o ATA is now fully newbus'd and split into modules.
This means that on a modern system you just load "atapci and ata"
to get the base support, and then one or more of the device
subdrivers "atadisk atapicd atapifd atapist ataraid".
All can be loaded/unloaded anytime, but for obvious reasons you
dont want to unload atadisk when you have mounted filesystems.
o The device identify part of the probe has been rewritten to fix
the problems with odd devices the old had, and to try to remove
so of the long delays some HW could provoke. Also probing is done
without the need for interrupts, making earlier probing possible.
o SATA devices can be hot inserted/removed and devices will be created/
removed in /dev accordingly.
NOTE: only supported on controllers that has this feature:
Promise and Silicon Image for now.
On other controllers the usual atacontrol detach/attach dance is
still needed.
o Support for "atomic" composite ATA requests used for RAID.
o ATA RAID support has been rewritten and and now supports these
metadata formats:
"Adaptec HostRAID"
"Highpoint V2 RocketRAID"
"Highpoint V3 RocketRAID"
"Intel MatrixRAID"
"Integrated Technology Express"
"LSILogic V2 MegaRAID"
"LSILogic V3 MegaRAID"
"Promise FastTrak"
"Silicon Image Medley"
"FreeBSD PseudoRAID"
o Update the ioctl API to match new RAID levels etc.
o Update atacontrol to know about the new RAID levels etc
NOTE: you need to recompile atacontrol with the new sys/ata.h,
make world will take care of that.
NOTE2: that rebuild is done differently from the old system as
the rebuild is now done piggybacked on read requests to the
array, so atacontrol simply starts a background "dd" to rebuild
the array.
o The reinit code has been worked over to be much more robust.
o The timeout code has been overhauled for races.
o Support of new chipsets.
o Lots of fixes for bugs found while doing the modulerization and
reviewing the old code.
Missing or changed features from current ATA:
o atapi-cd no longer has support for ATAPI changers. Todays its
much cheaper and alot faster to copy those CD images to disk
and serve them from there. Besides they dont seem to be made
anymore, maybe for that exact reason.
o ATA RAID can only read metadata from all the above metadata formats,
not write all of them (Promise and Highpoint V2 so far). This means
that arrays can be picked up from the BIOS, but they cannot be
created from FreeBSD. There is more to it than just the missing
write metadata support, those formats are not unique to a given
controller like Promise and Highpoint formats, instead they exist
for several types, and even worse, some controllers can have
different formats and its impossible to tell which one.
The outcome is that we cannot reliably create the metadata of those
formats and be sure the controller BIOS will understand it.
However write support is needed to update/fail/rebuild the arrays
properly so it sits fairly high on the TODO list.
o So far atapicam is not supported with these changes. When/if this
will change is up to the maintainer of atapi-cam so go there for
questions.
HW donated by: Webveveriet AS
HW donated by: Frode Nordahl
HW donated by: Yahoo!
HW donated by: Sentex
Patience by: Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
|
|
|
|
2005-04-18 16:01:56 +00:00
|
|
|
static void
|
|
|
|
ata_uninit(void)
|
|
|
|
{
|
|
|
|
uma_zdestroy(ata_request_zone);
|
|
|
|
}
|
|
|
|
SYSUNINIT(ata_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_uninit, NULL);
|