Commit 40ea4c83 authored by James Bottomley's avatar James Bottomley

Merge mulgrave.(none):/home/jejb/BK/53c700-2.5

into mulgrave.(none):/home/jejb/BK/scsi-for-linus-2.5
parents 60db5f20 3a0e045b
......@@ -170,6 +170,8 @@ STATIC int NCR_700_host_reset(Scsi_Cmnd * SCpnt);
STATIC int NCR_700_proc_directory_info(char *, char **, off_t, int, int, int);
STATIC void NCR_700_chip_setup(struct Scsi_Host *host);
STATIC void NCR_700_chip_reset(struct Scsi_Host *host);
STATIC int NCR_700_slave_attach(Scsi_Device *SDpnt);
STATIC void NCR_700_slave_detach(Scsi_Device *SDpnt);
static char *NCR_700_phase[] = {
"",
......@@ -280,9 +282,11 @@ NCR_700_detect(Scsi_Host_Template *tpnt,
tpnt->eh_host_reset_handler = NCR_700_host_reset;
tpnt->can_queue = NCR_700_COMMAND_SLOTS_PER_HOST;
tpnt->sg_tablesize = NCR_700_SG_SEGMENTS;
tpnt->cmd_per_lun = NCR_700_MAX_TAGS;
tpnt->cmd_per_lun = NCR_700_CMD_PER_LUN;
tpnt->use_clustering = DISABLE_CLUSTERING;
tpnt->proc_info = NCR_700_proc_directory_info;
tpnt->slave_attach = NCR_700_slave_attach;
tpnt->slave_detach = NCR_700_slave_detach;
tpnt->use_blk_tcq = 1;
tpnt->highmem_io = 1;
......@@ -891,8 +895,8 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
printk(KERN_WARNING "scsi%d (%d:%d) Rejected first tag queue attempt, turning off tag queueing\n", host->host_no, pun, lun);
NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING);
hostdata->tag_negotiated &= ~(1<<SCp->target);
SCp->device->tagged_queue = 0;
SCp->device->tagged_supported = 0;
scsi_deactivate_tcq(SCp->device);
} else {
printk(KERN_WARNING "scsi%d (%d:%d) Unexpected REJECT Message %s\n",
host->host_no, pun, lun,
......@@ -1739,7 +1743,7 @@ NCR_700_proc_directory_info(char *proc_buf, char **startp,
Target Depth Active Next Tag\n\
====== ===== ====== ========\n");
for(SDp = host->host_queue; SDp != NULL; SDp = SDp->next) {
len += sprintf(&buf[len]," %2d:%2d %4d %4d %4d\n", SDp->id, SDp->lun, SDp->queue_depth, NCR_700_get_depth(SDp), SDp->current_tag);
len += sprintf(&buf[len]," %2d:%2d %4d %4d %4d\n", SDp->id, SDp->lun, SDp->current_queue_depth, NCR_700_get_depth(SDp), SDp->current_tag);
}
if((len -= offset) <= 0)
return 0;
......@@ -1776,13 +1780,13 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *))
DEBUG((KERN_ERR "scsi%d (%d:%d) has non zero depth %d\n",
SCp->host->host_no, SCp->target, SCp->lun,
NCR_700_get_depth(SCp->device)));
return 1;
return SCSI_MLQUEUE_DEVICE_BUSY;
}
if(NCR_700_get_depth(SCp->device) >= NCR_700_MAX_TAGS) {
DEBUG((KERN_ERR "scsi%d (%d:%d) has max tag depth %d\n",
SCp->host->host_no, SCp->target, SCp->lun,
NCR_700_get_depth(SCp->device)));
return 1;
return SCSI_MLQUEUE_DEVICE_BUSY;
}
NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) + 1);
......@@ -1998,6 +2002,25 @@ NCR_700_host_reset(Scsi_Cmnd * SCp)
return SUCCESS;
}
STATIC int
NCR_700_slave_attach(Scsi_Device *SDp)
{
/* to do here: allocate memory; build a queue_full list */
if(SDp->tagged_supported) {
/* do TCQ stuff here */
} else {
/* initialise to default depth */
scsi_adjust_queue_depth(SDp, 0, SDp->host->cmd_per_lun);
}
return 0;
}
STATIC void
NCR_700_slave_detach(Scsi_Device *SDp)
{
/* to do here: deallocate memory */
}
EXPORT_SYMBOL(NCR_700_detect);
EXPORT_SYMBOL(NCR_700_release);
EXPORT_SYMBOL(NCR_700_intr);
......@@ -30,6 +30,11 @@
/* Alter this with care: too many tags won't give the elevator a chance to
* work; too few will cause the device to operate less efficiently */
#define NCR_700_MAX_TAGS 16
/* This is the default number of commands per LUN in the untagged case.
* two is a good value because it means we can have one command active and
* one command fully prepared and waiting
*/
#define NCR_700_CMD_PER_LUN 2
/* magic byte identifying an internally generated REQUEST_SENSE command */
#define NCR_700_INTERNAL_SENSE_MAGIC 0x42
......
......@@ -877,6 +877,12 @@ struct scsi_cmnd {
extern int scsi_reset_provider(Scsi_Device *, int);
#define MSG_SIMPLE_TAG 0x20
#define MSG_HEAD_TAG 0x21
#define MSG_ORDERED_TAG 0x22
#define SCSI_NO_TAG (-1) /* identify no tag in use */
/**
* scsi_activate_tcq - turn on tag command queueing
* @SDpnt: device to turn on TCQ for
......@@ -892,7 +898,7 @@ static inline void scsi_activate_tcq(Scsi_Device *SDpnt, int depth) {
if(SDpnt->tagged_supported && !blk_queue_tagged(q)) {
blk_queue_init_tags(q, depth);
SDpnt->tagged_queue = 1;
scsi_adjust_queue_depth(SDpnt, MSG_ORDERED_TAG, depth);
}
}
......@@ -902,13 +908,8 @@ static inline void scsi_activate_tcq(Scsi_Device *SDpnt, int depth) {
**/
static inline void scsi_deactivate_tcq(Scsi_Device *SDpnt) {
blk_queue_free_tags(&SDpnt->request_queue);
SDpnt->tagged_queue = 0;
scsi_adjust_queue_depth(SDpnt, 0, 2);
}
#define MSG_SIMPLE_TAG 0x20
#define MSG_HEAD_TAG 0x21
#define MSG_ORDERED_TAG 0x22
#define SCSI_NO_TAG (-1) /* identify no tag in use */
/**
* scsi_populate_tag_msg - place a tag message in a buffer
......
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