Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Calculate an offset of mailbox_in correctly by re...



details:   https://anonhg.NetBSD.org/src/rev/567ad96ae187
branches:  trunk
changeset: 485097:567ad96ae187
user:      enami <enami%NetBSD.org@localhost>
date:      Wed Apr 19 02:39:12 2000 +0000

description:
Calculate an offset of mailbox_in correctly by renaming BHA_MBO_OFFSET
to BHA_MBX_OFFSET and using it also for mailbox_in.  Since all mailboxes
should be placed in a single continuous memory due to a hardware limitation,
an offset of any mailbox can be/should be calculated using a same expression.

diffstat:

 sys/dev/ic/bhavar.h |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 6ce392838df1 -r 567ad96ae187 sys/dev/ic/bhavar.h
--- a/sys/dev/ic/bhavar.h       Wed Apr 19 02:26:08 2000 +0000
+++ b/sys/dev/ic/bhavar.h       Wed Apr 19 02:39:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bhavar.h,v 1.17 2000/03/27 17:00:50 kleink Exp $       */
+/*     $NetBSD: bhavar.h,v 1.18 2000/04/19 02:39:12 enami Exp $        */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -69,19 +69,24 @@
            BHA_CCB_OFFSET(ccb), sizeof(struct bha_ccb), (ops));        \
 } while (0)
 
-#define        BHA_MBI_OFFSET(sc, mbi) ((u_long)(mbi) - (u_long)(sc)->sc_mbi)
-#define        BHA_MBO_OFFSET(sc, mbo) ((u_long)(mbo) - (u_long)(sc)->sc_mbo)
+/*
+ * Offset in the DMA mapping for mailboxes.
+ * Since all mailboxes are allocated on a single DMA'able memory
+ * due to the hardware limitation, an offset of any mailboxes can be
+ * calculated using same expression.
+ */
+#define        BHA_MBX_OFFSET(sc, mbx) ((u_long)(mbx) - (u_long)(sc)->sc_mbo)
 
 #define        BHA_MBI_SYNC(sc, mbi, ops)                                      \
 do {                                                                   \
        bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap_mbox,            \
-           BHA_MBI_OFFSET((sc), (mbi)), sizeof(struct bha_mbx_in), (ops)); \
+           BHA_MBX_OFFSET((sc), (mbi)), sizeof(struct bha_mbx_in), (ops)); \
 } while (0)
 
 #define        BHA_MBO_SYNC(sc, mbo, ops)                                      \
 do {                                                                   \
        bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap_mbox,            \
-           BHA_MBO_OFFSET((sc), (mbo)), sizeof(struct bha_mbx_out), (ops)); \
+           BHA_MBX_OFFSET((sc), (mbo)), sizeof(struct bha_mbx_out), (ops)); \
 } while (0)
 
 struct bha_softc {



Home | Main Index | Thread Index | Old Index