xref: /dragonfly/sys/dev/disk/nata/atapi-fd.h (revision 2458a87a)
1c1b3d7c5SThomas E. Spanjaard /*-
2*2458a87aSzrj  * Copyright (c) 1998 - 2008 Søren Schmidt <sos@FreeBSD.org>
3c1b3d7c5SThomas E. Spanjaard  * All rights reserved.
4c1b3d7c5SThomas E. Spanjaard  *
5c1b3d7c5SThomas E. Spanjaard  * Redistribution and use in source and binary forms, with or without
6c1b3d7c5SThomas E. Spanjaard  * modification, are permitted provided that the following conditions
7c1b3d7c5SThomas E. Spanjaard  * are met:
8c1b3d7c5SThomas E. Spanjaard  * 1. Redistributions of source code must retain the above copyright
9c1b3d7c5SThomas E. Spanjaard  *    notice, this list of conditions and the following disclaimer,
10c1b3d7c5SThomas E. Spanjaard  *    without modification, immediately at the beginning of the file.
11c1b3d7c5SThomas E. Spanjaard  * 2. Redistributions in binary form must reproduce the above copyright
12c1b3d7c5SThomas E. Spanjaard  *    notice, this list of conditions and the following disclaimer in the
13c1b3d7c5SThomas E. Spanjaard  *    documentation and/or other materials provided with the distribution.
14c1b3d7c5SThomas E. Spanjaard  *
15c1b3d7c5SThomas E. Spanjaard  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16c1b3d7c5SThomas E. Spanjaard  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17c1b3d7c5SThomas E. Spanjaard  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18c1b3d7c5SThomas E. Spanjaard  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19c1b3d7c5SThomas E. Spanjaard  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20c1b3d7c5SThomas E. Spanjaard  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21c1b3d7c5SThomas E. Spanjaard  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22c1b3d7c5SThomas E. Spanjaard  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23c1b3d7c5SThomas E. Spanjaard  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24c1b3d7c5SThomas E. Spanjaard  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25c1b3d7c5SThomas E. Spanjaard  *
26c1b3d7c5SThomas E. Spanjaard  * $FreeBSD: src/sys/dev/ata/atapi-fd.h,v 1.26 2006/03/05 20:30:54 sos Exp $
27c1b3d7c5SThomas E. Spanjaard  */
28c1b3d7c5SThomas E. Spanjaard 
29c1b3d7c5SThomas E. Spanjaard #include <sys/param.h>
30c1b3d7c5SThomas E. Spanjaard #include <sys/devicestat.h>
31c1b3d7c5SThomas E. Spanjaard #include <sys/disk.h>
32c1b3d7c5SThomas E. Spanjaard 
33c1b3d7c5SThomas E. Spanjaard /* ATAPI Rewriteable drive Capabilities and Mechanical Status Page */
34c1b3d7c5SThomas E. Spanjaard struct afd_capabilities {
35c1b3d7c5SThomas E. Spanjaard     u_int16_t   data_length;
36c1b3d7c5SThomas E. Spanjaard     u_int8_t    medium_type;
37c1b3d7c5SThomas E. Spanjaard #define MFD_2DD_UN              0x10
38c1b3d7c5SThomas E. Spanjaard #define MFD_2DD                 0x11
39c1b3d7c5SThomas E. Spanjaard #define MFD_HD_UN               0x20
40c1b3d7c5SThomas E. Spanjaard #define MFD_HD_12_98            0x22
41c1b3d7c5SThomas E. Spanjaard #define MFD_HD_12               0x23
42c1b3d7c5SThomas E. Spanjaard #define MFD_HD_144              0x24
43c1b3d7c5SThomas E. Spanjaard #define MFD_UHD                 0x31
44c1b3d7c5SThomas E. Spanjaard 
45c1b3d7c5SThomas E. Spanjaard #define MFD_UNKNOWN             0x00
46c1b3d7c5SThomas E. Spanjaard #define MFD_NO_DISC             0x70
47c1b3d7c5SThomas E. Spanjaard #define MFD_DOOR_OPEN           0x71
48c1b3d7c5SThomas E. Spanjaard #define MFD_FMT_ERROR           0x72
49c1b3d7c5SThomas E. Spanjaard 
50c1b3d7c5SThomas E. Spanjaard     u_int8_t    reserved0       :7;
51c1b3d7c5SThomas E. Spanjaard     u_int8_t    wp              :1;             /* write protect */
52c1b3d7c5SThomas E. Spanjaard     u_int8_t    unused[4];
53c1b3d7c5SThomas E. Spanjaard 
54c1b3d7c5SThomas E. Spanjaard     /* capabilities page */
55c1b3d7c5SThomas E. Spanjaard     u_int8_t    page_code       :6;
56c1b3d7c5SThomas E. Spanjaard #define ATAPI_REWRITEABLE_CAP_PAGE        0x05
57c1b3d7c5SThomas E. Spanjaard 
58c1b3d7c5SThomas E. Spanjaard     u_int8_t    reserved1_6     :1;
59c1b3d7c5SThomas E. Spanjaard     u_int8_t    ps              :1;             /* page save supported */
60c1b3d7c5SThomas E. Spanjaard     u_int8_t    page_length;                    /* page length */
61c1b3d7c5SThomas E. Spanjaard     u_int16_t   transfer_rate;                  /* in kilobits per second */
62c1b3d7c5SThomas E. Spanjaard     u_int8_t    heads;                          /* number of heads */
63c1b3d7c5SThomas E. Spanjaard     u_int8_t    sectors;                        /* number of sectors pr track */
64c1b3d7c5SThomas E. Spanjaard     u_int16_t   sector_size;                    /* number of bytes per sector */
65c1b3d7c5SThomas E. Spanjaard     u_int16_t   cylinders;                      /* number of cylinders */
66c1b3d7c5SThomas E. Spanjaard     u_int8_t    reserved10[10];
67c1b3d7c5SThomas E. Spanjaard     u_int8_t    motor_delay;                    /* motor off delay */
68c1b3d7c5SThomas E. Spanjaard     u_int8_t    reserved21[7];
69c1b3d7c5SThomas E. Spanjaard     u_int16_t   rpm;                            /* rotations per minute */
70c1b3d7c5SThomas E. Spanjaard     u_int8_t    reserved30[2];
71c1b3d7c5SThomas E. Spanjaard };
72c1b3d7c5SThomas E. Spanjaard 
73c1b3d7c5SThomas E. Spanjaard struct afd_capacity {
74c1b3d7c5SThomas E. Spanjaard     u_int32_t	capacity;
75c1b3d7c5SThomas E. Spanjaard     u_int32_t	blocksize;
76c1b3d7c5SThomas E. Spanjaard };
77c1b3d7c5SThomas E. Spanjaard 
78c1b3d7c5SThomas E. Spanjaard struct afd_capacity_big {
79c1b3d7c5SThomas E. Spanjaard     u_int64_t	capacity;
80c1b3d7c5SThomas E. Spanjaard     u_int32_t	blocksize;
81c1b3d7c5SThomas E. Spanjaard };
82c1b3d7c5SThomas E. Spanjaard 
83c1b3d7c5SThomas E. Spanjaard struct afd_softc {
84c1b3d7c5SThomas E. Spanjaard     u_int64_t		mediasize;
85c1b3d7c5SThomas E. Spanjaard     u_int32_t		heads;
86c1b3d7c5SThomas E. Spanjaard     u_int32_t		sectors;
87c1b3d7c5SThomas E. Spanjaard     u_int32_t		sectorsize;
88c1b3d7c5SThomas E. Spanjaard     struct devstat	stats;
89c1b3d7c5SThomas E. Spanjaard     struct disk		disk;			/* virtual drives */
90c1b3d7c5SThomas E. Spanjaard     cdev_t		cdev;			/* device placeholder */
91c1b3d7c5SThomas E. Spanjaard };
92