Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Expose genfb_restore_palette and allow MD code to sp...
details: https://anonhg.NetBSD.org/src/rev/48225947ba71
branches: trunk
changeset: 746949:48225947ba71
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Aug 24 11:03:44 2009 +0000
description:
Expose genfb_restore_palette and allow MD code to specify PMF callbacks.
diffstat:
sys/dev/pci/genfb_pci.c | 15 ++++++++++-----
sys/dev/wsfb/genfb.c | 15 ++++++++++-----
sys/dev/wsfb/genfbvar.h | 12 ++++++++++--
3 files changed, 30 insertions(+), 12 deletions(-)
diffs (140 lines):
diff -r ad76ca6fc765 -r 48225947ba71 sys/dev/pci/genfb_pci.c
--- a/sys/dev/pci/genfb_pci.c Mon Aug 24 10:16:12 2009 +0000
+++ b/sys/dev/pci/genfb_pci.c Mon Aug 24 11:03:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_pci.c,v 1.21 2009/08/24 02:10:41 jmcneill Exp $ */
+/* $NetBSD: genfb_pci.c,v 1.22 2009/08/24 11:03:44 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.21 2009/08/24 02:10:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.22 2009/08/24 11:03:44 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -128,10 +128,15 @@
sc->sc_pcitag = pa->pa_tag;
sc->sc_want_wsfb = 0;
+ genfb_init(&sc->sc_gen);
+
/* firmware / MD code responsible for restoring the display */
- pmf_device_register(self, NULL, NULL);
-
- genfb_init(&sc->sc_gen);
+ if (sc->sc_gen.sc_pmfcb == NULL)
+ pmf_device_register(self, NULL, NULL);
+ else
+ pmf_device_register(self,
+ sc->sc_gen.sc_pmfcb->gpc_suspend,
+ sc->sc_gen.sc_pmfcb->gpc_resume);
if ((sc->sc_gen.sc_width == 0) || (sc->sc_gen.sc_fbsize == 0)) {
aprint_debug_dev(self, "not configured by firmware\n");
diff -r ad76ca6fc765 -r 48225947ba71 sys/dev/wsfb/genfb.c
--- a/sys/dev/wsfb/genfb.c Mon Aug 24 10:16:12 2009 +0000
+++ b/sys/dev/wsfb/genfb.c Mon Aug 24 11:03:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb.c,v 1.27 2009/08/20 02:51:27 macallan Exp $ */
+/* $NetBSD: genfb.c,v 1.28 2009/08/24 11:03:44 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.27 2009/08/20 02:51:27 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.28 2009/08/24 11:03:44 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -64,7 +64,6 @@
static int genfb_putcmap(struct genfb_softc *, struct wsdisplay_cmap *);
static int genfb_getcmap(struct genfb_softc *, struct wsdisplay_cmap *);
-static void genfb_restore_palette(struct genfb_softc *);
static int genfb_putpalreg(struct genfb_softc *, uint8_t, uint8_t,
uint8_t, uint8_t);
@@ -90,7 +89,7 @@
genfb_init(struct genfb_softc *sc)
{
prop_dictionary_t dict;
- uint64_t cmap_cb;
+ uint64_t cmap_cb, pmf_cb;
uint32_t fboffset;
dict = device_properties(&sc->sc_dev);
@@ -136,6 +135,12 @@
if (cmap_cb != 0)
sc->sc_cmcb = (void *)(vaddr_t)cmap_cb;
}
+ /* optional pmf callback */
+ sc->sc_pmfcb = NULL;
+ if (prop_dictionary_get_uint64(dict, "pmf_callback", &pmf_cb)) {
+ if (pmf_cb != 0)
+ sc->sc_pmfcb = (void *)(vaddr_t)pmf_cb;
+ }
}
int
@@ -408,7 +413,7 @@
return 0;
}
-static void
+void
genfb_restore_palette(struct genfb_softc *sc)
{
int i;
diff -r ad76ca6fc765 -r 48225947ba71 sys/dev/wsfb/genfbvar.h
--- a/sys/dev/wsfb/genfbvar.h Mon Aug 24 10:16:12 2009 +0000
+++ b/sys/dev/wsfb/genfbvar.h Mon Aug 24 11:03:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfbvar.h,v 1.10 2009/02/17 02:19:33 jmcneill Exp $ */
+/* $NetBSD: genfbvar.h,v 1.11 2009/08/24 11:03:44 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.10 2009/02/17 02:19:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.11 2009/08/24 11:03:44 jmcneill Exp $");
#ifndef GENFBVAR_H
#define GENFBVAR_H
@@ -56,6 +56,11 @@
void (*gcc_set_mapreg)(void *, int, int, int, int);
};
+struct genfb_pmf_callback {
+ bool (*gpc_suspend)(device_t PMF_FN_PROTO);
+ bool (*gpc_resume)(device_t PMF_FN_PROTO);
+};
+
struct genfb_softc {
struct device sc_dev;
struct vcons_data vd;
@@ -65,6 +70,7 @@
const struct wsscreen_descr *sc_screens[1];
struct wsscreen_list sc_screenlist;
struct genfb_colormap_callback *sc_cmcb;
+ struct genfb_pmf_callback *sc_pmfcb;
void *sc_fbaddr; /* kva */
void *sc_shadowfb;
bus_addr_t sc_fboffset; /* bus address */
@@ -84,5 +90,7 @@
void genfb_init(struct genfb_softc *);
int genfb_attach(struct genfb_softc *, struct genfb_ops *);
int genfb_borrow(bus_addr_t, bus_space_handle_t *);
+void genfb_restore_palette(struct genfb_softc *);
+
#endif /* GENFBVAR_H */
Home |
Main Index |
Thread Index |
Old Index