diff options
author | Gabe Black <gabeblack@google.com> | 2012-09-30 04:47:48 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-11-12 04:22:34 +0100 |
commit | fb8632ab58de871ef3a25b5e57c7a2e95f04a0d8 (patch) | |
tree | a1402a9b96267c648a2b8477b24dd7ee89c13b1f /src/devices/oprom/yabel | |
parent | 04c5bae39054aedbff1865d9dd2633260c23ece3 (diff) | |
download | coreboot-fb8632ab58de871ef3a25b5e57c7a2e95f04a0d8.tar.xz |
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 <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/1758
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/devices/oprom/yabel')
-rw-r--r-- | src/devices/oprom/yabel/vbe.c | 8 | ||||
-rw-r--r-- | src/devices/oprom/yabel/vbe.h | 1 |
2 files changed, 9 insertions, 0 deletions
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); diff --git a/src/devices/oprom/yabel/vbe.h b/src/devices/oprom/yabel/vbe.h index 6ddeeef292..bf286bc12c 100644 --- a/src/devices/oprom/yabel/vbe.h +++ b/src/devices/oprom/yabel/vbe.h @@ -16,6 +16,7 @@ struct lb_framebuffer; void vbe_set_graphics(void); +int vbe_mode_info_valid(void); void fill_lb_framebuffer(struct lb_framebuffer *framebuffer); void vbe_textmode_console(void); |