Commit 633b47cb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "A single fix for libata: older devices don't support command duration
  limits (CDL) and some don't support report opcodes, meaning there's no
  way to tell if they support the command or not.

  Reduce the problems of incorrectly using CDL commands on older devices
  by checking SCSI spec compliance at SPC-5 (the spec which introduced
  the command) before turning on CDL"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: core: ata: Do no try to probe for CDL on old drives
parents b6cd1705 2132df16
...@@ -1835,6 +1835,9 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) ...@@ -1835,6 +1835,9 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
hdr[2] = 0x7; /* claim SPC-5 version compatibility */ hdr[2] = 0x7; /* claim SPC-5 version compatibility */
} }
if (args->dev->flags & ATA_DFLAG_CDL)
hdr[2] = 0xd; /* claim SPC-6 version compatibility */
memcpy(rbuf, hdr, sizeof(hdr)); memcpy(rbuf, hdr, sizeof(hdr));
memcpy(&rbuf[8], "ATA ", 8); memcpy(&rbuf[8], "ATA ", 8);
ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
......
...@@ -613,6 +613,17 @@ void scsi_cdl_check(struct scsi_device *sdev) ...@@ -613,6 +613,17 @@ void scsi_cdl_check(struct scsi_device *sdev)
bool cdl_supported; bool cdl_supported;
unsigned char *buf; unsigned char *buf;
/*
* Support for CDL was defined in SPC-5. Ignore devices reporting an
* lower SPC version. This also avoids problems with old drives choking
* on MAINTENANCE_IN / MI_REPORT_SUPPORTED_OPERATION_CODES with a
* service action specified, as done in scsi_cdl_check_cmd().
*/
if (sdev->scsi_level < SCSI_SPC_5) {
sdev->cdl_supported = 0;
return;
}
buf = kmalloc(SCSI_CDL_CHECK_BUF_LEN, GFP_KERNEL); buf = kmalloc(SCSI_CDL_CHECK_BUF_LEN, GFP_KERNEL);
if (!buf) { if (!buf) {
sdev->cdl_supported = 0; sdev->cdl_supported = 0;
......
...@@ -822,7 +822,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, ...@@ -822,7 +822,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
* device is attached at LUN 0 (SCSI_SCAN_TARGET_PRESENT) so * device is attached at LUN 0 (SCSI_SCAN_TARGET_PRESENT) so
* non-zero LUNs can be scanned. * non-zero LUNs can be scanned.
*/ */
sdev->scsi_level = inq_result[2] & 0x07; sdev->scsi_level = inq_result[2] & 0x0f;
if (sdev->scsi_level >= 2 || if (sdev->scsi_level >= 2 ||
(sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1)) (sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1))
sdev->scsi_level++; sdev->scsi_level++;
......
...@@ -157,6 +157,9 @@ enum scsi_disposition { ...@@ -157,6 +157,9 @@ enum scsi_disposition {
#define SCSI_3 4 /* SPC */ #define SCSI_3 4 /* SPC */
#define SCSI_SPC_2 5 #define SCSI_SPC_2 5
#define SCSI_SPC_3 6 #define SCSI_SPC_3 6
#define SCSI_SPC_4 7
#define SCSI_SPC_5 8
#define SCSI_SPC_6 14
/* /*
* INQ PERIPHERAL QUALIFIERS * INQ PERIPHERAL QUALIFIERS
......
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