Use bus space functions rather than inw/outw
to help a future port of the driver to ARM. Approved by: imp (mentor)
This commit is contained in:
parent
c08ce26e98
commit
c8045145b7
@ -272,8 +272,6 @@ cs_cs89x0_probe(device_t dev)
|
|||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
sc->nic_addr = rman_get_start(sc->port_res);
|
|
||||||
|
|
||||||
if ((cs_inw(sc, ADD_PORT) & ADD_MASK) != ADD_SIG) {
|
if ((cs_inw(sc, ADD_PORT) & ADD_MASK) != ADD_SIG) {
|
||||||
/* Chip not detected. Let's try to reset it */
|
/* Chip not detected. Let's try to reset it */
|
||||||
if (bootverbose)
|
if (bootverbose)
|
||||||
@ -704,7 +702,7 @@ static int
|
|||||||
cs_get_packet(struct cs_softc *sc)
|
cs_get_packet(struct cs_softc *sc)
|
||||||
{
|
{
|
||||||
struct ifnet *ifp = sc->ifp;
|
struct ifnet *ifp = sc->ifp;
|
||||||
int iobase = sc->nic_addr, status, length;
|
int status, length;
|
||||||
struct ether_header *eh;
|
struct ether_header *eh;
|
||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
|
|
||||||
@ -746,7 +744,8 @@ cs_get_packet(struct cs_softc *sc)
|
|||||||
m->m_len = length;
|
m->m_len = length;
|
||||||
|
|
||||||
/* Get the data */
|
/* 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 *);
|
eh = mtod(m, struct ether_header *);
|
||||||
|
|
||||||
@ -869,7 +868,8 @@ cs_write_mbufs( struct cs_softc *sc, struct mbuf *m )
|
|||||||
static void
|
static void
|
||||||
cs_xmit_buf( struct cs_softc *sc )
|
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;
|
sc->buf_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/rman.h>
|
||||||
|
|
||||||
#define CS_89x0_IO_PORTS 0x0020
|
#define CS_89x0_IO_PORTS 0x0020
|
||||||
|
|
||||||
#define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */
|
#define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */
|
||||||
@ -541,21 +543,21 @@ cs_inw(struct cs_softc *sc, int off)
|
|||||||
{
|
{
|
||||||
if (off & 1)
|
if (off & 1)
|
||||||
device_printf(sc->dev, "BUG: inw to an odd address.\n");
|
device_printf(sc->dev, "BUG: inw to an odd address.\n");
|
||||||
return ((inb(sc->nic_addr + off) & 0xff) |
|
return ((bus_read_1(sc->port_res, off)) |
|
||||||
(inb(sc->nic_addr + off + 1) << 8));
|
(bus_read_1(sc->port_res, off + 1) << 8));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static __inline uint16_t
|
static __inline uint16_t
|
||||||
cs_inw(struct cs_softc *sc, int off)
|
cs_inw(struct cs_softc *sc, int off)
|
||||||
{
|
{
|
||||||
return (inw(sc->nic_addr + off));
|
return (bus_read_2(sc->port_res, off));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static __inline void
|
static __inline void
|
||||||
cs_outw(struct cs_softc *sc, int off, uint16_t val)
|
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
|
static __inline uint16_t
|
||||||
|
@ -57,7 +57,6 @@ struct cs_softc {
|
|||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
#define CS_NO_IRQ 0x1
|
#define CS_NO_IRQ 0x1
|
||||||
int nic_addr; /* Base IO address of card */
|
|
||||||
int send_cmd;
|
int send_cmd;
|
||||||
int line_ctl; /* */
|
int line_ctl; /* */
|
||||||
int send_underrun;
|
int send_underrun;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user