chiark / gitweb /
212765a17d367c6708e321ea0cbf5933ba68588e
[elogind.git] / extras / scsi_id / scsi.h
1 /*
2  * scsi.h
3  *
4  * General scsi and linux scsi specific defines and structs.
5  *
6  * Copyright (C) IBM Corp. 2003
7  *
8  *  This library is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU Lesser General Public License as
10  *  published by the Free Software Foundation; either version 2.1 of the
11  *  License, or (at your option) any later version.
12  *
13  *  This library is distributed in the hope that it will be useful, but
14  *  WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  *  Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU Lesser General Public
19  *  License along with this library; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21  *  USA
22  */
23
24 #include <scsi/scsi.h>
25
26 struct scsi_ioctl_command {
27         unsigned int inlen;     /* excluding scsi command length */
28         unsigned int outlen;
29         unsigned char data[1];
30         /* on input, scsi command starts here then opt. data */
31 };
32
33 /*
34  * Default 5 second timeout
35  */
36 #define DEF_TIMEOUT     5000
37
38 #define SENSE_BUFF_LEN  32
39
40 /*
41  * The request buffer size passed to the SCSI INQUIRY commands, use 254,
42  * as this is a nice value for some devices, especially some of the usb
43  * mass storage devices.
44  */
45 #define SCSI_INQ_BUFF_LEN       254
46
47 /*
48  * SCSI INQUIRY vendor and model (really product) lengths.
49  */
50 #define VENDOR_LENGTH   8
51 #define MODEL_LENGTH    16
52
53 #define INQUIRY_CMD     0x12
54 #define INQUIRY_CMDLEN  6
55
56 /*
57  * INQUIRY VPD page 0x83 identifier descriptor related values. Reference the
58  * SCSI Primary Commands specification for details.
59  */
60
61 /*
62  * id type values of id descriptors. These are assumed to fit in 4 bits.
63  */
64 #define SCSI_ID_VENDOR_SPECIFIC 0
65 #define SCSI_ID_T10_VENDOR      1
66 #define SCSI_ID_EUI_64          2
67 #define SCSI_ID_NAA             3
68
69 /*
70  * Supported NAA values. These fit in 4 bits, so the "don't care" value
71  * cannot conflict with real values.
72  */
73 #define SCSI_ID_NAA_DONT_CARE           0xff
74 #define SCSI_ID_NAA_IEEE_REG            5
75 #define SCSI_ID_NAA_IEEE_REG_EXTENDED   6
76
77 /*
78  * Supported Code Set values.
79  */
80 #define SCSI_ID_BINARY  1
81 #define SCSI_ID_ASCII   2
82
83 struct scsi_id_search_values {
84         u_char  id_type;
85         u_char  naa_type;
86         u_char  code_set;
87 };
88
89 /*
90  * Following are the "true" SCSI status codes. Linux has traditionally
91  * used a 1 bit right and masked version of these. So now CHECK_CONDITION
92  * and friends (in <scsi/scsi.h>) are deprecated.
93  */
94 #define SCSI_CHECK_CONDITION 0x2
95 #define SCSI_CONDITION_MET 0x4
96 #define SCSI_BUSY 0x8
97 #define SCSI_IMMEDIATE 0x10
98 #define SCSI_IMMEDIATE_CONDITION_MET 0x14
99 #define SCSI_RESERVATION_CONFLICT 0x18
100 #define SCSI_COMMAND_TERMINATED 0x22
101 #define SCSI_TASK_SET_FULL 0x28
102 #define SCSI_ACA_ACTIVE 0x30
103 #define SCSI_TASK_ABORTED 0x40