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

Cache object: 70dfef4f3cb154cb66e9d850a98544bc


[ 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.