Home | History | Annotate | Line # | Download | only in scsipi
atapi_tape.h revision 1.1
      1 /*	$NetBSD: atapi_tape.h,v 1.1 2001/06/18 09:05:05 bouyer Exp $	*/
      2 
      3 
      4 /*-
      5  * Copyright (c) 1998,1999,2000,2001 Sren 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 #define ATAPI_TAPE_CAP_PAGE_
     55     u_int8_t	cap2;
     56 #define ATAPI_TAPE_CAP_PAGE_EF	0x08;		/* supports ERASE formatting */
     57 #define ATAPI_TAPE_CAP_PAGE_QFA	0x20		/* supports QFA formats */
     58     u_int8_t	cap3;
     59 #define ATAPI_TAPE_CAP_PAGE_LCK	0x01		/* supports locking media */
     60 #define ATAPI_TAPE_CAP_PAGE_LCKED 0x02		/* the media is locked */
     61 #define ATAPI_TAPE_CAP_PAGE_PRV	0x04		/* defaults to prevent state */
     62 #define ATAPI_TAPE_CAP_PAGE_EJ	0x08		/* supports eject */
     63 #define ATAPI_TAPE_CAP_PAGE_DIS	0x10		/* can break request > ctl */
     64 #define ATAPI_TAPE_CAP_PAGE_ECC	0x40		/* supports error correction */
     65 #define ATAPI_TAPE_CAP_PAGE_CMP	0x80		/* supports data compression */
     66     u_int8_t	cap4;
     67 #define ATAPI_TAPE_CAP_PAGE_BLK512 0x02		/* supports 512b block size */
     68 #define ATAPI_TAPE_CAP_PAGE_BLK1K 0x04		/* supports 1024b block size */
     69 #define ATAPI_TAPE_CAP_PAGE_BLK32K 0x80		/* 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;
     77 };
     78 
     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 */
     86 
     87     /* data transfer page */
     88     u_int8_t	page_code	:6;
     89 #define ATAPI_TAPE_TRANSFER_PAGE     0x30
     90 
     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 */
    102 };
    103 
    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 */
    111 
    112     /* data transfer page */
    113     u_int8_t	page_code	:6;
    114 #define ATAPI_TAPE_IDENTIFY_PAGE     0x36
    115 
    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;
    122 };
    123