public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] add device_configure to the transport classes
Date: 05 Oct 2004 11:11:01 -0500	[thread overview]
Message-ID: <1096992666.1765.39.camel@mulgrave> (raw)

The idea here is to have a callback that's invoked after inquiry is
complete so that the transport class can pick fields it's interested in
out of the inquiry data.  The hope would be to have some of those fields
that are currently scsi_device flags go away.

This is against the scsi-target-2.6 tree

James

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/10/05 11:05:24-05:00 jejb@pashleys.(none) 
#   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: James Bottomley <James.Bottomley@SteelEye.com>
# 
# include/scsi/scsi_transport_spi.h
#   2004/10/05 11:05:12-05:00 jejb@pashleys.(none) +17 -0
#   add device_configure to the transport classes
# 
# include/scsi/scsi_transport.h
#   2004/10/05 11:05:12-05:00 jejb@pashleys.(none) +1 -0
#   add device_configure to the transport classes
# 
# drivers/scsi/scsi_transport_spi.c
#   2004/10/05 11:05:12-05:00 jejb@pashleys.(none) +18 -0
#   add device_configure to the transport classes
# 
# drivers/scsi/scsi_scan.c
#   2004/10/05 11:05:12-05:00 jejb@pashleys.(none) +4 -1
#   add device_configure to the transport classes
# 
diff -Nru a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
--- a/drivers/scsi/scsi_scan.c	2004-10-05 11:08:24 -05:00
+++ b/drivers/scsi/scsi_scan.c	2004-10-05 11:08:24 -05:00
@@ -613,7 +613,10 @@
 	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);
 
 	/*
diff -Nru a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
--- a/drivers/scsi/scsi_transport_spi.c	2004-10-05 11:08:24 -05:00
+++ b/drivers/scsi/scsi_transport_spi.c	2004-10-05 11:08:24 -05:00
@@ -150,6 +150,23 @@
 	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 @@
 	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;
diff -Nru a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
--- a/include/scsi/scsi_transport.h	2004-10-05 11:08:24 -05:00
+++ b/include/scsi/scsi_transport.h	2004-10-05 11:08:24 -05:00
@@ -36,6 +36,7 @@
 
 	/* 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 *);
 
diff -Nru a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
--- a/include/scsi/scsi_transport_spi.h	2004-10-05 11:08:24 -05:00
+++ b/include/scsi/scsi_transport_spi.h	2004-10-05 11:08:24 -05:00
@@ -37,6 +37,13 @@
 	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,8 +72,18 @@
 #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 {


             reply	other threads:[~2004-10-05 16:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-05 16:11 James Bottomley [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-10-05 17:10 [PATCH] add device_configure to the transport classes Martin Peschke3
2004-10-05 17:18 ` James Bottomley
2004-10-06  4:59   ` Douglas Gilbert
2004-10-06 15:22     ` Matthew Wilcox
2004-10-06 16:29 Martin Peschke3
2004-10-06 21:48 ` Luben Tuikov
2004-10-06 16:52 Martin Peschke3

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1096992666.1765.39.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox