Module Name: src
Committed By: skrll
Date: Tue Jul 21 07:35:55 UTC 2009
Modified Files:
src/sys/arch/arm/footbridge: footbridge.c footbridge_clock.c
footbridge_com.c footbridgevar.h todclock.c
src/sys/arch/arm/footbridge/isa: dsrtc.c sysbeep_isa.c
Log Message:
device_t/softc split
CFATTACH_DECL -> CFATTACH_DECL_NEW
struct device * -> device_t
struct cfdata * -> cfdata_t
Use aprint*
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/footbridge/footbridge.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/footbridge/footbridge_clock.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/footbridge/footbridge_com.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/footbridge/footbridgevar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/footbridge/todclock.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/footbridge/isa/dsrtc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/footbridge/isa/sysbeep_isa.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/footbridge/footbridge.c
diff -u src/sys/arch/arm/footbridge/footbridge.c:1.20 src/sys/arch/arm/footbridge/footbridge.c:1.21
--- src/sys/arch/arm/footbridge/footbridge.c:1.20 Sat Mar 14 15:36:02 2009
+++ src/sys/arch/arm/footbridge/footbridge.c Tue Jul 21 07:35:55 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: footbridge.c,v 1.20 2009/03/14 15:36:02 dsl Exp $ */
+/* $NetBSD: footbridge.c,v 1.21 2009/07/21 07:35:55 skrll Exp $ */
/*
* Copyright (c) 1997,1998 Mark Brinicombe.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: footbridge.c,v 1.20 2009/03/14 15:36:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge.c,v 1.21 2009/07/21 07:35:55 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,15 +68,13 @@
/* Declare prototypes */
-static int footbridge_match(struct device *parent, struct cfdata *cf,
- void *aux);
-static void footbridge_attach(struct device *parent, struct device *self,
- void *aux);
+static int footbridge_match(device_t parent, cfdata_t cf, void *aux);
+static void footbridge_attach(device_t parent, device_t self, void *aux);
static int footbridge_print(void *aux, const char *pnp);
static int footbridge_intr(void *arg);
/* Driver and attach structures */
-CFATTACH_DECL(footbridge, sizeof(struct footbridge_softc),
+CFATTACH_DECL_NEW(footbridge, sizeof(struct footbridge_softc),
footbridge_match, footbridge_attach, NULL, NULL);
/* Various bus space tags */
@@ -109,7 +107,7 @@
}
/*
- * int footbridgeprint(void *aux, const char *name)
+ * int footbridge_print(void *aux, const char *name)
*
* print configuration info for children
*/
@@ -131,7 +129,7 @@
*/
static int
-footbridge_match(struct device *parent, struct cfdata *cf, void *aux)
+footbridge_match(device_t parent, cfdata_t cf, void *aux)
{
if (footbridge_found)
return(0);
@@ -140,14 +138,14 @@
/*
- * void footbridge_attach(struct device *parent, struct device *dev, void *aux)
+ * void footbridge_attach(device_t parent, device_t dev, void *aux)
*
*/
static void
-footbridge_attach(struct device *parent, struct device *self, void *aux)
+footbridge_attach(device_t parent, device_t self, void *aux)
{
- struct footbridge_softc *sc = (struct footbridge_softc *)self;
+ struct footbridge_softc *sc = device_private(self);
union footbridge_attach_args fba;
int vendor, device, rev;
@@ -156,21 +154,22 @@
clock_sc = sc;
+ sc->sc_dev = self;
sc->sc_iot = &footbridge_bs_tag;
/* Map the Footbridge */
if (bus_space_map(sc->sc_iot, DC21285_ARMCSR_VBASE,
DC21285_ARMCSR_VSIZE, 0, &sc->sc_ioh))
- panic("%s: Cannot map registers", self->dv_xname);
+ panic("%s: Cannot map registers", device_xname(self));
/* Read the ID to make sure it is what we think it is */
vendor = bus_space_read_2(sc->sc_iot, sc->sc_ioh, VENDOR_ID);
device = bus_space_read_2(sc->sc_iot, sc->sc_ioh, DEVICE_ID);
rev = bus_space_read_1(sc->sc_iot, sc->sc_ioh, REVISION);
if (vendor != DC21285_VENDOR_ID && device != DC21285_DEVICE_ID)
- panic("%s: Unrecognised ID", self->dv_xname);
+ panic("%s: Unrecognised ID", device_xname(self));
- printf(": DC21285 rev %d\n", rev);
+ aprint_normal(": DC21285 rev %d\n", rev);
/* Disable all interrupts from the footbridge */
bus_space_write_4(sc->sc_iot, sc->sc_ioh, IRQ_ENABLE_CLEAR, 0xffffffff);
Index: src/sys/arch/arm/footbridge/footbridge_clock.c
diff -u src/sys/arch/arm/footbridge/footbridge_clock.c:1.25 src/sys/arch/arm/footbridge/footbridge_clock.c:1.26
--- src/sys/arch/arm/footbridge/footbridge_clock.c:1.25 Sat Sep 20 14:53:37 2008
+++ src/sys/arch/arm/footbridge/footbridge_clock.c Tue Jul 21 07:35:55 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: footbridge_clock.c,v 1.25 2008/09/20 14:53:37 chris Exp $ */
+/* $NetBSD: footbridge_clock.c,v 1.26 2009/07/21 07:35:55 skrll Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: footbridge_clock.c,v 1.25 2008/09/20 14:53:37 chris Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge_clock.c,v 1.26 2009/07/21 07:35:55 skrll Exp $");
/* Include header files */
@@ -78,20 +78,20 @@
void footbridge_tc_init(void);
#if 0
-static int clockmatch(struct device *parent, struct cfdata *cf, void *aux);
-static void clockattach(struct device *parent, struct device *self, void *aux);
+static int clockmatch(device_t parent, cfdata_t cf, void *aux);
+static void clockattach(device_t parent, device_t self, void *aux);
-CFATTACH_DECL(footbridge_clock, sizeof(struct clock_softc),
+CFATTACH_DECL_NEW(footbridge_clock, sizeof(struct clock_softc),
clockmatch, clockattach, NULL, NULL);
/*
- * int clockmatch(struct device *parent, void *match, void *aux)
+ * int clockmatch(device_t parent, cfdata_t cf, void *aux);
*
* Just return ok for this if it is device 0
*/
static int
-clockmatch(struct device *parent, struct cfdata *cf, void *aux)
+clockmatch(device_t parent, cfdata_t cf, void *aux)
{
union footbridge_attach_args *fba = aux;
@@ -102,16 +102,17 @@
/*
- * void clockattach(struct device *parent, struct device *dev, void *aux)
+ * void clockattach(device_t parent, device_t self, void *aux)
*
*/
static void
-clockattach(struct device *parent, struct device *self, void *aux)
+clockattach(device_t parent, device_t self, void *aux)
{
- struct clock_softc *sc = (struct clock_softc *)self;
+ struct clock_softc *sc = device_private(self);
union footbridge_attach_args *fba = aux;
+ sc->sc_dev = self;
sc->sc_iot = fba->fba_ca.ca_iot;
sc->sc_ioh = fba->fba_ca.ca_ioh;
@@ -119,7 +120,7 @@
/* Cannot do anything until cpu_initclocks() has been called */
- printf("\n");
+ aprint_normal("\n");
}
#endif
@@ -275,7 +276,7 @@
profhz = stathz * 5;
/* Report the clock frequencies */
- printf("clock: hz=%d stathz = %d profhz = %d\n", hz, stathz, profhz);
+ aprint_debug("clock: hz=%d stathz = %d profhz = %d\n", hz, stathz, profhz);
/* Setup timer 1 and claim interrupt */
clock_sc->sc_clock_count = load_timer(TIMER_1_BASE, hz);
@@ -291,7 +292,7 @@
if (clock_sc->sc_clockintr == NULL)
panic("%s: Cannot install timer 1 interrupt handler",
- clock_sc->sc_dev.dv_xname);
+ device_xname(clock_sc->sc_dev));
/* If stathz is non-zero then setup the stat clock */
if (stathz) {
@@ -301,7 +302,7 @@
"tmr2 stat clk", statclockhandler, 0);
if (clock_sc->sc_statclockintr == NULL)
panic("%s: Cannot install timer 2 interrupt handler",
- clock_sc->sc_dev.dv_xname);
+ device_xname(clock_sc->sc_dev));
}
footbridge_tc_init();
Index: src/sys/arch/arm/footbridge/footbridge_com.c
diff -u src/sys/arch/arm/footbridge/footbridge_com.c:1.31 src/sys/arch/arm/footbridge/footbridge_com.c:1.32
--- src/sys/arch/arm/footbridge/footbridge_com.c:1.31 Sat Mar 14 21:04:05 2009
+++ src/sys/arch/arm/footbridge/footbridge_com.c Tue Jul 21 07:35:55 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: footbridge_com.c,v 1.31 2009/03/14 21:04:05 dsl Exp $ */
+/* $NetBSD: footbridge_com.c,v 1.32 2009/07/21 07:35:55 skrll Exp $ */
/*-
* Copyright (c) 1997 Mark Brinicombe
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: footbridge_com.c,v 1.31 2009/03/14 21:04:05 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge_com.c,v 1.32 2009/07/21 07:35:55 skrll Exp $");
#include "opt_ddb.h"
#include "opt_ddbparam.h"
@@ -78,7 +78,7 @@
#endif /* DDB */
struct fcom_softc {
- struct device sc_dev;
+ device_t sc_dev;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
void *sc_ih;
@@ -100,8 +100,8 @@
#define RX_BUFFER_SIZE 0x100
-static int fcom_probe(struct device *, struct cfdata *, void *);
-static void fcom_attach(struct device *, struct device *, void *);
+static int fcom_probe(device_t, cfdata_t, void *);
+static void fcom_attach(device_t, device_t, void *);
static void fcom_softintr(void *);
static int fcom_rxintr(void *);
@@ -114,7 +114,7 @@
void fcomcnputc(dev_t, int);
void fcomcnpollc(dev_t, int);
-CFATTACH_DECL(fcom, sizeof(struct fcom_softc),
+CFATTACH_DECL_NEW(fcom, sizeof(struct fcom_softc),
fcom_probe, fcom_attach, NULL, NULL);
extern struct cfdriver fcom_cd;
@@ -161,7 +161,7 @@
*/
static int
-fcom_probe(struct device *parent, struct cfdata *cf, void *aux)
+fcom_probe(device_t parent, cfdata_t cf, void *aux)
{
union footbridge_attach_args *fba = aux;
@@ -171,18 +171,19 @@
}
/*
- * void fcom_attach(struct device *parent, struct device *self, void *aux)
+ * void fcom_attach(device_t parent, device_t self, void *aux)
*
* attach the com device
*/
static void
-fcom_attach(struct device *parent, struct device *self, void *aux)
+fcom_attach(device_t parent, device_t self, void *aux)
{
union footbridge_attach_args *fba = aux;
- struct fcom_softc *sc = (struct fcom_softc *)self;
+ struct fcom_softc *sc = device_private(self);
/* Set up the softc */
+ sc->sc_dev = self;
sc->sc_iot = fba->fba_fca.fca_iot;
sc->sc_ioh = fba->fba_fca.fca_ioh;
callout_init(&sc->sc_softintr_ch, 0);
@@ -201,16 +202,16 @@
/* locate the major number */
major = cdevsw_lookup_major(&fcom_cdevsw);
- cn_tab->cn_dev = makedev(major, device_unit(&sc->sc_dev));
- printf(": console");
+ cn_tab->cn_dev = makedev(major, device_unit(sc->sc_dev));
+ aprint_normal(": console");
}
- printf("\n");
+ aprint_normal("\n");
sc->sc_ih = footbridge_intr_claim(sc->sc_rx_irq, IPL_SERIAL,
"serial rx", fcom_rxintr, sc);
if (sc->sc_ih == NULL)
panic("%s: Cannot install rx interrupt handler",
- sc->sc_dev.dv_xname);
+ device_xname(sc->sc_dev));
}
static void fcomstart(struct tty *);
@@ -235,7 +236,7 @@
sc->sc_rxbuf = sc->sc_rxbuffer[sc->sc_rxcur];
if (!sc->sc_rxbuf)
panic("%s: Cannot allocate rx buffer memory",
- sc->sc_dev.dv_xname);
+ device_xname(sc->sc_dev));
}
tp->t_oproc = fcomstart;
tp->t_param = fcomparam;
Index: src/sys/arch/arm/footbridge/footbridgevar.h
diff -u src/sys/arch/arm/footbridge/footbridgevar.h:1.5 src/sys/arch/arm/footbridge/footbridgevar.h:1.6
--- src/sys/arch/arm/footbridge/footbridgevar.h:1.5 Sat Jan 6 16:18:18 2007
+++ src/sys/arch/arm/footbridge/footbridgevar.h Tue Jul 21 07:35:55 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: footbridgevar.h,v 1.5 2007/01/06 16:18:18 christos Exp $ */
+/* $NetBSD: footbridgevar.h,v 1.6 2009/07/21 07:35:55 skrll Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe.
@@ -45,7 +45,7 @@
*/
struct footbridge_softc {
- struct device sc_dev; /* device node */
+ device_t sc_dev; /* device node */
bus_space_tag_t sc_iot; /* bus tag */
bus_space_handle_t sc_ioh; /* bus handle */
Index: src/sys/arch/arm/footbridge/todclock.c
diff -u src/sys/arch/arm/footbridge/todclock.c:1.13 src/sys/arch/arm/footbridge/todclock.c:1.14
--- src/sys/arch/arm/footbridge/todclock.c:1.13 Sat Mar 14 15:36:02 2009
+++ src/sys/arch/arm/footbridge/todclock.c Tue Jul 21 07:35:55 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: todclock.c,v 1.13 2009/03/14 15:36:02 dsl Exp $ */
+/* $NetBSD: todclock.c,v 1.14 2009/07/21 07:35:55 skrll Exp $ */
/*
* Copyright (c) 1994-1997 Mark Brinicombe.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: todclock.c,v 1.13 2009/03/14 15:36:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: todclock.c,v 1.14 2009/07/21 07:35:55 skrll Exp $");
/* Include header files */
@@ -81,10 +81,8 @@
/* prototypes for functions */
-static void todclockattach(struct device *parent, struct device *self,
- void *aux);
-static int todclockmatch(struct device *parent, struct cfdata *cf,
- void *aux);
+static void todclockattach(device_t parent, device_t self, void *aux);
+static int todclockmatch(device_t parent, cfdata_t cf, void *aux);
/*
* We need to remember our softc for functions like inittodr()
@@ -97,18 +95,18 @@
/* driver and attach structures */
-CFATTACH_DECL(todclock, sizeof(struct todclock_softc),
+CFATTACH_DECL_NEW(todclock, sizeof(struct todclock_softc),
todclockmatch, todclockattach, NULL, NULL);
/*
- * int todclockmatch(struct device *parent, struct cfdata *cf, void *aux)
+ * int todclockmatch(device_t parent, cfdata_t cf, void *aux)
*
* todclock device probe function.
* just validate the attach args
*/
int
-todclockmatch(struct device *parent, struct cfdata *cf, void *aux)
+todclockmatch(device_t parent, cfdata_t cf, void *aux)
{
struct todclock_attach_args *ta = aux;
@@ -123,14 +121,14 @@
}
/*
- * void todclockattach(struct device *parent, struct device *self, void *aux)
+ * void todclockattach(device_t parent, device_t self, void *aux)
*
* todclock device attach function.
* Initialise the softc structure and do a search for children
*/
void
-todclockattach(struct device *parent, struct device *self, void *aux)
+todclockattach(device_t parent, device_t self, void *aux)
{
static struct todr_chip_handle tch;
@@ -139,6 +137,7 @@
/* set up our softc */
todclock_sc = sc;
+ todclock_sc->sc_dev = self;
todclock_sc->sc_rtc_arg = ta->ta_rtc_arg;
todclock_sc->sc_rtc_write = ta->ta_rtc_write;
todclock_sc->sc_rtc_read = ta->ta_rtc_read;
@@ -149,7 +148,7 @@
todr_attach(&tch);
- printf("\n");
+ aprint_normal("\n");
}
static int
@@ -168,7 +167,7 @@
rtc.rtc_centi = 0;
rtc.rtc_micro = 0;
- printf("resettod: %02d/%02d/%02d%02d %02d:%02d:%02d\n", rtc.rtc_day,
+ aprint_normal("resettod: %02d/%02d/%02d%02d %02d:%02d:%02d\n", rtc.rtc_day,
rtc.rtc_mon, rtc.rtc_cen, rtc.rtc_year, rtc.rtc_hour,
rtc.rtc_min, rtc.rtc_sec);
Index: src/sys/arch/arm/footbridge/isa/dsrtc.c
diff -u src/sys/arch/arm/footbridge/isa/dsrtc.c:1.10 src/sys/arch/arm/footbridge/isa/dsrtc.c:1.11
--- src/sys/arch/arm/footbridge/isa/dsrtc.c:1.10 Sat Jan 6 16:18:18 2007
+++ src/sys/arch/arm/footbridge/isa/dsrtc.c Tue Jul 21 07:35:55 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: dsrtc.c,v 1.10 2007/01/06 16:18:18 christos Exp $ */
+/* $NetBSD: dsrtc.c,v 1.11 2009/07/21 07:35:55 skrll Exp $ */
/*
* Copyright (c) 1998 Mark Brinicombe.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dsrtc.c,v 1.10 2007/01/06 16:18:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dsrtc.c,v 1.11 2009/07/21 07:35:55 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -180,7 +180,7 @@
}
/* device and attach structures */
-CFATTACH_DECL(ds1687rtc, sizeof(struct dsrtc_softc),
+CFATTACH_DECL_NEW(ds1687rtc, sizeof(struct dsrtc_softc),
dsrtcmatch, dsrtcattach, NULL, NULL);
/*
@@ -190,7 +190,7 @@
*/
int
-dsrtcmatch(struct device *parent, struct cfdata *cf, void *aux)
+dsrtcmatch(device_t parent, cfdata_t cf, void *aux)
{
struct isa_attach_args *ia = aux;
@@ -215,15 +215,15 @@
*/
void
-dsrtcattach(struct device *parent, struct device *self, void *aux)
+dsrtcattach(device_t parent, device_t self, void *aux)
{
- struct dsrtc_softc *sc = (struct dsrtc_softc *)self;
+ struct dsrtc_softc *sc = device_private(self);
struct isa_attach_args *ia = aux;
sc->sc_iot = ia->ia_iot;
if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr,
ia->ia_io[0].ir_size, 0, &sc->sc_ioh)) {
- printf(": cannot map I/O space\n");
+ aprint_error(": cannot map I/O space\n");
return;
}
@@ -231,8 +231,8 @@
ds1687_write(sc, RTC_REG_B, RTC_REG_B_BINARY | RTC_REG_B_24_HOUR);
if (!(ds1687_read(sc, RTC_REG_D) & RTC_REG_D_VRT))
- printf(": lithium cell is dead, RTC unreliable");
- printf("\n");
+ aprint_error(": lithium cell is dead, RTC unreliable");
+ aprint_normal("\n");
sc->sc_todr.todr_gettime_ymdhms = dsrtc_read;
sc->sc_todr.todr_settime_ymdhms = dsrtc_write;
Index: src/sys/arch/arm/footbridge/isa/sysbeep_isa.c
diff -u src/sys/arch/arm/footbridge/isa/sysbeep_isa.c:1.9 src/sys/arch/arm/footbridge/isa/sysbeep_isa.c:1.10
--- src/sys/arch/arm/footbridge/isa/sysbeep_isa.c:1.9 Sat Mar 14 21:04:05 2009
+++ src/sys/arch/arm/footbridge/isa/sysbeep_isa.c Tue Jul 21 07:35:55 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sysbeep_isa.c,v 1.9 2009/03/14 21:04:05 dsl Exp $ */
+/* $NetBSD: sysbeep_isa.c,v 1.10 2009/07/21 07:35:55 skrll Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysbeep_isa.c,v 1.9 2009/03/14 21:04:05 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysbeep_isa.c,v 1.10 2009/07/21 07:35:55 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -40,27 +40,27 @@
#include <dev/isa/pcppivar.h>
/* Prototypes */
-int sysbeep_isa_match(struct device *parent, struct cfdata *cf, void *aux);
-void sysbeep_isa_attach(struct device *parent, struct device *self, void *aux);
+int sysbeep_isa_match(device_t parent, cfdata_t cf, void *aux);
+void sysbeep_isa_attach(device_t parent, device_t self, void *aux);
void sysbeep_isa(int pitch, int period);
/* device attach structure */
-CFATTACH_DECL(sysbeep_isa, sizeof(struct device),
+CFATTACH_DECL_NEW(sysbeep_isa, sizeof(struct device),
sysbeep_isa_match, sysbeep_isa_attach, NULL, NULL);
static int ppi_attached;
static pcppi_tag_t ppicookie;
int
-sysbeep_isa_match(struct device *parent, struct cfdata *match, void *aux)
+sysbeep_isa_match(device_t parent, cfdata_t match, void *aux)
{
return (!ppi_attached);
}
void
-sysbeep_isa_attach(struct device *parent, struct device *self, void *aux)
+sysbeep_isa_attach(device_t parent, device_t self, void *aux)
{
- printf("\n");
+ aprint_normal("\n");
ppicookie = ((struct pcppi_attach_args *)aux)->pa_cookie;
ppi_attached = 1;