finish device_t-ification

This commit is contained in:
macallan 2010-10-07 07:53:53 +00:00
parent a2939d499b
commit 4fbc897fbb
4 changed files with 22 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfb_pci.c,v 1.24 2010/02/25 21:09:00 macallan Exp $ */
/* $NetBSD: genfb_pci.c,v 1.25 2010/10/07 07:53:54 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.24 2010/02/25 21:09:00 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.25 2010/10/07 07:53:54 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -66,7 +66,7 @@ static paddr_t pci_genfb_mmap(void *, void *, off_t, int);
static int pci_genfb_borrow(void *, bus_addr_t, bus_space_handle_t *);
static int pci_genfb_drm_print(void *, const char *);
CFATTACH_DECL(genfb_pci, sizeof(struct pci_genfb_softc),
CFATTACH_DECL_NEW(genfb_pci, sizeof(struct pci_genfb_softc),
pci_genfb_match, pci_genfb_attach, NULL, NULL);
static int
@ -105,6 +105,7 @@ pci_genfb_attach(device_t parent, device_t self, void *aux)
aprint_naive("\n");
aprint_normal(": %s\n", devinfo);
sc->sc_gen.sc_dev = self;
sc->sc_memt = pa->pa_memt;
sc->sc_iot = pa->pa_iot;
sc->sc_pc = pa->pa_pc;
@ -244,7 +245,7 @@ pci_genfb_mmap(void *v, void *vs, off_t offset, int prot)
*/
if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
NULL) != 0) {
aprint_normal_dev(&sc->sc_gen.sc_dev, "mmap() rejected.\n");
aprint_normal_dev(sc->sc_gen.sc_dev, "mmap() rejected.\n");
return -1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfb_sbus.c,v 1.9 2009/09/18 12:23:16 tsutsui Exp $ */
/* $NetBSD: genfb_sbus.c,v 1.10 2010/10/07 07:53:54 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -29,7 +29,7 @@
/* an SBus frontend for the generic fb console driver */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfb_sbus.c,v 1.9 2009/09/18 12:23:16 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfb_sbus.c,v 1.10 2010/10/07 07:53:54 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -62,7 +62,7 @@ static int genfb_ioctl_sbus(void *, void *, u_long, void *, int,
struct lwp*);
static paddr_t genfb_mmap_sbus(void *, void *, off_t, int);
CFATTACH_DECL(genfb_sbus, sizeof(struct genfb_sbus_softc),
CFATTACH_DECL_NEW(genfb_sbus, sizeof(struct genfb_sbus_softc),
genfb_match_sbus, genfb_attach_sbus, NULL, NULL);
/*
@ -100,6 +100,7 @@ genfb_attach_sbus(device_t parent, device_t self, void *args)
int isconsole;
aprint_normal("\n");
sc->sc_gen.sc_dev = self;
/* Remember cookies for genfb_mmap_sbus() */
sc->sc_tag = sa->sa_bustag;
sc->sc_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_slot, sa->sa_offset);

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfb.c,v 1.31 2010/10/06 02:24:35 macallan Exp $ */
/* $NetBSD: genfb.c,v 1.32 2010/10/07 07:53:53 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.31 2010/10/06 02:24:35 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.32 2010/10/07 07:53:53 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -106,7 +106,7 @@ genfb_init(struct genfb_softc *sc)
uint32_t fboffset;
bool console;
dict = device_properties(&sc->sc_dev);
dict = device_properties(sc->sc_dev);
#ifdef GENFB_DEBUG
printf(prop_dictionary_externalize(dict));
#endif
@ -165,16 +165,16 @@ genfb_init(struct genfb_softc *sc)
if (bl_cb != 0) {
sc->sc_backlight = (void *)(vaddr_t)bl_cb;
sc->sc_backlight_on = 1;
aprint_naive_dev(&sc->sc_dev,
aprint_naive_dev(sc->sc_dev,
"enabling backlight control\n");
sc->sc_backlight_level =
sc->sc_backlight->gpc_get_parameter(
sc->sc_backlight->gpc_cookie);
if (console) {
pmf_event_register(&sc->sc_dev,
pmf_event_register(sc->sc_dev,
PMFE_DISPLAY_BRIGHTNESS_UP,
genfb_brightness_up, TRUE);
pmf_event_register(&sc->sc_dev,
pmf_event_register(sc->sc_dev,
PMFE_DISPLAY_BRIGHTNESS_DOWN,
genfb_brightness_down, TRUE);
}
@ -193,7 +193,7 @@ genfb_attach(struct genfb_softc *sc, struct genfb_ops *ops)
int i, j;
bool console;
dict = device_properties(&sc->sc_dev);
dict = device_properties(sc->sc_dev);
prop_dictionary_get_bool(dict, "is_console", &console);
if (prop_dictionary_get_uint16(dict, "cursor-row", &crow) == false)
@ -204,11 +204,11 @@ genfb_attach(struct genfb_softc *sc, struct genfb_ops *ops)
/* do not attach when we're not console */
if (!console) {
aprint_normal_dev(&sc->sc_dev, "no console, unable to continue\n");
aprint_normal_dev(sc->sc_dev, "no console, unable to continue\n");
return -1;
}
aprint_verbose_dev(&sc->sc_dev, "framebuffer at %p, size %dx%d, depth %d, "
aprint_verbose_dev(sc->sc_dev, "framebuffer at %p, size %dx%d, depth %d, "
"stride %d\n",
sc->sc_fboffset ? (void *)(intptr_t)sc->sc_fboffset : sc->sc_fbaddr,
sc->sc_width, sc->sc_height, sc->sc_depth, sc->sc_stride);
@ -328,7 +328,7 @@ genfb_attach(struct genfb_softc *sc, struct genfb_ops *ops)
SCREEN_DISABLE_DRAWING(&sc->sc_console_screen);
#endif
config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);
config_found(sc->sc_dev, &aa, wsemuldisplaydevprint);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfbvar.h,v 1.16 2010/10/06 02:24:35 macallan Exp $ */
/* $NetBSD: genfbvar.h,v 1.17 2010/10/07 07:53:53 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.16 2010/10/06 02:24:35 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.17 2010/10/07 07:53:53 macallan Exp $");
#ifndef GENFBVAR_H
#define GENFBVAR_H
@ -78,7 +78,7 @@ struct genfb_pmf_callback {
};
struct genfb_softc {
struct device sc_dev;
device_t sc_dev;
struct vcons_data vd;
struct genfb_ops sc_ops;
struct vcons_screen sc_console_screen;