]> err.no Git - linux-2.6/commitdiff
[SCSI] scsi_lib: fix recognition of cache type of Initio SBP-2 bridges
authorAl Viro <viro@ftp.linux.org.uk>
Thu, 23 Feb 2006 01:03:16 +0000 (02:03 +0100)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Tue, 28 Feb 2006 05:31:07 +0000 (23:31 -0600)
Regardless what mode page was asked for, Initio INIC-14x0 and
INIC-2430 always return page 6 without mode page headers.  Try to
recognise this as a special case in scsi_mode_sense and setting the
mode sense headers accordingly.

Signed-off-by: Al Viro <viro@ftp.linux.org.uk>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_lib.c
drivers/scsi/sd.c

index 1fe4fd83e3051c546242a6f8bbffe0ef6ad4238e..eab303d148d8b8d9d8252c2fffcd6517ee5a0504 100644 (file)
@@ -1892,8 +1892,16 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
        }
 
        if(scsi_status_is_good(result)) {
-               data->header_length = header_length;
-               if(use_10_for_ms) {
+               if (unlikely(buffer[0] == 0x86 && buffer[1] == 0x0b &&
+                            (modepage == 6 || modepage == 8))) {
+                       /* Initio breakage? */
+                       header_length = 0;
+                       data->length = 13;
+                       data->medium_type = 0;
+                       data->device_specific = 0;
+                       data->longlba = 0;
+                       data->block_descriptor_length = 0;
+               } else if(use_10_for_ms) {
                        data->length = buffer[0]*256 + buffer[1] + 2;
                        data->medium_type = buffer[2];
                        data->device_specific = buffer[3];
@@ -1906,6 +1914,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
                        data->device_specific = buffer[2];
                        data->block_descriptor_length = buffer[3];
                }
+               data->header_length = header_length;
        }
 
        return result;
index 76b4d14c0b3f489af353d729876f31a0b0600ad7..31c9685ebc5a15c520d55105f47110763c28857a 100644 (file)
@@ -1333,6 +1333,12 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
        if (!scsi_status_is_good(res))
                goto bad_sense;
 
+       if (!data.header_length) {
+               modepage = 6;
+               printk(KERN_ERR "%s: missing header in MODE_SENSE response\n",
+                      diskname);
+       }
+
        /* that went OK, now ask for the proper length */
        len = data.length;