1 /* $NetBSD: atapi_tape.h,v 1.2 2001/12/01 00:03:45 bouyer Exp $ */ 2 3 4 /*- 5 * Copyright (c) 1998,1999,2000,2001 S�ren Schmidt 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer, 13 * without modification, immediately at the beginning of the file. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. The name of the author may not be used to endorse or promote products 18 * derived from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * $FreeBSD: src/sys/dev/ata/atapi-tape.h,v 1.15 2001/03/14 12:05:44 sos Exp $ 32 */ 33 34 /* defines for the device specific byte in the mode select/sense header */ 35 #define SMH_DSP_BUFF_MODE 0x70 36 #define SMH_DSP_BUFF_MODE_OFF 0x00 37 #define SMH_DSP_BUFF_MODE_ON 0x10 38 #define SMH_DSP_BUFF_MODE_MLTI 0x20 39 #define SMH_DSP_WRITE_PROT 0x80 40 41 /* ATAPI tape drive Capabilities and Mechanical Status Page */ 42 struct atapi_cappage { 43 /* mode page data header */ 44 struct scsipi_mode_header header; 45 /* capabilities page */ 46 u_int8_t page_code; 47 #define ATAPI_TAPE_CAP_PAGE 0x2a 48 u_int8_t page_length; /* page Length == 0x12 */ 49 u_int8_t reserved2; 50 u_int8_t reserved3; 51 u_int8_t cap1; 52 #define ATAPI_TAPE_CAP_PAGE_RO 0x01; /* read Only Mode */ 53 #define ATAPI_TAPE_CAP_PAGE_REV 0x20; /* supports reverse direction */ 54 u_int8_t cap2; 55 #define ATAPI_TAPE_CAP_PAGE_EF 0x08; /* supports ERASE formatting */ 56 #define ATAPI_TAPE_CAP_PAGE_QFA 0x20 /* supports QFA formats */ 57 u_int8_t cap3; 58 #define ATAPI_TAPE_CAP_PAGE_LCK 0x01 /* supports locking media */ 59 #define ATAPI_TAPE_CAP_PAGE_LCKED 0x02 /* the media is locked */ 60 #define ATAPI_TAPE_CAP_PAGE_PRV 0x04 /* defaults to prevent state */ 61 #define ATAPI_TAPE_CAP_PAGE_EJ 0x08 /* supports eject */ 62 #define ATAPI_TAPE_CAP_PAGE_DIS 0x10 /* can break request > ctl */ 63 #define ATAPI_TAPE_CAP_PAGE_ECC 0x40 /* supports error correction */ 64 #define ATAPI_TAPE_CAP_PAGE_CMP 0x80 /* supports data compression */ 65 u_int8_t cap4; 66 #define ATAPI_TAPE_CAP_PAGE_BLK512 0x02 /* supports 512b block size */ 67 #define ATAPI_TAPE_CAP_PAGE_BLK1K 0x04 /* supports 1024b block size */ 68 #define ATAPI_TAPE_CAP_PAGE_BLK32K 0x80 /* supports 32kb block size */ 69 u_int16_t max_speed; /* supported speed in KBps */ 70 u_int16_t max_defects; /* max stored defect entries */ 71 u_int16_t ctl; /* continuous transfer limit */ 72 u_int16_t speed; /* current Speed, in KBps */ 73 u_int16_t buffer_size; /* buffer Size, in 512 bytes */ 74 u_int8_t reserved18; 75 u_int8_t reserved19; 76 }; 77 78 /* ATAPI OnStream ADR data transfer mode page (ADR unique) */ 79 struct ast_transferpage { 80 /* mode page data header */ 81 u_int8_t data_length; /* total length of data */ 82 u_int8_t medium_type; /* medium type (if any) */ 83 u_int8_t dsp; /* device specific parameter */ 84 u_int8_t blk_desc_len; /* block Descriptor Length */ 85 86 /* data transfer page */ 87 u_int8_t page_code :6; 88 #define ATAPI_TAPE_TRANSFER_PAGE 0x30 89 90 u_int8_t reserved0_6 :1; 91 u_int8_t ps :1; /* parameters saveable */ 92 u_int8_t page_length; /* page Length == 0x02 */ 93 u_int8_t reserved2; 94 u_int8_t read32k :1; /* 32k blk size (data only) */ 95 u_int8_t read32k5 :1; /* 32.5k blk size (data&AUX) */ 96 u_int8_t reserved3_23 :2; 97 u_int8_t write32k :1; /* 32k blk size (data only) */ 98 u_int8_t write32k5 :1; /* 32.5k blk size (data&AUX) */ 99 u_int8_t reserved3_6 :1; 100 u_int8_t streaming :1; /* streaming mode enable */ 101 }; 102 103 /* ATAPI OnStream ADR vendor identification mode page (ADR unique) */ 104 struct ast_identifypage { 105 /* mode page data header */ 106 struct scsipi_mode_header header; 107 /* data transfer page */ 108 u_int8_t page_code; 109 #define ATAPI_TAPE_IDENTIFY_PAGE 0x36 110 u_int8_t page_length; /* page Length == 0x06 */ 111 u_int8_t ident[4]; /* host id string */ 112 u_int8_t reserved6; 113 u_int8_t reserved7; 114 }; 115