Merge from vendor branch CVS:
[dragonfly.git] / sys / dev / disk / ata / atapi-fd.h
1 /*-
2  * Copyright (c) 1998,1999,2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer,
10  *    without modification, immediately at the beginning of the file.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD: src/sys/dev/ata/atapi-fd.h,v 1.10.2.5 2002/07/31 11:19:26 sos Exp $
29  * $DragonFly: src/sys/dev/disk/ata/atapi-fd.h,v 1.2 2003/06/17 04:28:22 dillon Exp $
30  */
31
32 /* ATAPI Rewriteable drive Capabilities and Mechanical Status Page */
33 struct afd_cappage {
34     u_int16_t   data_length;
35     u_int8_t    medium_type;
36 #define MFD_2DD_UN              0x10
37 #define MFD_2DD                 0x11
38 #define MFD_HD_UN               0x20
39 #define MFD_HD_12_98            0x22
40 #define MFD_HD_12               0x23
41 #define MFD_HD_144              0x24
42 #define MFD_UHD                 0x31
43
44 #define MFD_UNKNOWN             0x00
45 #define MFD_NO_DISC             0x70
46 #define MFD_DOOR_OPEN           0x71
47 #define MFD_FMT_ERROR           0x72
48
49     u_int8_t    reserved0       :7;
50     u_int8_t    wp              :1;             /* write protect */
51     u_int8_t    unused[4];
52
53     /* capabilities page */
54     u_int8_t    page_code       :6;
55 #define ATAPI_REWRITEABLE_CAP_PAGE        0x05
56
57     u_int8_t    reserved1_6     :1;
58     u_int8_t    ps              :1;             /* page save supported */
59     u_int8_t    page_length;                    /* page length */
60     u_int16_t   transfer_rate;                  /* in kilobits per second */
61     u_int8_t    heads;                          /* number of heads */
62     u_int8_t    sectors;                        /* number of sectors pr track */
63     u_int16_t   sector_size;                    /* number of bytes per sector */
64     u_int16_t   cylinders;                      /* number of cylinders */
65     u_int8_t    reserved10[10];
66     u_int8_t    motor_delay;                    /* motor off delay */
67     u_int8_t    reserved21[7];
68     u_int16_t   rpm;                            /* rotations per minute */
69     u_int8_t    reserved30[2];
70 };
71
72 struct afd_softc {
73     struct ata_device           *device;        /* device softc */
74     int                         lun;            /* logical device unit */
75     struct buf_queue_head       queue;          /* queue of i/o requests */
76     struct afd_cappage          cap;            /* capabilities page info */
77     struct disk                 disk;           /* virtual drives */
78     struct devstat              stats;
79     dev_t                       dev;            /* device place holder */
80 };
81