1*86d7f5d3SJohn Marino /* $FreeBSD: src/sys/cam/scsi/scsi_ch.h,v 1.2.6.1 2000/08/03 00:50:59 peter Exp $ */ 2*86d7f5d3SJohn Marino /* $DragonFly: src/sys/bus/cam/scsi/scsi_ch.h,v 1.3 2007/11/25 17:59:22 pavalos Exp $ */ 3*86d7f5d3SJohn Marino /* $NetBSD: scsi_changer.h,v 1.11 1998/02/13 08:28:32 enami Exp $ */ 4*86d7f5d3SJohn Marino 5*86d7f5d3SJohn Marino /* 6*86d7f5d3SJohn Marino * Copyright (c) 1996 Jason R. Thorpe <thorpej@and.com> 7*86d7f5d3SJohn Marino * All rights reserved. 8*86d7f5d3SJohn Marino * 9*86d7f5d3SJohn Marino * Partially based on an autochanger driver written by Stefan Grefen 10*86d7f5d3SJohn Marino * and on an autochanger driver written by the Systems Programming Group 11*86d7f5d3SJohn Marino * at the University of Utah Computer Science Department. 12*86d7f5d3SJohn Marino * 13*86d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without 14*86d7f5d3SJohn Marino * modification, are permitted provided that the following conditions 15*86d7f5d3SJohn Marino * are met: 16*86d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright 17*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer. 18*86d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 19*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the 20*86d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution. 21*86d7f5d3SJohn Marino * 3. All advertising materials mentioning features or use of this software 22*86d7f5d3SJohn Marino * must display the following acknowledgements: 23*86d7f5d3SJohn Marino * This product includes software developed by Jason R. Thorpe 24*86d7f5d3SJohn Marino * for And Communications, http://www.and.com/ 25*86d7f5d3SJohn Marino * 4. The name of the author may not be used to endorse or promote products 26*86d7f5d3SJohn Marino * derived from this software without specific prior written permission. 27*86d7f5d3SJohn Marino * 28*86d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 29*86d7f5d3SJohn Marino * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 30*86d7f5d3SJohn Marino * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 31*86d7f5d3SJohn Marino * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 32*86d7f5d3SJohn Marino * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33*86d7f5d3SJohn Marino * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34*86d7f5d3SJohn Marino * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 35*86d7f5d3SJohn Marino * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 36*86d7f5d3SJohn Marino * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37*86d7f5d3SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38*86d7f5d3SJohn Marino * SUCH DAMAGE. 39*86d7f5d3SJohn Marino */ 40*86d7f5d3SJohn Marino 41*86d7f5d3SJohn Marino /* 42*86d7f5d3SJohn Marino * SCSI changer interface description 43*86d7f5d3SJohn Marino */ 44*86d7f5d3SJohn Marino 45*86d7f5d3SJohn Marino /* 46*86d7f5d3SJohn Marino * Partially derived from software written by Stefan Grefen 47*86d7f5d3SJohn Marino * (grefen@goofy.zdv.uni-mainz.de soon grefen@convex.com) 48*86d7f5d3SJohn Marino * based on the SCSI System by written Julian Elischer (julian@tfs.com) 49*86d7f5d3SJohn Marino * for TRW Financial Systems. 50*86d7f5d3SJohn Marino * 51*86d7f5d3SJohn Marino * TRW Financial Systems, in accordance with their agreement with Carnegie 52*86d7f5d3SJohn Marino * Mellon University, makes this software available to CMU to distribute 53*86d7f5d3SJohn Marino * or use in any manner that they see fit as long as this message is kept with 54*86d7f5d3SJohn Marino * the software. For this reason TFS also grants any other persons or 55*86d7f5d3SJohn Marino * organisations permission to use or modify this software. 56*86d7f5d3SJohn Marino * 57*86d7f5d3SJohn Marino * TFS supplies this software to be publicly redistributed 58*86d7f5d3SJohn Marino * on the understanding that TFS is not responsible for the correct 59*86d7f5d3SJohn Marino * functioning of this software in any circumstances. 60*86d7f5d3SJohn Marino * 61*86d7f5d3SJohn Marino * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 62*86d7f5d3SJohn Marino */ 63*86d7f5d3SJohn Marino 64*86d7f5d3SJohn Marino #ifndef _SCSI_SCSI_CH_H 65*86d7f5d3SJohn Marino #define _SCSI_SCSI_CH_H 1 66*86d7f5d3SJohn Marino 67*86d7f5d3SJohn Marino #include <sys/cdefs.h> 68*86d7f5d3SJohn Marino #include <sys/chio.h> 69*86d7f5d3SJohn Marino 70*86d7f5d3SJohn Marino /* 71*86d7f5d3SJohn Marino * SCSI command format 72*86d7f5d3SJohn Marino */ 73*86d7f5d3SJohn Marino 74*86d7f5d3SJohn Marino /* 75*86d7f5d3SJohn Marino * Exchange the medium in the source element with the medium 76*86d7f5d3SJohn Marino * located at the destination element. 77*86d7f5d3SJohn Marino */ 78*86d7f5d3SJohn Marino struct scsi_exchange_medium { 79*86d7f5d3SJohn Marino u_int8_t opcode; 80*86d7f5d3SJohn Marino #define EXCHANGE_MEDIUM 0xa6 81*86d7f5d3SJohn Marino u_int8_t byte2; 82*86d7f5d3SJohn Marino u_int8_t tea[2]; /* transport element address */ 83*86d7f5d3SJohn Marino u_int8_t src[2]; /* source address */ 84*86d7f5d3SJohn Marino u_int8_t fdst[2]; /* first destination address */ 85*86d7f5d3SJohn Marino u_int8_t sdst[2]; /* second destination address */ 86*86d7f5d3SJohn Marino u_int8_t invert; 87*86d7f5d3SJohn Marino #define EXCHANGE_MEDIUM_INV1 0x01 88*86d7f5d3SJohn Marino #define EXCHANGE_MEDIUM_INV2 0x02 89*86d7f5d3SJohn Marino u_int8_t control; 90*86d7f5d3SJohn Marino }; 91*86d7f5d3SJohn Marino 92*86d7f5d3SJohn Marino /* 93*86d7f5d3SJohn Marino * Cause the medium changer to check all elements for medium and any 94*86d7f5d3SJohn Marino * other status relevant to the element. 95*86d7f5d3SJohn Marino */ 96*86d7f5d3SJohn Marino struct scsi_initialize_element_status { 97*86d7f5d3SJohn Marino u_int8_t opcode; 98*86d7f5d3SJohn Marino #define INITIALIZE_ELEMENT_STATUS 0x07 99*86d7f5d3SJohn Marino u_int8_t byte2; 100*86d7f5d3SJohn Marino u_int8_t reserved[3]; 101*86d7f5d3SJohn Marino u_int8_t control; 102*86d7f5d3SJohn Marino }; 103*86d7f5d3SJohn Marino 104*86d7f5d3SJohn Marino /* 105*86d7f5d3SJohn Marino * Request the changer to move a unit of media from the source element 106*86d7f5d3SJohn Marino * to the destination element. 107*86d7f5d3SJohn Marino */ 108*86d7f5d3SJohn Marino struct scsi_move_medium { 109*86d7f5d3SJohn Marino u_int8_t opcode; 110*86d7f5d3SJohn Marino #define MOVE_MEDIUM 0xa5 111*86d7f5d3SJohn Marino u_int8_t byte2; 112*86d7f5d3SJohn Marino u_int8_t tea[2]; /* transport element address */ 113*86d7f5d3SJohn Marino u_int8_t src[2]; /* source element address */ 114*86d7f5d3SJohn Marino u_int8_t dst[2]; /* destination element address */ 115*86d7f5d3SJohn Marino u_int8_t reserved[2]; 116*86d7f5d3SJohn Marino u_int8_t invert; 117*86d7f5d3SJohn Marino #define MOVE_MEDIUM_INVERT 0x01 118*86d7f5d3SJohn Marino u_int8_t control; 119*86d7f5d3SJohn Marino }; 120*86d7f5d3SJohn Marino 121*86d7f5d3SJohn Marino /* 122*86d7f5d3SJohn Marino * Position the specified transport element (picker) in front of 123*86d7f5d3SJohn Marino * the destination element specified. 124*86d7f5d3SJohn Marino */ 125*86d7f5d3SJohn Marino struct scsi_position_to_element { 126*86d7f5d3SJohn Marino u_int8_t opcode; 127*86d7f5d3SJohn Marino #define POSITION_TO_ELEMENT 0x2b 128*86d7f5d3SJohn Marino u_int8_t byte2; 129*86d7f5d3SJohn Marino u_int8_t tea[2]; /* transport element address */ 130*86d7f5d3SJohn Marino u_int8_t dst[2]; /* destination element address */ 131*86d7f5d3SJohn Marino u_int8_t reserved[2]; 132*86d7f5d3SJohn Marino u_int8_t invert; 133*86d7f5d3SJohn Marino #define POSITION_TO_ELEMENT_INVERT 0x01 134*86d7f5d3SJohn Marino u_int8_t control; 135*86d7f5d3SJohn Marino }; 136*86d7f5d3SJohn Marino 137*86d7f5d3SJohn Marino /* 138*86d7f5d3SJohn Marino * Request that the changer report the status of its internal elements. 139*86d7f5d3SJohn Marino */ 140*86d7f5d3SJohn Marino struct scsi_read_element_status { 141*86d7f5d3SJohn Marino u_int8_t opcode; 142*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS 0xb8 143*86d7f5d3SJohn Marino u_int8_t byte2; 144*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_VOLTAG 0x10 /* report volume tag info */ 145*86d7f5d3SJohn Marino /* ...next 4 bits are an element type code... */ 146*86d7f5d3SJohn Marino u_int8_t sea[2]; /* starting element address */ 147*86d7f5d3SJohn Marino u_int8_t count[2]; /* number of elements */ 148*86d7f5d3SJohn Marino u_int8_t reserved0; 149*86d7f5d3SJohn Marino u_int8_t len[3]; /* length of data buffer */ 150*86d7f5d3SJohn Marino u_int8_t reserved1; 151*86d7f5d3SJohn Marino u_int8_t control; 152*86d7f5d3SJohn Marino }; 153*86d7f5d3SJohn Marino 154*86d7f5d3SJohn Marino struct scsi_request_volume_element_address { 155*86d7f5d3SJohn Marino u_int8_t opcode; 156*86d7f5d3SJohn Marino #define REQUEST_VOLUME_ELEMENT_ADDRESS 0xb5 157*86d7f5d3SJohn Marino u_int8_t byte2; 158*86d7f5d3SJohn Marino #define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG 0x10 159*86d7f5d3SJohn Marino /* ...next 4 bits are an element type code... */ 160*86d7f5d3SJohn Marino u_int8_t eaddr[2]; /* element address */ 161*86d7f5d3SJohn Marino u_int8_t count[2]; /* number of elements */ 162*86d7f5d3SJohn Marino u_int8_t reserved0; 163*86d7f5d3SJohn Marino u_int8_t len[3]; /* length of data buffer */ 164*86d7f5d3SJohn Marino u_int8_t reserved1; 165*86d7f5d3SJohn Marino u_int8_t control; 166*86d7f5d3SJohn Marino }; 167*86d7f5d3SJohn Marino 168*86d7f5d3SJohn Marino /* XXX scsi_release */ 169*86d7f5d3SJohn Marino 170*86d7f5d3SJohn Marino /* 171*86d7f5d3SJohn Marino * Changer-specific mode page numbers. 172*86d7f5d3SJohn Marino */ 173*86d7f5d3SJohn Marino #define CH_ELEMENT_ADDR_ASSIGN_PAGE 0x1D 174*86d7f5d3SJohn Marino #define CH_TRANS_GEOM_PARAMS_PAGE 0x1E 175*86d7f5d3SJohn Marino #define CH_DEVICE_CAP_PAGE 0x1F 176*86d7f5d3SJohn Marino 177*86d7f5d3SJohn Marino /* 178*86d7f5d3SJohn Marino * Data returned by READ ELEMENT STATUS consists of an 8-byte header 179*86d7f5d3SJohn Marino * followed by one or more read_element_status_pages. 180*86d7f5d3SJohn Marino */ 181*86d7f5d3SJohn Marino struct read_element_status_header { 182*86d7f5d3SJohn Marino u_int8_t fear[2]; /* first element address reported */ 183*86d7f5d3SJohn Marino u_int8_t count[2]; /* number of elements available */ 184*86d7f5d3SJohn Marino u_int8_t reserved; 185*86d7f5d3SJohn Marino u_int8_t nbytes[3]; /* byte count of all pages */ 186*86d7f5d3SJohn Marino }; 187*86d7f5d3SJohn Marino 188*86d7f5d3SJohn Marino struct read_element_status_page_header { 189*86d7f5d3SJohn Marino u_int8_t type; /* element type code; see type codes below */ 190*86d7f5d3SJohn Marino u_int8_t flags; 191*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_AVOLTAG 0x40 192*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_PVOLTAG 0x80 193*86d7f5d3SJohn Marino u_int8_t edl[2]; /* element descriptor length */ 194*86d7f5d3SJohn Marino u_int8_t reserved; 195*86d7f5d3SJohn Marino u_int8_t nbytes[3]; /* byte count of all descriptors */ 196*86d7f5d3SJohn Marino }; 197*86d7f5d3SJohn Marino 198*86d7f5d3SJohn Marino /* 199*86d7f5d3SJohn Marino * Format of a volume tag 200*86d7f5d3SJohn Marino */ 201*86d7f5d3SJohn Marino 202*86d7f5d3SJohn Marino struct volume_tag { 203*86d7f5d3SJohn Marino u_int8_t vif[32]; /* volume identification field */ 204*86d7f5d3SJohn Marino u_int8_t reserved[2]; 205*86d7f5d3SJohn Marino u_int8_t vsn[2]; /* volume sequence number */ 206*86d7f5d3SJohn Marino }; 207*86d7f5d3SJohn Marino 208*86d7f5d3SJohn Marino struct read_element_status_descriptor { 209*86d7f5d3SJohn Marino u_int8_t eaddr[2]; /* element address */ 210*86d7f5d3SJohn Marino u_int8_t flags1; 211*86d7f5d3SJohn Marino 212*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_FULL 0x01 213*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_IMPEXP 0x02 214*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_EXCEPT 0x04 215*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_ACCESS 0x08 216*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_EXENAB 0x10 217*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_INENAB 0x20 218*86d7f5d3SJohn Marino 219*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_MT_MASK1 0x05 220*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_ST_MASK1 0x0c 221*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_IE_MASK1 0x3f 222*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_DT_MASK1 0x0c 223*86d7f5d3SJohn Marino 224*86d7f5d3SJohn Marino u_int8_t reserved0; 225*86d7f5d3SJohn Marino u_int8_t sense_code; 226*86d7f5d3SJohn Marino u_int8_t sense_qual; 227*86d7f5d3SJohn Marino 228*86d7f5d3SJohn Marino /* 229*86d7f5d3SJohn Marino * dt_scsi_flags and dt_scsi_addr are valid only on data transport 230*86d7f5d3SJohn Marino * elements. These bytes are undefined for all other element types. 231*86d7f5d3SJohn Marino */ 232*86d7f5d3SJohn Marino u_int8_t dt_scsi_flags; 233*86d7f5d3SJohn Marino 234*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_DT_LUNMASK 0x07 235*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_DT_LUVALID 0x10 236*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_DT_IDVALID 0x20 237*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_DT_NOTBUS 0x80 238*86d7f5d3SJohn Marino 239*86d7f5d3SJohn Marino u_int8_t dt_scsi_addr; 240*86d7f5d3SJohn Marino 241*86d7f5d3SJohn Marino u_int8_t reserved1; 242*86d7f5d3SJohn Marino 243*86d7f5d3SJohn Marino u_int8_t flags2; 244*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_INVERT 0x40 245*86d7f5d3SJohn Marino #define READ_ELEMENT_STATUS_SVALID 0x80 246*86d7f5d3SJohn Marino u_int8_t ssea[2]; /* source storage element address */ 247*86d7f5d3SJohn Marino 248*86d7f5d3SJohn Marino struct volume_tag pvoltag; /* omitted if PVOLTAG == 0 */ 249*86d7f5d3SJohn Marino struct volume_tag avoltag; /* omitted if AVOLTAG == 0 */ 250*86d7f5d3SJohn Marino 251*86d7f5d3SJohn Marino /* Other data may follow */ 252*86d7f5d3SJohn Marino }; 253*86d7f5d3SJohn Marino 254*86d7f5d3SJohn Marino /* XXX add data returned by REQUEST VOLUME ELEMENT ADDRESS */ 255*86d7f5d3SJohn Marino 256*86d7f5d3SJohn Marino /* Element type codes */ 257*86d7f5d3SJohn Marino #define ELEMENT_TYPE_MASK 0x0f /* Note: these aren't bits */ 258*86d7f5d3SJohn Marino #define ELEMENT_TYPE_ALL 0x00 259*86d7f5d3SJohn Marino #define ELEMENT_TYPE_MT 0x01 260*86d7f5d3SJohn Marino #define ELEMENT_TYPE_ST 0x02 261*86d7f5d3SJohn Marino #define ELEMENT_TYPE_IE 0x03 262*86d7f5d3SJohn Marino #define ELEMENT_TYPE_DT 0x04 263*86d7f5d3SJohn Marino 264*86d7f5d3SJohn Marino /* 265*86d7f5d3SJohn Marino * XXX The following definitions should be common to all SCSI device types. 266*86d7f5d3SJohn Marino */ 267*86d7f5d3SJohn Marino #define PGCODE_MASK 0x3f /* valid page number bits in pg_code */ 268*86d7f5d3SJohn Marino #define PGCODE_PS 0x80 /* indicates page is savable */ 269*86d7f5d3SJohn Marino 270*86d7f5d3SJohn Marino /* 271*86d7f5d3SJohn Marino * Send volume tag information to the changer 272*86d7f5d3SJohn Marino */ 273*86d7f5d3SJohn Marino 274*86d7f5d3SJohn Marino struct scsi_send_volume_tag { 275*86d7f5d3SJohn Marino u_int8_t opcode; 276*86d7f5d3SJohn Marino #define SEND_VOLUME_TAG 0xb6 277*86d7f5d3SJohn Marino u_int8_t byte2; 278*86d7f5d3SJohn Marino u_int8_t ea[2]; /* element address */ 279*86d7f5d3SJohn Marino u_int8_t reserved2; 280*86d7f5d3SJohn Marino u_int8_t sac; /* send action code */ 281*86d7f5d3SJohn Marino 282*86d7f5d3SJohn Marino #define SEND_VOLUME_TAG_ASSERT_PRIMARY 0x08 283*86d7f5d3SJohn Marino #define SEND_VOLUME_TAG_ASSERT_ALTERNATE 0x09 284*86d7f5d3SJohn Marino #define SEND_VOLUME_TAG_REPLACE_PRIMARY 0x0a 285*86d7f5d3SJohn Marino #define SEND_VOLUME_TAG_REPLACE_ALTERNATE 0x0b 286*86d7f5d3SJohn Marino #define SEND_VOLUME_TAG_UNDEFINED_PRIMARY 0x0c 287*86d7f5d3SJohn Marino #define SEND_VOLUME_TAG_UNDEFINED_ALTERNATE 0x0d 288*86d7f5d3SJohn Marino 289*86d7f5d3SJohn Marino u_int8_t reserved4[2]; 290*86d7f5d3SJohn Marino u_int8_t pll[2]; /* parameter list length */ 291*86d7f5d3SJohn Marino u_int8_t reserved5; 292*86d7f5d3SJohn Marino u_int8_t control; 293*86d7f5d3SJohn Marino }; 294*86d7f5d3SJohn Marino 295*86d7f5d3SJohn Marino /* 296*86d7f5d3SJohn Marino * Parameter format for SEND VOLUME TAG 297*86d7f5d3SJohn Marino */ 298*86d7f5d3SJohn Marino 299*86d7f5d3SJohn Marino struct scsi_send_volume_tag_parameters { 300*86d7f5d3SJohn Marino u_int8_t vitf[32]; /* volume tag identification template */ 301*86d7f5d3SJohn Marino u_int8_t reserved1[2]; 302*86d7f5d3SJohn Marino u_int8_t minvsn[2]; /* minimum volume sequence number */ 303*86d7f5d3SJohn Marino u_int8_t reserved2[2]; 304*86d7f5d3SJohn Marino u_int8_t maxvsn[2]; /* maximum volume sequence number */ 305*86d7f5d3SJohn Marino }; 306*86d7f5d3SJohn Marino 307*86d7f5d3SJohn Marino /* 308*86d7f5d3SJohn Marino * Device capabilities page. 309*86d7f5d3SJohn Marino * 310*86d7f5d3SJohn Marino * This page defines characteristics of the elemenet types in the 311*86d7f5d3SJohn Marino * medium changer device. 312*86d7f5d3SJohn Marino * 313*86d7f5d3SJohn Marino * Note in the definitions below, the following abbreviations are 314*86d7f5d3SJohn Marino * used: 315*86d7f5d3SJohn Marino * MT Medium transport element (picker) 316*86d7f5d3SJohn Marino * ST Storage transport element (slot) 317*86d7f5d3SJohn Marino * IE Import/export element (portal) 318*86d7f5d3SJohn Marino * DT Data tranfer element (tape/disk drive) 319*86d7f5d3SJohn Marino */ 320*86d7f5d3SJohn Marino struct page_device_capabilities { 321*86d7f5d3SJohn Marino u_int8_t pg_code; /* page code (0x1f) */ 322*86d7f5d3SJohn Marino u_int8_t pg_length; /* page length (0x12) */ 323*86d7f5d3SJohn Marino 324*86d7f5d3SJohn Marino /* 325*86d7f5d3SJohn Marino * The STOR_xx bits indicate that an element of a given 326*86d7f5d3SJohn Marino * type may provide independent storage for a unit of 327*86d7f5d3SJohn Marino * media. The top four bits of this value are reserved. 328*86d7f5d3SJohn Marino */ 329*86d7f5d3SJohn Marino u_int8_t stor; 330*86d7f5d3SJohn Marino #define STOR_MT 0x01 331*86d7f5d3SJohn Marino #define STOR_ST 0x02 332*86d7f5d3SJohn Marino #define STOR_IE 0x04 333*86d7f5d3SJohn Marino #define STOR_DT 0x08 334*86d7f5d3SJohn Marino 335*86d7f5d3SJohn Marino u_int8_t reserved0; 336*86d7f5d3SJohn Marino 337*86d7f5d3SJohn Marino /* 338*86d7f5d3SJohn Marino * The MOVE_TO_yy bits indicate the changer supports 339*86d7f5d3SJohn Marino * moving a unit of medium from an element of a given type to an 340*86d7f5d3SJohn Marino * element of type yy. This is used to determine if a given 341*86d7f5d3SJohn Marino * MOVE MEDIUM command is legal. The top four bits of each 342*86d7f5d3SJohn Marino * of these values are reserved. 343*86d7f5d3SJohn Marino */ 344*86d7f5d3SJohn Marino u_int8_t move_from[CHET_MAX + 1]; 345*86d7f5d3SJohn Marino #define MOVE_TO_MT 0x01 346*86d7f5d3SJohn Marino #define MOVE_TO_ST 0x02 347*86d7f5d3SJohn Marino #define MOVE_TO_IE 0x04 348*86d7f5d3SJohn Marino #define MOVE_TO_DT 0x08 349*86d7f5d3SJohn Marino 350*86d7f5d3SJohn Marino u_int8_t reserved1[4]; 351*86d7f5d3SJohn Marino 352*86d7f5d3SJohn Marino /* 353*86d7f5d3SJohn Marino * Similar to above, but for EXCHANGE MEDIUM. 354*86d7f5d3SJohn Marino */ 355*86d7f5d3SJohn Marino u_int8_t exchange_with[CHET_MAX + 1]; 356*86d7f5d3SJohn Marino #define EXCHANGE_WITH_MT 0x01 357*86d7f5d3SJohn Marino #define EXCHANGE_WITH_ST 0x02 358*86d7f5d3SJohn Marino #define EXCHANGE_WITH_IE 0x04 359*86d7f5d3SJohn Marino #define EXCHANGE_WITH_DT 0x08 360*86d7f5d3SJohn Marino }; 361*86d7f5d3SJohn Marino 362*86d7f5d3SJohn Marino /* 363*86d7f5d3SJohn Marino * Medium changer elemement address assignment page. 364*86d7f5d3SJohn Marino * 365*86d7f5d3SJohn Marino * Some of these fields can be a little confusing, so an explanation 366*86d7f5d3SJohn Marino * is in order. 367*86d7f5d3SJohn Marino * 368*86d7f5d3SJohn Marino * Each component within a a medium changer apparatus is called an 369*86d7f5d3SJohn Marino * "element". 370*86d7f5d3SJohn Marino * 371*86d7f5d3SJohn Marino * The "medium transport element address" is the address of the first 372*86d7f5d3SJohn Marino * picker (robotic arm). "Number of medium transport elements" tells 373*86d7f5d3SJohn Marino * us how many pickers exist in the changer. 374*86d7f5d3SJohn Marino * 375*86d7f5d3SJohn Marino * The "first storage element address" is the address of the first 376*86d7f5d3SJohn Marino * slot in the tape or disk magazine. "Number of storage elements" tells 377*86d7f5d3SJohn Marino * us how many slots exist in the changer. 378*86d7f5d3SJohn Marino * 379*86d7f5d3SJohn Marino * The "first import/export element address" is the address of the first 380*86d7f5d3SJohn Marino * medium portal accessible both by the medium changer and an outside 381*86d7f5d3SJohn Marino * human operator. This is where the changer might deposit tapes destined 382*86d7f5d3SJohn Marino * for some vault. The "number of import/export elements" tells us 383*86d7f5d3SJohn Marino * not many of these portals exist in the changer. NOTE: this number may 384*86d7f5d3SJohn Marino * be 0. 385*86d7f5d3SJohn Marino * 386*86d7f5d3SJohn Marino * The "first data transfer element address" is the address of the first 387*86d7f5d3SJohn Marino * tape or disk drive in the changer. "Number of data transfer elements" 388*86d7f5d3SJohn Marino * tells us how many drives exist in the changer. 389*86d7f5d3SJohn Marino */ 390*86d7f5d3SJohn Marino struct page_element_address_assignment { 391*86d7f5d3SJohn Marino u_int8_t pg_code; /* page code (0x1d) */ 392*86d7f5d3SJohn Marino u_int8_t pg_length; /* page length (0x12) */ 393*86d7f5d3SJohn Marino 394*86d7f5d3SJohn Marino /* Medium transport element address */ 395*86d7f5d3SJohn Marino u_int8_t mtea[2]; 396*86d7f5d3SJohn Marino 397*86d7f5d3SJohn Marino /* Number of medium transport elements */ 398*86d7f5d3SJohn Marino u_int8_t nmte[2]; 399*86d7f5d3SJohn Marino 400*86d7f5d3SJohn Marino /* First storage element address */ 401*86d7f5d3SJohn Marino u_int8_t fsea[2]; 402*86d7f5d3SJohn Marino 403*86d7f5d3SJohn Marino /* Number of storage elements */ 404*86d7f5d3SJohn Marino u_int8_t nse[2]; 405*86d7f5d3SJohn Marino 406*86d7f5d3SJohn Marino /* First import/export element address */ 407*86d7f5d3SJohn Marino u_int8_t fieea[2]; 408*86d7f5d3SJohn Marino 409*86d7f5d3SJohn Marino /* Number of import/export elements */ 410*86d7f5d3SJohn Marino u_int8_t niee[2]; 411*86d7f5d3SJohn Marino 412*86d7f5d3SJohn Marino /* First data transfer element address */ 413*86d7f5d3SJohn Marino u_int8_t fdtea[2]; 414*86d7f5d3SJohn Marino 415*86d7f5d3SJohn Marino /* Number of data trafer elements */ 416*86d7f5d3SJohn Marino u_int8_t ndte[2]; 417*86d7f5d3SJohn Marino 418*86d7f5d3SJohn Marino u_int8_t reserved[2]; 419*86d7f5d3SJohn Marino }; 420*86d7f5d3SJohn Marino 421*86d7f5d3SJohn Marino /* 422*86d7f5d3SJohn Marino * Transport geometry parameters page. 423*86d7f5d3SJohn Marino * 424*86d7f5d3SJohn Marino * Defines whether each medium transport element is a member of a set of 425*86d7f5d3SJohn Marino * elements that share a common robotics subsystem and whether the element 426*86d7f5d3SJohn Marino * is capable of media rotation. One transport geometry descriptor is 427*86d7f5d3SJohn Marino * transferred for each medium transport element, beginning with the first 428*86d7f5d3SJohn Marino * medium transport element (other than the default transport element address 429*86d7f5d3SJohn Marino * of 0). 430*86d7f5d3SJohn Marino */ 431*86d7f5d3SJohn Marino struct page_transport_geometry_parameters { 432*86d7f5d3SJohn Marino u_int8_t pg_code; /* page code (0x1e) */ 433*86d7f5d3SJohn Marino u_int8_t pg_length; /* page length; variable */ 434*86d7f5d3SJohn Marino 435*86d7f5d3SJohn Marino /* Transport geometry descriptor(s) are here. */ 436*86d7f5d3SJohn Marino 437*86d7f5d3SJohn Marino u_int8_t misc; 438*86d7f5d3SJohn Marino #define CAN_ROTATE 0x01 439*86d7f5d3SJohn Marino 440*86d7f5d3SJohn Marino /* Member number in transport element set. */ 441*86d7f5d3SJohn Marino u_int8_t member; 442*86d7f5d3SJohn Marino }; 443*86d7f5d3SJohn Marino 444*86d7f5d3SJohn Marino __BEGIN_DECLS 445*86d7f5d3SJohn Marino void scsi_move_medium(struct ccb_scsiio *csio, u_int32_t retries, 446*86d7f5d3SJohn Marino void (*cbfcnp)(struct cam_periph *, union ccb *), 447*86d7f5d3SJohn Marino u_int8_t tag_action, u_int32_t tea, u_int32_t src, 448*86d7f5d3SJohn Marino u_int32_t dst, int invert, u_int8_t sense_len, 449*86d7f5d3SJohn Marino u_int32_t timeout); 450*86d7f5d3SJohn Marino 451*86d7f5d3SJohn Marino void scsi_exchange_medium(struct ccb_scsiio *csio, u_int32_t retries, 452*86d7f5d3SJohn Marino void (*cbfcnp)(struct cam_periph *, union ccb *), 453*86d7f5d3SJohn Marino u_int8_t tag_action, u_int32_t tea, u_int32_t src, 454*86d7f5d3SJohn Marino u_int32_t dst1, u_int32_t dst2, int invert1, 455*86d7f5d3SJohn Marino int invert2, u_int8_t sense_len, u_int32_t timeout); 456*86d7f5d3SJohn Marino 457*86d7f5d3SJohn Marino void scsi_position_to_element(struct ccb_scsiio *csio, u_int32_t retries, 458*86d7f5d3SJohn Marino void (*cbfcnp)(struct cam_periph *, union ccb *), 459*86d7f5d3SJohn Marino u_int8_t tag_action, u_int32_t tea, u_int32_t dst, 460*86d7f5d3SJohn Marino int invert, u_int8_t sense_len, 461*86d7f5d3SJohn Marino u_int32_t timeout); 462*86d7f5d3SJohn Marino 463*86d7f5d3SJohn Marino void scsi_read_element_status(struct ccb_scsiio *csio, u_int32_t retries, 464*86d7f5d3SJohn Marino void (*cbfcnp)(struct cam_periph *, union ccb *), 465*86d7f5d3SJohn Marino u_int8_t tag_action, int voltag, u_int32_t sea, 466*86d7f5d3SJohn Marino u_int32_t count, u_int8_t *data_ptr, 467*86d7f5d3SJohn Marino u_int32_t dxfer_len, u_int8_t sense_len, 468*86d7f5d3SJohn Marino u_int32_t timeout); 469*86d7f5d3SJohn Marino 470*86d7f5d3SJohn Marino void scsi_initialize_element_status(struct ccb_scsiio *csio, u_int32_t retries, 471*86d7f5d3SJohn Marino void (*cbfcnp)(struct cam_periph *, union ccb *), 472*86d7f5d3SJohn Marino u_int8_t tag_action, u_int8_t sense_len, 473*86d7f5d3SJohn Marino u_int32_t timeout); 474*86d7f5d3SJohn Marino void scsi_send_volume_tag(struct ccb_scsiio *csio, u_int32_t retries, 475*86d7f5d3SJohn Marino void (*cbfcnp)(struct cam_periph *, union ccb *), 476*86d7f5d3SJohn Marino u_int8_t tag_action, 477*86d7f5d3SJohn Marino u_int16_t element_address, 478*86d7f5d3SJohn Marino u_int8_t send_action_code, 479*86d7f5d3SJohn Marino struct scsi_send_volume_tag_parameters *parameters, 480*86d7f5d3SJohn Marino u_int8_t sense_len, u_int32_t timeout); 481*86d7f5d3SJohn Marino __END_DECLS 482*86d7f5d3SJohn Marino 483*86d7f5d3SJohn Marino #endif /* _SCSI_SCSI_CH_H */ 484