浏览代码

merge by hand (scsi_device.h)

James Bottomley 20 年之前
父节点
当前提交
c46f2ffb9e

+ 0 - 5
drivers/block/scsi_ioctl.c

@@ -328,11 +328,6 @@ static int sg_io(struct file *file, request_queue_t *q,
 	return 0;
 	return 0;
 }
 }
 
 
-#define FORMAT_UNIT_TIMEOUT		(2 * 60 * 60 * HZ)
-#define START_STOP_TIMEOUT		(60 * HZ)
-#define MOVE_MEDIUM_TIMEOUT		(5 * 60 * HZ)
-#define READ_ELEMENT_STATUS_TIMEOUT	(5 * 60 * HZ)
-#define READ_DEFECT_DATA_TIMEOUT	(60 * HZ )
 #define OMAX_SB_LEN 16          /* For backward compatibility */
 #define OMAX_SB_LEN 16          /* For backward compatibility */
 
 
 static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
 static int sg_scsi_ioctl(struct file *file, request_queue_t *q,

+ 27 - 14
drivers/message/i2o/i2o_config.c

@@ -54,6 +54,9 @@
 
 
 extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int);
 extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int);
 
 
+static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
+			 unsigned long arg);
+
 static spinlock_t i2o_config_lock;
 static spinlock_t i2o_config_lock;
 
 
 #define MODINC(x,y) ((x) = ((x) + 1) % (y))
 #define MODINC(x,y) ((x) = ((x) + 1) % (y))
@@ -538,8 +541,7 @@ static int i2o_cfg_evt_get(unsigned long arg, struct file *fp)
 }
 }
 
 
 #ifdef CONFIG_COMPAT
 #ifdef CONFIG_COMPAT
-static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
-			      struct file *file)
+static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long arg)
 {
 {
 	struct i2o_cmd_passthru32 __user *cmd;
 	struct i2o_cmd_passthru32 __user *cmd;
 	struct i2o_controller *c;
 	struct i2o_controller *c;
@@ -752,7 +754,26 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
 	return rcode;
 	return rcode;
 }
 }
 
 
-#else
+static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
+{
+	int ret;
+	lock_kernel();		
+	switch (cmd) { 
+	case I2OGETIOPS:
+		ret = i2o_cfg_ioctl(NULL, file, cmd, arg);
+		break;
+	case I2OPASSTHRU32:
+		ret = i2o_cfg_passthru32(file, cmd, arg);
+		break;
+	default:
+		ret = -ENOIOCTLCMD;
+		break;
+	}
+	unlock_kernel();
+	return ret;
+}
+
+#endif
 
 
 static int i2o_cfg_passthru(unsigned long arg)
 static int i2o_cfg_passthru(unsigned long arg)
 {
 {
@@ -958,7 +979,6 @@ static int i2o_cfg_passthru(unsigned long arg)
 	kfree(reply);
 	kfree(reply);
 	return rcode;
 	return rcode;
 }
 }
-#endif
 
 
 /*
 /*
  * IOCTL Handler
  * IOCTL Handler
@@ -1013,11 +1033,9 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
 		ret = i2o_cfg_evt_get(arg, fp);
 		ret = i2o_cfg_evt_get(arg, fp);
 		break;
 		break;
 
 
-#ifndef CONFIG_COMPAT
 	case I2OPASSTHRU:
 	case I2OPASSTHRU:
 		ret = i2o_cfg_passthru(arg);
 		ret = i2o_cfg_passthru(arg);
 		break;
 		break;
-#endif
 
 
 	default:
 	default:
 		osm_debug("unknown ioctl called!\n");
 		osm_debug("unknown ioctl called!\n");
@@ -1105,6 +1123,9 @@ static struct file_operations config_fops = {
 	.owner = THIS_MODULE,
 	.owner = THIS_MODULE,
 	.llseek = no_llseek,
 	.llseek = no_llseek,
 	.ioctl = i2o_cfg_ioctl,
 	.ioctl = i2o_cfg_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = i2o_cfg_compat_ioctl,
+#endif
 	.open = cfg_open,
 	.open = cfg_open,
 	.release = cfg_release,
 	.release = cfg_release,
 	.fasync = cfg_fasync,
 	.fasync = cfg_fasync,
@@ -1134,19 +1155,11 @@ static int __init i2o_config_init(void)
 		misc_deregister(&i2o_miscdev);
 		misc_deregister(&i2o_miscdev);
 		return -EBUSY;
 		return -EBUSY;
 	}
 	}
-#ifdef CONFIG_COMPAT
-	register_ioctl32_conversion(I2OPASSTHRU32, i2o_cfg_passthru32);
-	register_ioctl32_conversion(I2OGETIOPS, (void *)sys_ioctl);
-#endif
 	return 0;
 	return 0;
 }
 }
 
 
 static void i2o_config_exit(void)
 static void i2o_config_exit(void)
 {
 {
-#ifdef CONFIG_COMPAT
-	unregister_ioctl32_conversion(I2OPASSTHRU32);
-	unregister_ioctl32_conversion(I2OGETIOPS);
-#endif
 	misc_deregister(&i2o_miscdev);
 	misc_deregister(&i2o_miscdev);
 	i2o_driver_unregister(&i2o_config_driver);
 	i2o_driver_unregister(&i2o_config_driver);
 }
 }

+ 2 - 2
drivers/s390/scsi/zfcp_aux.c

@@ -88,10 +88,10 @@ MODULE_DESCRIPTION
     ("FCP (SCSI over Fibre Channel) HBA driver for IBM eServer zSeries");
     ("FCP (SCSI over Fibre Channel) HBA driver for IBM eServer zSeries");
 MODULE_LICENSE("GPL");
 MODULE_LICENSE("GPL");
 
 
-module_param(device, charp, 0);
+module_param(device, charp, 0400);
 MODULE_PARM_DESC(device, "specify initial device");
 MODULE_PARM_DESC(device, "specify initial device");
 
 
-module_param(loglevel, uint, 0);
+module_param(loglevel, uint, 0400);
 MODULE_PARM_DESC(loglevel,
 MODULE_PARM_DESC(loglevel,
 		 "log levels, 8 nibbles: "
 		 "log levels, 8 nibbles: "
 		 "FC ERP QDIO CIO Config FSF SCSI Other, "
 		 "FC ERP QDIO CIO Config FSF SCSI Other, "

+ 4 - 1
drivers/s390/scsi/zfcp_def.h

@@ -70,7 +70,7 @@
 /********************* GENERAL DEFINES *********************************/
 /********************* GENERAL DEFINES *********************************/
 
 
 /* zfcp version number, it consists of major, minor, and patch-level number */
 /* zfcp version number, it consists of major, minor, and patch-level number */
-#define ZFCP_VERSION		"4.2.0"
+#define ZFCP_VERSION		"4.3.0"
 
 
 /**
 /**
  * zfcp_sg_to_address - determine kernel address from struct scatterlist
  * zfcp_sg_to_address - determine kernel address from struct scatterlist
@@ -851,6 +851,9 @@ struct zfcp_adapter {
 	wwn_t			wwnn;	           /* WWNN */
 	wwn_t			wwnn;	           /* WWNN */
 	wwn_t			wwpn;	           /* WWPN */
 	wwn_t			wwpn;	           /* WWPN */
 	fc_id_t			s_id;	           /* N_Port ID */
 	fc_id_t			s_id;	           /* N_Port ID */
+	wwn_t			peer_wwnn;	   /* P2P peer WWNN */
+	wwn_t			peer_wwpn;	   /* P2P peer WWPN */
+	fc_id_t			peer_d_id;	   /* P2P peer D_ID */
 	struct ccw_device       *ccw_device;	   /* S/390 ccw device */
 	struct ccw_device       *ccw_device;	   /* S/390 ccw device */
 	u8			fc_service_class;
 	u8			fc_service_class;
 	u32			fc_topology;	   /* FC topology */
 	u32			fc_topology;	   /* FC topology */

+ 19 - 1
drivers/s390/scsi/zfcp_erp.c

@@ -2568,6 +2568,23 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
 	case ZFCP_ERP_STEP_UNINITIALIZED:
 	case ZFCP_ERP_STEP_UNINITIALIZED:
 	case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
 	case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
 	case ZFCP_ERP_STEP_PORT_CLOSING:
 	case ZFCP_ERP_STEP_PORT_CLOSING:
+		if (adapter->fc_topology == FSF_TOPO_P2P) {
+			if (port->wwpn != adapter->peer_wwpn) {
+				ZFCP_LOG_NORMAL("Failed to open port 0x%016Lx "
+						"on adapter %s.\nPeer WWPN "
+						"0x%016Lx does not match\n",
+						port->wwpn,
+						zfcp_get_busid_by_adapter(adapter),
+						adapter->peer_wwpn);
+				zfcp_erp_port_failed(port);
+				retval = ZFCP_ERP_FAILED;
+				break;
+			}
+			port->d_id = adapter->peer_d_id;
+			atomic_set_mask(ZFCP_STATUS_PORT_DID_DID, &port->status);
+			retval = zfcp_erp_port_strategy_open_port(erp_action);
+			break;
+		}
 		if (!(adapter->nameserver_port)) {
 		if (!(adapter->nameserver_port)) {
 			retval = zfcp_nameserver_enqueue(adapter);
 			retval = zfcp_nameserver_enqueue(adapter);
 			if (retval != 0) {
 			if (retval != 0) {
@@ -3516,8 +3533,9 @@ zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter)
 	debug_text_event(adapter->erp_dbf, 3, "a_access_unblock");
 	debug_text_event(adapter->erp_dbf, 3, "a_access_unblock");
 	debug_event(adapter->erp_dbf, 3, &adapter->name, 8);
 	debug_event(adapter->erp_dbf, 3, &adapter->name, 8);
 
 
-	zfcp_erp_port_access_changed(adapter->nameserver_port);
 	read_lock_irqsave(&zfcp_data.config_lock, flags);
 	read_lock_irqsave(&zfcp_data.config_lock, flags);
+	if (adapter->nameserver_port)
+		zfcp_erp_port_access_changed(adapter->nameserver_port);
 	list_for_each_entry(port, &adapter->port_list_head, list)
 	list_for_each_entry(port, &adapter->port_list_head, list)
 		if (port != adapter->nameserver_port)
 		if (port != adapter->nameserver_port)
 			zfcp_erp_port_access_changed(port);
 			zfcp_erp_port_access_changed(port);

+ 30 - 8
drivers/s390/scsi/zfcp_fsf.c

@@ -2107,6 +2107,9 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
 		       bottom->low_qtcb_version, bottom->high_qtcb_version);
 		       bottom->low_qtcb_version, bottom->high_qtcb_version);
 	adapter->fsf_lic_version = bottom->lic_version;
 	adapter->fsf_lic_version = bottom->lic_version;
 	adapter->supported_features = bottom->supported_features;
 	adapter->supported_features = bottom->supported_features;
+	adapter->peer_wwpn = 0;
+	adapter->peer_wwnn = 0;
+	adapter->peer_d_id = 0;
 
 
 	if (xchg_ok) {
 	if (xchg_ok) {
 		adapter->wwnn = bottom->nport_serv_param.wwnn;
 		adapter->wwnn = bottom->nport_serv_param.wwnn;
@@ -2124,13 +2127,19 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
 		adapter->hydra_version = 0;
 		adapter->hydra_version = 0;
 	}
 	}
 
 
+	if (adapter->fc_topology == FSF_TOPO_P2P) {
+		adapter->peer_d_id = bottom->peer_d_id & ZFCP_DID_MASK;
+		adapter->peer_wwpn = bottom->plogi_payload.wwpn;
+		adapter->peer_wwnn = bottom->plogi_payload.wwnn;
+	}
+
 	if(adapter->supported_features & FSF_FEATURE_HBAAPI_MANAGEMENT){
 	if(adapter->supported_features & FSF_FEATURE_HBAAPI_MANAGEMENT){
 		adapter->hardware_version = bottom->hardware_version;
 		adapter->hardware_version = bottom->hardware_version;
 		memcpy(adapter->serial_number, bottom->serial_number, 17);
 		memcpy(adapter->serial_number, bottom->serial_number, 17);
 		EBCASC(adapter->serial_number, sizeof(adapter->serial_number));
 		EBCASC(adapter->serial_number, sizeof(adapter->serial_number));
 	}
 	}
 
 
-	ZFCP_LOG_INFO("The adapter %s reported the following characteristics:\n"
+	ZFCP_LOG_NORMAL("The adapter %s reported the following characteristics:\n"
 		      "WWNN 0x%016Lx, "
 		      "WWNN 0x%016Lx, "
 		      "WWPN 0x%016Lx, "
 		      "WWPN 0x%016Lx, "
 		      "S_ID 0x%08x,\n"
 		      "S_ID 0x%08x,\n"
@@ -2194,14 +2203,18 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
 		switch (adapter->fc_topology) {
 		switch (adapter->fc_topology) {
 		case FSF_TOPO_P2P:
 		case FSF_TOPO_P2P:
 			ZFCP_LOG_FLAGS(1, "FSF_TOPO_P2P\n");
 			ZFCP_LOG_FLAGS(1, "FSF_TOPO_P2P\n");
-			ZFCP_LOG_NORMAL("error: Point-to-point fibrechannel "
-					"configuration detected at adapter %s "
-					"unsupported, shutting down adapter\n",
-					zfcp_get_busid_by_adapter(adapter));
+			ZFCP_LOG_NORMAL("Point-to-Point fibrechannel "
+					"configuration detected at adapter %s\n"
+					"Peer WWNN 0x%016llx, "
+					"peer WWPN 0x%016llx, "
+					"peer d_id 0x%06x\n",
+					zfcp_get_busid_by_adapter(adapter),
+					adapter->peer_wwnn,
+					adapter->peer_wwpn,
+					adapter->peer_d_id);
 			debug_text_event(fsf_req->adapter->erp_dbf, 0,
 			debug_text_event(fsf_req->adapter->erp_dbf, 0,
 					 "top-p-to-p");
 					 "top-p-to-p");
-			zfcp_erp_adapter_shutdown(adapter, 0);
-			return -EIO;
+			break;
 		case FSF_TOPO_AL:
 		case FSF_TOPO_AL:
 			ZFCP_LOG_FLAGS(1, "FSF_TOPO_AL\n");
 			ZFCP_LOG_FLAGS(1, "FSF_TOPO_AL\n");
 			ZFCP_LOG_NORMAL("error: Arbitrated loop fibrechannel "
 			ZFCP_LOG_NORMAL("error: Arbitrated loop fibrechannel "
@@ -2226,6 +2239,7 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
 					"of a type known to the zfcp "
 					"of a type known to the zfcp "
 					"driver, shutting down adapter\n",
 					"driver, shutting down adapter\n",
 					zfcp_get_busid_by_adapter(adapter));
 					zfcp_get_busid_by_adapter(adapter));
+			adapter->fc_topology = FSF_TOPO_ERROR;
 			debug_text_exception(fsf_req->adapter->erp_dbf, 0,
 			debug_text_exception(fsf_req->adapter->erp_dbf, 0,
 					     "unknown-topo");
 					     "unknown-topo");
 			zfcp_erp_adapter_shutdown(adapter, 0);
 			zfcp_erp_adapter_shutdown(adapter, 0);
@@ -4281,6 +4295,7 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
 				      bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
 				      bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
 			zfcp_cmd_dbf_event_fsf("undeffcp", fsf_req, NULL, 0);
 			zfcp_cmd_dbf_event_fsf("undeffcp", fsf_req, NULL, 0);
 			set_host_byte(&scpnt->result, DID_ERROR);
 			set_host_byte(&scpnt->result, DID_ERROR);
+			goto skip_fsfstatus;
 		}
 		}
 	}
 	}
 
 
@@ -4334,7 +4349,7 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
 
 
 		scpnt->resid = fcp_rsp_iu->fcp_resid;
 		scpnt->resid = fcp_rsp_iu->fcp_resid;
 		if (scpnt->request_bufflen - scpnt->resid < scpnt->underflow)
 		if (scpnt->request_bufflen - scpnt->resid < scpnt->underflow)
-			scpnt->result |= DID_ERROR << 16;
+			set_host_byte(&scpnt->result, DID_ERROR);
 	}
 	}
 
 
  skip_fsfstatus:
  skip_fsfstatus:
@@ -4607,6 +4622,13 @@ zfcp_fsf_control_file_handler(struct zfcp_fsf_req *fsf_req)
 		if (bottom->operation_subtype == FSF_CFDC_OPERATION_SUBTYPE) {
 		if (bottom->operation_subtype == FSF_CFDC_OPERATION_SUBTYPE) {
 			switch (header->fsf_status_qual.word[0]) {
 			switch (header->fsf_status_qual.word[0]) {
 
 
+			case FSF_SQ_CFDC_HARDENED_ON_SE:
+				ZFCP_LOG_NORMAL(
+					"CFDC on the adapter %s has being "
+					"hardened on primary and secondary SE\n",
+					zfcp_get_busid_by_adapter(adapter));
+				break;
+
 			case FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE:
 			case FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE:
 				ZFCP_LOG_NORMAL(
 				ZFCP_LOG_NORMAL(
 					"CFDC of the adapter %s could not "
 					"CFDC of the adapter %s could not "

+ 4 - 2
drivers/s390/scsi/zfcp_fsf.h

@@ -129,6 +129,7 @@
 #define FSF_SQ_NO_RETRY_POSSIBLE		0x07
 #define FSF_SQ_NO_RETRY_POSSIBLE		0x07
 
 
 /* FSF status qualifier for CFDC commands */
 /* FSF status qualifier for CFDC commands */
+#define FSF_SQ_CFDC_HARDENED_ON_SE		0x00000000
 #define FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE	0x00000001
 #define FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE	0x00000001
 #define FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE2	0x00000002
 #define FSF_SQ_CFDC_COULD_NOT_HARDEN_ON_SE2	0x00000002
 /* CFDC subtable codes */
 /* CFDC subtable codes */
@@ -357,7 +358,6 @@ struct fsf_nport_serv_param {
 	u8  class3_serv_param[16];
 	u8  class3_serv_param[16];
 	u8  class4_serv_param[16];
 	u8  class4_serv_param[16];
 	u8  vendor_version_level[16];
 	u8  vendor_version_level[16];
-	u8  res1[16];
 } __attribute__ ((packed));
 } __attribute__ ((packed));
 
 
 struct fsf_plogi {
 struct fsf_plogi {
@@ -415,11 +415,13 @@ struct fsf_qtcb_bottom_config {
 	u8 res2[12];
 	u8 res2[12];
 	u32 s_id;
 	u32 s_id;
 	struct fsf_nport_serv_param nport_serv_param;
 	struct fsf_nport_serv_param nport_serv_param;
+	u8 reserved_nport_serv_param[16];
 	u8 res3[8];
 	u8 res3[8];
 	u32 adapter_ports;
 	u32 adapter_ports;
 	u32 hardware_version;
 	u32 hardware_version;
 	u8 serial_number[32];
 	u8 serial_number[32];
-	u8 res4[272];
+	struct fsf_nport_serv_param plogi_payload;
+	u8 res4[160];
 } __attribute__ ((packed));
 } __attribute__ ((packed));
 
 
 struct fsf_qtcb_bottom_port {
 struct fsf_qtcb_bottom_port {

+ 6 - 0
drivers/s390/scsi/zfcp_sysfs_adapter.c

@@ -65,6 +65,9 @@ ZFCP_DEFINE_ADAPTER_ATTR(status, "0x%08x\n", atomic_read(&adapter->status));
 ZFCP_DEFINE_ADAPTER_ATTR(wwnn, "0x%016llx\n", adapter->wwnn);
 ZFCP_DEFINE_ADAPTER_ATTR(wwnn, "0x%016llx\n", adapter->wwnn);
 ZFCP_DEFINE_ADAPTER_ATTR(wwpn, "0x%016llx\n", adapter->wwpn);
 ZFCP_DEFINE_ADAPTER_ATTR(wwpn, "0x%016llx\n", adapter->wwpn);
 ZFCP_DEFINE_ADAPTER_ATTR(s_id, "0x%06x\n", adapter->s_id);
 ZFCP_DEFINE_ADAPTER_ATTR(s_id, "0x%06x\n", adapter->s_id);
+ZFCP_DEFINE_ADAPTER_ATTR(peer_wwnn, "0x%016llx\n", adapter->peer_wwnn);
+ZFCP_DEFINE_ADAPTER_ATTR(peer_wwpn, "0x%016llx\n", adapter->peer_wwpn);
+ZFCP_DEFINE_ADAPTER_ATTR(peer_d_id, "0x%06x\n", adapter->peer_d_id);
 ZFCP_DEFINE_ADAPTER_ATTR(card_version, "0x%04x\n", adapter->hydra_version);
 ZFCP_DEFINE_ADAPTER_ATTR(card_version, "0x%04x\n", adapter->hydra_version);
 ZFCP_DEFINE_ADAPTER_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version);
 ZFCP_DEFINE_ADAPTER_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version);
 ZFCP_DEFINE_ADAPTER_ATTR(fc_link_speed, "%d Gb/s\n", adapter->fc_link_speed);
 ZFCP_DEFINE_ADAPTER_ATTR(fc_link_speed, "%d Gb/s\n", adapter->fc_link_speed);
@@ -255,6 +258,9 @@ static struct attribute *zfcp_adapter_attrs[] = {
 	&dev_attr_wwnn.attr,
 	&dev_attr_wwnn.attr,
 	&dev_attr_wwpn.attr,
 	&dev_attr_wwpn.attr,
 	&dev_attr_s_id.attr,
 	&dev_attr_s_id.attr,
+	&dev_attr_peer_wwnn.attr,
+	&dev_attr_peer_wwpn.attr,
+	&dev_attr_peer_d_id.attr,
 	&dev_attr_card_version.attr,
 	&dev_attr_card_version.attr,
 	&dev_attr_lic_version.attr,
 	&dev_attr_lic_version.attr,
 	&dev_attr_fc_link_speed.attr,
 	&dev_attr_fc_link_speed.attr,

+ 12 - 11
drivers/scsi/53c7xx.c

@@ -280,6 +280,7 @@
 #endif
 #endif
 
 
 #include "scsi.h"
 #include "scsi.h"
+#include <scsi/scsi_dbg.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_host.h>
 #include "53c7xx.h"
 #include "53c7xx.h"
 #include <linux/stat.h>
 #include <linux/stat.h>
@@ -1721,9 +1722,9 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
 		printk ("scsi%d : test 2 INQUIRY to target %d, lun 0 : %s\n",
 		printk ("scsi%d : test 2 INQUIRY to target %d, lun 0 : %s\n",
 		    host->host_no, i, data + 8);
 		    host->host_no, i, data + 8);
 		printk ("scsi%d : status ", host->host_no);
 		printk ("scsi%d : status ", host->host_no);
-		print_status (status);
+		scsi_print_status (status);
 		printk ("\nscsi%d : message ", host->host_no);
 		printk ("\nscsi%d : message ", host->host_no);
-		print_msg (&msg);
+		scsi_print_msg (&msg);
 		printk ("\n");
 		printk ("\n");
 	    } else if (hostdata->test_completed == 3) {
 	    } else if (hostdata->test_completed == 3) {
 		printk("scsi%d : test 2 no connection with target %d\n",
 		printk("scsi%d : test 2 no connection with target %d\n",
@@ -2312,7 +2313,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
 	    printk ("scsi%d : received message", host->host_no);
 	    printk ("scsi%d : received message", host->host_no);
 	    if (c) 
 	    if (c) 
 	    	printk (" from target %d lun %d ", c->device->id, c->device->lun);
 	    	printk (" from target %d lun %d ", c->device->id, c->device->lun);
-	    print_msg ((unsigned char *) hostdata->msg_buf);
+	    scsi_print_msg ((unsigned char *) hostdata->msg_buf);
 	    printk("\n");
 	    printk("\n");
 	}
 	}
 	
 	
@@ -3204,7 +3205,7 @@ create_cmd (Scsi_Cmnd *cmd) {
     case WRITE_10:
     case WRITE_10:
 #if 0
 #if 0
 	printk("scsi%d : command is ", host->host_no);
 	printk("scsi%d : command is ", host->host_no);
-	print_command(cmd->cmnd);
+	__scsi_print_command(cmd->cmnd);
 #endif
 #endif
 #if 0
 #if 0
 	printk ("scsi%d : %d scatter/gather segments\n", host->host_no,
 	printk ("scsi%d : %d scatter/gather segments\n", host->host_no,
@@ -3232,7 +3233,7 @@ create_cmd (Scsi_Cmnd *cmd) {
      */
      */
     default:
     default:
 	printk("scsi%d : datain+dataout for command ", host->host_no);
 	printk("scsi%d : datain+dataout for command ", host->host_no);
-	print_command(cmd->cmnd);
+	__scsi_print_command(cmd->cmnd);
 	datain = dataout = 2 * (cmd->use_sg ? cmd->use_sg : 1) + 3;
 	datain = dataout = 2 * (cmd->use_sg ? cmd->use_sg : 1) + 3;
     }
     }
 
 
@@ -3938,7 +3939,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
     	    if (cmd) {
     	    if (cmd) {
     	    	printk("scsi%d : target %d, lun %d, command ",
     	    	printk("scsi%d : target %d, lun %d, command ",
 		    host->host_no, cmd->cmd->device->id, cmd->cmd->device->lun);
 		    host->host_no, cmd->cmd->device->id, cmd->cmd->device->lun);
-    	    	print_command (cmd->cmd->cmnd);
+    	    	__scsi_print_command (cmd->cmd->cmnd);
 		printk("scsi%d : dsp = 0x%x (virt 0x%p)\n", host->host_no,
 		printk("scsi%d : dsp = 0x%x (virt 0x%p)\n", host->host_no,
 		    NCR53c7x0_read32(DSP_REG),
 		    NCR53c7x0_read32(DSP_REG),
 		    bus_to_virt(NCR53c7x0_read32(DSP_REG)));
 		    bus_to_virt(NCR53c7x0_read32(DSP_REG)));
@@ -4208,7 +4209,7 @@ restart:
 	if (hostdata->options & OPTION_DEBUG_INTR) {
 	if (hostdata->options & OPTION_DEBUG_INTR) {
 	    printk ("scsi%d : command complete : pid %lu, id %d,lun %d result 0x%x ", 
 	    printk ("scsi%d : command complete : pid %lu, id %d,lun %d result 0x%x ", 
 		  host->host_no, tmp->pid, tmp->device->id, tmp->device->lun, tmp->result);
 		  host->host_no, tmp->pid, tmp->device->id, tmp->device->lun, tmp->result);
-	    print_command (tmp->cmnd);
+	    __scsi_print_command (tmp->cmnd);
 	}
 	}
 
 
 	tmp->scsi_done(tmp);
 	tmp->scsi_done(tmp);
@@ -4297,7 +4298,7 @@ NCR53c7x0_intr (int irq, void *dev_id, struct pt_regs * regs)
 		printk("scsi%d : interrupt for pid %lu, id %d, lun %d ", 
 		printk("scsi%d : interrupt for pid %lu, id %d, lun %d ", 
 		    host->host_no, cmd->cmd->pid, (int) cmd->cmd->device->id,
 		    host->host_no, cmd->cmd->pid, (int) cmd->cmd->device->id,
 		    (int) cmd->cmd->device->lun);
 		    (int) cmd->cmd->device->lun);
-		print_command (cmd->cmd->cmnd);
+		__scsi_print_command (cmd->cmd->cmnd);
 	    } else {
 	    } else {
 		printk("scsi%d : no active command\n", host->host_no);
 		printk("scsi%d : no active command\n", host->host_no);
 	    }
 	    }
@@ -5539,7 +5540,7 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) {
 	    i > 0 && !check_address ((unsigned long) ptr, 1);
 	    i > 0 && !check_address ((unsigned long) ptr, 1);
 	    ptr += len, i -= len) {
 	    ptr += len, i -= len) {
 	    printk("               ");
 	    printk("               ");
-	    len = print_msg (ptr);
+	    len = scsi_print_msg (ptr);
 	    printk("\n");
 	    printk("\n");
 	    if (!len)
 	    if (!len)
 		break;
 		break;
@@ -5554,7 +5555,7 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) {
     if (cmd) {
     if (cmd) {
 	printk("               result = 0x%x, target = %d, lun = %d, cmd = ",
 	printk("               result = 0x%x, target = %d, lun = %d, cmd = ",
 	    cmd->result, cmd->device->id, cmd->device->lun);
 	    cmd->result, cmd->device->id, cmd->device->lun);
-	print_command(cmd->cmnd);
+	__scsi_print_command(cmd->cmnd);
     } else
     } else
 	printk("\n");
 	printk("\n");
     printk("        + %d : dsa_next = 0x%x\n", hostdata->dsa_next,
     printk("        + %d : dsa_next = 0x%x\n", hostdata->dsa_next,
@@ -6028,7 +6029,7 @@ dump_events (struct Scsi_Host *host, int count) {
 		    virt_to_bus(event.dsa), event.dsa);
 		    virt_to_bus(event.dsa), event.dsa);
 	    if (event.pid != -1) {
 	    if (event.pid != -1) {
 		printk ("         event for pid %ld ", event.pid);
 		printk ("         event for pid %ld ", event.pid);
-		print_command (event.cmnd);
+		__scsi_print_command (event.cmnd);
 	    }
 	    }
 	}
 	}
     }
     }

+ 0 - 7
drivers/scsi/BusLogic.c

@@ -2957,13 +2957,6 @@ static int BusLogic_AbortCommand(struct scsi_cmnd *Command)
 	int TargetID = Command->device->id;
 	int TargetID = Command->device->id;
 	struct BusLogic_CCB *CCB;
 	struct BusLogic_CCB *CCB;
 	BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested);
 	BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested);
-	/*
-	   If this Command has already completed, then no Abort is necessary.
-	 */
-	if (Command->serial_number != Command->serial_number_at_timeout) {
-		BusLogic_Warning("Unable to Abort Command to Target %d - " "Already Completed\n", HostAdapter, TargetID);
-		return SUCCESS;
-	}
 	/*
 	/*
 	   Attempt to find an Active CCB for this Command.  If no Active CCB for this
 	   Attempt to find an Active CCB for this Command.  If no Active CCB for this
 	   Command is found, then no Abort is necessary.
 	   Command is found, then no Abort is necessary.

+ 5 - 4
drivers/scsi/NCR5380.c

@@ -86,6 +86,7 @@
  * 5.  Test linked command handling code after Eric is ready with 
  * 5.  Test linked command handling code after Eric is ready with 
  *      the high level code.
  *      the high level code.
  */
  */
+#include <scsi/scsi_dbg.h>
 
 
 #if (NDEBUG & NDEBUG_LISTS)
 #if (NDEBUG & NDEBUG_LISTS)
 #define LIST(x,y) {printk("LINE:%d   Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); if ((x)==(y)) udelay(5); }
 #define LIST(x,y) {printk("LINE:%d   Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); if ((x)==(y)) udelay(5); }
@@ -2371,7 +2372,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
  * 3..length+1  arguments
  * 3..length+1  arguments
  *
  *
  * Start the extended message buffer with the EXTENDED_MESSAGE
  * Start the extended message buffer with the EXTENDED_MESSAGE
- * byte, since print_msg() wants the whole thing.  
+ * byte, since scsi_print_msg() wants the whole thing.  
  */
  */
 					extended_msg[0] = EXTENDED_MESSAGE;
 					extended_msg[0] = EXTENDED_MESSAGE;
 					/* Accept first byte by clearing ACK */
 					/* Accept first byte by clearing ACK */
@@ -2418,7 +2419,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 				default:
 				default:
 					if (!tmp) {
 					if (!tmp) {
 						printk("scsi%d: rejecting message ", instance->host_no);
 						printk("scsi%d: rejecting message ", instance->host_no);
-						print_msg(extended_msg);
+						scsi_print_msg(extended_msg);
 						printk("\n");
 						printk("\n");
 					} else if (tmp != EXTENDED_MESSAGE)
 					} else if (tmp != EXTENDED_MESSAGE)
 						printk("scsi%d: rejecting unknown message %02x from target %d, lun %d\n", instance->host_no, tmp, cmd->device->id, cmd->device->lun);
 						printk("scsi%d: rejecting unknown message %02x from target %d, lun %d\n", instance->host_no, tmp, cmd->device->id, cmd->device->lun);
@@ -2552,7 +2553,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
 
 
 	if (!(msg[0] & 0x80)) {
 	if (!(msg[0] & 0x80)) {
 		printk(KERN_ERR "scsi%d : expecting IDENTIFY message, got ", instance->host_no);
 		printk(KERN_ERR "scsi%d : expecting IDENTIFY message, got ", instance->host_no);
-		print_msg(msg);
+		scsi_print_msg(msg);
 		abort = 1;
 		abort = 1;
 	} else {
 	} else {
 		/* Accept message by clearing ACK */
 		/* Accept message by clearing ACK */
@@ -2677,7 +2678,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 	Scsi_Cmnd *tmp, **prev;
 	Scsi_Cmnd *tmp, **prev;
 	
 	
 	printk(KERN_WARNING "scsi%d : aborting command\n", instance->host_no);
 	printk(KERN_WARNING "scsi%d : aborting command\n", instance->host_no);
-	print_Scsi_Cmnd(cmd);
+	scsi_print_command(cmd);
 
 
 	NCR5380_print_status(instance);
 	NCR5380_print_status(instance);
 
 

+ 2 - 5
drivers/scsi/advansys.c

@@ -9198,16 +9198,13 @@ asc_prt_scsi_cmnd(struct scsi_cmnd *s)
         s->use_sg, s->sglist_len, s->abort_reason);
         s->use_sg, s->sglist_len, s->abort_reason);
 
 
     printk(
     printk(
-" serial_number 0x%x, serial_number_at_timeout 0x%x, retries %d, allowed %d\n",
-        (unsigned) s->serial_number, (unsigned) s->serial_number_at_timeout,
-         s->retries, s->allowed);
+" serial_number 0x%x, retries %d, allowed %d\n",
+        (unsigned) s->serial_number, s->retries, s->allowed);
 
 
     printk(
     printk(
 " timeout_per_command %d, timeout_total %d, timeout %d\n",
 " timeout_per_command %d, timeout_total %d, timeout %d\n",
         s->timeout_per_command, s->timeout_total, s->timeout);
         s->timeout_per_command, s->timeout_total, s->timeout);
 
 
-    printk(" internal_timeout %u\n", s->internal_timeout);
-
     printk(
     printk(
 " scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n",
 " scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n",
         (ulong) s->scsi_done, (ulong) s->done,
         (ulong) s->scsi_done, (ulong) s->done,

+ 9 - 8
drivers/scsi/aha152x.c

@@ -257,6 +257,7 @@
 #include <scsi/scsicam.h>
 #include <scsi/scsicam.h>
 
 
 #include "scsi.h"
 #include "scsi.h"
+#include <scsi/scsi_dbg.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_host.h>
 #include "aha152x.h"
 #include "aha152x.h"
 
 
@@ -986,7 +987,7 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct semaphore *sem, int p
 	if (HOSTDATA(shpnt)->debug & debug_queue) {
 	if (HOSTDATA(shpnt)->debug & debug_queue) {
 		printk(INFO_LEAD "queue: %p; cmd_len=%d pieces=%d size=%u cmnd=",
 		printk(INFO_LEAD "queue: %p; cmd_len=%d pieces=%d size=%u cmnd=",
 		       CMDINFO(SCpnt), SCpnt, SCpnt->cmd_len, SCpnt->use_sg, SCpnt->request_bufflen);
 		       CMDINFO(SCpnt), SCpnt, SCpnt->cmd_len, SCpnt->use_sg, SCpnt->request_bufflen);
-		print_command(SCpnt->cmnd);
+		__scsi_print_command(SCpnt->cmnd);
 	}
 	}
 #endif
 #endif
 
 
@@ -1560,7 +1561,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
 #if 0
 #if 0
 			if(HOSTDATA(shpnt)->debug & debug_eh) {
 			if(HOSTDATA(shpnt)->debug & debug_eh) {
 				printk(ERR_LEAD "received sense: ", CMDINFO(DONE_SC));
 				printk(ERR_LEAD "received sense: ", CMDINFO(DONE_SC));
-				print_sense("bh", DONE_SC);
+				scsi_print_sense("bh", DONE_SC);
 			}
 			}
 #endif
 #endif
 
 
@@ -1846,7 +1847,7 @@ static void msgi_run(struct Scsi_Host *shpnt)
 #if defined(AHA152X_DEBUG)
 #if defined(AHA152X_DEBUG)
 		if (HOSTDATA(shpnt)->debug & debug_msgi) {
 		if (HOSTDATA(shpnt)->debug & debug_msgi) {
 			printk(INFO_LEAD "inbound message %02x ", CMDINFO(CURRENT_SC), MSGI(0));
 			printk(INFO_LEAD "inbound message %02x ", CMDINFO(CURRENT_SC), MSGI(0));
-			print_msg(&MSGI(0));
+			scsi_print_msg(&MSGI(0));
 			printk("\n");
 			printk("\n");
 		}
 		}
 #endif
 #endif
@@ -1934,7 +1935,7 @@ static void msgi_run(struct Scsi_Host *shpnt)
 						break;
 						break;
 
 
 					printk(INFO_LEAD, CMDINFO(CURRENT_SC));
 					printk(INFO_LEAD, CMDINFO(CURRENT_SC));
-					print_msg(&MSGI(0));
+					scsi_print_msg(&MSGI(0));
 					printk("\n");
 					printk("\n");
 
 
 					ticks = (MSGI(3) * 4 + 49) / 50;
 					ticks = (MSGI(3) * 4 + 49) / 50;
@@ -2032,7 +2033,7 @@ static void msgo_init(struct Scsi_Host *shpnt)
 		int i;
 		int i;
 
 
 		printk(DEBUG_LEAD "messages( ", CMDINFO(CURRENT_SC));
 		printk(DEBUG_LEAD "messages( ", CMDINFO(CURRENT_SC));
-		for (i=0; i<MSGOLEN; i+=print_msg(&MSGO(i)), printk(" "))
+		for (i=0; i<MSGOLEN; i+=scsi_print_msg(&MSGO(i)), printk(" "))
 			;
 			;
 		printk(")\n");
 		printk(")\n");
 	}
 	}
@@ -2104,7 +2105,7 @@ static void cmd_init(struct Scsi_Host *shpnt)
 #if defined(AHA152X_DEBUG)
 #if defined(AHA152X_DEBUG)
 	if (HOSTDATA(shpnt)->debug & debug_cmd) {
 	if (HOSTDATA(shpnt)->debug & debug_cmd) {
 		printk(DEBUG_LEAD "cmd_init: ", CMDINFO(CURRENT_SC));
 		printk(DEBUG_LEAD "cmd_init: ", CMDINFO(CURRENT_SC));
-		print_command(CURRENT_SC->cmnd);
+		__scsi_print_command(CURRENT_SC->cmnd);
 	}
 	}
 #endif
 #endif
 
 
@@ -2158,7 +2159,7 @@ static void status_run(struct Scsi_Host *shpnt)
 #if defined(AHA152X_DEBUG)
 #if defined(AHA152X_DEBUG)
 	if (HOSTDATA(shpnt)->debug & debug_status) {
 	if (HOSTDATA(shpnt)->debug & debug_status) {
 		printk(DEBUG_LEAD "inbound status %02x ", CMDINFO(CURRENT_SC), CURRENT_SC->SCp.Status);
 		printk(DEBUG_LEAD "inbound status %02x ", CMDINFO(CURRENT_SC), CURRENT_SC->SCp.Status);
-		print_status(CURRENT_SC->SCp.Status);
+		scsi_print_status(CURRENT_SC->SCp.Status);
 		printk("\n");
 		printk("\n");
 	}
 	}
 #endif
 #endif
@@ -2925,7 +2926,7 @@ static void show_command(Scsi_Cmnd *ptr)
 	printk(KERN_DEBUG "0x%08x: target=%d; lun=%d; cmnd=(",
 	printk(KERN_DEBUG "0x%08x: target=%d; lun=%d; cmnd=(",
 	       (unsigned int) ptr, ptr->device->id, ptr->device->lun);
 	       (unsigned int) ptr, ptr->device->id, ptr->device->lun);
 
 
-	print_command(ptr->cmnd);
+	__scsi_print_command(ptr->cmnd);
 
 
 	printk(KERN_DEBUG "); request_bufflen=%d; resid=%d; phase |",
 	printk(KERN_DEBUG "); request_bufflen=%d; resid=%d; phase |",
 	       ptr->request_bufflen, ptr->resid);
 	       ptr->request_bufflen, ptr->resid);

+ 5 - 4
drivers/scsi/arm/acornscsi.c

@@ -150,6 +150,7 @@
 #include <asm/ecard.h>
 #include <asm/ecard.h>
 
 
 #include "../scsi.h"
 #include "../scsi.h"
+#include <scsi/scsi_dbg.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_host.h>
 #include "acornscsi.h"
 #include "acornscsi.h"
 #include "msgqueue.h"
 #include "msgqueue.h"
@@ -866,7 +867,7 @@ void acornscsi_done(AS_Host *host, Scsi_Cmnd **SCpntp, unsigned int result)
 		    default:
 		    default:
 			printk(KERN_ERR "scsi%d.H: incomplete data transfer detected: result=%08X command=",
 			printk(KERN_ERR "scsi%d.H: incomplete data transfer detected: result=%08X command=",
 				host->host->host_no, SCpnt->result);
 				host->host->host_no, SCpnt->result);
-			print_command(SCpnt->cmnd);
+			__scsi_print_command(SCpnt->cmnd);
 			acornscsi_dumpdma(host, "done");
 			acornscsi_dumpdma(host, "done");
 		 	acornscsi_dumplog(host, SCpnt->device->id);
 		 	acornscsi_dumplog(host, SCpnt->device->id);
 			SCpnt->result &= 0xffff;
 			SCpnt->result &= 0xffff;
@@ -1369,7 +1370,7 @@ void acornscsi_sendmessage(AS_Host *host)
 
 
 	host->scsi.last_message = msg->msg[0];
 	host->scsi.last_message = msg->msg[0];
 #if (DEBUG & DEBUG_MESSAGES)
 #if (DEBUG & DEBUG_MESSAGES)
-	print_msg(msg->msg);
+	scsi_print_msg(msg->msg);
 #endif
 #endif
 	break;
 	break;
 
 
@@ -1391,7 +1392,7 @@ void acornscsi_sendmessage(AS_Host *host)
 	while ((msg = msgqueue_getmsg(&host->scsi.msgs, msgnr++)) != NULL) {
 	while ((msg = msgqueue_getmsg(&host->scsi.msgs, msgnr++)) != NULL) {
 	    unsigned int i;
 	    unsigned int i;
 #if (DEBUG & DEBUG_MESSAGES)
 #if (DEBUG & DEBUG_MESSAGES)
-	    print_msg(msg);
+	    scsi_print_msg(msg);
 #endif
 #endif
 	    i = 0;
 	    i = 0;
 	    if (acornscsi_write_pio(host, msg->msg, &i, msg->length, 1000000))
 	    if (acornscsi_write_pio(host, msg->msg, &i, msg->length, 1000000))
@@ -1487,7 +1488,7 @@ void acornscsi_message(AS_Host *host)
 #if (DEBUG & DEBUG_MESSAGES)
 #if (DEBUG & DEBUG_MESSAGES)
     printk("scsi%d.%c: message in: ",
     printk("scsi%d.%c: message in: ",
 	    host->host->host_no, acornscsi_target(host));
 	    host->host->host_no, acornscsi_target(host));
-    print_msg(message);
+    scsi_print_msg(message);
     printk("\n");
     printk("\n");
 #endif
 #endif
 
 

+ 5 - 4
drivers/scsi/arm/fas216.c

@@ -52,6 +52,7 @@
 #include <asm/ecard.h>
 #include <asm/ecard.h>
 
 
 #include "../scsi.h"
 #include "../scsi.h"
+#include <scsi/scsi_dbg.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_host.h>
 #include "fas216.h"
 #include "fas216.h"
 #include "scsi.h"
 #include "scsi.h"
@@ -309,7 +310,7 @@ fas216_log_command(FAS216_Info *info, int level, Scsi_Cmnd *SCpnt, char *fmt, ..
 	va_end(args);
 	va_end(args);
 
 
 	printk(" CDB: ");
 	printk(" CDB: ");
-	print_command(SCpnt->cmnd);
+	__scsi_print_command(SCpnt->cmnd);
 }
 }
 
 
 static void
 static void
@@ -2081,7 +2082,7 @@ fas216_std_done(FAS216_Info *info, Scsi_Cmnd *SCpnt, unsigned int result)
 				info->host->host_no, '0' + SCpnt->device->id,
 				info->host->host_no, '0' + SCpnt->device->id,
 				SCpnt->result, info->scsi.SCp.ptr,
 				SCpnt->result, info->scsi.SCp.ptr,
 				info->scsi.SCp.this_residual);
 				info->scsi.SCp.this_residual);
-			print_command(SCpnt->cmnd);
+			__scsi_print_command(SCpnt->cmnd);
 			SCpnt->result &= ~(255 << 16);
 			SCpnt->result &= ~(255 << 16);
 			SCpnt->result |= DID_BAD_TARGET << 16;
 			SCpnt->result |= DID_BAD_TARGET << 16;
 			goto request_sense;
 			goto request_sense;
@@ -2170,7 +2171,7 @@ static void fas216_done(FAS216_Info *info, unsigned int result)
 		       info->host->host_no, '0' + SCpnt->device->id,
 		       info->host->host_no, '0' + SCpnt->device->id,
 		       info->scsi.SCp.ptr, info->scsi.SCp.this_residual);
 		       info->scsi.SCp.ptr, info->scsi.SCp.this_residual);
 		info->scsi.SCp.ptr = NULL;
 		info->scsi.SCp.ptr = NULL;
-		print_command(SCpnt->cmnd);
+		__scsi_print_command(SCpnt->cmnd);
 	}
 	}
 
 
 	/*
 	/*
@@ -2426,7 +2427,7 @@ int fas216_eh_abort(Scsi_Cmnd *SCpnt)
 	info->stats.aborts += 1;
 	info->stats.aborts += 1;
 
 
 	printk(KERN_WARNING "scsi%d: abort command ", info->host->host_no);
 	printk(KERN_WARNING "scsi%d: abort command ", info->host->host_no);
-	print_command(SCpnt->data_cmnd);
+	__scsi_print_command(SCpnt->data_cmnd);
 
 
 	print_debug_list();
 	print_debug_list();
 	fas216_dumpstate(info);
 	fas216_dumpstate(info);

+ 1 - 1
drivers/scsi/arm/scsi.h

@@ -108,7 +108,7 @@ static inline void init_SCp(Scsi_Cmnd *SCpnt)
 #if 0 //def BELT_AND_BRACES
 #if 0 //def BELT_AND_BRACES
 		printk(KERN_WARNING "scsi%d.%c: zero length buffer passed for "
 		printk(KERN_WARNING "scsi%d.%c: zero length buffer passed for "
 		       "command ", SCpnt->host->host_no, '0' + SCpnt->target);
 		       "command ", SCpnt->host->host_no, '0' + SCpnt->target);
-		print_command(SCpnt->cmnd);
+		__scsi_print_command(SCpnt->cmnd);
 #endif
 #endif
 		SCpnt->SCp.ptr = NULL;
 		SCpnt->SCp.ptr = NULL;
 	}
 	}

+ 5 - 4
drivers/scsi/atari_NCR5380.c

@@ -73,6 +73,7 @@
  * 1.  Test linked command handling code after Eric is ready with 
  * 1.  Test linked command handling code after Eric is ready with 
  *     the high level code.
  *     the high level code.
  */
  */
+#include <scsi/scsi_dbg.h>
 
 
 #if (NDEBUG & NDEBUG_LISTS)
 #if (NDEBUG & NDEBUG_LISTS)
 #define LIST(x,y) \
 #define LIST(x,y) \
@@ -2354,7 +2355,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
  * 3..length+1	arguments
  * 3..length+1	arguments
  *
  *
  * Start the extended message buffer with the EXTENDED_MESSAGE
  * Start the extended message buffer with the EXTENDED_MESSAGE
- * byte, since print_msg() wants the whole thing.  
+ * byte, since scsi_print_msg() wants the whole thing.  
  */
  */
 		    extended_msg[0] = EXTENDED_MESSAGE;
 		    extended_msg[0] = EXTENDED_MESSAGE;
 		    /* Accept first byte by clearing ACK */
 		    /* Accept first byte by clearing ACK */
@@ -2407,7 +2408,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
 		default:
 		default:
 		    if (!tmp) {
 		    if (!tmp) {
 			printk(KERN_DEBUG "scsi%d: rejecting message ", HOSTNO);
 			printk(KERN_DEBUG "scsi%d: rejecting message ", HOSTNO);
-			print_msg (extended_msg);
+			scsi_print_msg (extended_msg);
 			printk("\n");
 			printk("\n");
 		    } else if (tmp != EXTENDED_MESSAGE)
 		    } else if (tmp != EXTENDED_MESSAGE)
 			printk(KERN_DEBUG "scsi%d: rejecting unknown "
 			printk(KERN_DEBUG "scsi%d: rejecting unknown "
@@ -2540,7 +2541,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
 
 
     if (!(msg[0] & 0x80)) {
     if (!(msg[0] & 0x80)) {
 	printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO);
 	printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO);
-	print_msg(msg);
+	scsi_print_msg(msg);
 	do_abort(instance);
 	do_abort(instance);
 	return;
 	return;
     }
     }
@@ -2646,7 +2647,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
     unsigned long flags;
     unsigned long flags;
 
 
     printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO);
     printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO);
-    print_Scsi_Cmnd (cmd);
+    scsi_print_command(cmd);
 
 
     NCR5380_print_status (instance);
     NCR5380_print_status (instance);
 
 

+ 1 - 1
drivers/scsi/constants.c

@@ -372,7 +372,7 @@ static void scsi_print_cdb(unsigned char *cdb, int cdb_len, int start_of_line)
 
 
 /**
 /**
  *
  *
- *	print_status - print scsi status description
+ *	scsi_print_status - print scsi status description
  *	@scsi_status: scsi status value
  *	@scsi_status: scsi status value
  *
  *
  *	If the status is recognized, the description is printed.
  *	If the status is recognized, the description is printed.

+ 0 - 7
drivers/scsi/ips.c

@@ -833,13 +833,6 @@ ips_eh_abort(Scsi_Cmnd * SC)
 	if (!ha->active)
 	if (!ha->active)
 		return (FAILED);
 		return (FAILED);
 
 
-	if (SC->serial_number != SC->serial_number_at_timeout) {
-		/* HMM, looks like a bogus command */
-		DEBUG(1, "Abort called with bogus scsi command");
-
-		return (FAILED);
-	}
-
 	/* See if the command is on the copp queue */
 	/* See if the command is on the copp queue */
 	item = ha->copp_waitlist.head;
 	item = ha->copp_waitlist.head;
 	while ((item) && (item->scsi_cmd != SC))
 	while ((item) && (item->scsi_cmd != SC))

+ 2 - 12
drivers/scsi/ncr53c8xx.c

@@ -7486,24 +7486,14 @@ static int ncr53c8xx_abort(struct scsi_cmnd *cmd)
 	struct scsi_cmnd *done_list;
 	struct scsi_cmnd *done_list;
 
 
 #if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
 #if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
-	printk("ncr53c8xx_abort: pid=%lu serial_number=%ld serial_number_at_timeout=%ld\n",
-		cmd->pid, cmd->serial_number, cmd->serial_number_at_timeout);
+	printk("ncr53c8xx_abort: pid=%lu serial_number=%ld\n",
+		cmd->pid, cmd->serial_number);
 #else
 #else
 	printk("ncr53c8xx_abort: command pid %lu\n", cmd->pid);
 	printk("ncr53c8xx_abort: command pid %lu\n", cmd->pid);
 #endif
 #endif
 
 
 	NCR_LOCK_NCB(np, flags);
 	NCR_LOCK_NCB(np, flags);
 
 
-#if defined SCSI_RESET_SYNCHRONOUS && defined SCSI_RESET_ASYNCHRONOUS
-	/*
-	 * We have to just ignore abort requests in some situations.
-	 */
-	if (cmd->serial_number != cmd->serial_number_at_timeout) {
-		sts = SCSI_ABORT_NOT_RUNNING;
-		goto out;
-	}
-#endif
-
 	sts = ncr_abort_command(np, cmd);
 	sts = ncr_abort_command(np, cmd);
 out:
 out:
 	done_list     = np->done_list;
 	done_list     = np->done_list;

+ 2 - 2
drivers/scsi/pci2000.c

@@ -438,8 +438,8 @@ int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
 	if ( bus )
 	if ( bus )
 		{
 		{
 		DEB (if(*cdb) printk ("\nCDB: %X-  %X %X %X %X %X %X %X %X %X %X ", SCpnt->cmd_len, cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9]));
 		DEB (if(*cdb) printk ("\nCDB: %X-  %X %X %X %X %X %X %X %X %X %X ", SCpnt->cmd_len, cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9]));
-		DEB (if(*cdb) printk ("\ntimeout_per_command: %d, timeout_total: %d, timeout: %d, internal_timout: %d", SCpnt->timeout_per_command,
-							  SCpnt->timeout_total, SCpnt->timeout, SCpnt->internal_timeout));
+		DEB (if(*cdb) printk ("\ntimeout_per_command: %d, timeout_total: %d, timeout: %d", SCpnt->timeout_per_command,
+							  SCpnt->timeout_total, SCpnt->timeout));
 		outl (SCpnt->timeout_per_command, padapter->mb1);
 		outl (SCpnt->timeout_per_command, padapter->mb1);
 		outb_p (CMD_SCSI_TIMEOUT, padapter->cmd);
 		outb_p (CMD_SCSI_TIMEOUT, padapter->cmd);
 		if ( WaitReady (padapter) )
 		if ( WaitReady (padapter) )

+ 2 - 4
drivers/scsi/qla2xxx/qla_dbg.c

@@ -1050,10 +1050,8 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
 	for (i = 0; i < cmd->cmd_len; i++) {
 	for (i = 0; i < cmd->cmd_len; i++) {
 		printk("0x%02x ", cmd->cmnd[i]);
 		printk("0x%02x ", cmd->cmnd[i]);
 	}
 	}
-	printk("\n  seg_cnt=%d, allowed=%d, retries=%d, "
-	    "serial_number_at_timeout=0x%lx\n",
-	    cmd->use_sg, cmd->allowed, cmd->retries,
-	    cmd->serial_number_at_timeout);
+	printk("\n  seg_cnt=%d, allowed=%d, retries=%d\n",
+	    cmd->use_sg, cmd->allowed, cmd->retries);
 	printk("  request buffer=0x%p, request buffer len=0x%x\n",
 	printk("  request buffer=0x%p, request buffer len=0x%x\n",
 	    cmd->request_buffer, cmd->request_bufflen);
 	    cmd->request_buffer, cmd->request_bufflen);
 	printk("  tag=%d, transfersize=0x%x\n",
 	printk("  tag=%d, transfersize=0x%x\n",

+ 1 - 4
drivers/scsi/scsi.c

@@ -489,7 +489,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
 			scsi_print_command(cmd);
 			scsi_print_command(cmd);
 			if (status_byte(cmd->result) & CHECK_CONDITION) {
 			if (status_byte(cmd->result) & CHECK_CONDITION) {
 				/*
 				/*
-				 * XXX The print_sense formatting/prefix
+				 * XXX The scsi_print_sense formatting/prefix
 				 * doesn't match this function.
 				 * doesn't match this function.
 				 */
 				 */
 				scsi_print_sense("", cmd);
 				scsi_print_sense("", cmd);
@@ -686,7 +686,6 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq)
 	cmd->request = sreq->sr_request;
 	cmd->request = sreq->sr_request;
 	memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd));
 	memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd));
 	cmd->serial_number = 0;
 	cmd->serial_number = 0;
-	cmd->serial_number_at_timeout = 0;
 	cmd->bufflen = sreq->sr_bufflen;
 	cmd->bufflen = sreq->sr_bufflen;
 	cmd->buffer = sreq->sr_buffer;
 	cmd->buffer = sreq->sr_buffer;
 	cmd->retries = 0;
 	cmd->retries = 0;
@@ -716,7 +715,6 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq)
 	/*
 	/*
 	 * Start the timer ticking.
 	 * Start the timer ticking.
 	 */
 	 */
-	cmd->internal_timeout = NORMAL_TIMEOUT;
 	cmd->abort_reason = 0;
 	cmd->abort_reason = 0;
 	cmd->result = 0;
 	cmd->result = 0;
 
 
@@ -766,7 +764,6 @@ void __scsi_done(struct scsi_cmnd *cmd)
 	 * Set the serial numbers back to zero
 	 * Set the serial numbers back to zero
 	 */
 	 */
 	cmd->serial_number = 0;
 	cmd->serial_number = 0;
-	cmd->serial_number_at_timeout = 0;
 	cmd->state = SCSI_STATE_BHQUEUE;
 	cmd->state = SCSI_STATE_BHQUEUE;
 	cmd->owner = SCSI_OWNER_BH_HANDLER;
 	cmd->owner = SCSI_OWNER_BH_HANDLER;
 
 

+ 0 - 43
drivers/scsi/scsi.h

@@ -23,7 +23,6 @@
 #include <linux/config.h>	    /* for CONFIG_SCSI_LOGGING */
 #include <linux/config.h>	    /* for CONFIG_SCSI_LOGGING */
 
 
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_cmnd.h>
-#include <scsi/scsi_dbg.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_eh.h>
 #include <scsi/scsi_eh.h>
 #include <scsi/scsi_request.h>
 #include <scsi/scsi_request.h>
@@ -61,48 +60,6 @@ struct scatterlist;
 #define scsi_to_pci_dma_dir(scsi_dir)	((int)(scsi_dir))
 #define scsi_to_pci_dma_dir(scsi_dir)	((int)(scsi_dir))
 #define scsi_to_sbus_dma_dir(scsi_dir)	((int)(scsi_dir))
 #define scsi_to_sbus_dma_dir(scsi_dir)	((int)(scsi_dir))
 
 
-/*
- * Old names for debug prettyprinting functions.
- */
-static inline void print_Scsi_Cmnd(struct scsi_cmnd *cmd)
-{
-	return scsi_print_command(cmd);
-}
-static inline void print_command(unsigned char *cdb)
-{
-	return __scsi_print_command(cdb);
-}
-static inline void print_sense(const char *devclass, struct scsi_cmnd *cmd)
-{
-	return scsi_print_sense(devclass, cmd);
-}
-static inline void print_req_sense(const char *devclass, struct scsi_request *req)
-{
-	return scsi_print_req_sense(devclass, req);
-}
-static inline void print_driverbyte(int scsiresult)
-{
-	return scsi_print_driverbyte(scsiresult);
-}
-static inline void print_hostbyte(int scsiresult)
-{
-	return scsi_print_hostbyte(scsiresult);
-}
-static inline void print_status(unsigned char status)
-{
-	return scsi_print_status(status);
-}
-static inline int print_msg(const unsigned char *msg)
-{
-	return scsi_print_msg(msg);
-}
-
-/*
- * This is the crap from the old error handling code.  We have it in a special
- * place so that we can more easily delete it later on.
- */
-#include "scsi_obsolete.h"
-
 /* obsolete typedef junk. */
 /* obsolete typedef junk. */
 #include "scsi_typedefs.h"
 #include "scsi_typedefs.h"
 
 

+ 16 - 20
drivers/scsi/scsi_error.c

@@ -79,11 +79,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag)
 	 */
 	 */
 	scmd->owner = SCSI_OWNER_ERROR_HANDLER;
 	scmd->owner = SCSI_OWNER_ERROR_HANDLER;
 	scmd->state = SCSI_STATE_FAILED;
 	scmd->state = SCSI_STATE_FAILED;
-	/*
-	 * Set the serial_number_at_timeout to the current
-	 * serial_number
-	 */
-	scmd->serial_number_at_timeout = scmd->serial_number;
 	list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q);
 	list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q);
 	set_bit(SHOST_RECOVERY, &shost->shost_state);
 	set_bit(SHOST_RECOVERY, &shost->shost_state);
 	shost->host_failed++;
 	shost->host_failed++;
@@ -481,7 +476,8 @@ static void scsi_eh_done(struct scsi_cmnd *scmd)
  **/
  **/
 static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
 static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
 {
 {
-	struct Scsi_Host *host = scmd->device->host;
+	struct scsi_device *sdev = scmd->device;
+	struct Scsi_Host *shost = sdev->host;
 	DECLARE_MUTEX_LOCKED(sem);
 	DECLARE_MUTEX_LOCKED(sem);
 	unsigned long flags;
 	unsigned long flags;
 	int rtn = SUCCESS;
 	int rtn = SUCCESS;
@@ -492,27 +488,27 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
 	 */
 	 */
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
 
 
-	if (scmd->device->scsi_level <= SCSI_2)
+	if (sdev->scsi_level <= SCSI_2)
 		scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) |
 		scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) |
-			(scmd->device->lun << 5 & 0xe0);
+			(sdev->lun << 5 & 0xe0);
 
 
 	scsi_add_timer(scmd, timeout, scsi_eh_times_out);
 	scsi_add_timer(scmd, timeout, scsi_eh_times_out);
 
 
 	/*
 	/*
 	 * set up the semaphore so we wait for the command to complete.
 	 * set up the semaphore so we wait for the command to complete.
 	 */
 	 */
-	scmd->device->host->eh_action = &sem;
+	shost->eh_action = &sem;
 	scmd->request->rq_status = RQ_SCSI_BUSY;
 	scmd->request->rq_status = RQ_SCSI_BUSY;
 
 
-	spin_lock_irqsave(scmd->device->host->host_lock, flags);
+	spin_lock_irqsave(shost->host_lock, flags);
 	scsi_log_send(scmd);
 	scsi_log_send(scmd);
-	host->hostt->queuecommand(scmd, scsi_eh_done);
-	spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
+	shost->hostt->queuecommand(scmd, scsi_eh_done);
+	spin_unlock_irqrestore(shost->host_lock, flags);
 
 
 	down(&sem);
 	down(&sem);
 	scsi_log_completion(scmd, SUCCESS);
 	scsi_log_completion(scmd, SUCCESS);
 
 
-	scmd->device->host->eh_action = NULL;
+	shost->eh_action = NULL;
 
 
 	/*
 	/*
 	 * see if timeout.  if so, tell the host to forget about it.
 	 * see if timeout.  if so, tell the host to forget about it.
@@ -532,10 +528,10 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
 		 * abort a timed out command or not.  not sure how
 		 * abort a timed out command or not.  not sure how
 		 * we should treat them differently anyways.
 		 * we should treat them differently anyways.
 		 */
 		 */
-		spin_lock_irqsave(scmd->device->host->host_lock, flags);
-		if (scmd->device->host->hostt->eh_abort_handler)
-			scmd->device->host->hostt->eh_abort_handler(scmd);
-		spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
+		spin_lock_irqsave(shost->host_lock, flags);
+		if (shost->hostt->eh_abort_handler)
+			shost->hostt->eh_abort_handler(scmd);
+		spin_unlock_irqrestore(shost->host_lock, flags);
 			
 			
 		scmd->request->rq_status = RQ_SCSI_DONE;
 		scmd->request->rq_status = RQ_SCSI_DONE;
 		scmd->owner = SCSI_OWNER_ERROR_HANDLER;
 		scmd->owner = SCSI_OWNER_ERROR_HANDLER;
@@ -1061,7 +1057,6 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd)
 	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n",
 	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n",
 					  __FUNCTION__));
 					  __FUNCTION__));
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
-	scmd->serial_number_at_timeout = scmd->serial_number;
 
 
 	if (!scmd->device->host->hostt->eh_bus_reset_handler)
 	if (!scmd->device->host->hostt->eh_bus_reset_handler)
 		return FAILED;
 		return FAILED;
@@ -1093,7 +1088,6 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
 	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n",
 	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n",
 					  __FUNCTION__));
 					  __FUNCTION__));
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
-	scmd->serial_number_at_timeout = scmd->serial_number;
 
 
 	if (!scmd->device->host->hostt->eh_host_reset_handler)
 	if (!scmd->device->host->hostt->eh_host_reset_handler)
 		return FAILED;
 		return FAILED;
@@ -1313,6 +1307,9 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
 	case DID_IMM_RETRY:
 	case DID_IMM_RETRY:
 		return NEEDS_RETRY;
 		return NEEDS_RETRY;
 
 
+	case DID_REQUEUE:
+		return ADD_TO_MLQUEUE;
+
 	case DID_ERROR:
 	case DID_ERROR:
 		if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
 		if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
 		    status_byte(scmd->result) == RESERVATION_CONFLICT)
 		    status_byte(scmd->result) == RESERVATION_CONFLICT)
@@ -1839,7 +1836,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
 	scmd->bufflen			= 0;
 	scmd->bufflen			= 0;
 	scmd->request_buffer		= NULL;
 	scmd->request_buffer		= NULL;
 	scmd->request_bufflen		= 0;
 	scmd->request_bufflen		= 0;
-	scmd->internal_timeout		= NORMAL_TIMEOUT;
 	scmd->abort_reason		= DID_ABORT;
 	scmd->abort_reason		= DID_ABORT;
 
 
 	scmd->cmd_len			= 0;
 	scmd->cmd_len			= 0;

+ 0 - 5
drivers/scsi/scsi_ioctl.c

@@ -27,11 +27,6 @@
 
 
 #define NORMAL_RETRIES			5
 #define NORMAL_RETRIES			5
 #define IOCTL_NORMAL_TIMEOUT			(10 * HZ)
 #define IOCTL_NORMAL_TIMEOUT			(10 * HZ)
-#define FORMAT_UNIT_TIMEOUT		(2 * 60 * 60 * HZ)
-#define START_STOP_TIMEOUT		(60 * HZ)
-#define MOVE_MEDIUM_TIMEOUT		(5 * 60 * HZ)
-#define READ_ELEMENT_STATUS_TIMEOUT	(5 * 60 * HZ)
-#define READ_DEFECT_DATA_TIMEOUT	(60 * HZ )  /* ZIP-250 on parallel port takes as long! */
 
 
 #define MAX_BUF PAGE_SIZE
 #define MAX_BUF PAGE_SIZE
 
 

+ 0 - 2
drivers/scsi/scsi_lib.c

@@ -298,7 +298,6 @@ static int scsi_init_cmd_errh(struct scsi_cmnd *cmd)
 {
 {
 	cmd->owner = SCSI_OWNER_MIDLEVEL;
 	cmd->owner = SCSI_OWNER_MIDLEVEL;
 	cmd->serial_number = 0;
 	cmd->serial_number = 0;
-	cmd->serial_number_at_timeout = 0;
 	cmd->abort_reason = 0;
 	cmd->abort_reason = 0;
 
 
 	memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer);
 	memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer);
@@ -320,7 +319,6 @@ static int scsi_init_cmd_errh(struct scsi_cmnd *cmd)
 	memcpy(cmd->data_cmnd, cmd->cmnd, sizeof(cmd->cmnd));
 	memcpy(cmd->data_cmnd, cmd->cmnd, sizeof(cmd->cmnd));
 	cmd->buffer = cmd->request_buffer;
 	cmd->buffer = cmd->request_buffer;
 	cmd->bufflen = cmd->request_bufflen;
 	cmd->bufflen = cmd->request_bufflen;
-	cmd->internal_timeout = NORMAL_TIMEOUT;
 	cmd->abort_reason = 0;
 	cmd->abort_reason = 0;
 
 
 	return 1;
 	return 1;

+ 0 - 106
drivers/scsi/scsi_obsolete.h

@@ -1,106 +0,0 @@
-/*
- *  scsi_obsolete.h Copyright (C) 1997 Eric Youngdale
- *
- */
-
-#ifndef _SCSI_OBSOLETE_H
-#define _SCSI_OBSOLETE_H
-
-/*
- * These are the return codes for the abort and reset functions.  The mid-level
- * code uses these to decide what to do next.  Each of the low level abort
- * and reset functions must correctly indicate what it has done.
- * The descriptions are written from the point of view of the mid-level code,
- * so that the return code is telling the mid-level drivers exactly what
- * the low level driver has already done, and what remains to be done.
- */
-
-/* We did not do anything.  
- * Wait some more for this command to complete, and if this does not work, 
- * try something more serious. */
-#define SCSI_ABORT_SNOOZE 0
-
-/* This means that we were able to abort the command.  We have already
- * called the mid-level done function, and do not expect an interrupt that 
- * will lead to another call to the mid-level done function for this command */
-#define SCSI_ABORT_SUCCESS 1
-
-/* We called for an abort of this command, and we should get an interrupt 
- * when this succeeds.  Thus we should not restore the timer for this
- * command in the mid-level abort function. */
-#define SCSI_ABORT_PENDING 2
-
-/* Unable to abort - command is currently on the bus.  Grin and bear it. */
-#define SCSI_ABORT_BUSY 3
-
-/* The command is not active in the low level code. Command probably
- * finished. */
-#define SCSI_ABORT_NOT_RUNNING 4
-
-/* Something went wrong.  The low level driver will indicate the correct
- * error condition when it calls scsi_done, so the mid-level abort function
- * can simply wait until this comes through */
-#define SCSI_ABORT_ERROR 5
-
-/* We do not know how to reset the bus, or we do not want to.  Bummer.
- * Anyway, just wait a little more for the command in question, and hope that
- * it eventually finishes.  If it never finishes, the SCSI device could
- * hang, so use this with caution. */
-#define SCSI_RESET_SNOOZE 0
-
-/* We do not know how to reset the bus, or we do not want to.  Bummer.
- * We have given up on this ever completing.  The mid-level code will
- * request sense information to decide how to proceed from here. */
-#define SCSI_RESET_PUNT 1
-
-/* This means that we were able to reset the bus.  We have restarted all of
- * the commands that should be restarted, and we should be able to continue
- * on normally from here.  We do not expect any interrupts that will return
- * DID_RESET to any of the other commands in the host_queue, and the mid-level
- * code does not need to do anything special to keep the commands alive. 
- * If a hard reset was performed then all outstanding commands on the
- * bus have been restarted. */
-#define SCSI_RESET_SUCCESS 2
-
-/* We called for a reset of this bus, and we should get an interrupt 
- * when this succeeds.  Each command should get its own status
- * passed up to scsi_done, but this has not happened yet. 
- * If a hard reset was performed, then we expect an interrupt
- * for *each* of the outstanding commands that will have the
- * effect of restarting the commands.
- */
-#define SCSI_RESET_PENDING 3
-
-/* We did a reset, but do not expect an interrupt to signal DID_RESET.
- * This tells the upper level code to request the sense info, and this
- * should keep the command alive. */
-#define SCSI_RESET_WAKEUP 4
-
-/* The command is not active in the low level code. Command probably
-   finished. */
-#define SCSI_RESET_NOT_RUNNING 5
-
-/* Something went wrong, and we do not know how to fix it. */
-#define SCSI_RESET_ERROR 6
-
-#define SCSI_RESET_SYNCHRONOUS		0x01
-#define SCSI_RESET_ASYNCHRONOUS		0x02
-#define SCSI_RESET_SUGGEST_BUS_RESET	0x04
-#define SCSI_RESET_SUGGEST_HOST_RESET	0x08
-/*
- * This is a bitmask that is ored with one of the above codes.
- * It tells the mid-level code that we did a hard reset.
- */
-#define SCSI_RESET_BUS_RESET 0x100
-/*
- * This is a bitmask that is ored with one of the above codes.
- * It tells the mid-level code that we did a host adapter reset.
- */
-#define SCSI_RESET_HOST_RESET 0x200
-/*
- * Used to mask off bits and to obtain the basic action that was
- * performed.  
- */
-#define SCSI_RESET_ACTION   0xff
-
-#endif				/* SCSI_OBSOLETE_H */

+ 0 - 5
drivers/scsi/scsi_priv.h

@@ -29,11 +29,6 @@ struct Scsi_Host;
 #define SCSI_CMND_MAGIC		0xE25C23A5
 #define SCSI_CMND_MAGIC		0xE25C23A5
 #define SCSI_REQ_MAGIC		0x75F6D354
 #define SCSI_REQ_MAGIC		0x75F6D354
 
 
-/*
- *  Flag bit for the internal_timeout array
- */
-#define NORMAL_TIMEOUT		0
-
 /*
 /*
  * Scsi Error Handler Flags
  * Scsi Error Handler Flags
  */
  */

+ 3 - 2
drivers/scsi/seagate.c

@@ -103,6 +103,7 @@
 #include <asm/uaccess.h>
 #include <asm/uaccess.h>
 
 
 #include "scsi.h"
 #include "scsi.h"
+#include <scsi/scsi_dbg.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_host.h>
 #include "seagate.h"
 #include "seagate.h"
 
 
@@ -746,7 +747,7 @@ static int internal_command (unsigned char target, unsigned char lun,
 
 
 #if (DEBUG & PRINT_COMMAND)
 #if (DEBUG & PRINT_COMMAND)
 	printk("scsi%d : target = %d, command = ", hostno, target);
 	printk("scsi%d : target = %d, command = ", hostno, target);
-	print_command((unsigned char *) cmnd);
+	__scsi_print_command((unsigned char *) cmnd);
 #endif
 #endif
 
 
 #if (DEBUG & PHASE_RESELECT)
 #if (DEBUG & PHASE_RESELECT)
@@ -1553,7 +1554,7 @@ connect_loop:
 	printk("\n");
 	printk("\n");
 #endif
 #endif
 	printk("scsi%d : status = ", hostno);
 	printk("scsi%d : status = ", hostno);
-	print_status(status);
+	scsi_print_status(status);
 	printk(" message = %02x\n", message);
 	printk(" message = %02x\n", message);
 #endif
 #endif
 
 

+ 2 - 1
drivers/scsi/sg.c

@@ -51,6 +51,7 @@ static int sg_version_num = 30533;	/* 2 digits for each component */
 #include <linux/delay.h>
 #include <linux/delay.h>
 
 
 #include "scsi.h"
 #include "scsi.h"
+#include <scsi/scsi_dbg.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_driver.h>
 #include <scsi/scsi_driver.h>
 #include <scsi/scsi_ioctl.h>
 #include <scsi/scsi_ioctl.h>
@@ -1368,7 +1369,7 @@ sg_cmd_done(Scsi_Cmnd * SCpnt)
 		if ((sdp->sgdebug > 0) &&
 		if ((sdp->sgdebug > 0) &&
 		    ((CHECK_CONDITION == srp->header.masked_status) ||
 		    ((CHECK_CONDITION == srp->header.masked_status) ||
 		     (COMMAND_TERMINATED == srp->header.masked_status)))
 		     (COMMAND_TERMINATED == srp->header.masked_status)))
-			print_req_sense("sg_cmd_done", SRpnt);
+			scsi_print_req_sense("sg_cmd_done", SRpnt);
 
 
 		/* Following if statement is a patch supplied by Eric Youngdale */
 		/* Following if statement is a patch supplied by Eric Youngdale */
 		if (driver_byte(SRpnt->sr_result) != 0
 		if (driver_byte(SRpnt->sr_result) != 0

+ 5 - 4
drivers/scsi/sun3_NCR5380.c

@@ -69,6 +69,7 @@
  *   finally replaced that by the *_PRINTK() macros.
  *   finally replaced that by the *_PRINTK() macros.
  *
  *
  */
  */
+#include <scsi/scsi_dbg.h>
 
 
 /*
 /*
  * Further development / testing that should be done : 
  * Further development / testing that should be done : 
@@ -2377,7 +2378,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
  * 3..length+1	arguments
  * 3..length+1	arguments
  *
  *
  * Start the extended message buffer with the EXTENDED_MESSAGE
  * Start the extended message buffer with the EXTENDED_MESSAGE
- * byte, since print_msg() wants the whole thing.  
+ * byte, since scsi_print_msg() wants the whole thing.  
  */
  */
 		    extended_msg[0] = EXTENDED_MESSAGE;
 		    extended_msg[0] = EXTENDED_MESSAGE;
 		    /* Accept first byte by clearing ACK */
 		    /* Accept first byte by clearing ACK */
@@ -2430,7 +2431,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
 		default:
 		default:
 		    if (!tmp) {
 		    if (!tmp) {
 			printk(KERN_DEBUG "scsi%d: rejecting message ", HOSTNO);
 			printk(KERN_DEBUG "scsi%d: rejecting message ", HOSTNO);
-			print_msg (extended_msg);
+			scsi_print_msg (extended_msg);
 			printk("\n");
 			printk("\n");
 		    } else if (tmp != EXTENDED_MESSAGE)
 		    } else if (tmp != EXTENDED_MESSAGE)
 			printk(KERN_DEBUG "scsi%d: rejecting unknown "
 			printk(KERN_DEBUG "scsi%d: rejecting unknown "
@@ -2565,7 +2566,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
 
 
     if (!(msg[0] & 0x80)) {
     if (!(msg[0] & 0x80)) {
 	printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO);
 	printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO);
-	print_msg(msg);
+	scsi_print_msg(msg);
 	do_abort(instance);
 	do_abort(instance);
 	return;
 	return;
     }
     }
@@ -2691,7 +2692,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
     unsigned long flags;
     unsigned long flags;
 
 
     printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO);
     printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO);
-    print_Scsi_Cmnd (cmd);
+    scsi_print_command(cmd);
 
 
     NCR5380_print_status (instance);
     NCR5380_print_status (instance);
 
 

+ 0 - 6
drivers/scsi/sym53c8xx_2/sym_glue.c

@@ -799,12 +799,6 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
 
 
 	dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname);
 	dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname);
 
 
-#if 0
-	/* This one should be the result of some race, thus to ignore */
-	if (cmd->serial_number != cmd->serial_number_at_timeout)
-		goto prepare;
-#endif
-
 	/* This one is queued in some place -> to wait for completion */
 	/* This one is queued in some place -> to wait for completion */
 	FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) {
 	FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) {
 		struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);
 		struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);

+ 2 - 2
drivers/scsi/ultrastor.c

@@ -945,7 +945,7 @@ static int ultrastor_abort(Scsi_Cmnd *SCpnt)
 	       config.mscp[mscp_index].SCint, SCpnt);
 	       config.mscp[mscp_index].SCint, SCpnt);
 #endif
 #endif
     if (config.mscp[mscp_index].SCint == 0)
     if (config.mscp[mscp_index].SCint == 0)
-	return SCSI_ABORT_NOT_RUNNING;
+	return FAILURE;
 
 
     if (config.mscp[mscp_index].SCint != SCpnt) panic("Bad abort");
     if (config.mscp[mscp_index].SCint != SCpnt) panic("Bad abort");
     config.mscp[mscp_index].SCint = NULL;
     config.mscp[mscp_index].SCint = NULL;
@@ -1020,7 +1020,7 @@ static int ultrastor_host_reset(Scsi_Cmnd * SCpnt)
 #endif
 #endif
 
 
     spin_unlock_irqrestore(host->host_lock, flags);
     spin_unlock_irqrestore(host->host_lock, flags);
-    return SCSI_RESET_SUCCESS;
+    return SUCCESS;
 
 
 }
 }
 
 

+ 1 - 1
drivers/usb/image/microtek.c

@@ -335,7 +335,7 @@ static int mts_scsi_abort (Scsi_Cmnd *srb)
 
 
 	mts_urb_abort(desc);
 	mts_urb_abort(desc);
 
 
-	return SCSI_ABORT_PENDING;
+	return FAILURE;
 }
 }
 
 
 static int mts_scsi_host_reset (Scsi_Cmnd *srb)
 static int mts_scsi_host_reset (Scsi_Cmnd *srb)

+ 11 - 0
include/scsi/scsi.h

@@ -295,6 +295,8 @@ struct scsi_lun {
 #define DID_PASSTHROUGH 0x0a	/* Force command past mid-layer            */
 #define DID_PASSTHROUGH 0x0a	/* Force command past mid-layer            */
 #define DID_SOFT_ERROR  0x0b	/* The low level driver just wish a retry  */
 #define DID_SOFT_ERROR  0x0b	/* The low level driver just wish a retry  */
 #define DID_IMM_RETRY   0x0c	/* Retry without decrementing retry count  */
 #define DID_IMM_RETRY   0x0c	/* Retry without decrementing retry count  */
+#define DID_REQUEUE	0x0d	/* Requeue command (no immediate retry) also
+				 * without decrementing the retry count	   */
 #define DRIVER_OK       0x00	/* Driver status                           */
 #define DRIVER_OK       0x00	/* Driver status                           */
 
 
 /*
 /*
@@ -360,6 +362,15 @@ struct scsi_lun {
 #define sense_error(sense)  ((sense) & 0xf)
 #define sense_error(sense)  ((sense) & 0xf)
 #define sense_valid(sense)  ((sense) & 0x80);
 #define sense_valid(sense)  ((sense) & 0x80);
 
 
+/*
+ * default timeouts
+*/
+#define FORMAT_UNIT_TIMEOUT		(2 * 60 * 60 * HZ)
+#define START_STOP_TIMEOUT		(60 * HZ)
+#define MOVE_MEDIUM_TIMEOUT		(5 * 60 * HZ)
+#define READ_ELEMENT_STATUS_TIMEOUT	(5 * 60 * HZ)
+#define READ_DEFECT_DATA_TIMEOUT	(60 * HZ )
+
 
 
 #define IDENTIFY_BASE       0x80
 #define IDENTIFY_BASE       0x80
 #define IDENTIFY(can_disconnect, lun)   (IDENTIFY_BASE |\
 #define IDENTIFY(can_disconnect, lun)   (IDENTIFY_BASE |\

+ 9 - 19
include/scsi/scsi_cmnd.h

@@ -43,21 +43,17 @@ struct scsi_cmnd {
 	void (*done) (struct scsi_cmnd *);	/* Mid-level done function */
 	void (*done) (struct scsi_cmnd *);	/* Mid-level done function */
 
 
 	/*
 	/*
-	 * A SCSI Command is assigned a nonzero serial_number when internal_cmnd
-	 * passes it to the driver's queue command function.  The serial_number
-	 * is cleared when scsi_done is entered indicating that the command has
-	 * been completed.  If a timeout occurs, the serial number at the moment
-	 * of timeout is copied into serial_number_at_timeout.  By subsequently
-	 * comparing the serial_number and serial_number_at_timeout fields
-	 * during abort or reset processing, we can detect whether the command
-	 * has already completed.  This also detects cases where the command has
-	 * completed and the SCSI Command structure has already being reused
-	 * for another command, so that we can avoid incorrectly aborting or
-	 * resetting the new command.
-	 * The serial number is only unique per host.
+	 * A SCSI Command is assigned a nonzero serial_number before passed
+	 * to the driver's queue command function.  The serial_number is
+	 * cleared when scsi_done is entered indicating that the command
+	 * has been completed.  It currently doesn't have much use other
+	 * than printk's.  Some lldd's use this number for other purposes.
+	 * It's almost certain that such usages are either incorrect or
+	 * meaningless.  Please kill all usages other than printk's.  Also,
+	 * as this number is always identical to ->pid, please convert
+	 * printk's to use ->pid, so that we can kill this field.
 	 */
 	 */
 	unsigned long serial_number;
 	unsigned long serial_number;
-	unsigned long serial_number_at_timeout;
 
 
 	int retries;
 	int retries;
 	int allowed;
 	int allowed;
@@ -65,12 +61,6 @@ struct scsi_cmnd {
 	int timeout_total;
 	int timeout_total;
 	int timeout;
 	int timeout;
 
 
-	/*
-	 * We handle the timeout differently if it happens when a reset, 
-	 * abort, etc are in process. 
-	 */
-	unsigned volatile char internal_timeout;
-
 	unsigned char cmd_len;
 	unsigned char cmd_len;
 	unsigned char old_cmd_len;
 	unsigned char old_cmd_len;
 	enum dma_data_direction sc_data_direction;
 	enum dma_data_direction sc_data_direction;

+ 2 - 1
include/scsi/scsi_device.h

@@ -44,7 +44,8 @@ struct scsi_device {
 	struct list_head    same_target_siblings; /* just the devices sharing same target id */
 	struct list_head    same_target_siblings; /* just the devices sharing same target id */
 
 
 	/* this is now protected by the request_queue->queue_lock */
 	/* this is now protected by the request_queue->queue_lock */
-	volatile unsigned short device_busy;	/* commands actually active on low-level */
+	unsigned int device_busy;	/* commands actually active on
+					 * low-level. protected by queue_lock. */
 	spinlock_t list_lock;
 	spinlock_t list_lock;
 	struct list_head cmd_list;	/* queue of in use SCSI Command structures */
 	struct list_head cmd_list;	/* queue of in use SCSI Command structures */
 	struct list_head starved_entry;
 	struct list_head starved_entry;

+ 8 - 2
include/scsi/scsi_host.h

@@ -448,8 +448,14 @@ struct Scsi_Host {
 	wait_queue_head_t       host_wait;
 	wait_queue_head_t       host_wait;
 	struct scsi_host_template *hostt;
 	struct scsi_host_template *hostt;
 	struct scsi_transport_template *transportt;
 	struct scsi_transport_template *transportt;
-	volatile unsigned short host_busy;   /* commands actually active on low-level */
-	volatile unsigned short host_failed; /* commands that failed. */
+
+	/*
+	 * The following two fields are protected with host_lock;
+	 * however, eh routines can safely access during eh processing
+	 * without acquiring the lock.
+	 */
+	unsigned int host_busy;		   /* commands actually active on low-level */
+	unsigned int host_failed;	   /* commands that failed. */
     
     
 	unsigned short host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
 	unsigned short host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
 	int resetting; /* if set, it means that last_reset is a valid value */
 	int resetting; /* if set, it means that last_reset is a valid value */