The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/scsi/scsi.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    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  Software.Distribution@CS.CMU.EDU
   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  * HISTORY
   28  * $Log:        scsi.h,v $
   29  * Revision 2.9  93/08/03  12:34:27  mrt
   30  *      Added comm device commands.
   31  *      [93/07/29  23:38:50  af]
   32  * 
   33  * Revision 2.8  93/03/09  10:58:01  danner
   34  *      Define EJECT flag in start/stop unit (SCSI2).
   35  *      Give a name to the block_decsriptors in mode sense/sel.
   36  *      [93/03/06            af]
   37  * 
   38  * Revision 2.7  91/06/19  11:57:24  rvb
   39  *      File moved here from mips/PMAX since it is now "MI" code, also
   40  *      used by Vax3100 and soon -- the omron luna88k.
   41  *      [91/06/04            rvb]
   42  * 
   43  * Revision 2.6  91/05/14  17:28:17  mrt
   44  *      Correcting copyright
   45  * 
   46  * Revision 2.5  91/05/13  06:33:17  af
   47  *      Define bus phases here.  More defines for return data from
   48  *      various commands that are now actually used.
   49  * 
   50  *      Added def of max addressable block for short read/write.
   51  *      Added missing sense key values (they were on the back of
   52  *      the page, oops).  Added extended sense data defs.
   53  *      Added mode sense defs.
   54  * 
   55  * Revision 2.4.2.1  91/05/12  16:22:46  af
   56  *      Define bus phases here.  More defines for return data from
   57  *      various commands that are now actually used.
   58  * 
   59  *      Added def of max addressable block for short read/write.
   60  *      Added missing sense key values (they were on the back of
   61  *      the page, oops).  Added extended sense data defs.
   62  *      Added mode sense defs.
   63  * 
   64  * Revision 2.4  91/02/05  17:44:46  mrt
   65  *      Added author notices
   66  *      [91/02/04  11:18:12  mrt]
   67  * 
   68  *      Changed to use new Mach copyright
   69  *      [91/02/02  12:16:54  mrt]
   70  * 
   71  * Revision 2.3  90/12/05  23:34:41  af
   72  *      Decls of status byte was upside down.
   73  *      [90/12/03  23:38:44  af]
   74  * 
   75  * Revision 2.1.1.1  90/11/01  03:38:31  af
   76  *      Created, from the SCSI specs:
   77  *      "Small Computer Systems Interface (SCSI)", ANSI Draft
   78  *      X3T9.2/82-2 - Rev 17B December 1985
   79  *      [90/09/03            af]
   80  */
   81 /*
   82  *      File: scsi.h
   83  *      Author: Alessandro Forin, Carnegie Mellon University
   84  *      Date:   9/90
   85  *
   86  *      Definitions of the SCSI-1 Standard
   87  */
   88 
   89 #ifndef _SCSI_SCSI_H_
   90 #define _SCSI_SCSI_H_
   91 
   92 #include <scsi/scsi_endian.h>
   93 
   94 /*
   95  * Bus phases
   96  */
   97 
   98 #define SCSI_IO         0x01            /* Input/Output */
   99 #define SCSI_CD         0x02            /* Command/Data */
  100 #define SCSI_MSG        0x04            /* Message */
  101 
  102 #define SCSI_PHASE_MASK 0x07
  103 #define SCSI_PHASE(x)   ((x)&SCSI_PHASE_MASK)
  104 
  105 #define SCSI_PHASE_DATAO        0x00                            /* 0 */
  106 #define SCSI_PHASE_DATAI        SCSI_IO                         /* 1 */
  107 #define SCSI_PHASE_CMD          SCSI_CD                         /* 2 */
  108 #define SCSI_PHASE_STATUS       (SCSI_CD|SCSI_IO)               /* 3 */
  109                                                                 /* 4..5 ANSI reserved */
  110 #define SCSI_PHASE_MSG_OUT      (SCSI_MSG|SCSI_CD)              /* 6 */
  111 #define SCSI_PHASE_MSG_IN       (SCSI_MSG|SCSI_CD|SCSI_IO)      /* 7 */
  112 
  113 /*
  114  * Single byte messages
  115  *
  116  * originator:  I-nitiator T-arget
  117  * T-support:   M-andatory O-ptional
  118  */
  119 
  120 #define SCSI_COMMAND_COMPLETE           0x00    /* M T   */
  121 #define SCSI_EXTENDED_MESSAGE           0x01    /*   IT  */
  122 #define SCSI_SAVE_DATA_POINTER          0x02    /* O T   */
  123 #define SCSI_RESTORE_POINTERS           0x03    /* O T   */
  124 #define SCSI_DISCONNECT                 0x04    /* O T   */
  125 #define SCSI_I_DETECTED_ERROR           0x05    /* M I   */
  126 #define SCSI_ABORT                      0x06    /* M I   */
  127 #define SCSI_MESSAGE_REJECT             0x07    /* M IT  */
  128 #define SCSI_NOP                        0x08    /* M I   */
  129 #define SCSI_MSG_PARITY_ERROR           0x09    /* M I   */
  130 #define SCSI_LNKD_CMD_COMPLETE          0x0a    /* O T   */
  131 #define SCSI_LNKD_CMD_COMPLETE_F        0x0b    /* O T   */
  132 #define SCSI_BUS_DEVICE_RESET           0x0c    /* M I   */
  133                                         /* 0x0d..0x11 scsi2 */
  134                                         /* 0x12..0x1f reserved */
  135 #define SCSI_IDENTIFY                   0x80    /* IT */
  136 #       define SCSI_IFY_ENABLE_DISCONNECT       0x40    /* I  */
  137 #       define SCSI_IFY_LUNTAR                  0x20    /* IT */
  138 #       define SCSI_IFY_LUN_MASK                0x07    /* IT */
  139 
  140 
  141 /* Message codes 0x30..0x7f are reserved */
  142 
  143 /*
  144  * Extended messages, codes and formats
  145  */
  146 
  147 #define SCSI_MODIFY_DATA_PTR            0x00    /* T  */
  148 typedef struct {
  149         unsigned char   xtn_msg_tag;            /* const 0x01 */
  150         unsigned char   xtn_msg_len;            /* const 0x05 */
  151         unsigned char   xtn_msg_code;           /* const 0x00 */
  152         unsigned char   xtn_msg_arg_1000;       /* MSB, signed 2cmpl */
  153         unsigned char   xtn_msg_arg_0200;
  154         unsigned char   xtn_msg_arg_0030;
  155         unsigned char   xtn_msg_arg_0004;       /* LSB */
  156 } scsi_mod_ptr_t;
  157 
  158 #define SCSI_SYNC_XFER_REQUEST          0x01    /* IT */
  159 typedef struct {
  160         unsigned char   xtn_msg_tag;            /* const 0x01 */
  161         unsigned char   xtn_msg_len;            /* const 0x03 */
  162         unsigned char   xtn_msg_code;           /* const 0x01 */
  163         unsigned char   xtn_msg_xfer_period;    /* times 4nsecs */
  164         unsigned char   xtn_msg_xfer_offset;    /* pending ack window */
  165 #define SCSI_SYNCH_XFER_OFFANY  0xff            /* T  unlimited */
  166 } scsi_synch_xfer_req_t;
  167 
  168 #define SCSI_XTN_IDENTIFY               0x02    /* IT -2 */
  169 typedef struct {
  170         unsigned char   xtn_msg_tag;            /* const 0x01 */
  171         unsigned char   xtn_msg_len;            /* const 0x02 */
  172         unsigned char   xtn_msg_code;           /* const 0x02 */
  173         unsigned char   xtn_msg_sublun;
  174 } scsi_xtn_identify_t;
  175 
  176                                         /* 0x03..0x7f reserved */
  177 
  178 #define SCSI_XTN_VENDOR_UQE             0x80    /* vendor unique bit */
  179 typedef struct {
  180         unsigned char   xtn_msg_tag;            /* const 0x01 */
  181         unsigned char   xtn_msg_len;            /* args' len+1 (0-->256)*/
  182         unsigned char   xtn_msg_code;           /* const 0x80..0xff */
  183         unsigned char   xtn_msg_args[1];        /* 0..255 bytes */
  184 } scsi_xtn_vedor_unique_t;
  185 
  186 
  187 /*
  188  * Commands, generic structures
  189  */
  190 
  191 /* SIX byte commands */
  192 typedef struct {
  193         unsigned char   scsi_cmd_code;          /* group(7..5) and command(4..1) */
  194 #define SCSI_CODE_GROUP         0xe0
  195 #define SCSI_CODE_CMD           0x1f
  196         unsigned char   scsi_cmd_lun_and_lba1;  /* lun(7..5) and block# msb[20..16] */
  197 #define SCSI_LUN_MASK           0xe0
  198 #define SCSI_LBA_MASK           0x1f
  199 #define SCSI_LUN_SHIFT          5
  200         unsigned char   scsi_cmd_lba2;          /* block#[15.. 8] */
  201         unsigned char   scsi_cmd_lba3;          /* block#[ 7.. 0] */
  202         unsigned char   scsi_cmd_xfer_len;      /* if required */
  203         unsigned char   scsi_cmd_ctrl_byte;     /* contains: */
  204 #define SCSI_CTRL_VUQ           0xc0            /* vendor unique bits */
  205 #define SCSI_CTRL_RESVD         0x3c            /* reserved, mbz */
  206 #define SCSI_CTRL_FLAG          0x02            /* send a complete_with_flag at end */
  207 #define SCSI_CTRL_LINK          0x01            /* link this command with next */
  208 } scsi_command_group_0;
  209 
  210 /* TEN byte commands */
  211 typedef struct {
  212         unsigned char   scsi_cmd_code;          /* group(7..5) and command(4..1) */
  213         unsigned char   scsi_cmd_lun_and_relbit;/* lun(7..5) and RelAdr(0) */
  214 #define SCSI_RELADR             0x01
  215         unsigned char   scsi_cmd_lba1;          /* block#[31..24] */
  216         unsigned char   scsi_cmd_lba2;          /* block#[23..16] */
  217         unsigned char   scsi_cmd_lba3;          /* block#[15.. 8] */
  218         unsigned char   scsi_cmd_lba4;          /* block#[ 7.. 0] */
  219         unsigned char   scsi_cmd_xxx;           /* reserved, mbz */
  220         unsigned char   scsi_cmd_xfer_len_1;    /* if required */
  221         unsigned char   scsi_cmd_xfer_len_2;    /* if required */
  222         unsigned char   scsi_cmd_ctrl_byte;     /* see above */
  223 } scsi_command_group_1,
  224   scsi_command_group_2;
  225 
  226 /* TWELVE byte commands */
  227 typedef struct {
  228         unsigned char   scsi_cmd_code;          /* group(7..5) and command(4..1) */
  229         unsigned char   scsi_cmd_lun_and_relbit;/* lun(7..5) and RelAdr(0) */
  230         unsigned char   scsi_cmd_lba1;          /* block#[31..24] */
  231         unsigned char   scsi_cmd_lba2;          /* block#[23..16] */
  232         unsigned char   scsi_cmd_lba3;          /* block#[15.. 8] */
  233         unsigned char   scsi_cmd_lba4;          /* block#[ 7.. 0] */
  234         unsigned char   scsi_cmd_xfer_len_1;    /* if required */
  235         unsigned char   scsi_cmd_xfer_len_2;    /* if required */
  236         unsigned char   scsi_cmd_xfer_len_3;    /* if required */
  237         unsigned char   scsi_cmd_xfer_len_4;    /* if required */
  238         unsigned char   scsi_cmd_xxx1;          /* reserved, mbz */
  239         unsigned char   scsi_cmd_ctrl_byte;     /* see above */
  240 } scsi_command_group_5;
  241 
  242 
  243 /*
  244  * Commands, codes and aliases
  245  */
  246 
  247                                 /* GROUP 0 */
  248 #define SCSI_CMD_TEST_UNIT_READY        0x00    /* O all 2M all */
  249 #define scsi_cmd_test_unit_ready_t      scsi_command_group_0
  250 
  251 #define SCSI_CMD_REZERO_UNIT            0x01    /* O disk worm rom */
  252 #define SCSI_CMD_REWIND                 0x01    /* M tape */
  253 #define scsi_cmd_rewind_t       scsi_command_group_0
  254 #define scsi_cmd_rezero_t       scsi_command_group_0
  255 #       define SCSI_CMD_REW_IMMED               0x01
  256 
  257                                         /* 0x02 vendor unique */
  258 
  259 #define SCSI_CMD_REQUEST_SENSE          0x03    /* M all */
  260 #define scsi_cmd_request_sense_t        scsi_command_group_0
  261 #       define scsi_cmd_allocation_length       scsi_cmd_xfer_len
  262 
  263 #define SCSI_CMD_FORMAT_UNIT            0x04    /* M disk O prin */
  264 #define scsi_cmd_format_t       scsi_command_group_0
  265 #       define SCSI_CMD_FMT_FMTDATA             0x10
  266 #       define SCSI_CMD_FMT_CMPLIST             0x08
  267 #       define SCSI_CMD_FMT_LIST_TYPE           0x07
  268 #       define scsi_cmd_intleave1               scsi_cmd_lba3
  269 #       define scsi_cmd_intleave2               scsi_cmd_xfer_len
  270 
  271 #define SCSI_CMD_READ_BLOCK_LIMITS      0x05    /* E tape */
  272 #define scsi_cmd_block_limits_t scsi_command_group_0
  273 
  274                                         /* 0x06 vendor unique */
  275 
  276 #define SCSI_CMD_REASSIGN_BLOCKS        0x07    /* O disk worm */
  277 #define scsi_cmd_reassign_blocks_t      scsi_command_group_0
  278 
  279 #define SCSI_CMD_READ                   0x08    /* M disk tape O worm rom */
  280 #define SCSI_CMD_RECEIVE                0x08    /* O proc */
  281 #define SCSI_CMD_GET_MESSAGE            0x08    /* M comm */
  282 #define scsi_cmd_read_t scsi_command_group_0
  283 #       define SCSI_CMD_TP_FIXED                0x01            /* tape */
  284 #       define scsi_cmd_tp_len1                 scsi_cmd_lba2
  285 #       define scsi_cmd_tp_len2                 scsi_cmd_lba3
  286 #       define scsi_cmd_tp_len3                 scsi_cmd_xfer_len
  287                                         /* largest addressable blockno */
  288 #define SCSI_CMD_READ_MAX_LBA           ((1 << 21) - 1)
  289 
  290                                         /* 0x09 vendor unique */
  291 
  292 #define SCSI_CMD_WRITE                  0x0a    /* M disk tape O worm */
  293 #define SCSI_CMD_PRINT                  0x0a    /* M prin */
  294 #define SCSI_CMD_SEND                   0x0a    /* M proc */
  295 #define SCSI_CMD_SEND_MESSAGE           0x0a    /* M comm */
  296 #define scsi_cmd_write_t        scsi_command_group_0
  297 
  298 #define SCSI_CMD_SEEK                   0x0b    /* O disk worm rom */
  299 #define SCSI_CMD_TRACK_SELECT           0x0b    /* O tape */
  300 #define SCSI_CMD_SLEW_AND_PRINT         0x0b    /* O prin */
  301 #define scsi_cmd_seek_t scsi_command_group_0
  302 #       define SCSI_CMD_SLW_CHANNEL             0x01
  303 #       define scsi_cmd_tp_trackno              scsi_cmd_xfer_len
  304 #       define scsi_cmd_slew_value              scsi_cmd_lba2
  305 
  306                                         /* 0x0c..0x0e vendor unique */
  307 
  308 #define SCSI_CMD_READ_REVERSE           0x0f    /* O tape */
  309 #define scsi_cmd_rev_read_t     scsi_command_group_0
  310 
  311 #define SCSI_CMD_WRITE_FILEMARKS        0x10    /* M tape */
  312 #define SCSI_CMD_FLUSH_BUFFER           0x10    /* M prin */
  313 #define scsi_cmd_write_fil_t    scsi_command_group_0
  314 
  315 #define SCSI_CMD_SPACE                  0x11    /* O tape */
  316 #define scsi_cmd_space_t        scsi_command_group_0
  317 #       define SCSI_CMD_SP_BLOCKS               0x00
  318 #       define SCSI_CMD_SP_FIL                  0x01
  319 #       define SCSI_CMD_SP_SEQ_FIL              0x02
  320 #       define SCSI_CMD_SP_EOT                  0x03
  321 
  322 #define SCSI_CMD_INQUIRY                0x12    /* E all (2M all) */
  323 #define scsi_cmd_inquiry_t      scsi_command_group_0
  324 #       define SCSI_CMD_INQ_EVPD                0x01    /* 2 */
  325 #       define scsi_cmd_page_code               scsi_cmd_lba2   /* 2 */
  326 
  327 #define SCSI_CMD_VERIFY_0               0x13    /* O tape */
  328 #define scsi_cmd_verify_t       scsi_command_group_0
  329 #       define SCSI_CMD_VFY_BYTCMP              0x02
  330 
  331 #define SCSI_CMD_RECOVER_BUFFERED_DATA  0x14    /* O tape prin */
  332 #define scsi_cmd_recover_buffer_t       scsi_command_group_0
  333 
  334 #define SCSI_CMD_MODE_SELECT            0x15    /* O disk tape prin worm rom */
  335 #       define SCSI_CMD_MSL_PF                  0x10
  336 #       define SCSI_CMD_MSL_SP                  0x01
  337 #define scsi_cmd_mode_select_t  scsi_command_group_0
  338 
  339 #define SCSI_CMD_RESERVE                0x16    /* O disk tape prin worm rom */
  340 #define scsi_cmd_reserve_t      scsi_command_group_0
  341 #       define SCSI_CMD_RES_3RDPTY              0x10
  342 #       define SCSI_CMD_RES_3RDPTY_DEV          0x0e
  343 #       define SCSI_CMD_RES_EXTENT              0x01
  344 #       define scsi_cmd_reserve_id              scsi_cmd_lba2
  345 #       define scsi_cmd_extent_llen1            scsi_cmd_lba3
  346 #       define scsi_cmd_extent_llen2            scsi_cmd_xfer_len
  347 
  348 #define SCSI_CMD_RELEASE                0x17    /* O disk tape prin worm rom */
  349 #define scsi_cmd_release_t      scsi_command_group_0
  350 
  351 #define SCSI_CMD_COPY                   0x18    /* O all */
  352 #define scsi_cmd_copy_t scsi_command_group_0
  353 #       define SCSI_CMD_CPY_PAD                 0x01    /* 2 */
  354 #       define scsi_cmd_paraml_len0             scsi_cmd_lba2
  355 #       define scsi_cmd_paraml_len1             scsi_cmd_lba3
  356 #       define scsi_cmd_paraml_len2             scsi_cmd_xfer_len
  357 
  358 #define SCSI_CMD_ERASE                  0x19    /* O tape */
  359 #define scsi_cmd_erase_t        scsi_command_group_0
  360 #       define SCSI_CMD_ER_LONG                 0x01
  361 
  362 #define SCSI_CMD_MODE_SENSE             0x1a    /* O disk tape prin worm rom */
  363 #define scsi_cmd_mode_sense_t   scsi_command_group_0
  364 #       define scsi_cmd_ms_pagecode             scsi_cmd_lba2
  365 
  366 #define SCSI_CMD_START_STOP_UNIT        0x1b    /* O disk prin worm rom */
  367 #define SCSI_CMD_LOAD_UNLOAD            0x1b    /* O tape */
  368 #define scsi_cmd_start_t        scsi_command_group_0
  369 #       define SCSI_CMD_SS_IMMED                0x01
  370 #       define scsi_cmd_ss_flags                scsi_cmd_xfer_len
  371 #       define SCSI_CMD_SS_START                0x01
  372 #       define SCSI_CMD_SS_RETEN                0x02
  373 #       define SCSI_CMD_SS_RETAIN               0x01
  374 #       define SCSI_CMD_SS_EJECT                0x02
  375 
  376 #define SCSI_CMD_RECEIVE_DIAG_RESULTS   0x1c    /* O all */
  377 #define scsi_cmd_receive_diag_t scsi_command_group_0
  378 #       define scsi_cmd_allocation_length1      scsi_cmd_lba3
  379 #       define scsi_cmd_allocation_length2      scsi_cmd_xfer_len
  380 
  381 #define SCSI_CMD_SEND_DIAGNOSTICS       0x1d    /* O all */
  382 #define scsi_cmd_send_diag_t    scsi_command_group_0
  383 #       define SCSI_CMD_DIAG_SELFTEST           0x04
  384 #       define SCSI_CMD_DIAG_DEVOFFL            0x02
  385 #       define SCSI_CMD_DIAG_UNITOFFL           0x01
  386 
  387 #define SCSI_CMD_PREVENT_ALLOW_REMOVAL  0x1e    /* O disk tape worm rom */
  388 #define scsi_cmd_medium_removal_t       scsi_command_group_0
  389 #       define scsi_cmd_pa_prevent              scsi_cmd_xfer_len /* 0x1 */
  390 
  391                                         /* 0x1f reserved */
  392 
  393                                 /* GROUP 1 */
  394                                         /* 0x20..0x24 vendor unique */
  395 
  396 #define SCSI_CMD_READ_CAPACITY          0x25    /* E disk worm rom */
  397 #define scsi_cmd_read_capacity_t        scsi_command_group_1
  398 #       define scsi_cmd_rcap_flags              scsi_cmd_xfer_len_2
  399 #       define SCSI_CMD_RCAP_PMI                0x01
  400 
  401                                         /* 0x26..0x27 vendor unique */
  402 
  403 #define SCSI_CMD_LONG_READ                      0x28    /* E disk M worm rom */
  404 #define scsi_cmd_long_read_t    scsi_command_group_1
  405 
  406                                         /* 0x29 vendor unique */
  407 
  408 #define SCSI_CMD_LONG_WRITE                     0x2a    /* E disk M worm */
  409 #define scsi_cmd_long_write_t   scsi_command_group_1
  410 
  411 #define SCSI_CMD_LONG_SEEK                      0x2b    /* O disk worm rom */
  412 #define scsi_cmd_long_seek_t    scsi_command_group_1
  413 
  414                                         /* 0x2c..0x2d vendor unique */
  415 
  416 #define SCSI_CMD_WRITE_AND_VERIFY       0x2e    /* O disk worm */
  417 #define scsi_cmd_write_vfy_t    scsi_command_group_1
  418 #       define SCSI_CMD_VFY_BYTCHK              0x02
  419 
  420 #define SCSI_CMD_VERIFY_1               0x2f    /* O disk worm rom */
  421 #define scsi_cmd_verify_long_t  scsi_command_group_1
  422 #       define SCSI_CMD_VFY_BLKVFY              0x04
  423 
  424 #define SCSI_CMD_SEARCH_HIGH            0x30    /* O disk worm rom */
  425 #define scsi_cmd_search_t       scsi_command_group_1
  426 #       define SCSI_CMD_SRCH_INVERT             0x10
  427 #       define SCSI_CMD_SRCH_SPNDAT             0x02
  428 
  429 #define SCSI_CMD_SEARCH_EQUAL           0x31    /* O disk worm rom */
  430 #define SCSI_CMD_SEARCH_LOW             0x32    /* O disk worm rom */
  431 
  432 #define SCSI_CMD_SET_LIMITS             0x33    /* O disk worm rom */
  433 #define scsi_cmd_set_limits_t   scsi_command_group_1
  434 #       define SCSI_CMD_SL_RDINH                0x02
  435 #       define SCSI_CMD_SL_WRINH                0x01
  436 
  437                                         /* 0x34..0x38 reserved */
  438 
  439 #define SCSI_CMD_COMPARE                0x39    /* O all */
  440 #define scsi_cmd_compare_t      scsi_command_group_1
  441 #       define scsi_cmd_1_paraml1               scsi_cmd_lba2
  442 #       define scsi_cmd_1_paraml2               scsi_cmd_lba3
  443 #       define scsi_cmd_1_paraml3               scsi_cmd_lba4
  444 
  445 #define SCSI_CMD_COPY_AND_VERIFY        0x3a    /* O all */
  446 #define scsi_cmd_copy_vfy_t     scsi_command_group_1
  447 #       define SCSI_CMD_CPY_BYTCHK              0x02
  448 
  449                                         /* 0x3b..0x3f reserved */
  450 
  451                                 /* GROUP 2 */
  452                                         /* 0x40..0x5f reserved */
  453 
  454                                 /* GROUP 3 */
  455                                         /* 0x60..0x7f reserved */
  456 
  457                                 /* GROUP 4 */
  458                                         /* 0x80..0x9f reserved */
  459 
  460                                 /* GROUP 5 */
  461                                         /* 0xa0..0xaf vendor unique */
  462                                         /* 0xb0..0xbf reserved */
  463 
  464                                 /* GROUP 6 */
  465                                         /* 0xc0..0xdf vendor unique */
  466 
  467                                 /* GROUP 7 */
  468                                         /* 0xe0..0xff vendor unique */
  469 
  470 
  471 /*
  472  * Command-specific results and definitions
  473  */
  474 
  475 /* inquiry data */
  476 typedef struct {
  477         unsigned char   periph_type;
  478 #define SCSI_DISK       0x00
  479 #define SCSI_TAPE       0x01
  480 #define SCSI_PRINTER    0x02
  481 #define SCSI_CPU        0x03
  482 #define SCSI_WORM       0x04
  483 #define SCSI_CDROM      0x05
  484 
  485         BITFIELD_2( unsigned char,
  486                         device_type : 7,
  487                         rmb : 1);
  488         BITFIELD_3( unsigned char,
  489                         ansi : 3,
  490                         ecma : 3,
  491                         iso : 2);
  492         unsigned char   reserved;
  493         unsigned char   length;
  494         unsigned char   param[1];
  495 } scsi_inquiry_data_t;
  496 
  497 #define SCSI_INQ_STD_DATA       -1
  498 
  499 /* request sense data */
  500 #define SCSI_SNS_NOSENSE        0x0
  501 #define SCSI_SNS_RECOVERED      0x1
  502 #define SCSI_SNS_NOTREADY       0x2
  503 #define SCSI_SNS_MEDIUM_ERR     0x3
  504 #define SCSI_SNS_HW_ERR         0x4
  505 #define SCSI_SNS_ILLEGAL_REQ    0x5
  506 #define SCSI_SNS_UNIT_ATN       0x6
  507 #define SCSI_SNS_PROTECT        0x7
  508 #define SCSI_SNS_BLANK_CHK      0x8
  509 #define SCSI_SNS_VUQE           0x9
  510 #define SCSI_SNS_COPY_ABRT      0xa
  511 #define SCSI_SNS_ABORTED        0xb
  512 #define SCSI_SNS_EQUAL          0xc
  513 #define SCSI_SNS_VOLUME_OVFL    0xd
  514 #define SCSI_SNS_MISCOMPARE     0xe
  515 #define SCSI_SNS_RESERVED       0xf
  516 
  517 typedef struct {
  518         BITFIELD_3( unsigned char,
  519                 error_code : 4,
  520                 error_class : 3,
  521                 addr_valid : 1);
  522 #       define  SCSI_SNS_XTENDED_SENSE_DATA     0x7     /* e.g. error_class=7 */
  523         union {
  524             struct {
  525                 BITFIELD_2(unsigned char,
  526                         lba_msb : 5,
  527                         vuqe : 3);
  528                 unsigned char   lba;
  529                 unsigned char   lba_lsb;
  530             } non_xtnded;
  531             struct {
  532                 unsigned char   segment_number;
  533                 BITFIELD_5(unsigned char,
  534                         sense_key : 4,
  535                         res : 1,
  536                         ili : 1,
  537                         eom : 1,
  538                         fm : 1);
  539                 unsigned char   info0;
  540                 unsigned char   info1;
  541                 unsigned char   info2;
  542                 unsigned char   info3;
  543                 unsigned char   add_len;
  544                 unsigned char   add_bytes[1];/* VARSIZE */
  545             } xtended;
  546         } u;
  547 } scsi_sense_data_t;
  548 
  549 
  550 /* mode select params */
  551 typedef struct {
  552         unsigned char   reserved1;
  553         unsigned char   medium_type;
  554         BITFIELD_3(unsigned char,
  555                         speed:4,        /* special for tapes, reserved in SCSI-1 */
  556                         buffer_mode:3,
  557                         reserved2:1);
  558         unsigned char   desc_len;
  559         struct scsi_mode_parm_blockdesc {
  560                 unsigned char   density_code;
  561                 unsigned char   nblocks1;
  562                 unsigned char   nblocks2;
  563                 unsigned char   nblocks3;
  564                 unsigned char   reserved;
  565                 unsigned char   reclen1;
  566                 unsigned char   reclen2;
  567                 unsigned char   reclen3;
  568         } descs[1];             /* VARSIZE, really */
  569 } scsi_mode_select_param_t;
  570 
  571 /* mode sense data (TAPE) */
  572 typedef struct {
  573         unsigned char   data_len;
  574         unsigned char   medium_type;
  575         BITFIELD_3(unsigned char,
  576                         speed : 4,
  577                         buffered_mode : 3,
  578                         wp : 1);
  579         unsigned char   bdesc_len;
  580         struct {
  581             unsigned char       density_code;
  582             unsigned char       no_blks_msb;
  583             unsigned char       no_blks;
  584             unsigned char       no_blks_lsb;
  585             unsigned char       reserved;
  586             unsigned char       blen_msb;
  587             unsigned char       blen;
  588             unsigned char       blen_lsb;
  589         } bdesc[1];     /* VARSIZE */
  590         /* vuqe data might follow */
  591 } scsi_mode_sense_data_t;
  592 
  593 /* read capacity data */
  594 typedef struct {
  595         unsigned char   lba1;
  596         unsigned char   lba2;
  597         unsigned char   lba3;
  598         unsigned char   lba4;
  599         unsigned char   blen1;
  600         unsigned char   blen2;
  601         unsigned char   blen3;
  602         unsigned char   blen4;
  603 } scsi_rcap_data_t;
  604 
  605 /* defect list(s) */
  606 typedef struct {
  607         unsigned char   res1;
  608         unsigned char   res2;
  609         unsigned char   list_len_msb;
  610         unsigned char   list_len_lsb;
  611         struct {
  612             unsigned char       blockno_msb;
  613             unsigned char       blockno_sb1;
  614             unsigned char       blockno_sb2;
  615             unsigned char       blockno_lsb;
  616         } defects[1];   /* VARSIZE */
  617 } scsi_Ldefect_data_t;
  618 
  619 /* block limits (tape) */
  620 typedef struct {
  621         unsigned char   res1;
  622         unsigned char   maxlen_msb;
  623         unsigned char   maxlen_sb;
  624         unsigned char   maxlen_lsb;
  625         unsigned char   minlen_msb;
  626         unsigned char   minlen_lsb;
  627 } scsi_blimits_data_t;
  628 
  629 /*
  630  * Status byte (a-la scsi1)
  631  */
  632 
  633 typedef union {
  634     struct {
  635         BITFIELD_4( unsigned char,
  636                         scsi_status_vendor_uqe1:1,
  637                         scsi_status_code:4,
  638                         scsi_status_vendor_uqe:2,
  639                         scsi_status_reserved:1);
  640 #       define SCSI_ST_GOOD             0x00            /* scsi_status_code values */
  641 #       define SCSI_ST_CHECK_CONDITION  0x01
  642 #       define SCSI_ST_CONDITION_MET    0x02
  643 #       define SCSI_ST_BUSY             0x04
  644 #       define SCSI_ST_INT_GOOD         0x08
  645 #       define SCSI_ST_INT_MET          0x0a
  646 #       define SCSI_ST_RES_CONFLICT     0x0c
  647                                         /* anything else is reserved */
  648     } st;
  649     unsigned char bits;
  650 } scsi_status_byte_t;
  651 
  652 
  653 #endif  _SCSI_SCSI_H_

Cache object: 949ea5dc489e96dc9bbdde062130c662


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.