aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/constants.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/constants.c')
-rw-r--r--drivers/scsi/constants.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index ec161733a82b..f6be2c1c3942 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -17,6 +17,7 @@
17#include <scsi/scsi_host.h> 17#include <scsi/scsi_host.h>
18#include <scsi/scsi_request.h> 18#include <scsi/scsi_request.h>
19#include <scsi/scsi_eh.h> 19#include <scsi/scsi_eh.h>
20#include <scsi/scsi_dbg.h>
20 21
21 22
22 23
@@ -1155,6 +1156,31 @@ scsi_show_extd_sense(unsigned char asc, unsigned char ascq)
1155 } 1156 }
1156} 1157}
1157 1158
1159void
1160scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr)
1161{
1162 const char *sense_txt;
1163 /* An example of deferred is when an earlier write to disk cache
1164 * succeeded, but now the disk discovers that it cannot write the
1165 * data to the magnetic media.
1166 */
1167 const char *error = scsi_sense_is_deferred(sshdr) ?
1168 "<<DEFERRED>>" : "Current";
1169 printk(KERN_INFO "%s: %s", name, error);
1170 if (sshdr->response_code >= 0x72)
1171 printk(" [descriptor]");
1172
1173 sense_txt = scsi_sense_key_string(sshdr->sense_key);
1174 if (sense_txt)
1175 printk(": sense key: %s\n", sense_txt);
1176 else
1177 printk(": sense key=0x%x\n", sshdr->sense_key);
1178 printk(KERN_INFO " ");
1179 scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
1180 printk("\n");
1181}
1182EXPORT_SYMBOL(scsi_print_sense_hdr);
1183
1158/* Print sense information */ 1184/* Print sense information */
1159void 1185void
1160__scsi_print_sense(const char *name, const unsigned char *sense_buffer, 1186__scsi_print_sense(const char *name, const unsigned char *sense_buffer,
@@ -1162,8 +1188,6 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
1162{ 1188{
1163 int k, num, res; 1189 int k, num, res;
1164 unsigned int info; 1190 unsigned int info;
1165 const char *error;
1166 const char *sense_txt;
1167 struct scsi_sense_hdr ssh; 1191 struct scsi_sense_hdr ssh;
1168 1192
1169 res = scsi_normalize_sense(sense_buffer, sense_len, &ssh); 1193 res = scsi_normalize_sense(sense_buffer, sense_len, &ssh);
@@ -1181,26 +1205,7 @@ __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
1181 printk("\n"); 1205 printk("\n");
1182 return; 1206 return;
1183 } 1207 }
1184 1208 scsi_print_sense_hdr(name, &ssh);
1185 /* An example of deferred is when an earlier write to disk cache
1186 * succeeded, but now the disk discovers that it cannot write the
1187 * data to the magnetic media.
1188 */
1189 error = scsi_sense_is_deferred(&ssh) ?
1190 "<<DEFERRED>>" : "Current";
1191 printk(KERN_INFO "%s: %s", name, error);
1192 if (ssh.response_code >= 0x72)
1193 printk(" [descriptor]");
1194
1195 sense_txt = scsi_sense_key_string(ssh.sense_key);
1196 if (sense_txt)
1197 printk(": sense key: %s\n", sense_txt);
1198 else
1199 printk(": sense key=0x%x\n", ssh.sense_key);
1200 printk(KERN_INFO " ");
1201 scsi_show_extd_sense(ssh.asc, ssh.ascq);
1202 printk("\n");
1203
1204 if (ssh.response_code < 0x72) { 1209 if (ssh.response_code < 0x72) {
1205 /* only decode extras for "fixed" format now */ 1210 /* only decode extras for "fixed" format now */
1206 char buff[80]; 1211 char buff[80];