1999-03-03 21:10:29 +00:00
|
|
|
|
/*-
|
2004-01-11 22:08:34 +00:00
|
|
|
|
* Copyright (c) 1998 - 2004 S<EFBFBD>ren Schmidt <sos@FreeBSD.org>
|
1999-03-03 21:10:29 +00:00
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer,
|
|
|
|
|
* without modification, immediately at the beginning of the file.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
2003-08-24 17:55:58 +00:00
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
|
1999-03-03 21:10:29 +00:00
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include <sys/systm.h>
|
2001-03-15 15:36:25 +00:00
|
|
|
|
#include <sys/ata.h>
|
1999-03-03 21:10:29 +00:00
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
|
#include <sys/malloc.h>
|
2000-05-05 09:59:14 +00:00
|
|
|
|
#include <sys/bio.h>
|
1999-12-14 10:25:28 +00:00
|
|
|
|
#include <sys/bus.h>
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
#include <sys/conf.h>
|
1999-03-03 21:10:29 +00:00
|
|
|
|
#include <sys/cdio.h>
|
2004-01-11 22:08:34 +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>
|
2002-04-05 13:13:56 +00:00
|
|
|
|
#include <machine/bus.h>
|
2003-04-01 15:06:26 +00:00
|
|
|
|
#include <geom/geom_disk.h>
|
1999-03-03 21:10:29 +00:00
|
|
|
|
#include <dev/ata/ata-all.h>
|
|
|
|
|
#include <dev/ata/atapi-fd.h>
|
|
|
|
|
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
/* prototypes */
|
2003-08-24 09:22:26 +00:00
|
|
|
|
static disk_open_t afd_open;
|
|
|
|
|
static disk_close_t afd_close;
|
2003-02-28 09:53:36 +00:00
|
|
|
|
#ifdef notyet
|
2003-08-24 09:22:26 +00:00
|
|
|
|
static disk_ioctl_t afd_ioctl;
|
2003-02-28 09:53:36 +00:00
|
|
|
|
#endif
|
2003-08-24 09:22:26 +00:00
|
|
|
|
static disk_strategy_t afdstrategy;
|
2003-08-25 09:01:49 +00:00
|
|
|
|
static void afd_detach(struct ata_device *);
|
|
|
|
|
static void afd_start(struct ata_device *);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int afd_sense(struct afd_softc *);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
static void afd_describe(struct afd_softc *);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
static void afd_done(struct ata_request *);
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int afd_eject(struct afd_softc *, int);
|
|
|
|
|
static int afd_start_stop(struct afd_softc *, int);
|
|
|
|
|
static int afd_prevent_allow(struct afd_softc *, int);
|
2003-08-25 09:01:49 +00:00
|
|
|
|
static int afd_test_ready(struct ata_device *);
|
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
|
|
|
|
|
|
|
|
|
/* internal vars */
|
2000-02-18 20:57:33 +00:00
|
|
|
|
static u_int32_t afd_lun_map = 0;
|
2000-12-08 20:09:00 +00:00
|
|
|
|
static MALLOC_DEFINE(M_AFD, "AFD driver", "ATAPI floppy driver buffers");
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
void
|
|
|
|
|
afd_attach(struct ata_device *atadev)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
|
|
|
|
struct afd_softc *fdp;
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
|
2000-12-26 12:05:49 +00:00
|
|
|
|
fdp = malloc(sizeof(struct afd_softc), M_AFD, M_NOWAIT | M_ZERO);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
if (!fdp) {
|
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
|
|
|
|
ata_prtdev(atadev, "out of memory\n");
|
2003-08-24 09:22:26 +00:00
|
|
|
|
return;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
2001-03-21 11:49:07 +00:00
|
|
|
|
|
Major update of the ATA RAID code, part 1:
Overhaul of the attach/detach code and structures, there were some nasty
bugs in the old implementation. This made it possible to collapse the
ATA/ATAPI device control structures into one generic structure.
A note here, the kernel is NOT ready for detach of active devices,
it fails all over in random places, but for inactive devices it works.
However for ATA RAID this works, since the RAID abstration layer
insulates the buggy^H^H^H^H^H^Hfragile device subsystem from the
physical disks.
Proberly detect the RAID's from the BIOS, and mark critical RAID1
arrays as such, but continue if there is enough of the mirror left
to do so.
Properly fail arrays on a live system. For RAID0 that means return EIO,
and for RAID1 it means continue on the still working part of the mirror
if possible, else return EIO.
If the state changes, log this to the console.
Allow for Promise & Highpoint controllers/arrays to coexist on the
same machine. It is not possible to distribute arrays over different
makes of controllers though.
If Promise SuperSwap enclosures are used, signal disk state on the
status LED on the front.
Misc fixes that I had lying around for various minor bugs.
Sponsored by: Advanis Inc.
2002-02-04 19:23:40 +00:00
|
|
|
|
fdp->device = atadev;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
fdp->lun = ata_get_lun(&afd_lun_map);
|
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
|
|
|
|
ata_set_name(atadev, "afd", fdp->lun);
|
2001-03-21 11:49:07 +00:00
|
|
|
|
bioq_init(&fdp->queue);
|
2004-06-22 11:18:25 +00:00
|
|
|
|
mtx_init(&fdp->queue_mtx, "ATAPI FD bioqueue lock", NULL, MTX_DEF);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
|
|
|
|
if (afd_sense(fdp)) {
|
1999-10-09 19:57:13 +00:00
|
|
|
|
free(fdp, M_AFD);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
return;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* setup the function ptrs */
|
|
|
|
|
atadev->detach = afd_detach;
|
|
|
|
|
atadev->start = afd_start;
|
|
|
|
|
atadev->softc = fdp;
|
|
|
|
|
atadev->flags |= ATA_D_MEDIA_CHANGED;
|
|
|
|
|
|
|
|
|
|
/* lets create the disk device */
|
2004-02-18 21:36:53 +00:00
|
|
|
|
fdp->disk = disk_alloc();
|
|
|
|
|
fdp->disk->d_open = afd_open;
|
|
|
|
|
fdp->disk->d_close = afd_close;
|
2003-02-28 09:53:36 +00:00
|
|
|
|
#ifdef notyet
|
2004-02-18 21:36:53 +00:00
|
|
|
|
fdp->disk->d_ioctl = afd_ioctl;
|
2003-02-28 09:53:36 +00:00
|
|
|
|
#endif
|
2004-02-18 21:36:53 +00:00
|
|
|
|
fdp->disk->d_strategy = afdstrategy;
|
|
|
|
|
fdp->disk->d_name = "afd";
|
|
|
|
|
fdp->disk->d_drv1 = fdp;
|
2003-08-24 09:22:26 +00:00
|
|
|
|
if (atadev->channel->dma)
|
2004-02-18 21:36:53 +00:00
|
|
|
|
fdp->disk->d_maxsize = atadev->channel->dma->max_iosize;
|
2003-08-24 09:22:26 +00:00
|
|
|
|
else
|
2004-02-18 21:36:53 +00:00
|
|
|
|
fdp->disk->d_maxsize = DFLTPHYS;
|
|
|
|
|
fdp->disk->d_unit = fdp->lun;
|
|
|
|
|
disk_create(fdp->disk, DISK_VERSION);
|
2002-06-19 12:41:05 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* announce we are here */
|
2000-01-24 20:45:24 +00:00
|
|
|
|
afd_describe(fdp);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
static void
|
|
|
|
|
afd_detach(struct ata_device *atadev)
|
2000-02-18 20:57:33 +00:00
|
|
|
|
{
|
2003-08-24 09:22:26 +00:00
|
|
|
|
struct afd_softc *fdp = atadev->softc;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
mtx_lock(&fdp->queue_mtx);
|
2003-04-01 15:06:26 +00:00
|
|
|
|
bioq_flush(&fdp->queue, NULL, ENXIO);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
mtx_unlock(&fdp->queue_mtx);
|
2004-03-01 13:17:07 +00:00
|
|
|
|
mtx_destroy(&fdp->queue_mtx);
|
2004-02-18 21:36:53 +00:00
|
|
|
|
disk_destroy(fdp->disk);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
ata_prtdev(atadev, "WARNING - removed from configuration\n");
|
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
|
|
|
|
ata_free_name(atadev);
|
2000-02-18 20:57:33 +00:00
|
|
|
|
ata_free_lun(&afd_lun_map, fdp->lun);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
atadev->attach = NULL;
|
|
|
|
|
atadev->detach = NULL;
|
|
|
|
|
atadev->start = NULL;
|
|
|
|
|
atadev->softc = NULL;
|
|
|
|
|
atadev->flags = 0;
|
2000-02-18 20:57:33 +00:00
|
|
|
|
free(fdp, M_AFD);
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int
|
1999-03-03 21:10:29 +00:00
|
|
|
|
afd_sense(struct afd_softc *fdp)
|
|
|
|
|
{
|
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
|
|
|
|
int8_t ccb[16] = { ATAPI_MODE_SENSE_BIG, 0, ATAPI_REWRITEABLE_CAP_PAGE,
|
2001-09-20 15:25:36 +00:00
|
|
|
|
0, 0, 0, 0, sizeof(struct afd_cappage) >> 8,
|
|
|
|
|
sizeof(struct afd_cappage) & 0xff, 0, 0, 0, 0, 0, 0, 0 };
|
2003-08-24 09:22:26 +00:00
|
|
|
|
int count;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
2001-03-14 12:12:46 +00:00
|
|
|
|
/* The IOMEGA Clik! doesn't support reading the cap page, fake it */
|
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 (!strncmp(fdp->device->param->model, "IOMEGA Clik!", 12)) {
|
2001-03-14 12:12:46 +00:00
|
|
|
|
fdp->cap.transfer_rate = 500;
|
|
|
|
|
fdp->cap.heads = 1;
|
|
|
|
|
fdp->cap.sectors = 2;
|
|
|
|
|
fdp->cap.cylinders = 39441;
|
|
|
|
|
fdp->cap.sector_size = 512;
|
2003-08-24 09:22:26 +00:00
|
|
|
|
afd_test_ready(fdp->device);
|
2001-03-14 12:12:46 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* get drive capabilities, some bugridden drives needs this repeated */
|
1999-03-03 21:10:29 +00:00
|
|
|
|
for (count = 0 ; count < 5 ; count++) {
|
2003-08-24 09:22:26 +00:00
|
|
|
|
if (!ata_atapicmd(fdp->device, ccb, (caddr_t)&fdp->cap,
|
|
|
|
|
sizeof(struct afd_cappage), ATA_R_READ, 30) &&
|
|
|
|
|
fdp->cap.page_code == ATAPI_REWRITEABLE_CAP_PAGE) {
|
|
|
|
|
fdp->cap.cylinders = ntohs(fdp->cap.cylinders);
|
|
|
|
|
fdp->cap.sector_size = ntohs(fdp->cap.sector_size);
|
|
|
|
|
fdp->cap.transfer_rate = ntohs(fdp->cap.transfer_rate);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
2003-08-24 09:22:26 +00:00
|
|
|
|
return 1;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
afd_describe(struct afd_softc *fdp)
|
|
|
|
|
{
|
2000-01-24 20:45:24 +00:00
|
|
|
|
if (bootverbose) {
|
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
|
|
|
|
ata_prtdev(fdp->device,
|
2003-08-24 09:22:26 +00:00
|
|
|
|
"<%.40s/%.8s> removable drive at ata%d as %s\n",
|
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
|
|
|
|
fdp->device->param->model, fdp->device->param->revision,
|
|
|
|
|
device_get_unit(fdp->device->channel->dev),
|
|
|
|
|
(fdp->device->unit == ATA_MASTER) ? "master" : "slave");
|
|
|
|
|
ata_prtdev(fdp->device,
|
2001-03-15 15:36:25 +00:00
|
|
|
|
"%luMB (%u sectors), %u cyls, %u heads, %u S/T, %u B/S\n",
|
|
|
|
|
(fdp->cap.cylinders * fdp->cap.heads * fdp->cap.sectors) /
|
|
|
|
|
((1024L * 1024L) / fdp->cap.sector_size),
|
|
|
|
|
fdp->cap.cylinders * fdp->cap.heads * fdp->cap.sectors,
|
|
|
|
|
fdp->cap.cylinders, fdp->cap.heads, fdp->cap.sectors,
|
|
|
|
|
fdp->cap.sector_size);
|
2002-05-25 11:18:03 +00:00
|
|
|
|
ata_prtdev(fdp->device, "%dKB/s,", fdp->cap.transfer_rate / 8);
|
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
|
|
|
|
printf(" %s\n", ata_mode2str(fdp->device->mode));
|
2001-09-20 15:25:36 +00:00
|
|
|
|
if (fdp->cap.medium_type) {
|
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
|
|
|
|
ata_prtdev(fdp->device, "Medium: ");
|
2001-09-20 15:25:36 +00:00
|
|
|
|
switch (fdp->cap.medium_type) {
|
2001-03-14 12:05:44 +00:00
|
|
|
|
case MFD_2DD:
|
|
|
|
|
printf("720KB DD disk"); break;
|
1999-05-20 09:12:06 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
case MFD_HD_12:
|
|
|
|
|
printf("1.2MB HD disk"); break;
|
1999-05-20 09:12:06 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
case MFD_HD_144:
|
|
|
|
|
printf("1.44MB HD disk"); break;
|
1999-05-20 09:12:06 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
case MFD_UHD:
|
|
|
|
|
printf("120MB UHD disk"); break;
|
1999-05-20 09:12:06 +00:00
|
|
|
|
|
2001-03-14 12:05:44 +00:00
|
|
|
|
default:
|
2001-09-20 15:25:36 +00:00
|
|
|
|
printf("Unknown (0x%x)", fdp->cap.medium_type);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
}
|
2001-09-20 15:25:36 +00:00
|
|
|
|
if (fdp->cap.wp) printf(", writeprotected");
|
2003-02-20 20:02:32 +00:00
|
|
|
|
printf("\n");
|
2000-01-24 20:45:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2003-08-24 09:22:26 +00:00
|
|
|
|
ata_prtdev(fdp->device, "REMOVABLE <%.40s> at ata%d-%s %s\n",
|
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
|
|
|
|
fdp->device->param->model,
|
|
|
|
|
device_get_unit(fdp->device->channel->dev),
|
|
|
|
|
(fdp->device->unit == ATA_MASTER) ? "master" : "slave",
|
|
|
|
|
ata_mode2str(fdp->device->mode));
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-03-05 09:43:30 +00:00
|
|
|
|
static int
|
2003-08-24 09:22:26 +00:00
|
|
|
|
afd_open(struct disk *dp)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
2003-02-28 09:53:36 +00:00
|
|
|
|
struct afd_softc *fdp = dp->d_drv1;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
if (fdp->device->flags & ATA_D_DETACHING)
|
|
|
|
|
return ENXIO;
|
2002-12-03 20:20:44 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
afd_test_ready(fdp->device);
|
2000-01-29 14:10:59 +00:00
|
|
|
|
|
2003-02-28 09:53:36 +00:00
|
|
|
|
afd_prevent_allow(fdp, 1);
|
2000-01-29 14:10:59 +00:00
|
|
|
|
|
1999-03-03 21:10:29 +00:00
|
|
|
|
if (afd_sense(fdp))
|
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
|
|
|
|
ata_prtdev(fdp->device, "sense media type failed\n");
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
Major update of the ATA RAID code, part 1:
Overhaul of the attach/detach code and structures, there were some nasty
bugs in the old implementation. This made it possible to collapse the
ATA/ATAPI device control structures into one generic structure.
A note here, the kernel is NOT ready for detach of active devices,
it fails all over in random places, but for inactive devices it works.
However for ATA RAID this works, since the RAID abstration layer
insulates the buggy^H^H^H^H^H^Hfragile device subsystem from the
physical disks.
Proberly detect the RAID's from the BIOS, and mark critical RAID1
arrays as such, but continue if there is enough of the mirror left
to do so.
Properly fail arrays on a live system. For RAID0 that means return EIO,
and for RAID1 it means continue on the still working part of the mirror
if possible, else return EIO.
If the state changes, log this to the console.
Allow for Promise & Highpoint controllers/arrays to coexist on the
same machine. It is not possible to distribute arrays over different
makes of controllers though.
If Promise SuperSwap enclosures are used, signal disk state on the
status LED on the front.
Misc fixes that I had lying around for various minor bugs.
Sponsored by: Advanis Inc.
2002-02-04 19:23:40 +00:00
|
|
|
|
fdp->device->flags &= ~ATA_D_MEDIA_CHANGED;
|
2000-01-29 14:10:59 +00:00
|
|
|
|
|
2004-02-18 21:36:53 +00:00
|
|
|
|
fdp->disk->d_sectorsize = fdp->cap.sector_size;
|
|
|
|
|
fdp->disk->d_mediasize = (off_t)fdp->cap.sector_size * fdp->cap.sectors *
|
2002-09-20 19:36:05 +00:00
|
|
|
|
fdp->cap.heads * fdp->cap.cylinders;
|
2004-02-18 21:36:53 +00:00
|
|
|
|
fdp->disk->d_fwsectors = fdp->cap.sectors;
|
|
|
|
|
fdp->disk->d_fwheads = fdp->cap.heads;
|
2002-09-20 19:36:05 +00:00
|
|
|
|
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
return 0;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-03-05 09:43:30 +00:00
|
|
|
|
static int
|
2003-08-24 09:22:26 +00:00
|
|
|
|
afd_close(struct disk *dp)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
2003-02-28 09:53:36 +00:00
|
|
|
|
struct afd_softc *fdp = dp->d_drv1;
|
|
|
|
|
|
|
|
|
|
afd_prevent_allow(fdp, 0);
|
|
|
|
|
if (0)
|
|
|
|
|
afd_eject(fdp, 0); /* to keep gcc quiet */
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-28 09:53:36 +00:00
|
|
|
|
#ifdef notyet
|
1999-03-05 09:43:30 +00:00
|
|
|
|
static int
|
2003-08-24 09:22:26 +00:00
|
|
|
|
afd_ioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
2003-02-28 09:53:36 +00:00
|
|
|
|
struct afd_softc *fdp = dp->d_drv1;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
1999-03-07 21:49:14 +00:00
|
|
|
|
switch (cmd) {
|
1999-03-03 21:10:29 +00:00
|
|
|
|
case CDIOCEJECT:
|
2000-02-07 23:05:40 +00:00
|
|
|
|
if (count_dev(dev) > 1)
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
return EBUSY;
|
|
|
|
|
return afd_eject(fdp, 0);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
|
|
|
|
case CDIOCCLOSE:
|
2000-02-07 23:05:40 +00:00
|
|
|
|
if (count_dev(dev) > 1)
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
return 0;
|
|
|
|
|
return afd_eject(fdp, 1);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
|
|
|
|
default:
|
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
|
|
|
|
return ENOIOCTL;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-02-28 09:53:36 +00:00
|
|
|
|
#endif
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2000-04-15 05:54:02 +00:00
|
|
|
|
afdstrategy(struct bio *bp)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
2003-02-28 09:53:36 +00:00
|
|
|
|
struct afd_softc *fdp = bp->bio_disk->d_drv1;
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
|
Major update of the ATA RAID code, part 1:
Overhaul of the attach/detach code and structures, there were some nasty
bugs in the old implementation. This made it possible to collapse the
ATA/ATAPI device control structures into one generic structure.
A note here, the kernel is NOT ready for detach of active devices,
it fails all over in random places, but for inactive devices it works.
However for ATA RAID this works, since the RAID abstration layer
insulates the buggy^H^H^H^H^H^Hfragile device subsystem from the
physical disks.
Proberly detect the RAID's from the BIOS, and mark critical RAID1
arrays as such, but continue if there is enough of the mirror left
to do so.
Properly fail arrays on a live system. For RAID0 that means return EIO,
and for RAID1 it means continue on the still working part of the mirror
if possible, else return EIO.
If the state changes, log this to the console.
Allow for Promise & Highpoint controllers/arrays to coexist on the
same machine. It is not possible to distribute arrays over different
makes of controllers though.
If Promise SuperSwap enclosures are used, signal disk state on the
status LED on the front.
Misc fixes that I had lying around for various minor bugs.
Sponsored by: Advanis Inc.
2002-02-04 19:23:40 +00:00
|
|
|
|
if (fdp->device->flags & ATA_D_DETACHING) {
|
2001-05-06 20:00:03 +00:00
|
|
|
|
biofinish(bp, NULL, ENXIO);
|
2001-03-14 12:05:44 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-19 12:41:05 +00:00
|
|
|
|
/* if it's a null transfer, return immediatly. */
|
|
|
|
|
if (bp->bio_bcount == 0) {
|
|
|
|
|
bp->bio_resid = 0;
|
|
|
|
|
biodone(bp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
mtx_lock(&fdp->queue_mtx);
|
2003-04-01 15:06:26 +00:00
|
|
|
|
bioq_disksort(&fdp->queue, bp);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
mtx_unlock(&fdp->queue_mtx);
|
2002-03-11 21:04:32 +00:00
|
|
|
|
ata_start(fdp->device->channel);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
static void
|
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
|
|
|
|
afd_start(struct ata_device *atadev)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
2003-08-24 09:22:26 +00:00
|
|
|
|
struct afd_softc *fdp = atadev->softc;
|
|
|
|
|
struct bio *bp;
|
|
|
|
|
struct ata_request *request;
|
2000-09-19 11:08:39 +00:00
|
|
|
|
u_int32_t lba;
|
|
|
|
|
u_int16_t count;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
int8_t ccb[16];
|
2000-01-07 12:01:01 +00:00
|
|
|
|
|
1999-05-17 15:58:47 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
mtx_lock(&fdp->queue_mtx);
|
|
|
|
|
bp = bioq_first(&fdp->queue);
|
|
|
|
|
if (!bp) {
|
|
|
|
|
mtx_unlock(&fdp->queue_mtx);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-03-14 12:05:44 +00:00
|
|
|
|
bioq_remove(&fdp->queue, bp);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
mtx_unlock(&fdp->queue_mtx);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
Nine'th update to the new ATA/ATAPI driver:
The atapi subsystem has gotten better error handeling and timeouts,
it also tries a REQUEST SENSE command when devices returns errors,
to give a little more info as to what went wrong. It might be a
little verbose for now, but I'm interested in as much feedback on
errors as possible, especially timeouts, as I'm a bit in doubt if
I've chosen resonable default values everywhere.
The disk driver has been changed a bit to prepare for tagged queing,
which is next on my list.
The disk driver has grown a dump routine, I got one implementation
from Darrell Anderson <anderson@cs.duke.edu> which also did
partial dumps (usefull on big memory machines) I left out the
partial stuff for now, and changed the rest alot to fit into the new
ad_request framework.
Some minor cleanups and rearrangements as well.
As usual USE AT YOUR OWN RISK!!, this is still pre alpha level code.
Especially the DMA support can hose your disk real bad if anything
goes wrong, again you have been warned :)
Notebook owners should be carefull that their machines dont suspend
as this might cause trouble...
But please tell me how it works for you!
Enjoy!
-Søren
1999-06-25 09:03:07 +00:00
|
|
|
|
/* should reject all queued entries if media have changed. */
|
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 (fdp->device->flags & ATA_D_MEDIA_CHANGED) {
|
2001-05-06 20:00:03 +00:00
|
|
|
|
biofinish(bp, NULL, EIO);
|
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
|
|
|
|
return;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-15 05:54:02 +00:00
|
|
|
|
lba = bp->bio_pblkno;
|
2002-07-28 23:59:00 +00:00
|
|
|
|
count = bp->bio_bcount / fdp->cap.sector_size;
|
2002-06-19 12:41:05 +00:00
|
|
|
|
bp->bio_resid = bp->bio_bcount;
|
1999-03-07 21:49:14 +00:00
|
|
|
|
|
1999-05-17 15:58:47 +00:00
|
|
|
|
bzero(ccb, sizeof(ccb));
|
|
|
|
|
|
2000-04-15 05:54:02 +00:00
|
|
|
|
if (bp->bio_cmd == BIO_READ)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
ccb[0] = ATAPI_READ_BIG;
|
|
|
|
|
else
|
|
|
|
|
ccb[0] = ATAPI_WRITE_BIG;
|
|
|
|
|
|
1999-05-20 09:12:06 +00:00
|
|
|
|
ccb[2] = lba>>24;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
ccb[3] = lba>>16;
|
|
|
|
|
ccb[4] = lba>>8;
|
1999-05-20 09:12:06 +00:00
|
|
|
|
ccb[5] = lba;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
ccb[7] = count>>8;
|
|
|
|
|
ccb[8] = count;
|
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
if (!(request = ata_alloc_request())) {
|
2004-01-12 09:33:10 +00:00
|
|
|
|
biofinish(bp, NULL, ENOMEM);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
request->device = atadev;
|
|
|
|
|
request->driver = bp;
|
|
|
|
|
bcopy(ccb, request->u.atapi.ccb,
|
|
|
|
|
(request->device->param->config & ATA_PROTO_MASK) ==
|
|
|
|
|
ATA_PROTO_ATAPI_12 ? 16 : 12);
|
|
|
|
|
request->data = bp->bio_data;
|
|
|
|
|
request->bytecount = count * fdp->cap.sector_size;
|
|
|
|
|
request->transfersize = min(request->bytecount, 65534);
|
|
|
|
|
request->timeout = (ccb[0] == ATAPI_WRITE_BIG) ? 60 : 30;
|
|
|
|
|
request->retries = 2;
|
|
|
|
|
request->callback = afd_done;
|
|
|
|
|
switch (bp->bio_cmd) {
|
|
|
|
|
case BIO_READ:
|
2004-01-28 20:38:51 +00:00
|
|
|
|
request->flags |= (ATA_R_ATAPI | ATA_R_READ);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case BIO_WRITE:
|
2004-01-28 20:38:51 +00:00
|
|
|
|
request->flags |= (ATA_R_ATAPI | ATA_R_WRITE);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ata_prtdev(atadev, "unknown BIO operation\n");
|
|
|
|
|
ata_free_request(request);
|
|
|
|
|
biofinish(bp, NULL, EIO);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ata_queue_request(request);
|
|
|
|
|
|
1999-05-20 09:12:06 +00:00
|
|
|
|
}
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
static void
|
|
|
|
|
afd_done(struct ata_request *request)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
2000-04-15 05:54:02 +00:00
|
|
|
|
struct bio *bp = request->driver;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
/* finish up transfer */
|
|
|
|
|
if ((bp->bio_error = request->result))
|
2000-04-15 05:54:02 +00:00
|
|
|
|
bp->bio_flags |= BIO_ERROR;
|
2003-08-24 09:22:26 +00:00
|
|
|
|
bp->bio_resid = bp->bio_bcount - request->donecount;
|
2003-03-08 08:01:31 +00:00
|
|
|
|
biodone(bp);
|
2003-08-24 09:22:26 +00:00
|
|
|
|
ata_free_request(request);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int
|
|
|
|
|
afd_eject(struct afd_softc *fdp, int close)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
2000-09-19 11:08:39 +00:00
|
|
|
|
int error;
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
|
1999-09-22 12:04:51 +00:00
|
|
|
|
if ((error = afd_start_stop(fdp, 0)) == EBUSY) {
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
if (!close)
|
|
|
|
|
return 0;
|
|
|
|
|
if ((error = afd_start_stop(fdp, 3)))
|
1999-03-03 21:10:29 +00:00
|
|
|
|
return error;
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
return afd_prevent_allow(fdp, 1);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
Nine'th update to the new ATA/ATAPI driver:
The atapi subsystem has gotten better error handeling and timeouts,
it also tries a REQUEST SENSE command when devices returns errors,
to give a little more info as to what went wrong. It might be a
little verbose for now, but I'm interested in as much feedback on
errors as possible, especially timeouts, as I'm a bit in doubt if
I've chosen resonable default values everywhere.
The disk driver has been changed a bit to prepare for tagged queing,
which is next on my list.
The disk driver has grown a dump routine, I got one implementation
from Darrell Anderson <anderson@cs.duke.edu> which also did
partial dumps (usefull on big memory machines) I left out the
partial stuff for now, and changed the rest alot to fit into the new
ad_request framework.
Some minor cleanups and rearrangements as well.
As usual USE AT YOUR OWN RISK!!, this is still pre alpha level code.
Especially the DMA support can hose your disk real bad if anything
goes wrong, again you have been warned :)
Notebook owners should be carefull that their machines dont suspend
as this might cause trouble...
But please tell me how it works for you!
Enjoy!
-Søren
1999-06-25 09:03:07 +00:00
|
|
|
|
if (error)
|
Ten'th update to the new ATA/ATAPI driver:
It been awhile since the last major update, as a benefit there
are some cool things in this one (and new bugs probably :) )...
The ATA driver has grown "real" timeout support for all devices.
This means that it should be possible to get in contact with
(especially) lost ATAPI devices. It also means that the ATA
driver is now usable on notebooks as it will DTRT on resume.
An experimental hack at utilizing the Promise66's at UDMA66 is
in there, but I cant test it. If someone feels like sending
me one, give me a ping.
The ATAPI DMA enableling scheme has been changed, also better DMA
support for the Aladdin chipset has been implemented for ATAPI
devices. Note that the Aladdin apparently only can do DMA reads
on ATAPI devices, and the Promise cant do ATAPI DMA at all.
I have seen problems on some ATAPI devices that should be able
to run in DMA mode, so if you encounter problems with hanging
atapi devices during the probe, or during access, disable DMA
in atapi-all.c, and let me know. It might be nessesary to do this
via a "white list" for known good devices...
The ATAPI CDROM driver can now use eject/close without hanging and
the bug that caused reading beyond the end of a CD has been fixed.
Media change is also handled proberly. DVD drives are identified
and are usable as CDROM devices at least, I dont have the HW to
test this further, see above :).
The ATAPI tape driver has gotten some support for using the DSC
method for not blocking the IDE channel during read/write when
the device has full buffers. It knows about the OnStream DI-30
device, support is not completed yet, but it can function as a
primitive backup medium, without filemarks, and without bad media
handeling. This is because the OnStream device doesn't handle this
(like everybody else) in HW. It also now supports getting/setting
the record position on devices that supports it.
Some rather major cleanups and rearrangements as well (cvs -b diff
is your freind). I'm closing in on declaring this for beta code,
most of the infrastruture is in place by now.
As usual USE AT YOUR OWN RISK!!, this is still alpha level code.
This driver can hose your disk real bad if anything goes wrong, but
now you have been warned :)
But please tell me how it works for you!
Enjoy!
-Søren
1999-09-21 19:50:40 +00:00
|
|
|
|
return error;
|
1999-03-03 21:10:29 +00:00
|
|
|
|
if (close)
|
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
|
|
|
|
return 0;
|
|
|
|
|
if ((error = afd_prevent_allow(fdp, 0)))
|
Nine'th update to the new ATA/ATAPI driver:
The atapi subsystem has gotten better error handeling and timeouts,
it also tries a REQUEST SENSE command when devices returns errors,
to give a little more info as to what went wrong. It might be a
little verbose for now, but I'm interested in as much feedback on
errors as possible, especially timeouts, as I'm a bit in doubt if
I've chosen resonable default values everywhere.
The disk driver has been changed a bit to prepare for tagged queing,
which is next on my list.
The disk driver has grown a dump routine, I got one implementation
from Darrell Anderson <anderson@cs.duke.edu> which also did
partial dumps (usefull on big memory machines) I left out the
partial stuff for now, and changed the rest alot to fit into the new
ad_request framework.
Some minor cleanups and rearrangements as well.
As usual USE AT YOUR OWN RISK!!, this is still pre alpha level code.
Especially the DMA support can hose your disk real bad if anything
goes wrong, again you have been warned :)
Notebook owners should be carefull that their machines dont suspend
as this might cause trouble...
But please tell me how it works for you!
Enjoy!
-Søren
1999-06-25 09:03:07 +00:00
|
|
|
|
return error;
|
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
|
|
|
|
fdp->device->flags |= ATA_D_MEDIA_CHANGED;
|
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
|
|
|
|
return afd_start_stop(fdp, 2);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int
|
|
|
|
|
afd_start_stop(struct afd_softc *fdp, int start)
|
1999-03-03 21:10:29 +00:00
|
|
|
|
{
|
2000-11-12 20:41:24 +00:00
|
|
|
|
int8_t ccb[16] = { ATAPI_START_STOP, 0, 0, 0, start,
|
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
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
1999-03-03 21:10:29 +00:00
|
|
|
|
|
2003-08-24 09:22:26 +00:00
|
|
|
|
return ata_atapicmd(fdp->device, ccb, NULL, 0, 0, 30);
|
1999-03-03 21:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-19 11:08:39 +00:00
|
|
|
|
static int
|
|
|
|
|
afd_prevent_allow(struct afd_softc *fdp, int lock)
|
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
|
|
|
|
{
|
|
|
|
|
int8_t ccb[16] = { ATAPI_PREVENT_ALLOW, 0, 0, 0, lock,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
|
|
Major update of the ATA RAID code, part 1:
Overhaul of the attach/detach code and structures, there were some nasty
bugs in the old implementation. This made it possible to collapse the
ATA/ATAPI device control structures into one generic structure.
A note here, the kernel is NOT ready for detach of active devices,
it fails all over in random places, but for inactive devices it works.
However for ATA RAID this works, since the RAID abstration layer
insulates the buggy^H^H^H^H^H^Hfragile device subsystem from the
physical disks.
Proberly detect the RAID's from the BIOS, and mark critical RAID1
arrays as such, but continue if there is enough of the mirror left
to do so.
Properly fail arrays on a live system. For RAID0 that means return EIO,
and for RAID1 it means continue on the still working part of the mirror
if possible, else return EIO.
If the state changes, log this to the console.
Allow for Promise & Highpoint controllers/arrays to coexist on the
same machine. It is not possible to distribute arrays over different
makes of controllers though.
If Promise SuperSwap enclosures are used, signal disk state on the
status LED on the front.
Misc fixes that I had lying around for various minor bugs.
Sponsored by: Advanis Inc.
2002-02-04 19:23:40 +00:00
|
|
|
|
if (!strncmp(fdp->device->param->model, "IOMEGA Clik!", 12))
|
2001-03-14 12:12:46 +00:00
|
|
|
|
return 0;
|
2003-08-24 09:22:26 +00:00
|
|
|
|
return ata_atapicmd(fdp->device, ccb, NULL, 0, 0, 30);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
afd_test_ready(struct ata_device *atadev)
|
|
|
|
|
{
|
|
|
|
|
int8_t ccb[16] = { ATAPI_TEST_UNIT_READY, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
|
|
return ata_atapicmd(atadev, ccb, NULL, 0, 0, 30);
|
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
|
|
|
|
}
|