]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[SCSI] Recognize missing LUNs for non-standard devices
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 9 Feb 2006 20:26:18 +0000 (15:26 -0500)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Tue, 28 Feb 2006 05:24:09 +0000 (23:24 -0600)
Some non-standard SCSI targets or protocols, such as USB UFI, report "no
LUN present" by setting the Peripheral Device Type to 0x1f and the
Peripheral Qualifier to 0 (not 3 as the standard requires) in the INQUIRY
response.  This patch (as650b) adds a new target flag and code to
accomodate such targets.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_scan.c
include/scsi/scsi_device.h

index 803c7b9690c5eae29318f92f1ce250f518a50821..94b86d5b14696d1303e716b3c723a4114f1b4f8d 100644 (file)
@@ -853,6 +853,19 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
                goto out_free_result;
        }
 
+       /*
+        * Non-standard SCSI targets may set the PDT to 0x1f (unknown or
+        * no device type) instead of using the Peripheral Qualifier to
+        * indicate that no LUN is present.  For example, USB UFI does this.
+        */
+       if (starget->pdt_1f_for_no_lun && (result[0] & 0x1f) == 0x1f) {
+               SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
+                                       "scsi scan: peripheral device type"
+                                       " of 31, no device added\n"));
+               res = SCSI_SCAN_TARGET_PRESENT;
+               goto out_free_result;
+       }
+
        res = scsi_add_lun(sdev, result, &bflags);
        if (res == SCSI_SCAN_LUN_PRESENT) {
                if (bflags & BLIST_KEY) {
index cde84b39bb6513bf8cd637e6c50d496fa02b9565..8d77da932d2c33cc1794ff69e9c13c8e93e6fa4b 100644 (file)
@@ -167,7 +167,10 @@ struct scsi_target {
        unsigned int            channel;
        unsigned int            id; /* target id ... replace
                                     * scsi_device.id eventually */
-       unsigned long           create:1; /* signal that it needs to be added */
+       unsigned int            create:1; /* signal that it needs to be added */
+       unsigned int            pdt_1f_for_no_lun;      /* PDT = 0x1f */
+                                               /* means no lun present */
+
        char                    scsi_level;
        void                    *hostdata; /* available to low-level driver */
        unsigned long           starget_data[0]; /* for the transport */