summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Pettersson <mikpe@it.uu.se>2007-07-24 00:25:59 +0200
committerH. Peter Anvin <hpa@zytor.com>2007-07-25 12:02:21 -0700
commit1514ab09edb071345fe17cd230c97f9e72c9478e (patch)
tree209b45d07415b73fdf1110f421575ab7942c2a52
parent80492cc797ea15572de8eac766cbf606626ee338 (diff)
[x86 setup] APM detection logic bug fix
Starting with kernel 2.6.23-rc1, the i386 APM driver fails on several of my machines with the message: apm: BIOS not found This happens because of a bug in the i386 boot code rewrite from assembler to C. The original assembly code had the following code in its APM BIOS presence test (boot/setup.S): andw $0x02, %cx # Is 32 bit supported? je done_apm_bios # No 32-bit, no (good) APM BIOS That is, the code bails out if bit 2 is zero. In the new C version, this is coded as (boot/apm.c): if (cx & 0x02) /* 32 bits supported? */ return -1; Here we see that the test has been accidentally inverted. The fix is to negate the test. I've verified that this allows the APM driver to work again on my affected machines. Signed-off-by: Mikael Pettersson <mikpe@it.uu.se> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--arch/i386/boot/apm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/i386/boot/apm.c b/arch/i386/boot/apm.c
index a34087c370c0..8be3f5686af6 100644
--- a/arch/i386/boot/apm.c
+++ b/arch/i386/boot/apm.c
@@ -40,7 +40,7 @@ int query_apm_bios(void)
if (bx != 0x504d) /* "PM" signature */
return -1;
- if (cx & 0x02) /* 32 bits supported? */
+ if (!(cx & 0x02)) /* 32 bits supported? */
return -1;
/* Disconnect first, just in case */