Split device_t/softc, use aprint*().

This commit is contained in:
isaki 2009-01-17 10:02:23 +00:00
parent cbd07c5ca6
commit 60e2f02631
6 changed files with 52 additions and 53 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf.c,v 1.36 2008/06/14 13:36:24 isaki Exp $ */ /* $NetBSD: grf.c,v 1.37 2009/01/17 10:02:23 isaki Exp $ */
/* /*
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -83,7 +83,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.36 2008/06/14 13:36:24 isaki Exp $"); __KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.37 2009/01/17 10:02:23 isaki Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -245,7 +245,7 @@ grfmmap(dev_t dev, off_t off, int prot)
int int
grfon(struct grf_softc *gp) grfon(struct grf_softc *gp)
{ {
int unit = device_unit(&gp->g_device); int unit = device_unit(gp->g_device);
/* /*
* XXX: iteoff call relies on devices being in same order * XXX: iteoff call relies on devices being in same order
@ -260,7 +260,7 @@ grfon(struct grf_softc *gp)
int int
grfoff(struct grf_softc *gp) grfoff(struct grf_softc *gp)
{ {
int unit = device_unit(&gp->g_device); int unit = device_unit(gp->g_device);
int error; int error;
#if 0 /* always fails in EINVAL... */ #if 0 /* always fails in EINVAL... */

View File

@ -1,4 +1,4 @@
/* $NetBSD: grf_machdep.c,v 1.28 2009/01/17 09:20:46 isaki Exp $ */ /* $NetBSD: grf_machdep.c,v 1.29 2009/01/17 10:02:23 isaki Exp $ */
/* /*
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -82,7 +82,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: grf_machdep.c,v 1.28 2009/01/17 09:20:46 isaki Exp $"); __KERNEL_RCSID(0, "$NetBSD: grf_machdep.c,v 1.29 2009/01/17 10:02:23 isaki Exp $");
#include "locators.h" #include "locators.h"
@ -97,27 +97,27 @@ __KERNEL_RCSID(0, "$NetBSD: grf_machdep.c,v 1.28 2009/01/17 09:20:46 isaki Exp $
/* grfbus: is this necessary? */ /* grfbus: is this necessary? */
int grfbusprint(void *auxp, const char *); int grfbusprint(void *auxp, const char *);
int grfbusmatch(struct device *, struct cfdata *, void *); int grfbusmatch(device_t, cfdata_t, void *);
void grfbusattach(struct device *, struct device *, void *); void grfbusattach(device_t, device_t, void *);
int grfbussearch(struct device *, struct cfdata *, const int *, void *); int grfbussearch(device_t, cfdata_t, const int *, void *);
/* grf itself */ /* grf itself */
void grfattach(struct device *, struct device *, void *); int grfmatch(device_t, cfdata_t, void *);
int grfmatch(struct device *, struct cfdata *, void *); void grfattach(device_t, device_t, void *);
int grfprint(void *, const char *); int grfprint(void *, const char *);
static int grfinit(void *, int); static int grfinit(struct grf_softc *, int);
CFATTACH_DECL(grfbus, sizeof(struct device), CFATTACH_DECL_NEW(grfbus, 0,
grfbusmatch, grfbusattach, NULL, NULL); grfbusmatch, grfbusattach, NULL, NULL);
CFATTACH_DECL(grf, sizeof(struct grf_softc), CFATTACH_DECL_NEW(grf, sizeof(struct grf_softc),
grfmatch, grfattach, NULL, NULL); grfmatch, grfattach, NULL, NULL);
extern struct cfdriver grfbus_cd; extern struct cfdriver grfbus_cd;
int int
grfbusmatch(struct device *pdp, struct cfdata *cfp, void *auxp) grfbusmatch(device_t pdp, cfdata_t cfp, void *auxp)
{ {
if (strcmp(auxp, grfbus_cd.cd_name)) if (strcmp(auxp, grfbus_cd.cd_name))
return (0); return (0);
@ -126,16 +126,15 @@ grfbusmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
} }
void void
grfbusattach(struct device *pdp, struct device *dp, void *auxp) grfbusattach(device_t pdp, device_t dp, void *auxp)
{ {
printf("\n"); aprint_normal("\n");
config_search_ia(grfbussearch, dp, "grfb", NULL); config_search_ia(grfbussearch, dp, "grfb", NULL);
} }
int int
grfbussearch(struct device *dp, struct cfdata *match, grfbussearch(device_t dp, cfdata_t match, const int *ldesc, void *aux)
const int *ldesc, void *aux)
{ {
config_found(dp, &match->cf_loc[GRFBCF_ADDR], grfbusprint); config_found(dp, &match->cf_loc[GRFBCF_ADDR], grfbusprint);
@ -155,7 +154,7 @@ grfbusprint(void *auxp, const char *name)
* Normal init routine called by configure() code * Normal init routine called by configure() code
*/ */
int int
grfmatch(struct device *parent, struct cfdata *cfp, void *aux) grfmatch(device_t parent, cfdata_t cfp, void *aux)
{ {
int addr; int addr;
@ -169,7 +168,7 @@ grfmatch(struct device *parent, struct cfdata *cfp, void *aux)
struct grf_softc congrf; struct grf_softc congrf;
void void
grfattach(struct device *parent, struct device *dp, void *aux) grfattach(device_t parent, device_t dp, void *aux)
{ {
struct grf_softc *gp; struct grf_softc *gp;
struct cfdata *cf; struct cfdata *cf;
@ -177,16 +176,19 @@ grfattach(struct device *parent, struct device *dp, void *aux)
cf = device_cfdata(dp); cf = device_cfdata(dp);
addr = cf->cf_loc[GRFBCF_ADDR]; addr = cf->cf_loc[GRFBCF_ADDR];
grfinit(dp, addr);
gp = (struct grf_softc *)dp; gp = device_private(dp);
gp->g_device = dp;
gp->g_cfaddr = addr; gp->g_cfaddr = addr;
printf(": %d x %d ", gp->g_display.gd_dwidth, gp->g_display.gd_dheight); grfinit(gp, addr);
aprint_normal(": %d x %d ",
gp->g_display.gd_dwidth, gp->g_display.gd_dheight);
if (gp->g_display.gd_colors == 2) if (gp->g_display.gd_colors == 2)
printf("monochrome"); aprint_normal("monochrome");
else else
printf("%d colors", gp->g_display.gd_colors); aprint_normal("%d colors", gp->g_display.gd_colors);
printf(" %s display\n", gp->g_sw->gd_desc); aprint_normal(" %s display\n", gp->g_sw->gd_desc);
/* /*
* try and attach an ite * try and attach an ite
@ -204,9 +206,8 @@ grfprint(void *auxp, const char *pnp)
} }
int int
grfinit(void *dp, int cfaddr) grfinit(struct grf_softc *gp, int cfaddr)
{ {
struct grf_softc *gp = dp;
struct grfsw *gsw; struct grfsw *gsw;
void *addr; void *addr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: grfvar.h,v 1.10 2007/03/04 06:01:06 christos Exp $ */ /* $NetBSD: grfvar.h,v 1.11 2009/01/17 10:02:23 isaki Exp $ */
/* /*
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -98,7 +98,7 @@ struct grfsw {
/* per display info */ /* per display info */
struct grf_softc { struct grf_softc {
struct device g_device; /* for config */ device_t g_device; /* for config */
int g_flags; /* software flags */ int g_flags; /* software flags */
int g_cfaddr; /* "addr" locator */ int g_cfaddr; /* "addr" locator */
struct grfsw *g_sw; /* static configuration info */ struct grfsw *g_sw; /* static configuration info */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.56 2009/01/17 09:20:46 isaki Exp $ */ /* $NetBSD: ite.c,v 1.57 2009/01/17 10:02:23 isaki Exp $ */
/* /*
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -83,7 +83,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.56 2009/01/17 09:20:46 isaki Exp $"); __KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.57 2009/01/17 10:02:23 isaki Exp $");
#include "ite.h" #include "ite.h"
#if NITE > 0 #if NITE > 0
@ -186,10 +186,10 @@ void itestart(struct tty *);
void iteputchar(int, struct ite_softc *); void iteputchar(int, struct ite_softc *);
void ite_putstr(const u_char *, int, dev_t); void ite_putstr(const u_char *, int, dev_t);
void iteattach(struct device *, struct device *, void *); int itematch(device_t, cfdata_t, void *);
int itematch(struct device *, struct cfdata *, void *); void iteattach(device_t, device_t, void *);
CFATTACH_DECL(ite, sizeof(struct ite_softc), CFATTACH_DECL_NEW(ite, sizeof(struct ite_softc),
itematch, iteattach, NULL, NULL); itematch, iteattach, NULL, NULL);
extern struct cfdriver ite_cd; extern struct cfdriver ite_cd;
@ -208,7 +208,7 @@ const struct cdevsw ite_cdevsw = {
}; };
int int
itematch(struct device *pdp, struct cfdata *cdp, void *auxp) itematch(device_t pdp, cfdata_t cdp, void *auxp)
{ {
struct grf_softc *gp; struct grf_softc *gp;
@ -224,13 +224,13 @@ itematch(struct device *pdp, struct cfdata *cdp, void *auxp)
* an ite device, it is also called from ite_cninit(). * an ite device, it is also called from ite_cninit().
*/ */
void void
iteattach(struct device *pdp, struct device *dp, void *auxp) iteattach(device_t pdp, device_t dp, void *auxp)
{ {
struct ite_softc *ip; struct ite_softc *ip;
struct grf_softc *gp; struct grf_softc *gp;
gp = (struct grf_softc *)auxp; gp = (struct grf_softc *)auxp;
ip = (struct ite_softc *)dp; ip = device_private(dp);
if(con_itesoftc.grf != NULL if(con_itesoftc.grf != NULL
/*&& con_itesoftc.grf->g_unit == gp->g_unit*/) { /*&& con_itesoftc.grf->g_unit == gp->g_unit*/) {
/* /*
@ -244,10 +244,10 @@ iteattach(struct device *pdp, struct device *dp, void *auxp)
} }
ip->grf = gp; ip->grf = gp;
iteinit(device_unit(&ip->device)); /* XXX */ iteinit(device_unit(&ip->device)); /* XXX */
printf(": rows %d cols %d", ip->rows, ip->cols); aprint_normal(": rows %d cols %d", ip->rows, ip->cols);
if (kbd_ite == NULL) if (kbd_ite == NULL)
kbd_ite = ip; kbd_ite = ip;
printf("\n"); aprint_normal("\n");
} }
struct ite_softc * struct ite_softc *

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfp.c,v 1.22 2009/01/17 09:20:46 isaki Exp $ */ /* $NetBSD: mfp.c,v 1.23 2009/01/17 10:02:23 isaki Exp $ */
/*- /*-
* Copyright (c) 1998 NetBSD Foundation, Inc. * Copyright (c) 1998 NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfp.c,v 1.22 2009/01/17 09:20:46 isaki Exp $"); __KERNEL_RCSID(0, "$NetBSD: mfp.c,v 1.23 2009/01/17 10:02:23 isaki Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -56,19 +56,19 @@ __KERNEL_RCSID(0, "$NetBSD: mfp.c,v 1.22 2009/01/17 09:20:46 isaki Exp $");
#include <arch/x68k/dev/intiovar.h> #include <arch/x68k/dev/intiovar.h>
#include <arch/x68k/dev/mfp.h> #include <arch/x68k/dev/mfp.h>
static int mfp_match(struct device *, struct cfdata *, void *); static int mfp_match(device_t, cfdata_t, void *);
static void mfp_attach(struct device *, struct device *, void *); static void mfp_attach(device_t, device_t, void *);
static int mfp_search(device_t, cfdata_t, const int *, void *); static int mfp_search(device_t, cfdata_t, const int *, void *);
static void mfp_init(void); static void mfp_init(void);
static void mfp_calibrate_delay(void); static void mfp_calibrate_delay(void);
CFATTACH_DECL(mfp, sizeof(struct mfp_softc), CFATTACH_DECL_NEW(mfp, sizeof(struct mfp_softc),
mfp_match, mfp_attach, NULL, NULL); mfp_match, mfp_attach, NULL, NULL);
static int mfp_attached; static int mfp_attached;
static int static int
mfp_match(struct device *parent, struct cfdata *cf, void *aux) mfp_match(device_t parent, cfdata_t cf, void *aux)
{ {
struct intio_attach_args *ia = aux; struct intio_attach_args *ia = aux;
@ -94,13 +94,13 @@ mfp_match(struct device *parent, struct cfdata *cf, void *aux)
static void static void
mfp_attach(struct device *parent, struct device *self, void *aux) mfp_attach(device_t parent, device_t self, void *aux)
{ {
struct mfp_softc *sc = (struct mfp_softc *)self; struct mfp_softc *sc = device_private(self);
struct intio_attach_args *ia = aux; struct intio_attach_args *ia = aux;
int r; int r;
printf("\n"); aprint_normal("\n");
mfp_attached = 1; mfp_attached = 1;
mfp_init(); mfp_init();

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfp.h,v 1.7 2008/12/18 05:56:42 isaki Exp $ */ /* $NetBSD: mfp.h,v 1.8 2009/01/17 10:02:23 isaki Exp $ */
/* /*
* *
@ -36,8 +36,6 @@
#define MFP_INTR 0x40 #define MFP_INTR 0x40
struct mfp_softc { struct mfp_softc {
struct device sc_dev;
bus_space_tag_t sc_bst; bus_space_tag_t sc_bst;
bus_space_handle_t sc_bht; bus_space_handle_t sc_bht;
int sc_intr; int sc_intr;