diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-13 17:14:29 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-20 14:06:58 -0400 |
commit | 3f662b3f6e422a15fefcbaf4bdd21f97e6bcf32d (patch) | |
tree | cabd8b62dd391164afbfc0f0feb489d661a92f69 /arch/i386/boot | |
parent | 81cfe79b9c577139a873483654640eb3f6e78c39 (diff) |
[x86 setup] Present the canonical video mode number to the kernel
Canonicalize the video mode number as presented to the kernel. The
video mode number may be user-entered (e.g. ASK_VGA), an alias
(e.g. NORMAL_VGA), or a size specification, and that confuses the
suspend wakeup code.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/i386/boot')
-rw-r--r-- | arch/i386/boot/video.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/i386/boot/video.c b/arch/i386/boot/video.c index 693f20d3102e..e4ba897bf9a3 100644 --- a/arch/i386/boot/video.c +++ b/arch/i386/boot/video.c | |||
@@ -147,7 +147,7 @@ int mode_defined(u16 mode) | |||
147 | } | 147 | } |
148 | 148 | ||
149 | /* Set mode (without recalc) */ | 149 | /* Set mode (without recalc) */ |
150 | static int raw_set_mode(u16 mode) | 150 | static int raw_set_mode(u16 mode, u16 *real_mode) |
151 | { | 151 | { |
152 | int nmode, i; | 152 | int nmode, i; |
153 | struct card_info *card; | 153 | struct card_info *card; |
@@ -165,8 +165,10 @@ static int raw_set_mode(u16 mode) | |||
165 | 165 | ||
166 | if ((mode == nmode && visible) || | 166 | if ((mode == nmode && visible) || |
167 | mode == mi->mode || | 167 | mode == mi->mode || |
168 | mode == (mi->y << 8)+mi->x) | 168 | mode == (mi->y << 8)+mi->x) { |
169 | *real_mode = mi->mode; | ||
169 | return card->set_mode(mi); | 170 | return card->set_mode(mi); |
171 | } | ||
170 | 172 | ||
171 | if (visible) | 173 | if (visible) |
172 | nmode++; | 174 | nmode++; |
@@ -178,7 +180,7 @@ static int raw_set_mode(u16 mode) | |||
178 | if (mode >= card->xmode_first && | 180 | if (mode >= card->xmode_first && |
179 | mode < card->xmode_first+card->xmode_n) { | 181 | mode < card->xmode_first+card->xmode_n) { |
180 | struct mode_info mix; | 182 | struct mode_info mix; |
181 | mix.mode = mode; | 183 | *real_mode = mix.mode = mode; |
182 | mix.x = mix.y = 0; | 184 | mix.x = mix.y = 0; |
183 | return card->set_mode(&mix); | 185 | return card->set_mode(&mix); |
184 | } | 186 | } |
@@ -223,6 +225,7 @@ static void vga_recalc_vertical(void) | |||
223 | static int set_mode(u16 mode) | 225 | static int set_mode(u16 mode) |
224 | { | 226 | { |
225 | int rv; | 227 | int rv; |
228 | u16 real_mode; | ||
226 | 229 | ||
227 | /* Very special mode numbers... */ | 230 | /* Very special mode numbers... */ |
228 | if (mode == VIDEO_CURRENT_MODE) | 231 | if (mode == VIDEO_CURRENT_MODE) |
@@ -232,13 +235,16 @@ static int set_mode(u16 mode) | |||
232 | else if (mode == EXTENDED_VGA) | 235 | else if (mode == EXTENDED_VGA) |
233 | mode = VIDEO_8POINT; | 236 | mode = VIDEO_8POINT; |
234 | 237 | ||
235 | rv = raw_set_mode(mode); | 238 | rv = raw_set_mode(mode, &real_mode); |
236 | if (rv) | 239 | if (rv) |
237 | return rv; | 240 | return rv; |
238 | 241 | ||
239 | if (mode & VIDEO_RECALC) | 242 | if (mode & VIDEO_RECALC) |
240 | vga_recalc_vertical(); | 243 | vga_recalc_vertical(); |
241 | 244 | ||
245 | /* Save the canonical mode number for the kernel, not | ||
246 | an alias, size specification or menu position */ | ||
247 | boot_params.hdr.vid_mode = real_mode; | ||
242 | return 0; | 248 | return 0; |
243 | } | 249 | } |
244 | 250 | ||