Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ieee1394 use OHCI_BITVAL(val, name), instead of



details:   https://anonhg.NetBSD.org/src/rev/962bcd5ff1de
branches:  trunk
changeset: 507066:962bcd5ff1de
user:      onoe <onoe%NetBSD.org@localhost>
date:      Mon Mar 12 23:27:53 2001 +0000

description:
use OHCI_BITVAL(val, name), instead of
((val) & (name##_MASK)) >> name##_BITPOS

diffstat:

 sys/dev/ieee1394/fwohci.c    |  23 ++++++++++-------------
 sys/dev/ieee1394/fwohcireg.h |   5 ++++-
 2 files changed, 14 insertions(+), 14 deletions(-)

diffs (91 lines):

diff -r 075d738c13fb -r 962bcd5ff1de sys/dev/ieee1394/fwohci.c
--- a/sys/dev/ieee1394/fwohci.c Mon Mar 12 23:22:37 2001 +0000
+++ b/sys/dev/ieee1394/fwohci.c Mon Mar 12 23:27:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fwohci.c,v 1.17 2001/03/12 23:22:37 onoe Exp $ */
+/*     $NetBSD: fwohci.c,v 1.18 2001/03/12 23:27:53 onoe Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -187,8 +187,7 @@
         */
        val = OHCI_CSR_READ(sc, OHCI_REG_BusOptions);
        sc->sc_sc1394.sc1394_link_speed =
-           (val & OHCI_BusOptions_LinkSpd_MASK)
-               >> OHCI_BusOptions_LinkSpd_BITPOS;
+           OHCI_BITVAL(val, OHCI_BusOptions_LinkSpd);
        if (sc->sc_sc1394.sc1394_link_speed < IEEE1394_SPD_MAX) {
                printf(", %s", ieee1394_speeds[sc->sc_sc1394.sc1394_link_speed]);
        } else {
@@ -198,8 +197,7 @@
        /* MaxRec is encoded as log2(max_rec_octets)-1
         */
        sc->sc_sc1394.sc1394_max_receive =
-           1 << (((val & OHCI_BusOptions_MaxRec_MASK)
-                      >> OHCI_BusOptions_MaxRec_BITPOS) + 1);
+           1 << (OHCI_BITVAL(val, OHCI_BusOptions_MaxRec) + 1);
        printf(", %u max_rec", sc->sc_sc1394.sc1394_max_receive);
 
        /*
@@ -1819,8 +1817,7 @@
                        if (!(val1 & OHCI_Guid_AddrReset))
                                break;
                }
-               off = ((val1 & OHCI_Guid_MiniROM_MASK)
-                   >> OHCI_Guid_MiniROM_BITPOS) + 4;
+               off = OHCI_BITVAL(val1, OHCI_Guid_MiniROM) + 4;
                val2 = 0;
                for (n = 0; n < off + sizeof(sc->sc_sc1394.sc1394_guid); n++) {
                        OHCI_CSR_WRITE(sc, OHCI_REG_Guid_Rom,
@@ -1832,8 +1829,7 @@
                        }
                        if (n < off)
                                continue;
-                       val1 = (val1 & OHCI_Guid_RdData_MASK)
-                               >> OHCI_Guid_RdData_BITPOS;
+                       val1 = OHCI_BITVAL(val1, OHCI_Guid_RdData);
                        sc->sc_sc1394.sc1394_guid[n - off] = val1;
                        val2 |= val1;
                }
@@ -2063,17 +2059,18 @@
                printf("%s: SelfID Error\n", sc->sc_sc1394.sc1394_dev.dv_xname);
                return -1;
        }
-       count = (val & OHCI_SelfID_Size_MASK) >> OHCI_SelfID_Size_BITPOS;
-       gen = (val & OHCI_SelfID_Gen_MASK) >> OHCI_SelfID_Gen_BITPOS;
+       count = OHCI_BITVAL(val, OHCI_SelfID_Size);
+       gen = OHCI_BITVAL(val, OHCI_SelfID_Gen);
 
        bus_dmamap_sync(sc->sc_dmat, sc->sc_buf_selfid.fb_dmamap,
            0, count << 2, BUS_DMASYNC_POSTREAD);
 
        buf = (u_int32_t *)sc->sc_buf_selfid.fb_buf;
-       if ((val & OHCI_SelfID_Gen_MASK) != (buf[0] & OHCI_SelfID_Gen_MASK)) {
+       if (OHCI_BITVAL(val, OHCI_SelfID_Gen) !=
+           OHCI_BITVAL(buf[0], OHCI_SelfID_Gen)) {
                printf("%s: SelfID Gen mismatch (%d, %d)\n",
                    sc->sc_sc1394.sc1394_dev.dv_xname, gen,
-                   (buf[0] & OHCI_SelfID_Gen_MASK) >> OHCI_SelfID_Gen_BITPOS);
+                   OHCI_BITVAL(buf[0], OHCI_SelfID_Gen));
                return -1;
        }
 
diff -r 075d738c13fb -r 962bcd5ff1de sys/dev/ieee1394/fwohcireg.h
--- a/sys/dev/ieee1394/fwohcireg.h      Mon Mar 12 23:22:37 2001 +0000
+++ b/sys/dev/ieee1394/fwohcireg.h      Mon Mar 12 23:27:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fwohcireg.h,v 1.6 2001/03/03 02:04:55 onoe Exp $       */
+/*     $NetBSD: fwohcireg.h,v 1.7 2001/03/12 23:27:54 onoe Exp $       */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -202,6 +202,9 @@
 #define        OHCI_SYNC_RX_DMA_READ(sc, ctx, reg) \
        OHCI_CSR_READ(sc, OHCI_REG_SYNC_RX_DMA_BASE + 32*(ctx) + (reg))
 
+#define        OHCI_BITVAL(val, name) \
+       ((((val) & name##_MASK) >> name##_BITPOS))
+
 /* OHCI_REG_Version
  */
 #define        OHCI_Version_GUID_ROM           0x01000000



Home | Main Index | Thread Index | Old Index