diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c index c264192b902d..3b75efc8369c 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 be41e5c516d2..7ffe27602697 100644 --- a/sys/dev/cs/if_csreg.h +++ b/sys/dev/cs/if_csreg.h @@ -30,6 +30,8 @@ * $FreeBSD$ */ +#include + #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 944450e88d5f..be1bfbd590e5 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;