Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d0b9e82 authored by Sujit Reddy Thumma's avatar Sujit Reddy Thumma
Browse files

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: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
parent 01364e16
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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:
+1 −0
Original line number Diff line number Diff line
@@ -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 */