svn commit: r202299 - stable/8/sys/dev/ste
Pyun YongHyeon
yongari at FreeBSD.org
Thu Jan 14 20:47:49 UTC 2010
Author: yongari
Date: Thu Jan 14 20:47:49 2010
New Revision: 202299
URL: http://svn.freebsd.org/changeset/base/202299
Log:
MFC r200798,200801,200803-200804,200808,200810
r200798:
Use ANSI function definations.
r200801:
o Remove unnecessary return statement.
o Remove register keyword.
r200803:
s/u_intXX_t/uintXX_t/g
r200804:
Remove trailing white spaces.
r200808:
style(9)
r200810:
Sort function prototyes.
Modified:
stable/8/sys/dev/ste/if_ste.c
stable/8/sys/dev/ste/if_stereg.h
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/dev/ste/if_ste.c
==============================================================================
--- stable/8/sys/dev/ste/if_ste.c Thu Jan 14 20:40:37 2010 (r202298)
+++ stable/8/sys/dev/ste/if_ste.c Thu Jan 14 20:47:49 2010 (r202299)
@@ -91,45 +91,44 @@ static struct ste_type ste_devs[] = {
{ 0, 0, NULL }
};
-static int ste_probe(device_t);
-static int ste_attach(device_t);
-static int ste_detach(device_t);
-static void ste_init(void *);
-static void ste_init_locked(struct ste_softc *);
-static void ste_intr(void *);
-static void ste_rxeoc(struct ste_softc *);
-static int ste_rxeof(struct ste_softc *);
-static void ste_txeoc(struct ste_softc *);
-static void ste_txeof(struct ste_softc *);
-static void ste_stats_update(void *);
-static void ste_stop(struct ste_softc *);
-static void ste_reset(struct ste_softc *);
-static int ste_ioctl(struct ifnet *, u_long, caddr_t);
-static int ste_encap(struct ste_softc *, struct ste_chain *, struct mbuf *);
-static void ste_start(struct ifnet *);
-static void ste_start_locked(struct ifnet *);
-static void ste_watchdog(struct ste_softc *);
-static int ste_shutdown(device_t);
-static int ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *,
- struct mbuf *);
-static int ste_ifmedia_upd(struct ifnet *);
-static void ste_ifmedia_upd_locked(struct ifnet *);
-static void ste_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-
-static void ste_mii_sync(struct ste_softc *);
-static void ste_mii_send(struct ste_softc *, u_int32_t, int);
-static int ste_mii_readreg(struct ste_softc *, struct ste_mii_frame *);
-static int ste_mii_writereg(struct ste_softc *, struct ste_mii_frame *);
-static int ste_miibus_readreg(device_t, int, int);
-static int ste_miibus_writereg(device_t, int, int, int);
-static void ste_miibus_statchg(device_t);
-
-static int ste_eeprom_wait(struct ste_softc *);
-static int ste_read_eeprom(struct ste_softc *, caddr_t, int, int, int);
-static void ste_wait(struct ste_softc *);
-static void ste_setmulti(struct ste_softc *);
-static int ste_init_rx_list(struct ste_softc *);
-static void ste_init_tx_list(struct ste_softc *);
+static int ste_attach(device_t);
+static int ste_detach(device_t);
+static int ste_probe(device_t);
+static int ste_shutdown(device_t);
+
+static int ste_eeprom_wait(struct ste_softc *);
+static int ste_encap(struct ste_softc *, struct ste_chain *, struct mbuf *);
+static int ste_ifmedia_upd(struct ifnet *);
+static void ste_ifmedia_upd_locked(struct ifnet *);
+static void ste_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static void ste_init(void *);
+static void ste_init_locked(struct ste_softc *);
+static int ste_init_rx_list(struct ste_softc *);
+static void ste_init_tx_list(struct ste_softc *);
+static void ste_intr(void *);
+static int ste_ioctl(struct ifnet *, u_long, caddr_t);
+static int ste_mii_readreg(struct ste_softc *, struct ste_mii_frame *);
+static void ste_mii_send(struct ste_softc *, uint32_t, int);
+static void ste_mii_sync(struct ste_softc *);
+static int ste_mii_writereg(struct ste_softc *, struct ste_mii_frame *);
+static int ste_miibus_readreg(device_t, int, int);
+static void ste_miibus_statchg(device_t);
+static int ste_miibus_writereg(device_t, int, int, int);
+static int ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *,
+ struct mbuf *);
+static int ste_read_eeprom(struct ste_softc *, caddr_t, int, int, int);
+static void ste_reset(struct ste_softc *);
+static void ste_rxeoc(struct ste_softc *);
+static int ste_rxeof(struct ste_softc *);
+static void ste_setmulti(struct ste_softc *);
+static void ste_start(struct ifnet *);
+static void ste_start_locked(struct ifnet *);
+static void ste_stats_update(void *);
+static void ste_stop(struct ste_softc *);
+static void ste_txeoc(struct ste_softc *);
+static void ste_txeof(struct ste_softc *);
+static void ste_wait(struct ste_softc *);
+static void ste_watchdog(struct ste_softc *);
#ifdef STE_USEIOSPACE
#define STE_RES SYS_RES_IOPORT
@@ -194,16 +193,15 @@ SYSCTL_INT(_hw_ste, OID_AUTO, rxsyncs, C
#define MII_SET(x) STE_SETBIT1(sc, STE_PHYCTL, x)
-#define MII_CLR(x) STE_CLRBIT1(sc, STE_PHYCTL, x)
+#define MII_CLR(x) STE_CLRBIT1(sc, STE_PHYCTL, x)
/*
* Sync the PHYs by setting data bit and strobing the clock 32 times.
*/
static void
-ste_mii_sync(sc)
- struct ste_softc *sc;
+ste_mii_sync(struct ste_softc *sc)
{
- register int i;
+ int i;
MII_SET(STE_PHYCTL_MDIR|STE_PHYCTL_MDATA);
@@ -213,20 +211,15 @@ ste_mii_sync(sc)
MII_CLR(STE_PHYCTL_MCLK);
DELAY(1);
}
-
- return;
}
/*
* Clock a series of bits through the MII.
*/
static void
-ste_mii_send(sc, bits, cnt)
- struct ste_softc *sc;
- u_int32_t bits;
- int cnt;
+ste_mii_send(struct ste_softc *sc, uint32_t bits, int cnt)
{
- int i;
+ int i;
MII_CLR(STE_PHYCTL_MCLK);
@@ -247,12 +240,9 @@ ste_mii_send(sc, bits, cnt)
* Read an PHY register through the MII.
*/
static int
-ste_mii_readreg(sc, frame)
- struct ste_softc *sc;
- struct ste_mii_frame *frame;
-
+ste_mii_readreg(struct ste_softc *sc, struct ste_mii_frame *frame)
{
- int i, ack;
+ int i, ack;
/*
* Set up frame for RX.
@@ -261,7 +251,7 @@ ste_mii_readreg(sc, frame)
frame->mii_opcode = STE_MII_READOP;
frame->mii_turnaround = 0;
frame->mii_data = 0;
-
+
CSR_WRITE_2(sc, STE_PHYCTL, 0);
/*
* Turn on data xmit.
@@ -299,7 +289,7 @@ ste_mii_readreg(sc, frame)
* need to clock through 16 cycles to keep the PHY(s) in sync.
*/
if (ack) {
- for(i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++) {
MII_CLR(STE_PHYCTL_MCLK);
DELAY(1);
MII_SET(STE_PHYCTL_MCLK);
@@ -328,18 +318,15 @@ fail:
DELAY(1);
if (ack)
- return(1);
- return(0);
+ return (1);
+ return (0);
}
/*
* Write to a PHY register through the MII.
*/
static int
-ste_mii_writereg(sc, frame)
- struct ste_softc *sc;
- struct ste_mii_frame *frame;
-
+ste_mii_writereg(struct ste_softc *sc, struct ste_mii_frame *frame)
{
/*
@@ -349,7 +336,7 @@ ste_mii_writereg(sc, frame)
frame->mii_stdelim = STE_MII_STARTDELIM;
frame->mii_opcode = STE_MII_WRITEOP;
frame->mii_turnaround = STE_MII_TURNAROUND;
-
+
/*
* Turn on data output.
*/
@@ -375,16 +362,14 @@ ste_mii_writereg(sc, frame)
*/
MII_CLR(STE_PHYCTL_MDIR);
- return(0);
+ return (0);
}
static int
-ste_miibus_readreg(dev, phy, reg)
- device_t dev;
- int phy, reg;
+ste_miibus_readreg(device_t dev, int phy, int reg)
{
- struct ste_softc *sc;
- struct ste_mii_frame frame;
+ struct ste_softc *sc;
+ struct ste_mii_frame frame;
sc = device_get_softc(dev);
@@ -397,16 +382,14 @@ ste_miibus_readreg(dev, phy, reg)
frame.mii_regaddr = reg;
ste_mii_readreg(sc, &frame);
- return(frame.mii_data);
+ return (frame.mii_data);
}
static int
-ste_miibus_writereg(dev, phy, reg, data)
- device_t dev;
- int phy, reg, data;
+ste_miibus_writereg(device_t dev, int phy, int reg, int data)
{
- struct ste_softc *sc;
- struct ste_mii_frame frame;
+ struct ste_softc *sc;
+ struct ste_mii_frame frame;
sc = device_get_softc(dev);
bzero((char *)&frame, sizeof(frame));
@@ -417,15 +400,14 @@ ste_miibus_writereg(dev, phy, reg, data)
ste_mii_writereg(sc, &frame);
- return(0);
+ return (0);
}
static void
-ste_miibus_statchg(dev)
- device_t dev;
+ste_miibus_statchg(device_t dev)
{
- struct ste_softc *sc;
- struct mii_data *mii;
+ struct ste_softc *sc;
+ struct mii_data *mii;
sc = device_get_softc(dev);
@@ -436,30 +418,26 @@ ste_miibus_statchg(dev)
} else {
STE_CLRBIT2(sc, STE_MACCTL0, STE_MACCTL0_FULLDUPLEX);
}
-
- return;
}
-
+
static int
-ste_ifmedia_upd(ifp)
- struct ifnet *ifp;
+ste_ifmedia_upd(struct ifnet *ifp)
{
- struct ste_softc *sc;
+ struct ste_softc *sc;
sc = ifp->if_softc;
STE_LOCK(sc);
ste_ifmedia_upd_locked(ifp);
STE_UNLOCK(sc);
- return(0);
+ return (0);
}
static void
-ste_ifmedia_upd_locked(ifp)
- struct ifnet *ifp;
+ste_ifmedia_upd_locked(struct ifnet *ifp)
{
- struct ste_softc *sc;
- struct mii_data *mii;
+ struct ste_softc *sc;
+ struct mii_data *mii;
sc = ifp->if_softc;
STE_LOCK_ASSERT(sc);
@@ -474,12 +452,10 @@ ste_ifmedia_upd_locked(ifp)
}
static void
-ste_ifmedia_sts(ifp, ifmr)
- struct ifnet *ifp;
- struct ifmediareq *ifmr;
+ste_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
{
- struct ste_softc *sc;
- struct mii_data *mii;
+ struct ste_softc *sc;
+ struct mii_data *mii;
sc = ifp->if_softc;
mii = device_get_softc(sc->ste_miibus);
@@ -489,15 +465,12 @@ ste_ifmedia_sts(ifp, ifmr)
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
STE_UNLOCK(sc);
-
- return;
}
static void
-ste_wait(sc)
- struct ste_softc *sc;
+ste_wait(struct ste_softc *sc)
{
- register int i;
+ int i;
for (i = 0; i < STE_TIMEOUT; i++) {
if (!(CSR_READ_4(sc, STE_DMACTL) & STE_DMACTL_DMA_HALTINPROG))
@@ -506,8 +479,6 @@ ste_wait(sc)
if (i == STE_TIMEOUT)
device_printf(sc->ste_dev, "command never completed!\n");
-
- return;
}
/*
@@ -515,10 +486,9 @@ ste_wait(sc)
* it a command.
*/
static int
-ste_eeprom_wait(sc)
- struct ste_softc *sc;
+ste_eeprom_wait(struct ste_softc *sc)
{
- int i;
+ int i;
DELAY(1000);
@@ -531,10 +501,10 @@ ste_eeprom_wait(sc)
if (i == 100) {
device_printf(sc->ste_dev, "eeprom failed to come ready\n");
- return(1);
+ return (1);
}
- return(0);
+ return (0);
}
/*
@@ -542,18 +512,13 @@ ste_eeprom_wait(sc)
* data is stored in the EEPROM in network byte order.
*/
static int
-ste_read_eeprom(sc, dest, off, cnt, swap)
- struct ste_softc *sc;
- caddr_t dest;
- int off;
- int cnt;
- int swap;
+ste_read_eeprom(struct ste_softc *sc, caddr_t dest, int off, int cnt, int swap)
{
- int err = 0, i;
- u_int16_t word = 0, *ptr;
+ uint16_t word, *ptr;
+ int err = 0, i;
if (ste_eeprom_wait(sc))
- return(1);
+ return (1);
for (i = 0; i < cnt; i++) {
CSR_WRITE_2(sc, STE_EEPROM_CTL, STE_EEOPCODE_READ | (off + i));
@@ -561,24 +526,23 @@ ste_read_eeprom(sc, dest, off, cnt, swap
if (err)
break;
word = CSR_READ_2(sc, STE_EEPROM_DATA);
- ptr = (u_int16_t *)(dest + (i * 2));
+ ptr = (uint16_t *)(dest + (i * 2));
if (swap)
*ptr = ntohs(word);
else
- *ptr = word;
+ *ptr = word;
}
- return(err ? 1 : 0);
+ return (err ? 1 : 0);
}
static void
-ste_setmulti(sc)
- struct ste_softc *sc;
+ste_setmulti(struct ste_softc *sc)
{
- struct ifnet *ifp;
- int h = 0;
- u_int32_t hashes[2] = { 0, 0 };
- struct ifmultiaddr *ifma;
+ struct ifnet *ifp;
+ struct ifmultiaddr *ifma;
+ uint32_t hashes[2] = { 0, 0 };
+ int h;
ifp = sc->ste_ifp;
if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
@@ -613,8 +577,6 @@ ste_setmulti(sc)
CSR_WRITE_2(sc, STE_MAR3, (hashes[1] >> 16) & 0xFFFF);
STE_CLRBIT1(sc, STE_RX_MODE, STE_RXMODE_ALLMULTI);
STE_SETBIT1(sc, STE_RX_MODE, STE_RXMODE_MULTIHASH);
-
- return;
}
#ifdef DEVICE_POLLING
@@ -650,7 +612,7 @@ ste_poll_locked(struct ifnet *ifp, enum
ste_start_locked(ifp);
if (cmd == POLL_AND_CHECK_STATUS) {
- u_int16_t status;
+ uint16_t status;
status = CSR_READ_2(sc, STE_ISR_ACK);
@@ -675,12 +637,11 @@ ste_poll_locked(struct ifnet *ifp, enum
#endif /* DEVICE_POLLING */
static void
-ste_intr(xsc)
- void *xsc;
+ste_intr(void *xsc)
{
- struct ste_softc *sc;
- struct ifnet *ifp;
- u_int16_t status;
+ struct ste_softc *sc;
+ struct ifnet *ifp;
+ uint16_t status;
sc = xsc;
STE_LOCK(sc);
@@ -738,8 +699,6 @@ ste_intr(xsc)
ste_start_locked(ifp);
STE_UNLOCK(sc);
-
- return;
}
static void
@@ -770,20 +729,19 @@ ste_rxeoc(struct ste_softc *sc)
* the higher level protocols.
*/
static int
-ste_rxeof(sc)
- struct ste_softc *sc;
+ste_rxeof(struct ste_softc *sc)
{
- struct mbuf *m;
- struct ifnet *ifp;
- struct ste_chain_onefrag *cur_rx;
- int total_len = 0, count=0, rx_npkts = 0;
- u_int32_t rxstat;
+ struct mbuf *m;
+ struct ifnet *ifp;
+ struct ste_chain_onefrag *cur_rx;
+ uint32_t rxstat;
+ int total_len = 0, count = 0, rx_npkts = 0;
STE_LOCK_ASSERT(sc);
ifp = sc->ste_ifp;
- while((rxstat = sc->ste_cdata.ste_rx_head->ste_ptr->ste_status)
+ while ((rxstat = sc->ste_cdata.ste_rx_head->ste_ptr->ste_status)
& STE_RXSTAT_DMADONE) {
#ifdef DEVICE_POLLING
if (ifp->if_capenable & IFCAP_POLLING) {
@@ -824,7 +782,7 @@ ste_rxeof(sc)
continue;
}
- /* No errors; receive the packet. */
+ /* No errors; receive the packet. */
m = cur_rx->ste_mbuf;
total_len = cur_rx->ste_ptr->ste_status & STE_RXSTAT_FRAMELEN;
@@ -858,11 +816,10 @@ ste_rxeof(sc)
}
static void
-ste_txeoc(sc)
- struct ste_softc *sc;
+ste_txeoc(struct ste_softc *sc)
{
- u_int8_t txstat;
- struct ifnet *ifp;
+ struct ifnet *ifp;
+ uint8_t txstat;
ifp = sc->ste_ifp;
@@ -893,22 +850,19 @@ ste_txeoc(sc)
ste_init_locked(sc);
CSR_WRITE_2(sc, STE_TX_STATUS, txstat);
}
-
- return;
}
static void
-ste_txeof(sc)
- struct ste_softc *sc;
+ste_txeof(struct ste_softc *sc)
{
- struct ste_chain *cur_tx;
- struct ifnet *ifp;
- int idx;
+ struct ifnet *ifp;
+ struct ste_chain *cur_tx;
+ int idx;
ifp = sc->ste_ifp;
idx = sc->ste_cdata.ste_tx_cons;
- while(idx != sc->ste_cdata.ste_tx_prod) {
+ while (idx != sc->ste_cdata.ste_tx_prod) {
cur_tx = &sc->ste_cdata.ste_tx_chain[idx];
if (!(cur_tx->ste_ptr->ste_ctl & STE_TXCTL_DMADONE))
@@ -928,12 +882,11 @@ ste_txeof(sc)
}
static void
-ste_stats_update(xsc)
- void *xsc;
+ste_stats_update(void *xsc)
{
- struct ste_softc *sc;
- struct ifnet *ifp;
- struct mii_data *mii;
+ struct ste_softc *sc;
+ struct ifnet *ifp;
+ struct mii_data *mii;
sc = xsc;
STE_LOCK_ASSERT(sc);
@@ -963,8 +916,6 @@ ste_stats_update(xsc)
if (sc->ste_timer > 0 && --sc->ste_timer == 0)
ste_watchdog(sc);
callout_reset(&sc->ste_stat_callout, hz, ste_stats_update, sc);
-
- return;
}
@@ -973,14 +924,13 @@ ste_stats_update(xsc)
* IDs against our list and return a device name if we find a match.
*/
static int
-ste_probe(dev)
- device_t dev;
+ste_probe(device_t dev)
{
- struct ste_type *t;
+ struct ste_type *t;
t = ste_devs;
- while(t->ste_name != NULL) {
+ while (t->ste_name != NULL) {
if ((pci_get_vendor(dev) == t->ste_vid) &&
(pci_get_device(dev) == t->ste_did)) {
device_set_desc(dev, t->ste_name);
@@ -989,7 +939,7 @@ ste_probe(dev)
t++;
}
- return(ENXIO);
+ return (ENXIO);
}
/*
@@ -997,13 +947,12 @@ ste_probe(dev)
* setup and ethernet/BPF attach.
*/
static int
-ste_attach(dev)
- device_t dev;
+ste_attach(device_t dev)
{
- struct ste_softc *sc;
- struct ifnet *ifp;
- int error = 0, rid;
- u_char eaddr[6];
+ struct ste_softc *sc;
+ struct ifnet *ifp;
+ u_char eaddr[6];
+ int error = 0, rid;
sc = device_get_softc(dev);
sc->ste_dev = dev;
@@ -1132,7 +1081,7 @@ fail:
if (error)
ste_detach(dev);
- return(error);
+ return (error);
}
/*
@@ -1143,11 +1092,10 @@ fail:
* allocated.
*/
static int
-ste_detach(dev)
- device_t dev;
+ste_detach(device_t dev)
{
- struct ste_softc *sc;
- struct ifnet *ifp;
+ struct ste_softc *sc;
+ struct ifnet *ifp;
sc = device_get_softc(dev);
KASSERT(mtx_initialized(&sc->ste_mtx), ("ste mutex not initialized"));
@@ -1187,25 +1135,22 @@ ste_detach(dev)
mtx_destroy(&sc->ste_mtx);
- return(0);
+ return (0);
}
static int
-ste_newbuf(sc, c, m)
- struct ste_softc *sc;
- struct ste_chain_onefrag *c;
- struct mbuf *m;
+ste_newbuf(struct ste_softc *sc, struct ste_chain_onefrag *c, struct mbuf *m)
{
- struct mbuf *m_new = NULL;
+ struct mbuf *m_new = NULL;
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL)
- return(ENOBUFS);
+ return (ENOBUFS);
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
m_freem(m_new);
- return(ENOBUFS);
+ return (ENOBUFS);
}
m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
} else {
@@ -1221,16 +1166,15 @@ ste_newbuf(sc, c, m)
c->ste_ptr->ste_frag.ste_addr = vtophys(mtod(m_new, caddr_t));
c->ste_ptr->ste_frag.ste_len = (1536 + ETHER_VLAN_ENCAP_LEN) | STE_FRAG_LAST;
- return(0);
+ return (0);
}
static int
-ste_init_rx_list(sc)
- struct ste_softc *sc;
+ste_init_rx_list(struct ste_softc *sc)
{
- struct ste_chain_data *cd;
- struct ste_list_data *ld;
- int i;
+ struct ste_chain_data *cd;
+ struct ste_list_data *ld;
+ int i;
cd = &sc->ste_cdata;
ld = sc->ste_ldata;
@@ -1238,7 +1182,7 @@ ste_init_rx_list(sc)
for (i = 0; i < STE_RX_LIST_CNT; i++) {
cd->ste_rx_chain[i].ste_ptr = &ld->ste_rx_list[i];
if (ste_newbuf(sc, &cd->ste_rx_chain[i], NULL) == ENOBUFS)
- return(ENOBUFS);
+ return (ENOBUFS);
if (i == (STE_RX_LIST_CNT - 1)) {
cd->ste_rx_chain[i].ste_next =
&cd->ste_rx_chain[0];
@@ -1255,16 +1199,15 @@ ste_init_rx_list(sc)
cd->ste_rx_head = &cd->ste_rx_chain[0];
- return(0);
+ return (0);
}
static void
-ste_init_tx_list(sc)
- struct ste_softc *sc;
+ste_init_tx_list(struct ste_softc *sc)
{
- struct ste_chain_data *cd;
- struct ste_list_data *ld;
- int i;
+ struct ste_chain_data *cd;
+ struct ste_list_data *ld;
+ int i;
cd = &sc->ste_cdata;
ld = sc->ste_ldata;
@@ -1283,15 +1226,12 @@ ste_init_tx_list(sc)
cd->ste_tx_prod = 0;
cd->ste_tx_cons = 0;
-
- return;
}
static void
-ste_init(xsc)
- void *xsc;
+ste_init(void *xsc)
{
- struct ste_softc *sc;
+ struct ste_softc *sc;
sc = xsc;
STE_LOCK(sc);
@@ -1300,11 +1240,10 @@ ste_init(xsc)
}
static void
-ste_init_locked(sc)
- struct ste_softc *sc;
+ste_init_locked(struct ste_softc *sc)
{
- int i;
- struct ifnet *ifp;
+ struct ifnet *ifp;
+ int i;
STE_LOCK_ASSERT(sc);
ifp = sc->ste_ifp;
@@ -1394,7 +1333,7 @@ ste_init_locked(sc)
/* Disable interrupts if we are polling. */
if (ifp->if_capenable & IFCAP_POLLING)
CSR_WRITE_2(sc, STE_IMR, 0);
- else
+ else
#endif
/* Enable interrupts. */
CSR_WRITE_2(sc, STE_IMR, STE_INTRS);
@@ -1408,16 +1347,13 @@ ste_init_locked(sc)
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
callout_reset(&sc->ste_stat_callout, hz, ste_stats_update, sc);
-
- return;
}
static void
-ste_stop(sc)
- struct ste_softc *sc;
+ste_stop(struct ste_softc *sc)
{
- int i;
- struct ifnet *ifp;
+ struct ifnet *ifp;
+ int i;
STE_LOCK_ASSERT(sc);
ifp = sc->ste_ifp;
@@ -1432,8 +1368,8 @@ ste_stop(sc)
STE_SETBIT2(sc, STE_DMACTL, STE_DMACTL_TXDMA_STALL);
STE_SETBIT2(sc, STE_DMACTL, STE_DMACTL_RXDMA_STALL);
ste_wait(sc);
- /*
- * Try really hard to stop the RX engine or under heavy RX
+ /*
+ * Try really hard to stop the RX engine or under heavy RX
* data chip will write into de-allocated memory.
*/
ste_reset(sc);
@@ -1455,15 +1391,12 @@ ste_stop(sc)
}
bzero(sc->ste_ldata, sizeof(struct ste_list_data));
-
- return;
}
static void
-ste_reset(sc)
- struct ste_softc *sc;
+ste_reset(struct ste_softc *sc)
{
- int i;
+ int i;
STE_SETBIT4(sc, STE_ASICCTL,
STE_ASICCTL_GLOBAL_RESET|STE_ASICCTL_RX_RESET|
@@ -1481,25 +1414,20 @@ ste_reset(sc)
if (i == STE_TIMEOUT)
device_printf(sc->ste_dev, "global reset never completed\n");
-
- return;
}
static int
-ste_ioctl(ifp, command, data)
- struct ifnet *ifp;
- u_long command;
- caddr_t data;
-{
- struct ste_softc *sc;
- struct ifreq *ifr;
- struct mii_data *mii;
- int error = 0;
+ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
+{
+ struct ste_softc *sc;
+ struct ifreq *ifr;
+ struct mii_data *mii;
+ int error = 0;
sc = ifp->if_softc;
ifr = (struct ifreq *)data;
- switch(command) {
+ switch (command) {
case SIOCSIFFLAGS:
STE_LOCK(sc);
if (ifp->if_flags & IFF_UP) {
@@ -1513,7 +1441,7 @@ ste_ioctl(ifp, command, data)
sc->ste_if_flags & IFF_PROMISC) {
STE_CLRBIT1(sc, STE_RX_MODE,
STE_RXMODE_PROMISC);
- }
+ }
if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
(ifp->if_flags ^ sc->ste_if_flags) & IFF_ALLMULTI)
ste_setmulti(sc);
@@ -1547,14 +1475,14 @@ ste_ioctl(ifp, command, data)
!(ifp->if_capenable & IFCAP_POLLING)) {
error = ether_poll_register(ste_poll, ifp);
if (error)
- return(error);
+ return (error);
STE_LOCK(sc);
/* Disable interrupts */
CSR_WRITE_2(sc, STE_IMR, 0);
ifp->if_capenable |= IFCAP_POLLING;
STE_UNLOCK(sc);
return (error);
-
+
}
if (!(ifr->ifr_reqcap & IFCAP_POLLING) &&
ifp->if_capenable & IFCAP_POLLING) {
@@ -1573,19 +1501,16 @@ ste_ioctl(ifp, command, data)
break;
}
- return(error);
+ return (error);
}
static int
-ste_encap(sc, c, m_head)
- struct ste_softc *sc;
- struct ste_chain *c;
- struct mbuf *m_head;
-{
- int frag = 0;
- struct ste_frag *f = NULL;
- struct mbuf *m;
- struct ste_desc *d;
+ste_encap(struct ste_softc *sc, struct ste_chain *c, struct mbuf *m_head)
+{
+ struct mbuf *m;
+ struct ste_desc *d;
+ struct ste_frag *f = NULL;
+ int frag = 0;
d = c->ste_ptr;
d->ste_ctl = 0;
@@ -1623,14 +1548,13 @@ encap_retry:
d->ste_frags[frag - 1].ste_len |= STE_FRAG_LAST;
d->ste_ctl = 1;
- return(0);
+ return (0);
}
static void
-ste_start(ifp)
- struct ifnet *ifp;
+ste_start(struct ifnet *ifp)
{
- struct ste_softc *sc;
+ struct ste_softc *sc;
sc = ifp->if_softc;
STE_LOCK(sc);
@@ -1639,13 +1563,12 @@ ste_start(ifp)
}
static void
-ste_start_locked(ifp)
- struct ifnet *ifp;
+ste_start_locked(struct ifnet *ifp)
{
- struct ste_softc *sc;
- struct mbuf *m_head = NULL;
- struct ste_chain *cur_tx;
- int idx;
+ struct ste_softc *sc;
+ struct ste_chain *cur_tx;
+ struct mbuf *m_head = NULL;
+ int idx;
sc = ifp->if_softc;
STE_LOCK_ASSERT(sc);
@@ -1658,7 +1581,7 @@ ste_start_locked(ifp)
idx = sc->ste_cdata.ste_tx_prod;
- while(sc->ste_cdata.ste_tx_chain[idx].ste_mbuf == NULL) {
+ while (sc->ste_cdata.ste_tx_chain[idx].ste_mbuf == NULL) {
/*
* We cannot re-use the last (free) descriptor;
* the chip may not have read its ste_next yet.
@@ -1691,7 +1614,7 @@ ste_start_locked(ifp)
/* Set TX polling interval to start TX engine */
CSR_WRITE_1(sc, STE_TX_DMAPOLL_PERIOD, 64);
-
+
STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_TXDMA_UNSTALL);
ste_wait(sc);
}else{
@@ -1712,14 +1635,12 @@ ste_start_locked(ifp)
sc->ste_timer = 5;
}
sc->ste_cdata.ste_tx_prod = idx;
-
- return;
}
static void
ste_watchdog(struct ste_softc *sc)
{
- struct ifnet *ifp;
+ struct ifnet *ifp;
ifp = sc->ste_ifp;
STE_LOCK_ASSERT(sc);
@@ -1736,15 +1657,12 @@ ste_watchdog(struct ste_softc *sc)
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
ste_start_locked(ifp);
-
- return;
}
static int
-ste_shutdown(dev)
- device_t dev;
+ste_shutdown(device_t dev)
{
- struct ste_softc *sc;
+ struct ste_softc *sc;
sc = device_get_softc(dev);
Modified: stable/8/sys/dev/ste/if_stereg.h
==============================================================================
--- stable/8/sys/dev/ste/if_stereg.h Thu Jan 14 20:40:37 2010 (r202298)
+++ stable/8/sys/dev/ste/if_stereg.h Thu Jan 14 20:47:49 2010 (r202299)
@@ -96,7 +96,7 @@
#define STE_LATE_COLLS 0x75
#define STE_MULTI_COLLS 0x76
-#define STE_SINGLE_COLLS 0x77
+#define STE_SINGLE_COLLS 0x77
#define STE_DMACTL_RXDMA_STOPPED 0x00000001
#define STE_DMACTL_TXDMA_CMPREQ 0x00000002
@@ -386,27 +386,27 @@
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-stable
mailing list