CFATTACH_DECL_NEW

This commit is contained in:
christos 2011-06-03 03:20:39 +00:00
parent 88655ce235
commit 817999e9d9
7 changed files with 69 additions and 62 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cons.h,v 1.8 2006/10/16 22:07:11 martin Exp $ */
/* $NetBSD: cons.h,v 1.9 2011/06/03 03:20:39 christos Exp $ */
/*-
* Copyright (c) 2000 Eduardo E. Horvath
@ -35,7 +35,7 @@
*/
struct pconssoftc {
struct device of_dev;
device_t of_dev;
struct tty *of_tty;
struct callout sc_poll_ch;
int of_flags;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffb.c,v 1.42 2011/05/19 04:43:45 macallan Exp $ */
/* $NetBSD: ffb.c,v 1.43 2011/06/03 03:20:39 christos Exp $ */
/* $OpenBSD: creator.c,v 1.20 2002/07/30 19:48:15 jason Exp $ */
/*
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.42 2011/05/19 04:43:45 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffb.c,v 1.43 2011/06/03 03:20:39 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -137,7 +137,7 @@ void ffb_putchar(void *, int, int, u_int, long);
void ffb_cursor(void *, int, int, int);
/* frame buffer generic driver */
static void ffbfb_unblank(struct device*);
static void ffbfb_unblank(device_t);
dev_type_open(ffbfb_open);
dev_type_close(ffbfb_close);
dev_type_ioctl(ffbfb_ioctl);
@ -255,7 +255,7 @@ ffb_attach(struct ffb_softc *sc)
printf(", model %s, dac %u\n", model, sc->sc_dacrev);
if (sc->sc_needredraw)
printf("%s: found old DAC, enabling redraw on unblank\n",
device_xname(&sc->sc_dv));
device_xname(sc->sc_dev));
/* Check if a console resolution "<device>:r<res>" is set. */
if (sc->sc_console) {
@ -289,7 +289,7 @@ ffb_attach(struct ffb_softc *sc)
sort_modes(sc->sc_edid_info.edid_modes,
&sc->sc_edid_info.edid_preferred_mode,
sc->sc_edid_info.edid_nmodes);
DPRINTF(("%s: EDID data:\n ", device_xname(&sc->sc_dv)));
DPRINTF(("%s: EDID data:\n ", device_xname(sc->sc_dev)));
for (i = 0; i < EDID_DATA_LEN; i++) {
if (i && !(i % 32))
DPRINTF(("\n "));
@ -309,14 +309,14 @@ ffb_attach(struct ffb_softc *sc)
break;
}
} else {
DPRINTF(("%s: No EDID data.\n", device_xname(&sc->sc_dv)));
DPRINTF(("%s: No EDID data.\n", device_xname(sc->sc_dev)));
}
ffb_ras_init(sc);
ffb_blank(sc, WSDISPLAYIO_SVIDEO, &blank);
sc->sc_accel = ((device_cfdata(&sc->sc_dv)->cf_flags &
sc->sc_accel = ((device_cfdata(sc->sc_dev)->cf_flags &
FFB_CFFLAG_NOACCEL) == 0);
wsfont_init();
@ -354,7 +354,7 @@ ffb_attach(struct ffb_softc *sc)
sc->sc_fb.fb_type.fb_width = sc->sc_width;
sc->sc_fb.fb_type.fb_depth = sc->sc_depth;
sc->sc_fb.fb_type.fb_height = sc->sc_height;
sc->sc_fb.fb_device = &sc->sc_dv;
sc->sc_fb.fb_device = sc->sc_dev;
fb_attach(&sc->sc_fb, sc->sc_console);
ffb_clearscreen(sc);
@ -368,7 +368,7 @@ ffb_attach(struct ffb_softc *sc)
waa.scrdata = &ffb_screenlist;
waa.accessops = &ffb_accessops;
waa.accesscookie = &sc->vd;
config_found(&sc->sc_dv, &waa, wsemuldisplaydevprint);
config_found(sc->sc_dev, &waa, wsemuldisplaydevprint);
}
void
@ -396,7 +396,7 @@ ffb_ioctl(void *v, void *vs, u_long cmd, void *data, int flags, struct lwp *l)
struct vcons_screen *ms = vd->active;
DPRINTF(("ffb_ioctl: %s cmd _IO%s%s('%c', %lu)\n",
device_xname(&sc->sc_dv),
device_xname(sc->sc_dev),
(cmd & IOC_IN) ? "W" : "", (cmd & IOC_OUT) ? "R" : "",
(char)IOCGROUP(cmd), cmd & 0xff));
@ -432,13 +432,16 @@ ffb_ioctl(void *v, void *vs, u_long cmd, void *data, int flags, struct lwp *l)
/* the console driver is not using the hardware cursor */
break;
case FBIOGCURPOS:
printf("%s: FBIOGCURPOS not implemented\n", device_xname(&sc->sc_dv));
printf("%s: FBIOGCURPOS not implemented\n",
device_xname(sc->sc_dev));
return EIO;
case FBIOSCURPOS:
printf("%s: FBIOSCURPOS not implemented\n", device_xname(&sc->sc_dv));
printf("%s: FBIOSCURPOS not implemented\n",
device_xname(sc->sc_dev));
return EIO;
case FBIOGCURMAX:
printf("%s: FBIOGCURMAX not implemented\n", device_xname(&sc->sc_dv));
printf("%s: FBIOGCURMAX not implemented\n",
device_xname(sc->sc_dev));
return EIO;
case WSDISPLAYIO_GTYPE:
@ -764,7 +767,7 @@ ffb_ras_setbg(struct ffb_softc *sc, int32_t bg)
/* frame buffer generic driver support functions */
static void
ffbfb_unblank(struct device *dev)
ffbfb_unblank(device_t dev)
{
struct ffb_softc *sc = device_private(dev);
struct vcons_screen *ms = sc->vd.active;
@ -1448,7 +1451,7 @@ ffb_set_vmode(struct ffb_softc *sc, struct videomode *mode, int btype,
*vres = mode->vdisplay;
printf("%s: video mode set to %d x %d @ %dHz\n",
device_xname(&sc->sc_dv),
device_xname(sc->sc_dev),
mode->hdisplay, mode->vdisplay,
DIVIDE(DIVIDE(mode->dot_clock * 1000,
mode->htotal), mode->vtotal));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffb_mainbus.c,v 1.9 2010/09/21 03:31:04 macallan Exp $ */
/* $NetBSD: ffb_mainbus.c,v 1.10 2011/06/03 03:20:39 christos Exp $ */
/* $OpenBSD: creator_mainbus.c,v 1.4 2002/07/26 16:39:04 jason Exp $ */
/*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffb_mainbus.c,v 1.9 2010/09/21 03:31:04 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffb_mainbus.c,v 1.10 2011/06/03 03:20:39 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -55,30 +55,31 @@ __KERNEL_RCSID(0, "$NetBSD: ffb_mainbus.c,v 1.9 2010/09/21 03:31:04 macallan Exp
extern int prom_stdout_node;
int ffb_mainbus_match(struct device *, struct cfdata *, void *);
void ffb_mainbus_attach(struct device *, struct device *, void *);
int ffb_mainbus_match(device_t, cfdata_t, void *);
void ffb_mainbus_attach(device_t, device_t, void *);
CFATTACH_DECL(ffb_mainbus, sizeof(struct ffb_softc),
ffb_mainbus_match, ffb_mainbus_attach, NULL, NULL);
CFATTACH_DECL_NEW(ffb_mainbus, sizeof(struct ffb_softc),
ffb_mainbus_match, ffb_mainbus_attach, NULL, NULL);
int
ffb_mainbus_match(struct device *parent, struct cfdata *match, void *aux)
ffb_mainbus_match(device_t parent, cfdata_t match, void *aux)
{
struct mainbus_attach_args *ma = aux;
if (strcmp(ma->ma_name, "SUNW,ffb") == 0 ||
strcmp(ma->ma_name, "SUNW,afb") == 0)
return (1);
return (0);
return 1;
return 0;
}
void
ffb_mainbus_attach(struct device *parent, struct device *self, void *aux)
ffb_mainbus_attach(device_t parent, device_t self, void *aux)
{
struct ffb_softc *sc = (struct ffb_softc *)self;
struct ffb_softc *sc = device_private(self);
struct mainbus_attach_args *ma = aux;
int i, nregs;
sc->sc_dev = self;
sc->sc_bt = ma->ma_bustag;
nregs = min(ma->ma_nreg, FFB_NREGS);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffbvar.h,v 1.10 2011/04/09 19:31:15 jdc Exp $ */
/* $NetBSD: ffbvar.h,v 1.11 2011/06/03 03:20:39 christos Exp $ */
/* $OpenBSD: creatorvar.h,v 1.6 2002/07/30 19:48:15 jason Exp $ */
/*
@ -49,7 +49,7 @@
#define EDID_DATA_LEN 128
struct ffb_softc {
struct device sc_dv;
device_t sc_dev;
struct fbdevice sc_fb;
bus_space_tag_t sc_bt;
bus_space_handle_t sc_dac_h;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcons.c,v 1.30 2011/04/24 16:26:57 rmind Exp $ */
/* $NetBSD: pcons.c,v 1.31 2011/06/03 03:20:39 christos Exp $ */
/*-
* Copyright (c) 2000 Eduardo E. Horvath
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.30 2011/04/24 16:26:57 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.31 2011/06/03 03:20:39 christos Exp $");
#include "opt_ddb.h"
@ -61,10 +61,10 @@ __KERNEL_RCSID(0, "$NetBSD: pcons.c,v 1.30 2011/04/24 16:26:57 rmind Exp $");
#include <sparc64/dev/cons.h>
static int pconsmatch(struct device *, struct cfdata *, void *);
static void pconsattach(struct device *, struct device *, void *);
static int pconsmatch(device_t, cfdata_t, void *);
static void pconsattach(device_t, device_t, void *);
CFATTACH_DECL(pcons, sizeof(struct pconssoftc),
CFATTACH_DECL_NEW(pcons, sizeof(struct pconssoftc),
pconsmatch, pconsattach, NULL, NULL);
extern struct cfdriver pcons_cd;
@ -88,7 +88,7 @@ static int pconsprobe(void);
extern struct consdev *cn_tab;
static int
pconsmatch(struct device *parent, struct cfdata *match, void *aux)
pconsmatch(device_t parent, cfdata_t match, void *aux)
{
struct mainbus_attach_args *ma = aux;
extern int prom_cngetc(dev_t);
@ -100,9 +100,10 @@ pconsmatch(struct device *parent, struct cfdata *match, void *aux)
}
static void
pconsattach(struct device *parent, struct device *self, void *aux)
pconsattach(device_t parent, device_t self, void *aux)
{
struct pconssoftc *sc = (struct pconssoftc *) self;
struct pconssoftc *sc = device_private(self);
sc->of_dev = self;
printf("\n");
if (!pconsprobe())

View File

@ -1,4 +1,4 @@
/* $NetBSD: pld_wdog.c,v 1.7 2009/03/18 10:22:37 cegger Exp $ */
/* $NetBSD: pld_wdog.c,v 1.8 2011/06/03 03:20:39 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -56,7 +56,7 @@
/* #define PLD_WDOG_DEBUG 1 */
struct pldwdog_softc {
struct device sc_dev;
device_t sc_dev;
bus_space_tag_t sc_btag;
bus_space_handle_t sc_bh;
@ -65,8 +65,8 @@ struct pldwdog_softc {
int sc_wdog_period;
};
int pldwdog_match(struct device *, struct cfdata *, void *);
void pldwdog_attach(struct device *, struct device *, void *);
int pldwdog_match(device_t, cfdata_t, void *);
void pldwdog_attach(device_t, device_t, void *);
CFATTACH_DECL(pldwdog, sizeof(struct pldwdog_softc),
pldwdog_match, pldwdog_attach, NULL, NULL);
@ -99,7 +99,8 @@ pldwdog_setmode(struct sysmon_wdog *smw)
struct pldwdog_softc *sc = smw->smw_cookie;
#ifdef PLD_WDOG_DEBUG
printf("%s:pldwdog_setmode: mode %x\n", device_xname(&sc->sc_dev), smw->smw_mode);
printf("%s:pldwdog_setmode: mode %x\n", device_xname(sc->sc_dev),
smw->smw_mode);
#endif
if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
@ -126,7 +127,7 @@ pldwdog_intr(void)
#endif
int
pldwdog_match(struct device *parent, struct cfdata *cf, void *aux)
pldwdog_match(device_t parent, cfdata_t cf, void *aux)
{
struct ebus_attach_args *ea = aux;
@ -139,24 +140,24 @@ pldwdog_regs(struct pldwdog_softc *sc)
{
printf("%s: status 0x%02x, intr mask 0x%02x\n",
device_xname(&sc->sc_dev),
device_xname(sc->sc_dev),
bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG_INTR_MASK),
bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG_STATUS));
printf("%s: wdog1: count 0x%04x, limit 0x%04x, status 0x%02x\n",
device_xname(&sc->sc_dev),
device_xname(sc->sc_dev),
bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG1_COUNTER),
bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG1_LIMIT),
bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG1_STATUS));
printf("%s: wdog2: count 0x%04x, limit 0x%04x, status 0x%02x\n",
device_xname(&sc->sc_dev),
device_xname(sc->sc_dev),
bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG2_COUNTER),
bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG2_LIMIT),
bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG2_STATUS));
printf("%s: wdog3: count 0x%04x, limit 0x%04x, status 0x%02x\n",
device_xname(&sc->sc_dev),
device_xname(sc->sc_dev),
bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG3_COUNTER),
bus_space_read_2(sc->sc_btag, sc->sc_bh, PLD_WDOG3_LIMIT),
bus_space_read_1(sc->sc_btag, sc->sc_bh, PLD_WDOG3_STATUS));
@ -164,13 +165,14 @@ pldwdog_regs(struct pldwdog_softc *sc)
#endif
void
pldwdog_attach(struct device *parent, struct device *self, void *aux)
pldwdog_attach(device_t parent, device_t self, void *aux)
{
struct pldwdog_softc *sc = (struct pldwdog_softc *)self;
struct pldwdog_softc *sc = device_private(self);
struct ebus_attach_args *ea = aux;
printf("\n");
sc->sc_dev = self;
sc->sc_btag = ea->ea_bustag;
if (ea->ea_nreg < 1) {
@ -188,14 +190,14 @@ pldwdog_attach(struct device *parent, struct device *self, void *aux)
sc->sc_wdog_period = PLD_WDOG_PERIOD_DEFAULT;
sc->sc_smw.smw_name = device_xname(&sc->sc_dev);
sc->sc_smw.smw_name = device_xname(sc->sc_dev);
sc->sc_smw.smw_cookie = sc;
sc->sc_smw.smw_setmode = pldwdog_setmode;
sc->sc_smw.smw_tickle = pldwdog_tickle;
sc->sc_smw.smw_period = sc->sc_wdog_period;
if (sysmon_wdog_register(&sc->sc_smw) != 0)
aprint_error_dev(&sc->sc_dev, "unable to register with sysmon\n");
aprint_error_dev(sc->sc_dev, "unable to register with sysmon\n");
/* pldwdog_regs(sc); */

View File

@ -1,4 +1,4 @@
/* $NetBSD: power.c,v 1.11 2009/03/18 10:22:37 cegger Exp $ */
/* $NetBSD: power.c,v 1.12 2011/06/03 03:20:39 christos Exp $ */
/*
* Copyright (c) 1996
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: power.c,v 1.11 2009/03/18 10:22:37 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: power.c,v 1.12 2011/06/03 03:20:39 christos Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -51,10 +51,10 @@ __KERNEL_RCSID(0, "$NetBSD: power.c,v 1.11 2009/03/18 10:22:37 cegger Exp $");
#include <sparc64/dev/power.h>
static int powermatch(struct device *, struct cfdata *, void *);
static void powerattach(struct device *, struct device *, void *);
static int powermatch(device_t, cfdata_t, void *);
static void powerattach(device_t, device_t, void *);
CFATTACH_DECL(power, sizeof(struct device),
CFATTACH_DECL_NEW(power, 0,
powermatch, powerattach, NULL, NULL);
extern struct cfdriver power_cd;
@ -68,19 +68,19 @@ extern struct cfdriver power_cd;
*/
static int
powermatch(struct device *parent, struct cfdata *cf, void *aux)
powermatch(device_t parent, cfdata_t cf, void *aux)
{
register struct confargs *ca = aux;
struct confargs *ca = aux;
if (CPU_ISSUN4M)
return (strcmp("power", ca->ca_ra.ra_name) == 0);
return strcmp("power", ca->ca_ra.ra_name) == 0;
return (0);
return 0;
}
/* ARGSUSED */
static void
powerattach(struct device *parent, struct device *self, void *aux)
powerattach(device_t parent, device_t self, void *aux)
{
struct confargs *ca = aux;
struct romaux *ra = &ca->ca_ra;