[BUG] VGA palette corruption in vgacon.c for EFI machine

From: Yannick Heneault
Date: Fri Nov 26 2010 - 09:45:04 EST


Hi,

It seems there is a small problem of VGA palette corruption on EFI machine. When the kernel initializes the architecture, it checks if the machine is a EFI machine and if the memory at 0xa0000 is not tagged as conventional memory, which should not be the case because this is VGA memory. In that case, the kernel assumes that a VGA console can exist. I would think that this assumption is correct.

When the kernel initialize the console in vgacon_startup it checks if it can really use the VGA console. I think this is where a check is missing. Currently, the function can fail if a VESA boot mode is detected but not if a EFI boot mode was used. I think the code should be modified like this :

--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -377,7 +377,8 @@ static const char *vgacon_startup(void)
u16 saved1, saved2;
volatile u16 *p;

- if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) {
+ if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB ||
+ screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) {
no_vga:
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;


In that case, the VGA console will fail and a dummy console will be temporary used until the EFI driver get loaded. At that point the console will be mapped to the EFI driver and graphics (splash screen and penguins) will appear correctly.

Currently, the function vgacon_startup doesn't fail and initialize the video card for a real VGA mode. This function change the first 16 entries of the VGA palette. When the efifb driver kick-in, the palette is not restored to default ramp value, thus the 16 first entry remain in a modified state.

Thanks,

Yannick Heneault
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/