Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [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 |
Blue Swirl | 70539e1 | 2010-03-07 15:48:43 +0000 | [diff] [blame] | 15 | License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 17 | |
| 18 | /* |
| 19 | * This header file contains public constants and structures used by |
| 20 | * the scsi code for linux. |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * SCSI opcodes |
| 25 | */ |
| 26 | |
| 27 | #define TEST_UNIT_READY 0x00 |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 28 | #define REWIND 0x01 |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 29 | #define REQUEST_SENSE 0x03 |
| 30 | #define FORMAT_UNIT 0x04 |
| 31 | #define READ_BLOCK_LIMITS 0x05 |
| 32 | #define REASSIGN_BLOCKS 0x07 |
| 33 | #define READ_6 0x08 |
| 34 | #define WRITE_6 0x0a |
| 35 | #define SEEK_6 0x0b |
| 36 | #define READ_REVERSE 0x0f |
| 37 | #define WRITE_FILEMARKS 0x10 |
| 38 | #define SPACE 0x11 |
| 39 | #define INQUIRY 0x12 |
| 40 | #define RECOVER_BUFFERED_DATA 0x14 |
| 41 | #define MODE_SELECT 0x15 |
| 42 | #define RESERVE 0x16 |
| 43 | #define RELEASE 0x17 |
| 44 | #define COPY 0x18 |
| 45 | #define ERASE 0x19 |
| 46 | #define MODE_SENSE 0x1a |
| 47 | #define START_STOP 0x1b |
| 48 | #define RECEIVE_DIAGNOSTIC 0x1c |
| 49 | #define SEND_DIAGNOSTIC 0x1d |
| 50 | #define ALLOW_MEDIUM_REMOVAL 0x1e |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 51 | #define READ_CAPACITY_10 0x25 |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 52 | #define READ_10 0x28 |
| 53 | #define WRITE_10 0x2a |
| 54 | #define SEEK_10 0x2b |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 55 | #define LOCATE_10 0x2b |
| 56 | #define WRITE_VERIFY_10 0x2e |
| 57 | #define VERIFY_10 0x2f |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 58 | #define SEARCH_HIGH 0x30 |
| 59 | #define SEARCH_EQUAL 0x31 |
| 60 | #define SEARCH_LOW 0x32 |
| 61 | #define SET_LIMITS 0x33 |
| 62 | #define PRE_FETCH 0x34 |
| 63 | #define READ_POSITION 0x34 |
| 64 | #define SYNCHRONIZE_CACHE 0x35 |
| 65 | #define LOCK_UNLOCK_CACHE 0x36 |
| 66 | #define READ_DEFECT_DATA 0x37 |
| 67 | #define MEDIUM_SCAN 0x38 |
| 68 | #define COMPARE 0x39 |
| 69 | #define COPY_VERIFY 0x3a |
| 70 | #define WRITE_BUFFER 0x3b |
| 71 | #define READ_BUFFER 0x3c |
| 72 | #define UPDATE_BLOCK 0x3d |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 73 | #define READ_LONG_10 0x3e |
| 74 | #define WRITE_LONG_10 0x3f |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 75 | #define CHANGE_DEFINITION 0x40 |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 76 | #define WRITE_SAME_10 0x41 |
| 77 | #define UNMAP 0x42 |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 78 | #define READ_TOC 0x43 |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 79 | #define REPORT_DENSITY_SUPPORT 0x44 |
| 80 | #define GET_CONFIGURATION 0x46 |
Paolo Bonzini | 6dc06f0 | 2011-08-03 10:49:17 +0200 | [diff] [blame] | 81 | #define GET_EVENT_STATUS_NOTIFICATION 0x4a |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 82 | #define LOG_SELECT 0x4c |
| 83 | #define LOG_SENSE 0x4d |
| 84 | #define MODE_SELECT_10 0x55 |
| 85 | #define RESERVE_10 0x56 |
| 86 | #define RELEASE_10 0x57 |
| 87 | #define MODE_SENSE_10 0x5a |
| 88 | #define PERSISTENT_RESERVE_IN 0x5e |
| 89 | #define PERSISTENT_RESERVE_OUT 0x5f |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 90 | #define VARLENGTH_CDB 0x7f |
| 91 | #define WRITE_FILEMARKS_16 0x80 |
| 92 | #define EXTENDED_COPY 0x83 |
| 93 | #define ATA_PASSTHROUGH 0x85 |
| 94 | #define ACCESS_CONTROL_IN 0x86 |
| 95 | #define ACCESS_CONTROL_OUT 0x87 |
| 96 | #define READ_16 0x88 |
| 97 | #define COMPARE_AND_WRITE 0x89 |
| 98 | #define WRITE_16 0x8a |
| 99 | #define WRITE_VERIFY_16 0x8e |
| 100 | #define VERIFY_16 0x8f |
| 101 | #define SYNCHRONIZE_CACHE_16 0x91 |
| 102 | #define LOCATE_16 0x92 |
Christoph Hellwig | ea3bd56 | 2010-12-16 19:36:43 +0100 | [diff] [blame] | 103 | #define WRITE_SAME_16 0x93 |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 104 | #define ERASE_16 0x93 |
Paolo Bonzini | f651526 | 2011-09-06 12:31:42 +0200 | [diff] [blame] | 105 | #define SERVICE_ACTION_IN_16 0x9e |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 106 | #define WRITE_LONG_16 0x9f |
| 107 | #define REPORT_LUNS 0xa0 |
| 108 | #define BLANK 0xa1 |
Nicholas Bellinger | c7126d5 | 2010-06-16 06:43:06 -0700 | [diff] [blame] | 109 | #define MAINTENANCE_IN 0xa3 |
| 110 | #define MAINTENANCE_OUT 0xa4 |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 111 | #define MOVE_MEDIUM 0xa5 |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 112 | #define LOAD_UNLOAD 0xa6 |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 113 | #define READ_12 0xa8 |
| 114 | #define WRITE_12 0xaa |
Paolo Bonzini | f651526 | 2011-09-06 12:31:42 +0200 | [diff] [blame] | 115 | #define SERVICE_ACTION_IN_12 0xab |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 116 | #define WRITE_VERIFY_12 0xae |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 117 | #define VERIFY_12 0xaf |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 118 | #define SEARCH_HIGH_12 0xb0 |
| 119 | #define SEARCH_EQUAL_12 0xb1 |
| 120 | #define SEARCH_LOW_12 0xb2 |
| 121 | #define READ_ELEMENT_STATUS 0xb8 |
| 122 | #define SEND_VOLUME_TAG 0xb6 |
Hannes Reinecke | 5e30a07 | 2011-07-22 16:51:15 +0200 | [diff] [blame] | 123 | #define READ_DEFECT_DATA_12 0xb7 |
| 124 | #define SET_CD_SPEED 0xbb |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 125 | |
| 126 | /* |
Paolo Bonzini | f651526 | 2011-09-06 12:31:42 +0200 | [diff] [blame] | 127 | * SERVICE ACTION IN subcodes |
| 128 | */ |
| 129 | #define SAI_READ_CAPACITY_16 0x10 |
| 130 | |
| 131 | /* |
Hannes Reinecke | f017132 | 2010-11-24 12:15:57 +0100 | [diff] [blame] | 132 | * SAM Status codes |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 133 | */ |
| 134 | |
| 135 | #define GOOD 0x00 |
Hannes Reinecke | f017132 | 2010-11-24 12:15:57 +0100 | [diff] [blame] | 136 | #define CHECK_CONDITION 0x02 |
| 137 | #define CONDITION_GOOD 0x04 |
| 138 | #define BUSY 0x08 |
| 139 | #define INTERMEDIATE_GOOD 0x10 |
| 140 | #define INTERMEDIATE_C_GOOD 0x14 |
| 141 | #define RESERVATION_CONFLICT 0x18 |
| 142 | #define COMMAND_TERMINATED 0x22 |
| 143 | #define TASK_SET_FULL 0x28 |
| 144 | #define ACA_ACTIVE 0x30 |
| 145 | #define TASK_ABORTED 0x40 |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 146 | |
| 147 | #define STATUS_MASK 0x3e |
| 148 | |
| 149 | /* |
| 150 | * SENSE KEYS |
| 151 | */ |
| 152 | |
| 153 | #define NO_SENSE 0x00 |
| 154 | #define RECOVERED_ERROR 0x01 |
| 155 | #define NOT_READY 0x02 |
| 156 | #define MEDIUM_ERROR 0x03 |
| 157 | #define HARDWARE_ERROR 0x04 |
| 158 | #define ILLEGAL_REQUEST 0x05 |
| 159 | #define UNIT_ATTENTION 0x06 |
| 160 | #define DATA_PROTECT 0x07 |
| 161 | #define BLANK_CHECK 0x08 |
| 162 | #define COPY_ABORTED 0x0a |
| 163 | #define ABORTED_COMMAND 0x0b |
| 164 | #define VOLUME_OVERFLOW 0x0d |
| 165 | #define MISCOMPARE 0x0e |
| 166 | |
| 167 | |
| 168 | /* |
| 169 | * DEVICE TYPES |
| 170 | */ |
| 171 | |
| 172 | #define TYPE_DISK 0x00 |
| 173 | #define TYPE_TAPE 0x01 |
Hannes Reinecke | f37bd73 | 2011-07-22 16:44:46 +0200 | [diff] [blame] | 174 | #define TYPE_PRINTER 0x02 |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 175 | #define TYPE_PROCESSOR 0x03 /* HP scanners use this */ |
| 176 | #define TYPE_WORM 0x04 /* Treated as ROM by our system */ |
| 177 | #define TYPE_ROM 0x05 |
| 178 | #define TYPE_SCANNER 0x06 |
| 179 | #define TYPE_MOD 0x07 /* Magneto-optical disk - |
| 180 | * - treated as TYPE_DISK */ |
| 181 | #define TYPE_MEDIUM_CHANGER 0x08 |
Hannes Reinecke | f37bd73 | 2011-07-22 16:44:46 +0200 | [diff] [blame] | 182 | #define TYPE_STORAGE_ARRAY 0x0c /* Storage array device */ |
| 183 | #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ |
| 184 | #define TYPE_RBC 0x0e /* Simplified Direct-Access Device */ |
| 185 | #define TYPE_OSD 0x11 /* Object-storage Device */ |
Paolo Bonzini | fdaef06 | 2011-08-03 10:49:14 +0200 | [diff] [blame] | 186 | #define TYPE_WLUN 0x1e /* Well known LUN */ |
| 187 | #define TYPE_NOT_PRESENT 0x1f |
| 188 | #define TYPE_INACTIVE 0x20 |
Gerd Hoffmann | 0d65e1f | 2009-11-26 15:33:53 +0100 | [diff] [blame] | 189 | #define TYPE_NO_LUN 0x7f |
| 190 | |