mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-29 12:03:03 +00:00
3427651043
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
88 lines
3.3 KiB
C
88 lines
3.3 KiB
C
/*-
|
|
* Copyright (c) 1998,1999 Søren Schmidt
|
|
* 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.
|
|
*
|
|
* $FreeBSD$
|
|
*/
|
|
|
|
/* MODE SENSE parameter header */
|
|
struct afd_header {
|
|
u_int16_t data_length;
|
|
u_int8_t medium_type;
|
|
#define MFD_2DD_UN 0x10
|
|
#define MFD_2DD 0x11
|
|
#define MFD_HD_UN 0x20
|
|
#define MFD_HD_12_98 0x22
|
|
#define MFD_HD_12 0x23
|
|
#define MFD_HD_144 0x24
|
|
#define MFD_UHD 0x31
|
|
|
|
#define MFD_UNKNOWN 0x00
|
|
#define MFD_NO_DISC 0x70
|
|
#define MFD_DOOR_OPEN 0x71
|
|
#define MFD_FMT_ERROR 0x72
|
|
|
|
u_int8_t reserved0 :7;
|
|
u_int8_t wp :1; /* write protect */
|
|
u_int8_t unused[4];
|
|
};
|
|
|
|
/* ATAPI Rewriteable drive Capabilities and Mechanical Status Page */
|
|
struct afd_cappage {
|
|
u_int8_t page_code :6;
|
|
#define ATAPI_REWRITEABLE_CAP_PAGE 0x05
|
|
|
|
u_int8_t reserved1_6 :1;
|
|
u_int8_t ps :1; /* page save supported */
|
|
u_int8_t page_length; /* page length */
|
|
u_int16_t transfer_rate; /* in kilobits per second */
|
|
u_int8_t heads; /* number of heads */
|
|
u_int8_t sectors; /* number of sectors per track */
|
|
u_int16_t sector_size; /* number of bytes per sector */
|
|
u_int16_t cylinders; /* number of cylinders */
|
|
u_int8_t reserved10[10];
|
|
u_int8_t motor_delay; /* motor off delay */
|
|
u_int8_t reserved21[7];
|
|
u_int16_t rpm; /* rotations per minute */
|
|
u_int8_t reserved30[2];
|
|
};
|
|
|
|
struct afd_softc {
|
|
struct atapi_softc *atp; /* controller structure */
|
|
int32_t lun; /* logical device unit */
|
|
int32_t flags; /* device state flags */
|
|
#define F_OPEN 0x0001 /* the device is opened */
|
|
|
|
int32_t refcnt; /* the number of raw opens */
|
|
int32_t transfersize; /* max size of each transfer */
|
|
struct buf_queue_head buf_queue; /* queue of i/o requests */
|
|
struct afd_header header; /* capabilities page info */
|
|
struct afd_cappage cap; /* capabilities page info */
|
|
struct disk disk; /* virtual drives */
|
|
struct devstat stats;
|
|
};
|
|
|