summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/scsi/impl/commands.h
diff options
context:
space:
mode:
authorpd144616 <none@none>2006-06-08 09:55:15 -0700
committerpd144616 <none@none>2006-06-08 09:55:15 -0700
commit5c46c6a053defc1bf25f2e08df2653bc7717ed0b (patch)
treecf9db9b9eb65fc1c5c0ce41c091eb197838a3ee4 /usr/src/uts/common/sys/scsi/impl/commands.h
parentbe653f2ebb94b16135c96dea55b464d5c1480bd7 (diff)
downloadillumos-gate-5c46c6a053defc1bf25f2e08df2653bc7717ed0b.tar.gz
PSARC 2006/126 SCSA needs format-neutral method for accessing sense data
6312929 scsi_vu_errmsg doesn't handle descriptor sense data 6314069 sd needs to reissue MODE_SELECT upon receiving UNIT ATTENTION 6320349 Descriptor sense enabled for >1TB devices (should be 2TB)
Diffstat (limited to 'usr/src/uts/common/sys/scsi/impl/commands.h')
-rw-r--r--usr/src/uts/common/sys/scsi/impl/commands.h60
1 files changed, 56 insertions, 4 deletions
diff --git a/usr/src/uts/common/sys/scsi/impl/commands.h b/usr/src/uts/common/sys/scsi/impl/commands.h
index e9c1e35eb5..91ea8e6233 100644
--- a/usr/src/uts/common/sys/scsi/impl/commands.h
+++ b/usr/src/uts/common/sys/scsi/impl/commands.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -276,6 +275,59 @@ union scsi_cdb { /* scsi command description block */
*/
/*
+ * defines for getting/setting fields in data received from or destined for
+ * a SCSI device. These macros are necessary (in place of BE16/BE32/BE64)
+ * because the address to be read or written may not be on a proper alignment.
+ */
+
+#define SCSI_READ16(Sr16_Addr) \
+ (((uint16_t)*((uint8_t *)(Sr16_Addr)) << 8) | \
+ ((uint16_t)*((uint8_t *)((Sr16_Addr)+1))))
+
+#define SCSI_READ32(Sr32_Addr) \
+ (((uint32_t)*((uint8_t *)(Sr32_Addr)) << 24) | \
+ ((uint32_t)*((uint8_t *)((Sr32_Addr)+1)) << 16) | \
+ ((uint32_t)*((uint8_t *)((Sr32_Addr)+2)) << 8) | \
+ ((uint32_t)*((uint8_t *)((Sr32_Addr)+3))))
+
+#define SCSI_READ64(Sr64_Addr) \
+ (((uint64_t)*((uint8_t *)(Sr64_Addr)) << 56) | \
+ ((uint64_t)*((uint8_t *)((Sr64_Addr)+1)) << 48) | \
+ ((uint64_t)*((uint8_t *)((Sr64_Addr)+2)) << 40) | \
+ ((uint64_t)*((uint8_t *)((Sr64_Addr)+3)) << 32) | \
+ ((uint64_t)*((uint8_t *)((Sr64_Addr)+4)) << 24) | \
+ ((uint64_t)*((uint8_t *)((Sr64_Addr)+5)) << 16) | \
+ ((uint64_t)*((uint8_t *)((Sr64_Addr)+6)) << 8) | \
+ ((uint64_t)*((uint8_t *)((Sr64_Addr)+7))))
+
+#define SCSI_WRITE16(Sr16_Addr, Sr16_Val) \
+ *((uint8_t *)(Sr16_Addr)) = (((uint16_t)(Sr16_Val) >> 8) & 0xff); \
+ *(((uint8_t *)(Sr16_Addr))+1) = ((uint16_t)(Sr16_Val) & 0xff);
+
+#define SCSI_WRITE32(Sr32_Addr, Sr32_Val) \
+ *(uint8_t *)(Sr32_Addr) = (((uint32_t)(Sr32_Val) >> 24) & 0xff); \
+ *(((uint8_t *)(Sr32_Addr))+1) = \
+ (((uint32_t)(Sr32_Val) >> 16) & 0xff); \
+ *(((uint8_t *)(Sr32_Addr))+2) = (((uint32_t)(Sr32_Val) >> 8) & 0xff); \
+ *(((uint8_t *)(Sr32_Addr))+3) = (((uint32_t)(Sr32_Val)) & 0xff);
+
+#define SCSI_WRITE64(Sr64_Addr, Sr64_Val) \
+ *(uint8_t *)(Sr64_Addr) = (((uint64_t)(Sr64_Val) >> 56) & 0xff); \
+ *(((uint8_t *)(Sr64_Addr))+1) = \
+ (((uint64_t)(Sr64_Val) >> 48) & 0xff); \
+ *(((uint8_t *)(Sr64_Addr))+2) = \
+ (((uint64_t)(Sr64_Val) >> 40) & 0xff); \
+ *(((uint8_t *)(Sr64_Addr))+3) = \
+ (((uint64_t)(Sr64_Val) >> 32) & 0xff); \
+ *(((uint8_t *)(Sr64_Addr))+4) = \
+ (((uint64_t)(Sr64_Val) >> 24) & 0xff); \
+ *(((uint8_t *)(Sr64_Addr))+5) = \
+ (((uint64_t)(Sr64_Val) >> 16) & 0xff); \
+ *(((uint8_t *)(Sr64_Addr))+6) = \
+ (((uint64_t)(Sr64_Val) >> 8) & 0xff); \
+ *(((uint8_t *)(Sr64_Addr))+7) = (((uint64_t)(Sr64_Val)) & 0xff);
+
+/*
* defines for getting/setting fields within the various command groups
*/