Bug 62811 - [PATCH]Don't Modify the scsi subcmd as LUN value when using VENDOR cmd
Summary: [PATCH]Don't Modify the scsi subcmd as LUN value when using VENDOR cmd
Status: NEW
Alias: None
Product: SCSI Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: scsi_drivers-other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-10 17:22 UTC by liyi
Modified: 2013-11-13 13:39 UTC (History)
1 user (show)

See Also:
Kernel Version: 3.12rc4
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description liyi 2013-10-10 17:22:11 UTC
Using the VENDOR scsi cmd, We should not to modify the cmd->cmnd [1] as lun value. it is useful as a subcmd for USB device, such as STEC usb device.

 Signed-off-by: Yi Li <yilikernel@gmail.com>

--- linux/drivers/scsi/scsi.c_orig 2013-09-12 01:51:45.000000000 -0400
+++ linux/drivers/scsi/scsi.c 2013-09-12 01:59:24.000000000 -0400
@@ -83,6 +83,9 @@ static void scsi_done(struct scsi_cmnd *
 /* Do not call reset on error if we just did a reset within 15 sec. */
 #define MIN_RESET_PERIOD (15*HZ)

+/* Define a SCSI command VENDOR to get device info For STEC USB devcie */
+#define STECUSB_VENDOR_CMD_CODE 0xD8
+
 /*
 * Note - the initial logging level can be set here to log events at boot time.
 * After the system is up, you may enable logging via the /proc interface.
@@ -700,8 +703,13 @@ int scsi_dispatch_cmd(struct scsi_cmnd *
 */
 if (cmd->device->scsi_level <= SCSI_2 &&
 cmd->device->scsi_level != SCSI_UNKNOWN) {
 - cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
- (cmd->device->lun << 5 & 0xe0);
+ /*
+ * Don't Modify the cmnd[1] as LUN value when it is a VENDOR CMD
+ * for STEC disk.
 + */
+ if (STECUSB_VENDOR_CMD_CODE != cmd->cmnd[0])
+ cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
+ (cmd->device->lun << 5 & 0xe0);
 }

 /*
Comment 1 Alan 2013-11-13 13:39:35 UTC
We do not accept patches via bugzilla. Patches need to be submitted as per Documentation/SubmittingPatches.

Alan

Note You need to log in before you can comment on or make changes to this bug.