summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1997-09-11 21:05:23 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1997-09-11 21:05:23 +0000
commit90e261b53ad285d4042ba006c657c3868b3fffe4 (patch)
tree134543fa6f17947722835a02bbe395790e2f295e /sys/scsi
parent52759134e40d2ef6a826ca359ca35114097ea751 (diff)
Fix setting up of the LUN field of the CDB
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsi_base.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 1d832cfd719..5986bc6577b 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.18 1997/09/05 05:56:49 millert Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.19 1997/09/11 21:05:22 niklas Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -176,12 +176,17 @@ scsi_make_xs(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
xs->bp = bp;
/*
- * Set the LUN in the CDB if we have an older device. We also
- * set it for more modern SCSI-II devices "just in case".
+ * Set the LUN in the CDB. This may only be needed if we have an
+ * older device. However, we also set it for more modern SCSI
+ * devices "just in case". The old code assumed everything newer
+ * than SCSI-2 would not need it, but why risk it? This was the
+ * old conditional:
+ *
+ * if ((sc_link->scsi_version & SID_ANSII) <= 2)
*/
- if ((sc_link->scsi_version & SID_ANSII) <= 2)
- xs->cmd->bytes[0] |=
- ((sc_link->lun << SCSI_CMD_LUN_SHIFT) & SCSI_CMD_LUN_MASK);
+ xs->cmd->bytes[0] &= ~SCSI_CMD_LUN_MASK;
+ xs->cmd->bytes[0] |=
+ ((sc_link->lun << SCSI_CMD_LUN_SHIFT) & SCSI_CMD_LUN_MASK);
return xs;
}