Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Re-arrange the transmit control data somewhat so ...
details: https://anonhg.NetBSD.org/src/rev/b71b8f19e03e
branches: trunk
changeset: 510176:b71b8f19e03e
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon May 21 23:58:44 2001 +0000
description:
Re-arrange the transmit control data somewhat so that we can
use the extended TxCB format (that change will happen later).
diffstat:
sys/dev/ic/i82557.c | 42 +++++++++++++++++++-----------------------
sys/dev/ic/i82557reg.h | 7 ++++++-
sys/dev/ic/i82557var.h | 32 ++++++++++++--------------------
3 files changed, 37 insertions(+), 44 deletions(-)
diffs (217 lines):
diff -r 7d6852a82233 -r b71b8f19e03e sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c Mon May 21 23:55:04 2001 +0000
+++ b/sys/dev/ic/i82557.c Mon May 21 23:58:44 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557.c,v 1.49 2001/05/21 23:21:27 thorpej Exp $ */
+/* $NetBSD: i82557.c,v 1.50 2001/05/21 23:58:44 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -697,9 +697,8 @@
{
struct fxp_softc *sc = ifp->if_softc;
struct mbuf *m0, *m;
- struct fxp_cb_tx *txd;
+ struct fxp_txdesc *txd;
struct fxp_txsoft *txs;
- struct fxp_tbdlist *tbd;
bus_dmamap_t dmamap;
int error, lasttx, nexttx, opending, seg;
@@ -739,7 +738,6 @@
*/
nexttx = FXP_NEXTTX(sc->sc_txlast);
txd = FXP_CDTX(sc, nexttx);
- tbd = FXP_CDTBD(sc, nexttx);
txs = FXP_DSTX(sc, nexttx);
dmamap = txs->txs_dmamap;
@@ -785,14 +783,12 @@
/* Initialize the fraglist. */
for (seg = 0; seg < dmamap->dm_nsegs; seg++) {
- tbd->tbd_d[seg].tb_addr =
+ txd->txd_tbd[seg].tb_addr =
htole32(dmamap->dm_segs[seg].ds_addr);
- tbd->tbd_d[seg].tb_size =
+ txd->txd_tbd[seg].tb_size =
htole32(dmamap->dm_segs[seg].ds_len);
}
- FXP_CDTBDSYNC(sc, nexttx, BUS_DMASYNC_PREWRITE);
-
/* Sync the DMA map. */
bus_dmamap_sync(sc->sc_dmat, dmamap, 0, dmamap->dm_mapsize,
BUS_DMASYNC_PREWRITE);
@@ -806,11 +802,11 @@
* Initialize the transmit descriptor.
*/
/* BIG_ENDIAN: no need to swap to store 0 */
- txd->cb_status = 0;
- txd->cb_command =
+ txd->txd_txcb.cb_status = 0;
+ txd->txd_txcb.cb_command =
htole16(FXP_CB_COMMAND_XMIT | FXP_CB_COMMAND_SF);
- txd->tx_threshold = tx_threshold;
- txd->tbd_number = dmamap->dm_nsegs;
+ txd->txd_txcb.tx_threshold = tx_threshold;
+ txd->txd_txcb.tbd_number = dmamap->dm_nsegs;
FXP_CDTXSYNC(sc, nexttx,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
@@ -846,7 +842,7 @@
* processing once the last packet we've enqueued
* has been transmitted.
*/
- FXP_CDTX(sc, sc->sc_txlast)->cb_command |=
+ FXP_CDTX(sc, sc->sc_txlast)->txd_txcb.cb_command |=
htole16(FXP_CB_COMMAND_I | FXP_CB_COMMAND_S);
FXP_CDTXSYNC(sc, sc->sc_txlast,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
@@ -857,7 +853,8 @@
*/
FXP_CDTXSYNC(sc, lasttx,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- FXP_CDTX(sc, lasttx)->cb_command &= htole16(~FXP_CB_COMMAND_S);
+ FXP_CDTX(sc, lasttx)->txd_txcb.cb_command &=
+ htole16(~FXP_CB_COMMAND_S);
FXP_CDTXSYNC(sc, lasttx,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
@@ -881,7 +878,7 @@
struct fxp_softc *sc = arg;
struct ethercom *ec = &sc->sc_ethercom;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
- struct fxp_cb_tx *txd;
+ struct fxp_txdesc *txd;
struct fxp_txsoft *txs;
struct mbuf *m, *m0;
bus_dmamap_t rxmap;
@@ -1036,13 +1033,11 @@
FXP_CDTXSYNC(sc, i,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- txstat = le16toh(txd->cb_status);
+ txstat = le16toh(txd->txd_txcb.cb_status);
if ((txstat & FXP_CB_STATUS_C) == 0)
break;
- FXP_CDTBDSYNC(sc, i, BUS_DMASYNC_POSTWRITE);
-
bus_dmamap_sync(sc->sc_dmat, txs->txs_dmamap,
0, txs->txs_dmamap->dm_mapsize,
BUS_DMASYNC_POSTWRITE);
@@ -1287,7 +1282,7 @@
struct fxp_softc *sc = ifp->if_softc;
struct fxp_cb_config *cbp;
struct fxp_cb_ias *cb_ias;
- struct fxp_cb_tx *txd;
+ struct fxp_txdesc *txd;
bus_dmamap_t rxmap;
int i, prm, save_bf, allm, error = 0;
@@ -1452,11 +1447,12 @@
*/
for (i = 0; i < FXP_NTXCB; i++) {
txd = FXP_CDTX(sc, i);
- memset(txd, 0, sizeof(struct fxp_cb_tx));
- txd->cb_command =
+ memset(txd, 0, sizeof(*txd));
+ txd->txd_txcb.cb_command =
htole16(FXP_CB_COMMAND_NOP | FXP_CB_COMMAND_S);
- txd->tbd_array_addr = htole32(FXP_CDTBDADDR(sc, i));
- txd->link_addr = htole32(FXP_CDTXADDR(sc, FXP_NEXTTX(i)));
+ txd->txd_txcb.tbd_array_addr = htole32(FXP_CDTBDADDR(sc, i));
+ txd->txd_txcb.link_addr =
+ htole32(FXP_CDTXADDR(sc, FXP_NEXTTX(i)));
FXP_CDTXSYNC(sc, i, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
}
sc->sc_txpending = 0;
diff -r 7d6852a82233 -r b71b8f19e03e sys/dev/ic/i82557reg.h
--- a/sys/dev/ic/i82557reg.h Mon May 21 23:55:04 2001 +0000
+++ b/sys/dev/ic/i82557reg.h Mon May 21 23:58:44 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557reg.h,v 1.3 1999/12/12 17:46:36 thorpej Exp $ */
+/* $NetBSD: i82557reg.h,v 1.4 2001/05/21 23:58:44 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -238,6 +238,11 @@
volatile u_int16_t byte_count;
volatile u_int8_t tx_threshold;
volatile u_int8_t tbd_number;
+ /*
+ * If using the extended TxCB feature, there is a
+ * single TBD right here. We handle this in the
+ * fxp_control_data in i82557var.h.
+ */
};
/*
diff -r 7d6852a82233 -r b71b8f19e03e sys/dev/ic/i82557var.h
--- a/sys/dev/ic/i82557var.h Mon May 21 23:55:04 2001 +0000
+++ b/sys/dev/ic/i82557var.h Mon May 21 23:58:44 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557var.h,v 1.19 2001/05/21 22:20:31 thorpej Exp $ */
+/* $NetBSD: i82557var.h,v 1.20 2001/05/21 23:58:44 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -102,17 +102,14 @@
*/
struct fxp_control_data {
/*
- * The transmit control blocks. The first if these
- * is also used as the config CB.
+ * The transmit control blocks and transmit buffer descriptors.
+ * We arrange them like this so that everything is all lined
+ * up to use the extended TxCB feature.
*/
- struct fxp_cb_tx fcd_txcbs[FXP_NTXCB];
-
- /*
- * The transmit buffer descriptors.
- */
- struct fxp_tbdlist {
- struct fxp_tbd tbd_d[FXP_NTXSEG];
- } fcd_tbdl[FXP_NTXCB];
+ struct fxp_txdesc {
+ struct fxp_cb_tx txd_txcb;
+ struct fxp_tbd txd_tbd[FXP_NTXSEG];
+ } fcd_txdescs[FXP_NTXCB];
/*
* The configuration CB.
@@ -136,8 +133,8 @@
};
#define FXP_CDOFF(x) offsetof(struct fxp_control_data, x)
-#define FXP_CDTXOFF(x) FXP_CDOFF(fcd_txcbs[(x)])
-#define FXP_CDTBDOFF(x) FXP_CDOFF(fcd_tbdl[(x)])
+#define FXP_CDTXOFF(x) FXP_CDOFF(fcd_txdescs[(x)].txd_txcb)
+#define FXP_CDTBDOFF(x) FXP_CDOFF(fcd_txdescs[(x)].txd_tbd)
#define FXP_CDCONFIGOFF FXP_CDOFF(fcd_configcb)
#define FXP_CDIASOFF FXP_CDOFF(fcd_iascb)
#define FXP_CDMCSOFF FXP_CDOFF(fcd_mcscb)
@@ -227,18 +224,13 @@
#define FXP_CDTXADDR(sc, x) ((sc)->sc_cddma + FXP_CDTXOFF((x)))
#define FXP_CDTBDADDR(sc, x) ((sc)->sc_cddma + FXP_CDTBDOFF((x)))
-#define FXP_CDTX(sc, x) (&(sc)->sc_control_data->fcd_txcbs[(x)])
-#define FXP_CDTBD(sc, x) (&(sc)->sc_control_data->fcd_tbdl[(x)])
+#define FXP_CDTX(sc, x) (&(sc)->sc_control_data->fcd_txdescs[(x)])
#define FXP_DSTX(sc, x) (&(sc)->sc_txsoft[(x)])
#define FXP_CDTXSYNC(sc, x, ops) \
bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \
- FXP_CDTXOFF((x)), sizeof(struct fxp_cb_tx), (ops))
-
-#define FXP_CDTBDSYNC(sc, x, ops) \
- bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \
- FXP_CDTBDOFF((x)), sizeof(struct fxp_tbdlist), (ops))
+ FXP_CDTXOFF((x)), sizeof(struct fxp_txdesc), (ops))
#define FXP_CDCONFIGSYNC(sc, ops) \
bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \
Home |
Main Index |
Thread Index |
Old Index