chiark / gitweb /
Merge branch 'master' of ssh://git.freedesktop.org/git/systemd/systemd
[elogind.git] / src / udev / 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 program is free software; you can redistribute it and/or modify it
9  *        under the terms of the GNU General Public License as published by the
10  *        Free Software Foundation version 2 of the License.
11  */
12
13 #include <scsi/scsi.h>
14
15 struct scsi_ioctl_command {
16         unsigned int inlen;        /* excluding scsi command length */
17         unsigned int outlen;
18         unsigned char data[1];
19         /* on input, scsi command starts here then opt. data */
20 };
21
22 /*
23  * Default 5 second timeout
24  */
25 #define DEF_TIMEOUT        5000
26
27 #define SENSE_BUFF_LEN        32
28
29 /*
30  * The request buffer size passed to the SCSI INQUIRY commands, use 254,
31  * as this is a nice value for some devices, especially some of the usb
32  * mass storage devices.
33  */
34 #define        SCSI_INQ_BUFF_LEN        254
35
36 /*
37  * SCSI INQUIRY vendor and model (really product) lengths.
38  */
39 #define VENDOR_LENGTH        8
40 #define        MODEL_LENGTH        16
41
42 #define INQUIRY_CMD     0x12
43 #define INQUIRY_CMDLEN  6
44
45 /*
46  * INQUIRY VPD page 0x83 identifier descriptor related values. Reference the
47  * SCSI Primary Commands specification for details.
48  */
49
50 /*
51  * id type values of id descriptors. These are assumed to fit in 4 bits.
52  */
53 #define SCSI_ID_VENDOR_SPECIFIC        0
54 #define SCSI_ID_T10_VENDOR        1
55 #define SCSI_ID_EUI_64                2
56 #define SCSI_ID_NAA                3
57 #define SCSI_ID_RELPORT                4
58 #define SCSI_ID_TGTGROUP        5
59 #define SCSI_ID_LUNGROUP        6
60 #define SCSI_ID_MD5                7
61 #define SCSI_ID_NAME                8
62
63 /*
64  * Supported NAA values. These fit in 4 bits, so the "don't care" value
65  * cannot conflict with real values.
66  */
67 #define        SCSI_ID_NAA_DONT_CARE                0xff
68 #define        SCSI_ID_NAA_IEEE_REG                5
69 #define        SCSI_ID_NAA_IEEE_REG_EXTENDED        6
70
71 /*
72  * Supported Code Set values.
73  */
74 #define        SCSI_ID_BINARY        1
75 #define        SCSI_ID_ASCII        2
76
77 struct scsi_id_search_values {
78         u_char        id_type;
79         u_char        naa_type;
80         u_char        code_set;
81 };
82
83 /*
84  * Following are the "true" SCSI status codes. Linux has traditionally
85  * used a 1 bit right and masked version of these. So now CHECK_CONDITION
86  * and friends (in <scsi/scsi.h>) are deprecated.
87  */
88 #define SCSI_CHECK_CONDITION 0x2
89 #define SCSI_CONDITION_MET 0x4
90 #define SCSI_BUSY 0x8
91 #define SCSI_IMMEDIATE 0x10
92 #define SCSI_IMMEDIATE_CONDITION_MET 0x14
93 #define SCSI_RESERVATION_CONFLICT 0x18
94 #define SCSI_COMMAND_TERMINATED 0x22
95 #define SCSI_TASK_SET_FULL 0x28
96 #define SCSI_ACA_ACTIVE 0x30
97 #define SCSI_TASK_ABORTED 0x40