From 133c5b73a27d543e8387cab5647226ff585c00b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 15 Feb 2005 15:35:59 +0000 Subject: [PATCH] Obviously, my laptop (SiS 630 based) only reports all VESA modes when there was one mode change before - took me quite some time to figure this out; now we just do a mode change to the standard text mode; this is probably a good idea anyway to make sure we're running in the correct text mode for the boot menu. The error check for the VESA BIOS calls were not really correct, even if they worked. The vbe_mode_info structure is now cleared before the mode info is requested (as suggested in Ralf Brown's interrupt list). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11382 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/boot/platform/bios_ia32/video.cpp | 33 +++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/kernel/boot/platform/bios_ia32/video.cpp b/src/kernel/boot/platform/bios_ia32/video.cpp index 8d78097545..1d71ddb43a 100644 --- a/src/kernel/boot/platform/bios_ia32/video.cpp +++ b/src/kernel/boot/platform/bios_ia32/video.cpp @@ -81,6 +81,8 @@ vga_enable_bright_background_colors(void) static status_t vesa_get_mode_info(uint16 mode, struct vbe_mode_info *modeInfo) { + memset(modeInfo, 0, sizeof(vbe_mode_info)); + struct bios_regs regs; regs.eax = 0x4f01; regs.ecx = mode; @@ -88,7 +90,8 @@ vesa_get_mode_info(uint16 mode, struct vbe_mode_info *modeInfo) regs.edi = ADDRESS_OFFSET(modeInfo); call_bios(0x10, ®s); - if ((regs.eax & 0xffff) != 0x4f) + // %ah contains the error code + if ((regs.eax & 0xff00) != 0) return B_ENTRY_NOT_FOUND; return B_OK; @@ -107,7 +110,8 @@ vesa_get_vbe_info_block(vbe_info_block *info) regs.edi = ADDRESS_OFFSET(info); call_bios(0x10, ®s); - if ((regs.eax & 0xffff) != 0x4f) + // %ah contains the error code + if ((regs.eax & 0xff00) != 0) return B_ERROR; if (info->signature != VESA_SIGNATURE) @@ -138,9 +142,8 @@ vesa_init(vbe_info_block *info, video_mode **_standardMode) video_mode *standardMode = NULL; - int32 i = 0; - while (true) { - uint16 mode = ((uint16 *)info->mode_list)[i++]; + for (int32 i = 0; true; i++) { + uint16 mode = ((uint16 *)info->mode_list)[i]; if (mode == 0xffff) break; @@ -381,6 +384,15 @@ out: } +static void +set_text_mode(void) +{ + bios_regs regs; + regs.eax = 3; + call_bios(0x10, ®s); +} + + // #pragma mark - @@ -467,9 +479,7 @@ platform_switch_to_text_mode(void) return; } - bios_regs regs; - regs.eax = 3; - call_bios(0x10, ®s); + set_text_mode(); gKernelArgs.frame_buffer.enabled = 0; vga_enable_bright_background_colors(); @@ -482,6 +492,13 @@ platform_init_video(void) gKernelArgs.frame_buffer.enabled = 0; list_init(&sModeList); + set_text_mode(); + // You may wonder why we do this here: + // Obviously, some graphics card BIOS implementations don't + // report all available modes unless you've done this before + // getting the VESA information. + // One example of those is the SiS 630 chipset on my laptop. + sVesaCompatible = vesa_init(&sInfo, &sMode) == B_OK; if (!sVesaCompatible) { TRACE(("No VESA compatible graphics!\n"));