aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fb/vesa.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-02-23 19:05:57 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-02-23 19:05:57 +0000
commit257e5645da1263ebd52049563d642cb0643dae83 (patch)
tree681abadc432da45db63cac04a5dcc27ae354af55 /sys/dev/fb/vesa.c
parent3dd6e888c0e9d20f5f293e773aaf9ba1d3d95ffa (diff)
Notes
Diffstat (limited to 'sys/dev/fb/vesa.c')
-rw-r--r--sys/dev/fb/vesa.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c
index 54427403d38c..9b47442021e7 100644
--- a/sys/dev/fb/vesa.c
+++ b/sys/dev/fb/vesa.c
@@ -80,6 +80,7 @@ typedef struct adp_state adp_state_t;
static struct mtx vesa_lock;
+static int vesa_state;
static void *vesa_state_buf = NULL;
static uint32_t vesa_state_buf_offs = 0;
static ssize_t vesa_state_buf_size = 0;
@@ -205,13 +206,7 @@ static int vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g,
#define STATE_SIZE 0
#define STATE_SAVE 1
#define STATE_LOAD 2
-#define STATE_HW (1<<0)
-#define STATE_DATA (1<<1)
-#define STATE_DAC (1<<2)
-#define STATE_REG (1<<3)
-#define STATE_MOST (STATE_HW | STATE_DATA | STATE_REG)
-#define STATE_ALL (STATE_HW | STATE_DATA | STATE_DAC | STATE_REG)
-static ssize_t vesa_bios_state_buf_size(void);
+static ssize_t vesa_bios_state_buf_size(int);
static int vesa_bios_save_restore(int code, void *p);
#ifdef MODE_TABLE_BROKEN
static int vesa_bios_get_line_length(void);
@@ -509,14 +504,14 @@ vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
}
static ssize_t
-vesa_bios_state_buf_size(void)
+vesa_bios_state_buf_size(int state)
{
x86regs_t regs;
x86bios_init_regs(&regs);
regs.R_AX = 0x4f04;
/* regs.R_DL = STATE_SIZE; */
- regs.R_CX = STATE_MOST;
+ regs.R_CX = state;
x86bios_intr(&regs, 0x10);
@@ -537,7 +532,7 @@ vesa_bios_save_restore(int code, void *p)
x86bios_init_regs(&regs);
regs.R_AX = 0x4f04;
regs.R_DL = code;
- regs.R_CX = STATE_MOST;
+ regs.R_CX = vesa_state;
regs.R_ES = X86BIOS_PHYSTOSEG(vesa_state_buf_offs);
regs.R_BX = X86BIOS_PHYSTOOFF(vesa_state_buf_offs);
@@ -1041,7 +1036,12 @@ vesa_bios_init(void)
x86bios_free(vmbuf, sizeof(*buf));
- vesa_state_buf_size = vesa_bios_state_buf_size();
+ /* Probe supported save/restore states. */
+ for (i = 0; i < 4; i++)
+ if (vesa_bios_state_buf_size(1 << i) > 0)
+ vesa_state |= 1 << i;
+ if (vesa_state != 0)
+ vesa_state_buf_size = vesa_bios_state_buf_size(vesa_state);
vesa_palette = x86bios_alloc(&vesa_palette_offs,
VESA_PALETTE_SIZE + vesa_state_buf_size, M_WAITOK);
if (vesa_state_buf_size > 0) {