From fb8632ab58de871ef3a25b5e57c7a2e95f04a0d8 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 30 Sep 2012 04:47:48 -0700 Subject: oprom: Ensure that mode information is valid before putting it in the tables. At least when CONFIG_CHROMEOS is turned on, it's possible for CONFIG_FRAMEBUFFER_KEEP_VESA_MODE to be set but for there not to be any valid information to put into the framebuffer coreboot table. That means that what's put in there is junk, probably all zeroes from the uninitialized global variable the mode information is stored in (mode_info). When a payload uses libpayload and turns on the coreboot framebuffer console, that console will attempt to scroll at some point and decrease the cursor's y coordinate until it is less than the number of rows claimed by the console. The number of rows is computed by taking the vertical resolution of the framebuffer and dividing it by the height of the font. Because the mode information was all zeroes, the coreboot table info is all zeroes, and that means that the number of rows the console claims is zero. You can't get the unsigned y coordinate of the cursor to be less than zero, so libpayload gets stuck in an infinite loop. The solution this change implements is to add a new function, vbe_mode_info_valid, which simply returns whether or not mode_info has anything in it. If not, the framebuffer coreboot table is not created, and libpayload doesn't get stuck. Change-Id: I08f3ec628e4453f0cfe9e15c4d8dfd40327f91c9 Signed-off-by: Gabe Black Reviewed-on: http://review.coreboot.org/1758 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/devices/oprom/yabel/vbe.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/devices/oprom/yabel/vbe.c') diff --git a/src/devices/oprom/yabel/vbe.c b/src/devices/oprom/yabel/vbe.c index a9cee30626..9dbe07cdd5 100644 --- a/src/devices/oprom/yabel/vbe.c +++ b/src/devices/oprom/yabel/vbe.c @@ -133,6 +133,13 @@ vbe_info(vbe_info_t * info) return 0; } +static int mode_info_valid; + +int vbe_mode_info_valid(void) +{ + return mode_info_valid; +} + // VBE Function 01h static u8 vbe_get_mode_info(vbe_mode_info_t * mode_info) @@ -167,6 +174,7 @@ vbe_get_mode_info(vbe_mode_info_t * mode_info) memcpy(mode_info->mode_info_block, biosmem + ((M.x86.R_ES << 4) + M.x86.R_DI), sizeof(mode_info->mode_info_block)); + mode_info_valid = 1; //printf("Mode Info Dump:"); //dump(mode_info_block, 64); -- cgit v1.2.3