Ignore machine-check MSRs
[freebsd-src/fkvm-freebsd.git] / sys / dev / ata / atapi-tape.h
blob0d4dedff4989f433e77b333dfebaeee8977410ec
1 /*-
2 * Copyright (c) 1998 - 2008 Søren Schmidt <sos@FreeBSD.org>
3 * All rights reserved.
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.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * $FreeBSD$
29 /* ATAPI tape drive Capabilities and Mechanical Status Page */
30 struct ast_cappage {
31 /* mode page data header */
32 u_int8_t data_length; /* total length of data */
33 u_int8_t medium_type; /* medium type (if any) */
34 u_int8_t reserved :4;
35 u_int8_t mode :3; /* buffering mode */
36 u_int8_t write_protect :1; /* media is writeprotected */
37 u_int8_t blk_desc_len; /* block Descriptor Length */
39 /* capabilities page */
40 u_int8_t page_code :6;
41 #define ATAPI_TAPE_CAP_PAGE 0x2a
43 u_int8_t reserved0_6 :1;
44 u_int8_t ps :1; /* parameters saveable */
45 u_int8_t page_length; /* page Length == 0x12 */
46 u_int8_t reserved2;
47 u_int8_t reserved3;
48 u_int8_t readonly :1; /* read Only Mode */
49 u_int8_t reserved4_1234 :4;
50 u_int8_t reverse :1; /* supports reverse direction */
51 u_int8_t reserved4_67 :2;
52 u_int8_t reserved5_012 :3;
53 u_int8_t eformat :1; /* supports ERASE formatting */
54 u_int8_t reserved5_4 :1;
55 u_int8_t qfa :1; /* supports QFA formats */
56 u_int8_t reserved5_67 :2;
57 u_int8_t lock :1; /* supports locking media */
58 u_int8_t locked :1; /* the media is locked */
59 u_int8_t prevent :1; /* defaults to prevent state */
60 u_int8_t eject :1; /* supports eject */
61 u_int8_t disconnect :1; /* can break request > ctl */
62 u_int8_t reserved6_5 :1;
63 u_int8_t ecc :1; /* supports error correction */
64 u_int8_t compress :1; /* supports data compression */
65 u_int8_t reserved7_0 :1;
66 u_int8_t blk512 :1; /* supports 512b block size */
67 u_int8_t blk1024 :1; /* supports 1024b block size */
68 u_int8_t reserved7_3456 :4;
69 u_int8_t blk32k :1; /* supports 32kb block size */
70 u_int16_t max_speed; /* supported speed in KBps */
71 u_int16_t max_defects; /* max stored defect entries */
72 u_int16_t ctl; /* continuous transfer limit */
73 u_int16_t speed; /* current Speed, in KBps */
74 u_int16_t buffer_size; /* buffer Size, in 512 bytes */
75 u_int8_t reserved18;
76 u_int8_t reserved19;
79 /* ATAPI OnStream ADR data transfer mode page (ADR unique) */
80 struct ast_transferpage {
81 /* mode page data header */
82 u_int8_t data_length; /* total length of data */
83 u_int8_t medium_type; /* medium type (if any) */
84 u_int8_t dsp; /* device specific parameter */
85 u_int8_t blk_desc_len; /* block Descriptor Length */
87 /* data transfer page */
88 u_int8_t page_code :6;
89 #define ATAPI_TAPE_TRANSFER_PAGE 0x30
91 u_int8_t reserved0_6 :1;
92 u_int8_t ps :1; /* parameters saveable */
93 u_int8_t page_length; /* page Length == 0x02 */
94 u_int8_t reserved2;
95 u_int8_t read32k :1; /* 32k blk size (data only) */
96 u_int8_t read32k5 :1; /* 32.5k blk size (data&AUX) */
97 u_int8_t reserved3_23 :2;
98 u_int8_t write32k :1; /* 32k blk size (data only) */
99 u_int8_t write32k5 :1; /* 32.5k blk size (data&AUX) */
100 u_int8_t reserved3_6 :1;
101 u_int8_t streaming :1; /* streaming mode enable */
104 /* ATAPI OnStream ADR vendor identification mode page (ADR unique) */
105 struct ast_identifypage {
106 /* mode page data header */
107 u_int8_t data_length; /* total length of data */
108 u_int8_t medium_type; /* medium type (if any) */
109 u_int8_t dsp; /* device specific parameter */
110 u_int8_t blk_desc_len; /* block Descriptor Length */
112 /* data transfer page */
113 u_int8_t page_code :6;
114 #define ATAPI_TAPE_IDENTIFY_PAGE 0x36
116 u_int8_t reserved0_6 :1;
117 u_int8_t ps :1; /* parameters saveable */
118 u_int8_t page_length; /* page Length == 0x06 */
119 u_int8_t ident[4]; /* host id string */
120 u_int8_t reserved6;
121 u_int8_t reserved7;
124 /* ATAPI read position structure */
125 struct ast_readposition {
126 u_int8_t reserved0_05 :6;
127 u_int8_t eop :1; /* end of partition */
128 u_int8_t bop :1; /* beginning of partition */
129 u_int8_t reserved1;
130 u_int8_t reserved2;
131 u_int8_t reserved3;
132 u_int32_t host; /* frame address in buffer */
133 u_int32_t tape; /* frame address on tape */
134 u_int8_t reserved12;
135 u_int8_t reserved13;
136 u_int8_t reserved14;
137 u_int8_t blks_in_buf; /* blocks in buffer */
138 u_int8_t reserved16;
139 u_int8_t reserved17;
140 u_int8_t reserved18;
141 u_int8_t reserved19;
144 struct ast_softc {
145 int flags; /* device state flags */
146 #define F_CTL_WARN 0x0001 /* warned about CTL wrong? */
147 #define F_WRITEPROTECT 0x0002 /* media is writeprotected */
148 #define F_DATA_WRITTEN 0x0004 /* data has been written */
149 #define F_FM_WRITTEN 0x0008 /* filemark has been written */
150 #define F_ONSTREAM 0x0100 /* OnStream ADR device */
152 int blksize; /* block size (512 | 1024) */
153 struct atapi_params *param; /* drive parameters table */
154 struct ast_cappage cap; /* capabilities page info */
155 struct devstat *stats; /* devstat entry */
156 struct cdev *dev1, *dev2; /* device place holders */