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 Update to CFATTACH_DECL_NEW.
details: https://anonhg.NetBSD.org/src/rev/84bd693d1cfd
branches: trunk
changeset: 761564:84bd693d1cfd
user: matt <matt%NetBSD.org@localhost>
date: Tue Feb 01 03:16:54 2011 +0000
description:
Update to CFATTACH_DECL_NEW.
diffstat:
sys/arch/mips/sibyte/dev/sbgbus.c | 23 +-
sys/arch/mips/sibyte/dev/sbjcn.c | 20 +-
sys/arch/mips/sibyte/dev/sbjcnvar.h | 4 +-
sys/arch/mips/sibyte/dev/sbmac.c | 275 ++++++++++++++++++-----------------
sys/arch/mips/sibyte/dev/sbobio.c | 14 +-
sys/arch/mips/sibyte/dev/sbscd.c | 14 +-
sys/arch/mips/sibyte/dev/sbscn.c | 45 +++--
sys/arch/mips/sibyte/dev/sbscnvar.h | 6 +-
sys/arch/mips/sibyte/dev/sbsmbus.c | 14 +-
sys/arch/mips/sibyte/dev/sbtimer.c | 27 +-
sys/arch/mips/sibyte/dev/sbwdog.c | 27 +-
11 files changed, 238 insertions(+), 231 deletions(-)
diffs (truncated from 1402 to 300 lines):
diff -r 80c17058db56 -r 84bd693d1cfd sys/arch/mips/sibyte/dev/sbgbus.c
--- a/sys/arch/mips/sibyte/dev/sbgbus.c Tue Feb 01 02:09:26 2011 +0000
+++ b/sys/arch/mips/sibyte/dev/sbgbus.c Tue Feb 01 03:16:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbgbus.c,v 1.11 2009/12/14 00:46:08 matt Exp $ */
+/* $NetBSD: sbgbus.c,v 1.12 2011/02/01 03:16:54 matt Exp $ */
/*
* Copyright 2000, 2001
@@ -33,32 +33,31 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbgbus.c,v 1.11 2009/12/14 00:46:08 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbgbus.c,v 1.12 2011/02/01 03:16:54 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
+#include "ioconf.h"
+
#include <machine/locore.h>
#include <machine/sb1250/sb1250_regs.h>
#include <machine/sb1250/sb1250_genbus.h>
#include <sbmips/dev/sbobio/sbobiovar.h>
#include <sbmips/dev/sbgbus/sbgbusvar.h>
-extern struct cfdriver sbgbus_cd;
+static int sbgbus_match(device_t, cfdata_t, void *);
+static void sbgbus_attach(device_t, device_t, void *);
-static int sbgbus_match(struct device *, struct cfdata *, void *);
-static void sbgbus_attach(struct device *, struct device *, void *);
-
-CFATTACH_DECL(sbgbus, sizeof(struct device),
+CFATTACH_DECL_NEW(sbgbus, 0,
sbgbus_match, sbgbus_attach, NULL, NULL);
-static int sbgbussearch(struct device *, struct cfdata *,
- const int *, void *);
+static int sbgbussearch(device_t, cfdata_t, const int *, void *);
static int sbgbusprint(void *, const char *);
static int
-sbgbus_match(struct device *parent, struct cfdata *match, void *aux)
+sbgbus_match(device_t parent, cfdata_t match, void *aux)
{
struct sbobio_attach_args *sap = aux;
@@ -69,7 +68,7 @@
}
static void
-sbgbus_attach(struct device *parent, struct device *self, void *aux)
+sbgbus_attach(device_t parent, device_t self, void *aux)
{
/* Configure children using indirect configuration. */
@@ -95,7 +94,7 @@
}
static int
-sbgbussearch(struct device *parent, struct cfdata *cf,
+sbgbussearch(device_t parent, cfdata_t cf,
const int *ldesc, void *aux)
{
struct sbgbus_attach_args sga;
diff -r 80c17058db56 -r 84bd693d1cfd sys/arch/mips/sibyte/dev/sbjcn.c
--- a/sys/arch/mips/sibyte/dev/sbjcn.c Tue Feb 01 02:09:26 2011 +0000
+++ b/sys/arch/mips/sibyte/dev/sbjcn.c Tue Feb 01 03:16:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbjcn.c,v 1.24 2009/12/14 00:46:08 matt Exp $ */
+/* $NetBSD: sbjcn.c,v 1.25 2011/02/01 03:16:54 matt Exp $ */
/*
* Copyright 2000, 2001
@@ -103,11 +103,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.24 2009/12/14 00:46:08 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.25 2011/02/01 03:16:54 matt Exp $");
#define SBJCN_DEBUG
#include "opt_ddb.h"
+#include "ioconf.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -163,8 +164,6 @@
void sbjcn_cnputc(dev_t dev, int c);
void sbjcn_cnpollc(dev_t dev, int on);
-extern struct cfdriver sbjcn_cd;
-
dev_type_open(sbjcnopen);
dev_type_close(sbjcnclose);
dev_type_read(sbjcnread);
@@ -218,10 +217,10 @@
void sbjcn_kgdb_putc(void *, int);
#endif /* KGDB */
-static int sbjcn_match(struct device *, struct cfdata *, void *);
-static void sbjcn_attach(struct device *, struct device *, void *);
+static int sbjcn_match(device_t, cfdata_t, void *);
+static void sbjcn_attach(device_t, device_t, void *);
-CFATTACH_DECL(sbjcn, sizeof(struct sbjcn_softc),
+CFATTACH_DECL_NEW(sbjcn, sizeof(struct sbjcn_softc),
sbjcn_match, sbjcn_attach, NULL, NULL);
#define READ_REG(rp) (mips3_ld((volatile uint64_t *)(rp)))
@@ -236,7 +235,7 @@
static int
-sbjcn_match(struct device *parent, struct cfdata *match, void *aux)
+sbjcn_match(device_t parent, cfdata_t match, void *aux)
{
struct sbscd_attach_args *sap = aux;
@@ -247,11 +246,12 @@
}
static void
-sbjcn_attach(struct device *parent, struct device *self, void *aux)
+sbjcn_attach(device_t parent, device_t self, void *aux)
{
- struct sbjcn_softc *sc = (struct sbjcn_softc *)self;
+ struct sbjcn_softc *sc = device_private(self);
struct sbscd_attach_args *sap = aux;
+ sc->sc_dev = self;
sc->sc_addr = sap->sa_base + sap->sa_locs.sa_offset;
printf("\n");
diff -r 80c17058db56 -r 84bd693d1cfd sys/arch/mips/sibyte/dev/sbjcnvar.h
--- a/sys/arch/mips/sibyte/dev/sbjcnvar.h Tue Feb 01 02:09:26 2011 +0000
+++ b/sys/arch/mips/sibyte/dev/sbjcnvar.h Tue Feb 01 03:16:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbjcnvar.h,v 1.2 2003/02/07 17:38:49 cgd Exp $ */
+/* $NetBSD: sbjcnvar.h,v 1.3 2011/02/01 03:16:54 matt Exp $ */
/*
* Copyright 2000, 2001
@@ -163,7 +163,7 @@
};
struct sbjcn_softc {
- struct device sc_dev; /* base device */
+ device_t sc_dev; /* base device */
/* shared data structures */
u_long sc_addr; /* phys addr of JTAG console bus_space */
diff -r 80c17058db56 -r 84bd693d1cfd sys/arch/mips/sibyte/dev/sbmac.c
--- a/sys/arch/mips/sibyte/dev/sbmac.c Tue Feb 01 02:09:26 2011 +0000
+++ b/sys/arch/mips/sibyte/dev/sbmac.c Tue Feb 01 03:16:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbmac.c,v 1.37 2010/04/05 07:19:31 joerg Exp $ */
+/* $NetBSD: sbmac.c,v 1.38 2011/02/01 03:16:54 matt Exp $ */
/*
* Copyright 2000, 2001, 2004
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.37 2010/04/05 07:19:31 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.38 2011/02/01 03:16:54 matt Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@@ -173,11 +173,11 @@
/*
* NetBSD-specific things
*/
- struct device sc_dev; /* base device (must be first) */
struct ethercom sc_ethercom; /* Ethernet common part */
struct mii_data sc_mii;
struct callout sc_tick_ch;
+ device_t sc_dev; /* device */
int sbm_if_flags;
void *sbm_intrhand;
@@ -255,8 +255,8 @@
static int sbmac_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data);
static int sbmac_ioctl(struct ifnet *, u_long, void *);
static void sbmac_watchdog(struct ifnet *ifp);
-static int sbmac_match(struct device *parent, struct cfdata *match, void *aux);
-static void sbmac_attach(struct device *parent, struct device *self, void *aux);
+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);
@@ -265,11 +265,11 @@
/* Globals */
-CFATTACH_DECL(sbmac, sizeof(struct sbmac_softc),
+CFATTACH_DECL_NEW(sbmac, sizeof(struct sbmac_softc),
sbmac_match, sbmac_attach, NULL, NULL);
-static uint32_t sbmac_mii_bitbang_read(struct device *self);
-static void sbmac_mii_bitbang_write(struct device *self, uint32_t val);
+static uint32_t sbmac_mii_bitbang_read(device_t self);
+static void sbmac_mii_bitbang_write(device_t self, uint32_t val);
static const struct mii_bitbang_ops sbmac_mii_bitbang_ops = {
sbmac_mii_bitbang_read,
@@ -284,9 +284,9 @@
};
static uint32_t
-sbmac_mii_bitbang_read(struct device *self)
+sbmac_mii_bitbang_read(device_t self)
{
- struct sbmac_softc *sc = (void *) self;
+ struct sbmac_softc *sc = device_private(self);
sbmac_port_t reg;
reg = PKSEG1(sc->sbm_base + R_MAC_MDIO);
@@ -294,9 +294,9 @@
}
static void
-sbmac_mii_bitbang_write(struct device *self, uint32_t val)
+sbmac_mii_bitbang_write(device_t self, uint32_t val)
{
- struct sbmac_softc *sc = (void *) self;
+ struct sbmac_softc *sc = device_private(self);
sbmac_port_t reg;
reg = PKSEG1(sc->sbm_base + R_MAC_MDIO);
@@ -309,7 +309,7 @@
* Read an PHY register through the MII.
*/
static int
-sbmac_mii_readreg(struct device *self, int phy, int reg)
+sbmac_mii_readreg(device_t self, int phy, int reg)
{
return (mii_bitbang_readreg(self, &sbmac_mii_bitbang_ops, phy, reg));
@@ -319,16 +319,16 @@
* Write to a PHY register through the MII.
*/
static void
-sbmac_mii_writereg(struct device *self, int phy, int reg, int val)
+sbmac_mii_writereg(device_t self, int phy, int reg, int val)
{
mii_bitbang_writereg(self, &sbmac_mii_bitbang_ops, phy, reg, val);
}
static void
-sbmac_mii_statchg(struct device *self)
+sbmac_mii_statchg(device_t self)
{
- struct sbmac_softc *sc = (struct sbmac_softc *)self;
+ struct sbmac_softc *sc = device_private(self);
sbmac_state_t oldstate;
/* Stop the MAC in preparation for changing all of the parameters. */
@@ -364,7 +364,7 @@
}
/*
- * SBDMA_INITCTX(d, s, chan, txrx, maxdescr)
+ * SBDMA_INITCTX(d, sc, chan, txrx, maxdescr)
*
* Initialize a DMA channel context. Since there are potentially
* eight DMA channels per MAC, it's nice to do this in a standard
@@ -382,14 +382,14 @@
*/
static void
-sbdma_initctx(sbmacdma_t *d, struct sbmac_softc *s, int chan, int txrx,
+sbdma_initctx(sbmacdma_t *d, struct sbmac_softc *sc, int chan, int txrx,
int maxdescr)
{
/*
* Save away interesting stuff in the structure
*/
- d->sbdma_eth = s;
+ d->sbdma_eth = sc;
d->sbdma_channel = chan;
d->sbdma_txdir = txrx;
@@ -397,15 +397,15 @@
* initialize register pointers
*/
- d->sbdma_config0 = PKSEG1(s->sbm_base +
+ d->sbdma_config0 = PKSEG1(sc->sbm_base +
R_MAC_DMA_REGISTER(txrx, chan, R_MAC_DMA_CONFIG0));
- d->sbdma_config1 = PKSEG1(s->sbm_base +
Home |
Main Index |
Thread Index |
Old Index