Split device_t/softc.
This commit is contained in:
parent
5b17090754
commit
07d8ce4981
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: maple.c,v 1.40 2008/10/19 14:05:49 mjf Exp $ */
|
||||
/* $NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.40 2008/10/19 14:05:49 mjf Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -107,8 +107,8 @@ __KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.40 2008/10/19 14:05:49 mjf Exp $");
|
|||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
static int maplematch(struct device *, struct cfdata *, void *);
|
||||
static void mapleattach(struct device *, struct device *, void *);
|
||||
static int maplematch(device_t, cfdata_t, void *);
|
||||
static void mapleattach(device_t, device_t, void *);
|
||||
static void maple_scanbus(struct maple_softc *);
|
||||
static char * maple_unit_name(char *, int port, int subunit);
|
||||
static void maple_begin_txbuf(struct maple_softc *);
|
||||
|
@ -157,7 +157,7 @@ void maple_free_dma(paddr_t, size_t);
|
|||
*/
|
||||
int maple_polling; /* Are we polling? (Debugger mode) */
|
||||
|
||||
CFATTACH_DECL(maple, sizeof(struct maple_softc),
|
||||
CFATTACH_DECL_NEW(maple, sizeof(struct maple_softc),
|
||||
maplematch, mapleattach, NULL, NULL);
|
||||
|
||||
extern struct cfdriver maple_cd;
|
||||
|
@ -172,14 +172,14 @@ const struct cdevsw maple_cdevsw = {
|
|||
};
|
||||
|
||||
static int
|
||||
maplematch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
maplematch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
mapleattach(struct device *parent, struct device *self, void *aux)
|
||||
mapleattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct maple_softc *sc;
|
||||
struct maple_unit *u;
|
||||
|
@ -188,13 +188,14 @@ mapleattach(struct device *parent, struct device *self, void *aux)
|
|||
uint32_t *p;
|
||||
int port, subunit, f;
|
||||
|
||||
sc = (struct maple_softc *)self;
|
||||
sc = device_private(self);
|
||||
sc->sc_dev = self;
|
||||
|
||||
printf(": %s\n", sysasic_intr_string(IRL_MAPLE));
|
||||
|
||||
if (maple_alloc_dma(MAPLE_DMABUF_SIZE, &dmabuffer, &dmabuffer_phys)) {
|
||||
printf("%s: unable to allocate DMA buffers.\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -246,10 +247,10 @@ mapleattach(struct device *parent, struct device *self, void *aux)
|
|||
config_pending_incr(); /* create thread before mounting root */
|
||||
|
||||
if (kthread_create(PRI_NONE, 0, NULL, maple_event_thread, sc,
|
||||
&sc->event_thread, "%s", sc->sc_dev.dv_xname) == 0)
|
||||
&sc->event_thread, "%s", device_xname(self)) == 0)
|
||||
return;
|
||||
|
||||
panic("%s: unable to create event thread", sc->sc_dev.dv_xname);
|
||||
panic("%s: unable to create event thread", device_xname(self));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -304,13 +305,13 @@ maple_scanbus(struct maple_softc *sc)
|
|||
}
|
||||
|
||||
void
|
||||
maple_run_polling(struct device *dev)
|
||||
maple_run_polling(device_t dev)
|
||||
{
|
||||
struct maple_softc *sc;
|
||||
int port, subunit;
|
||||
int i;
|
||||
|
||||
sc = (struct maple_softc *)dev;
|
||||
sc = device_private(dev);
|
||||
|
||||
/*
|
||||
* first, make sure polling works
|
||||
|
@ -672,10 +673,10 @@ maple_attach_unit(struct maple_softc *sc, struct maple_unit *u)
|
|||
ma.ma_basedevinfo = &sc->sc_unit[u->port][0].devinfo;
|
||||
func = be32toh(ma.ma_devinfo->di_func);
|
||||
|
||||
maple_print_unit(&ma, sc->sc_dev.dv_xname);
|
||||
maple_print_unit(&ma, device_xname(sc->sc_dev));
|
||||
printf("\n");
|
||||
strcpy(oldxname, sc->sc_dev.dv_xname);
|
||||
maple_unit_name(sc->sc_dev.dv_xname, u->port, u->subunit);
|
||||
strcpy(oldxname, device_xname(sc->sc_dev));
|
||||
maple_unit_name(sc->sc_dev->dv_xname, u->port, u->subunit);
|
||||
|
||||
for (f = 0; f < MAPLE_NFUNC; f++) {
|
||||
u->u_func[f].f_callback = NULL;
|
||||
|
@ -684,7 +685,7 @@ maple_attach_unit(struct maple_softc *sc, struct maple_unit *u)
|
|||
u->u_func[f].f_dev = NULL;
|
||||
if (func & MAPLE_FUNC(f)) {
|
||||
ma.ma_function = f;
|
||||
u->u_func[f].f_dev = config_found_sm_loc(&sc->sc_dev,
|
||||
u->u_func[f].f_dev = config_found_sm_loc(sc->sc_dev,
|
||||
"maple", NULL, &ma, mapleprint, maplesubmatch);
|
||||
u->u_ping_func = f; /* XXX using largest func */
|
||||
}
|
||||
|
@ -702,7 +703,7 @@ maple_attach_unit(struct maple_softc *sc, struct maple_unit *u)
|
|||
u->u_ping_stat = MAPLE_PING_NORMAL;
|
||||
}
|
||||
#endif
|
||||
strcpy(sc->sc_dev.dv_xname, oldxname);
|
||||
strcpy(sc->sc_dev->dv_xname, oldxname);
|
||||
|
||||
sc->sc_port_units[u->port] |= 1 << u->subunit;
|
||||
}
|
||||
|
@ -760,11 +761,11 @@ maple_detach_unit_nofix(struct maple_softc *sc, struct maple_unit *u)
|
|||
if ((error = config_detach(fn->f_dev, DETACH_FORCE))) {
|
||||
printf("%s: failed to detach %s (func %d), errno %d\n",
|
||||
maple_unit_name(buf, port, u->subunit),
|
||||
fn->f_dev->dv_xname, fn->f_funcno, error);
|
||||
device_xname(fn->f_dev), fn->f_funcno, error);
|
||||
}
|
||||
}
|
||||
|
||||
maple_enable_periodic(&sc->sc_dev, u, fn->f_funcno, 0);
|
||||
maple_enable_periodic(sc->sc_dev, u, fn->f_funcno, 0);
|
||||
|
||||
fn->f_dev = NULL;
|
||||
fn->f_callback = NULL;
|
||||
|
@ -821,10 +822,10 @@ maple_detach_unit(struct maple_softc *sc, struct maple_unit *u)
|
|||
* Only one command (per function) is valid at a time.
|
||||
*/
|
||||
void
|
||||
maple_command(struct device *dev, struct maple_unit *u, int func,
|
||||
maple_command(device_t dev, struct maple_unit *u, int func,
|
||||
int command, int datalen, const void *dataaddr, int flags)
|
||||
{
|
||||
struct maple_softc *sc = (void *) dev;
|
||||
struct maple_softc *sc = device_private(dev);
|
||||
struct maple_func *fn;
|
||||
int s;
|
||||
|
||||
|
@ -943,11 +944,10 @@ maple_unit_probe(struct maple_softc *sc)
|
|||
*/
|
||||
/* ARGSUSED */
|
||||
void
|
||||
maple_enable_unit_ping(struct device *dev, struct maple_unit *u,
|
||||
int func, int enable)
|
||||
maple_enable_unit_ping(device_t dev, struct maple_unit *u, int func, int enable)
|
||||
{
|
||||
#if 0 /* currently unused */
|
||||
struct maple_softc *sc = (void *) dev;
|
||||
struct maple_softc *sc = device_private(dev);
|
||||
#endif
|
||||
|
||||
if (enable)
|
||||
|
@ -1002,10 +1002,9 @@ maple_unit_ping(struct maple_softc *sc)
|
|||
* Enable/disable periodic GETCOND (called by drivers)
|
||||
*/
|
||||
void
|
||||
maple_enable_periodic(struct device *dev, struct maple_unit *u,
|
||||
int func, int on)
|
||||
maple_enable_periodic(device_t dev, struct maple_unit *u, int func, int on)
|
||||
{
|
||||
struct maple_softc *sc = (void *) dev;
|
||||
struct maple_softc *sc = device_private(dev);
|
||||
struct maple_func *fn;
|
||||
|
||||
KASSERT(func >= 0 && func < 32);
|
||||
|
@ -1422,7 +1421,7 @@ maple_event_thread(void *arg)
|
|||
|
||||
#ifdef MAPLE_DEBUG
|
||||
printf("%s: forked event thread, pid %d\n",
|
||||
sc->sc_dev.dv_xname, sc->event_thread->l_proc->p_pid);
|
||||
device_xname(sc->sc_dev), sc->event_thread->l_proc->p_pid);
|
||||
#endif
|
||||
|
||||
/* begin first DMA cycle */
|
||||
|
@ -1487,7 +1486,8 @@ maple_event_thread(void *arg)
|
|||
if (tsleep(&sc->sc_dmadone, PWAIT, "mdma", hz)
|
||||
== EWOULDBLOCK) {
|
||||
/* was DDB active? */
|
||||
printf("%s: timed out\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: timed out\n",
|
||||
device_xname(sc->sc_dev));
|
||||
}
|
||||
splx(s);
|
||||
|
||||
|
@ -1506,7 +1506,7 @@ maple_event_thread(void *arg)
|
|||
if (noreq) /* ignore first time */
|
||||
#endif
|
||||
printf("%s: no request %d\n",
|
||||
sc->sc_dev.dv_xname, noreq);
|
||||
device_xname(sc->sc_dev), noreq);
|
||||
noreq++;
|
||||
}
|
||||
#endif
|
||||
|
@ -1520,7 +1520,7 @@ maple_event_thread(void *arg)
|
|||
if (tsleep(&sc->sc_event, PWAIT, "mslp", hz)
|
||||
== EWOULDBLOCK) {
|
||||
printf("%s: event timed out\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(sc->sc_dev));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1558,11 +1558,11 @@ maple_callout(void *ctx)
|
|||
*/
|
||||
/* ARGSUSED */
|
||||
void
|
||||
maple_set_callback(struct device *dev, struct maple_unit *u, int func,
|
||||
maple_set_callback(device_t dev, struct maple_unit *u, int func,
|
||||
void (*callback)(void *, struct maple_response *, int, int), void *arg)
|
||||
{
|
||||
#if 0 /* currently unused */
|
||||
struct maple_softc *sc = (void *) dev;
|
||||
struct maple_softc *sc = device_private(dev);
|
||||
#endif
|
||||
struct maple_func *fn;
|
||||
|
||||
|
@ -1634,10 +1634,10 @@ mapleclose(dev_t dev, int flag, int mode, struct lwp *l)
|
|||
}
|
||||
|
||||
int
|
||||
maple_unit_ioctl(struct device *dev, struct maple_unit *u, u_long cmd,
|
||||
maple_unit_ioctl(device_t dev, struct maple_unit *u, u_long cmd,
|
||||
void *data, int flag, struct lwp *l)
|
||||
{
|
||||
struct maple_softc *sc = (struct maple_softc *)dev;
|
||||
struct maple_softc *sc = device_private(dev);
|
||||
|
||||
if (!(sc->sc_port_units[u->port] & (1 << u->subunit)))
|
||||
return ENXIO;
|
||||
|
@ -1662,5 +1662,5 @@ mapleioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
|||
sc = device_lookup_private(&maple_cd, MAPLEBUSUNIT(dev));
|
||||
u = &sc->sc_unit[MAPLEPORT(dev)][MAPLESUBUNIT(dev)];
|
||||
|
||||
return maple_unit_ioctl(&sc->sc_dev, u, cmd, data, flag, l);
|
||||
return maple_unit_ioctl(sc->sc_dev, u, cmd, data, flag, l);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: maple.h,v 1.11 2008/04/28 20:23:16 martin Exp $ */
|
||||
/* $NetBSD: maple.h,v 1.12 2010/10/17 14:13:44 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -128,19 +128,19 @@ struct maple_response {
|
|||
|
||||
struct maple_unit;
|
||||
|
||||
extern void maple_set_callback(struct device *, struct maple_unit *, int,
|
||||
void (*)(void *, struct maple_response *, int, int),
|
||||
void *);
|
||||
extern void maple_enable_unit_ping(struct device *, struct maple_unit *,
|
||||
int /*func*/, int /*enable*/);
|
||||
extern void maple_enable_periodic(struct device *, struct maple_unit *,
|
||||
int /*func*/, int /*on*/);
|
||||
extern void maple_command(struct device *, struct maple_unit *,
|
||||
int /*func*/, int /*command*/, int /*datalen*/,
|
||||
const void *, int /*flags*/);
|
||||
extern uint32_t maple_get_function_data(struct maple_devinfo *, int);
|
||||
extern void maple_run_polling(struct device *);
|
||||
extern int maple_unit_ioctl(struct device *, struct maple_unit *,
|
||||
u_long, void *, int, struct lwp *);
|
||||
void maple_set_callback(device_t, struct maple_unit *, int,
|
||||
void (*)(void *, struct maple_response *, int, int),
|
||||
void *);
|
||||
void maple_enable_unit_ping(device_t, struct maple_unit *,
|
||||
int /*func*/, int /*enable*/);
|
||||
void maple_enable_periodic(device_t, struct maple_unit *,
|
||||
int /*func*/, int /*on*/);
|
||||
void maple_command(device_t, struct maple_unit *,
|
||||
int /*func*/, int /*command*/, int /*datalen*/,
|
||||
const void *, int /*flags*/);
|
||||
uint32_t maple_get_function_data(struct maple_devinfo *, int);
|
||||
void maple_run_polling(device_t);
|
||||
int maple_unit_ioctl(device_t, struct maple_unit *,
|
||||
u_long, void *, int, struct lwp *);
|
||||
|
||||
#endif /* _DREAMCAST_DEV_MAPLE_MAPLE_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: maplevar.h,v 1.12 2008/04/28 20:23:16 martin Exp $ */
|
||||
/* $NetBSD: maplevar.h,v 1.13 2010/10/17 14:13:44 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -166,7 +166,7 @@ struct maple_unit {
|
|||
};
|
||||
|
||||
struct maple_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
|
||||
callout_t maple_callout_ch;
|
||||
lwp_t *event_thread;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkbd.c,v 1.27 2008/10/19 21:24:20 marcus Exp $ */
|
||||
/* $NetBSD: mkbd.c,v 1.28 2010/10/17 14:13:44 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mkbd.c,v 1.27 2008/10/19 21:24:20 marcus Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mkbd.c,v 1.28 2010/10/17 14:13:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -62,9 +62,9 @@ __KERNEL_RCSID(0, "$NetBSD: mkbd.c,v 1.27 2008/10/19 21:24:20 marcus Exp $");
|
|||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
static int mkbdmatch(struct device *, struct cfdata *, void *);
|
||||
static void mkbdattach(struct device *, struct device *, void *);
|
||||
static int mkbddetach(struct device *, int);
|
||||
static int mkbdmatch(device_t, cfdata_t, void *);
|
||||
static void mkbdattach(device_t, device_t, void *);
|
||||
static int mkbddetach(device_t, int);
|
||||
|
||||
int mkbd_enable(void *, int);
|
||||
void mkbd_set_leds(void *, int);
|
||||
|
@ -97,11 +97,11 @@ static struct mkbd_softc *mkbd_console_softc;
|
|||
static int mkbd_is_console;
|
||||
static int mkbd_console_initted;
|
||||
|
||||
CFATTACH_DECL(mkbd, sizeof(struct mkbd_softc),
|
||||
CFATTACH_DECL_NEW(mkbd, sizeof(struct mkbd_softc),
|
||||
mkbdmatch, mkbdattach, mkbddetach, NULL);
|
||||
|
||||
static int
|
||||
mkbdmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
mkbdmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct maple_attach_args *ma = aux;
|
||||
|
||||
|
@ -109,15 +109,16 @@ mkbdmatch(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
static void
|
||||
mkbdattach(struct device *parent, struct device *self, void *aux)
|
||||
mkbdattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct mkbd_softc *sc = (struct mkbd_softc *) self;
|
||||
struct mkbd_softc *sc = device_private(self);
|
||||
struct maple_attach_args *ma = aux;
|
||||
#if NWSKBD > 0
|
||||
struct wskbddev_attach_args a;
|
||||
#endif
|
||||
uint32_t kbdtype;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_parent = parent;
|
||||
sc->sc_unit = ma->ma_unit;
|
||||
|
||||
|
@ -168,9 +169,9 @@ mkbdattach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
|
||||
static int
|
||||
mkbddetach(struct device *self, int flags)
|
||||
mkbddetach(device_t self, int flags)
|
||||
{
|
||||
struct mkbd_softc *sc = (struct mkbd_softc *) self;
|
||||
struct mkbd_softc *sc = device_private(self);
|
||||
int rv = 0;
|
||||
|
||||
if (sc == mkbd_console_softc) {
|
||||
|
@ -178,7 +179,7 @@ mkbddetach(struct device *self, int flags)
|
|||
* Hack to allow another Maple keyboard to be new console.
|
||||
* XXX Should some other type device can be console.
|
||||
*/
|
||||
printf("%s: was console keyboard\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: was console keyboard\n", device_xname(sc->sc_dev));
|
||||
wskbd_cndetach();
|
||||
mkbd_console_softc = NULL;
|
||||
mkbd_console_initted = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkbdvar.h,v 1.6 2005/12/11 12:17:06 christos Exp $ */
|
||||
/* $NetBSD: mkbdvar.h,v 1.7 2010/10/17 14:13:44 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Marcus Comstedt
|
||||
|
@ -43,9 +43,9 @@ struct mkbd_condition {
|
|||
* State info, per keyboard instance.
|
||||
*/
|
||||
struct mkbd_softc {
|
||||
struct device sc_dev;
|
||||
struct device *sc_wskbddev;
|
||||
struct device *sc_parent;
|
||||
device_t sc_dev;
|
||||
device_t sc_wskbddev;
|
||||
device_t sc_parent;
|
||||
|
||||
struct maple_unit *sc_unit;
|
||||
struct mkbd_condition sc_condition;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mlcd.c,v 1.12 2010/02/24 22:58:45 dyoung Exp $ */
|
||||
/* $NetBSD: mlcd.c,v 1.13 2010/10/17 14:13:44 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mlcd.c,v 1.12 2010/02/24 22:58:45 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mlcd.c,v 1.13 2010/10/17 14:13:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -91,7 +91,7 @@ struct mlcd_buf {
|
|||
#define MLCD_BUF_SZ(sc) (offsetof(struct mlcd_buf, lb_data) + (sc)->sc_bsize)
|
||||
|
||||
struct mlcd_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
|
||||
device_t sc_parent;
|
||||
struct maple_unit *sc_unit;
|
||||
|
@ -148,7 +148,7 @@ struct mlcd_softc {
|
|||
#define MLCD_UNIT(dev) (minor(dev) >> 8)
|
||||
#define MLCD_MINOR(unit, part) (((unit) << 8) | (part))
|
||||
|
||||
static int mlcdmatch(device_t, struct cfdata *, void *);
|
||||
static int mlcdmatch(device_t, cfdata_t, void *);
|
||||
static void mlcdattach(device_t, device_t, void *);
|
||||
static int mlcddetach(device_t, int);
|
||||
static void mlcd_intr(void *, struct maple_response *, int, int);
|
||||
|
@ -171,7 +171,7 @@ const struct cdevsw mlcd_cdevsw = {
|
|||
nostop, notty, nopoll, nommap, nokqfilter
|
||||
};
|
||||
|
||||
CFATTACH_DECL(mlcd, sizeof(struct mlcd_softc),
|
||||
CFATTACH_DECL_NEW(mlcd, sizeof(struct mlcd_softc),
|
||||
mlcdmatch, mlcdattach, mlcddetach, NULL);
|
||||
|
||||
extern struct cfdriver mlcd_cd;
|
||||
|
@ -198,7 +198,7 @@ static const char initimg48x32[192] = {
|
|||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
mlcdmatch(device_t parent, struct cfdata *cf, void *aux)
|
||||
mlcdmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct maple_attach_args *ma = aux;
|
||||
|
||||
|
@ -216,6 +216,7 @@ mlcdattach(device_t parent, device_t self, void *aux)
|
|||
struct mlcd_funcdef s;
|
||||
} funcdef;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_parent = parent;
|
||||
sc->sc_unit = ma->ma_unit;
|
||||
sc->sc_direction = ma->ma_basedevinfo->di_connector_direction;
|
||||
|
@ -223,7 +224,7 @@ mlcdattach(device_t parent, device_t self, void *aux)
|
|||
funcdef.v = maple_get_function_data(ma->ma_devinfo, MAPLE_FN_LCD);
|
||||
printf(": LCD display\n");
|
||||
printf("%s: %d LCD, %d bytes/block, ",
|
||||
sc->sc_dev.dv_xname,
|
||||
device_xname(self),
|
||||
sc->sc_npt = funcdef.s.pt + 1,
|
||||
sc->sc_bsize = (funcdef.s.bb + 1) << 5);
|
||||
if ((sc->sc_wacc = funcdef.s.wa) == 0)
|
||||
|
@ -246,17 +247,17 @@ mlcdattach(device_t parent, device_t self, void *aux)
|
|||
sc->sc_waccsz = sc->sc_bsize / sc->sc_wacc;
|
||||
if (sc->sc_bsize != sc->sc_waccsz * sc->sc_wacc) {
|
||||
printf("%s: write access isn't equally divided\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
sc->sc_wacc = 0; /* no write */
|
||||
} else if (sc->sc_waccsz > MLCD_MAXACCSIZE) {
|
||||
printf("%s: write access size is too large\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
sc->sc_wacc = 0; /* no write */
|
||||
}
|
||||
}
|
||||
if (sc->sc_wacc == 0) {
|
||||
printf("%s: device doesn't support write\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -265,7 +266,7 @@ mlcdattach(device_t parent, device_t self, void *aux)
|
|||
M_WAITOK|M_ZERO);
|
||||
|
||||
for (i = 0; i < sc->sc_npt; i++) {
|
||||
sprintf(sc->sc_pt[i].pt_name, "%s.%d", sc->sc_dev.dv_xname, i);
|
||||
sprintf(sc->sc_pt[i].pt_name, "%s.%d", device_xname(self), i);
|
||||
}
|
||||
|
||||
maple_set_callback(parent, sc->sc_unit, MAPLE_FN_LCD,
|
||||
|
@ -324,9 +325,9 @@ mlcddetach(device_t self, int flags)
|
|||
*/
|
||||
/* ARGSUSED3 */
|
||||
static void
|
||||
mlcd_intr(void *dev, struct maple_response *response, int sz, int flags)
|
||||
mlcd_intr(void *arg, struct maple_response *response, int sz, int flags)
|
||||
{
|
||||
struct mlcd_softc *sc = dev;
|
||||
struct mlcd_softc *sc = arg;
|
||||
struct mlcd_response_media_info *rm = (void *) response->data;
|
||||
struct mlcd_buf *bp;
|
||||
int part;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mmemcard.c,v 1.18 2009/01/13 13:35:51 yamt Exp $ */
|
||||
/* $NetBSD: mmemcard.c,v 1.19 2010/10/17 14:13:44 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mmemcard.c,v 1.18 2009/01/13 13:35:51 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mmemcard.c,v 1.19 2010/10/17 14:13:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -102,9 +102,9 @@ struct mmem_response_media_info {
|
|||
};
|
||||
|
||||
struct mmem_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
|
||||
struct device *sc_parent;
|
||||
device_t sc_parent;
|
||||
struct maple_unit *sc_unit;
|
||||
struct maple_devinfo *sc_devinfo;
|
||||
|
||||
|
@ -167,11 +167,11 @@ struct mmem_softc {
|
|||
#define MMEM_DISKMINOR(unit, part, disklabel_partition) \
|
||||
DISKMINOR(((unit) << 8) | (part), (disklabel_partition))
|
||||
|
||||
static int mmemmatch(struct device *, struct cfdata *, void *);
|
||||
static void mmemattach(struct device *, struct device *, void *);
|
||||
static int mmemmatch(device_t, cfdata_t, void *);
|
||||
static void mmemattach(device_t, device_t, void *);
|
||||
static void mmem_defaultlabel(struct mmem_softc *, struct mmem_pt *,
|
||||
struct disklabel *);
|
||||
static int mmemdetach(struct device *, int);
|
||||
static int mmemdetach(device_t, int);
|
||||
static void mmem_intr(void *, struct maple_response *, int, int);
|
||||
static void mmem_printerror(const char *, int, int, uint32_t);
|
||||
static void mmemstart(struct mmem_softc *);
|
||||
|
@ -196,7 +196,7 @@ const struct cdevsw mmem_cdevsw = {
|
|||
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
|
||||
};
|
||||
|
||||
CFATTACH_DECL(mmem, sizeof(struct mmem_softc),
|
||||
CFATTACH_DECL_NEW(mmem, sizeof(struct mmem_softc),
|
||||
mmemmatch, mmemattach, mmemdetach, NULL);
|
||||
|
||||
extern struct cfdriver mmem_cd;
|
||||
|
@ -204,7 +204,7 @@ extern struct cfdriver mmem_cd;
|
|||
struct dkdriver mmemdkdriver = { mmemstrategy };
|
||||
|
||||
static int
|
||||
mmemmatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
mmemmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct maple_attach_args *ma = aux;
|
||||
|
||||
|
@ -212,9 +212,9 @@ mmemmatch(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
static void
|
||||
mmemattach(struct device *parent, struct device *self, void *aux)
|
||||
mmemattach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct mmem_softc *sc = (void *)self;
|
||||
struct mmem_softc *sc = device_private(self);
|
||||
struct maple_attach_args *ma = aux;
|
||||
int i;
|
||||
union {
|
||||
|
@ -222,6 +222,7 @@ mmemattach(struct device *parent, struct device *self, void *aux)
|
|||
struct mmem_funcdef s;
|
||||
} funcdef;
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_parent = parent;
|
||||
sc->sc_unit = ma->ma_unit;
|
||||
sc->sc_devinfo = ma->ma_devinfo;
|
||||
|
@ -229,7 +230,7 @@ mmemattach(struct device *parent, struct device *self, void *aux)
|
|||
funcdef.v = maple_get_function_data(ma->ma_devinfo, MAPLE_FN_MEMCARD);
|
||||
printf(": Memory card\n");
|
||||
printf("%s: %d part, %d bytes/block, ",
|
||||
sc->sc_dev.dv_xname,
|
||||
device_xname(self),
|
||||
sc->sc_npt = funcdef.s.pt + 1,
|
||||
sc->sc_bsize = (funcdef.s.bb + 1) << 5);
|
||||
if ((sc->sc_wacc = funcdef.s.wa) == 0)
|
||||
|
@ -252,11 +253,11 @@ mmemattach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_waccsz = sc->sc_bsize / sc->sc_wacc;
|
||||
if (sc->sc_bsize != sc->sc_waccsz * sc->sc_wacc) {
|
||||
printf("%s: write access isn't equally divided\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
sc->sc_wacc = 0; /* no write */
|
||||
} else if (sc->sc_waccsz > MMEM_MAXACCSIZE) {
|
||||
printf("%s: write access size is too large\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
sc->sc_wacc = 0; /* no write */
|
||||
}
|
||||
}
|
||||
|
@ -264,17 +265,17 @@ mmemattach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_raccsz = sc->sc_bsize / sc->sc_racc;
|
||||
if (sc->sc_bsize != sc->sc_raccsz * sc->sc_racc) {
|
||||
printf("%s: read access isn't equally divided\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
sc->sc_racc = 0; /* no read */
|
||||
} else if (sc->sc_raccsz > MMEM_MAXACCSIZE) {
|
||||
printf("%s: read access size is too large\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
sc->sc_racc = 0; /* no read */
|
||||
}
|
||||
}
|
||||
if (sc->sc_wacc == 0 && sc->sc_racc == 0) {
|
||||
printf("%s: device doesn't support read nor write\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(self));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -283,7 +284,7 @@ mmemattach(struct device *parent, struct device *self, void *aux)
|
|||
M_WAITOK|M_ZERO);
|
||||
|
||||
for (i = 0; i < sc->sc_npt; i++) {
|
||||
sprintf(sc->sc_pt[i].pt_name, "%s.%d", sc->sc_dev.dv_xname, i);
|
||||
sprintf(sc->sc_pt[i].pt_name, "%s.%d", device_xname(self), i);
|
||||
}
|
||||
|
||||
maple_set_callback(parent, sc->sc_unit, MAPLE_FN_MEMCARD,
|
||||
|
@ -299,9 +300,9 @@ mmemattach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
|
||||
static int
|
||||
mmemdetach(struct device *self, int flags)
|
||||
mmemdetach(device_t self, int flags)
|
||||
{
|
||||
struct mmem_softc *sc = (struct mmem_softc *) self;
|
||||
struct mmem_softc *sc = device_private(self);
|
||||
struct buf *bp;
|
||||
int i;
|
||||
int minor_l, minor_h;
|
||||
|
@ -386,9 +387,9 @@ mmem_defaultlabel(struct mmem_softc *sc, struct mmem_pt *pt,
|
|||
* called back from maple bus driver
|
||||
*/
|
||||
static void
|
||||
mmem_intr(void *dev, struct maple_response *response, int sz, int flags)
|
||||
mmem_intr(void *arg, struct maple_response *response, int sz, int flags)
|
||||
{
|
||||
struct mmem_softc *sc = dev;
|
||||
struct mmem_softc *sc = arg;
|
||||
struct mmem_response_read_data *r = (void *) response->data;
|
||||
struct mmem_response_media_info *rm = (void *) response->data;
|
||||
struct buf *bp;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mms.c,v 1.14 2008/04/28 20:23:16 martin Exp $ */
|
||||
/* $NetBSD: mms.c,v 1.15 2010/10/17 14:13:44 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mms.c,v 1.14 2008/04/28 20:23:16 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mms.c,v 1.15 2010/10/17 14:13:44 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -81,9 +81,9 @@ struct mms_condition {
|
|||
#define MMS_FUNCDATA_START 0x800
|
||||
|
||||
struct mms_softc {
|
||||
struct device sc_dev;
|
||||
device_t sc_dev;
|
||||
|
||||
struct device *sc_parent;
|
||||
device_t sc_parent;
|
||||
struct maple_unit *sc_unit;
|
||||
|
||||
uint32_t sc_oldbuttons;
|
||||
|
@ -91,11 +91,11 @@ struct mms_softc {
|
|||
struct device *sc_wsmousedev;
|
||||
};
|
||||
|
||||
int mms_match(struct device *, struct cfdata *, void *);
|
||||
void mms_attach(struct device *, struct device *, void *);
|
||||
int mms_detach(struct device *, int);
|
||||
int mms_match(device_t, cfdata_t, void *);
|
||||
void mms_attach(device_t, device_t, void *);
|
||||
int mms_detach(device_t, int);
|
||||
|
||||
CFATTACH_DECL(mms, sizeof(struct mms_softc),
|
||||
CFATTACH_DECL_NEW(mms, sizeof(struct mms_softc),
|
||||
mms_match, mms_attach, mms_detach, NULL);
|
||||
|
||||
int mms_enable(void *);
|
||||
|
@ -111,7 +111,7 @@ const struct wsmouse_accessops mms_accessops = {
|
|||
void mms_intr(void *, struct maple_response *, int, int);
|
||||
|
||||
int
|
||||
mms_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
mms_match(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct maple_attach_args *ma = aux;
|
||||
|
||||
|
@ -119,22 +119,23 @@ mms_match(struct device *parent, struct cfdata *cf, void *aux)
|
|||
}
|
||||
|
||||
void
|
||||
mms_attach(struct device *parent, struct device *self, void *aux)
|
||||
mms_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct mms_softc *sc = (void *) self;
|
||||
struct mms_softc *sc = device_private(self);
|
||||
struct maple_attach_args *ma = aux;
|
||||
struct wsmousedev_attach_args a;
|
||||
uint32_t data;
|
||||
|
||||
printf(": SEGA Dreamcast Mouse\n");
|
||||
|
||||
sc->sc_dev = self;
|
||||
sc->sc_parent = parent;
|
||||
sc->sc_unit = ma->ma_unit;
|
||||
|
||||
data = maple_get_function_data(ma->ma_devinfo,
|
||||
MAPLE_FN_MOUSE);
|
||||
|
||||
printf("%s: buttons:", sc->sc_dev.dv_xname);
|
||||
printf("%s: buttons:", device_xname(self));
|
||||
if (data & MMS_FUNCDATA_A)
|
||||
printf(" left");
|
||||
if (data & MMS_FUNCDATA_C)
|
||||
|
@ -163,9 +164,9 @@ mms_attach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
|
||||
int
|
||||
mms_detach(struct device *self, int flags)
|
||||
mms_detach(device_t self, int flags)
|
||||
{
|
||||
struct mms_softc *sc = (void *) self;
|
||||
struct mms_softc *sc = device_private(self);
|
||||
int rv = 0;
|
||||
|
||||
if (sc->sc_wsmousedev != NULL)
|
||||
|
|
Loading…
Reference in New Issue