]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
x86, setup: un-resequence mode setting for VGA 80x34 and 80x60 modes
authorH. Peter Anvin <hpa@linux.intel.com>
Tue, 7 Apr 2009 17:59:25 +0000 (10:59 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Tue, 7 Apr 2009 17:59:25 +0000 (10:59 -0700)
Impact: Fixes these modes on at least one system

The rewrite of the setup code into C resequenced the font setting and
register reprogramming phases of configuring nonstandard VGA modes
which use 480 scan lines in text mode.  However, there exists at least
one board (Micro-Star MS-7383 version 2.0) on which this resequencing
causes an unusable display.

Revert to the original sequencing: set up 480-line mode, install the
font, and then adjust the vertical end register appropriately.

This failure was masked by the fact that the 480-line setup was broken
until checkin 5f641356127712fbdce0eee120e5ce115860c17f (therefore this
is not a -stable candidate bug fix.)

Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/boot/video-vga.c

index 95d86ce0421c84dd647f26f34cd65fc9f0143d3e..9e0587a3776868e73b62b7def725997b6ffb7699 100644 (file)
@@ -129,22 +129,18 @@ u16 vga_crtc(void)
        return (inb(0x3cc) & 1) ? 0x3d4 : 0x3b4;
 }
 
-static void vga_set_480_scanlines(int lines)
+static void vga_set_480_scanlines(void)
 {
        u16 crtc;               /* CRTC base address */
        u8  csel;               /* CRTC miscellaneous output register */
-       u8  ovfw;               /* CRTC overflow register */
-       int end = lines-1;
 
        crtc = vga_crtc();
 
-       ovfw = 0x3c | ((end >> (8-1)) & 0x02) | ((end >> (9-6)) & 0x40);
-
        out_idx(0x0c, crtc, 0x11); /* Vertical sync end, unlock CR0-7 */
        out_idx(0x0b, crtc, 0x06); /* Vertical total */
-       out_idx(ovfw, crtc, 0x07); /* Vertical overflow */
+       out_idx(0x3e, crtc, 0x07); /* Vertical overflow */
        out_idx(0xea, crtc, 0x10); /* Vertical sync start */
-       out_idx(end,  crtc, 0x12); /* Vertical display end */
+       out_idx(0xdf, crtc, 0x12); /* Vertical display end */
        out_idx(0xe7, crtc, 0x15); /* Vertical blank start */
        out_idx(0x04, crtc, 0x16); /* Vertical blank end */
        csel = inb(0x3cc);
@@ -153,21 +149,38 @@ static void vga_set_480_scanlines(int lines)
        outb(csel, 0x3c2);
 }
 
+static void vga_set_vertical_end(int lines)
+{
+       u16 crtc;               /* CRTC base address */
+       u8  ovfw;               /* CRTC overflow register */
+       int end = lines-1;
+
+       crtc = vga_crtc();
+
+       ovfw = 0x3c | ((end >> (8-1)) & 0x02) | ((end >> (9-6)) & 0x40);
+
+       out_idx(ovfw, crtc, 0x07); /* Vertical overflow */
+       out_idx(end,  crtc, 0x12); /* Vertical display end */
+}
+
 static void vga_set_80x30(void)
 {
-       vga_set_480_scanlines(30*16);
+       vga_set_480_scanlines();
+       vga_set_vertical_end(30*16);
 }
 
 static void vga_set_80x34(void)
 {
+       vga_set_480_scanlines();
        vga_set_14font();
-       vga_set_480_scanlines(34*14);
+       vga_set_vertical_end(34*14);
 }
 
 static void vga_set_80x60(void)
 {
+       vga_set_480_scanlines();
        vga_set_8font();
-       vga_set_480_scanlines(60*8);
+       vga_set_vertical_end(60*8);
 }
 
 static int vga_set_mode(struct mode_info *mode)