Commit 0b2c0d4f authored by Andries E. Brouwer's avatar Andries E. Brouwer Committed by Linus Torvalds

[PATCH] SCSI stuff part 2

Below a patch removing the list of sense codes from usb/storage/debug.h
since the same list is already found in scsi/constants.c.
This also brings this list up to date with SCSI-3.
parent a19bafa6
No related merge requests found
......@@ -154,7 +154,6 @@
#include "../../scsi/scsi.h"
#include "../../scsi/hosts.h"
#include "../../scsi/constants.h"
#include "acornscsi.h"
#include "msgqueue.h"
#include "scsi.h"
......
......@@ -61,7 +61,6 @@
#include "../../scsi/scsi.h"
#include "../../scsi/hosts.h"
#include "../../scsi/constants.h"
#include <scsi/scsicam.h>
......
......@@ -54,7 +54,6 @@
#include "../../scsi/scsi.h"
#include "../../scsi/hosts.h"
#include "../../scsi/NCR5380.h"
#include "../../scsi/constants.h"
#define ECOSCSI_PUBLIC_RELEASE 1
......
......@@ -59,7 +59,6 @@
#include "../../scsi/scsi.h"
#include "../../scsi/hosts.h"
#include "../../scsi/constants.h"
#define OAKSCSI_PUBLIC_RELEASE 1
......
......@@ -241,7 +241,6 @@
#include "scsi.h"
#include "hosts.h"
#include "53c7,8xx.h"
#include "constants.h"
#include "sd.h"
#include <linux/stat.h>
#include <linux/stddef.h>
......
......@@ -137,7 +137,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include "53c700.h"
......
......@@ -281,7 +281,6 @@
#include "scsi.h"
#include "hosts.h"
#include "53c7xx.h"
#include "constants.h"
#include "sd.h"
#include <linux/stat.h>
#include <linux/stddef.h>
......
......@@ -17,7 +17,6 @@
#include "scsi.h"
#include "hosts.h"
#include "AM53C974.h"
#include "constants.h"
#include "sd.h"
/* AM53/79C974 (PCscsi) driver release 0.5
......
......@@ -115,7 +115,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include "53c700.h"
#include "NCR_D700.h"
......
......@@ -234,7 +234,6 @@
#include "scsi.h"
#include "sd.h"
#include "hosts.h"
#include "constants.h"
#include <asm/system.h>
#include <linux/errno.h>
#include <linux/string.h>
......
......@@ -105,7 +105,6 @@
#include "hosts.h"
#include "atari_scsi.h"
#include "NCR5380.h"
#include "constants.h"
#include <asm/atari_stdma.h>
#include <asm/atari_stram.h>
#include <asm/io.h>
......
This diff is collapsed.
#ifndef _CONSTANTS_H
#define _CONSTANTS_H
extern int print_msg(unsigned char *);
extern void print_status(int);
extern void print_Scsi_Cmnd (Scsi_Cmnd *);
#endif /* def _CONSTANTS_H */
......@@ -34,7 +34,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include "sd.h"
#include "dmx3191d.h"
......
......@@ -83,7 +83,6 @@
#include "dtc.h"
#define AUTOPROBE_IRQ
#include "NCR5380.h"
#include "constants.h"
#include "sd.h"
#include <linux/stat.h>
#include <linux/string.h>
......
......@@ -116,7 +116,6 @@
#include "hosts.h"
#include "g_NCR5380.h"
#include "NCR5380.h"
#include "constants.h"
#include "sd.h"
#include <linux/stat.h>
#include <linux/init.h>
......
......@@ -57,7 +57,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include "lasi700.h"
#include "53c700.h"
......
......@@ -70,7 +70,6 @@
#include "hosts.h"
#include "mac_scsi.h"
#include "NCR5380.h"
#include "constants.h"
#if 0
#define NDEBUG (NDEBUG_INTR | NDEBUG_PSEUDO_DMA | NDEBUG_ARBITRATION | NDEBUG_SELECTION | NDEBUG_RESELECTION)
......
......@@ -157,7 +157,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include "sd.h"
#include <linux/types.h>
......
......@@ -74,8 +74,6 @@ const char * osst_version = "0.9.10";
#include "osst_options.h"
#include "osst_detect.h"
#include "constants.h"
static int buffer_kbs = 0;
static int write_threshold_kbs = 0;
static int max_buffers = 0;
......
......@@ -123,7 +123,6 @@
#include "pas16.h"
#define AUTOPROBE_IRQ
#include "NCR5380.h"
#include "constants.h"
#include "sd.h"
#include <linux/stat.h>
......
......@@ -69,7 +69,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
......
......@@ -527,24 +527,30 @@ extern struct proc_dir_entry *proc_scsi;
/*
* Prototypes for functions in constants.c
* Some of these used to live in constants.h
*/
extern void print_Scsi_Cmnd (Scsi_Cmnd *);
extern void print_command(unsigned char *);
extern void print_sense(const char *, Scsi_Cmnd *);
extern void print_req_sense(const char *, Scsi_Request *);
extern void print_driverbyte(int scsiresult);
extern void print_hostbyte(int scsiresult);
extern void print_status (int status);
extern void print_status(unsigned char status);
extern int print_msg(const unsigned char *);
extern const char *scsi_sense_key_string(unsigned char);
extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
/*
* The scsi_device struct contains what we know about each given scsi
* device.
*
* FIXME(eric) - one of the great regrets that I have is that I failed to define
* these structure elements as something like sdev_foo instead of foo. This would
* make it so much easier to grep through sources and so forth. I propose that
* all new elements that get added to these structures follow this convention.
* As time goes on and as people have the stomach for it, it should be possible to
* go back and retrofit at least some of the elements here with with the prefix.
* FIXME(eric) - One of the great regrets that I have is that I failed to
* define these structure elements as something like sdev_foo instead of foo.
* This would make it so much easier to grep through sources and so forth.
* I propose that all new elements that get added to these structures follow
* this convention. As time goes on and as people have the stomach for it,
* it should be possible to go back and retrofit at least some of the elements
* here with with the prefix.
*/
struct scsi_device {
......@@ -851,22 +857,3 @@ struct scsi_cmnd {
extern int scsi_reset_provider(Scsi_Device *, int);
#endif
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-indent-level: 4
* c-brace-imaginary-offset: 0
* c-brace-offset: -4
* c-argdecl-indent: 4
* c-label-offset: -4
* c-continued-statement-offset: 4
* c-continued-brace-offset: 0
* indent-tabs-mode: nil
* tab-width: 8
* End:
*/
......@@ -32,7 +32,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
/*
* We must always allow SHUTDOWN_SIGS. Even if we are not a module,
......@@ -2014,23 +2013,3 @@ scsi_new_reset(Scsi_Cmnd *SCpnt, int flag)
return rtn;
}
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-indent-level: 4
* c-brace-imaginary-offset: 0
* c-brace-offset: -4
* c-argdecl-indent: 4
* c-label-offset: -4
* c-continued-statement-offset: 4
* c-continued-brace-offset: 0
* indent-tabs-mode: nil
* tab-width: 8
* End:
*/
......@@ -43,7 +43,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include <scsi/scsi_ioctl.h>
/*
......
......@@ -42,7 +42,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include <scsi/scsi_ioctl.h>
/*
......
......@@ -34,7 +34,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
/*
* TODO:
......
......@@ -16,7 +16,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
......
......@@ -21,7 +21,6 @@
#include "scsi.h"
#include <scsi/scsi_ioctl.h>
#include "hosts.h"
#include "constants.h"
#include "sd.h"
#include <scsi/scsicam.h>
......@@ -48,6 +47,8 @@ EXPORT_SYMBOL(print_sense);
EXPORT_SYMBOL(print_req_sense);
EXPORT_SYMBOL(print_msg);
EXPORT_SYMBOL(print_status);
EXPORT_SYMBOL(scsi_sense_key_string);
EXPORT_SYMBOL(scsi_extd_sense_format);
EXPORT_SYMBOL(kernel_scsi_ioctl);
EXPORT_SYMBOL(scsi_release_command);
EXPORT_SYMBOL(print_Scsi_Cmnd);
......
......@@ -57,7 +57,6 @@
#include "hosts.h"
#include "sd.h"
#include <scsi/scsi_ioctl.h>
#include "constants.h"
#include <scsi/scsicam.h> /* must follow "hosts.h" */
#include <linux/genhd.h>
......@@ -232,7 +231,7 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
or driver values */
if(host->hostt->bios_param != NULL)
host->hostt->bios_param(sdkp, dev,
host->hostt->bios_param(sdkp, dev,
&diskinfo[0]);
else
scsicam_bios_param(sdkp, dev, &diskinfo[0]);
......@@ -551,8 +550,7 @@ static int sd_open(struct inode *inode, struct file *filp)
/*
* It is possible that the disk changing stuff resulted in the device
* being taken offline. If this is the case, report this to the user,
* and don't pretend that
* the open actually succeeded.
* and don't pretend that the open actually succeeded.
*/
if (!sdp->online) {
goto error_out;
......@@ -754,6 +752,13 @@ static void sd_rw_intr(Scsi_Cmnd * SCpnt)
scsi_io_completion(SCpnt, good_sectors, block_sectors);
}
static void
sd_set_media_not_present(Scsi_Disk *sdkp) {
sdkp->media_present = 0;
sdkp->capacity = 0;
sdkp->device->changed = 1;
}
/**
* check_scsidisk_media_change - self descriptive
* @full_dev: kernel device descriptor (kdev_t)
......@@ -828,13 +833,6 @@ static int check_scsidisk_media_change(kdev_t full_dev)
return retval;
}
static void
sd_set_media_not_present(Scsi_Disk *sdkp) {
sdkp->media_present = 0;
sdkp->capacity = 0;
sdkp->device->changed = 1;
}
static int
sd_media_not_present(Scsi_Disk *sdkp, Scsi_Request *SRpnt) {
int the_result = SRpnt->sr_result;
......@@ -1325,7 +1323,7 @@ static int sd_init()
}
/**
* sd_finish- called during driver initialization, after all
* sd_finish - called during driver initialization, after all
* the sd_attach() calls are finished.
*
* Note: this function is invoked from the scsi mid-level.
......@@ -1361,7 +1359,7 @@ static void sd_finish()
}
/**
* sd_detect- called at the start of driver initialization, once
* sd_detect - called at the start of driver initialization, once
* for each scsi device (not just disks) present.
*
* Returns 0 if not interested in this scsi device (e.g. scanner);
......@@ -1380,7 +1378,7 @@ static int sd_detect(Scsi_Device * sdp)
}
/**
* sd_attach- called during driver initialization and whenever a
* sd_attach - called during driver initialization and whenever a
* new scsi device is attached to the system. It is called once
* for each scsi device (not just disks) present.
* @sdp: pointer to mid level scsi device object
......@@ -1447,7 +1445,7 @@ static int sd_attach(Scsi_Device * sdp)
}
/**
* revalidate_scsidisk- called to flush all partitions and partition
* revalidate_scsidisk - called to flush all partitions and partition
* tables for a changed scsi disk. sd_init_onedisk() is then called
* followed by re-reading the new partition table.
* @dev: kernel device descriptor (kdev_t)
......@@ -1496,7 +1494,7 @@ static int fop_revalidate_scsidisk(kdev_t dev)
}
/**
* sd_detach- called whenever a scsi disk (previously recognized by
* sd_detach - called whenever a scsi disk (previously recognized by
* sd_attach) is detached from the system. It is called (potentially
* multiple times) during sd module unload.
* @sdp: pointer to mid level scsi device object
......@@ -1550,7 +1548,7 @@ static void sd_detach(Scsi_Device * sdp)
}
/**
* init_sd- entry point for this driver (both when built in or when
* init_sd - entry point for this driver (both when built in or when
* a module).
*
* Note: this function registers this driver with the scsi mid-level.
......@@ -1563,14 +1561,13 @@ static int __init init_sd(void)
}
/**
* exit_sd- exit point for this driver (when it is a module).
* exit_sd - exit point for this driver (when it is a module).
*
* Note: this function unregisters this driver from the scsi mid-level.
**/
static void __exit exit_sd(void)
{
int k;
Scsi_Disk * sdkp;
SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n"));
scsi_unregister_device(&sd_template);
......@@ -1579,15 +1576,12 @@ static void __exit exit_sd(void)
sd_registered--;
if (sd_dsk_arr != NULL) {
for (k = 0; k < sd_template.dev_max; ++k) {
sdkp = sd_dsk_arr[k];
if (sdkp)
vfree(sdkp);
}
for (k = 0; k < sd_template.dev_max; ++k)
vfree(sd_dsk_arr[k]);
vfree(sd_dsk_arr);
}
if (sd_sizes) vfree(sd_sizes);
if (sd) vfree((char *) sd);
vfree(sd_sizes);
vfree((char *) sd);
for (k = 0; k < N_USED_SD_MAJORS; k++) {
blk_dev[SD_MAJOR(k)].queue = NULL;
del_gendisk(&(sd_gendisks[k]));
......
......@@ -102,7 +102,6 @@
#include "scsi.h"
#include "hosts.h"
#include "seagate.h"
#include "constants.h"
#include <linux/stat.h>
#include <asm/uaccess.h>
#include "sd.h"
......@@ -1709,7 +1708,7 @@ static int internal_command (unsigned char target, unsigned char lun,
#endif
printk ("scsi%d : status = ", hostno);
print_status (status);
printk ("message = %02x\n", message);
printk (" message = %02x\n", message);
#endif
/* We shouldn't reach this until *after* BSY has been deasserted */
......
......@@ -56,7 +56,6 @@
#include "hosts.h"
#include "sr.h"
#include <scsi/scsi_ioctl.h> /* For the door lock/unlock commands */
#include "constants.h"
MODULE_PARM(xa_test, "i"); /* see sr_ioctl.c */
......
......@@ -67,8 +67,6 @@ static char *verstr = "20020205";
#include "st_options.h"
#include "st.h"
#include "constants.h"
static int buffer_kbs;
static int write_threshold_kbs;
static int max_buffers = (-1);
......
......@@ -78,7 +78,6 @@
#include "hosts.h"
#include "sun3_scsi.h"
#include "NCR5380.h"
#include "constants.h"
#define USE_WRAPPER
#define RESET_BOOT
......
......@@ -143,7 +143,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include "sd.h"
#include <linux/types.h>
......
......@@ -99,7 +99,6 @@
#include "../scsi.h"
#include "../hosts.h"
#include "../constants.h"
#include "../sd.h"
#include <linux/types.h>
......
......@@ -116,7 +116,6 @@
#include "t128.h"
#define AUTOPROBE_IRQ
#include "NCR5380.h"
#include "constants.h"
#include "sd.h"
#include <linux/stat.h>
#include <linux/init.h>
......
......@@ -228,7 +228,6 @@
#include "scsi.h"
#include "hosts.h"
#include "constants.h"
#include "sd.h"
#include <linux/stat.h>
#include <scsi/scsicam.h>
......
......@@ -218,158 +218,17 @@ void usb_stor_show_sense(
unsigned char asc,
unsigned char ascq) {
char *keys[] = {
"No Sense",
"Recovered Error",
"Not Ready",
"Medium Error",
"Hardware Error",
"Illegal Request",
"Unit Attention",
"Data Protect",
"Blank Check",
"Vendor Specific",
"Copy Aborted",
"Aborted Command",
"(Obsolete)",
"Volume Overflow",
"Miscompare"
};
const char *what, *keystr;
unsigned short qual = asc;
keystr = scsi_sense_key_string(key);
what = scsi_extd_sense_format(asc, ascq);
char *what = 0;
char *keystr = 0;
qual <<= 8;
qual |= ascq;
if (key>0x0E)
if (keystr == NULL)
keystr = "(Unknown Key)";
else
keystr = keys[key];
switch (qual) {
case 0x0000: what="no additional sense information"; break;
case 0x0001: what="filemark detected"; break;
case 0x0002: what="end of partition/medium detected"; break;
case 0x0003: what="setmark detected"; break;
case 0x0004: what="beginning of partition/medium detected"; break;
case 0x0005: what="end of data detected"; break;
case 0x0006: what="I/O process terminated"; break;
case 0x0011: what="audio play operation in progress"; break;
case 0x0012: what="audio play operation paused"; break;
case 0x0013: what="audio play operation stopped due to error"; break;
case 0x0014: what="audio play operation successfully completed"; break;
case 0x0015: what="no current audio status to return"; break;
case 0x0016: what="operation in progress"; break;
case 0x0017: what="cleaning requested"; break;
case 0x0100: what="no index/sector signal"; break;
case 0x0200: what="no seek complete"; break;
case 0x0300: what="peripheral device write fault"; break;
case 0x0301: what="no write current"; break;
case 0x0302: what="excessive write errors"; break;
case 0x0400: what="LUN not ready, cause not reportable"; break;
case 0x0401: what="LUN in process of becoming ready"; break;
case 0x0402: what="LUN not ready, initializing cmd. required"; break;
case 0x0403: what="LUN not ready, manual intervention required"; break;
case 0x0404: what="LUN not ready, format in progress"; break;
case 0x0405: what="LUN not ready, rebuild in progress"; break;
case 0x0406: what="LUN not ready, recalculation in progress"; break;
case 0x0407: what="LUN not ready, operation in progress"; break;
case 0x0408: what="LUN not ready, long write in progress"; break;
case 0x0500: what="LUN doesn't respond to selection"; break;
case 0x0A00: what="error log overflow"; break;
case 0x0C04: what="compression check miscompare error"; break;
case 0x0C05: what="data expansion occurred during compression"; break;
case 0x0C06: what="block not compressible"; break;
case 0x1102: what="error too long to correct"; break;
case 0x1106: what="CIRC unrecovered error"; break;
case 0x1107: what="data resynchronization error"; break;
case 0x110D: what="decompression CRC error"; break;
case 0x110E: what="can't decompress using declared algorithm"; break;
case 0x110F: what="error reading UPC/EAN number"; break;
case 0x1110: what="error reading ISRC number"; break;
case 0x1200: what="address mark not found for ID field"; break;
case 0x1300: what="address mark not found for data field"; break;
case 0x1403: what="end of data not found"; break;
case 0x1404: what="block sequence error"; break;
case 0x1600: what="data sync mark error"; break;
case 0x1601: what="data sync error: data rewritten"; break;
case 0x1602: what="data sync error: recommend rewrite"; break;
case 0x1603: what="data sync error: data auto-reallocated"; break;
case 0x1604: what="data sync error: recommend reassignment"; break;
case 0x1900: what="defect list error"; break;
case 0x1901: what="defect list not available"; break;
case 0x1902: what="defect list error in primary list"; break;
case 0x1903: what="defect list error in grown list"; break;
case 0x1C00: what="defect list not found"; break;
case 0x2000: what="invalid command operation code"; break;
case 0x2400: what="invalid field in CDB"; break;
case 0x2703: what="associated write protect"; break;
case 0x2800: what="not ready to ready transition"; break;
case 0x2900: what="device reset occurred"; break;
case 0x2903: what="bus device reset function occurred"; break;
case 0x2904: what="device internal reset"; break;
case 0x2B00: what="copy can't execute / host can't disconnect"; break;
case 0x2C00: what="command sequence error"; break;
case 0x2C03: what="current program area is not empty"; break;
case 0x2C04: what="current program area is empty"; break;
case 0x2F00: what="commands cleared by another initiator"; break;
case 0x3001: what="can't read medium: unknown format"; break;
case 0x3002: what="can't read medium: incompatible format"; break;
case 0x3003: what="cleaning cartridge installed"; break;
case 0x3004: what="can't write medium: unknown format"; break;
case 0x3005: what="can't write medium: incompatible format"; break;
case 0x3006: what="can't format medium: incompatible medium"; break;
case 0x3007: what="cleaning failure"; break;
case 0x3008: what="can't write: application code mismatch"; break;
case 0x3009: what="current session not fixated for append"; break;
case 0x3201: what="defect list update failure"; break;
case 0x3400: what="enclosure failure"; break;
case 0x3500: what="enclosure services failure"; break;
case 0x3502: what="enclosure services unavailable"; break;
case 0x3503: what="enclosure services transfer failure"; break;
case 0x3504: what="enclosure services transfer refused"; break;
case 0x3A00: what="media not present"; break;
case 0x3B0F: what="end of medium reached"; break;
case 0x3F02: what="changed operating definition"; break;
case 0x4100: what="data path failure (should use 40 NN)"; break;
case 0x4A00: what="command phase error"; break;
case 0x4B00: what="data phase error"; break;
case 0x5100: what="erase failure"; break;
case 0x5200: what="cartridge fault"; break;
case 0x6300: what="end of user area encountered on this track"; break;
case 0x6600: what="automatic document feeder cover up"; break;
case 0x6601: what="automatic document feeder lift up"; break;
case 0x6602: what="document jam in auto doc feeder"; break;
case 0x6603: what="document miss feed auto in doc feeder"; break;
case 0x6700: what="configuration failure"; break;
case 0x6701: what="configuration of incapable LUN's failed"; break;
case 0x6702: what="add logical unit failed"; break;
case 0x6706: what="attachment of logical unit failed"; break;
case 0x6707: what="creation of logical unit failed"; break;
case 0x6900: what="data loss on logical unit"; break;
case 0x6E00: what="command to logical unit failed"; break;
case 0x7100: what="decompression exception long algorithm ID"; break;
case 0x7204: what="empty or partially written reserved track"; break;
case 0x7300: what="CD control error"; break;
default:
if (asc==0x40) {
US_DEBUGP("%s: diagnostic failure on component"
" %02X\n", keystr, ascq);
return;
}
if (asc==0x70) {
US_DEBUGP("%s: decompression exception short"
" algorithm ID of %02X\n", keystr, ascq);
return;
}
if (what == NULL)
what = "(unknown ASC/ASCQ)";
}
US_DEBUGP("%s: %s\n", keystr, what);
US_DEBUGP("%s: ", keystr);
US_DEBUGPX(what, ascq);
US_DEBUGPX("\n");
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment