DB(DB_QUEUE_COMMAND, printk("Q-%d-%02x-%ld(", cmd->device->id, cmd->cmnd[0], cmd->pid)) 
DB(DB_QUEUE_COMMAND, scmd_printk(KERN_DEBUG, cmd, "Q-%02x-%ld(", cmd->cmnd[0], cmd->pid)) 
static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)){	struct Scsi_Host *instance;	struct IN2000_hostdata *hostdata;	Scsi_Cmnd *tmp;	instance = cmd->device->host;	hostdata = (struct IN2000_hostdata *) instance->hostdata;	DB(DB_QUEUE_COMMAND, printk("Q-%d-%02x-%ld(", cmd->device->id, cmd->cmnd[0], cmd->pid))/* Set up a few fields in the Scsi_Cmnd structure for our own use: *  - host_scribble is the pointer to the next cmd in the input queue *  - scsi_done points to the routine we call when a cmd is finished *  - result is what you'd expect */	    cmd->host_scribble = NULL;	cmd->scsi_done = done;	cmd->result = 0;/* We use the Scsi_Pointer structure that's included with each command * as a scratchpad (as it's intended to be used!). The handy thing about * the SCp.xxx fields is that they're always associated with a given * cmd, and are preserved across disconnect-reselect. This means we * can pretty much ignore SAVE_POINTERS and RESTORE_POINTERS messages * if we keep all the critical pointers and counters in SCp: *  - SCp.ptr is the pointer into the RAM buffer *  - SCp.this_residual is the size of that buffer *  - SCp.buffer points to the current scatter-gather buffer *  - SCp.buffers_residual tells us how many S.G. buffers there are *  - SCp.have_data_in helps keep track of >2048 byte transfers *  - SCp.sent_command is not used *  - SCp.phase records this command's SRCID_ER bit setting */	if (cmd->use_sg) {		cmd->SCp.buffer = (struct scatterlist *) cmd->buffer;		cmd->SCp.buffers_residual = cmd->use_sg - 1;		cmd->SCp.ptr = (char *) page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset;		cmd->SCp.this_residual = cmd->SCp.buffer->length;	} else {		cmd->SCp.buffer = NULL;		cmd->SCp.buffers_residual = 0;		cmd->SCp.ptr = (char *) cmd->request_buffer;		cmd->SCp.this_residual = cmd->request_bufflen;	}	cmd->SCp.have_data_in = 0;/* We don't set SCp.phase here - that's done in in2000_execute() *//* WD docs state that at the conclusion of a "LEVEL2" command, the * status byte can be retrieved from the LUN register. Apparently, * this is the case only for *uninterrupted* LEVEL2 commands! If * there are any unexpected phases entered, even if they are 100% * legal (different devices may choose to do things differently), * the LEVEL2 command sequence is exited. This often occurs prior * to receiving the status byte, in which case the driver does a * status phase interrupt and gets the status byte on its own. * While such a command can then be "resumed" (ie restarted to * finish up as a LEVEL2 command), the LUN register will NOT be * a valid status byte at the command's conclusion, and we must * use the byte obtained during the earlier interrupt. Here, we * preset SCp.Status to an illegal value (0xff) so that when * this command finally completes, we can tell where the actual * status byte is stored. */	cmd->SCp.Status = ILLEGAL_STATUS_BYTE;/* We need to disable interrupts before messing with the input * queue and calling in2000_execute(). */	/*	 * Add the cmd to the end of 'input_Q'. Note that REQUEST_SENSE	 * commands are added to the head of the queue so that the desired	 * sense data is not lost before REQUEST_SENSE executes.	 */	if (!(hostdata->input_Q) || (cmd->cmnd[0] == REQUEST_SENSE)) {		cmd->host_scribble = (uchar *) hostdata->input_Q;		hostdata->input_Q = cmd;	} else {		/* find the end of the queue */		for (tmp = (Scsi_Cmnd *) hostdata->input_Q; tmp->host_scribble; tmp = (Scsi_Cmnd *) tmp->host_scribble);		tmp->host_scribble = (uchar *) cmd;	}/* We know that there's at least one command in 'input_Q' now. * Go see if any of them are runnable! */	in2000_execute(cmd->device->host);	DB(DB_QUEUE_COMMAND, printk(")Q-%ld ", cmd->pid))	    return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/017560fca496f72ed9dd734ffde63ce39dfe0411/in2000.c/clean/drivers/scsi/in2000.c