aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/boot/video-vga.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c
index 95d86ce0421c..9e0587a37768 100644
--- a/arch/x86/boot/video-vga.c
+++ b/arch/x86/boot/video-vga.c
@@ -129,22 +129,18 @@ u16 vga_crtc(void)
129 return (inb(0x3cc) & 1) ? 0x3d4 : 0x3b4; 129 return (inb(0x3cc) & 1) ? 0x3d4 : 0x3b4;
130} 130}
131 131
132static void vga_set_480_scanlines(int lines) 132static void vga_set_480_scanlines(void)
133{ 133{
134 u16 crtc; /* CRTC base address */ 134 u16 crtc; /* CRTC base address */
135 u8 csel; /* CRTC miscellaneous output register */ 135 u8 csel; /* CRTC miscellaneous output register */
136 u8 ovfw; /* CRTC overflow register */
137 int end = lines-1;
138 136
139 crtc = vga_crtc(); 137 crtc = vga_crtc();
140 138
141 ovfw = 0x3c | ((end >> (8-1)) & 0x02) | ((end >> (9-6)) & 0x40);
142
143 out_idx(0x0c, crtc, 0x11); /* Vertical sync end, unlock CR0-7 */ 139 out_idx(0x0c, crtc, 0x11); /* Vertical sync end, unlock CR0-7 */
144 out_idx(0x0b, crtc, 0x06); /* Vertical total */ 140 out_idx(0x0b, crtc, 0x06); /* Vertical total */
145 out_idx(ovfw, crtc, 0x07); /* Vertical overflow */ 141 out_idx(0x3e, crtc, 0x07); /* Vertical overflow */
146 out_idx(0xea, crtc, 0x10); /* Vertical sync start */ 142 out_idx(0xea, crtc, 0x10); /* Vertical sync start */
147 out_idx(end, crtc, 0x12); /* Vertical display end */ 143 out_idx(0xdf, crtc, 0x12); /* Vertical display end */
148 out_idx(0xe7, crtc, 0x15); /* Vertical blank start */ 144 out_idx(0xe7, crtc, 0x15); /* Vertical blank start */
149 out_idx(0x04, crtc, 0x16); /* Vertical blank end */ 145 out_idx(0x04, crtc, 0x16); /* Vertical blank end */
150 csel = inb(0x3cc); 146 csel = inb(0x3cc);
@@ -153,21 +149,38 @@ static void vga_set_480_scanlines(int lines)
153 outb(csel, 0x3c2); 149 outb(csel, 0x3c2);
154} 150}
155 151
152static void vga_set_vertical_end(int lines)
153{
154 u16 crtc; /* CRTC base address */
155 u8 ovfw; /* CRTC overflow register */
156 int end = lines-1;
157
158 crtc = vga_crtc();
159
160 ovfw = 0x3c | ((end >> (8-1)) & 0x02) | ((end >> (9-6)) & 0x40);
161
162 out_idx(ovfw, crtc, 0x07); /* Vertical overflow */
163 out_idx(end, crtc, 0x12); /* Vertical display end */
164}
165
156static void vga_set_80x30(void) 166static void vga_set_80x30(void)
157{ 167{
158 vga_set_480_scanlines(30*16); 168 vga_set_480_scanlines();
169 vga_set_vertical_end(30*16);
159} 170}
160 171
161static void vga_set_80x34(void) 172static void vga_set_80x34(void)
162{ 173{
174 vga_set_480_scanlines();
163 vga_set_14font(); 175 vga_set_14font();
164 vga_set_480_scanlines(34*14); 176 vga_set_vertical_end(34*14);
165} 177}
166 178
167static void vga_set_80x60(void) 179static void vga_set_80x60(void)
168{ 180{
181 vga_set_480_scanlines();
169 vga_set_8font(); 182 vga_set_8font();
170 vga_set_480_scanlines(60*8); 183 vga_set_vertical_end(60*8);
171} 184}
172 185
173static int vga_set_mode(struct mode_info *mode) 186static int vga_set_mode(struct mode_info *mode)