Commit d54eece0 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

add device_configure to the transport classes

This allows attributes to be picked out of the INQUIRY fields and
placed into transport specific capability flags
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 39b1fd4c
......@@ -613,7 +613,10 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
if (*bflags & BLIST_NOT_LOCKABLE)
sdev->lockable = 0;
if(sdev->host->hostt->slave_configure)
if (sdev->host->transportt->device_configure)
sdev->host->transportt->device_configure(sdev);
if (sdev->host->hostt->slave_configure)
sdev->host->hostt->slave_configure(sdev);
/*
......
......@@ -150,6 +150,23 @@ static int spi_setup_host_attrs(struct Scsi_Host *shost)
return 0;
}
static int spi_configure_device(struct scsi_device *sdev)
{
struct scsi_target *starget = sdev->sdev_target;
/* Populate the target capability fields with the values
* gleaned from the device inquiry */
spi_support_sync(starget) = scsi_device_sync(sdev);
spi_support_wide(starget) = scsi_device_wide(sdev);
spi_support_dt(starget) = scsi_device_dt(sdev);
spi_support_dt_only(starget) = scsi_device_dt_only(sdev);
spi_support_ius(starget) = scsi_device_ius(sdev);
spi_support_qas(starget) = scsi_device_qas(sdev);
return 0;
}
static int spi_setup_transport_attrs(struct scsi_target *starget)
{
spi_period(starget) = -1; /* illegal value */
......@@ -783,6 +800,7 @@ spi_attach_transport(struct spi_function_template *ft)
i->t.target_attrs = &i->attrs[0];
i->t.target_class = &spi_transport_class;
i->t.target_setup = &spi_setup_transport_attrs;
i->t.device_configure = &spi_configure_device;
i->t.target_size = sizeof(struct spi_transport_attrs);
i->t.host_attrs = &i->host_attrs[0];
i->t.host_class = &spi_host_class;
......
......@@ -36,6 +36,7 @@ struct scsi_transport_template {
/* Constructor functions */
int (*device_setup)(struct scsi_device *);
int (*device_configure)(struct scsi_device *);
int (*target_setup)(struct scsi_target *);
int (*host_setup)(struct Scsi_Host *);
......
......@@ -37,6 +37,13 @@ struct spi_transport_attrs {
unsigned int pcomp_en:1;/* Precompensation enabled */
unsigned int initial_dv:1; /* DV done to this target yet */
unsigned long flags; /* flags field for drivers to use */
/* Device Properties fields */
unsigned int support_sync:1; /* synchronous support */
unsigned int support_wide:1; /* wide support */
unsigned int support_dt:1; /* allows DT phases */
unsigned int support_dt_only; /* disallows ST phases */
unsigned int support_ius; /* support Information Units */
unsigned int support_qas; /* supports quick arbitration and selection */
/* Private Fields */
unsigned int dv_pending:1; /* Internal flag */
struct semaphore dv_sem; /* semaphore to serialise dv */
......@@ -65,9 +72,19 @@ struct spi_host_attrs {
#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti)
#define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en)
#define spi_initial_dv(x) (((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv)
#define spi_support_sync(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_sync)
#define spi_support_wide(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_wide)
#define spi_support_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_dt)
#define spi_support_dt_only(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_dt_only)
#define spi_support_ius(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_ius)
#define spi_support_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_qas)
#define spi_flags(x) (((struct spi_transport_attrs *)&(x)->starget_data)->flags)
#define spi_signalling(h) (((struct spi_host_attrs *)&(h)->shost_data)->signalling)
/* The functions by which the transport class and the driver communicate */
struct spi_function_template {
void (*get_period)(struct scsi_target *);
......
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