diff options
author | Subrata Banik <subrata.banik@intel.com> | 2019-07-12 17:41:43 +0530 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-07-19 17:11:07 +0000 |
commit | a260215a644f0f13b60c08b1a9d55d3567a380b1 (patch) | |
tree | 60e7c3555e179596c44d5871d733290e45e23038 /src/device | |
parent | ba0a3930d6825b5e3a3a0b51f2902c440b431a29 (diff) | |
download | coreboot-a260215a644f0f13b60c08b1a9d55d3567a380b1.tar.xz |
device/oprom: List all supported vesa mode by oprom
This patch lists all supported vesa mode by oprom
using Function 0x4F00 (return vbe controller information).
This information might be useful for user to select correct vesa
mode for oprom.
TEST=Enabling external pcie based graphics card on ICLRVP
Case 1: with unsupported vesa mode 0x118
Now coreboot will show below msg to user to know there is a potential
issue with choosen vesa mode and better users know the failure rather
going to depthcharge and debug further.
Calling Option ROM...
... Option ROM returned.
VBE: Getting information about VESA mode 4118
VBE: Function call invalid with unsupported video mode 0x118!
User to select mode from below list -
Supported Video Mode list for OpRom are:
0x110
0x111
0x113
0x114
0x116
0x117
0x119
0x11a
0x165
0x166
0x121
0x122
0x123
0x124
0x145
0x146
0x175
0x176
0x1d2
0x1d4
Error: In vbe_get_mode_info function
Case 2: with supported vesa mode 0x116
Calling Option ROM...
... Option ROM returned.
VBE: Getting information about VESA mode 4116
VBE: resolution: 1024x768@16
VBE: framebuffer: a0000000
VBE: Setting VESA mode 4116
VGA Option ROM was run
Change-Id: I02cba44374bc50ec3ec2819c97b6f5027c58387f
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34284
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/device')
-rw-r--r-- | src/device/oprom/realmode/x86.c | 49 | ||||
-rw-r--r-- | src/device/oprom/yabel/vbe.c | 12 |
2 files changed, 61 insertions, 0 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; |