scsi: force well-known logical unit type

Some well-known Logical Units (LUs) might not specify the correct
peripheral device type in the inquiry response which leads to binding
with other drivers like scsi disk drivers and hence cause delays
during device detection as most of the initialization commands fail.

Since such well-known LUs are known only to respond to special commands
force the type to 0x1e (well-known logical unit type) so that respective
type drivers will handle them.

Change-Id: Iaf85eedba8c214cdcf32d207e4913cb72eef53f4
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
This commit is contained in:
Sujit Reddy Thumma 2013-10-08 21:45:48 -07:00
parent 01364e1649
commit 5d0b9e8282
2 changed files with 10 additions and 0 deletions

View File

@ -780,6 +780,14 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
} else {
sdev->type = (inq_result[0] & 0x1f);
sdev->removable = (inq_result[1] & 0x80) >> 7;
/*
* some devices may respond with wrong type for
* well-known logical units. Force well-known type
* to enumerate them correctly.
*/
if (scsi_is_wlun(sdev->lun) && (sdev->type != TYPE_WLUN))
sdev->type = TYPE_WLUN;
}
switch (sdev->type) {
@ -795,6 +803,7 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
case TYPE_COMM:
case TYPE_RAID:
case TYPE_OSD:
case TYPE_WLUN:
sdev->writeable = 1;
break;
case TYPE_ROM:

View File

@ -326,6 +326,7 @@ static inline int scsi_status_is_good(int status)
#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
#define TYPE_RBC 0x0e
#define TYPE_OSD 0x11
#define TYPE_WLUN 0x1e /* well-known logical unit */
#define TYPE_NO_LUN 0x7f
/* SCSI protocols; these are taken from SPC-3 section 7.5 */