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>
This commit is contained in:
Subrata Banik 2019-07-12 17:41:43 +05:30 committed by Patrick Georgi
parent ba0a3930d6
commit a260215a64
3 changed files with 61 additions and 12 deletions

View File

@ -36,6 +36,16 @@
#include "x86.h" #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 /* 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 point to the correct address location after the code has been copied
* to REALMODE_BASE. Absolute symbols are not used because those symbols are * 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; 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 * EAX register is used to indicate the completion status upon return from
* VBE function in real mode. * VBE function in real mode.
@ -255,6 +303,7 @@ static int vbe_check_for_failure(int ah)
default: default:
printk(BIOS_DEBUG, "VBE: Unsupported video mode %x!\n", printk(BIOS_DEBUG, "VBE: Unsupported video mode %x!\n",
CONFIG_FRAMEBUFFER_VESA_MODE); CONFIG_FRAMEBUFFER_VESA_MODE);
vbe_oprom_supported_mode_list();
status = -1; status = -1;
break; break;
} }

View File

@ -59,6 +59,18 @@
#include <vbe.h> #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 // pointer to VBEInfoBuffer, set by vbe_prepare
u8 *vbe_info_buffer = 0; u8 *vbe_info_buffer = 0;

View File

@ -34,18 +34,6 @@ typedef struct {
u8 color_depth; u8 color_depth;
} __packed screen_info_input_t; } __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 { typedef struct {
u16 mode_attributes; // 00 u16 mode_attributes; // 00
u8 win_a_attributes; // 02 u8 win_a_attributes; // 02