9 #include <linux/kernel.h>
11 #include <linux/cdrom.h>
12 #include <scsi/scsi.h>
14 #ifndef CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS
26 "asc: 0x%02x ascq: 0x%02x\n",
27 name, sense->error_code, sense->sense_key,
35 const char *
const text;
36 } packet_command_texts[] = {
59 "Get Event Status Notification" },
90 static const char *
const sense_key_texts[16] = {
110 static const struct {
111 unsigned long asc_ascq;
112 const char *
const text;
113 } sense_data_texts[] = {
114 { 0x000000,
"No additional sense information" },
115 { 0x000011,
"Play operation in progress" },
116 { 0x000012,
"Play operation paused" },
117 { 0x000013,
"Play operation successfully completed" },
118 { 0x000014,
"Play operation stopped due to error" },
119 { 0x000015,
"No current audio status to return" },
120 { 0x010c0a,
"Write error - padding blocks added" },
121 { 0x011700,
"Recovered data with no error correction applied" },
122 { 0x011701,
"Recovered data with retries" },
123 { 0x011702,
"Recovered data with positive head offset" },
124 { 0x011703,
"Recovered data with negative head offset" },
125 { 0x011704,
"Recovered data with retries and/or CIRC applied" },
126 { 0x011705,
"Recovered data using previous sector ID" },
127 { 0x011800,
"Recovered data with error correction applied" },
128 { 0x011801,
"Recovered data with error correction and retries applied"},
129 { 0x011802,
"Recovered data - the data was auto-reallocated" },
130 { 0x011803,
"Recovered data with CIRC" },
131 { 0x011804,
"Recovered data with L-EC" },
132 { 0x015d00,
"Failure prediction threshold exceeded"
133 " - Predicted logical unit failure" },
134 { 0x015d01,
"Failure prediction threshold exceeded"
135 " - Predicted media failure" },
136 { 0x015dff,
"Failure prediction threshold exceeded - False" },
137 { 0x017301,
"Power calibration area almost full" },
138 { 0x020400,
"Logical unit not ready - cause not reportable" },
140 { 0x020401,
"Logical unit not ready"
141 " - in progress [sic] of becoming ready" },
142 { 0x020402,
"Logical unit not ready - initializing command required" },
143 { 0x020403,
"Logical unit not ready - manual intervention required" },
144 { 0x020404,
"Logical unit not ready - format in progress" },
145 { 0x020407,
"Logical unit not ready - operation in progress" },
146 { 0x020408,
"Logical unit not ready - long write in progress" },
147 { 0x020600,
"No reference position found (media may be upside down)" },
148 { 0x023000,
"Incompatible medium installed" },
149 { 0x023a00,
"Medium not present" },
150 { 0x025300,
"Media load or eject failed" },
151 { 0x025700,
"Unable to recover table of contents" },
152 { 0x030300,
"Peripheral device write fault" },
153 { 0x030301,
"No write current" },
154 { 0x030302,
"Excessive write errors" },
155 { 0x030c00,
"Write error" },
156 { 0x030c01,
"Write error - Recovered with auto reallocation" },
157 { 0x030c02,
"Write error - auto reallocation failed" },
158 { 0x030c03,
"Write error - recommend reassignment" },
159 { 0x030c04,
"Compression check miscompare error" },
160 { 0x030c05,
"Data expansion occurred during compress" },
161 { 0x030c06,
"Block not compressible" },
162 { 0x030c07,
"Write error - recovery needed" },
163 { 0x030c08,
"Write error - recovery failed" },
164 { 0x030c09,
"Write error - loss of streaming" },
165 { 0x031100,
"Unrecovered read error" },
166 { 0x031106,
"CIRC unrecovered error" },
167 { 0x033101,
"Format command failed" },
168 { 0x033200,
"No defect spare location available" },
169 { 0x033201,
"Defect list update failure" },
170 { 0x035100,
"Erase failure" },
171 { 0x037200,
"Session fixation error" },
172 { 0x037201,
"Session fixation error writin lead-in" },
173 { 0x037202,
"Session fixation error writin lead-out" },
174 { 0x037300,
"CD control error" },
175 { 0x037302,
"Power calibration area is full" },
176 { 0x037303,
"Power calibration area error" },
177 { 0x037304,
"Program memory area / RMA update failure" },
178 { 0x037305,
"Program memory area / RMA is full" },
179 { 0x037306,
"Program memory area / RMA is (almost) full" },
180 { 0x040200,
"No seek complete" },
181 { 0x040300,
"Write fault" },
182 { 0x040900,
"Track following error" },
183 { 0x040901,
"Tracking servo failure" },
184 { 0x040902,
"Focus servo failure" },
185 { 0x040903,
"Spindle servo failure" },
186 { 0x041500,
"Random positioning error" },
187 { 0x041501,
"Mechanical positioning or changer error" },
188 { 0x041502,
"Positioning error detected by read of medium" },
189 { 0x043c00,
"Mechanical positioning or changer error" },
190 { 0x044000,
"Diagnostic failure on component (ASCQ)" },
191 { 0x044400,
"Internal CD/DVD logical unit failure" },
192 { 0x04b600,
"Media load mechanism failed" },
193 { 0x051a00,
"Parameter list length error" },
194 { 0x052000,
"Invalid command operation code" },
195 { 0x052100,
"Logical block address out of range" },
196 { 0x052102,
"Invalid address for write" },
197 { 0x052400,
"Invalid field in command packet" },
198 { 0x052600,
"Invalid field in parameter list" },
199 { 0x052601,
"Parameter not supported" },
200 { 0x052602,
"Parameter value invalid" },
201 { 0x052700,
"Write protected media" },
202 { 0x052c00,
"Command sequence error" },
203 { 0x052c03,
"Current program area is not empty" },
204 { 0x052c04,
"Current program area is empty" },
205 { 0x053001,
"Cannot read medium - unknown format" },
206 { 0x053002,
"Cannot read medium - incompatible format" },
207 { 0x053900,
"Saving parameters not supported" },
208 { 0x054e00,
"Overlapped commands attempted" },
209 { 0x055302,
"Medium removal prevented" },
210 { 0x055500,
"System resource failure" },
211 { 0x056300,
"End of user area encountered on this track" },
212 { 0x056400,
"Illegal mode for this track or incompatible medium" },
213 { 0x056f00,
"Copy protection key exchange failure"
214 " - Authentication failure" },
215 { 0x056f01,
"Copy protection key exchange failure - Key not present" },
216 { 0x056f02,
"Copy protection key exchange failure"
217 " - Key not established" },
218 { 0x056f03,
"Read of scrambled sector without authentication" },
219 { 0x056f04,
"Media region code is mismatched to logical unit" },
220 { 0x056f05,
"Drive region must be permanent"
221 " / region reset count error" },
222 { 0x057203,
"Session fixation error - incomplete track in session" },
223 { 0x057204,
"Empty or partially written reserved track" },
224 { 0x057205,
"No more RZONE reservations are allowed" },
225 { 0x05bf00,
"Loss of streaming" },
226 { 0x062800,
"Not ready to ready transition, medium may have changed" },
227 { 0x062900,
"Power on, reset or hardware reset occurred" },
228 { 0x062a00,
"Parameters changed" },
229 { 0x062a01,
"Mode parameters changed" },
230 { 0x062e00,
"Insufficient time for operation" },
231 { 0x063f00,
"Logical unit operating conditions have changed" },
232 { 0x063f01,
"Microcode has been changed" },
233 { 0x065a00,
"Operator request or state change input (unspecified)" },
234 { 0x065a01,
"Operator medium removal request" },
235 { 0x0bb900,
"Play operation aborted" },
238 { 0xff0401,
"Logical unit is in process of becoming ready" },
239 { 0xff0400,
"Logical unit not ready, cause not reportable" },
240 { 0xff0402,
"Logical unit not ready, initializing command required" },
241 { 0xff0403,
"Logical unit not ready, manual intervention required" },
242 { 0xff0500,
"Logical unit does not respond to selection" },
243 { 0xff0800,
"Logical unit communication failure" },
244 { 0xff0802,
"Logical unit communication parity error" },
245 { 0xff0801,
"Logical unit communication time-out" },
246 { 0xff2500,
"Logical unit not supported" },
247 { 0xff4c00,
"Logical unit failed self-configuration" },
248 { 0xff3e00,
"Logical unit has not self-configured yet" },
255 const char *
s =
"bad sense key!";
259 if (sense->error_code == 0x70)
261 else if (sense->error_code == 0x71)
262 printk(
" Deferred Error: ");
263 else if (sense->error_code == 0x7f)
268 if (sense->sense_key <
ARRAY_SIZE(sense_key_texts))
269 s = sense_key_texts[sense->sense_key];
273 if (sense->
asc == 0x40) {
274 sprintf(buf,
"Diagnostic failure on component 0x%02x",
279 unsigned long key = (sense->sense_key << 16);
281 key |= (sense->
asc << 8);
282 if (!(sense->
ascq >= 0x80 && sense->
ascq <= 0xdd))
288 if (sense_data_texts[
mid].asc_ascq == key ||
289 sense_data_texts[
mid].asc_ascq == (0xff0000|key)) {
290 s = sense_data_texts[
mid].text;
292 }
else if (sense_data_texts[
mid].asc_ascq > key)
300 if (sense->
asc > 0x80)
301 s =
"(vendor-specific error)";
303 s =
"(reserved error code)";
309 if (failed_command !=
NULL) {
316 failed_command->
cmd[0]) {
317 s = packet_command_texts[
mid].text;
321 failed_command->
cmd[0])
329 for (i = 0; i < BLK_MAX_CDB; i++)
339 if (sense->sense_key ==
NOT_READY && (sense->
sks[0] & 0x80)) {
347 (sense->
sks[0] & 0x80) != 0) {
349 (sense->
sks[0] & 0x40) != 0 ?
350 "command packet" :
"command data",
351 (sense->
sks[1] << 8) + sense->
sks[2]);
353 if ((sense->
sks[0] & 0x40) != 0)