Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Verbose error logging for ATAPI CD/DVD devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 1994-1996  Scott Snyder <snyder@fnald0.fnal.gov>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (C) 1996-1998  Erik Andersen <andersee@debian.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright (C) 1998-2000  Jens Axboe <axboe@suse.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/blkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/cdrom.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/ide.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <scsi/scsi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "ide-cd.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #ifndef CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) void ide_cd_log_error(const char *name, struct request *failed_command,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 		      struct request_sense *sense)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	/* Suppress printing unit attention and `in progress of becoming ready'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	   errors when we're not being verbose. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	if (sense->sense_key == UNIT_ATTENTION ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	    (sense->sense_key == NOT_READY && (sense->asc == 4 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 						sense->asc == 0x3a)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	printk(KERN_ERR "%s: error code: 0x%02x  sense_key: 0x%02x  "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 			"asc: 0x%02x  ascq: 0x%02x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 			name, sense->error_code, sense->sense_key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 			sense->asc, sense->ascq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) /* The generic packet command opcodes for CD/DVD Logical Units,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) static const struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	unsigned short packet_command;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	const char * const text;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) } packet_command_texts[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	{ GPCMD_TEST_UNIT_READY, "Test Unit Ready" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	{ GPCMD_REQUEST_SENSE, "Request Sense" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	{ GPCMD_FORMAT_UNIT, "Format Unit" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	{ GPCMD_INQUIRY, "Inquiry" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	{ GPCMD_START_STOP_UNIT, "Start/Stop Unit" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	{ GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL, "Prevent/Allow Medium Removal" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	{ GPCMD_READ_FORMAT_CAPACITIES, "Read Format Capacities" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	{ GPCMD_READ_CDVD_CAPACITY, "Read Cd/Dvd Capacity" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	{ GPCMD_READ_10, "Read 10" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	{ GPCMD_WRITE_10, "Write 10" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	{ GPCMD_SEEK, "Seek" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	{ GPCMD_WRITE_AND_VERIFY_10, "Write and Verify 10" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	{ GPCMD_VERIFY_10, "Verify 10" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	{ GPCMD_FLUSH_CACHE, "Flush Cache" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	{ GPCMD_READ_SUBCHANNEL, "Read Subchannel" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	{ GPCMD_READ_TOC_PMA_ATIP, "Read Table of Contents" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	{ GPCMD_READ_HEADER, "Read Header" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	{ GPCMD_PLAY_AUDIO_10, "Play Audio 10" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	{ GPCMD_GET_CONFIGURATION, "Get Configuration" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	{ GPCMD_PLAY_AUDIO_MSF, "Play Audio MSF" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	{ GPCMD_PLAYAUDIO_TI, "Play Audio TrackIndex" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	{ GPCMD_GET_EVENT_STATUS_NOTIFICATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		"Get Event Status Notification" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	{ GPCMD_PAUSE_RESUME, "Pause/Resume" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	{ GPCMD_STOP_PLAY_SCAN, "Stop Play/Scan" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	{ GPCMD_READ_DISC_INFO, "Read Disc Info" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	{ GPCMD_READ_TRACK_RZONE_INFO, "Read Track Rzone Info" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	{ GPCMD_RESERVE_RZONE_TRACK, "Reserve Rzone Track" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	{ GPCMD_SEND_OPC, "Send OPC" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	{ GPCMD_MODE_SELECT_10, "Mode Select 10" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	{ GPCMD_REPAIR_RZONE_TRACK, "Repair Rzone Track" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	{ GPCMD_MODE_SENSE_10, "Mode Sense 10" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	{ GPCMD_CLOSE_TRACK, "Close Track" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	{ GPCMD_BLANK, "Blank" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	{ GPCMD_SEND_EVENT, "Send Event" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	{ GPCMD_SEND_KEY, "Send Key" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	{ GPCMD_REPORT_KEY, "Report Key" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	{ GPCMD_LOAD_UNLOAD, "Load/Unload" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	{ GPCMD_SET_READ_AHEAD, "Set Read-ahead" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	{ GPCMD_READ_12, "Read 12" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	{ GPCMD_GET_PERFORMANCE, "Get Performance" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	{ GPCMD_SEND_DVD_STRUCTURE, "Send DVD Structure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	{ GPCMD_READ_DVD_STRUCTURE, "Read DVD Structure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	{ GPCMD_SET_STREAMING, "Set Streaming" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	{ GPCMD_READ_CD_MSF, "Read CD MSF" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	{ GPCMD_SCAN, "Scan" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	{ GPCMD_SET_SPEED, "Set Speed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	{ GPCMD_PLAY_CD, "Play CD" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	{ GPCMD_MECHANISM_STATUS, "Mechanism Status" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	{ GPCMD_READ_CD, "Read CD" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) /* From Table 303 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) static const char * const sense_key_texts[16] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	"No sense data",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	"Recovered error",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	"Not ready",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	"Medium error",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	"Hardware error",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	"Illegal request",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	"Unit attention",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	"Data protect",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	"Blank check",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	"(reserved)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	"(reserved)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	"Aborted command",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	"(reserved)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	"(reserved)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	"Miscompare",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	"(reserved)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* From Table 304 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static const struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	unsigned long asc_ascq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	const char * const text;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) } sense_data_texts[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	{ 0x000000, "No additional sense information" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	{ 0x000011, "Play operation in progress" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	{ 0x000012, "Play operation paused" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	{ 0x000013, "Play operation successfully completed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	{ 0x000014, "Play operation stopped due to error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	{ 0x000015, "No current audio status to return" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	{ 0x010c0a, "Write error - padding blocks added" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	{ 0x011700, "Recovered data with no error correction applied" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	{ 0x011701, "Recovered data with retries" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	{ 0x011702, "Recovered data with positive head offset" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	{ 0x011703, "Recovered data with negative head offset" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	{ 0x011704, "Recovered data with retries and/or CIRC applied" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	{ 0x011705, "Recovered data using previous sector ID" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	{ 0x011800, "Recovered data with error correction applied" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	{ 0x011801, "Recovered data with error correction and retries applied"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	{ 0x011802, "Recovered data - the data was auto-reallocated" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	{ 0x011803, "Recovered data with CIRC" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	{ 0x011804, "Recovered data with L-EC" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	{ 0x015d00, "Failure prediction threshold exceeded"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		    " - Predicted logical unit failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	{ 0x015d01, "Failure prediction threshold exceeded"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		    " - Predicted media failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	{ 0x015dff, "Failure prediction threshold exceeded - False" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	{ 0x017301, "Power calibration area almost full" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	{ 0x020400, "Logical unit not ready - cause not reportable" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	/* Following is misspelled in ATAPI 2.6, _and_ in Mt. Fuji */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	{ 0x020401, "Logical unit not ready"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		    " - in progress [sic] of becoming ready" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	{ 0x020402, "Logical unit not ready - initializing command required" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	{ 0x020403, "Logical unit not ready - manual intervention required" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	{ 0x020404, "Logical unit not ready - format in progress" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	{ 0x020407, "Logical unit not ready - operation in progress" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	{ 0x020408, "Logical unit not ready - long write in progress" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	{ 0x020600, "No reference position found (media may be upside down)" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	{ 0x023000, "Incompatible medium installed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	{ 0x023a00, "Medium not present" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	{ 0x025300, "Media load or eject failed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	{ 0x025700, "Unable to recover table of contents" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	{ 0x030300, "Peripheral device write fault" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	{ 0x030301, "No write current" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	{ 0x030302, "Excessive write errors" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	{ 0x030c00, "Write error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	{ 0x030c01, "Write error - Recovered with auto reallocation" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	{ 0x030c02, "Write error - auto reallocation failed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	{ 0x030c03, "Write error - recommend reassignment" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	{ 0x030c04, "Compression check miscompare error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	{ 0x030c05, "Data expansion occurred during compress" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	{ 0x030c06, "Block not compressible" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	{ 0x030c07, "Write error - recovery needed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	{ 0x030c08, "Write error - recovery failed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	{ 0x030c09, "Write error - loss of streaming" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	{ 0x031100, "Unrecovered read error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	{ 0x031106, "CIRC unrecovered error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	{ 0x033101, "Format command failed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	{ 0x033200, "No defect spare location available" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	{ 0x033201, "Defect list update failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	{ 0x035100, "Erase failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	{ 0x037200, "Session fixation error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	{ 0x037201, "Session fixation error writin lead-in" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	{ 0x037202, "Session fixation error writin lead-out" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	{ 0x037300, "CD control error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	{ 0x037302, "Power calibration area is full" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	{ 0x037303, "Power calibration area error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	{ 0x037304, "Program memory area / RMA update failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	{ 0x037305, "Program memory area / RMA is full" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	{ 0x037306, "Program memory area / RMA is (almost) full" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	{ 0x040200, "No seek complete" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	{ 0x040300, "Write fault" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	{ 0x040900, "Track following error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	{ 0x040901, "Tracking servo failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	{ 0x040902, "Focus servo failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	{ 0x040903, "Spindle servo failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	{ 0x041500, "Random positioning error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	{ 0x041501, "Mechanical positioning or changer error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	{ 0x041502, "Positioning error detected by read of medium" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	{ 0x043c00, "Mechanical positioning or changer error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	{ 0x044000, "Diagnostic failure on component (ASCQ)" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	{ 0x044400, "Internal CD/DVD logical unit failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	{ 0x04b600, "Media load mechanism failed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	{ 0x051a00, "Parameter list length error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	{ 0x052000, "Invalid command operation code" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	{ 0x052100, "Logical block address out of range" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	{ 0x052102, "Invalid address for write" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	{ 0x052400, "Invalid field in command packet" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	{ 0x052600, "Invalid field in parameter list" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	{ 0x052601, "Parameter not supported" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	{ 0x052602, "Parameter value invalid" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	{ 0x052700, "Write protected media" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	{ 0x052c00, "Command sequence error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	{ 0x052c03, "Current program area is not empty" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	{ 0x052c04, "Current program area is empty" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	{ 0x053001, "Cannot read medium - unknown format" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	{ 0x053002, "Cannot read medium - incompatible format" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	{ 0x053900, "Saving parameters not supported" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	{ 0x054e00, "Overlapped commands attempted" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	{ 0x055302, "Medium removal prevented" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	{ 0x055500, "System resource failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	{ 0x056300, "End of user area encountered on this track" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	{ 0x056400, "Illegal mode for this track or incompatible medium" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	{ 0x056f00, "Copy protection key exchange failure"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		    " - Authentication failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	{ 0x056f01, "Copy protection key exchange failure - Key not present" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	{ 0x056f02, "Copy protection key exchange failure"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		     " - Key not established" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	{ 0x056f03, "Read of scrambled sector without authentication" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	{ 0x056f04, "Media region code is mismatched to logical unit" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	{ 0x056f05, "Drive region must be permanent"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		    " / region reset count error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	{ 0x057203, "Session fixation error - incomplete track in session" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	{ 0x057204, "Empty or partially written reserved track" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	{ 0x057205, "No more RZONE reservations are allowed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	{ 0x05bf00, "Loss of streaming" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	{ 0x062800, "Not ready to ready transition, medium may have changed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	{ 0x062900, "Power on, reset or hardware reset occurred" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	{ 0x062a00, "Parameters changed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	{ 0x062a01, "Mode parameters changed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	{ 0x062e00, "Insufficient time for operation" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	{ 0x063f00, "Logical unit operating conditions have changed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	{ 0x063f01, "Microcode has been changed" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	{ 0x065a00, "Operator request or state change input (unspecified)" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	{ 0x065a01, "Operator medium removal request" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	{ 0x0bb900, "Play operation aborted" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	/* Here we use 0xff for the key (not a valid key) to signify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	 * that these can have _any_ key value associated with them... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	{ 0xff0401, "Logical unit is in process of becoming ready" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	{ 0xff0400, "Logical unit not ready, cause not reportable" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	{ 0xff0402, "Logical unit not ready, initializing command required" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	{ 0xff0403, "Logical unit not ready, manual intervention required" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	{ 0xff0500, "Logical unit does not respond to selection" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	{ 0xff0800, "Logical unit communication failure" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	{ 0xff0802, "Logical unit communication parity error" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	{ 0xff0801, "Logical unit communication time-out" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	{ 0xff2500, "Logical unit not supported" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	{ 0xff4c00, "Logical unit failed self-configuration" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	{ 0xff3e00, "Logical unit has not self-configured yet" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) void ide_cd_log_error(const char *name, struct request *failed_command,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		      struct request_sense *sense)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	const char *s = "bad sense key!";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	char buf[80];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	printk(KERN_ERR "ATAPI device %s:\n", name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	if (sense->error_code == 0x70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		printk(KERN_CONT "  Error: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	else if (sense->error_code == 0x71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 		printk("  Deferred Error: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	else if (sense->error_code == 0x7f)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 		printk(KERN_CONT "  Vendor-specific Error: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 		printk(KERN_CONT "  Unknown Error Type: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	if (sense->sense_key < ARRAY_SIZE(sense_key_texts))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 		s = sense_key_texts[sense->sense_key];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	printk(KERN_CONT "%s -- (Sense key=0x%02x)\n", s, sense->sense_key);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	if (sense->asc == 0x40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		sprintf(buf, "Diagnostic failure on component 0x%02x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 			sense->ascq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 		s = buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 		int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 		unsigned long key = (sense->sense_key << 16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		key |= (sense->asc << 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 		if (!(sense->ascq >= 0x80 && sense->ascq <= 0xdd))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 			key |= sense->ascq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		s = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 		while (hi > lo) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 			mid = (lo + hi) / 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			if (sense_data_texts[mid].asc_ascq == key ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 			    sense_data_texts[mid].asc_ascq == (0xff0000|key)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 				s = sense_data_texts[mid].text;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 			} else if (sense_data_texts[mid].asc_ascq > key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 				hi = mid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 			else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 				lo = mid + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	if (s == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 		if (sense->asc > 0x80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 			s = "(vendor-specific error)";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 			s = "(reserved error code)";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	printk(KERN_ERR "  %s -- (asc=0x%02x, ascq=0x%02x)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 			s, sense->asc, sense->ascq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	if (failed_command != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 		int lo = 0, mid, hi = ARRAY_SIZE(packet_command_texts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 		s = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 		while (hi > lo) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 			mid = (lo + hi) / 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 			if (packet_command_texts[mid].packet_command ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 			    scsi_req(failed_command)->cmd[0]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 				s = packet_command_texts[mid].text;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 			if (packet_command_texts[mid].packet_command >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 			    scsi_req(failed_command)->cmd[0])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 				hi = mid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 			else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 				lo = mid + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		printk(KERN_ERR "  The failed \"%s\" packet command "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 				"was: \n  \"", s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		for (i = 0; i < BLK_MAX_CDB; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 			printk(KERN_CONT "%02x ", scsi_req(failed_command)->cmd[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 		printk(KERN_CONT "\"\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	/* The SKSV bit specifies validity of the sense_key_specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	 * in the next two commands. It is bit 7 of the first byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	 * In the case of NOT_READY, if SKSV is set the drive can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	 * give us nice ETA readings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	if (sense->sense_key == NOT_READY && (sense->sks[0] & 0x80)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 		int progress = (sense->sks[1] << 8 | sense->sks[2]) * 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		printk(KERN_ERR "  Command is %02d%% complete\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 				progress / 0xffff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	if (sense->sense_key == ILLEGAL_REQUEST &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	    (sense->sks[0] & 0x80) != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 		printk(KERN_ERR "  Error in %s byte %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 				(sense->sks[0] & 0x40) != 0 ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 				"command packet" : "command data",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 				(sense->sks[1] << 8) + sense->sks[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 		if ((sense->sks[0] & 0x40) != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 			printk(KERN_CONT " bit %d", sense->sks[0] & 0x07);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		printk(KERN_CONT "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) #endif