WextraRemove unused DPRINTF/DPRINTFN macros.
Remove NetBSD 1.6 compatibility checks (way out of date). Be somewhat consistent (and closer to KNF) with whitespace. Use uintN_t instead of u_intN_t. No functional changes.
This commit is contained in:
parent
25153c3ec9
commit
fb673d9599
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_bce.c,v 1.19 2008/01/19 20:25:44 dyoung Exp $ */
|
||||
/* $NetBSD: if_bce.c,v 1.20 2008/01/30 11:54:08 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Clifford Wright. All rights reserved.
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.19 2008/01/19 20:25:44 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.20 2008/01/30 11:54:08 simonb Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "vlan.h"
|
||||
|
@ -81,8 +81,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.19 2008/01/19 20:25:44 dyoung Exp $");
|
|||
|
||||
/* ring descriptor */
|
||||
struct bce_dma_slot {
|
||||
u_int32_t ctrl;
|
||||
u_int32_t addr;
|
||||
uint32_t ctrl;
|
||||
uint32_t addr;
|
||||
};
|
||||
#define CTRL_BC_MASK 0x1fff /* buffer byte count */
|
||||
#define CTRL_EOT 0x10000000 /* end of descriptor table */
|
||||
|
@ -92,9 +92,9 @@ struct bce_dma_slot {
|
|||
|
||||
/* Packet status is returned in a pre-packet header */
|
||||
struct rx_pph {
|
||||
u_int16_t len;
|
||||
u_int16_t flags;
|
||||
u_int16_t pad[12];
|
||||
uint16_t len;
|
||||
uint16_t flags;
|
||||
uint16_t pad[12];
|
||||
};
|
||||
|
||||
/* packet status flags bits */
|
||||
|
@ -115,8 +115,8 @@ struct rx_pph {
|
|||
struct bce_chain_data {
|
||||
struct mbuf *bce_tx_chain[BCE_NTXDESC];
|
||||
struct mbuf *bce_rx_chain[BCE_NRXDESC];
|
||||
bus_dmamap_t bce_tx_map[BCE_NTXDESC];
|
||||
bus_dmamap_t bce_rx_map[BCE_NRXDESC];
|
||||
bus_dmamap_t bce_tx_map[BCE_NTXDESC];
|
||||
bus_dmamap_t bce_rx_map[BCE_NRXDESC];
|
||||
};
|
||||
|
||||
#define BCE_TIMEOUT 100 /* # 10us for mii read/write */
|
||||
|
@ -130,16 +130,16 @@ struct bce_softc {
|
|||
void *bce_intrhand;
|
||||
struct pci_attach_args bce_pa;
|
||||
struct mii_data bce_mii;
|
||||
u_int32_t bce_phy; /* eeprom indicated phy */
|
||||
uint32_t bce_phy; /* eeprom indicated phy */
|
||||
struct ifmedia bce_ifmedia; /* media info *//* Check */
|
||||
u_int8_t enaddr[ETHER_ADDR_LEN];
|
||||
uint8_t enaddr[ETHER_ADDR_LEN];
|
||||
struct bce_dma_slot *bce_rx_ring; /* receive ring */
|
||||
struct bce_dma_slot *bce_tx_ring; /* transmit ring */
|
||||
struct bce_chain_data bce_cdata; /* mbufs */
|
||||
bus_dmamap_t bce_ring_map;
|
||||
u_int32_t bce_intmask; /* current intr mask */
|
||||
u_int32_t bce_rxin; /* last rx descriptor seen */
|
||||
u_int32_t bce_txin; /* last tx descriptor seen */
|
||||
uint32_t bce_intmask; /* current intr mask */
|
||||
uint32_t bce_rxin; /* last rx descriptor seen */
|
||||
uint32_t bce_txin; /* last tx descriptor seen */
|
||||
int bce_txsfree; /* no. tx slots available */
|
||||
int bce_txsnext; /* next available tx slot */
|
||||
callout_t bce_timeout;
|
||||
|
@ -154,7 +154,7 @@ struct bce_softc {
|
|||
do { \
|
||||
struct bce_dma_slot *__bced = &sc->bce_rx_ring[x]; \
|
||||
\
|
||||
*mtod(sc->bce_cdata.bce_rx_chain[x], u_int32_t *) = 0; \
|
||||
*mtod(sc->bce_cdata.bce_rx_chain[x], uint32_t *) = 0; \
|
||||
__bced->addr = \
|
||||
htole32(sc->bce_cdata.bce_rx_map[x]->dm_segs[0].ds_addr \
|
||||
+ 0x40000000); \
|
||||
|
@ -177,7 +177,7 @@ static int bce_intr(void *);
|
|||
static void bce_rxintr(struct bce_softc *);
|
||||
static void bce_txintr(struct bce_softc *);
|
||||
static int bce_init(struct ifnet *);
|
||||
static void bce_add_mac(struct bce_softc *, u_int8_t *, unsigned long);
|
||||
static void bce_add_mac(struct bce_softc *, uint8_t *, unsigned long);
|
||||
static int bce_add_rxbuf(struct bce_softc *, int);
|
||||
static void bce_rxdrain(struct bce_softc *);
|
||||
static void bce_stop(struct ifnet *, int);
|
||||
|
@ -188,39 +188,7 @@ static void bce_mii_write(struct device *, int, int, int);
|
|||
static void bce_statchg(struct device *);
|
||||
static void bce_tick(void *);
|
||||
|
||||
#define BCE_DEBUG
|
||||
#ifdef BCE_DEBUG
|
||||
#define DPRINTF(x) do { \
|
||||
if (bcedebug) \
|
||||
printf x; \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
#define DPRINTFN(n,x) do { \
|
||||
if (bcedebug >= (n)) \
|
||||
printf x; \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
int bcedebug = 0;
|
||||
#else
|
||||
#define DPRINTF(x)
|
||||
#define DPRINTFN(n,x)
|
||||
#endif
|
||||
|
||||
#if __NetBSD_Version__ >= 106080000
|
||||
CFATTACH_DECL(bce, sizeof(struct bce_softc),
|
||||
bce_probe, bce_attach, NULL, NULL);
|
||||
#else
|
||||
struct cfattach bce_ca = {
|
||||
sizeof(struct bce_softc), bce_probe, bce_attach
|
||||
};
|
||||
#endif
|
||||
|
||||
#if __NetBSD_Version__ >= 106120000
|
||||
#define APRINT_ERROR aprint_error
|
||||
#define APRINT_NORMAL aprint_normal
|
||||
#else
|
||||
#define APRINT_ERROR printf
|
||||
#define APRINT_NORMAL printf
|
||||
#endif
|
||||
|
||||
CFATTACH_DECL(bce, sizeof(struct bce_softc), bce_probe, bce_attach, NULL, NULL);
|
||||
|
||||
static const struct bce_product {
|
||||
pci_vendor_id_t bp_vendor;
|
||||
|
@ -284,18 +252,18 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
pci_chipset_tag_t pc = pa->pa_pc;
|
||||
pci_intr_handle_t ih;
|
||||
const char *intrstr = NULL;
|
||||
void * kva;
|
||||
void *kva;
|
||||
bus_dma_segment_t seg;
|
||||
int rseg;
|
||||
u_int32_t command;
|
||||
int rseg;
|
||||
uint32_t command;
|
||||
struct ifnet *ifp;
|
||||
pcireg_t memtype;
|
||||
bus_addr_t memaddr;
|
||||
bus_size_t memsize;
|
||||
int pmreg;
|
||||
pcireg_t pmode;
|
||||
int error;
|
||||
int i;
|
||||
pcireg_t memtype;
|
||||
bus_addr_t memaddr;
|
||||
bus_size_t memsize;
|
||||
int pmreg;
|
||||
pcireg_t pmode;
|
||||
int error;
|
||||
int i;
|
||||
|
||||
bp = bce_lookup(pa);
|
||||
KASSERT(bp != NULL);
|
||||
|
@ -304,18 +272,15 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
|
||||
/* BCM440x can only address 30 bits (1GB) */
|
||||
if (bus_dmatag_subregion(pa->pa_dmat, 0, (1 << 30),
|
||||
&(sc->bce_dmatag), BUS_DMA_NOWAIT) != 0)
|
||||
{
|
||||
APRINT_ERROR("WARNING: %s failed to restrict dma range,"
|
||||
" falling back to parent bus dma range\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
&(sc->bce_dmatag), BUS_DMA_NOWAIT) != 0) {
|
||||
aprint_error("WARNING: %s failed to restrict dma range,"
|
||||
" falling back to parent bus dma range\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
sc->bce_dmatag = pa->pa_dmat;
|
||||
}
|
||||
|
||||
#if __NetBSD_Version__ >= 106120000
|
||||
aprint_naive(": Ethernet controller\n");
|
||||
#endif
|
||||
APRINT_NORMAL(": %s\n", bp->bp_name);
|
||||
aprint_normal(": %s\n", bp->bp_name);
|
||||
|
||||
/*
|
||||
* Map control/status registers.
|
||||
|
@ -326,7 +291,7 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
command = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
|
||||
|
||||
if (!(command & PCI_COMMAND_MEM_ENABLE)) {
|
||||
APRINT_ERROR("%s: failed to enable memory mapping!\n",
|
||||
aprint_error("%s: failed to enable memory mapping!\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
@ -338,7 +303,7 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
&sc->bce_bhandle, &memaddr, &memsize) == 0)
|
||||
break;
|
||||
default:
|
||||
APRINT_ERROR("%s: unable to find mem space\n",
|
||||
aprint_error("%s: unable to find mem space\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
@ -352,17 +317,17 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
* this state, so punt.
|
||||
*/
|
||||
printf("%s: unable to wake up from power state D3\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
sc->bce_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
if (pmode != 0) {
|
||||
printf("%s: waking up from power state D%d\n",
|
||||
sc->bce_dev.dv_xname, pmode);
|
||||
sc->bce_dev.dv_xname, pmode);
|
||||
pci_conf_write(pc, pa->pa_tag, pmreg + 4, 0);
|
||||
}
|
||||
}
|
||||
if (pci_intr_map(pa, &ih)) {
|
||||
APRINT_ERROR("%s: couldn't map interrupt\n",
|
||||
aprint_error("%s: couldn't map interrupt\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
@ -371,14 +336,14 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->bce_intrhand = pci_intr_establish(pc, ih, IPL_NET, bce_intr, sc);
|
||||
|
||||
if (sc->bce_intrhand == NULL) {
|
||||
APRINT_ERROR("%s: couldn't establish interrupt",
|
||||
aprint_error("%s: couldn't establish interrupt",
|
||||
sc->bce_dev.dv_xname);
|
||||
if (intrstr != NULL)
|
||||
APRINT_NORMAL(" at %s", intrstr);
|
||||
APRINT_NORMAL("\n");
|
||||
aprint_normal(" at %s", intrstr);
|
||||
aprint_normal("\n");
|
||||
return;
|
||||
}
|
||||
APRINT_NORMAL("%s: interrupting at %s\n",
|
||||
aprint_normal("%s: interrupting at %s\n",
|
||||
sc->bce_dev.dv_xname, intrstr);
|
||||
|
||||
/* reset the chip */
|
||||
|
@ -395,9 +360,9 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
*/
|
||||
if ((error = bus_dmamem_alloc(sc->bce_dmatag,
|
||||
2 * PAGE_SIZE, PAGE_SIZE, 2 * PAGE_SIZE,
|
||||
&seg, 1, &rseg, BUS_DMA_NOWAIT))) {
|
||||
&seg, 1, &rseg, BUS_DMA_NOWAIT))) {
|
||||
printf("%s: unable to alloc space for ring descriptors, "
|
||||
"error = %d\n", sc->bce_dev.dv_xname, error);
|
||||
"error = %d\n", sc->bce_dev.dv_xname, error);
|
||||
return;
|
||||
}
|
||||
/* map ring space to kernel */
|
||||
|
@ -411,7 +376,7 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
/* create a dma map for the ring */
|
||||
if ((error = bus_dmamap_create(sc->bce_dmatag,
|
||||
2 * PAGE_SIZE, 1, 2 * PAGE_SIZE, 0, BUS_DMA_NOWAIT,
|
||||
&sc->bce_ring_map))) {
|
||||
&sc->bce_ring_map))) {
|
||||
printf("%s: unable to create ring DMA map, error = %d\n",
|
||||
sc->bce_dev.dv_xname, error);
|
||||
bus_dmamem_unmap(sc->bce_dmatag, kva, 2 * PAGE_SIZE);
|
||||
|
@ -508,7 +473,7 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->enaddr[5] = bus_space_read_1(sc->bce_btag, sc->bce_bhandle,
|
||||
BCE_MAGIC_ENET5);
|
||||
printf("%s: Ethernet address %s\n", sc->bce_dev.dv_xname,
|
||||
ether_sprintf(sc->enaddr));
|
||||
ether_sprintf(sc->enaddr));
|
||||
ether_ifattach(ifp, sc->enaddr);
|
||||
#if NRND > 0
|
||||
rnd_attach_source(&sc->rnd_source, sc->bce_dev.dv_xname,
|
||||
|
@ -521,7 +486,7 @@ bce_attach(struct device *parent, struct device *self, void *aux)
|
|||
static int
|
||||
bce_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
int s, error;
|
||||
int s, error;
|
||||
|
||||
s = splnet();
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
|
@ -543,16 +508,16 @@ bce_start(struct ifnet *ifp)
|
|||
{
|
||||
struct bce_softc *sc = ifp->if_softc;
|
||||
struct mbuf *m0;
|
||||
bus_dmamap_t dmamap;
|
||||
int txstart;
|
||||
int txsfree;
|
||||
int newpkts = 0;
|
||||
int error;
|
||||
bus_dmamap_t dmamap;
|
||||
int txstart;
|
||||
int txsfree;
|
||||
int newpkts = 0;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* do not start another if currently transmitting, and more
|
||||
* descriptors(tx slots) are needed for next packet.
|
||||
*/
|
||||
* do not start another if currently transmitting, and more
|
||||
* descriptors(tx slots) are needed for next packet.
|
||||
*/
|
||||
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
|
||||
return;
|
||||
|
||||
|
@ -563,12 +528,12 @@ bce_start(struct ifnet *ifp)
|
|||
txsfree = sc->bce_txin - sc->bce_txsnext - 1;
|
||||
|
||||
/*
|
||||
* Loop through the send queue, setting up transmit descriptors
|
||||
* until we drain the queue, or use up all available transmit
|
||||
* descriptors.
|
||||
*/
|
||||
* Loop through the send queue, setting up transmit descriptors
|
||||
* until we drain the queue, or use up all available transmit
|
||||
* descriptors.
|
||||
*/
|
||||
while (txsfree > 0) {
|
||||
int seg;
|
||||
int seg;
|
||||
|
||||
/* Grab a packet off the queue. */
|
||||
IFQ_POLL(&ifp->if_snd, m0);
|
||||
|
@ -621,7 +586,7 @@ bce_start(struct ifnet *ifp)
|
|||
/* Initialize the transmit descriptor(s). */
|
||||
txstart = sc->bce_txsnext;
|
||||
for (seg = 0; seg < dmamap->dm_nsegs; seg++) {
|
||||
u_int32_t ctrl;
|
||||
uint32_t ctrl;
|
||||
|
||||
ctrl = dmamap->dm_segs[seg].ds_len & CTRL_BC_MASK;
|
||||
if (seg == 0)
|
||||
|
@ -648,7 +613,7 @@ bce_start(struct ifnet *ifp)
|
|||
|
||||
/* Give the packet to the chip. */
|
||||
bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_DMA_DPTR,
|
||||
sc->bce_txsnext * sizeof(struct bce_dma_slot));
|
||||
sc->bce_txsnext * sizeof(struct bce_dma_slot));
|
||||
|
||||
newpkts++;
|
||||
|
||||
|
@ -688,14 +653,13 @@ bce_intr(void *xsc)
|
|||
{
|
||||
struct bce_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
u_int32_t intstatus;
|
||||
int wantinit;
|
||||
int handled = 0;
|
||||
uint32_t intstatus;
|
||||
int wantinit;
|
||||
int handled = 0;
|
||||
|
||||
sc = xsc;
|
||||
ifp = &sc->ethercom.ec_if;
|
||||
|
||||
|
||||
for (wantinit = 0; wantinit == 0;) {
|
||||
intstatus = bus_space_read_4(sc->bce_btag, sc->bce_bhandle,
|
||||
BCE_INT_STS);
|
||||
|
@ -729,10 +693,10 @@ bce_intr(void *xsc)
|
|||
}
|
||||
if (intstatus & I_RU)
|
||||
printf("%s: receive descriptor underflow\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
sc->bce_dev.dv_xname);
|
||||
if (intstatus & I_DE)
|
||||
printf("%s: descriptor protocol error\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
sc->bce_dev.dv_xname);
|
||||
if (intstatus & I_PD)
|
||||
printf("%s: data error\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
|
@ -766,9 +730,9 @@ bce_rxintr(struct bce_softc *sc)
|
|||
struct ifnet *ifp = &sc->ethercom.ec_if;
|
||||
struct rx_pph *pph;
|
||||
struct mbuf *m;
|
||||
int curr;
|
||||
int len;
|
||||
int i;
|
||||
int curr;
|
||||
int len;
|
||||
int i;
|
||||
|
||||
/* get pointer to active receive slot */
|
||||
curr = bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_DMA_RXSTATUS)
|
||||
|
@ -876,15 +840,15 @@ void
|
|||
bce_txintr(struct bce_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp = &sc->ethercom.ec_if;
|
||||
int curr;
|
||||
int i;
|
||||
int curr;
|
||||
int i;
|
||||
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
/*
|
||||
* Go through the Tx list and free mbufs for those
|
||||
* frames which have been transmitted.
|
||||
*/
|
||||
* Go through the Tx list and free mbufs for those
|
||||
* frames which have been transmitted.
|
||||
*/
|
||||
curr = bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_DMA_TXSTATUS) &
|
||||
RS_CD_MASK;
|
||||
curr = curr / sizeof(struct bce_dma_slot);
|
||||
|
@ -918,9 +882,9 @@ static int
|
|||
bce_init(struct ifnet *ifp)
|
||||
{
|
||||
struct bce_softc *sc = ifp->if_softc;
|
||||
u_int32_t reg_win;
|
||||
int error;
|
||||
int i;
|
||||
uint32_t reg_win;
|
||||
int error;
|
||||
int i;
|
||||
|
||||
/* Cancel any pending I/O. */
|
||||
bce_stop(ifp, 0);
|
||||
|
@ -985,9 +949,9 @@ bce_init(struct ifnet *ifp)
|
|||
sc->bce_ring_map->dm_segs[0].ds_addr + PAGE_SIZE + 0x40000000); /* MAGIC */
|
||||
|
||||
/*
|
||||
* Give the receive ring to the chip, and
|
||||
* start the receive DMA engine.
|
||||
*/
|
||||
* Give the receive ring to the chip, and
|
||||
* start the receive DMA engine.
|
||||
*/
|
||||
sc->bce_rxin = 0;
|
||||
|
||||
/* clear the rx descriptor ring */
|
||||
|
@ -1043,10 +1007,10 @@ bce_init(struct ifnet *ifp)
|
|||
|
||||
/* add a mac address to packet filter */
|
||||
void
|
||||
bce_add_mac(struct bce_softc *sc, u_int8_t *mac, u_long idx)
|
||||
bce_add_mac(struct bce_softc *sc, uint8_t *mac, u_long idx)
|
||||
{
|
||||
int i;
|
||||
u_int32_t rval;
|
||||
int i;
|
||||
uint32_t rval;
|
||||
|
||||
bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_FILT_LOW,
|
||||
mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5]);
|
||||
|
@ -1073,7 +1037,7 @@ static int
|
|||
bce_add_rxbuf(struct bce_softc *sc, int idx)
|
||||
{
|
||||
struct mbuf *m;
|
||||
int error;
|
||||
int error;
|
||||
|
||||
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
||||
if (m == NULL)
|
||||
|
@ -1109,7 +1073,7 @@ bce_add_rxbuf(struct bce_softc *sc, int idx)
|
|||
static void
|
||||
bce_rxdrain(struct bce_softc *sc)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < BCE_NRXDESC; i++) {
|
||||
if (sc->bce_cdata.bce_rx_chain[i] != NULL) {
|
||||
|
@ -1126,8 +1090,8 @@ static void
|
|||
bce_stop(struct ifnet *ifp, int disable)
|
||||
{
|
||||
struct bce_softc *sc = ifp->if_softc;
|
||||
int i;
|
||||
u_int32_t val;
|
||||
int i;
|
||||
uint32_t val;
|
||||
|
||||
/* Stop the 1 second timer */
|
||||
callout_stop(&sc->bce_timeout);
|
||||
|
@ -1178,9 +1142,9 @@ bce_stop(struct ifnet *ifp, int disable)
|
|||
static void
|
||||
bce_reset(struct bce_softc *sc)
|
||||
{
|
||||
u_int32_t val;
|
||||
u_int32_t sbval;
|
||||
int i;
|
||||
uint32_t val;
|
||||
uint32_t sbval;
|
||||
int i;
|
||||
|
||||
/* if SB core is up */
|
||||
sbval = bus_space_read_4(sc->bce_btag, sc->bce_bhandle,
|
||||
|
@ -1201,7 +1165,7 @@ bce_reset(struct bce_softc *sc)
|
|||
}
|
||||
if (i == 200)
|
||||
printf("%s: timed out disabling ethernet mac\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
sc->bce_dev.dv_xname);
|
||||
|
||||
/* reset the dma engines */
|
||||
bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_DMA_TXCTL, 0);
|
||||
|
@ -1234,9 +1198,9 @@ bce_reset(struct bce_softc *sc)
|
|||
}
|
||||
if (i == 200)
|
||||
printf("%s: timed out restting ethernet mac\n",
|
||||
sc->bce_dev.dv_xname);
|
||||
sc->bce_dev.dv_xname);
|
||||
} else {
|
||||
u_int32_t reg_win;
|
||||
uint32_t reg_win;
|
||||
|
||||
/* remap the pci registers to the Sonics config registers */
|
||||
|
||||
|
@ -1250,7 +1214,7 @@ bce_reset(struct bce_softc *sc)
|
|||
/* enable SB to PCI interrupt */
|
||||
bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_SBINTVEC,
|
||||
bus_space_read_4(sc->bce_btag, sc->bce_bhandle,
|
||||
BCE_SBINTVEC) |
|
||||
BCE_SBINTVEC) |
|
||||
SBIV_ENET0);
|
||||
|
||||
/* enable prefetch and bursts for sonics-to-pci translation 2 */
|
||||
|
@ -1261,7 +1225,7 @@ bce_reset(struct bce_softc *sc)
|
|||
|
||||
/* restore to ethernet register space */
|
||||
pci_conf_write(sc->bce_pa.pa_pc, sc->bce_pa.pa_tag, BCE_REG_WIN,
|
||||
reg_win);
|
||||
reg_win);
|
||||
}
|
||||
|
||||
/* disable SB core if not in reset */
|
||||
|
@ -1399,8 +1363,8 @@ int
|
|||
bce_mii_read(struct device *self, int phy, int reg)
|
||||
{
|
||||
struct bce_softc *sc = (struct bce_softc *) self;
|
||||
int i;
|
||||
u_int32_t val;
|
||||
int i;
|
||||
uint32_t val;
|
||||
|
||||
/* clear mii_int */
|
||||
bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_MI_STS, BCE_MIINTR);
|
||||
|
@ -1430,8 +1394,8 @@ void
|
|||
bce_mii_write(struct device *self, int phy, int reg, int val)
|
||||
{
|
||||
struct bce_softc *sc = (struct bce_softc *) self;
|
||||
int i;
|
||||
u_int32_t rval;
|
||||
int i;
|
||||
uint32_t rval;
|
||||
|
||||
/* clear mii_int */
|
||||
bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_MI_STS,
|
||||
|
@ -1463,7 +1427,7 @@ void
|
|||
bce_statchg(struct device *self)
|
||||
{
|
||||
struct bce_softc *sc = (struct bce_softc *) self;
|
||||
u_int32_t reg;
|
||||
uint32_t reg;
|
||||
|
||||
/* if needed, change register to match duplex mode */
|
||||
reg = bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_TX_CTL);
|
||||
|
@ -1475,9 +1439,9 @@ bce_statchg(struct device *self)
|
|||
reg & ~EXC_FD);
|
||||
|
||||
/*
|
||||
* Enable activity led.
|
||||
* XXX This should be in a phy driver, but not currently.
|
||||
*/
|
||||
* Enable activity led.
|
||||
* XXX This should be in a phy driver, but not currently.
|
||||
*/
|
||||
bce_mii_write((struct device *) sc, 1, 26, /* MAGIC */
|
||||
bce_mii_read((struct device *) sc, 1, 26) & 0x7fff); /* MAGIC */
|
||||
/* enable traffic meter led mode */
|
||||
|
|
Loading…
Reference in New Issue