diff options
Diffstat (limited to 'drivers/scsi/wd33c93.c')
| -rw-r--r-- | drivers/scsi/wd33c93.c | 246 | 
1 files changed, 110 insertions, 136 deletions
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index b701bf2cc18..41883a87931 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c @@ -371,8 +371,8 @@ calc_sync_msg(unsigned int period, unsigned int offset, unsigned int fast,  	msg[1] = offset;  } -int -wd33c93_queuecommand(struct scsi_cmnd *cmd, +static int +wd33c93_queuecommand_lck(struct scsi_cmnd *cmd,  		void (*done)(struct scsi_cmnd *))  {  	struct WD33C93_hostdata *hostdata; @@ -381,7 +381,7 @@ wd33c93_queuecommand(struct scsi_cmnd *cmd,  	hostdata = (struct WD33C93_hostdata *) cmd->device->host->hostdata;  	DB(DB_QUEUE_COMMAND, -	   printk("Q-%d-%02x-%ld( ", cmd->device->id, cmd->cmnd[0], cmd->serial_number)) +	   printk("Q-%d-%02x( ", cmd->device->id, cmd->cmnd[0]))  /* 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 @@ -462,12 +462,14 @@ wd33c93_queuecommand(struct scsi_cmnd *cmd,  	wd33c93_execute(cmd->device->host); -	DB(DB_QUEUE_COMMAND, printk(")Q-%ld ", cmd->serial_number)) +	DB(DB_QUEUE_COMMAND, printk(")Q "))  	spin_unlock_irq(&hostdata->lock);  	return 0;  } +DEF_SCSI_QCMD(wd33c93_queuecommand) +  /*   * This routine attempts to start a scsi command. If the host_card is   * already connected, we give up immediately. Otherwise, look through @@ -685,7 +687,7 @@ wd33c93_execute(struct Scsi_Host *instance)  	 */  	DB(DB_EXECUTE, -	   printk("%s%ld)EX-2 ", (cmd->SCp.phase) ? "d:" : "", cmd->serial_number)) +	   printk("%s)EX-2 ", (cmd->SCp.phase) ? "d:" : ""))  }  static void @@ -961,7 +963,7 @@ wd33c93_intr(struct Scsi_Host *instance)  	case CSR_XFER_DONE | PHS_COMMAND:  	case CSR_UNEXP | PHS_COMMAND:  	case CSR_SRV_REQ | PHS_COMMAND: -		DB(DB_INTR, printk("CMND-%02x,%ld", cmd->cmnd[0], cmd->serial_number)) +		DB(DB_INTR, printk("CMND-%02x", cmd->cmnd[0]))  		    transfer_pio(regs, cmd->cmnd, cmd->cmd_len, DATA_OUT_DIR,  				 hostdata);  		hostdata->state = S_CONNECTED; @@ -1005,7 +1007,7 @@ wd33c93_intr(struct Scsi_Host *instance)  		switch (msg) {  		case COMMAND_COMPLETE: -			DB(DB_INTR, printk("CCMP-%ld", cmd->serial_number)) +			DB(DB_INTR, printk("CCMP"))  			    write_wd33c93_cmd(regs, WD_CMD_NEGATE_ACK);  			hostdata->state = S_PRE_CMP_DISC;  			break; @@ -1172,7 +1174,7 @@ wd33c93_intr(struct Scsi_Host *instance)  		write_wd33c93(regs, WD_SOURCE_ID, SRCID_ER);  		if (phs == 0x60) { -			DB(DB_INTR, printk("SX-DONE-%ld", cmd->serial_number)) +			DB(DB_INTR, printk("SX-DONE"))  			    cmd->SCp.Message = COMMAND_COMPLETE;  			lun = read_wd33c93(regs, WD_TARGET_LUN);  			DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun)) @@ -1198,8 +1200,8 @@ wd33c93_intr(struct Scsi_Host *instance)  			wd33c93_execute(instance);  		} else {  			printk -			    ("%02x:%02x:%02x-%ld: Unknown SEL_XFER_DONE phase!!---", -			     asr, sr, phs, cmd->serial_number); +			    ("%02x:%02x:%02x: Unknown SEL_XFER_DONE phase!!---", +			     asr, sr, phs);  			spin_unlock_irqrestore(&hostdata->lock, flags);  		}  		break; @@ -1264,7 +1266,7 @@ wd33c93_intr(struct Scsi_Host *instance)  			spin_unlock_irqrestore(&hostdata->lock, flags);  			return;  		} -		DB(DB_INTR, printk("UNEXP_DISC-%ld", cmd->serial_number)) +		DB(DB_INTR, printk("UNEXP_DISC"))  		    hostdata->connected = NULL;  		hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);  		hostdata->state = S_UNCONNECTED; @@ -1290,7 +1292,7 @@ wd33c93_intr(struct Scsi_Host *instance)   */  		write_wd33c93(regs, WD_SOURCE_ID, SRCID_ER); -		DB(DB_INTR, printk("DISC-%ld", cmd->serial_number)) +		DB(DB_INTR, printk("DISC"))  		    if (cmd == NULL) {  			printk(" - Already disconnected! ");  			hostdata->state = S_UNCONNECTED; @@ -1489,7 +1491,6 @@ wd33c93_intr(struct Scsi_Host *instance)  		} else  			hostdata->state = S_CONNECTED; -		DB(DB_INTR, printk("-%ld", cmd->serial_number))  		    spin_unlock_irqrestore(&hostdata->lock, flags);  		break; @@ -1635,8 +1636,8 @@ wd33c93_abort(struct scsi_cmnd * cmd)  			cmd->host_scribble = NULL;  			cmd->result = DID_ABORT << 16;  			printk -			    ("scsi%d: Abort - removing command %ld from input_Q. ", -			     instance->host_no, cmd->serial_number); +			    ("scsi%d: Abort - removing command from input_Q. ", +			     instance->host_no);  			enable_irq(cmd->device->host->irq);  			cmd->scsi_done(cmd);  			return SUCCESS; @@ -1660,8 +1661,8 @@ wd33c93_abort(struct scsi_cmnd * cmd)  		uchar sr, asr;  		unsigned long timeout; -		printk("scsi%d: Aborting connected command %ld - ", -		       instance->host_no, cmd->serial_number); +		printk("scsi%d: Aborting connected command - ", +		       instance->host_no);  		printk("stopping DMA - ");  		if (hostdata->dma == D_DMA_RUNNING) { @@ -1727,8 +1728,8 @@ wd33c93_abort(struct scsi_cmnd * cmd)  	while (tmp) {  		if (tmp == cmd) {  			printk -			    ("scsi%d: Abort - command %ld found on disconnected_Q - ", -			     instance->host_no, cmd->serial_number); +			    ("scsi%d: Abort - command found on disconnected_Q - ", +			     instance->host_no);  			printk("Abort SNOOZE. ");  			enable_irq(cmd->device->host->irq);  			return FAILED; @@ -1841,7 +1842,7 @@ check_setup_args(char *key, int *flags, int *val, char *buf)   *   * The original driver used to rely on a fixed sx_table, containing periods   * for (only) the lower limits of the respective input-clock-frequency ranges - * (8-10/12-15/16-20 MHz). Although it seems, that no problems ocurred with + * (8-10/12-15/16-20 MHz). Although it seems, that no problems occurred with   * this setting so far, it might be desirable to adjust the transfer periods   * closer to the really attached, possibly 25% higher, input-clock, since   * - the wd33c93 may really use a significant shorter period, than it has @@ -2050,26 +2051,19 @@ wd33c93_init(struct Scsi_Host *instance, const wd33c93_regs regs,  	for (i = 0; i < MAX_SETUP_ARGS; i++)  		printk("%s,", setup_args[i]);  	printk("\n"); -	printk("           Version %s - %s, Compiled %s at %s\n", -	       WD33C93_VERSION, WD33C93_DATE, __DATE__, __TIME__); +	printk("           Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE);  } -int -wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in) +int wd33c93_write_info(struct Scsi_Host *instance, char *buf, int len)  { -  #ifdef PROC_INTERFACE -  	char *bp; -	char tbuf[128];  	struct WD33C93_hostdata *hd; -	struct scsi_cmnd *cmd;  	int x; -	static int stop = 0;  	hd = (struct WD33C93_hostdata *) instance->hostdata; -/* If 'in' is TRUE we need to _read_ the proc file. We accept the following +/* We accept the following   * keywords (same format as command-line, but arguments are not optional):   *    debug   *    disconnect @@ -2083,145 +2077,124 @@ wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off   *    nosync   */ -	if (in) { -		buf[len] = '\0'; -		for (bp = buf; *bp; ) { -			while (',' == *bp || ' ' == *bp) -				++bp; -		if (!strncmp(bp, "debug:", 6)) { -				hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK; -		} else if (!strncmp(bp, "disconnect:", 11)) { -				x = simple_strtoul(bp+11, &bp, 0); -			if (x < DIS_NEVER || x > DIS_ALWAYS) -				x = DIS_ADAPTIVE; -			hd->disconnect = x; -		} else if (!strncmp(bp, "period:", 7)) { +	buf[len] = '\0'; +	for (bp = buf; *bp; ) { +		while (',' == *bp || ' ' == *bp) +			++bp; +	if (!strncmp(bp, "debug:", 6)) { +			hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK; +	} else if (!strncmp(bp, "disconnect:", 11)) { +			x = simple_strtoul(bp+11, &bp, 0); +		if (x < DIS_NEVER || x > DIS_ALWAYS) +			x = DIS_ADAPTIVE; +		hd->disconnect = x; +	} else if (!strncmp(bp, "period:", 7)) { +		x = simple_strtoul(bp+7, &bp, 0); +		hd->default_sx_per = +			hd->sx_table[round_period((unsigned int) x, +						  hd->sx_table)].period_ns; +	} else if (!strncmp(bp, "resync:", 7)) { +			set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0)); +	} else if (!strncmp(bp, "proc:", 5)) { +			hd->proc = simple_strtoul(bp+5, &bp, 0); +	} else if (!strncmp(bp, "nodma:", 6)) { +			hd->no_dma = simple_strtoul(bp+6, &bp, 0); +	} else if (!strncmp(bp, "level2:", 7)) { +			hd->level2 = simple_strtoul(bp+7, &bp, 0); +		} else if (!strncmp(bp, "burst:", 6)) { +			hd->dma_mode = +				simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA; +		} else if (!strncmp(bp, "fast:", 5)) { +			x = !!simple_strtol(bp+5, &bp, 0); +			if (x != hd->fast) +				set_resync(hd, 0xff); +			hd->fast = x; +		} else if (!strncmp(bp, "nosync:", 7)) {  			x = simple_strtoul(bp+7, &bp, 0); -			hd->default_sx_per = -				hd->sx_table[round_period((unsigned int) x, -							  hd->sx_table)].period_ns; -		} else if (!strncmp(bp, "resync:", 7)) { -				set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0)); -		} else if (!strncmp(bp, "proc:", 5)) { -				hd->proc = simple_strtoul(bp+5, &bp, 0); -		} else if (!strncmp(bp, "nodma:", 6)) { -				hd->no_dma = simple_strtoul(bp+6, &bp, 0); -		} else if (!strncmp(bp, "level2:", 7)) { -				hd->level2 = simple_strtoul(bp+7, &bp, 0); -			} else if (!strncmp(bp, "burst:", 6)) { -				hd->dma_mode = -					simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA; -			} else if (!strncmp(bp, "fast:", 5)) { -				x = !!simple_strtol(bp+5, &bp, 0); -				if (x != hd->fast) -					set_resync(hd, 0xff); -				hd->fast = x; -			} else if (!strncmp(bp, "nosync:", 7)) { -				x = simple_strtoul(bp+7, &bp, 0); -				set_resync(hd, x ^ hd->no_sync); -				hd->no_sync = x; -			} else { -				break; /* unknown keyword,syntax-error,... */ -			} +			set_resync(hd, x ^ hd->no_sync); +			hd->no_sync = x; +		} else { +			break; /* unknown keyword,syntax-error,... */  		} -		return len;  	} +	return len; +#else +	return 0; +#endif +} + +int +wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance) +{ +#ifdef PROC_INTERFACE +	struct WD33C93_hostdata *hd; +	struct scsi_cmnd *cmd; +	int x; + +	hd = (struct WD33C93_hostdata *) instance->hostdata;  	spin_lock_irq(&hd->lock); -	bp = buf; -	*bp = '\0'; -	if (hd->proc & PR_VERSION) { -		sprintf(tbuf, "\nVersion %s - %s. Compiled %s %s", -			WD33C93_VERSION, WD33C93_DATE, __DATE__, __TIME__); -		strcat(bp, tbuf); -	} +	if (hd->proc & PR_VERSION) +		seq_printf(m, "\nVersion %s - %s.", +			WD33C93_VERSION, WD33C93_DATE); +  	if (hd->proc & PR_INFO) { -		sprintf(tbuf, "\nclock_freq=%02x no_sync=%02x no_dma=%d" +		seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d"  			" dma_mode=%02x fast=%d",  			hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast); -		strcat(bp, tbuf); -		strcat(bp, "\nsync_xfer[] =       "); -		for (x = 0; x < 7; x++) { -			sprintf(tbuf, "\t%02x", hd->sync_xfer[x]); -			strcat(bp, tbuf); -		} -		strcat(bp, "\nsync_stat[] =       "); -		for (x = 0; x < 7; x++) { -			sprintf(tbuf, "\t%02x", hd->sync_stat[x]); -			strcat(bp, tbuf); -		} +		seq_printf(m, "\nsync_xfer[] =       "); +		for (x = 0; x < 7; x++) +			seq_printf(m, "\t%02x", hd->sync_xfer[x]); +		seq_printf(m, "\nsync_stat[] =       "); +		for (x = 0; x < 7; x++) +			seq_printf(m, "\t%02x", hd->sync_stat[x]);  	}  #ifdef PROC_STATISTICS  	if (hd->proc & PR_STATISTICS) { -		strcat(bp, "\ncommands issued:    "); -		for (x = 0; x < 7; x++) { -			sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]); -			strcat(bp, tbuf); -		} -		strcat(bp, "\ndisconnects allowed:"); -		for (x = 0; x < 7; x++) { -			sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]); -			strcat(bp, tbuf); -		} -		strcat(bp, "\ndisconnects done:   "); -		for (x = 0; x < 7; x++) { -			sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]); -			strcat(bp, tbuf); -		} -		sprintf(tbuf, +		seq_printf(m, "\ncommands issued:    "); +		for (x = 0; x < 7; x++) +			seq_printf(m, "\t%ld", hd->cmd_cnt[x]); +		seq_printf(m, "\ndisconnects allowed:"); +		for (x = 0; x < 7; x++) +			seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]); +		seq_printf(m, "\ndisconnects done:   "); +		for (x = 0; x < 7; x++) +			seq_printf(m, "\t%ld", hd->disc_done_cnt[x]); +		seq_printf(m,  			"\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO",  			hd->int_cnt, hd->dma_cnt, hd->pio_cnt); -		strcat(bp, tbuf);  	}  #endif  	if (hd->proc & PR_CONNECTED) { -		strcat(bp, "\nconnected:     "); +		seq_printf(m, "\nconnected:     ");  		if (hd->connected) {  			cmd = (struct scsi_cmnd *) hd->connected; -			sprintf(tbuf, " %ld-%d:%d(%02x)", -				cmd->serial_number, cmd->device->id, cmd->device->lun, cmd->cmnd[0]); -			strcat(bp, tbuf); +			seq_printf(m, " %d:%d(%02x)", +				cmd->device->id, cmd->device->lun, cmd->cmnd[0]);  		}  	}  	if (hd->proc & PR_INPUTQ) { -		strcat(bp, "\ninput_Q:       "); +		seq_printf(m, "\ninput_Q:       ");  		cmd = (struct scsi_cmnd *) hd->input_Q;  		while (cmd) { -			sprintf(tbuf, " %ld-%d:%d(%02x)", -				cmd->serial_number, cmd->device->id, cmd->device->lun, cmd->cmnd[0]); -			strcat(bp, tbuf); +			seq_printf(m, " %d:%d(%02x)", +				cmd->device->id, cmd->device->lun, cmd->cmnd[0]);  			cmd = (struct scsi_cmnd *) cmd->host_scribble;  		}  	}  	if (hd->proc & PR_DISCQ) { -		strcat(bp, "\ndisconnected_Q:"); +		seq_printf(m, "\ndisconnected_Q:");  		cmd = (struct scsi_cmnd *) hd->disconnected_Q;  		while (cmd) { -			sprintf(tbuf, " %ld-%d:%d(%02x)", -				cmd->serial_number, cmd->device->id, cmd->device->lun, cmd->cmnd[0]); -			strcat(bp, tbuf); +			seq_printf(m, " %d:%d(%02x)", +				cmd->device->id, cmd->device->lun, cmd->cmnd[0]);  			cmd = (struct scsi_cmnd *) cmd->host_scribble;  		}  	} -	strcat(bp, "\n"); +	seq_printf(m, "\n");  	spin_unlock_irq(&hd->lock); -	*start = buf; -	if (stop) { -		stop = 0; -		return 0; -	} -	if (off > 0x40000)	/* ALWAYS stop after 256k bytes have been read */ -		stop = 1; -	if (hd->proc & PR_STOP)	/* stop every other time */ -		stop = 1; -	return strlen(bp); - -#else				/* PROC_INTERFACE */ - -	return 0; -  #endif				/* PROC_INTERFACE */ - +	return 0;  }  EXPORT_SYMBOL(wd33c93_host_reset); @@ -2229,4 +2202,5 @@ EXPORT_SYMBOL(wd33c93_init);  EXPORT_SYMBOL(wd33c93_abort);  EXPORT_SYMBOL(wd33c93_queuecommand);  EXPORT_SYMBOL(wd33c93_intr); -EXPORT_SYMBOL(wd33c93_proc_info); +EXPORT_SYMBOL(wd33c93_show_info); +EXPORT_SYMBOL(wd33c93_write_info);  | 
