Deleted Added
full compact
vga_isa.c (174985) vga_isa.c (198866)
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>
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 174985 2007-12-29 23:26:59Z wkoszek $");
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>

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

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);
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>

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

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 | M_ZERO);
183 if (sc->state_buf == NULL)
184 return (0);
185 if (bootverbose)
186 device_printf(dev, "saving %d bytes of video state\n", 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;
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 }
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;
206 }
207 }
208
193 return (0);
194}
195
196static int
197isavga_resume(device_t dev)
198{
199 vga_softc_t *sc;
200
201 sc = device_get_softc(dev);
202 if (sc->state_buf != NULL) {
203 if (vidd_load_state(sc->adp, sc->state_buf) != 0)
204 device_printf(dev, "failed to reload state\n");
205 free(sc->state_buf, M_TEMP);
206 sc->state_buf = NULL;
207 }
209 return (0);
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 }
208
209 bus_generic_resume(dev);
210 return 0;
211}
212
213#ifdef FB_INSTALL_CDEV
214
215static int

--- 55 unchanged lines hidden ---
230
231 bus_generic_resume(dev);
232 return 0;
233}
234
235#ifdef FB_INSTALL_CDEV
236
237static int

--- 55 unchanged lines hidden ---