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

source code of include/scsi/scsi.h