Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Make the bitfields in here work on big-endian mac...



details:   https://anonhg.NetBSD.org/src/rev/16888506874e
branches:  trunk
changeset: 479834:16888506874e
user:      wrstuden <wrstuden%NetBSD.org@localhost>
date:      Thu Dec 23 00:15:12 1999 +0000

description:
Make the bitfields in here work on big-endian machines. How this ever
worked is unclear.

Patch from thorpej, tested by me.

diffstat:

 sys/dev/ic/bhareg.h |  43 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 6 deletions(-)

diffs (92 lines):

diff -r e0ff386783e4 -r 16888506874e sys/dev/ic/bhareg.h
--- a/sys/dev/ic/bhareg.h       Wed Dec 22 23:54:09 1999 +0000
+++ b/sys/dev/ic/bhareg.h       Thu Dec 23 00:15:12 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bhareg.h,v 1.13 1999/09/30 23:12:29 thorpej Exp $      */
+/*     $NetBSD: bhareg.h,v 1.14 1999/12/23 00:15:12 wrstuden Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -191,11 +191,19 @@
 
 struct bha_ccb {
        u_int8_t        opcode;
+#if BYTE_ORDER == LITTLE_ENDIAN
        u_int8_t                                :3,
                        data_in                 :1,
                        data_out                :1,
                        wide_tag_enable         :1, /* Wide Lun CCB format */
                        wide_tag_type           :2; /* Wide Lun CCB format */
+#else
+       u_int8_t        wide_tag_type           :2, /* Wide Lun CCB format */
+                       wide_tag_enable         :1, /* Wide Lun CCB format */
+                       data_out                :1,
+                       data_in                 :1,
+                                               :3;
+#endif
        u_int8_t        scsi_cmd_length;
        u_int8_t        req_sense_length;
        /*------------------------------------longword boundary */
@@ -208,9 +216,15 @@
        u_int8_t        target_stat;
        /*------------------------------------longword boundary */
        u_int8_t        target;
+#if BYTE_ORDER == LITTLE_ENDIAN
        u_int8_t        lun                     :5,
                        tag_enable              :1,
                        tag_type                :2;
+#else
+       u_int8_t        tag_type                :2,
+                       tag_enable              :1,
+                       lun                     :5;
+#endif
        u_int8_t        scsi_cmd[12];
        u_int8_t        reserved2[1];
        u_int8_t        link_id;
@@ -320,8 +334,13 @@
        struct {
                u_char  chan;
                u_char  intr;
-               u_char  scsi_dev:3;
-               u_char  :5;
+#if BYTE_ORDER == LITTLE_ENDIAN
+               u_char  scsi_dev :3,
+                                :5;
+#else
+               u_char           :5,
+                       scsi_dev :3;
+#endif
        } reply;
 };
 
@@ -382,15 +401,27 @@
 };
 
 struct bha_sync {
-       u_char  offset:4;
-       u_char  period:3;
-       u_char  valid:1;
+#if BYTE_ORDER == LITTLE_ENDIAN
+       u_char  offset  :4,
+               period  :3,
+               valid   :1;
+#else
+       u_char  valid   :1,
+               period  :3,
+               offset  :4;
+#endif
 };
 
 struct bha_setup_reply {
+#if BYTE_ORDER == LITTLE_ENDIAN
        u_int8_t        sync_neg        :1,
                        parity          :1,
                                        :6;
+#else
+       u_int8_t                        :6,
+                       parity          :1,
+                       sync_neg        :1;
+#endif
        u_int8_t        speed;
        u_int8_t        bus_on;
        u_int8_t        bus_off;



Home | Main Index | Thread Index | Old Index