1 /* @(#)tmscp.h 5.1 (Berkeley) 02/11/86 */ 2 3 /* 4 * @(#)tmscp.h 1.3 10/21/85 5 * Definitions for the Tape Mass Storage Control Protocol 6 */ 7 8 /************************************************************************ 9 * * 10 * Copyright (c) 1985 by * 11 * Digital Equipment Corporation, Maynard, MA * 12 * * 13 * Permission to use, copy, modify, and distribute this software * 14 * and its documentation is hereby granted to licensees of the * 15 * Regents of the University of California pursuant to their * 16 * license agreement for the "Fourth Berkeley Software * 17 * Distribution". * 18 * * 19 * The information in this software is subject to change without * 20 * notice and should not be construed as a commitment by Digital * 21 * Equipment Corporation. Digital makes no representations * 22 * about suitability of this software for any purpose. It is * 23 * supplied "as is" without express or implied warranty. * 24 * * 25 * This software is not subject to any license of the American * 26 * Telephone and Telegraph Company. * 27 * * 28 ************************************************************************ 29 * 30 * Modification history: /sys/vax/tmscp.h 31 * 32 * 18-Oct-85 - afd 33 * Added: defines for tape format (density) flag values. 34 * 35 * 18-Jul-85 - afd 36 * Added: #define M_UF_WBKNV 0000100 37 * for write back (which enables cache). 38 ************************************************************************/ 39 40 41 /* 42 * Control message opcodes 43 */ 44 #define M_OP_ABORT 0001 /* Abort command */ 45 #define M_OP_GTCMD 0002 /* Get command status command */ 46 #define M_OP_GTUNT 0003 /* Get unit status command */ 47 #define M_OP_STCON 0004 /* Set controller characteristics command */ 48 #define M_OP_AVAIL 0010 /* Available command */ 49 #define M_OP_ONLIN 0011 /* Online command */ 50 #define M_OP_STUNT 0012 /* Set unit characteristics command */ 51 #define M_OP_DTACP 0013 /* Determine access paths command */ 52 #define M_OP_ACCES 0020 /* Access command */ 53 #define M_OP_CMPCD 0021 /* Compare controller data command */ 54 #define M_OP_ERASE 0022 /* Erase command */ 55 #define M_OP_FLUSH 0023 /* Flush command */ 56 #define M_OP_ERGAP 0026 /* Erase gap command */ 57 #define M_OP_COMP 0040 /* Compare host data command */ 58 #define M_OP_READ 0041 /* Read command */ 59 #define M_OP_WRITE 0042 /* Write command */ 60 #define M_OP_WRITM 0044 /* Write tape mark command */ 61 #define M_OP_REPOS 0045 /* Reposition command */ 62 #define M_OP_AVATN 0100 /* Available attention message */ 63 #define M_OP_DUPUN 0101 /* Duplicate unit number attention message */ 64 #define M_OP_ACPTH 0102 /* Access path attention message */ 65 #define M_OP_END 0200 /* End message flag */ 66 67 68 /* 69 * Generic command modifiers 70 */ 71 #define M_MD_COMP 0040000 /* Compare */ 72 #define M_MD_CLSEX 0020000 /* Clear serious exception */ 73 #define M_MD_SECOR 0001000 /* Suppress error correction */ 74 #define M_MD_SEREC 0000400 /* Suppress error recovery */ 75 #define M_MD_STWRP 0000004 /* Set write protect */ 76 #define M_MD_ALLCD 0000002 /* All class drivers */ 77 #define M_MD_NXUNT 0000001 /* Next unit */ 78 79 /* 80 * TMSCP command modifiers 81 */ 82 #define M_MD_DLEOT 0000200 /* Delete LEOT */ 83 #define M_MD_IMMED 0000100 /* Immediate completion */ 84 #define M_MD_EXCAC 0000040 /* Exclusive access */ 85 #define M_MD_UNLOD 0000020 /* Unload */ 86 #define M_MD_REVRS 0000010 /* reverse */ 87 #define M_MD_OBJCT 0000004 /* object count */ 88 #define M_MD_REWND 0000002 /* rewind */ 89 90 /* 91 * End message flags 92 */ 93 #define M_EF_ERLOG 0040 /* Error log generated */ 94 #define M_EF_SEREX 0020 /* Serious exception */ 95 #define M_EF_EOT 0010 /* End of tape encountered */ 96 #define M_EF_PLS 0004 /* Position lost */ 97 98 99 /* 100 * Controller flags 101 */ 102 #define M_CF_ATTN 0200 /* Enable attention messages */ 103 #define M_CF_MISC 0100 /* Enable miscellaneous error log messages */ 104 #define M_CF_OTHER 0040 /* Enable other host's error log messages */ 105 #define M_CF_THIS 0020 /* Enable this host's error log messages */ 106 107 108 /* 109 * Unit flags 110 */ 111 #define M_UF_WRTPH 0020000 /* Write protect (hardware) */ 112 #define M_UF_WRTPS 0010000 /* Write protect (software or volume) */ 113 #define M_UF_WBKNV 0000100 /* Write back (enables cache) */ 114 #define M_UF_VSMSU 0000040 /* Variable speed mode suppression */ 115 #define M_UF_VARSP 0000020 /* Variable speed unit */ 116 #define M_UF_CMPWR 0000002 /* Compare writes */ 117 #define M_UF_CMPRD 0000001 /* Compare reads */ 118 119 120 /* 121 * Status codes 122 */ 123 #define M_ST_MASK 037 /* Status code mask */ 124 #define M_ST_SUCC 000 /* Success */ 125 #define M_ST_ICMD 001 /* Invalid command */ 126 #define M_ST_ABRTD 002 /* Command aborted */ 127 #define M_ST_OFFLN 003 /* Unit offline */ 128 #define M_ST_AVLBL 004 /* Unit available */ 129 #define M_ST_WRTPR 006 /* Write protected */ 130 #define M_ST_COMP 007 /* Compare error */ 131 #define M_ST_DATA 010 /* Data error */ 132 #define M_ST_HSTBF 011 /* Host buffer access error */ 133 #define M_ST_CNTLR 012 /* Controller error */ 134 #define M_ST_DRIVE 013 /* Drive error */ 135 #define M_ST_FMTER 014 /* Formatter error */ 136 #define M_ST_BOT 015 /* BOT encountered */ 137 #define M_ST_TAPEM 016 /* Tape mark encountered */ 138 #define M_ST_RDTRN 020 /* Record data truncated */ 139 #define M_ST_PLOST 021 /* Position lost */ 140 #define M_ST_SEX 022 /* Serious exception */ 141 #define M_ST_LED 023 /* LEOT detected */ 142 #define M_ST_DIAG 037 /* Message from an internal diagnostic */ 143 144 /* 145 * An MSCP packet 146 */ 147 148 struct mscp { 149 struct mscp_header mscp_header;/* device specific header */ 150 long mscp_cmdref; /* command reference number */ 151 short mscp_unit; /* unit number */ 152 short mscp_xxx1; /* unused */ 153 u_char mscp_opcode; /* opcode */ 154 u_char mscp_flags; /* end message flags */ 155 short mscp_modifier; /* modifiers */ 156 union { 157 struct { 158 long Mscp_bytecnt; /* byte count */ 159 long Mscp_buffer; /* buffer descriptor */ 160 long Mscp_mapbase; /* physical addr of map registers */ 161 long Mscp_xxx2; /* unused */ 162 long Mscp_lbn; /* logical block number */ 163 long Mscp_xxx4; /* unused */ 164 long *Mscp_dscptr; /* pointer to descriptor (software) */ 165 long Mscp_sftwds[17];/* software words, padding */ 166 } mscp_generic; 167 struct { 168 short Mscp_version; /* MSCP version */ 169 short Mscp_cntflgs; /* controller flags */ 170 short Mscp_hsttmo; /* host timeout */ 171 short Mscp_usefrac; /* use fraction */ 172 quad Mscp_time; /* time and date */ 173 long Mscp_cntdep; /* controller dependent parameters */ 174 } mscp_setcntchar; 175 struct { 176 short Mscp_multunt; /* multi-unit code */ 177 short Mscp_unitflgs; /* unit flags */ 178 long Mscp_hostid; /* host identifier */ 179 quad Mscp_unitid; /* unit identifier */ 180 long Mscp_mediaid; /* media type identifier */ 181 short Mscp_format; /* format (tape density) */ 182 short Mscp_speed; /* tape speed = (ips * bpi) /1000 */ 183 short Mscp_fmtmenu; /* format menu */ 184 short Mscp_group; /* group size */ 185 short Mscp_cylinder; /* cylinder size */ 186 short Mscp_xxx3; /* reserved */ 187 short Mscp_rctsize; /* RCT table size */ 188 char Mscp_rbns; /* RBNs / track */ 189 char Mscp_rctcpys; /* RCT copies */ 190 } mscp_getunitsts; 191 } mscp_un; 192 short mscp_fil1; 193 short mscp_fil2; 194 short mscp_fil3; 195 }; 196 197 #define mscp_msglen (sizeof (struct mscp) - sizeof(struct mscp_header)) 198 199 /* 200 * generic packet 201 */ 202 203 #define mscp_bytecnt mscp_un.mscp_generic.Mscp_bytecnt 204 #define mscp_buffer mscp_un.mscp_generic.Mscp_buffer 205 #define mscp_mapbase mscp_un.mscp_generic.Mscp_mapbase 206 #define mscp_lbn mscp_un.mscp_generic.Mscp_lbn 207 #define mscp_dscptr mscp_un.mscp_generic.Mscp_dscptr 208 #define mscp_sftwds mscp_un.mscp_generic.Mscp_sftwds 209 #define mscp_status mscp_modifier 210 211 /* 212 * Abort / Get Command Status packet 213 */ 214 215 #define mscp_outref mscp_bytecnt 216 217 /* 218 * Set Controller Characteristics packet 219 */ 220 221 #define mscp_version mscp_un.mscp_setcntchar.Mscp_version 222 #define mscp_cntflgs mscp_un.mscp_setcntchar.Mscp_cntflgs 223 #define mscp_hsttmo mscp_un.mscp_setcntchar.Mscp_hsttmo 224 #define mscp_usefrac mscp_un.mscp_setcntchar.Mscp_usefrac 225 #define mscp_time mscp_un.mscp_setcntchar.Mscp_time 226 #define mscp_cntdep mscp_un.mscp_setcntchar.Mscp_cntdep 227 228 /* 229 * Reposition command packet fields 230 */ 231 232 #define mscp_reccnt mscp_bytecnt /* record/object count */ 233 #define mscp_tmkcnt mscp_buffer /* tape mark count */ 234 235 /* 236 * Get Unit Status end packet 237 */ 238 239 #define mscp_multunt mscp_un.mscp_getunitsts.Mscp_multunt 240 #define mscp_unitflgs mscp_un.mscp_getunitsts.Mscp_unitflgs 241 #define mscp_hostid mscp_un.mscp_getunitsts.Mscp_hostid 242 #define mscp_unitid mscp_un.mscp_getunitsts.Mscp_unitid 243 #define mscp_mediaid mscp_un.mscp_getunitsts.Mscp_mediaid 244 #define mscp_format mscp_un.mscp_getunitsts.Mscp_format /* density:0=high */ 245 #define mscp_speed mscp_un.mscp_getunitsts.Mscp_speed /* (ips*bpi)/1000 */ 246 #define mscp_fmtmenu mscp_un.mscp_getunitsts.Mscp_fmtmenu 247 248 /* 249 * Online / Set Unit Characteristics end packet 250 */ 251 252 #define mscp_maxwrt mscp_dscptr /* max write byte count */ 253 #define mscp_noiserec mscp_cylinder /* noise record */ 254 255 /* 256 * Set Controller Characteristics end packet 257 */ 258 259 #define mscp_cnttmo mscp_hsttmo /* controller timeout */ 260 #define mscp_cntcmdl mscp_usefrac /* controller soft & hardware version */ 261 #define mscp_cntid mscp_unitid /* controller id */ 262 263 264 /* 265 * Error Log message format codes 266 */ 267 #define M_FM_CNTERR 0 /* Controller error */ 268 #define M_FM_BUSADDR 1 /* Host memory access error */ 269 #define M_FM_TAPETRN 5 /* Tape transfer error */ 270 #define M_FM_STIERR 6 /* STI communication or command failure */ 271 #define M_FM_STIDEL 7 /* STI drive error log */ 272 #define M_FM_STIFEL 010 /* STI formatter error log */ 273 274 /* 275 * Error Log message flags 276 */ 277 #define M_LF_SUCC 0200 /* Operation successful */ 278 #define M_LF_CONT 0100 /* Operation continuing */ 279 #define M_LF_SQNRS 0001 /* Sequence number reset */ 280 281 /* 282 * Tape Format Flag Values 283 */ 284 #define M_TF_800 001 /* NRZI 800 bpi */ 285 #define M_TF_PE 002 /* Phase Encoded 1600 bpi */ 286 #define M_TF_GCR 004 /* Group Code Recording 6250 bpi */ 287 #define M_TF_BLK 010 /* Cartridge Block Mode */ 288 289 /* 290 * MSCP Error Log packet 291 * 292 * NOTE: MSCP packet must be padded to this size. 293 */ 294 295 struct mslg { 296 struct mscp_header mslg_header;/* device specific header */ 297 long mslg_cmdref; /* command reference number */ 298 short mslg_unit; /* unit number */ 299 short mslg_seqnum; /* sequence number */ 300 u_char mslg_format; /* format */ 301 u_char mslg_flags; /* error log message flags */ 302 short mslg_event; /* event code */ 303 quad mslg_cntid; /* controller id */ 304 u_char mslg_cntsvr; /* controller software version */ 305 u_char mslg_cnthvr; /* controller hardware version */ 306 short mslg_multunt; /* multi-unit code */ 307 quad mslg_unitid; /* unit id */ 308 u_char mslg_unitsvr; /* unit software version */ 309 u_char mslg_unithvr; /* unit hardware version */ 310 short mslg_group; /* group; retry + level */ 311 long mslg_position; /* position (object count) */ 312 u_char mslg_fmtsvr; /* formatter software version */ 313 u_char mslg_fmthvr; /* formatter hardware version */ 314 short mslg_xxx2; /* unused */ 315 char mslg_stiunsucc[62]; /* STI status information */ 316 }; 317 318 #define mslg_busaddr mslg_unitid.val[0] 319 #define mslg_sdecyl mslg_group 320 321