diff options
author | jkim <jkim@FreeBSD.org> | 2009-11-05 22:58:50 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2009-11-05 22:58:50 +0000 |
commit | bc53678aaf2e4a99efcef14a1b53d0ac50403b83 (patch) | |
tree | 04dc58e4b98fb82187ea223ad1ac4b66c38c4c65 /sys/dev/fb | |
parent | b7d759e2ccf64c56e17c806c07398a5a7090df00 (diff) | |
download | FreeBSD-src-bc53678aaf2e4a99efcef14a1b53d0ac50403b83.zip FreeBSD-src-bc53678aaf2e4a99efcef14a1b53d0ac50403b83.tar.gz |
Save/restore VGA state from vga_pci.c instead of relying on vga_isa.c.
It was not working because we were saving its state after the device was
powered down. Simplify vesa_load_state() as the culprit is fixed now.
Diffstat (limited to 'sys/dev/fb')
-rw-r--r-- | sys/dev/fb/vesa.c | 54 |
1 files changed, 5 insertions, 49 deletions
diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c index 5403352..36b05f8 100644 --- a/sys/dev/fb/vesa.c +++ b/sys/dev/fb/vesa.c @@ -164,7 +164,6 @@ static char *vesa_revstr = NULL; static int int10_set_mode(int mode); static int vesa_bios_post(void); static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode); -static int vesa_bios_get_current_mode(void); static int vesa_bios_set_mode(int mode); static int vesa_bios_get_dac(void); static int vesa_bios_set_dac(int bits); @@ -319,22 +318,6 @@ vesa_bios_get_mode(int mode, struct vesa_mode *vmode) } static int -vesa_bios_get_current_mode(void) -{ - x86regs_t regs; - - x86bios_init_regs(®s); - regs.R_AX = 0x4f03; - - x86bios_intr(®s, 0x10); - - if (regs.R_AX != 0x004f) - return (-1); - - return (regs.R_BX); -} - -static int vesa_bios_set_mode(int mode) { x86regs_t regs; @@ -1438,7 +1421,6 @@ vesa_save_state(video_adapter_t *adp, void *p, size_t size) static int vesa_load_state(video_adapter_t *adp, void *p) { - int flags, mode, ret; if ((adp != vesa_adp) || (((adp_state_t *)p)->sig != V_STATE_SIG)) return ((*prevvidsw->load_state)(adp, p)); @@ -1446,38 +1428,12 @@ vesa_load_state(video_adapter_t *adp, void *p) if (vesa_state_buf_size <= 0) return (1); - /* - * If the current mode is not the same, probably it was powered down. - * Try BIOS POST to restore a sane state. - */ - if (VESA_MODE(adp->va_mode)) { - mode = vesa_bios_get_current_mode(); - if (mode >= 0 && (mode & 0x1ff) != adp->va_mode) - (void)vesa_bios_post(); - } - - ret = vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs, - vesa_state_buf_size); + /* Try BIOS POST to restore a sane state. */ + (void)vesa_bios_post(); + (void)int10_set_mode(adp->va_initial_bios_mode); - /* - * If the desired mode is not restored, force setting the mode. - */ - if (VESA_MODE(adp->va_mode)) { - mode = vesa_bios_get_current_mode(); - if (mode < 0 || (mode & 0x1ff) == adp->va_mode) - return (ret); - mode = adp->va_mode; - flags = adp->va_info.vi_flags; - if ((flags & V_INFO_GRAPHICS) != 0 && - (flags & V_INFO_LINEAR) != 0) - mode |= 0x4000; - (void)vesa_bios_set_mode(mode); - if ((vesa_adp_info->v_flags & V_DAC8) != 0) - (void)vesa_bios_set_dac(8); - (void)(*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); - } - - return (ret); + return (vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs, + vesa_state_buf_size)); } #if 0 |