diff options
| author | enami <enami@NetBSD.org> | 2000-04-19 02:39:12 +0000 |
|---|---|---|
| committer | enami <enami@NetBSD.org> | 2000-04-19 02:39:12 +0000 |
| commit | debe6e88b645849a8872c515d97d6eec5380e7bc (patch) | |
| tree | 49b11450617a543ac1bd78237c0fed66aa7aafc8 /sys/dev | |
| parent | 19a31e7b5e2b5e7dc602519c27aa498c907f9a17 (diff) | |
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 (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ic/bhavar.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/ic/bhavar.h b/sys/dev/ic/bhavar.h index bef821300f6..b0c9df5d557 100644 --- a/sys/dev/ic/bhavar.h +++ b/sys/dev/ic/bhavar.h @@ -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 @@ do { \ 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 { |
