From: Tony Battersby <tonyb@cybernetics.com>
To: linux-scsi@vger.kernel.org,
James Bottomley <James.Bottomley@SteelEye.com>
Subject: [PATCH] [SCSI] make SPI DV data pattern "d" match T10
Date: Fri, 25 Jan 2008 16:13:18 -0500 [thread overview]
Message-ID: <479A50EE.4020703@cybernetics.com> (raw)
The T10 SCSI domain validation draft sdv-r08b.pdf section 5.4 describes
data pattern "d" like this:
d) shifting bit (0000h, FFFEh, 0000h, FFFDh, ... then FFFFh, 0001h,
FFFFh, 0002h, ...)
The current code in scsi_transport_spi.c produces the following data
pattern:
FF FF 00 00 | FE FF 01 00 | FC FF 03 00 | F8 FF 07 00
F0 FF 0F 00 | E0 FF 1F 00 | C0 FF 3F 00 | 80 FF 7F 00
(other patterns here)
00 FF FF 00 | 00 FE FF 01 | 00 FC FF 03 | 00 F8 FF 07
00 F0 FF 0F | 00 E0 FF 1F | 00 C0 FF 3F | 00 80 FF 7F
(other patterns here)
00 00 FF FF | 01 00 FE FF | 03 00 FC FF | 07 00 F8 FF
0F 00 F0 FF | 1F 00 E0 FF | 3F 00 C0 FF | 7F 00 80 FF
(other patterns here)
FF 00 00 FF | FF 01 00 FE | FF 03 00 FC | FF 07 00 F8
FF 0F 00 F0 | FF 1F 00 E0 | FF 3F 00 C0 | FF 7F 00 80
This patch changes the data pattern to match sdv-r08b.pdf, like this:
00 00 FF FE | 00 00 FF FD | 00 00 FF FB | 00 00 FF F7
00 00 FF EF | 00 00 FF DF | 00 00 FF BF | 00 00 FF 7F
00 00 FE FF | 00 00 FD FF | 00 00 FB FF | 00 00 F7 FF
00 00 EF FF | 00 00 DF FF | 00 00 BF FF | 00 00 7F FF
FF FF 00 01 | FF FF 00 02 | FF FF 00 04 | FF FF 00 08
FF FF 00 10 | FF FF 00 20 | FF FF 00 40 | FF FF 00 80
FF FF 01 00 | FF FF 02 00 | FF FF 04 00 | FF FF 08 00
FF FF 10 00 | FF FF 20 00 | FF FF 40 00 | FF FF 80 00
This data pattern tests simultaneously turning on or off all bits but
one.
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---
--- linux-2.6.24/drivers/scsi/scsi_transport_spi.c.orig 2008-01-25 15:16:15.000000000 -0500
+++ linux-2.6.24/drivers/scsi/scsi_transport_spi.c 2008-01-25 15:30:20.000000000 -0500
@@ -559,7 +559,6 @@ spi_dv_device_echo_buffer(struct scsi_de
{
int len = ptr - buffer;
int j, k, r, result;
- unsigned int pattern = 0x0000ffff;
struct scsi_sense_hdr sshdr;
const char spi_write_buffer[] = {
@@ -594,12 +593,18 @@ spi_dv_device_echo_buffer(struct scsi_de
}
k = j;
/* fill with shifting bits (test d) */
- for ( ; j < min(len, k + 32); j += 4) {
- u32 *word = (unsigned int *)&buffer[j];
- u32 roll = (pattern & 0x80000000) ? 1 : 0;
-
- *word = pattern;
- pattern = (pattern << 1) | roll;
+ for ( ; j < min(len, k + 64); j += 4) {
+ u32 *word = (u32 *)&buffer[j];
+ int bit = (j - k) >> 2;
+
+ *word = cpu_to_be32(0x0000ffff & ~(1 << bit));
+ }
+ k = j;
+ for ( ; j < min(len, k + 64); j += 4) {
+ u32 *word = (u32 *)&buffer[j];
+ int bit = (j - k) >> 2;
+
+ *word = cpu_to_be32(0xffff0000 | (1 << bit));
}
/* don't bother with random data (test e) */
}
reply other threads:[~2008-01-25 21:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=479A50EE.4020703@cybernetics.com \
--to=tonyb@cybernetics.com \
--cc=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;
as well as URLs for NNTP newsgroup(s).