diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-13 17:16:37 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-20 14:06:58 -0400 |
commit | 91c4b8cb5ab8cc3e8352739e35699c0487a6b6f3 (patch) | |
tree | d0a73e97ddb5c4ab8de7d5cb89517ff7f29f467f /arch/x86_64/kernel/acpi | |
parent | 3f662b3f6e422a15fefcbaf4bdd21f97e6bcf32d (diff) |
[acpi] Correct the decoding of video mode numbers in wakeup.S
wakeup.S looks at the video mode number from the setup header and
looks to see if it is a VESA mode. Unfortunately, the decoding is
done incorrectly and it will attempt to frob the VESA BIOS for any
mode number 0x0200 or larger. Correct this, and remove a bunch of #if
0'd code.
Massive thanks to Jeff Chua for reporting the bug, and suffering
though a large number of experiments in order to track this problem
down.
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86_64/kernel/acpi')
-rw-r--r-- | arch/x86_64/kernel/acpi/wakeup.S | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/arch/x86_64/kernel/acpi/wakeup.S b/arch/x86_64/kernel/acpi/wakeup.S index 13f1480cbec9..a06f2bcabef9 100644 --- a/arch/x86_64/kernel/acpi/wakeup.S +++ b/arch/x86_64/kernel/acpi/wakeup.S | |||
@@ -81,7 +81,7 @@ wakeup_code: | |||
81 | testl $2, realmode_flags - wakeup_code | 81 | testl $2, realmode_flags - wakeup_code |
82 | jz 1f | 82 | jz 1f |
83 | mov video_mode - wakeup_code, %ax | 83 | mov video_mode - wakeup_code, %ax |
84 | call mode_seta | 84 | call mode_set |
85 | 1: | 85 | 1: |
86 | 86 | ||
87 | movw $0xb800, %ax | 87 | movw $0xb800, %ax |
@@ -291,52 +291,31 @@ no_longmode: | |||
291 | #define VIDEO_FIRST_V7 0x0900 | 291 | #define VIDEO_FIRST_V7 0x0900 |
292 | 292 | ||
293 | # Setting of user mode (AX=mode ID) => CF=success | 293 | # Setting of user mode (AX=mode ID) => CF=success |
294 | |||
295 | # For now, we only handle VESA modes (0x0200..0x03ff). To handle other | ||
296 | # modes, we should probably compile in the video code from the boot | ||
297 | # directory. | ||
294 | .code16 | 298 | .code16 |
295 | mode_seta: | 299 | mode_set: |
296 | movw %ax, %bx | 300 | movw %ax, %bx |
297 | #if 0 | 301 | subb $VIDEO_FIRST_VESA>>8, %bh |
298 | cmpb $0xff, %ah | 302 | cmpb $2, %bh |
299 | jz setalias | 303 | jb check_vesa |
300 | |||
301 | testb $VIDEO_RECALC>>8, %ah | ||
302 | jnz _setrec | ||
303 | |||
304 | cmpb $VIDEO_FIRST_RESOLUTION>>8, %ah | ||
305 | jnc setres | ||
306 | |||
307 | cmpb $VIDEO_FIRST_SPECIAL>>8, %ah | ||
308 | jz setspc | ||
309 | |||
310 | cmpb $VIDEO_FIRST_V7>>8, %ah | ||
311 | jz setv7 | ||
312 | #endif | ||
313 | |||
314 | cmpb $VIDEO_FIRST_VESA>>8, %ah | ||
315 | jnc check_vesaa | ||
316 | #if 0 | ||
317 | orb %ah, %ah | ||
318 | jz setmenu | ||
319 | #endif | ||
320 | |||
321 | decb %ah | ||
322 | # jz setbios Add bios modes later | ||
323 | 304 | ||
324 | setbada: clc | 305 | setbad: |
306 | clc | ||
325 | ret | 307 | ret |
326 | 308 | ||
327 | check_vesaa: | 309 | check_vesa: |
328 | subb $VIDEO_FIRST_VESA>>8, %bh | ||
329 | orw $0x4000, %bx # Use linear frame buffer | 310 | orw $0x4000, %bx # Use linear frame buffer |
330 | movw $0x4f02, %ax # VESA BIOS mode set call | 311 | movw $0x4f02, %ax # VESA BIOS mode set call |
331 | int $0x10 | 312 | int $0x10 |
332 | cmpw $0x004f, %ax # AL=4f if implemented | 313 | cmpw $0x004f, %ax # AL=4f if implemented |
333 | jnz _setbada # AH=0 if OK | 314 | jnz setbad # AH=0 if OK |
334 | 315 | ||
335 | stc | 316 | stc |
336 | ret | 317 | ret |
337 | 318 | ||
338 | _setbada: jmp setbada | ||
339 | |||
340 | wakeup_stack_begin: # Stack grows down | 319 | wakeup_stack_begin: # Stack grows down |
341 | 320 | ||
342 | .org 0xff0 | 321 | .org 0xff0 |