public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG] 2.6.23-rc1 broke APM
@ 2007-07-23 13:10 Mikael Pettersson
  2007-07-23 15:50 ` H. Peter Anvin
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Pettersson @ 2007-07-23 13:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: hpa

On this machine (Gigabyte mobo with i815EP chipset and a PIII),
APM worked fine up to 2.6.22. With 2.6.23-rc1 however the APM
driver fails to locate the APM bios:

--- dmesg-2.6.22	2007-07-23 14:07:46.000000000 +0200
+++ dmesg-2.6.23-rc1	2007-07-23 14:48:24.000000000 +0200
@@ -102,7 +105,7 @@
 Unpacking initramfs... done
 Freeing initrd memory: 976k freed
 Machine check exception polling timer started.
-apm: BIOS version 1.2 Flags 0x07 (Driver version 1.16ac)
+apm: BIOS not found.
 io scheduler noop registered
 io scheduler anticipatory registered (default)
 io scheduler deadline registered

The only change in 2.6.23-rc1 to arch/i386/kernel/apm.c is a
trivial nofreeze flag removal, so I suspect the boot code changes,
perhaps the new arch/i386/boot/apm.c:query_apm_bios().

/Mikael

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] 2.6.23-rc1 broke APM
  2007-07-23 13:10 [BUG] 2.6.23-rc1 broke APM Mikael Pettersson
@ 2007-07-23 15:50 ` H. Peter Anvin
  0 siblings, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2007-07-23 15:50 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

Mikael Pettersson wrote:
> On this machine (Gigabyte mobo with i815EP chipset and a PIII),
> APM worked fine up to 2.6.22. With 2.6.23-rc1 however the APM
> driver fails to locate the APM bios:
> 
> --- dmesg-2.6.22	2007-07-23 14:07:46.000000000 +0200
> +++ dmesg-2.6.23-rc1	2007-07-23 14:48:24.000000000 +0200
> @@ -102,7 +105,7 @@
>  Unpacking initramfs... done
>  Freeing initrd memory: 976k freed
>  Machine check exception polling timer started.
> -apm: BIOS version 1.2 Flags 0x07 (Driver version 1.16ac)
> +apm: BIOS not found.
>  io scheduler noop registered
>  io scheduler anticipatory registered (default)
>  io scheduler deadline registered
> 
> The only change in 2.6.23-rc1 to arch/i386/kernel/apm.c is a
> trivial nofreeze flag removal, so I suspect the boot code changes,
> perhaps the new arch/i386/boot/apm.c:query_apm_bios().
> 

Seems like a reasonable suspicion.

Could you try the attached patch and:

a) see if it helps the situation, and
b) tell me what it prints?

	-hpa


[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 1812 bytes --]

diff --git a/arch/i386/boot/apm.c b/arch/i386/boot/apm.c
index a34087c..5843beb 100644
--- a/arch/i386/boot/apm.c
+++ b/arch/i386/boot/apm.c
@@ -34,6 +34,9 @@ int query_apm_bios(void)
 		     : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
 		     : : "esi", "edi");
 
+	printf("apm: err = %d, ax = %#x, bx = %#x, cx = %#x\n",
+	       err, ax, bx, cx);
+
 	if (err)
 		return -1;		/* No APM BIOS */
 
@@ -45,9 +48,10 @@ int query_apm_bios(void)
 
 	/* Disconnect first, just in case */
 	ax = 0x5304;
+	bx = 0;
 	asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
-		     : "+a" (ax)
-		     : : "ebx", "ecx", "edx", "esi", "edi");
+		     : "+a" (ax), "+b" (bx)
+		     : "ecx", "edx", "esi", "edi");
 
 	/* Paranoia */
 	ebx = esi = 0;
@@ -59,6 +63,10 @@ int query_apm_bios(void)
 		       "+S" (esi), "+D" (di), "=m" (err)
 		     : "a" (0x5303));
 
+	printf("apm: err = %d, ax = %#x, ebx = %#x, cx = %#x, dx = %#x\n"
+	       "     esi = %#x, di = %#x\n",
+	       err, ax, ebx, cx, dx, esi, di);
+
 	boot_params.apm_bios_info.cseg = ax;
 	boot_params.apm_bios_info.offset = ebx;
 	boot_params.apm_bios_info.cseg_16 = cx;
@@ -79,6 +87,9 @@ int query_apm_bios(void)
 		     : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
 		     : : "esi", "edi");
 
+	printf("apm: err = %d, ax = %#x, bx = %#x, cx = %#x\n",
+	       err, ax, bx, cx);
+
 	if (err || bx != 0x504d) {
 		/* Failure with 32-bit connect, try to disconect and ignore */
 		ax = 0x5304;
diff --git a/arch/i386/boot/main.c b/arch/i386/boot/main.c
index 7f01f96..b0072d7 100644
--- a/arch/i386/boot/main.c
+++ b/arch/i386/boot/main.c
@@ -150,6 +150,8 @@ void main(void)
 	/* Query APM information */
 #if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
 	query_apm_bios();
+#else
+	printf("apm: disabled\n");
 #endif
 
 	/* Query EDD information */

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [BUG] 2.6.23-rc1 broke APM
@ 2007-07-23 22:26 Mikael Pettersson
  0 siblings, 0 replies; 3+ messages in thread
From: Mikael Pettersson @ 2007-07-23 22:26 UTC (permalink / raw)
  To: hpa, mikpe; +Cc: linux-kernel

On Mon, 23 Jul 2007 08:50:41 -0700, H. Peter Anvin wrote:
>Mikael Pettersson wrote:
>> On this machine (Gigabyte mobo with i815EP chipset and a PIII),
>> APM worked fine up to 2.6.22. With 2.6.23-rc1 however the APM
>> driver fails to locate the APM bios:
>> 
>> --- dmesg-2.6.22	2007-07-23 14:07:46.000000000 +0200
>> +++ dmesg-2.6.23-rc1	2007-07-23 14:48:24.000000000 +0200
>> @@ -102,7 +105,7 @@
>>  Unpacking initramfs... done
>>  Freeing initrd memory: 976k freed
>>  Machine check exception polling timer started.
>> -apm: BIOS version 1.2 Flags 0x07 (Driver version 1.16ac)
>> +apm: BIOS not found.
>>  io scheduler noop registered
>>  io scheduler anticipatory registered (default)
>>  io scheduler deadline registered
>> 
>> The only change in 2.6.23-rc1 to arch/i386/kernel/apm.c is a
>> trivial nofreeze flag removal, so I suspect the boot code changes,
>> perhaps the new arch/i386/boot/apm.c:query_apm_bios().
>> 
>
>Seems like a reasonable suspicion.
>
>Could you try the attached patch and:
>
>a) see if it helps the situation, and
>b) tell me what it prints?
>
>	-hpa

Only the first printf() triggers, and it prints:

apm: err = 0, ax = 0x102, bx = 0x504d, cx = 0x7

The err and bx checks will succeed, but the "if (cx & 0x02)"
check will cause query_apm_bios() to return failure.

I compared this check with the original assembly code,
and it turns out that the i386 boot rewrite accidentally
inverted the sense of this check. I've just posted a
patch to fix it.

/Mikael

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-23 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-23 13:10 [BUG] 2.6.23-rc1 broke APM Mikael Pettersson
2007-07-23 15:50 ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2007-07-23 22:26 Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox