Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev/isa Pullup from trunk:
details: https://anonhg.NetBSD.org/src/rev/94b18515fe18
branches: netbsd-1-5
changeset: 488610:94b18515fe18
user: is <is%NetBSD.org@localhost>
date: Fri Jul 21 14:30:54 2000 +0000
description:
Pullup from trunk:
big-endian-machine support for if_iy.c (would only work on little endian
machines before).
diffstat:
sys/dev/isa/if_iy.c | 101 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 68 insertions(+), 33 deletions(-)
diffs (226 lines):
diff -r afc080399449 -r 94b18515fe18 sys/dev/isa/if_iy.c
--- a/sys/dev/isa/if_iy.c Fri Jul 21 06:50:36 2000 +0000
+++ b/sys/dev/isa/if_iy.c Fri Jul 21 14:30:54 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iy.c,v 1.36.4.3 2000/07/14 17:34:01 is Exp $ */
+/* $NetBSD: if_iy.c,v 1.36.4.4 2000/07/21 14:30:54 is Exp $ */
/* #define IYDEBUG */
/* #define IYMEMDEBUG */
@@ -60,6 +60,7 @@
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/device.h>
+#include <sys/endian.h>
#if NRND > 0
#include <sys/rnd.h>
#endif
@@ -102,6 +103,14 @@
#include <dev/isa/isavar.h>
#include <dev/ic/i82595reg.h>
+/* XXX why isn't this centralized? */
+#ifndef __BUS_SPACE_HAS_STREAM_METHODS
+#define bus_space_write_stream_2 bus_space_write_2
+#define bus_space_write_multi_stream_2 bus_space_write_multi_2
+#define bus_space_read_stream_2 bus_space_read_2
+#define bus_space_read_multi_stream_2 bus_space_read_multi_2
+#endif /* __BUS_SPACE_HAS_STREAM_METHODS */
+
/*
* Ethernet status, per interface.
*/
@@ -402,13 +411,13 @@
p = sc->tx_start;
do {
bus_space_write_2(iot, ioh, HOST_ADDR_REG, p);
- v = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ v = le16toh(bus_space_read_stream_2(iot, ioh, MEM_PORT_REG));
printf("0x%04x: %b ", p, v, "\020\006Ab\010Dn");
- v = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ v = le16toh(bus_space_read_stream_2(iot, ioh, MEM_PORT_REG));
printf("0x%b", v, "\020\6MAX_COL\7HRT_BEAT\010TX_DEF\011UND_RUN\012JERR\013LST_CRS\014LTCOL\016TX_OK\020COLL");
- p = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ p = le16toh(bus_space_read_stream_2(iot, ioh, MEM_PORT_REG));
printf(" 0x%04x", p);
- v = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ v = le16toh(bus_space_read_stream_2(iot, ioh, MEM_PORT_REG));
printf(" 0x%b\n", v, "\020\020Ch");
} while (v & 0x8000);
@@ -677,10 +686,14 @@
}
bus_space_write_2(iot, ioh, HOST_ADDR_REG, last);
- bus_space_write_2(iot, ioh, MEM_PORT_REG, XMT_CMD);
+ bus_space_write_stream_2(iot, ioh, MEM_PORT_REG,
+ htole16(XMT_CMD));
+
bus_space_write_2(iot, ioh, MEM_PORT_REG, 0);
bus_space_write_2(iot, ioh, MEM_PORT_REG, 0);
- bus_space_write_2(iot, ioh, MEM_PORT_REG, len + pad);
+
+ bus_space_write_stream_2(iot, ioh, MEM_PORT_REG,
+ htole16(len + pad));
residual = resval = 0;
@@ -693,13 +706,14 @@
sc->sc_dev.dv_xname);
#endif
resval |= *data << 8;
- bus_space_write_2(iot, ioh, MEM_PORT_REG, resval);
+ bus_space_write_stream_2(iot, ioh,
+ MEM_PORT_REG, resval);
--llen;
++data;
}
if (llen > 1)
- bus_space_write_multi_2(iot, ioh, MEM_PORT_REG,
- data, llen>>1);
+ bus_space_write_multi_stream_2(iot, ioh,
+ MEM_PORT_REG, data, llen>>1);
residual = llen & 1;
if (residual) {
resval = *(data + llen - 1);
@@ -713,11 +727,12 @@
}
if (residual)
- bus_space_write_2(iot, ioh, MEM_PORT_REG, resval);
+ bus_space_write_stream_2(iot, ioh, MEM_PORT_REG,
+ resval);
pad >>= 1;
while (pad-- > 0)
- bus_space_write_2(iot, ioh, MEM_PORT_REG, 0);
+ bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, 0);
#ifdef IYDEBUG
printf("%s: new last = 0x%x, end = 0x%x.\n",
@@ -727,16 +742,27 @@
#endif
if (sc->tx_start != sc->tx_end) {
- bus_space_write_2(iot, ioh, HOST_ADDR_REG, sc->tx_last + XMT_COUNT);
- stat = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ bus_space_write_2(iot, ioh, HOST_ADDR_REG,
+ sc->tx_last + XMT_COUNT);
+
+ /*
+ * XXX We keep stat in le order, to potentially save
+ * a byte swap.
+ */
+ stat = bus_space_read_stream_2(iot, ioh, MEM_PORT_REG);
- bus_space_write_2(iot, ioh, HOST_ADDR_REG, sc->tx_last + XMT_CHAIN);
- bus_space_write_2(iot, ioh, MEM_PORT_REG, last);
- bus_space_write_2(iot, ioh, MEM_PORT_REG, stat | CHAIN);
+ bus_space_write_2(iot, ioh, HOST_ADDR_REG,
+ sc->tx_last + XMT_CHAIN);
+
+ bus_space_write_stream_2(iot, ioh, MEM_PORT_REG,
+ htole16(last));
+
+ bus_space_write_stream_2(iot, ioh, MEM_PORT_REG,
+ stat | htole16(CHAIN));
#ifdef IYDEBUG
printf("%s: setting 0x%x to 0x%x\n",
sc->sc_dev.dv_xname, sc->tx_last + XMT_COUNT,
- stat | CHAIN);
+ le16toh(stat) | CHAIN);
#endif
}
stat = bus_space_read_2(iot, ioh, MEM_PORT_REG); /* dummy read */
@@ -943,13 +969,13 @@
if (len > 1) {
len &= ~1;
- bus_space_read_multi_2(iot, ioh, MEM_PORT_REG,
+ bus_space_read_multi_stream_2(iot, ioh, MEM_PORT_REG,
mtod(m, caddr_t), len/2);
} else {
#ifdef IYDEBUG
printf("%s: received odd mbuf\n", sc->sc_dev.dv_xname);
#endif
- *(mtod(m, caddr_t)) = bus_space_read_2(iot, ioh,
+ *(mtod(m, caddr_t)) = bus_space_read_stream_2(iot, ioh,
MEM_PORT_REG);
}
m->m_len = len;
@@ -999,13 +1025,16 @@
rxadrs = sc->rx_start;
bus_space_write_2(iot, ioh, HOST_ADDR_REG, rxadrs);
- rxevnt = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ rxevnt = le16toh(bus_space_read_stream_2(iot, ioh, MEM_PORT_REG));
rxnext = 0;
while (rxevnt == RCV_DONE) {
- rxstatus = bus_space_read_2(iot, ioh, MEM_PORT_REG);
- rxnext = bus_space_read_2(iot, ioh, MEM_PORT_REG);
- rxlen = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ rxstatus = le16toh(bus_space_read_stream_2(iot, ioh,
+ MEM_PORT_REG));
+ rxnext = le16toh(bus_space_read_stream_2(iot, ioh,
+ MEM_PORT_REG));
+ rxlen = le16toh(bus_space_read_stream_2(iot, ioh,
+ MEM_PORT_REG));
#ifdef IYDEBUG
printf("%s: pck at 0x%04x stat %b next 0x%x len 0x%x\n",
sc->sc_dev.dv_xname, rxadrs, rxstatus,
@@ -1021,7 +1050,8 @@
bus_space_write_2(iot, ioh, HOST_ADDR_REG, rxnext);
rxadrs = rxnext;
- rxevnt = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ rxevnt = le16toh(bus_space_read_stream_2(iot, ioh,
+ MEM_PORT_REG));
}
sc->rx_start = rxnext;
}
@@ -1041,13 +1071,18 @@
while (sc->tx_start != sc->tx_end) {
bus_space_write_2(iot, ioh, HOST_ADDR_REG, sc->tx_start);
- txstatus = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ txstatus = le16toh(bus_space_read_stream_2(iot, ioh,
+ MEM_PORT_REG));
+
if ((txstatus & (TX_DONE|CMD_MASK)) != (TX_DONE|XMT_CMD))
break;
- txstat2 = bus_space_read_2(iot, ioh, MEM_PORT_REG);
- txnext = bus_space_read_2(iot, ioh, MEM_PORT_REG);
- txlen = bus_space_read_2(iot, ioh, MEM_PORT_REG);
+ txstat2 = le16toh(bus_space_read_stream_2(iot, ioh,
+ MEM_PORT_REG));
+ txnext = le16toh(bus_space_read_stream_2(iot, ioh,
+ MEM_PORT_REG));
+ txlen = le16toh(bus_space_read_stream_2(iot, ioh,
+ MEM_PORT_REG));
#ifdef IYDEBUG
printf("txstat 0x%x stat2 0x%b next 0x%x len 0x%x\n",
txstatus, txstat2, "\020\6MAX_COL\7HRT_BEAT\010TX_DEF"
@@ -1261,17 +1296,17 @@
/* XXX END OF VOODOO */
bus_space_write_1(iot, ioh, 0, BANK_SEL(0));
bus_space_write_2(iot, ioh, HOST_ADDR_REG, last);
- bus_space_write_2(iot, ioh, MEM_PORT_REG, MC_SETUP_CMD);
+ bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, htole16(MC_SETUP_CMD));
bus_space_write_2(iot, ioh, MEM_PORT_REG, 0);
bus_space_write_2(iot, ioh, MEM_PORT_REG, 0);
- bus_space_write_2(iot, ioh, MEM_PORT_REG, len);
+ bus_space_write_stream_2(iot, ioh, MEM_PORT_REG, htole16(len));
- bus_space_write_multi_2(iot, ioh, MEM_PORT_REG,
+ bus_space_write_multi_stream_2(iot, ioh, MEM_PORT_REG,
LLADDR(ifp->if_sadl), 3);
ETHER_FIRST_MULTI(step, ecp, enm);
while(enm) {
- bus_space_write_multi_2(iot, ioh, MEM_PORT_REG,
+ bus_space_write_multi_stream_2(iot, ioh, MEM_PORT_REG,
enm->enm_addrlo, 3);
ETHER_NEXT_MULTI(step, enm);
Home |
Main Index |
Thread Index |
Old Index