|
|
1.1 ! root 1: /* ! 2: * Mach Operating System ! 3: * Copyright (c) 1991,1990 Carnegie Mellon University ! 4: * All Rights Reserved. ! 5: * ! 6: * Permission to use, copy, modify and distribute this software and its ! 7: * documentation is hereby granted, provided that both the copyright ! 8: * notice and this permission notice appear in all copies of the ! 9: * software, derivative works or modified versions, and any portions ! 10: * thereof, and that both notices appear in supporting documentation. ! 11: * ! 12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ! 13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ! 14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 15: * ! 16: * Carnegie Mellon requests users of this software to return to ! 17: * ! 18: * Software Distribution Coordinator or [email protected] ! 19: * School of Computer Science ! 20: * Carnegie Mellon University ! 21: * Pittsburgh PA 15213-3890 ! 22: * ! 23: * any improvements or extensions that they make and grant Carnegie Mellon ! 24: * the rights to redistribute these changes. ! 25: */ ! 26: /* ! 27: * File: scsi2.h ! 28: * Author: Alessandro Forin, Carnegie Mellon University ! 29: * Date: 9/90 ! 30: * ! 31: * Additions and changes of the SCSI-II standard viz SCSI-I ! 32: */ ! 33: ! 34: #ifndef _SCSI_SCSI2_H_ ! 35: #define _SCSI_SCSI2_H_ ! 36: ! 37: #include <scsi/scsi_endian.h> ! 38: ! 39: /* ! 40: * Single byte messages ! 41: * ! 42: * originator: I-nitiator T-arget ! 43: * T-support: M-andatory O-ptional ! 44: */ ! 45: ! 46: #define SCSI_ABORT_TAG 0x0d /* O I 2 */ ! 47: #define SCSI_CLEAR_QUEUE 0x0e /* O I 2 */ ! 48: #define SCSI_INITIATE_RECOVERY 0x0f /* O IT2 */ ! 49: #define SCSI_RELEASE_RECOVERY 0x10 /* O I 2 */ ! 50: #define SCSI_TERMINATE_IO_PROCESS 0x11 /* O I 2 */ ! 51: ! 52: /* ! 53: * Two byte messages ! 54: */ ! 55: #define SCSI_SIMPLE_QUEUE_TAG 0x20 /* O IT2 */ ! 56: #define SCSI_HEADOF_QUEUE_TAG 0x21 /* O I 2 */ ! 57: #define SCSI_ORDERED_QUEUE_TAG 0x22 /* O I 2 */ ! 58: #define SCSI_IGNORE_WIDE_RESIDUE 0x23 /* O T2 */ ! 59: /* 0x24..0x2f reserved */ ! 60: ! 61: /* ! 62: * Extended messages, codes and formats ! 63: */ ! 64: ! 65: #define SCSI_WIDE_XFER_REQUEST 0x03 /* IT 2 */ ! 66: typedef struct { ! 67: unsigned char xtn_msg_tag; /* const 0x01 */ ! 68: unsigned char xtn_msg_len; /* const 0x02 */ ! 69: unsigned char xtn_msg_code; /* const 0x03 */ ! 70: unsigned char xtn_msg_xfer_width; ! 71: } scsi_wide_xfer_t; ! 72: ! 73: /* ! 74: * NOTE: some command-specific mods and extensions ! 75: * are actually defined in the scsi.h file for ! 76: * readability reasons ! 77: */ ! 78: ! 79: /* GROUP 1 */ ! 80: ! 81: #define SCSI_CMD_READ_DEFECT_DATA 0x37 /* O2 disk opti */ ! 82: typedef scsi_command_group_1 scsi_cmd_read_defect_t; ! 83: # define SCSI_CMD_RDD_LIST_TYPE 0x07 ! 84: # define SCSI_CMD_RDD_GLIST 0x08 ! 85: # define SCSI_CMD_RDD_PLIST 0x10 ! 86: ! 87: #define SCSI_CMD_WRITE_BUFFER 0x3b /* O2 all */ ! 88: typedef scsi_command_group_1 scsi_cmd_write_buffer_t; ! 89: # define SCSI_CMD_BUF_MODE 0x07 ! 90: # define scsi_cmd_buf_id scs_cmd_lba1 ! 91: # define scsi_cmd_buf_offset1 scs_cmd_lba2 ! 92: # define scsi_cmd_buf_offset2 scs_cmd_lba3 ! 93: # define scsi_cmd_buf_offset3 scs_cmd_lba4 ! 94: # define scsi_cmd_buf_alloc1 scs_cmd_xxx ! 95: # define scsi_cmd_buf_alloc2 scs_cmd_xfer_len_1 ! 96: # define scsi_cmd_buf_alloc3 scs_cmd_xfer_len_2 ! 97: ! 98: #define SCSI_CMD_READ_BUFFER 0x3c /* O2 all */ ! 99: #define scsi_cmd_read_buffer_t scsi_command_group_1 ! 100: ! 101: /* GROUP 2 */ ! 102: ! 103: #define SCSI_CMD_CHANGE_DEFINITION 0x40 /* O2 all */ ! 104: #define scsi_cmd_change_def_t scsi_command_group_2 ! 105: # define scsi_cmd_chg_save scsi_cmd_lba1 ! 106: # define scsi_cmd_chg_definition scsi_cmd_lba2 ! 107: # define SCSI_CMD_CHG_CURRENT 0x00 ! 108: # define SCSI_CMD_CHG_SCSI_1 0x01 ! 109: # define SCSI_CMD_CHG_CCS 0x02 ! 110: # define SCSI_CMD_CHG_SCSI_2 0x03 ! 111: ! 112: /* 0x41 reserved */ ! 113: ! 114: #define SCSI_CMD_READ_SUBCH 0x42 /* O2 rom */ ! 115: #define scsi_cmd_read_subch_t scsi_command_group_2 ! 116: # define SCSI_CMD_CD_MSF 0x02 ! 117: # define SCSI_CMD_RS_SUBQ 0x40 ! 118: # define scsi_cmd_rs_format scsi_cmd_lba2 ! 119: # define SCSI_CMD_RS_FMT_SUBQ 0x00 ! 120: # define SCSI_CMD_RS_FMT_CURPOS 0x01 ! 121: # define SCSI_CMD_RS_FMT_CATALOG 0x02 ! 122: # define SCSI_CMD_RS_FMT_ISRC 0x03 ! 123: # define scsi_cmd_rs_trackno scsi_cmd_xxx ! 124: ! 125: ! 126: #define SCSI_CMD_READ_TOC 0x43 /* O2 rom */ ! 127: #define scsi_cmd_read_toc_t scsi_command_group_2 ! 128: # define scsi_cmd_rtoc_startT scsi_cmd_xxx ! 129: ! 130: #define SCSI_CMD_READ_HEADER 0x44 /* O2 rom */ ! 131: #define scsi_cmd_read_header_t scsi_command_group_2 ! 132: ! 133: #define SCSI_CMD_PLAY_AUDIO 0x45 /* O2 rom */ ! 134: #define scsi_cmd_play_audio_t scsi_command_group_2 ! 135: ! 136: #define SCSI_CMD_PLAY_AUDIO_MSF 0x47 /* O2 rom */ ! 137: #define scsi_cmd_play_audio_msf_t scsi_command_group_2 ! 138: # define scsi_cmd_pamsf_startM scsi_cmd_lba2 ! 139: # define scsi_cmd_pamsf_startS scsi_cmd_lba3 ! 140: # define scsi_cmd_pamsf_startF scsi_cmd_lba4 ! 141: # define scsi_cmd_pamsf_endM scsi_cmd_xxx ! 142: # define scsi_cmd_pamsf_endS scsi_cmd_xfer_len_1 ! 143: # define scsi_cmd_pamsf_endF scsi_cmd_xfer_len_2 ! 144: ! 145: #define SCSI_CMD_PLAY_AUDIO_TI 0x48 /* O2 rom */ ! 146: #define scsi_cmd_play_audio_ti_t scsi_command_group_2 ! 147: # define scsi_cmd_pati_startT scsi_cmd_lba3 ! 148: # define scsi_cmd_pati_startI scsi_cmd_lba4 ! 149: # define scsi_cmd_pati_endT scsi_cmd_xfer_len_1 ! 150: # define scsi_cmd_pati_endI scsi_cmd_xfer_len_2 ! 151: ! 152: #define SCSI_CMD_PLAY_AUDIO_TR 0x49 /* O2 rom */ ! 153: #define scsi_cmd_play_audio_tr_t scsi_command_group_2 ! 154: # define scsi_cmd_patr_startT scsi_cmd_xxx ! 155: ! 156: ! 157: #define SCSI_CMD_PAUSE_RESUME 0x4b /* O2 rom */ ! 158: #define scsi_cmd_pausres_t scsi_command_group_2 ! 159: # define SCSI_CMD_PAUSRES_RESUME 0x01 ! 160: # define scsi_cmd_pausres_res scsi_cmd_xfer_len_2 ! 161: ! 162: #define SCSI_CMD_LOG_SELECT 0x4c /* O2 all */ ! 163: #define scsi_cmd_logsel_t scsi_command_group_2 ! 164: # define SCSI_CMD_LOG_SP 0x01 ! 165: # define SCSI_CMD_LOG_PCR 0x02 ! 166: # define scsi_cmd_log_page_control scsi_cmd_lba1 ! 167: ! 168: #define SCSI_CMD_LOG_SENSE 0x4d /* O2 all */ ! 169: #define scsi_cmd_logsense_t scsi_command_group_2 ! 170: # define SCSI_CMD_LOG_PPC 0x02 ! 171: # define scsi_cmd_log_page_code scsi_cmd_lba1 ! 172: # define scsi_cmd_log_param_ptr1 scsi_cmd_lba4 ! 173: # define scsi_cmd_log_param_ptr2 scsi_cmd_xxx ! 174: ! 175: ! 176: /* 0x4e..0x54 reserved */ ! 177: ! 178: #define SCSI_CMD_MODE_SELECT_2 0x55 /* Z2 */ ! 179: #define scsi_cmd_mode_select_long_t scsi_command_group_2 ! 180: # define SCSI_CMD_MSL2_PF 0x10 ! 181: # define SCSI_CMD_MSL2_SP 0x01 ! 182: ! 183: /* 0x56..0x59 reserved */ ! 184: ! 185: #define SCSI_CMD_MODE_SENSE_2 0x5a /* Z2 */ ! 186: #define scsi_cmd_mode_sense_long_t scsi_command_group_2 ! 187: # define SCSI_CMD_MSS2_DBD 0x08 ! 188: ! 189: /* 0x5b..0x5f reserved */ ! 190: ! 191: /* GROUP 5 */ ! 192: ! 193: #define SCSI_CMD_PLAY_AUDIO_LONG 0xa5 /* O2 rom */ ! 194: #define scsi_cmd_play_audio_l_t scsi_command_group_5 ! 195: ! 196: #define SCSI_CMD_PLAY_AUDIO_TR_LONG 0xa9 /* O2 rom */ ! 197: #define scsi_cmd_play_audio_tr_l_t scsi_command_group_5 ! 198: # define scsi_cmd_patrl_startT scsi_cmd_xxx1 ! 199: ! 200: ! 201: /* ! 202: * Command specific defines ! 203: */ ! 204: typedef struct { ! 205: BITFIELD_2(unsigned char, ! 206: periph_type : 5, ! 207: periph_qual : 3); ! 208: #define SCSI_SCANNER 0x06 /* periph_type values */ ! 209: #define SCSI_MEMORY 0x07 ! 210: #define SCSI_J_BOX 0x08 ! 211: #define SCSI_COMM 0x09 ! 212: #define SCSI_PREPRESS1 0x0a ! 213: #define SCSI_PREPRESS2 0x0b ! 214: ! 215: #define SCSI_PERIPH_CONNECTED 0x00 /* periph_qual values */ ! 216: #define SCSI_PERIPH_DISCONN 0x20 ! 217: #define SCSI_PERIPH_NOTHERE 0x30 ! 218: ! 219: BITFIELD_2(unsigned char, ! 220: device_type : 7, ! 221: rmb : 1); ! 222: ! 223: BITFIELD_3( unsigned char, ! 224: ansi : 3, ! 225: ecma : 3, ! 226: iso : 2); ! 227: ! 228: BITFIELD_4( unsigned char, ! 229: response_fmt : 4, ! 230: res1 : 2, ! 231: trmIOP : 1, ! 232: aenc : 1); ! 233: unsigned char length; ! 234: unsigned char res2; ! 235: unsigned char res3; ! 236: ! 237: BITFIELD_8(unsigned char, ! 238: SftRe : 1, ! 239: CmdQue : 1, ! 240: res4 : 1, ! 241: Linked : 1, ! 242: Sync : 1, ! 243: Wbus16 : 1, ! 244: Wbus32 : 1, ! 245: RelAdr : 1); ! 246: ! 247: unsigned char vendor_id[8]; ! 248: unsigned char product_id[16]; ! 249: unsigned char product_rev[4]; ! 250: unsigned char vendor_uqe[20]; ! 251: unsigned char reserved[40]; ! 252: unsigned char vendor_uqe1[1]; /* varsize */ ! 253: } scsi2_inquiry_data_t; ! 254: #define SCSI_INQ_SUPP_PAGES 0x00 ! 255: #define SCSI_INQ_A_INFO 0x01 /* 0x01..0x1f, really */ ! 256: #define SCSI_INQ_SERIALNO 0x80 ! 257: #define SCSI_INQ_IMPL_OPDEF 0x81 ! 258: #define SCSI_INQ_A_IMPL_OPDEF 0x82 ! 259: ! 260: /* mode_select */ ! 261: typedef struct { ! 262: unsigned char data_len; ! 263: unsigned char medium_type; ! 264: unsigned char device_specific; ! 265: unsigned char desc_len; ! 266: /* block descriptors are optional, same struct as scsi1 */ ! 267: /* page info then follows, see individual pages */ ! 268: } scsi2_mode_param_t; ! 269: ! 270: /* ! 271: * CDROM thingies ! 272: */ ! 273: typedef union { ! 274: struct { ! 275: unsigned char xxx; ! 276: unsigned char minute; ! 277: unsigned char second; ! 278: unsigned char frame; ! 279: } msf; ! 280: struct { ! 281: unsigned char lba1; ! 282: unsigned char lba2; ! 283: unsigned char lba3; ! 284: unsigned char lba4; ! 285: } lba; ! 286: } cdrom_addr_t; ! 287: ! 288: typedef struct { ! 289: unsigned char len1; /* MSB */ ! 290: unsigned char len2; /* LSB */ ! 291: unsigned char first_track; ! 292: unsigned char last_track; ! 293: struct cdrom_toc_desc { ! 294: ! 295: unsigned char xxx; ! 296: ! 297: BITFIELD_2(unsigned char, ! 298: control : 4, ! 299: adr : 4); ! 300: ! 301: unsigned char trackno; ! 302: unsigned char xxx1; ! 303: cdrom_addr_t absolute_address; ! 304: } descs[1]; /* varsize */ ! 305: } cdrom_toc_t; ! 306: ! 307: typedef struct { ! 308: unsigned char xxx; ! 309: ! 310: unsigned char audio_status; ! 311: #define SCSI_CDST_INVALID 0x00 ! 312: #define SCSI_CDST_PLAYING 0x11 ! 313: #define SCSI_CDST_PAUSED 0x12 ! 314: #define SCSI_CDST_COMPLETED 0x13 ! 315: #define SCSI_CDST_ERROR 0x14 ! 316: #define SCSI_CDST_NO_STATUS 0x15 ! 317: ! 318: unsigned char len1; ! 319: unsigned char len2; ! 320: struct cdrom_chanQ { ! 321: unsigned char format; ! 322: BITFIELD_2(unsigned char, ! 323: control : 4, ! 324: adr : 4); ! 325: unsigned char trackno; ! 326: unsigned char indexno; ! 327: cdrom_addr_t absolute_address; ! 328: cdrom_addr_t relative_address; ! 329: BITFIELD_2(unsigned char, ! 330: xxx : 7, ! 331: mcv : 1); ! 332: unsigned char catalog[15]; ! 333: BITFIELD_2(unsigned char, ! 334: xxx1 : 7, ! 335: tcv : 1); ! 336: unsigned char isrc[15]; ! 337: } subQ; ! 338: } cdrom_chan_data_t; ! 339: ! 340: /* subsets */ ! 341: typedef struct { ! 342: unsigned char xxx; ! 343: unsigned char audio_status; ! 344: unsigned char len1; ! 345: unsigned char len2; ! 346: struct { ! 347: unsigned char format; ! 348: BITFIELD_2(unsigned char, ! 349: control : 4, ! 350: adr : 4); ! 351: unsigned char trackno; ! 352: unsigned char indexno; ! 353: cdrom_addr_t absolute_address; ! 354: cdrom_addr_t relative_address; ! 355: } subQ; ! 356: } cdrom_chan_curpos_t; ! 357: ! 358: typedef struct { ! 359: unsigned char xxx; ! 360: unsigned char audio_status; ! 361: unsigned char len1; ! 362: unsigned char len2; ! 363: struct { ! 364: unsigned char format; ! 365: unsigned char xxx1[3]; ! 366: BITFIELD_2(unsigned char, ! 367: xxx : 7, ! 368: mcv : 1); ! 369: unsigned char catalog[15]; ! 370: } subQ; ! 371: } cdrom_chan_catalog_t; ! 372: ! 373: typedef struct { ! 374: unsigned char xxx; ! 375: unsigned char audio_status; ! 376: unsigned char len1; ! 377: unsigned char len2; ! 378: struct { ! 379: unsigned char format; ! 380: BITFIELD_2(unsigned char, ! 381: control : 4, ! 382: adr : 4); ! 383: unsigned char trackno; ! 384: unsigned char xxx0; ! 385: BITFIELD_2(unsigned char, ! 386: xxx1 : 7, ! 387: tcv : 1); ! 388: unsigned char isrc[15]; ! 389: } subQ; ! 390: } cdrom_chan_isrc_t; ! 391: ! 392: /* Audio page */ ! 393: typedef struct { ! 394: scsi_mode_sense_data_t h; /* includes bdescs */ ! 395: unsigned char page_code; ! 396: #define SCSI_CD_AUDIO_PAGE 0x0e ! 397: unsigned char page_len; ! 398: BITFIELD_4(unsigned char, ! 399: xxx1 : 1, ! 400: sotc : 1, ! 401: imm : 1, ! 402: xxx2 : 5); ! 403: unsigned char xxx3[2]; ! 404: BITFIELD_3(unsigned char, ! 405: fmt : 4, ! 406: xxx4 : 3, ! 407: aprv : 1); ! 408: unsigned char bps1; ! 409: unsigned char bps2; ! 410: BITFIELD_2(unsigned char, ! 411: sel0 : 4, ! 412: xxx5 : 4); ! 413: unsigned char vol0; ! 414: BITFIELD_2(unsigned char, ! 415: sel1 : 4, ! 416: xxx6 : 4); ! 417: unsigned char vol1; ! 418: BITFIELD_2(unsigned char, ! 419: sel2 : 4, ! 420: xxx7 : 4); ! 421: unsigned char vol2; ! 422: BITFIELD_2(unsigned char, ! 423: sel3 : 4, ! 424: xxx8 : 4); ! 425: unsigned char vol3; ! 426: } cdrom_audio_page_t; ! 427: ! 428: /* ! 429: * Status byte (a-la scsi2) ! 430: */ ! 431: ! 432: typedef union { ! 433: struct { ! 434: BITFIELD_3( unsigned char, ! 435: scsi_status_reserved1:1, ! 436: scsi_status_code:5, ! 437: scsi_status_reserved2:2); ! 438: /* more scsi_status_code values */ ! 439: /* 00..0c as in SCSI-I */ ! 440: # define SCSI_ST2_CMD_TERMINATED 0x11 /* 2 */ ! 441: # define SCSI_ST2_QUEUE_FULL 0x14 /* 2 */ ! 442: /* anything else is reserved */ ! 443: } st; ! 444: unsigned char bits; ! 445: } scsi2_status_byte_t; ! 446: ! 447: #endif _SCSI_SCSI2_H_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.