1 | /*␊ |
2 | * Copyright (c) 1998-2009 Apple Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * This file contains Original Code and/or Modifications of Original Code␊ |
7 | * as defined in and that are subject to the Apple Public Source License␊ |
8 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
9 | * compliance with the License. Please obtain a copy of the License at␊ |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
11 | * file.␊ |
12 | * ␊ |
13 | * The Original Code and all software distributed under the License are␊ |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
18 | * Please see the License for the specific language governing rights and␊ |
19 | * limitations under the License.␊ |
20 | * ␊ |
21 | * @APPLE_LICENSE_HEADER_END@␊ |
22 | */␊ |
23 | ␊ |
24 | #ifndef _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_␊ |
25 | #define _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_␊ |
26 | ␊ |
27 | ␊ |
28 | #if KERNEL␊ |
29 | #include <IOKit/IOTypes.h>␊ |
30 | #else␊ |
31 | #include <CoreFoundation/CoreFoundation.h>␊ |
32 | #endif␊ |
33 | ␊ |
34 | ␊ |
35 | /*! @header SCSI Request Sense Definitions␊ |
36 | ␉@discussion␊ |
37 | ␉This file contains all definitions for the data returned from␊ |
38 | ␉the REQUEST SENSE (0x03) command and from auto sense on protocols␊ |
39 | ␉that support it.␊ |
40 | */␊ |
41 | ␊ |
42 | ␊ |
43 | /*!␊ |
44 | @enum kSenseDefaultSize␊ |
45 | @discussion␊ |
46 | The default size for SCSI Request Sense data.␊ |
47 | */␊ |
48 | enum␊ |
49 | {␊ |
50 | ␉kSenseDefaultSize␉= 18␊ |
51 | };␊ |
52 | ␊ |
53 | ␊ |
54 | /*!␊ |
55 | @struct SCSI_Sense_Data␊ |
56 | @discussion␊ |
57 | The basic SCSI Request Sense data structure.␊ |
58 | */␊ |
59 | typedef struct SCSI_Sense_Data␊ |
60 | {␊ |
61 | ␉UInt8␉␉VALID_RESPONSE_CODE;␉␉␉␉// 7 = Valid. 6-0 = Response Code.␊ |
62 | ␉UInt8␉␉SEGMENT_NUMBER;␉␉␉␉␉␉// Segment number␊ |
63 | ␉UInt8␉␉SENSE_KEY;␉␉␉␉␉␉␉// 7 = FILEMARK, 6 = EOM, 5 = ILI, 3-0 = SENSE KEY.␊ |
64 | ␉UInt8␉␉INFORMATION_1;␉␉␉␉␉␉// INFORMATION.␊ |
65 | ␉UInt8␉␉INFORMATION_2;␉␉␉␉␉␉// INFORMATION.␊ |
66 | ␉UInt8␉␉INFORMATION_3;␉␉␉␉␉␉// INFORMATION.␊ |
67 | ␉UInt8␉␉INFORMATION_4;␉␉␉␉␉␉// INFORMATION.␊ |
68 | ␉UInt8␉␉ADDITIONAL_SENSE_LENGTH;␉␉␉// Number of additional bytes available in sense data␊ |
69 | ␉UInt8␉␉COMMAND_SPECIFIC_INFORMATION_1;␉␉// Command Specific Information␊ |
70 | ␉UInt8␉␉COMMAND_SPECIFIC_INFORMATION_2;␉␉// Command Specific Information␊ |
71 | ␉UInt8␉␉COMMAND_SPECIFIC_INFORMATION_3;␉␉// Command Specific Information␊ |
72 | ␉UInt8␉␉COMMAND_SPECIFIC_INFORMATION_4;␉␉// Command Specific Information␊ |
73 | ␉UInt8␉␉ADDITIONAL_SENSE_CODE;␉␉␉␉// Additional Sense Code␊ |
74 | ␉UInt8␉␉ADDITIONAL_SENSE_CODE_QUALIFIER;␉// Additional Sense Code Qualifier␊ |
75 | ␉UInt8␉␉FIELD_REPLACEABLE_UNIT_CODE;␉␉// Field Replaceable Unit Code␊ |
76 | ␉UInt8␉␉SKSV_SENSE_KEY_SPECIFIC_MSB;␉␉// 7 = Sense Key Specific Valid bit, 6-0 Sense Key Specific MSB␊ |
77 | ␉UInt8␉␉SENSE_KEY_SPECIFIC_MID;␉␉␉␉// Sense Key Specific Middle␊ |
78 | ␉UInt8␉␉SENSE_KEY_SPECIFIC_LSB;␉␉␉␉// Sense Key Specific LSB␊ |
79 | } SCSI_Sense_Data;␊ |
80 | ␊ |
81 | ␊ |
82 | /*!␊ |
83 | @enum Sense Valid␊ |
84 | @discussion␊ |
85 | Masks to use to determine if sense data is valid or not.␊ |
86 | @constant kSENSE_DATA_VALID␊ |
87 | Sense data is valid.␊ |
88 | @constant kSENSE_NOT_DATA_VALID␊ |
89 | Sense data is not valid.␊ |
90 | @constant kSENSE_DATA_VALID_Mask␊ |
91 | Validity mask to use when checking the VALID_RESPONSE_CODE field.␊ |
92 | */␊ |
93 | enum␊ |
94 | {␊ |
95 | ␉kSENSE_DATA_VALID␉␉␉␉␉␉␉␉␉␉= 0x80,␊ |
96 | ␉kSENSE_NOT_DATA_VALID␉␉␉␉␉␉␉␉␉= 0x00,␊ |
97 | ␉kSENSE_DATA_VALID_Mask␉␉␉␉␉␉␉␉␉= 0x80␊ |
98 | };␊ |
99 | ␊ |
100 | ␊ |
101 | /*!␊ |
102 | @enum Sense Response Codes␊ |
103 | @discussion␊ |
104 | Masks and values to determine the Response Code.␊ |
105 | @constant kSENSE_RESPONSE_CODE_Current_Errors␊ |
106 | Response code indicating current errors are reported.␊ |
107 | @constant kSENSE_RESPONSE_CODE_Deferred_Errors␊ |
108 | Response code indicating deferred errors are reported.␊ |
109 | @constant kSENSE_RESPONSE_CODE_Mask␊ |
110 | Mask to use when checking the VALID_RESPONSE_CODE field.␊ |
111 | */␊ |
112 | enum␊ |
113 | {␊ |
114 | ␉kSENSE_RESPONSE_CODE_Current_Errors␉␉␉␉␉␉= 0x70,␊ |
115 | ␉kSENSE_RESPONSE_CODE_Deferred_Errors␉␉␉␉␉= 0x71,␊ |
116 | ␉kSENSE_RESPONSE_CODE_Mask␉␉␉␉␉␉␉␉= 0x7F␊ |
117 | };␊ |
118 | ␊ |
119 | ␊ |
120 | /*!␊ |
121 | @enum FILEMARK bit field definitions␊ |
122 | @discussion␊ |
123 | Masks and values to determine the FileMark bit field.␊ |
124 | @constant kSENSE_FILEMARK_Set␊ |
125 | Filemark bit is set.␊ |
126 | @constant kSENSE_FILEMARK_Not_Set␊ |
127 | Filemark bit is not set.␊ |
128 | @constant kSENSE_FILEMARK_Mask␊ |
129 | Mask to use when checking the SENSE_KEY field for the FILEMARK bit.␊ |
130 | */␊ |
131 | enum␊ |
132 | {␊ |
133 | ␉kSENSE_FILEMARK_Set␉␉␉␉␉␉␉␉␉␉= 0x80,␊ |
134 | ␉kSENSE_FILEMARK_Not_Set ␉␉␉␉␉␉␉␉= 0x00,␊ |
135 | ␉kSENSE_FILEMARK_Mask ␉␉␉␉␉␉␉␉␉= 0x80␊ |
136 | };␊ |
137 | ␊ |
138 | ␊ |
139 | /*!␊ |
140 | @enum EOM bit field definitions␊ |
141 | @discussion␊ |
142 | Masks and values to determine the End Of Medium bit field.␊ |
143 | @constant kSENSE_EOM_Set␊ |
144 | End Of Medium bit is set.␊ |
145 | @constant kSENSE_EOM_Not_Set␊ |
146 | End Of Medium bit is not set.␊ |
147 | @constant kSENSE_EOM_Mask␊ |
148 | Mask to use when checking the SENSE_KEY field for the EOM bit.␊ |
149 | */␊ |
150 | enum␊ |
151 | {␊ |
152 | ␉kSENSE_EOM_Set␉␉␉␉␉␉␉␉␉␉␉= 0x40,␊ |
153 | ␉kSENSE_EOM_Not_Set ␉␉␉␉␉␉␉␉␉␉= 0x00,␊ |
154 | ␉kSENSE_EOM_Mask ␉␉␉␉␉␉␉␉␉␉= 0x40␊ |
155 | };␊ |
156 | ␊ |
157 | ␊ |
158 | /*!␊ |
159 | @enum ILI bit field definitions␊ |
160 | @discussion␊ |
161 | Masks and values to determine the Incorrect Length Indicator bit field.␊ |
162 | @constant kSENSE_ILI_Set␊ |
163 | Incorrect Length Indicator bit is set.␊ |
164 | @constant kSENSE_ILI_Not_Set␊ |
165 | Incorrect Length Indicator bit is not set.␊ |
166 | @constant kSENSE_ILI_Mask␊ |
167 | Mask to use when checking the SENSE_KEY field for the ILI bit.␊ |
168 | */␊ |
169 | enum␊ |
170 | {␊ |
171 | ␉kSENSE_ILI_Set␉␉␉␉␉␉␉␉␉␉␉= 0x20,␊ |
172 | ␉kSENSE_ILI_Not_Set ␉␉␉␉␉␉␉␉␉␉= 0x00,␊ |
173 | ␉kSENSE_ILI_Mask ␉␉␉␉␉␉␉␉␉␉= 0x20␊ |
174 | };␊ |
175 | ␊ |
176 | ␊ |
177 | /*!␊ |
178 | @enum Sense Key definitions␊ |
179 | @discussion␊ |
180 | Masks and values to determine the SENSE_KEY.␊ |
181 | @constant kSENSE_KEY_NO_SENSE␊ |
182 | No sense data is present.␊ |
183 | @constant kSENSE_KEY_RECOVERED_ERROR␊ |
184 | A recovered error has occurred.␊ |
185 | @constant kSENSE_KEY_NOT_READY␊ |
186 | Device server is not ready.␊ |
187 | @constant kSENSE_KEY_MEDIUM_ERROR␊ |
188 | Device server detected a medium error.␊ |
189 | @constant kSENSE_KEY_HARDWARE_ERROR␊ |
190 | Device server detected a hardware error.␊ |
191 | @constant kSENSE_KEY_ILLEGAL_REQUEST␊ |
192 | Device server detected an illegal request.␊ |
193 | @constant kSENSE_KEY_UNIT_ATTENTION␊ |
194 | Device server indicates a unit attention condition.␊ |
195 | @constant kSENSE_KEY_DATA_PROTECT␊ |
196 | Device server indicates a data protect condition.␊ |
197 | @constant kSENSE_KEY_BLANK_CHECK␊ |
198 | Device server indicates a blank check condition.␊ |
199 | @constant kSENSE_KEY_VENDOR_SPECIFIC␊ |
200 | Device server indicates a vendor specific condition.␊ |
201 | @constant kSENSE_KEY_COPY_ABORTED␊ |
202 | Device server indicates a copy aborted condition.␊ |
203 | @constant kSENSE_KEY_ABORTED_COMMAND␊ |
204 | Device server indicates an aborted command condition.␊ |
205 | @constant kSENSE_KEY_VOLUME_OVERFLOW␊ |
206 | Device server indicates a volume overflow condition.␊ |
207 | @constant kSENSE_KEY_MISCOMPARE␊ |
208 | Device server indicates a miscompare condition.␊ |
209 | @constant kSENSE_KEY_Mask␊ |
210 | Mask to use when checking the SENSE_KEY field for the SENSE_KEY value.␊ |
211 | */␊ |
212 | enum␊ |
213 | {␊ |
214 | ␉kSENSE_KEY_NO_SENSE␉␉␉␉␉␉␉␉␉␉= 0x00,␊ |
215 | ␉kSENSE_KEY_RECOVERED_ERROR␉␉␉␉␉␉␉␉= 0x01,␊ |
216 | ␉kSENSE_KEY_NOT_READY␉␉␉␉␉␉␉␉␉= 0x02,␊ |
217 | ␉kSENSE_KEY_MEDIUM_ERROR␉␉␉␉␉␉␉␉␉= 0x03,␊ |
218 | ␉kSENSE_KEY_HARDWARE_ERROR␉␉␉␉␉␉␉␉= 0x04,␊ |
219 | ␉kSENSE_KEY_ILLEGAL_REQUEST␉␉␉␉␉␉␉␉= 0x05,␊ |
220 | ␉kSENSE_KEY_UNIT_ATTENTION␉␉␉␉␉␉␉␉= 0x06,␊ |
221 | ␉kSENSE_KEY_DATA_PROTECT␉␉␉␉␉␉␉␉␉= 0x07,␊ |
222 | ␉kSENSE_KEY_BLANK_CHECK␉␉␉␉␉␉␉␉␉= 0x08,␊ |
223 | ␉kSENSE_KEY_VENDOR_SPECIFIC␉␉␉␉␉␉␉␉= 0x09,␊ |
224 | ␉kSENSE_KEY_COPY_ABORTED␉␉␉␉␉␉␉␉␉= 0x0A,␊ |
225 | ␉kSENSE_KEY_ABORTED_COMMAND␉␉␉␉␉␉␉␉= 0x0B,␊ |
226 | ␉/* SENSE KEY 0x0C is obsoleted */␊ |
227 | ␉kSENSE_KEY_VOLUME_OVERFLOW␉␉␉␉␉␉␉␉= 0x0D,␊ |
228 | ␉kSENSE_KEY_MISCOMPARE␉␉␉␉␉␉␉␉␉= 0x0E,␊ |
229 | ␉/* SENSE KEY 0x0F is reserved */␊ |
230 | ␉kSENSE_KEY_Mask ␉␉␉␉␉␉␉␉␉␉= 0x0F␊ |
231 | };␊ |
232 | ␊ |
233 | ␊ |
234 | #endif␉/* _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_ */␊ |
235 | |