Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips/sibyte/dev Use aprint_* and misc cleanup.
details: https://anonhg.NetBSD.org/src/rev/bc0d36c211fe
branches: trunk
changeset: 761565:bc0d36c211fe
user: matt <matt%NetBSD.org@localhost>
date: Tue Feb 01 06:13:08 2011 +0000
description:
Use aprint_* and misc cleanup.
diffstat:
sys/arch/mips/sibyte/dev/sbgbusvar.h | 4 +-
sys/arch/mips/sibyte/dev/sbjcn.c | 45 +++++++-----
sys/arch/mips/sibyte/dev/sbmac.c | 125 ++++++++++++++++------------------
sys/arch/mips/sibyte/dev/sbobio.c | 6 +-
sys/arch/mips/sibyte/dev/sbscd.c | 6 +-
sys/arch/mips/sibyte/dev/sbscn.c | 28 ++++---
sys/arch/mips/sibyte/dev/sbsmbus.c | 9 +-
sys/arch/mips/sibyte/dev/sbtimer.c | 29 +++----
sys/arch/mips/sibyte/dev/sbwdog.c | 9 +-
9 files changed, 131 insertions(+), 130 deletions(-)
diffs (truncated from 761 to 300 lines):
diff -r 84bd693d1cfd -r bc0d36c211fe sys/arch/mips/sibyte/dev/sbgbusvar.h
--- a/sys/arch/mips/sibyte/dev/sbgbusvar.h Tue Feb 01 03:16:54 2011 +0000
+++ b/sys/arch/mips/sibyte/dev/sbgbusvar.h Tue Feb 01 06:13:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbgbusvar.h,v 1.2 2003/02/07 17:38:49 cgd Exp $ */
+/* $NetBSD: sbgbusvar.h,v 1.3 2011/02/01 06:13:08 matt Exp $ */
/*
* Copyright 2000, 2001
@@ -38,7 +38,7 @@
struct sbgbus_attach_args {
/* from locators */
u_int sga_chipsel;
- u_int sga_offset;
+ u_long sga_offset;
u_int sga_intr[2];
/* calculated by sbgbus */
diff -r 84bd693d1cfd -r bc0d36c211fe sys/arch/mips/sibyte/dev/sbjcn.c
--- a/sys/arch/mips/sibyte/dev/sbjcn.c Tue Feb 01 03:16:54 2011 +0000
+++ b/sys/arch/mips/sibyte/dev/sbjcn.c Tue Feb 01 06:13:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbjcn.c,v 1.25 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbjcn.c,v 1.26 2011/02/01 06:13:08 matt Exp $ */
/*
* Copyright 2000, 2001
@@ -103,7 +103,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.25 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.26 2011/02/01 06:13:08 matt Exp $");
#define SBJCN_DEBUG
@@ -237,9 +237,9 @@
static int
sbjcn_match(device_t parent, cfdata_t match, void *aux)
{
- struct sbscd_attach_args *sap = aux;
+ struct sbscd_attach_args *sa = aux;
- if (sap->sa_locs.sa_type != SBSCD_DEVTYPE_JTAGCONS)
+ if (sa->sa_locs.sa_type != SBSCD_DEVTYPE_JTAGCONS)
return (0);
return 1;
@@ -249,13 +249,13 @@
sbjcn_attach(device_t parent, device_t self, void *aux)
{
struct sbjcn_softc *sc = device_private(self);
- struct sbscd_attach_args *sap = aux;
+ struct sbscd_attach_args *sa = aux;
sc->sc_dev = self;
- sc->sc_addr = sap->sa_base + sap->sa_locs.sa_offset;
+ sc->sc_addr = sa->sa_base + sa->sa_locs.sa_offset;
- printf("\n");
- sbjcn_attach_channel(sc, 0, sap->sa_locs.sa_intr[0]);
+ aprint_normal("\n");
+ sbjcn_attach_channel(sc, 0, sa->sa_locs.sa_intr[0]);
}
void
@@ -312,8 +312,9 @@
ch->ch_tty = tp;
ch->ch_rbuf = malloc(sbjcn_rbuf_size << 1, M_DEVBUF, M_NOWAIT);
if (ch->ch_rbuf == NULL) {
- printf("%s: channel %d: unable to allocate ring buffer\n",
- sc->sc_dev.dv_xname, chan);
+ aprint_error_dev(sc->sc_dev,
+ "channel %d: unable to allocate ring buffer\n",
+ chan);
return;
}
ch->ch_ebuf = ch->ch_rbuf + (sbjcn_rbuf_size << 1);
@@ -327,9 +328,10 @@
maj = cdevsw_lookup_major(&sbjcn_cdevsw);
cn_tab->cn_dev = makedev(maj,
- (device_unit(&sc->sc_dev) << 1) + chan);
+ (device_unit(sc->sc_dev) << 1) + chan);
- printf("%s: channel %d: console\n", sc->sc_dev.dv_xname, chan);
+ aprint_normal_dev(sc->sc_dev, "channel %d: %s\n",
+ chan, "console");
}
#ifdef KGDB
@@ -342,7 +344,8 @@
sbjcn_kgdb_attached = 1;
SET(ch->ch_hwflags, SBJCN_HW_KGDB);
- printf("%s: channel %d: kgdb\n", sc->sc_dev.dv_xname, chan);
+ aprint_normal_dev(sc->sc_dev, "channel %d: %s\n",
+ chan, "kgdb");
}
#endif
@@ -390,16 +393,18 @@
struct sbjcn_softc *sc = ch->ch_sc;
struct tty *tp = ch->ch_tty;
- printf("%s: chan %d: %s %sclocal %sdcd %sts_carr_on %sdtr %stx_stopped\n",
- sc->sc_dev.dv_xname, ch->ch_num, str,
+ aprint_normal_dev(sc->sc_dev,
+ "chan %d: %s %sclocal %sdcd %sts_carr_on %sdtr %stx_stopped\n",
+ ch->ch_num, str,
ISSET(tp->t_cflag, CLOCAL) ? "+" : "-",
ISSET(ch->ch_iports, ch->ch_i_dcd) ? "+" : "-",
ISSET(tp->t_state, TS_CARR_ON) ? "+" : "-",
ISSET(ch->ch_oports, ch->ch_o_dtr) ? "+" : "-",
ch->ch_tx_stopped ? "+" : "-");
- printf("%s: chan %d: %s %scrtscts %scts %sts_ttstop %srts %xrx_flags\n",
- sc->sc_dev.dv_xname, ch->ch_num, str,
+ aprint_normal_dev(sc->sc_dev,
+ "chan %d: %s %scrtscts %scts %sts_ttstop %srts %xrx_flags\n",
+ ch->ch_num, str,
ISSET(tp->t_cflag, CRTSCTS) ? "+" : "-",
ISSET(ch->ch_iports, ch->ch_i_cts) ? "+" : "-",
ISSET(tp->t_state, TS_TTSTOP) ? "+" : "-",
@@ -1042,8 +1047,8 @@
#ifdef DIAGNOSTIC
if (!timo)
- printf("%s: sbjcn_iflush timeout %02x\n",
- ch->ch_sc->sc_dev.dv_xname, reg);
+ aprint_error_dev(ch->ch_sc->sc_dev,
+ "sbjcn_iflush timeout %02x\n", reg);
#endif
}
@@ -1196,7 +1201,7 @@
splx(s);
log(LOG_WARNING, "%s: channel %d: %d fifo overflow%s, %d ibuf flood%s\n",
- sc->sc_dev.dv_xname, ch->ch_num,
+ device_xname(sc->sc_dev), ch->ch_num,
overflows, overflows == 1 ? "" : "s",
floods, floods == 1 ? "" : "s");
}
diff -r 84bd693d1cfd -r bc0d36c211fe sys/arch/mips/sibyte/dev/sbmac.c
--- a/sys/arch/mips/sibyte/dev/sbmac.c Tue Feb 01 03:16:54 2011 +0000
+++ b/sys/arch/mips/sibyte/dev/sbmac.c Tue Feb 01 06:13:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbmac.c,v 1.38 2011/02/01 03:16:54 matt Exp $ */
+/* $NetBSD: sbmac.c,v 1.39 2011/02/01 06:13:08 matt Exp $ */
/*
* Copyright 2000, 2001, 2004
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.38 2011/02/01 03:16:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.39 2011/02/01 06:13:08 matt Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@@ -232,35 +232,33 @@
/* Prototypes */
-static void sbdma_initctx(sbmacdma_t *d, struct sbmac_softc *s, int chan,
- int txrx, int maxdescr);
-static void sbdma_channel_start(sbmacdma_t *d);
-static int sbdma_add_rcvbuffer(sbmacdma_t *d, struct mbuf *m);
-static int sbdma_add_txbuffer(sbmacdma_t *d, struct mbuf *m);
-static void sbdma_emptyring(sbmacdma_t *d);
-static void sbdma_fillring(sbmacdma_t *d);
-static void sbdma_rx_process(struct sbmac_softc *sc, sbmacdma_t *d);
-static void sbdma_tx_process(struct sbmac_softc *sc, sbmacdma_t *d);
-static void sbmac_initctx(struct sbmac_softc *s);
-static void sbmac_channel_start(struct sbmac_softc *s);
-static void sbmac_channel_stop(struct sbmac_softc *s);
+static void sbdma_initctx(sbmacdma_t *, struct sbmac_softc *, int, int, int);
+static void sbdma_channel_start(sbmacdma_t *);
+static int sbdma_add_rcvbuffer(sbmacdma_t *, struct mbuf *);
+static int sbdma_add_txbuffer(sbmacdma_t *, struct mbuf *);
+static void sbdma_emptyring(sbmacdma_t *);
+static void sbdma_fillring(sbmacdma_t *);
+static void sbdma_rx_process(struct sbmac_softc *, sbmacdma_t *);
+static void sbdma_tx_process(struct sbmac_softc *, sbmacdma_t *);
+static void sbmac_initctx(struct sbmac_softc *);
+static void sbmac_channel_start(struct sbmac_softc *);
+static void sbmac_channel_stop(struct sbmac_softc *);
static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *,
sbmac_state_t);
-static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff);
-static void sbmac_init_and_start(struct sbmac_softc *sc);
-static uint64_t sbmac_addr2reg(u_char *ptr);
-static void sbmac_intr(void *xsc, uint32_t status, vaddr_t pc);
-static void sbmac_start(struct ifnet *ifp);
-static void sbmac_setmulti(struct sbmac_softc *sc);
-static int sbmac_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data);
+static void sbmac_promiscuous_mode(struct sbmac_softc *, bool);
+static void sbmac_init_and_start(struct sbmac_softc *);
+static uint64_t sbmac_addr2reg(u_char *);
+static void sbmac_intr(void *, uint32_t, vaddr_t);
+static void sbmac_start(struct ifnet *);
+static void sbmac_setmulti(struct sbmac_softc *);
+static int sbmac_ether_ioctl(struct ifnet *, u_long, void *);
static int sbmac_ioctl(struct ifnet *, u_long, void *);
-static void sbmac_watchdog(struct ifnet *ifp);
-static int sbmac_match(device_t parent, cfdata_t match, void *aux);
-static void sbmac_attach(device_t parent, device_t self, void *aux);
-static int sbmac_set_speed(struct sbmac_softc *s, sbmac_speed_t speed);
-static int sbmac_set_duplex(struct sbmac_softc *s, sbmac_duplex_t duplex,
- sbmac_fc_t fc);
-static void sbmac_tick(void *arg);
+static void sbmac_watchdog(struct ifnet *);
+static int sbmac_match(device_t, cfdata_t, void *);
+static void sbmac_attach(device_t, device_t, void *);
+static bool sbmac_set_speed(struct sbmac_softc *, sbmac_speed_t);
+static bool sbmac_set_duplex(struct sbmac_softc *, sbmac_duplex_t, sbmac_fc_t);
+static void sbmac_tick(void *);
/* Globals */
@@ -372,7 +370,7 @@
*
* Input parameters:
* d - sbmacdma_t structure (DMA channel context)
- * s - sbmac_softc structure (pointer to a MAC)
+ * sc - sbmac_softc structure (pointer to a MAC)
* chan - channel number (0..1 right now)
* txrx - Identifies DMA_TX or DMA_RX for channel direction
* maxdescr - number of descriptors
@@ -1053,7 +1051,7 @@
* interface up/down
*
* Input parameters:
- * s - sbmac context structure
+ * sc - sbmac context structure
*
* Return value:
* 0
@@ -1062,7 +1060,6 @@
static void
sbmac_initctx(struct sbmac_softc *sc)
{
- const char * const xname = device_xname(sc->sc_dev);
uint64_t sysrev;
/*
@@ -1109,6 +1106,7 @@
(SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250 &&
G_SYS_REVISION(sysrev) >= K_SYS_REVISION_BCM1250_PASS3));
#ifdef SBMAC_EVENT_COUNTERS
+ const char * const xname = device_xname(sc->sc_dev);
evcnt_attach_dynamic(&sc->sbm_ev_rxintr, EVCNT_TYPE_INTR,
NULL, xname, "rxintr");
evcnt_attach_dynamic(&sc->sbm_ev_txintr, EVCNT_TYPE_INTR,
@@ -1132,7 +1130,7 @@
* Start packet processing on this MAC.
*
* Input parameters:
- * s - sbmac structure
+ * sc - sbmac structure
*
* Return value:
* nothing
@@ -1327,7 +1325,7 @@
*/
if (sc->sc_ethercom.ec_if.if_flags & IFF_PROMISC)
- sbmac_promiscuous_mode(sc, 1);
+ sbmac_promiscuous_mode(sc, true);
/*
* Turn on the once-per-second timer
@@ -1342,7 +1340,7 @@
* Stop packet processing on this MAC.
*
* Input parameters:
- * s - sbmac structure
+ * sc - sbmac structure
*
* Return value:
* nothing
@@ -1425,27 +1423,27 @@
}
/*
- * SBMAC_PROMISCUOUS_MODE(sc, onoff)
+ * SBMAC_PROMISCUOUS_MODE(sc, enabled)
*
* Turn on or off promiscuous mode
*
* Input parameters:
* sc - softc
- * onoff - 1 to turn on, 0 to turn off
+ * enabled - true to turn on, false to turn off
*
* Return value:
* nothing
*/
Home |
Main Index |
Thread Index |
Old Index