Module Name: src Committed By: jmcneill Date: Mon Aug 24 11:04:29 UTC 2009
Modified Files: src/sys/arch/x86/x86: x86_autoconf.c Log Message: Paranoia; restore the genfb colour map on resume. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/x86/x86_autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/x86_autoconf.c diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.41 src/sys/arch/x86/x86/x86_autoconf.c:1.42 --- src/sys/arch/x86/x86/x86_autoconf.c:1.41 Mon Aug 3 20:15:14 2009 +++ src/sys/arch/x86/x86/x86_autoconf.c Mon Aug 24 11:04:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_autoconf.c,v 1.41 2009/08/03 20:15:14 dsl Exp $ */ +/* $NetBSD: x86_autoconf.c,v 1.42 2009/08/24 11:04:29 jmcneill Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.41 2009/08/03 20:15:14 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.42 2009/08/24 11:04:29 jmcneill Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -64,7 +64,8 @@ #include <dev/wsfb/genfbvar.h> #include <dev/ic/vgareg.h> -struct genfb_colormap_callback gfb_cb; +static struct genfb_colormap_callback gfb_cb; +static struct genfb_pmf_callback pmf_cb; struct disklist *x86_alldisks; int x86_ndisks; @@ -78,6 +79,22 @@ outb(0x3c0 + VGA_DAC_PALETTE, (uint8_t)g >> 2); outb(0x3c0 + VGA_DAC_PALETTE, (uint8_t)b >> 2); } + +static bool +x86_genfb_suspend(device_t dev PMF_FN_ARGS) +{ + return true; +} + +static bool +x86_genfb_resume(device_t dev PMF_FN_ARGS) +{ + struct genfb_softc *sc = device_private(dev); + + genfb_restore_palette(sc); + + return true; +} #endif static void @@ -597,6 +614,10 @@ prop_dictionary_set_uint64(dict, "cmap_callback", (uint64_t)&gfb_cb); } + pmf_cb.gpc_suspend = x86_genfb_suspend; + pmf_cb.gpc_resume = x86_genfb_resume; + prop_dictionary_set_uint64(dict, + "pmf_callback", (uint64_t)&pmf_cb); found_console = true; return; }