summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2011-01-29 00:53:58 +0000
committerandrew <andrew@FreeBSD.org>2011-01-29 00:53:58 +0000
commitf689fa27ba120e327e15f54a3045b054588d5fbc (patch)
tree922ed2f2cacbfe73422b894efc36b54a6f6cb72c /sys/dev
parent0b5604dcfb1025906ef301dd1201c72edb9f0560 (diff)
downloadFreeBSD-src-f689fa27ba120e327e15f54a3045b054588d5fbc.zip
FreeBSD-src-f689fa27ba120e327e15f54a3045b054588d5fbc.tar.gz
Use bus space functions rather than inw/outw
to help a future port of the driver to ARM. Approved by: imp (mentor)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cs/if_cs.c10
-rw-r--r--sys/dev/cs/if_csreg.h10
-rw-r--r--sys/dev/cs/if_csvar.h1
3 files changed, 11 insertions, 10 deletions
diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c
index c264192..3b75efc 100644
--- a/sys/dev/cs/if_cs.c
+++ b/sys/dev/cs/if_cs.c
@@ -272,8 +272,6 @@ cs_cs89x0_probe(device_t dev)
if (error)
return (error);
- sc->nic_addr = rman_get_start(sc->port_res);
-
if ((cs_inw(sc, ADD_PORT) & ADD_MASK) != ADD_SIG) {
/* Chip not detected. Let's try to reset it */
if (bootverbose)
@@ -704,7 +702,7 @@ static int
cs_get_packet(struct cs_softc *sc)
{
struct ifnet *ifp = sc->ifp;
- int iobase = sc->nic_addr, status, length;
+ int status, length;
struct ether_header *eh;
struct mbuf *m;
@@ -746,7 +744,8 @@ cs_get_packet(struct cs_softc *sc)
m->m_len = length;
/* Get the data */
- insw(iobase + RX_FRAME_PORT, m->m_data, (length+1)>>1);
+ bus_read_multi_2(sc->port_res, RX_FRAME_PORT, mtod(m, uint16_t *),
+ (length + 1) >> 1);
eh = mtod(m, struct ether_header *);
@@ -869,7 +868,8 @@ cs_write_mbufs( struct cs_softc *sc, struct mbuf *m )
static void
cs_xmit_buf( struct cs_softc *sc )
{
- outsw(sc->nic_addr+TX_FRAME_PORT, sc->buffer, (sc->buf_len+1)>>1);
+ bus_write_multi_2(sc->port_res, TX_FRAME_PORT, (uint16_t *)sc->buffer,
+ (sc->buf_len + 1) >> 1);
sc->buf_len = 0;
}
diff --git a/sys/dev/cs/if_csreg.h b/sys/dev/cs/if_csreg.h
index be41e5c..7ffe276 100644
--- a/sys/dev/cs/if_csreg.h
+++ b/sys/dev/cs/if_csreg.h
@@ -30,6 +30,8 @@
* $FreeBSD$
*/
+#include <sys/rman.h>
+
#define CS_89x0_IO_PORTS 0x0020
#define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */
@@ -541,21 +543,21 @@ cs_inw(struct cs_softc *sc, int off)
{
if (off & 1)
device_printf(sc->dev, "BUG: inw to an odd address.\n");
- return ((inb(sc->nic_addr + off) & 0xff) |
- (inb(sc->nic_addr + off + 1) << 8));
+ return ((bus_read_1(sc->port_res, off)) |
+ (bus_read_1(sc->port_res, off + 1) << 8));
}
#else
static __inline uint16_t
cs_inw(struct cs_softc *sc, int off)
{
- return (inw(sc->nic_addr + off));
+ return (bus_read_2(sc->port_res, off));
}
#endif
static __inline void
cs_outw(struct cs_softc *sc, int off, uint16_t val)
{
- outw(sc->nic_addr + off, val);
+ bus_write_2(sc->port_res, off, val);
}
static __inline uint16_t
diff --git a/sys/dev/cs/if_csvar.h b/sys/dev/cs/if_csvar.h
index 944450e..be1bfbd 100644
--- a/sys/dev/cs/if_csvar.h
+++ b/sys/dev/cs/if_csvar.h
@@ -57,7 +57,6 @@ struct cs_softc {
int flags;
#define CS_NO_IRQ 0x1
- int nic_addr; /* Base IO address of card */
int send_cmd;
int line_ctl; /* */
int send_underrun;
OpenPOWER on IntegriCloud