Deleted Added
full compact
vesa.c (208279) vesa.c (209472)
1/*-
2 * Copyright (c) 1998 Kazutaka YOKOTA and Michael Smith
3 * Copyright (c) 2009-2010 Jung-uk Kim <jkim@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 Kazutaka YOKOTA and Michael Smith
3 * Copyright (c) 2009-2010 Jung-uk Kim <jkim@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/fb/vesa.c 208279 2010-05-18 22:30:55Z jkim $");
29__FBSDID("$FreeBSD: head/sys/dev/fb/vesa.c 209472 2010-06-23 17:20:51Z jkim $");
30
31#include "opt_vga.h"
32#include "opt_vesa.h"
33
34#ifndef VGA_NO_MODE_CHANGE
35
36#include <sys/param.h>
37#include <sys/bus.h>

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

279/* VESA BIOS calls */
280static int
281vesa_bios_get_mode(int mode, struct vesa_mode *vmode)
282{
283 x86regs_t regs;
284 uint32_t offs;
285 void *buf;
286
30
31#include "opt_vga.h"
32#include "opt_vesa.h"
33
34#ifndef VGA_NO_MODE_CHANGE
35
36#include <sys/param.h>
37#include <sys/bus.h>

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

279/* VESA BIOS calls */
280static int
281vesa_bios_get_mode(int mode, struct vesa_mode *vmode)
282{
283 x86regs_t regs;
284 uint32_t offs;
285 void *buf;
286
287 buf = x86bios_alloc(&offs, sizeof(*vmode));
287 buf = x86bios_alloc(&offs, sizeof(*vmode), M_NOWAIT);
288 if (buf == NULL)
289 return (1);
290
291 x86bios_init_regs(&regs);
292 regs.R_AX = 0x4f01;
293 regs.R_CX = mode;
294
295 regs.R_ES = X86BIOS_PHYSTOSEG(offs);

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

362static int
363vesa_bios_save_palette(int start, int colors, u_char *palette, int bits)
364{
365 x86regs_t regs;
366 uint32_t offs;
367 u_char *p;
368 int i;
369
288 if (buf == NULL)
289 return (1);
290
291 x86bios_init_regs(&regs);
292 regs.R_AX = 0x4f01;
293 regs.R_CX = mode;
294
295 regs.R_ES = X86BIOS_PHYSTOSEG(offs);

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

362static int
363vesa_bios_save_palette(int start, int colors, u_char *palette, int bits)
364{
365 x86regs_t regs;
366 uint32_t offs;
367 u_char *p;
368 int i;
369
370 p = (u_char *)x86bios_alloc(&offs, colors * 4);
370 p = (u_char *)x86bios_alloc(&offs, colors * 4, M_NOWAIT);
371 if (p == NULL)
372 return (1);
373
374 x86bios_init_regs(&regs);
375 regs.R_AX = 0x4f09;
376 regs.R_BL = 1;
377 regs.R_CX = colors;
378 regs.R_DX = start;

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

402vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
403 int bits)
404{
405 x86regs_t regs;
406 uint32_t offs;
407 u_char *p;
408 int i;
409
371 if (p == NULL)
372 return (1);
373
374 x86bios_init_regs(&regs);
375 regs.R_AX = 0x4f09;
376 regs.R_BL = 1;
377 regs.R_CX = colors;
378 regs.R_DX = start;

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

402vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
403 int bits)
404{
405 x86regs_t regs;
406 uint32_t offs;
407 u_char *p;
408 int i;
409
410 p = (u_char *)x86bios_alloc(&offs, colors * 4);
410 p = (u_char *)x86bios_alloc(&offs, colors * 4, M_NOWAIT);
411 if (p == NULL)
412 return (1);
413
414 x86bios_init_regs(&regs);
415 regs.R_AX = 0x4f09;
416 regs.R_BL = 1;
417 regs.R_CX = colors;
418 regs.R_DX = start;

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

441static int
442vesa_bios_load_palette(int start, int colors, u_char *palette, int bits)
443{
444 x86regs_t regs;
445 uint32_t offs;
446 u_char *p;
447 int i;
448
411 if (p == NULL)
412 return (1);
413
414 x86bios_init_regs(&regs);
415 regs.R_AX = 0x4f09;
416 regs.R_BL = 1;
417 regs.R_CX = colors;
418 regs.R_DX = start;

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

441static int
442vesa_bios_load_palette(int start, int colors, u_char *palette, int bits)
443{
444 x86regs_t regs;
445 uint32_t offs;
446 u_char *p;
447 int i;
448
449 p = (u_char *)x86bios_alloc(&offs, colors * 4);
449 p = (u_char *)x86bios_alloc(&offs, colors * 4, M_NOWAIT);
450 if (p == NULL)
451 return (1);
452
453 x86bios_init_regs(&regs);
454 regs.R_AX = 0x4f09;
455 /* regs.R_BL = 0; */
456 regs.R_CX = colors;
457 regs.R_DX = start;

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

476vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
477 int bits)
478{
479 x86regs_t regs;
480 uint32_t offs;
481 u_char *p;
482 int i;
483
450 if (p == NULL)
451 return (1);
452
453 x86bios_init_regs(&regs);
454 regs.R_AX = 0x4f09;
455 /* regs.R_BL = 0; */
456 regs.R_CX = colors;
457 regs.R_DX = start;

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

476vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
477 int bits)
478{
479 x86regs_t regs;
480 uint32_t offs;
481 u_char *p;
482 int i;
483
484 p = (u_char *)x86bios_alloc(&offs, colors * 4);
484 p = (u_char *)x86bios_alloc(&offs, colors * 4, M_NOWAIT);
485 if (p == NULL)
486 return (1);
487
488 x86bios_init_regs(&regs);
489 regs.R_AX = 0x4f09;
490 /* regs.R_BL = 0; */
491 regs.R_CX = colors;
492 regs.R_DX = start;

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

530{
531 x86regs_t regs;
532 uint32_t offs;
533 void *buf;
534
535 if (code != STATE_SAVE && code != STATE_LOAD)
536 return (1);
537
485 if (p == NULL)
486 return (1);
487
488 x86bios_init_regs(&regs);
489 regs.R_AX = 0x4f09;
490 /* regs.R_BL = 0; */
491 regs.R_CX = colors;
492 regs.R_DX = start;

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

530{
531 x86regs_t regs;
532 uint32_t offs;
533 void *buf;
534
535 if (code != STATE_SAVE && code != STATE_LOAD)
536 return (1);
537
538 buf = x86bios_alloc(&offs, size);
538 buf = x86bios_alloc(&offs, size, M_NOWAIT);
539
540 x86bios_init_regs(&regs);
541 regs.R_AX = 0x4f04;
542 regs.R_DL = code;
543 regs.R_CX = STATE_ALL;
544
545 regs.R_ES = X86BIOS_PHYSTOSEG(offs);
546 regs.R_BX = X86BIOS_PHYSTOOFF(offs);

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

795 printf("VESA: interrupt vector installed (0x%x)\n",
796 BIOS_SADDRTOLADDR(offs));
797 }
798 }
799
800 x86bios_init_regs(&regs);
801 regs.R_AX = 0x4f00;
802
539
540 x86bios_init_regs(&regs);
541 regs.R_AX = 0x4f04;
542 regs.R_DL = code;
543 regs.R_CX = STATE_ALL;
544
545 regs.R_ES = X86BIOS_PHYSTOSEG(offs);
546 regs.R_BX = X86BIOS_PHYSTOOFF(offs);

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

795 printf("VESA: interrupt vector installed (0x%x)\n",
796 BIOS_SADDRTOLADDR(offs));
797 }
798 }
799
800 x86bios_init_regs(&regs);
801 regs.R_AX = 0x4f00;
802
803 vmbuf = x86bios_alloc(&offs, sizeof(*buf));
804 if (vmbuf == NULL)
805 return (1);
803 vmbuf = x86bios_alloc(&offs, sizeof(*buf), M_WAITOK);
806
807 regs.R_ES = X86BIOS_PHYSTOSEG(offs);
808 regs.R_DI = X86BIOS_PHYSTOOFF(offs);
809
810 bcopy("VBE2", vmbuf, 4); /* try for VBE2 data */
811 x86bios_intr(&regs, 0x10);
812
813 if (regs.R_AX != 0x004f || bcmp("VESA", vmbuf, 4) != 0)

--- 1107 unchanged lines hidden ---
804
805 regs.R_ES = X86BIOS_PHYSTOSEG(offs);
806 regs.R_DI = X86BIOS_PHYSTOOFF(offs);
807
808 bcopy("VBE2", vmbuf, 4); /* try for VBE2 data */
809 x86bios_intr(&regs, 0x10);
810
811 if (regs.R_AX != 0x004f || bcmp("VESA", vmbuf, 4) != 0)

--- 1107 unchanged lines hidden ---