diff options
Diffstat (limited to 'drivers/scsi/ips.c')
| -rw-r--r-- | drivers/scsi/ips.c | 267 | 
1 files changed, 99 insertions, 168 deletions
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index f83a116955f..52a216f21ae 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -137,7 +137,7 @@  /*          - Fix path/name for scsi_hosts.h include for 2.6 kernels         */  /*          - Fix sort order of 7k                                           */  /*          - Remove 3 unused "inline" functions                             */ -/* 7.12.xx  - Use STATIC functions whereever possible                        */ +/* 7.12.xx  - Use STATIC functions wherever possible                        */  /*          - Clean up deprecated MODULE_PARM calls                          */  /* 7.12.05  - Remove Version Matching per IBM request                        */  /*****************************************************************************/ @@ -232,7 +232,7 @@ static int ips_detect(struct scsi_host_template *);  static int ips_release(struct Scsi_Host *);  static int ips_eh_abort(struct scsi_cmnd *);  static int ips_eh_reset(struct scsi_cmnd *); -static int ips_queue(struct scsi_cmnd *, void (*)(struct scsi_cmnd *)); +static int ips_queue(struct Scsi_Host *, struct scsi_cmnd *);  static const char *ips_info(struct Scsi_Host *);  static irqreturn_t do_ipsintr(int, void *);  static int ips_hainit(ips_ha_t *); @@ -326,10 +326,9 @@ static void ips_scmd_buf_write(struct scsi_cmnd * scmd, void *data,  static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data,  			      unsigned int count); -static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); -static int ips_host_info(ips_ha_t *, char *, off_t, int); -static void copy_mem_info(IPS_INFOSTR *, char *, int); -static int copy_info(IPS_INFOSTR *, char *, ...); +static int ips_write_info(struct Scsi_Host *, char *, int); +static int ips_show_info(struct seq_file *, struct Scsi_Host *); +static int ips_host_info(ips_ha_t *, struct seq_file *);  static int ips_abort_init(ips_ha_t * ha, int index);  static int ips_init_phase2(int index); @@ -367,13 +366,15 @@ static struct scsi_host_template ips_driver_template = {  	.eh_abort_handler	= ips_eh_abort,  	.eh_host_reset_handler	= ips_eh_reset,  	.proc_name		= "ips", -	.proc_info		= ips_proc_info, +	.show_info		= ips_show_info, +	.write_info		= ips_write_info,  	.slave_configure	= ips_slave_configure,  	.bios_param		= ips_biosparam,  	.this_id		= -1,  	.sg_tablesize		= IPS_MAX_SG,  	.cmd_per_lun		= 3,  	.use_clustering		= ENABLE_CLUSTERING, +	.no_write_same		= 1,  }; @@ -389,14 +390,14 @@ MODULE_DEVICE_TABLE( pci, ips_pci_table );  static char ips_hot_plug_name[] = "ips"; -static int __devinit  ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent); -static void __devexit ips_remove_device(struct pci_dev *pci_dev); +static int  ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent); +static void ips_remove_device(struct pci_dev *pci_dev);  static struct pci_driver ips_pci_driver = {  	.name		= ips_hot_plug_name,  	.id_table	= ips_pci_table,  	.probe		= ips_insert_device, -	.remove		= __devexit_p(ips_remove_device), +	.remove		= ips_remove_device,  }; @@ -1046,7 +1047,7 @@ static int ips_eh_reset(struct scsi_cmnd *SC)  /*    Linux obtains io_request_lock before calling this function            */  /*                                                                          */  /****************************************************************************/ -static int ips_queue(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)) +static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *))  {  	ips_ha_t *ha;  	ips_passthru_t *pt; @@ -1137,6 +1138,8 @@ static int ips_queue(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *))  	return (0);  } +static DEF_SCSI_QCMD(ips_queue) +  /****************************************************************************/  /*                                                                          */  /* Routine Name: ips_biosparam                                              */ @@ -1431,25 +1434,12 @@ ips_info(struct Scsi_Host *SH)  	return (bp);  } -/****************************************************************************/ -/*                                                                          */ -/* Routine Name: ips_proc_info                                              */ -/*                                                                          */ -/* Routine Description:                                                     */ -/*                                                                          */ -/*   The passthru interface for the driver                                  */ -/*                                                                          */ -/****************************************************************************/  static int -ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, -	      int length, int func) +ips_write_info(struct Scsi_Host *host, char *buffer, int length)  {  	int i; -	int ret;  	ips_ha_t *ha = NULL; -	METHOD_TRACE("ips_proc_info", 1); -  	/* Find our host structure */  	for (i = 0; i < ips_next_controller; i++) {  		if (ips_sh[i]) { @@ -1463,18 +1453,29 @@ ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,  	if (!ha)  		return (-EINVAL); -	if (func) { -		/* write */ -		return (0); -	} else { -		/* read */ -		if (start) -			*start = buffer; +	return 0; +} -		ret = ips_host_info(ha, buffer, offset, length); +static int +ips_show_info(struct seq_file *m, struct Scsi_Host *host) +{ +	int i; +	ips_ha_t *ha = NULL; -		return (ret); +	/* Find our host structure */ +	for (i = 0; i < ips_next_controller; i++) { +		if (ips_sh[i]) { +			if (ips_sh[i] == host) { +				ha = (ips_ha_t *) ips_sh[i]->hostdata; +				break; +			} +		}  	} + +	if (!ha) +		return (-EINVAL); + +	return ips_host_info(ha, m);  }  /*--------------------------------------------------------------------------*/ @@ -1509,14 +1510,14 @@ static int ips_is_passthru(struct scsi_cmnd *SC)                  /* kmap_atomic() ensures addressability of the user buffer.*/                  /* local_irq_save() protects the KM_IRQ0 address slot.     */                  local_irq_save(flags); -                buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; +                buffer = kmap_atomic(sg_page(sg)) + sg->offset;                  if (buffer && buffer[0] == 'C' && buffer[1] == 'O' &&                      buffer[2] == 'P' && buffer[3] == 'P') { -                        kunmap_atomic(buffer - sg->offset, KM_IRQ0); +                        kunmap_atomic(buffer - sg->offset);                          local_irq_restore(flags);                          return 1;                  } -                kunmap_atomic(buffer - sg->offset, KM_IRQ0); +                kunmap_atomic(buffer - sg->offset);                  local_irq_restore(flags);  	}  	return 0; @@ -1663,7 +1664,7 @@ ips_flash_copperhead(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb)  	int datasize;  	/* Trombone is the only copperhead that can do packet flash, but only -	 * for firmware. No one said it had to make sence. */ +	 * for firmware. No one said it had to make sense. */  	if (IPS_IS_TROMBONE(ha) && pt->CoppCP.cmd.flashfw.type == IPS_FW_IMAGE) {  		if (ips_usrcmd(ha, pt, scb))  			return IPS_SUCCESS; @@ -2033,183 +2034,113 @@ ips_cleanup_passthru(ips_ha_t * ha, ips_scb_t * scb)  /*                                                                          */  /****************************************************************************/  static int -ips_host_info(ips_ha_t * ha, char *ptr, off_t offset, int len) +ips_host_info(ips_ha_t *ha, struct seq_file *m)  { -	IPS_INFOSTR info; -  	METHOD_TRACE("ips_host_info", 1); -	info.buffer = ptr; -	info.length = len; -	info.offset = offset; -	info.pos = 0; -	info.localpos = 0; - -	copy_info(&info, "\nIBM ServeRAID General Information:\n\n"); +	seq_printf(m, "\nIBM ServeRAID General Information:\n\n");  	if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) &&  	    (le16_to_cpu(ha->nvram->adapter_type) != 0)) -		copy_info(&info, "\tController Type                   : %s\n", +		seq_printf(m, "\tController Type                   : %s\n",  			  ips_adapter_name[ha->ad_type - 1]);  	else -		copy_info(&info, +		seq_printf(m,  			  "\tController Type                   : Unknown\n");  	if (ha->io_addr) -		copy_info(&info, -			  "\tIO region                         : 0x%lx (%d bytes)\n", +		seq_printf(m, +			  "\tIO region                         : 0x%x (%d bytes)\n",  			  ha->io_addr, ha->io_len);  	if (ha->mem_addr) { -		copy_info(&info, -			  "\tMemory region                     : 0x%lx (%d bytes)\n", +		seq_printf(m, +			  "\tMemory region                     : 0x%x (%d bytes)\n",  			  ha->mem_addr, ha->mem_len); -		copy_info(&info, +		seq_printf(m,  			  "\tShared memory address             : 0x%lx\n", -			  ha->mem_ptr); +			  (unsigned long)ha->mem_ptr);  	} -	copy_info(&info, "\tIRQ number                        : %d\n", ha->pcidev->irq); +	seq_printf(m, "\tIRQ number                        : %d\n", ha->pcidev->irq);      /* For the Next 3 lines Check for Binary 0 at the end and don't include it if it's there. */      /* That keeps everything happy for "text" operations on the proc file.                    */  	if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) {  	if (ha->nvram->bios_low[3] == 0) { -            copy_info(&info, -			          "\tBIOS Version                      : %c%c%c%c%c%c%c\n", -			          ha->nvram->bios_high[0], ha->nvram->bios_high[1], -			          ha->nvram->bios_high[2], ha->nvram->bios_high[3], -			          ha->nvram->bios_low[0], ha->nvram->bios_low[1], -			          ha->nvram->bios_low[2]); +		seq_printf(m, +			  "\tBIOS Version                      : %c%c%c%c%c%c%c\n", +			  ha->nvram->bios_high[0], ha->nvram->bios_high[1], +			  ha->nvram->bios_high[2], ha->nvram->bios_high[3], +			  ha->nvram->bios_low[0], ha->nvram->bios_low[1], +			  ha->nvram->bios_low[2]);          } else { -		    copy_info(&info, -			          "\tBIOS Version                      : %c%c%c%c%c%c%c%c\n", -			          ha->nvram->bios_high[0], ha->nvram->bios_high[1], -			          ha->nvram->bios_high[2], ha->nvram->bios_high[3], -			          ha->nvram->bios_low[0], ha->nvram->bios_low[1], -			          ha->nvram->bios_low[2], ha->nvram->bios_low[3]); +		seq_printf(m, +			  "\tBIOS Version                      : %c%c%c%c%c%c%c%c\n", +			  ha->nvram->bios_high[0], ha->nvram->bios_high[1], +			  ha->nvram->bios_high[2], ha->nvram->bios_high[3], +			  ha->nvram->bios_low[0], ha->nvram->bios_low[1], +			  ha->nvram->bios_low[2], ha->nvram->bios_low[3]);          }      }      if (ha->enq->CodeBlkVersion[7] == 0) { -        copy_info(&info, -		          "\tFirmware Version                  : %c%c%c%c%c%c%c\n", -		          ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], -		          ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], -		          ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], -		          ha->enq->CodeBlkVersion[6]); +        seq_printf(m, +		  "\tFirmware Version                  : %c%c%c%c%c%c%c\n", +		  ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], +		  ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], +		  ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], +		  ha->enq->CodeBlkVersion[6]);      } else { -        copy_info(&info, -		          "\tFirmware Version                  : %c%c%c%c%c%c%c%c\n", -		          ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], -		          ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], -		          ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], -		          ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); +	seq_printf(m, +		  "\tFirmware Version                  : %c%c%c%c%c%c%c%c\n", +		  ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], +		  ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], +		  ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], +		  ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]);      }      if (ha->enq->BootBlkVersion[7] == 0) { -        copy_info(&info, -		          "\tBoot Block Version                : %c%c%c%c%c%c%c\n", -		          ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], -		          ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], -		          ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], -		          ha->enq->BootBlkVersion[6]); +        seq_printf(m, +		  "\tBoot Block Version                : %c%c%c%c%c%c%c\n", +		  ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], +		  ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], +		  ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], +		  ha->enq->BootBlkVersion[6]);      } else { -        copy_info(&info, -		          "\tBoot Block Version                : %c%c%c%c%c%c%c%c\n", -		          ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], -		          ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], -		          ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], -		          ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); +        seq_printf(m, +		  "\tBoot Block Version                : %c%c%c%c%c%c%c%c\n", +		  ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], +		  ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], +		  ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], +		  ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]);      } -	copy_info(&info, "\tDriver Version                    : %s%s\n", +	seq_printf(m, "\tDriver Version                    : %s%s\n",  		  IPS_VERSION_HIGH, IPS_VERSION_LOW); -	copy_info(&info, "\tDriver Build                      : %d\n", +	seq_printf(m, "\tDriver Build                      : %d\n",  		  IPS_BUILD_IDENT); -	copy_info(&info, "\tMax Physical Devices              : %d\n", +	seq_printf(m, "\tMax Physical Devices              : %d\n",  		  ha->enq->ucMaxPhysicalDevices); -	copy_info(&info, "\tMax Active Commands               : %d\n", +	seq_printf(m, "\tMax Active Commands               : %d\n",  		  ha->max_cmds); -	copy_info(&info, "\tCurrent Queued Commands           : %d\n", +	seq_printf(m, "\tCurrent Queued Commands           : %d\n",  		  ha->scb_waitlist.count); -	copy_info(&info, "\tCurrent Active Commands           : %d\n", +	seq_printf(m, "\tCurrent Active Commands           : %d\n",  		  ha->scb_activelist.count - ha->num_ioctl); -	copy_info(&info, "\tCurrent Queued PT Commands        : %d\n", +	seq_printf(m, "\tCurrent Queued PT Commands        : %d\n",  		  ha->copp_waitlist.count); -	copy_info(&info, "\tCurrent Active PT Commands        : %d\n", +	seq_printf(m, "\tCurrent Active PT Commands        : %d\n",  		  ha->num_ioctl); -	copy_info(&info, "\n"); - -	return (info.localpos); -} +	seq_printf(m, "\n"); -/****************************************************************************/ -/*                                                                          */ -/* Routine Name: copy_mem_info                                              */ -/*                                                                          */ -/* Routine Description:                                                     */ -/*                                                                          */ -/*   Copy data into an IPS_INFOSTR structure                                */ -/*                                                                          */ -/****************************************************************************/ -static void -copy_mem_info(IPS_INFOSTR * info, char *data, int len) -{ -	METHOD_TRACE("copy_mem_info", 1); - -	if (info->pos + len < info->offset) { -		info->pos += len; -		return; -	} - -	if (info->pos < info->offset) { -		data += (info->offset - info->pos); -		len -= (info->offset - info->pos); -		info->pos += (info->offset - info->pos); -	} - -	if (info->localpos + len > info->length) -		len = info->length - info->localpos; - -	if (len > 0) { -		memcpy(info->buffer + info->localpos, data, len); -		info->pos += len; -		info->localpos += len; -	} -} - -/****************************************************************************/ -/*                                                                          */ -/* Routine Name: copy_info                                                  */ -/*                                                                          */ -/* Routine Description:                                                     */ -/*                                                                          */ -/*   printf style wrapper for an info structure                             */ -/*                                                                          */ -/****************************************************************************/ -static int -copy_info(IPS_INFOSTR * info, char *fmt, ...) -{ -	va_list args; -	char buf[128]; -	int len; - -	METHOD_TRACE("copy_info", 1); - -	va_start(args, fmt); -	len = vsprintf(buf, fmt, args); -	va_end(args); - -	copy_mem_info(info, buf, len); - -	return (len); +	return 0;  }  /****************************************************************************/ @@ -4492,7 +4423,7 @@ ips_init_scb(ips_ha_t * ha, ips_scb_t * scb)  /*                                                                          */  /*   Initialize a CCB to default values                                     */  /*                                                                          */ -/* ASSUMED to be callled from within a lock                                 */ +/* ASSUMED to be called from within a lock                                 */  /*                                                                          */  /****************************************************************************/  static ips_scb_t * @@ -6835,7 +6766,7 @@ err_out_sh:  /*   Routine Description:                                                    */  /*     Remove one Adapter ( Hot Plugging )                                   */  /*---------------------------------------------------------------------------*/ -static void __devexit +static void  ips_remove_device(struct pci_dev *pci_dev)  {  	struct Scsi_Host *sh = pci_get_drvdata(pci_dev); @@ -6896,7 +6827,7 @@ module_exit(ips_module_exit);  /*   Return Value:                                                           */  /*     0 if Successful, else non-zero                                        */  /*---------------------------------------------------------------------------*/ -static int __devinit +static int  ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent)  {  	int index = -1;  | 
