Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/dev/ic pullup 1.8->1.9 (thorpej)



details:   https://anonhg.NetBSD.org/src/rev/2af97e07a8ce
branches:  netbsd-1-4
changeset: 468500:2af97e07a8ce
user:      perry <perry%NetBSD.org@localhost>
date:      Tue Apr 27 00:12:57 1999 +0000

description:
pullup 1.8->1.9 (thorpej)

diffstat:

 sys/dev/ic/elinkxl.c |  39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diffs (111 lines):

diff -r d65a5e92661a -r 2af97e07a8ce sys/dev/ic/elinkxl.c
--- a/sys/dev/ic/elinkxl.c      Tue Apr 27 00:10:53 1999 +0000
+++ b/sys/dev/ic/elinkxl.c      Tue Apr 27 00:12:57 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elinkxl.c,v 1.7.2.1 1999/04/27 00:10:53 perry Exp $    */
+/*     $NetBSD: elinkxl.c,v 1.7.2.2 1999/04/27 00:12:57 perry Exp $    */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -82,6 +82,15 @@
 #include <machine/bus.h>
 #include <machine/intr.h>
 
+#if BYTE_ORDER == BIG_ENDIAN
+#include <machine/bswap.h>
+#define        htopci(x)       bswap32(x)
+#define        pcitoh(x)       bswap32(x)
+#else
+#define        htopci(x)       (x)
+#define        pcitoh(x)       (x)
+#endif
+
 #include <vm/vm.h>
 #include <vm/pmap.h>
 
@@ -333,7 +342,8 @@
        for (i = 0; i < EX_NUPD; i++) {
                sc->sc_rxdescs[i].rx_dmamap = sc->sc_rx_dmamaps[i];
                sc->sc_rxdescs[i].rx_upd = &sc->sc_upd[i];
-               sc->sc_upd[i].upd_frags[0].fr_len = (MCLBYTES - 2) | EX_FR_LAST;
+               sc->sc_upd[i].upd_frags[0].fr_len =
+                   htopci((MCLBYTES - 2) | EX_FR_LAST);
                if (ex_add_rxbuf(sc, &sc->sc_rxdescs[i]) != 0) {
                        printf("%s: can't allocate or map rx buffers\n",
                            sc->sc_dev.dv_xname);
@@ -977,12 +987,12 @@
                fr = &txp->tx_dpd->dpd_frags[0];
                totlen = 0;
                for (segment = 0; segment < dmamap->dm_nsegs; segment++, fr++) {
-                       fr->fr_addr = dmamap->dm_segs[segment].ds_addr;
-                       fr->fr_len = dmamap->dm_segs[segment].ds_len;
-                       totlen += fr->fr_len;
+                       fr->fr_addr = htopci(dmamap->dm_segs[segment].ds_addr);
+                       fr->fr_len = htopci(dmamap->dm_segs[segment].ds_len);
+                       totlen += dmamap->dm_segs[segment].ds_len;
                }
                fr--;
-               fr->fr_len |= EX_FR_LAST;
+               fr->fr_len |= htopci(EX_FR_LAST);
                txp->tx_mbhead = mb_head;
 
                bus_dmamap_sync(sc->sc_dmat, dmamap, 0, dmamap->dm_mapsize,
@@ -990,7 +1000,7 @@
 
                dpd = txp->tx_dpd;
                dpd->dpd_nextptr = 0;
-               dpd->dpd_fsh = totlen;
+               dpd->dpd_fsh = htopci(totlen);
 
                bus_dmamap_sync(sc->sc_dmat, sc->sc_dpd_dmamap,
                    ((caddr_t)dpd - (caddr_t)sc->sc_dpd),
@@ -1010,7 +1020,7 @@
                        bus_dmamap_sync(sc->sc_dmat, sc->sc_dpd_dmamap,
                            offset, sizeof (struct ex_dpd),
                            BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
-                       prevdpd->dpd_nextptr = DPD_DMADDR(sc, txp);
+                       prevdpd->dpd_nextptr = htopci(DPD_DMADDR(sc, txp));
                        bus_dmamap_sync(sc->sc_dmat, sc->sc_dpd_dmamap,
                            offset, sizeof (struct ex_dpd),
                            BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); 
@@ -1030,7 +1040,7 @@
        }
  out:
        if (sc->tx_head) {
-               sc->tx_tail->tx_dpd->dpd_fsh |= EX_DPD_DNIND;
+               sc->tx_tail->tx_dpd->dpd_fsh |= htopci(EX_DPD_DNIND);
                bus_dmamap_sync(sc->sc_dmat, sc->sc_dpd_dmamap,
                    ((caddr_t)sc->tx_tail->tx_dpd - (caddr_t)sc->sc_dpd),
                    sizeof (struct ex_dpd),
@@ -1133,7 +1143,7 @@
                        rxmap = rxd->rx_dmamap;
                        m = rxd->rx_mbhead;
                        upd = rxd->rx_upd;
-                       pktstat = upd->upd_pktstatus;
+                       pktstat = pcitoh(upd->upd_pktstatus);
 
                        bus_dmamap_sync(sc->sc_dmat, rxmap, 0,
                            rxmap->dm_mapsize,
@@ -1610,8 +1620,9 @@
        m->m_data += 2;
 
        rxd->rx_mbhead = m;
-       rxd->rx_upd->upd_pktstatus = MCLBYTES - 2;
-       rxd->rx_upd->upd_frags[0].fr_addr = rxmap->dm_segs[0].ds_addr + 2;
+       rxd->rx_upd->upd_pktstatus = htopci(MCLBYTES - 2);
+       rxd->rx_upd->upd_frags[0].fr_addr =
+           htopci(rxmap->dm_segs[0].ds_addr + 2);
        rxd->rx_upd->upd_nextptr = 0;
 
        /*
@@ -1619,8 +1630,8 @@
         */
        if (sc->rx_head != NULL) {
                sc->rx_tail->rx_next = rxd;
-               sc->rx_tail->rx_upd->upd_nextptr = sc->sc_upddma +
-                   ((caddr_t)rxd->rx_upd - (caddr_t)sc->sc_upd);
+               sc->rx_tail->rx_upd->upd_nextptr = htopci(sc->sc_upddma +
+                   ((caddr_t)rxd->rx_upd - (caddr_t)sc->sc_upd));
                bus_dmamap_sync(sc->sc_dmat, sc->sc_upd_dmamap,
                    (caddr_t)sc->rx_tail->rx_upd - (caddr_t)sc->sc_upd,
                    sizeof (struct ex_upd),



Home | Main Index | Thread Index | Old Index