Commit 2e4420fa authored by Patrick Mansfield's avatar Patrick Mansfield Committed by James Bottomley

[PATCH] Add 192 byte MODE SENSE flag

Add a BLIST_MS_192_BYTES_FOR_3F flag. If it is set, sends a 192 byte MODE
SENSE in sd.c.
parent 2160d142
...@@ -647,6 +647,9 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) ...@@ -647,6 +647,9 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
* may do I/O */ * may do I/O */
scsi_device_set_state(sdev, SDEV_RUNNING); scsi_device_set_state(sdev, SDEV_RUNNING);
if (*bflags & BLIST_MS_192_BYTES_FOR_3F)
sdev->use_192_bytes_for_3f = 1;
if(sdev->host->hostt->slave_configure) if(sdev->host->hostt->slave_configure)
sdev->host->hostt->slave_configure(sdev); sdev->host->hostt->slave_configure(sdev);
......
...@@ -1122,6 +1122,9 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, ...@@ -1122,6 +1122,9 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
return; return;
} }
if (sdkp->device->use_192_bytes_for_3f) {
res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 192, &data);
} else {
/* /*
* First attempt: ask for all pages (0x3F), but only 4 bytes. * First attempt: ask for all pages (0x3F), but only 4 bytes.
* We have to start carefully: some devices hang if we ask * We have to start carefully: some devices hang if we ask
...@@ -1130,9 +1133,10 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, ...@@ -1130,9 +1133,10 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 4, &data); res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 4, &data);
/* /*
* Second attempt: ask for page 0 * Second attempt: ask for page 0 When only page 0 is
* When only page 0 is implemented, a request for page 3F may return * implemented, a request for page 3F may return Sense Key
* Sense Key 5: Illegal Request, Sense Code 24: Invalid field in CDB. * 5: Illegal Request, Sense Code 24: Invalid field in
* CDB.
*/ */
if (!scsi_status_is_good(res)) if (!scsi_status_is_good(res))
res = sd_do_mode_sense(SRpnt, 0, 0, buffer, 4, &data); res = sd_do_mode_sense(SRpnt, 0, 0, buffer, 4, &data);
...@@ -1141,7 +1145,9 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, ...@@ -1141,7 +1145,9 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname,
* Third attempt: ask 255 bytes, as we did earlier. * Third attempt: ask 255 bytes, as we did earlier.
*/ */
if (!scsi_status_is_good(res)) if (!scsi_status_is_good(res))
res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 255, &data); res = sd_do_mode_sense(SRpnt, 0, 0x3F, buffer, 255,
&data);
}
if (!scsi_status_is_good(res)) { if (!scsi_status_is_good(res)) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -100,6 +100,7 @@ struct scsi_device { ...@@ -100,6 +100,7 @@ struct scsi_device {
unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */
unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */
unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
unsigned no_start_on_add:1; /* do not issue start on add */ unsigned no_start_on_add:1; /* do not issue start on add */
unsigned allow_restart:1; /* issue START_UNIT in error handler */ unsigned allow_restart:1; /* issue START_UNIT in error handler */
......
...@@ -19,4 +19,5 @@ ...@@ -19,4 +19,5 @@
#define BLIST_MS_SKIP_PAGE_08 0x2000 /* do not send ms page 0x08 */ #define BLIST_MS_SKIP_PAGE_08 0x2000 /* do not send ms page 0x08 */
#define BLIST_MS_SKIP_PAGE_3F 0x4000 /* do not send ms page 0x3f */ #define BLIST_MS_SKIP_PAGE_3F 0x4000 /* do not send ms page 0x3f */
#define BLIST_USE_10_BYTE_MS 0x8000 /* use 10 byte ms before 6 byte ms */ #define BLIST_USE_10_BYTE_MS 0x8000 /* use 10 byte ms before 6 byte ms */
#define BLIST_MS_192_BYTES_FOR_3F 0x10000 /* 192 byte ms page 0x3f request */
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment