lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* Copyright (C) 1998, 1999 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, write to the Free |
| 16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 17 | 02111-1307 USA. */ |
| 18 | |
| 19 | /* |
| 20 | * This header file contains public constants and structures used by |
| 21 | * the scsi code for linux. |
| 22 | */ |
| 23 | |
| 24 | #ifndef _SCSI_SCSI_H |
| 25 | #define _SCSI_SCSI_H 1 |
| 26 | |
| 27 | #include <features.h> |
| 28 | |
| 29 | /* |
| 30 | * SCSI opcodes |
| 31 | */ |
| 32 | |
| 33 | #define TEST_UNIT_READY 0x00 |
| 34 | #define REZERO_UNIT 0x01 |
| 35 | #define REQUEST_SENSE 0x03 |
| 36 | #define FORMAT_UNIT 0x04 |
| 37 | #define READ_BLOCK_LIMITS 0x05 |
| 38 | #define REASSIGN_BLOCKS 0x07 |
| 39 | #define READ_6 0x08 |
| 40 | #define WRITE_6 0x0a |
| 41 | #define SEEK_6 0x0b |
| 42 | #define READ_REVERSE 0x0f |
| 43 | #define WRITE_FILEMARKS 0x10 |
| 44 | #define SPACE 0x11 |
| 45 | #define INQUIRY 0x12 |
| 46 | #define RECOVER_BUFFERED_DATA 0x14 |
| 47 | #define MODE_SELECT 0x15 |
| 48 | #define RESERVE 0x16 |
| 49 | #define RELEASE 0x17 |
| 50 | #define COPY 0x18 |
| 51 | #define ERASE 0x19 |
| 52 | #define MODE_SENSE 0x1a |
| 53 | #define START_STOP 0x1b |
| 54 | #define RECEIVE_DIAGNOSTIC 0x1c |
| 55 | #define SEND_DIAGNOSTIC 0x1d |
| 56 | #define ALLOW_MEDIUM_REMOVAL 0x1e |
| 57 | |
| 58 | #define SET_WINDOW 0x24 |
| 59 | #define READ_CAPACITY 0x25 |
| 60 | #define READ_10 0x28 |
| 61 | #define WRITE_10 0x2a |
| 62 | #define SEEK_10 0x2b |
| 63 | #define WRITE_VERIFY 0x2e |
| 64 | #define VERIFY 0x2f |
| 65 | #define SEARCH_HIGH 0x30 |
| 66 | #define SEARCH_EQUAL 0x31 |
| 67 | #define SEARCH_LOW 0x32 |
| 68 | #define SET_LIMITS 0x33 |
| 69 | #define PRE_FETCH 0x34 |
| 70 | #define READ_POSITION 0x34 |
| 71 | #define SYNCHRONIZE_CACHE 0x35 |
| 72 | #define LOCK_UNLOCK_CACHE 0x36 |
| 73 | #define READ_DEFECT_DATA 0x37 |
| 74 | #define MEDIUM_SCAN 0x38 |
| 75 | #define COMPARE 0x39 |
| 76 | #define COPY_VERIFY 0x3a |
| 77 | #define WRITE_BUFFER 0x3b |
| 78 | #define READ_BUFFER 0x3c |
| 79 | #define UPDATE_BLOCK 0x3d |
| 80 | #define READ_LONG 0x3e |
| 81 | #define WRITE_LONG 0x3f |
| 82 | #define CHANGE_DEFINITION 0x40 |
| 83 | #define WRITE_SAME 0x41 |
| 84 | #define READ_TOC 0x43 |
| 85 | #define LOG_SELECT 0x4c |
| 86 | #define LOG_SENSE 0x4d |
| 87 | #define MODE_SELECT_10 0x55 |
| 88 | #define RESERVE_10 0x56 |
| 89 | #define RELEASE_10 0x57 |
| 90 | #define MODE_SENSE_10 0x5a |
| 91 | #define PERSISTENT_RESERVE_IN 0x5e |
| 92 | #define PERSISTENT_RESERVE_OUT 0x5f |
| 93 | #define MOVE_MEDIUM 0xa5 |
| 94 | #define READ_12 0xa8 |
| 95 | #define WRITE_12 0xaa |
| 96 | #define WRITE_VERIFY_12 0xae |
| 97 | #define SEARCH_HIGH_12 0xb0 |
| 98 | #define SEARCH_EQUAL_12 0xb1 |
| 99 | #define SEARCH_LOW_12 0xb2 |
| 100 | #define READ_ELEMENT_STATUS 0xb8 |
| 101 | #define SEND_VOLUME_TAG 0xb6 |
| 102 | #define WRITE_LONG_2 0xea |
| 103 | |
| 104 | /* |
| 105 | * Status codes |
| 106 | */ |
| 107 | |
| 108 | #define GOOD 0x00 |
| 109 | #define CHECK_CONDITION 0x01 |
| 110 | #define CONDITION_GOOD 0x02 |
| 111 | #define BUSY 0x04 |
| 112 | #define INTERMEDIATE_GOOD 0x08 |
| 113 | #define INTERMEDIATE_C_GOOD 0x0a |
| 114 | #define RESERVATION_CONFLICT 0x0c |
| 115 | #define COMMAND_TERMINATED 0x11 |
| 116 | #define QUEUE_FULL 0x14 |
| 117 | |
| 118 | #define STATUS_MASK 0x3e |
| 119 | |
| 120 | /* |
| 121 | * SENSE KEYS |
| 122 | */ |
| 123 | |
| 124 | #define NO_SENSE 0x00 |
| 125 | #define RECOVERED_ERROR 0x01 |
| 126 | #define NOT_READY 0x02 |
| 127 | #define MEDIUM_ERROR 0x03 |
| 128 | #define HARDWARE_ERROR 0x04 |
| 129 | #define ILLEGAL_REQUEST 0x05 |
| 130 | #define UNIT_ATTENTION 0x06 |
| 131 | #define DATA_PROTECT 0x07 |
| 132 | #define BLANK_CHECK 0x08 |
| 133 | #define COPY_ABORTED 0x0a |
| 134 | #define ABORTED_COMMAND 0x0b |
| 135 | #define VOLUME_OVERFLOW 0x0d |
| 136 | #define MISCOMPARE 0x0e |
| 137 | |
| 138 | |
| 139 | /* |
| 140 | * DEVICE TYPES |
| 141 | */ |
| 142 | |
| 143 | #define TYPE_DISK 0x00 |
| 144 | #define TYPE_TAPE 0x01 |
| 145 | #define TYPE_PROCESSOR 0x03 /* HP scanners use this */ |
| 146 | #define TYPE_WORM 0x04 /* Treated as ROM by our system */ |
| 147 | #define TYPE_ROM 0x05 |
| 148 | #define TYPE_SCANNER 0x06 |
| 149 | #define TYPE_MOD 0x07 /* Magneto-optical disk - |
| 150 | * - treated as TYPE_DISK */ |
| 151 | #define TYPE_MEDIUM_CHANGER 0x08 |
| 152 | #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ |
| 153 | #define TYPE_NO_LUN 0x7f |
| 154 | |
| 155 | /* |
| 156 | * standard mode-select header prepended to all mode-select commands |
| 157 | * |
| 158 | * moved here from cdrom.h -- kraxel |
| 159 | */ |
| 160 | |
| 161 | struct ccs_modesel_head |
| 162 | { |
| 163 | unsigned char _r1; /* reserved. */ |
| 164 | unsigned char medium; /* device-specific medium type. */ |
| 165 | unsigned char _r2; /* reserved. */ |
| 166 | unsigned char block_desc_length; /* block descriptor length. */ |
| 167 | unsigned char density; /* device-specific density code. */ |
| 168 | unsigned char number_blocks_hi; /* number of blocks in this block |
| 169 | desc. */ |
| 170 | unsigned char number_blocks_med; |
| 171 | unsigned char number_blocks_lo; |
| 172 | unsigned char _r3; |
| 173 | unsigned char block_length_hi; /* block length for blocks in this |
| 174 | desc. */ |
| 175 | unsigned char block_length_med; |
| 176 | unsigned char block_length_lo; |
| 177 | }; |
| 178 | |
| 179 | /* |
| 180 | * MESSAGE CODES |
| 181 | */ |
| 182 | |
| 183 | #define COMMAND_COMPLETE 0x00 |
| 184 | #define EXTENDED_MESSAGE 0x01 |
| 185 | #define EXTENDED_MODIFY_DATA_POINTER 0x00 |
| 186 | #define EXTENDED_SDTR 0x01 |
| 187 | #define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */ |
| 188 | #define EXTENDED_WDTR 0x03 |
| 189 | #define SAVE_POINTERS 0x02 |
| 190 | #define RESTORE_POINTERS 0x03 |
| 191 | #define DISCONNECT 0x04 |
| 192 | #define INITIATOR_ERROR 0x05 |
| 193 | #define ABORT 0x06 |
| 194 | #define MESSAGE_REJECT 0x07 |
| 195 | #define NOP 0x08 |
| 196 | #define MSG_PARITY_ERROR 0x09 |
| 197 | #define LINKED_CMD_COMPLETE 0x0a |
| 198 | #define LINKED_FLG_CMD_COMPLETE 0x0b |
| 199 | #define BUS_DEVICE_RESET 0x0c |
| 200 | |
| 201 | #define INITIATE_RECOVERY 0x0f /* SCSI-II only */ |
| 202 | #define RELEASE_RECOVERY 0x10 /* SCSI-II only */ |
| 203 | |
| 204 | #define SIMPLE_QUEUE_TAG 0x20 |
| 205 | #define HEAD_OF_QUEUE_TAG 0x21 |
| 206 | #define ORDERED_QUEUE_TAG 0x22 |
| 207 | |
| 208 | /* |
| 209 | * Here are some scsi specific ioctl commands which are sometimes useful. |
| 210 | */ |
| 211 | /* These are a few other constants only used by scsi devices. */ |
| 212 | |
| 213 | #define SCSI_IOCTL_GET_IDLUN 0x5382 |
| 214 | |
| 215 | /* Used to turn on and off tagged queuing for scsi devices. */ |
| 216 | |
| 217 | #define SCSI_IOCTL_TAGGED_ENABLE 0x5383 |
| 218 | #define SCSI_IOCTL_TAGGED_DISABLE 0x5384 |
| 219 | |
| 220 | /* Used to obtain the host number of a device. */ |
| 221 | #define SCSI_IOCTL_PROBE_HOST 0x5385 |
| 222 | |
| 223 | /* Used to get the bus number for a device. */ |
| 224 | #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 |
| 225 | |
| 226 | #endif /* scsi/scsi.h */ |