Deleted Added
sdiff udiff text old ( 198866 ) new ( 198964 )
full compact
1/*-
2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/isa/vga_isa.c 198866 2009-11-04 00:58:20Z jkim $");
29
30#include "opt_vga.h"
31#include "opt_fb.h"
32#include "opt_syscons.h" /* should be removed in the future, XXX */
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>

--- 124 unchanged lines hidden (view full) ---

161}
162
163static int
164isavga_suspend(device_t dev)
165{
166 vga_softc_t *sc;
167 int err, nbytes;
168
169 sc = device_get_softc(dev);
170 err = bus_generic_suspend(dev);
171 if (err)
172 return (err);
173
174 /* Save the video state across the suspend. */
175 if (sc->state_buf != NULL) {
176 free(sc->state_buf, M_TEMP);
177 sc->state_buf = NULL;
178 }
179 nbytes = vidd_save_state(sc->adp, NULL, 0);
180 if (nbytes <= 0)
181 return (0);
182 sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT);
183 if (sc->state_buf != NULL) {
184 if (bootverbose)
185 device_printf(dev, "saving %d bytes of video state\n",
186 nbytes);
187 if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) {
188 device_printf(dev, "failed to save state (nbytes=%d)\n",
189 nbytes);
190 free(sc->state_buf, M_TEMP);
191 sc->state_buf = NULL;
192 }
193 }
194
195 /* Save the color palette across the suspend. */
196 if (sc->pal_buf != NULL)
197 free(sc->pal_buf, M_TEMP);
198 sc->pal_buf = malloc(256 * 3, M_TEMP, M_NOWAIT);
199 if (sc->pal_buf != NULL) {
200 if (bootverbose)
201 device_printf(dev, "saving color palette\n");
202 if (vidd_save_palette(sc->adp, sc->pal_buf) != 0) {
203 device_printf(dev, "failed to save palette\n");
204 free(sc->pal_buf, M_TEMP);
205 sc->pal_buf = NULL;

--- 4 unchanged lines hidden (view full) ---

210}
211
212static int
213isavga_resume(device_t dev)
214{
215 vga_softc_t *sc;
216
217 sc = device_get_softc(dev);
218 if (sc->state_buf != NULL) {
219 if (vidd_load_state(sc->adp, sc->state_buf) != 0)
220 device_printf(dev, "failed to reload state\n");
221 free(sc->state_buf, M_TEMP);
222 sc->state_buf = NULL;
223 }
224 if (sc->pal_buf != NULL) {
225 if (vidd_load_palette(sc->adp, sc->pal_buf) != 0)
226 device_printf(dev, "failed to reload palette\n");
227 free(sc->pal_buf, M_TEMP);
228 sc->pal_buf = NULL;
229 }
230
231 bus_generic_resume(dev);
232 return 0;
233}
234
235#ifdef FB_INSTALL_CDEV
236
237static int
238isavga_open(struct cdev *dev, int flag, int mode, struct thread *td)
239{
240 return vga_open(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td);

--- 52 unchanged lines hidden ---