Probe supported states for save/restore function. Some VBE implementation
refuses to save/restore states if an unsupported bit is set.
This commit is contained in:
parent
3dd6e888c0
commit
257e5645da
@ -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(®s);
|
||||
regs.R_AX = 0x4f04;
|
||||
/* regs.R_DL = STATE_SIZE; */
|
||||
regs.R_CX = STATE_MOST;
|
||||
regs.R_CX = state;
|
||||
|
||||
x86bios_intr(®s, 0x10);
|
||||
|
||||
@ -537,7 +532,7 @@ vesa_bios_save_restore(int code, void *p)
|
||||
x86bios_init_regs(®s);
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user