diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/device/oprom/realmode/x86.c | 49 | ||||
-rw-r--r-- | src/device/oprom/yabel/vbe.c | 12 | ||||
-rw-r--r-- | src/include/vbe.h | 12 |
3 files changed, 61 insertions, 12 deletions
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c index bf31babe6e..67e550cd5e 100644 --- a/src/device/oprom/realmode/x86.c +++ b/src/device/oprom/realmode/x86.c @@ -36,6 +36,16 @@ #include "x86.h" +typedef struct { + char signature[4]; + u16 version; + u8 *oem_string_ptr; + u32 capabilities; + u32 video_mode_ptr; + u16 total_memory; + char reserved[236]; +} __packed vbe_info_block; + /* The following symbols cannot be used directly. They need to be fixed up * to point to the correct address location after the code has been copied * to REALMODE_BASE. Absolute symbols are not used because those symbols are @@ -221,6 +231,44 @@ static int vbe_mode_info_valid(void) return mode_info_valid; } +static int vbe_check_for_failure(int ah); + +static void vbe_get_ctrl_info(vbe_info_block *info) +{ + char *buffer = PTR_TO_REAL_MODE(__realmode_buffer); + u16 buffer_seg = (((unsigned long)buffer) >> 4) & 0xff00; + u16 buffer_adr = ((unsigned long)buffer) & 0xffff; + X86_EAX = realmode_interrupt(0x10, VESA_GET_INFO, 0x0000, 0x0000, + 0x0000, buffer_seg, buffer_adr); + /* If the VBE function completed successfully, 0x0 is returned in AH */ + if (X86_AH) + die("\nError: In %s function\n", __func__); + memcpy(info, buffer, sizeof(vbe_info_block)); +} + +static void vbe_oprom_list_supported_mode(uint16_t *video_mode_ptr) +{ + uint16_t mode; + printk(BIOS_DEBUG, "Supported Video Mode list for OpRom:\n"); + do { + mode = *video_mode_ptr++; + if (mode != 0xffff) + printk(BIOS_DEBUG, "%x\n", mode); + } while (mode != 0xffff); +} + +static void vbe_oprom_supported_mode_list(void) +{ + uint16_t segment, offset; + vbe_info_block info; + + vbe_get_ctrl_info(&info); + + offset = info.video_mode_ptr; + segment = info.video_mode_ptr >> 16; + + vbe_oprom_list_supported_mode((uint16_t *)((segment << 4) + offset)); +} /* * EAX register is used to indicate the completion status upon return from * VBE function in real mode. @@ -255,6 +303,7 @@ static int vbe_check_for_failure(int ah) default: printk(BIOS_DEBUG, "VBE: Unsupported video mode %x!\n", CONFIG_FRAMEBUFFER_VESA_MODE); + vbe_oprom_supported_mode_list(); status = -1; break; } diff --git a/src/device/oprom/yabel/vbe.c b/src/device/oprom/yabel/vbe.c index 682bf00ba5..8116c6b3ed 100644 --- a/src/device/oprom/yabel/vbe.c +++ b/src/device/oprom/yabel/vbe.c @@ -59,6 +59,18 @@ #include <vbe.h> +// these structs only store a subset of the VBE defined fields +// only those needed. +typedef struct { + char signature[4]; + u16 version; + u8 *oem_string_ptr; + u32 capabilities; + u16 video_mode_list[256]; // lets hope we never have more than + // 256 video modes... + u16 total_memory; +} vbe_info_t; + // pointer to VBEInfoBuffer, set by vbe_prepare u8 *vbe_info_buffer = 0; diff --git a/src/include/vbe.h b/src/include/vbe.h index 2c40d0507e..67049be613 100644 --- a/src/include/vbe.h +++ b/src/include/vbe.h @@ -34,18 +34,6 @@ typedef struct { u8 color_depth; } __packed screen_info_input_t; -// these structs only store a subset of the VBE defined fields -// only those needed. -typedef struct { - char signature[4]; - u16 version; - u8 *oem_string_ptr; - u32 capabilities; - u16 video_mode_list[256]; // lets hope we never have more than - // 256 video modes... - u16 total_memory; -} vbe_info_t; - typedef struct { u16 mode_attributes; // 00 u8 win_a_attributes; // 02 |