summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_spi.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2005-12-15 16:22:01 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-12-15 18:42:39 -0800
commitef72582e7a02e1069c6e6bf5eecf6f388b1467c6 (patch)
treeaf53892d987f11d8bc0cec3674daf2f564290e93 /drivers/scsi/scsi_transport_spi.c
parentb32aaffcdc694650d299a59501c5b3e267fca343 (diff)
downloadop-kernel-dev-ef72582e7a02e1069c6e6bf5eecf6f388b1467c6.zip
op-kernel-dev-ef72582e7a02e1069c6e6bf5eecf6f388b1467c6.tar.gz
[SCSI] Add PPR support to spi_print_msg
Introduce a new helper, print_nego() to handle SDTR/WDTR/PPR. Split out the guts of show_spi_transport_period_helper() into period_to_str() and use it in print_nego to get the period factor conversion right. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_spi.c')
-rw-r--r--drivers/scsi/scsi_transport_spi.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 380e167..46da6fe 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -379,9 +379,7 @@ static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate);
/* Translate the period into ns according to the current spec
* for SDTR/PPR messages */
-static ssize_t
-show_spi_transport_period_helper(struct class_device *cdev, char *buf,
- int period)
+static int period_to_str(char *buf, int period)
{
int len, picosec;
@@ -399,6 +397,14 @@ show_spi_transport_period_helper(struct class_device *cdev, char *buf,
len = sprint_frac(buf, picosec, 1000);
}
+ return len;
+}
+
+static ssize_t
+show_spi_transport_period_helper(struct class_device *cdev, char *buf,
+ int period)
+{
+ int len = period_to_str(buf, period);
buf[len++] = '\n';
buf[len] = '\0';
return len;
@@ -1065,9 +1071,23 @@ static const char * const two_byte_msgs[] = {
static const char * const extended_msgs[] = {
/* 0x00 */ "Modify Data Pointer", "Synchronous Data Transfer Request",
-/* 0x02 */ "SCSI-I Extended Identify", "Wide Data Transfer Request"
+/* 0x02 */ "SCSI-I Extended Identify", "Wide Data Transfer Request",
+/* 0x04 */ "Parallel Protocol Request"
};
+void print_nego(const unsigned char *msg, int per, int off, int width)
+{
+ if (per) {
+ char buf[20];
+ period_to_str(buf, msg[per]);
+ printk("period = %s ns ", buf);
+ }
+
+ if (off)
+ printk("offset = %d ", msg[off]);
+ if (width)
+ printk("width = %d ", 8 << msg[width]);
+}
int spi_print_msg(const unsigned char *msg)
{
@@ -1085,11 +1105,13 @@ int spi_print_msg(const unsigned char *msg)
(msg[4] << 16) | (msg[5] << 8) | msg[6]);
break;
case EXTENDED_SDTR:
- printk("period = %d ns, offset = %d",
- (int) msg[3] * 4, (int) msg[4]);
+ print_nego(msg, 3, 4, 0);
break;
case EXTENDED_WDTR:
- printk("width = 2^%d bytes", msg[3]);
+ print_nego(msg, 0, 0, 3);
+ break;
+ case EXTENDED_PPR:
+ print_nego(msg, 3, 5, 6);
break;
default:
for (i = 2; i < len; ++i)
OpenPOWER on IntegriCloud