Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Add macros to sync the various bits of the DMA'd...



details:   https://anonhg.NetBSD.org/src/rev/1784697c1639
branches:  trunk
changeset: 511935:1784697c1639
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Jun 30 15:57:58 2001 +0000

description:
Add macros to sync the various bits of the DMA'd control data.

diffstat:

 sys/dev/pci/if_tireg.h |  63 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 62 insertions(+), 1 deletions(-)

diffs (77 lines):

diff -r 0c7439bc56ff -r 1784697c1639 sys/dev/pci/if_tireg.h
--- a/sys/dev/pci/if_tireg.h    Sat Jun 30 15:39:51 2001 +0000
+++ b/sys/dev/pci/if_tireg.h    Sat Jun 30 15:57:58 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tireg.h,v 1.9 2001/06/30 15:39:51 thorpej Exp $ */
+/* $NetBSD: if_tireg.h,v 1.10 2001/06/30 15:57:58 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -1148,6 +1148,67 @@
 #define        TI_CDGIBADDR(sc)        ((sc)->info_dmaaddr + TI_CDGIBOFF)
 #define        TI_CDSTATSADDR(sc)      ((sc)->info_dmaaddr + TI_CDSTATSOFF)
 
+#define        TI_CDRXSTDSYNC(sc, x, ops)                                      \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDRXSTDOFF((x)), sizeof(struct ti_rx_desc), (ops))
+
+#define        TI_CDRXJUMBOSYNC(sc, x, ops)                                    \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDRXJUMBOOFF((x)), sizeof(struct ti_rx_desc), (ops))
+
+#define        TI_CDRXMINISYNC(sc, x, ops)                                     \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDRXMINIOFF((x)), sizeof(struct ti_rx_desc), (ops))
+
+#define        TI_CDRXRTNSYNC(sc, x, ops)                                      \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDRXRTNOFF((x)), sizeof(struct ti_rx_desc), (ops))
+
+#define        TI_CDEVENTSYNC(sc, x, ops)                                      \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDEVENTOFF((x)), sizeof(struct ti_event_desc), (ops))
+
+#define        TI_CDTXSYNC(sc, x, n, ops)                                      \
+do {                                                                   \
+       int __x, __n;                                                   \
+                                                                       \
+       __x = (x);                                                      \
+       __n = (n);                                                      \
+                                                                       \
+       /* If it will wrap around, sync to the end of the ring. */      \
+       if ((__x + __n) > TI_TX_RING_CNT) {                             \
+               bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,       \
+                   TI_CDTXOFF(__x), sizeof(struct ti_tx_desc) *        \
+                   (TI_TX_RING_CNT - __x), (ops));                     \
+               __n -= (TI_TX_RING_CNT - __x);                          \
+               __x = 0;                                                \
+       }                                                               \
+                                                                       \
+       /* Now sync whatever is left. */                                \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDTXOFF(__x), sizeof(struct ti_tx_desc) * (__n), (ops)); \
+} while (/*CONSTCOND*/0)
+
+#define        TI_CEVPRODSYNC(sc, ops)                                         \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDEVPRODOFF, sizeof(struct ti_producer), (ops))
+
+#define        TI_CDRTNPRODSYNC(sc, ops)                                       \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDRTNPRODOFF, sizeof(struct ti_producer), (ops))
+
+#define        TI_CDTXCONSSYNC(sc, ops)                                        \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDTXCONSOFF, sizeof(struct ti_producer), (ops))
+
+#define        TI_CDGIBSYNC(sc, ops)                                           \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDGIBOFF, sizeof(struct ti_gib), (ops))
+
+#define        TI_CDSTATSSYNC(sc, ops)                                         \
+       bus_dmamap_sync((sc)->sc_dmat, (sc)->info_dmamap,               \
+           TI_CDSTATSOFF, sizeof(struct ti_stats), (ops))
+
 /*
  * Microchip Technology 24Cxx EEPROM control bytes
  */



Home | Main Index | Thread Index | Old Index