Back to index

glibc  2.9
scsi.h
Go to the documentation of this file.
00001 /* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /*
00020  * This header file contains public constants and structures used by
00021  * the scsi code for linux.
00022  */
00023 
00024 #ifndef _SCSI_SCSI_H
00025 #define _SCSI_SCSI_H 1
00026 
00027 #include <features.h>
00028 
00029 /*
00030  *      SCSI opcodes
00031  */
00032 
00033 #define TEST_UNIT_READY       0x00
00034 #define REZERO_UNIT           0x01
00035 #define REQUEST_SENSE         0x03
00036 #define FORMAT_UNIT           0x04
00037 #define READ_BLOCK_LIMITS     0x05
00038 #define REASSIGN_BLOCKS       0x07
00039 #define READ_6                0x08
00040 #define WRITE_6               0x0a
00041 #define SEEK_6                0x0b
00042 #define READ_REVERSE          0x0f
00043 #define WRITE_FILEMARKS       0x10
00044 #define SPACE                 0x11
00045 #define INQUIRY               0x12
00046 #define RECOVER_BUFFERED_DATA 0x14
00047 #define MODE_SELECT           0x15
00048 #define RESERVE               0x16
00049 #define RELEASE               0x17
00050 #define COPY                  0x18
00051 #define ERASE                 0x19
00052 #define MODE_SENSE            0x1a
00053 #define START_STOP            0x1b
00054 #define RECEIVE_DIAGNOSTIC    0x1c
00055 #define SEND_DIAGNOSTIC       0x1d
00056 #define ALLOW_MEDIUM_REMOVAL  0x1e
00057 
00058 #define SET_WINDOW            0x24
00059 #define READ_CAPACITY         0x25
00060 #define READ_10               0x28
00061 #define WRITE_10              0x2a
00062 #define SEEK_10               0x2b
00063 #define WRITE_VERIFY          0x2e
00064 #define VERIFY                0x2f
00065 #define SEARCH_HIGH           0x30
00066 #define SEARCH_EQUAL          0x31
00067 #define SEARCH_LOW            0x32
00068 #define SET_LIMITS            0x33
00069 #define PRE_FETCH             0x34
00070 #define READ_POSITION         0x34
00071 #define SYNCHRONIZE_CACHE     0x35
00072 #define LOCK_UNLOCK_CACHE     0x36
00073 #define READ_DEFECT_DATA      0x37
00074 #define MEDIUM_SCAN           0x38
00075 #define COMPARE               0x39
00076 #define COPY_VERIFY           0x3a
00077 #define WRITE_BUFFER          0x3b
00078 #define READ_BUFFER           0x3c
00079 #define UPDATE_BLOCK          0x3d
00080 #define READ_LONG             0x3e
00081 #define WRITE_LONG            0x3f
00082 #define CHANGE_DEFINITION     0x40
00083 #define WRITE_SAME            0x41
00084 #define READ_TOC              0x43
00085 #define LOG_SELECT            0x4c
00086 #define LOG_SENSE             0x4d
00087 #define MODE_SELECT_10        0x55
00088 #define RESERVE_10            0x56
00089 #define RELEASE_10            0x57
00090 #define MODE_SENSE_10         0x5a
00091 #define PERSISTENT_RESERVE_IN 0x5e
00092 #define PERSISTENT_RESERVE_OUT 0x5f
00093 #define MOVE_MEDIUM           0xa5
00094 #define READ_12               0xa8
00095 #define WRITE_12              0xaa
00096 #define WRITE_VERIFY_12       0xae
00097 #define SEARCH_HIGH_12        0xb0
00098 #define SEARCH_EQUAL_12       0xb1
00099 #define SEARCH_LOW_12         0xb2
00100 #define READ_ELEMENT_STATUS   0xb8
00101 #define SEND_VOLUME_TAG       0xb6
00102 #define WRITE_LONG_2          0xea
00103 
00104 /*
00105  *  Status codes
00106  */
00107 
00108 #define GOOD                 0x00
00109 #define CHECK_CONDITION      0x01
00110 #define CONDITION_GOOD       0x02
00111 #define BUSY                 0x04
00112 #define INTERMEDIATE_GOOD    0x08
00113 #define INTERMEDIATE_C_GOOD  0x0a
00114 #define RESERVATION_CONFLICT 0x0c
00115 #define COMMAND_TERMINATED   0x11
00116 #define QUEUE_FULL           0x14
00117 
00118 #define STATUS_MASK          0x3e
00119 
00120 /*
00121  *  SENSE KEYS
00122  */
00123 
00124 #define NO_SENSE            0x00
00125 #define RECOVERED_ERROR     0x01
00126 #define NOT_READY           0x02
00127 #define MEDIUM_ERROR        0x03
00128 #define HARDWARE_ERROR      0x04
00129 #define ILLEGAL_REQUEST     0x05
00130 #define UNIT_ATTENTION      0x06
00131 #define DATA_PROTECT        0x07
00132 #define BLANK_CHECK         0x08
00133 #define COPY_ABORTED        0x0a
00134 #define ABORTED_COMMAND     0x0b
00135 #define VOLUME_OVERFLOW     0x0d
00136 #define MISCOMPARE          0x0e
00137 
00138 
00139 /*
00140  *  DEVICE TYPES
00141  */
00142 
00143 #define TYPE_DISK           0x00
00144 #define TYPE_TAPE           0x01
00145 #define TYPE_PROCESSOR      0x03    /* HP scanners use this */
00146 #define TYPE_WORM           0x04    /* Treated as ROM by our system */
00147 #define TYPE_ROM            0x05
00148 #define TYPE_SCANNER        0x06
00149 #define TYPE_MOD            0x07    /* Magneto-optical disk -
00150                                  * - treated as TYPE_DISK */
00151 #define TYPE_MEDIUM_CHANGER 0x08
00152 #define TYPE_ENCLOSURE          0x0d    /* Enclosure Services Device */
00153 #define TYPE_NO_LUN         0x7f
00154 
00155 /*
00156  * standard mode-select header prepended to all mode-select commands
00157  *
00158  * moved here from cdrom.h -- kraxel
00159  */
00160 
00161 struct ccs_modesel_head
00162   {
00163     unsigned char _r1;                    /* reserved.  */
00164     unsigned char medium;          /* device-specific medium type.  */
00165     unsigned char _r2;                    /* reserved.  */
00166     unsigned char block_desc_length;      /* block descriptor length.  */
00167     unsigned char density;         /* device-specific density code.  */
00168     unsigned char number_blocks_hi;       /* number of blocks in this block
00169                                       desc.  */
00170     unsigned char number_blocks_med;
00171     unsigned char number_blocks_lo;
00172     unsigned char _r3;
00173     unsigned char block_length_hi; /* block length for blocks in this
00174                                       desc.  */
00175     unsigned char block_length_med;
00176     unsigned char block_length_lo;
00177   };
00178 
00179 /*
00180  *  MESSAGE CODES
00181  */
00182 
00183 #define COMMAND_COMPLETE    0x00
00184 #define EXTENDED_MESSAGE    0x01
00185 #define     EXTENDED_MODIFY_DATA_POINTER    0x00
00186 #define     EXTENDED_SDTR                   0x01
00187 #define     EXTENDED_EXTENDED_IDENTIFY      0x02    /* SCSI-I only */
00188 #define     EXTENDED_WDTR                   0x03
00189 #define SAVE_POINTERS       0x02
00190 #define RESTORE_POINTERS    0x03
00191 #define DISCONNECT          0x04
00192 #define INITIATOR_ERROR     0x05
00193 #define ABORT               0x06
00194 #define MESSAGE_REJECT      0x07
00195 #define NOP                 0x08
00196 #define MSG_PARITY_ERROR    0x09
00197 #define LINKED_CMD_COMPLETE 0x0a
00198 #define LINKED_FLG_CMD_COMPLETE 0x0b
00199 #define BUS_DEVICE_RESET    0x0c
00200 
00201 #define INITIATE_RECOVERY   0x0f            /* SCSI-II only */
00202 #define RELEASE_RECOVERY    0x10            /* SCSI-II only */
00203 
00204 #define SIMPLE_QUEUE_TAG    0x20
00205 #define HEAD_OF_QUEUE_TAG   0x21
00206 #define ORDERED_QUEUE_TAG   0x22
00207 
00208 /*
00209  * Here are some scsi specific ioctl commands which are sometimes useful.
00210  */
00211 /* These are a few other constants only used by scsi devices.  */
00212 
00213 #define SCSI_IOCTL_GET_IDLUN 0x5382
00214 
00215 /* Used to turn on and off tagged queuing for scsi devices.  */
00216 
00217 #define SCSI_IOCTL_TAGGED_ENABLE 0x5383
00218 #define SCSI_IOCTL_TAGGED_DISABLE 0x5384
00219 
00220 /* Used to obtain the host number of a device.  */
00221 #define SCSI_IOCTL_PROBE_HOST 0x5385
00222 
00223 /* Used to get the bus number for a device.  */
00224 #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
00225 
00226 #endif /* scsi/scsi.h */