Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Remove incorrect BIG_ENDIAN defines and substitut...
details: https://anonhg.NetBSD.org/src/rev/69d1148f1ba1
branches: trunk
changeset: 471529:69d1148f1ba1
user: mjacob <mjacob%NetBSD.org@localhost>
date: Sun Apr 04 01:32:44 1999 +0000
description:
Remove incorrect BIG_ENDIAN defines and substitute in the SBus only macros
that will SBusify an isp header or the lun/target portions of a request IOCB-
and have these only valid iff __sparc__ (no non-sparc SBus machine that *I*
know about).
diffstat:
sys/dev/ic/ispmbox.h | 170 +++++++++++++-------------------------------------
1 files changed, 44 insertions(+), 126 deletions(-)
diffs (truncated from 396 to 300 lines):
diff -r 49bf5bfc603e -r 69d1148f1ba1 sys/dev/ic/ispmbox.h
--- a/sys/dev/ic/ispmbox.h Sun Apr 04 01:27:06 1999 +0000
+++ b/sys/dev/ic/ispmbox.h Sun Apr 04 01:32:44 1999 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: ispmbox.h,v 1.15 1999/03/26 22:39:45 mjacob Exp $ */
-/* release_03_25_99 */
+/* $NetBSD: ispmbox.h,v 1.16 1999/04/04 01:32:44 mjacob Exp $ */
+/* release_4_3_99 */
/*
* Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
*
@@ -185,19 +185,34 @@
u_int32_t ds_count;
} ispds_t;
+#define _ISP_SWAP8(a, b) { \
+ u_int8_t tmp; \
+ tmp = a; \
+ a = b; \
+ b = tmp; \
+}
+
+/*
+ * These elements get swizzled around for SBus instances.
+ */
typedef struct {
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t rqs_entry_count;
- u_int8_t rqs_entry_type;
- u_int8_t rqs_flags;
- u_int8_t rqs_seqno;
-#else
u_int8_t rqs_entry_type;
u_int8_t rqs_entry_count;
u_int8_t rqs_seqno;
u_int8_t rqs_flags;
+} isphdr_t;
+/*
+ * There are no (for all intents and purposes) non-sparc SBus machines
+ */
+#ifdef __sparc__
+#define ISP_SBUSIFY_ISPHDR(isp, hdrp) \
+ if ((isp)->isp_bustype == ISP_BT_SBUS) { \
+ _ISP_SWAP8((hdrp)->rqs_entry_count, (hdrp)->rqs_entry_type); \
+ _ISP_SWAP8((hdrp)->rqs_flags, (hdrp)->rqs_seqno); \
+ }
+#else
+#define ISP_SBUSIFY_ISPHDR(a, b)
#endif
-} isphdr_t;
/* RQS Flag definitions */
#define RQSFLAG_CONTINUATION 0x01
@@ -237,13 +252,8 @@
typedef struct {
isphdr_t req_header;
u_int32_t req_handle;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t req_target;
- u_int8_t req_lun_trn;
-#else
u_int8_t req_lun_trn;
u_int8_t req_target;
-#endif
u_int16_t req_cdblen;
#define req_modifier req_cdblen /* marker packet */
u_int16_t req_flags;
@@ -254,17 +264,31 @@
ispds_t req_dataseg[ISP_RQDSEG];
} ispreq_t;
+/*
+ * A request packet can also be a marker packet.
+ */
+#define SYNC_DEVICE 0
+#define SYNC_TARGET 1
+#define SYNC_ALL 2
+
+/*
+ * There are no (for all intents and purposes) non-sparc SBus machines
+ */
+#ifdef __sparc__
+#define ISP_SBUSIFY_ISPREQ(isp, rqp) \
+ if ((isp)->isp_bustype == ISP_BT_SBUS) { \
+ _ISP_SWAP8((rqp)->req_target, (rqp)->req_lun_trn); \
+ }
+#else
+#define ISP_SBUSIFY_ISPREQ(a, b)
+#endif
+
#define ISP_RQDSEG_T2 3
typedef struct {
isphdr_t req_header;
u_int32_t req_handle;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t req_target;
- u_int8_t req_lun_trn;
-#else
u_int8_t req_lun_trn;
u_int8_t req_target;
-#endif
u_int16_t req_scclun;
u_int16_t req_flags;
u_int16_t _res2;
@@ -299,13 +323,8 @@
typedef struct {
isphdr_t req_header;
u_int32_t req_handle;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t req_target;
- u_int8_t req_lun_trn;
-#else
u_int8_t req_lun_trn;
u_int8_t req_target;
-#endif
u_int16_t req_cdblen;
u_int16_t req_flags;
u_int16_t _res1;
@@ -323,26 +342,6 @@
typedef struct {
isphdr_t req_header;
- u_int32_t _res1;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t req_target;
- u_int8_t req_lun_trn;
- u_int8_t _res2;
- u_int8_t req_modifier;
-#else
- u_int8_t req_lun_trn;
- u_int8_t req_target;
- u_int8_t req_modifier;
- u_int8_t _res2;
-#endif
-} ispmarkreq_t;
-
-#define SYNC_DEVICE 0
-#define SYNC_TARGET 1
-#define SYNC_ALL 2
-
-typedef struct {
- isphdr_t req_header;
u_int32_t req_handle;
u_int16_t req_scsi_status;
u_int16_t req_completion_status;
@@ -439,33 +438,18 @@
* Version One format.
*/
typedef struct {
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t _reserved0;
- u_int8_t icb_version;
-#else
u_int8_t icb_version;
u_int8_t _reserved0;
-#endif
u_int16_t icb_fwoptions;
u_int16_t icb_maxfrmlen;
u_int16_t icb_maxalloc;
u_int16_t icb_execthrottle;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t icb_retry_delay;
- u_int8_t icb_retry_count;
-#else
u_int8_t icb_retry_count;
u_int8_t icb_retry_delay;
-#endif
u_int8_t icb_nodename[8];
u_int16_t icb_hardaddr;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t _reserved1;
- u_int8_t icb_iqdevtype;
-#else
u_int8_t icb_iqdevtype;
u_int8_t _reserved1;
-#endif
u_int8_t icb_portname[8];
u_int16_t icb_rqstout;
u_int16_t icb_rspnsin;
@@ -528,33 +512,17 @@
typedef struct {
u_int16_t pdb_options;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t pdb_sstate;
- u_int8_t pdb_mstate;
-#else
u_int8_t pdb_mstate;
u_int8_t pdb_sstate;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
-#define BITS2WORD(x) \
- (x)[1] << 16 | (x)[2] << 8 | (x)[3]
-#else
-#define BITS2WORD(x) \
- (x)[0] << 16 | (x)[3] << 8 | (x)[2]
-#endif
+#define BITS2WORD(x) (x)[0] << 16 | (x)[3] << 8 | (x)[2]
u_int8_t pdb_hardaddr_bits[4];
u_int8_t pdb_portid_bits[4];
u_int8_t pdb_nodename[8];
u_int8_t pdb_portname[8];
u_int16_t pdb_execthrottle;
u_int16_t pdb_exec_count;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t pdb_retry_delay;
- u_int8_t pdb_retry_count;
-#else
u_int8_t pdb_retry_count;
u_int8_t pdb_retry_delay;
-#endif
u_int16_t pdb_resalloc;
u_int16_t pdb_curalloc;
u_int16_t pdb_qhead;
@@ -564,13 +532,8 @@
u_int16_t pdb_features; /* PLOGI, Common Service */
u_int16_t pdb_pconcurrnt; /* PLOGI, Common Service */
u_int16_t pdb_roi; /* PLOGI, Common Service */
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t pdb_initiator; /* PLOGI, Class 3 Control Flags */
- u_int8_t pdb_target;
-#else
u_int8_t pdb_target;
u_int8_t pdb_initiator; /* PLOGI, Class 3 Control Flags */
-#endif
u_int16_t pdb_rdsiz; /* PLOGI, Class 3 */
u_int16_t pdb_ncseq; /* PLOGI, Class 3 */
u_int16_t pdb_noseq; /* PLOGI, Class 3 */
@@ -625,23 +588,17 @@
typedef struct {
isphdr_t le_header;
u_int32_t le_reserved2;
-#if BYTE_ORDER == BIG_ENDIAN
-#else
u_int8_t le_lun;
u_int8_t le_rsvd;
u_int8_t le_ops; /* Modify LUN only */
u_int8_t le_tgt; /* Not for FC */
-#endif
u_int32_t le_flags; /* Not for FC */
-#if BYTE_ORDER == BIG_ENDIAN
-#else
u_int8_t le_status;
u_int8_t le_rsvd2;
u_int8_t le_cmd_count;
u_int8_t le_in_count;
u_int8_t le_cdb6len; /* Not for FC */
u_int8_t le_cdb7len; /* Not for FC */
-#endif
u_int16_t le_timeout;
u_int16_t le_reserved[20];
} lun_entry_t;
@@ -677,21 +634,15 @@
typedef struct {
isphdr_t in_header;
u_int32_t in_reserved2;
-#if BYTE_ORDER == BIG_ENDIAN
-#else
u_int8_t in_lun; /* lun */
u_int8_t in_iid; /* initiator */
u_int8_t in_rsvd;
u_int8_t in_tgt; /* target */
-#endif
u_int32_t in_flags;
-#if BYTE_ORDER == BIG_ENDIAN
-#else
u_int8_t in_status;
u_int8_t in_rsvd2;
u_int8_t in_tag_val; /* tag value */
u_int8_t in_tag_type; /* tag type */
-#endif
u_int16_t in_seqid; /* sequence id */
u_int8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */
u_int16_t in_reserved[IN_RSVDLEN];
@@ -701,11 +652,8 @@
typedef struct {
isphdr_t in_header;
u_int32_t in_reserved2;
-#if BYTE_ORDER == BIG_ENDIAN
-#else
u_int8_t in_lun; /* lun */
u_int8_t in_iid; /* initiator */
-#endif
u_int16_t in_rsvd;
u_int32_t in_rsvd2;
u_int16_t in_status;
@@ -730,19 +678,13 @@
typedef struct {
isphdr_t na_header;
u_int32_t na_reserved2;
-#if BYTE_ORDER == BIG_ENDIAN
-#else
u_int8_t na_lun; /* lun */
u_int8_t na_iid; /* initiator */
u_int8_t na_rsvd;
u_int8_t na_tgt; /* target */
-#endif
u_int32_t na_flags;
-#if BYTE_ORDER == BIG_ENDIAN
-#else
Home |
Main Index |
Thread Index |
Old Index