Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
scsi_transport_spi.c File Reference
#include <linux/ctype.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/workqueue.h>
#include <linux/blkdev.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
#include <scsi/scsi.h>
#include "scsi_priv.h"
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_spi.h>

Go to the source code of this file.

Data Structures

struct  spi_internal
 
struct  work_queue_wrapper
 

Macros

#define SPI_NUM_ATTRS   14 /* increase this if you add attributes */
 
#define SPI_OTHER_ATTRS
 
#define SPI_HOST_ATTRS   1
 
#define SPI_MAX_ECHO_BUFFER_SIZE   4096
 
#define DV_LOOPS   3
 
#define DV_TIMEOUT   (10*HZ)
 
#define DV_RETRIES
 
#define spi_dv_in_progress(x)   (((struct spi_transport_attrs *)&(x)->starget_data)->dv_in_progress)
 
#define spi_dv_mutex(x)   (((struct spi_transport_attrs *)&(x)->starget_data)->dv_mutex)
 
#define to_spi_internal(tmpl)   container_of(tmpl, struct spi_internal, t)
 
#define SPI_STATIC_PPR   0x0c
 
#define spi_transport_show_simple(field, format_string)
 
#define spi_transport_store_simple(field, format_string)
 
#define spi_transport_show_function(field, format_string)
 
#define spi_transport_store_function(field, format_string)
 
#define spi_transport_store_max(field, format_string)
 
#define spi_transport_rd_attr(field, format_string)
 
#define spi_transport_simple_attr(field, format_string)
 
#define spi_transport_max_attr(field, format_string)
 
#define DV_SET(x, y)
 
#define TARGET_ATTRIBUTE_HELPER(name)
 

Enumerations

enum  { SPI_BLIST_NOIUS = 0x1 }
 
enum  spi_compare_returns { SPI_COMPARE_SUCCESS, SPI_COMPARE_FAILURE, SPI_COMPARE_SKIP_TEST }
 

Functions

 spi_transport_max_attr (offset,"%d\n")
 
 spi_transport_max_attr (width,"%d\n")
 
 spi_transport_max_attr (iu,"%d\n")
 
 spi_transport_rd_attr (dt,"%d\n")
 
 spi_transport_max_attr (qas,"%d\n")
 
 spi_transport_rd_attr (wr_flow,"%d\n")
 
 spi_transport_rd_attr (rd_strm,"%d\n")
 
 spi_transport_rd_attr (rti,"%d\n")
 
 spi_transport_rd_attr (pcomp_en,"%d\n")
 
 spi_transport_rd_attr (hold_mcs,"%d\n")
 
void spi_dv_device (struct scsi_device *sdev)
 
 EXPORT_SYMBOL (spi_dv_device)
 
void spi_schedule_dv_device (struct scsi_device *sdev)
 
 EXPORT_SYMBOL (spi_schedule_dv_device)
 
void spi_display_xfer_agreement (struct scsi_target *starget)
 
 EXPORT_SYMBOL (spi_display_xfer_agreement)
 
int spi_populate_width_msg (unsigned char *msg, int width)
 
 EXPORT_SYMBOL_GPL (spi_populate_width_msg)
 
int spi_populate_sync_msg (unsigned char *msg, int period, int offset)
 
 EXPORT_SYMBOL_GPL (spi_populate_sync_msg)
 
int spi_populate_ppr_msg (unsigned char *msg, int period, int offset, int width, int options)
 
 EXPORT_SYMBOL_GPL (spi_populate_ppr_msg)
 
int spi_print_msg (const unsigned char *msg)
 
 EXPORT_SYMBOL (spi_print_msg)
 
struct scsi_transport_templatespi_attach_transport (struct spi_function_template *ft)
 
 EXPORT_SYMBOL (spi_attach_transport)
 
void spi_release_transport (struct scsi_transport_template *t)
 
 EXPORT_SYMBOL (spi_release_transport)
 
 MODULE_AUTHOR ("Martin Hicks")
 
 MODULE_DESCRIPTION ("SPI Transport Attributes")
 
 MODULE_LICENSE ("GPL")
 
 module_init (spi_transport_init)
 
 module_exit (spi_transport_exit)
 

Macro Definition Documentation

#define DV_LOOPS   3

Definition at line 44 of file scsi_transport_spi.c.

#define DV_RETRIES
Value:
3 /* should only need at most
* two cc/ua clears */

Definition at line 46 of file scsi_transport_spi.c.

#define DV_SET (   x,
  y 
)
Value:
if(i->f->set_##x) \
i->f->set_##x(sdev->sdev_target, y)

Definition at line 620 of file scsi_transport_spi.c.

#define DV_TIMEOUT   (10*HZ)

Definition at line 45 of file scsi_transport_spi.c.

#define spi_dv_in_progress (   x)    (((struct spi_transport_attrs *)&(x)->starget_data)->dv_in_progress)

Definition at line 65 of file scsi_transport_spi.c.

#define spi_dv_mutex (   x)    (((struct spi_transport_attrs *)&(x)->starget_data)->dv_mutex)

Definition at line 66 of file scsi_transport_spi.c.

#define SPI_HOST_ATTRS   1

Definition at line 40 of file scsi_transport_spi.c.

#define SPI_MAX_ECHO_BUFFER_SIZE   4096

Definition at line 42 of file scsi_transport_spi.c.

#define SPI_NUM_ATTRS   14 /* increase this if you add attributes */

Definition at line 38 of file scsi_transport_spi.c.

#define SPI_OTHER_ATTRS
Value:
1 /* Increase this if you add "always
* on" attributes */

Definition at line 39 of file scsi_transport_spi.c.

#define SPI_STATIC_PPR   0x0c

Definition at line 94 of file scsi_transport_spi.c.

#define spi_transport_max_attr (   field,
  format_string 
)
Value:
spi_transport_store_max(field, format_string) \
spi_transport_simple_attr(max_##field, format_string) \
show_spi_transport_##field, \
store_spi_transport_##field);

Definition at line 376 of file scsi_transport_spi.c.

#define spi_transport_rd_attr (   field,
  format_string 
)
Value:
spi_transport_store_function(field, format_string) \
show_spi_transport_##field, \
store_spi_transport_##field);

Definition at line 362 of file scsi_transport_spi.c.

#define spi_transport_show_function (   field,
  format_string 
)
Value:
\
static ssize_t \
show_spi_transport_##field(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \
struct spi_internal *i = to_spi_internal(shost->transportt); \
tp = (struct spi_transport_attrs *)&starget->starget_data; \
if (i->f->get_##field) \
i->f->get_##field(starget); \
return snprintf(buf, 20, format_string, tp->field); \
}

Definition at line 306 of file scsi_transport_spi.c.

#define spi_transport_show_simple (   field,
  format_string 
)
Value:
\
static ssize_t \
show_spi_transport_##field(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
\
tp = (struct spi_transport_attrs *)&starget->starget_data; \
return snprintf(buf, 20, format_string, tp->field); \
}

Definition at line 276 of file scsi_transport_spi.c.

#define spi_transport_simple_attr (   field,
  format_string 
)
Value:
spi_transport_store_simple(field, format_string) \
show_spi_transport_##field, \
store_spi_transport_##field);

Definition at line 369 of file scsi_transport_spi.c.

#define spi_transport_store_function (   field,
  format_string 
)
Value:
static ssize_t \
store_spi_transport_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
int val; \
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \
struct spi_internal *i = to_spi_internal(shost->transportt); \
if (!i->f->set_##field) \
return -EINVAL; \
val = simple_strtoul(buf, NULL, 0); \
i->f->set_##field(starget, val); \
return count; \
}

Definition at line 322 of file scsi_transport_spi.c.

#define spi_transport_store_max (   field,
  format_string 
)
Value:
static ssize_t \
store_spi_transport_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
int val; \
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \
struct spi_internal *i = to_spi_internal(shost->transportt); \
= (struct spi_transport_attrs *)&starget->starget_data; \
\
if (i->f->set_##field) \
return -EINVAL; \
val = simple_strtoul(buf, NULL, 0); \
if (val > tp->max_##field) \
val = tp->max_##field; \
i->f->set_##field(starget, val); \
return count; \
}

Definition at line 340 of file scsi_transport_spi.c.

#define spi_transport_store_simple (   field,
  format_string 
)
Value:
\
static ssize_t \
store_spi_transport_##field(struct device *dev, \
const char *buf, size_t count) \
{ \
int val; \
\
tp = (struct spi_transport_attrs *)&starget->starget_data; \
val = simple_strtoul(buf, NULL, 0); \
tp->field = val; \
return count; \
}

Definition at line 289 of file scsi_transport_spi.c.

#define TARGET_ATTRIBUTE_HELPER (   name)
Value:
(si->f->show_##name ? S_IRUGO : 0) | \
(si->f->set_##name ? S_IWUSR : 0)

Definition at line 1431 of file scsi_transport_spi.c.

#define to_spi_internal (   tmpl)    container_of(tmpl, struct spi_internal, t)

Definition at line 73 of file scsi_transport_spi.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
SPI_BLIST_NOIUS 

Definition at line 49 of file scsi_transport_spi.c.

Enumerator:
SPI_COMPARE_SUCCESS 
SPI_COMPARE_FAILURE 
SPI_COMPARE_SKIP_TEST 

Definition at line 624 of file scsi_transport_spi.c.

Function Documentation

EXPORT_SYMBOL ( spi_dv_device  )
EXPORT_SYMBOL ( spi_schedule_dv_device  )
EXPORT_SYMBOL ( spi_display_xfer_agreement  )
EXPORT_SYMBOL ( spi_print_msg  )
EXPORT_SYMBOL ( spi_attach_transport  )
EXPORT_SYMBOL ( spi_release_transport  )
EXPORT_SYMBOL_GPL ( spi_populate_width_msg  )
EXPORT_SYMBOL_GPL ( spi_populate_sync_msg  )
EXPORT_SYMBOL_GPL ( spi_populate_ppr_msg  )
MODULE_AUTHOR ( "Martin Hicks"  )
MODULE_DESCRIPTION ( "SPI Transport Attributes )
module_exit ( spi_transport_exit  )
module_init ( spi_transport_init  )
MODULE_LICENSE ( "GPL"  )
struct scsi_transport_template* spi_attach_transport ( struct spi_function_template ft)
read

Definition at line 1536 of file scsi_transport_spi.c.

void spi_display_xfer_agreement ( struct scsi_target starget)

spi_display_xfer_agreement - Print the current target transfer agreement : The target for which to display the agreement

Each SPI port is required to maintain a transfer agreement for each other port on the bus. This function prints a one-line summary of the current agreement; more detailed information is available in sysfs.

Definition at line 1118 of file scsi_transport_spi.c.

void spi_dv_device ( struct scsi_device sdev)

spi_dv_device - Do Domain Validation on the device : scsi device to validate

Performs the domain validation on the given device in the current execution thread. Since DV operations may sleep, the current thread must have user context. Also no SCSI related locks that would deadlock I/O issued by the DV may be held.

Definition at line 1005 of file scsi_transport_spi.c.

int spi_populate_ppr_msg ( unsigned char msg,
int  period,
int  offset,
int  width,
int  options 
)

Definition at line 1193 of file scsi_transport_spi.c.

int spi_populate_sync_msg ( unsigned char msg,
int  period,
int  offset 
)

Definition at line 1182 of file scsi_transport_spi.c.

int spi_populate_width_msg ( unsigned char msg,
int  width 
)

Definition at line 1172 of file scsi_transport_spi.c.

int spi_print_msg ( const unsigned char msg)

Definition at line 1316 of file scsi_transport_spi.c.

void spi_release_transport ( struct scsi_transport_template t)

Definition at line 1560 of file scsi_transport_spi.c.

void spi_schedule_dv_device ( struct scsi_device sdev)

spi_schedule_dv_device - schedule domain validation to occur on the device : The device to validate

Identical to spi_dv_device() above, except that the DV will be scheduled to occur in a workqueue later. All memory allocations are atomic, so may be called from any context including those holding SCSI locks.

Definition at line 1083 of file scsi_transport_spi.c.

spi_transport_max_attr ( offset  ,
"%d\n"   
)
spi_transport_max_attr ( width  ,
"%d\n"   
)
spi_transport_max_attr ( iu  ,
"%d\n"   
)
spi_transport_max_attr ( qas  ,
"%d\n"   
)
spi_transport_rd_attr ( dt  ,
"%d\n"   
)
spi_transport_rd_attr ( wr_flow  ,
"%d\n"   
)
spi_transport_rd_attr ( rd_strm  ,
"%d\n"   
)
spi_transport_rd_attr ( rti  ,
"%d\n"   
)
spi_transport_rd_attr ( pcomp_en  ,
"%d\n"   
)
spi_transport_rd_attr ( hold_mcs  ,
"%d\n"   
)

Variable Documentation

unsigned flags

Definition at line 57 of file scsi_transport_spi.c.

char* model

Definition at line 56 of file scsi_transport_spi.c.

char* name

Definition at line 148 of file scsi_transport_spi.c.

enum spi_signal_type value

Definition at line 147 of file scsi_transport_spi.c.

Definition at line 55 of file scsi_transport_spi.c.