]> localhost Git - SCSI2SD-V6.git/commitdiff
Fix SCSI inquiry command with 0 byte allocation length
authorMichael McMaster <michael@codesrc.com>
Tue, 24 Jan 2017 10:23:29 +0000 (20:23 +1000)
committerMichael McMaster <michael@codesrc.com>
Tue, 24 Jan 2017 10:23:29 +0000 (20:23 +1000)
rtl/fpga_bitmap.o
src/firmware/inquiry.c
src/firmware/scsi.c
src/firmware/scsi.h

index c4ec7a4843862cb50b727468363ddda3c6401f05..6cbce7c58ef6b593e699f40565e37b8c6806855b 100644 (file)
Binary files a/rtl/fpga_bitmap.o and b/rtl/fpga_bitmap.o differ
index d51b3c0db198e7b0636ce223e1669cc5c14c18df..70dca308b86acd754647ed63cf431204d387a1f6 100755 (executable)
@@ -85,7 +85,11 @@ void s2s_scsiInquiry()
        uint32_t allocationLength = scsiDev.cdb[4];\r
 \r
        // SASI standard, X3T9.3_185_RevE  states that 0 == 256 bytes\r
-       if (allocationLength == 0) allocationLength = 256;\r
+       // BUT SCSI 2 standard says 0 == 0.\r
+       if (scsiDev.compatMode <= COMPAT_SCSI1) // excludes COMPAT_SCSI2_DISABLED\r
+       {\r
+               if (allocationLength == 0) allocationLength = 256;\r
+       }\r
 \r
        if (!evpd)\r
        {\r
@@ -210,6 +214,11 @@ uint32_t s2s_getStandardInquiry(
 \r
        memcpy(out, StandardResponse, buflen);\r
        out[1] = cfg->deviceTypeModifier;\r
+\r
+       if (scsiDev.compatMode >= COMPAT_SCSI2)\r
+       {\r
+               out[3] = 2; // SCSI 2 response format.\r
+       }\r
        memcpy(&out[8], cfg->vendor, sizeof(cfg->vendor));\r
        memcpy(&out[16], cfg->prodId, sizeof(cfg->prodId));\r
        memcpy(&out[32], cfg->revision, sizeof(cfg->revision));\r
index bf20f9df8a3e72f8660bc1a9339533d1b53e4654..0b9b8078d50fc5b667ff7374bf7255f0c99e1138 100755 (executable)
@@ -596,7 +596,7 @@ static void process_SelectionPhase()
                }\r
                else if (!(scsiDev.boardCfg.flags & S2S_CFG_ENABLE_SCSI2))\r
                {\r
-                       scsiDev.compatMode = COMPAT_SCSI1;\r
+                       scsiDev.compatMode = COMPAT_SCSI2_DISABLED;\r
                }\r
                else\r
                {\r
index 33f3c08506d4a087aee9387fd340d2762851554a..50724564e57cc086438fa4c77306e728c52ced53 100755 (executable)
@@ -63,6 +63,11 @@ typedef enum
 {
        COMPAT_UNKNOWN,
        COMPAT_SCSI1,
+
+       // Messages are being used, yet SCSI 2 mode is disabled.
+       // This impacts interpretation of INQUIRY commands.
+       COMPAT_SCSI2_DISABLED,
+
        COMPAT_SCSI2
 } SCSI_COMPAT_MODE;