2 * Copyright (c) 1998,1999,2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
28 * $FreeBSD: src/sys/dev/ata/atapi-tape.h,v 1.11.2.5 2002/03/18 08:37:34 sos Exp $
29 * $DragonFly: src/sys/dev/disk/ata/atapi-tape.h,v 1.4 2006/02/17 19:17:54 dillon Exp $
32 /* ATAPI tape drive Capabilities and Mechanical Status Page */
34 /* mode page data header */
35 u_int8_t data_length
; /* total length of data */
36 u_int8_t medium_type
; /* medium type (if any) */
38 u_int8_t mode
:3; /* buffering mode */
39 u_int8_t write_protect
:1; /* media is writeprotected */
40 u_int8_t blk_desc_len
; /* block Descriptor Length */
42 /* capabilities page */
43 u_int8_t page_code
:6;
44 #define ATAPI_TAPE_CAP_PAGE 0x2a
46 u_int8_t reserved0_6
:1;
47 u_int8_t ps
:1; /* parameters saveable */
48 u_int8_t page_length
; /* page Length == 0x12 */
51 u_int8_t readonly
:1; /* read Only Mode */
52 u_int8_t reserved4_1234
:4;
53 u_int8_t reverse
:1; /* supports reverse direction */
54 u_int8_t reserved4_67
:2;
55 u_int8_t reserved5_012
:3;
56 u_int8_t eformat
:1; /* supports ERASE formatting */
57 u_int8_t reserved5_4
:1;
58 u_int8_t qfa
:1; /* supports QFA formats */
59 u_int8_t reserved5_67
:2;
60 u_int8_t lock
:1; /* supports locking media */
61 u_int8_t locked
:1; /* the media is locked */
62 u_int8_t prevent
:1; /* defaults to prevent state */
63 u_int8_t eject
:1; /* supports eject */
64 u_int8_t disconnect
:1; /* can break request > ctl */
65 u_int8_t reserved6_5
:1;
66 u_int8_t ecc
:1; /* supports error correction */
67 u_int8_t compress
:1; /* supports data compression */
68 u_int8_t reserved7_0
:1;
69 u_int8_t blk512
:1; /* supports 512b block size */
70 u_int8_t blk1024
:1; /* supports 1024b block size */
71 u_int8_t reserved7_3456
:4;
72 u_int8_t blk32k
:1; /* supports 32kb block size */
73 u_int16_t max_speed
; /* supported speed in KBps */
74 u_int16_t max_defects
; /* max stored defect entries */
75 u_int16_t ctl
; /* continuous transfer limit */
76 u_int16_t speed
; /* current Speed, in KBps */
77 u_int16_t buffer_size
; /* buffer Size, in 512 bytes */
82 /* ATAPI OnStream ADR data transfer mode page (ADR unique) */
83 struct ast_transferpage
{
84 /* mode page data header */
85 u_int8_t data_length
; /* total length of data */
86 u_int8_t medium_type
; /* medium type (if any) */
87 u_int8_t dsp
; /* device specific parameter */
88 u_int8_t blk_desc_len
; /* block Descriptor Length */
90 /* data transfer page */
91 u_int8_t page_code
:6;
92 #define ATAPI_TAPE_TRANSFER_PAGE 0x30
94 u_int8_t reserved0_6
:1;
95 u_int8_t ps
:1; /* parameters saveable */
96 u_int8_t page_length
; /* page Length == 0x02 */
98 u_int8_t read32k
:1; /* 32k blk size (data only) */
99 u_int8_t read32k5
:1; /* 32.5k blk size (data&AUX) */
100 u_int8_t reserved3_23
:2;
101 u_int8_t write32k
:1; /* 32k blk size (data only) */
102 u_int8_t write32k5
:1; /* 32.5k blk size (data&AUX) */
103 u_int8_t reserved3_6
:1;
104 u_int8_t streaming
:1; /* streaming mode enable */
107 /* ATAPI OnStream ADR vendor identification mode page (ADR unique) */
108 struct ast_identifypage
{
109 /* mode page data header */
110 u_int8_t data_length
; /* total length of data */
111 u_int8_t medium_type
; /* medium type (if any) */
112 u_int8_t dsp
; /* device specific parameter */
113 u_int8_t blk_desc_len
; /* block Descriptor Length */
115 /* data transfer page */
116 u_int8_t page_code
:6;
117 #define ATAPI_TAPE_IDENTIFY_PAGE 0x36
119 u_int8_t reserved0_6
:1;
120 u_int8_t ps
:1; /* parameters saveable */
121 u_int8_t page_length
; /* page Length == 0x06 */
122 u_int8_t ident
[4]; /* host id string */
127 /* ATAPI read position structure */
128 struct ast_readposition
{
129 u_int8_t reserved0_05
:6;
130 u_int8_t eop
:1; /* end of partition */
131 u_int8_t bop
:1; /* beginning of partition */
135 u_int32_t host
; /* frame address in buffer */
136 u_int32_t tape
; /* frame address on tape */
140 u_int8_t blks_in_buf
; /* blocks in buffer */
148 struct ata_device
*device
; /* device softc */
149 int lun
; /* logical device unit */
150 int flags
; /* device state flags */
151 #define F_CTL_WARN 0x0001 /* warned about CTL wrong? */
152 #define F_WRITEPROTECT 0x0002 /* media is writeprotected */
153 #define F_DATA_WRITTEN 0x0004 /* data has been written */
154 #define F_FM_WRITTEN 0x0008 /* filemark has been written */
155 #define F_ONSTREAM 0x0100 /* OnStream ADR device */
157 int blksize
; /* block size (512 | 1024) */
158 struct bio_queue_head bio_queue
; /* queue of i/o requests */
159 struct atapi_params
*param
; /* drive parameters table */
160 struct ast_cappage cap
; /* capabilities page info */
161 struct devstat stats
; /* devstat entry */