2007-12-06 22:39:22

by Rémi Hérilier

[permalink] [raw]
Subject: PATCH] adding wistron_btns support for X86_64 systems.


Hello again.

To use my previous patch (wistron_btns support for fujitsu-siemens amilo pro edition v3505)
with my laptop, I need to make the wistron module compile for x86_64. It is based on Linux
2.4.24-rc4 too.

So, here it is:


Wistron button support for X86_64 systems.

Signed-off-by: Remi Herilier <[email protected]>


diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 8f5c7b9..5bc8ce6 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -64,7 +64,7 @@ config INPUT_COBALT_BTNS

config INPUT_WISTRON_BTNS
tristate "x86 Wistron laptop button interface"
- depends on X86 && !X86_64
+ depends on X86
select INPUT_POLLDEV
select NEW_LEDS
select LEDS_CLASS
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index b438d99..9d8069b 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -74,10 +74,18 @@ static void call_bios(struct regs *regs)

preempt_disable();
local_irq_save(flags);
+#ifdef CONFIG_X86_64
+ asm volatile ("pushq %%rbp;"
+#else
asm volatile ("pushl %%ebp;"
+#endif
"movl %7, %%ebp;"
"call *%6;"
+#ifdef CONFIG_X86_64
+ "popq %%rbp"
+#else
"popl %%ebp"
+#endif
: "=a" (regs->eax), "=b" (regs->ebx), "=c" (regs->ecx)
: "0" (regs->eax), "1" (regs->ebx), "2" (regs->ecx),
"m" (bios_entry_point), "m" (bios_data_map_base)

--
Best regards

Rémi Hérilier


2007-12-22 20:42:16

by Carlos Corbacho

[permalink] [raw]
Subject: Re: PATCH] adding wistron_btns support for X86_64 systems.

(CC'ing linux-input, as that is the relevant subsystem list for wistron-btns).

R?mi H?rilier wrote:
> To use my previous patch (wistron_btns support for fujitsu-siemens amilo
> pro edition v3505) with my laptop, I need to make the wistron module
> compile for x86_64. It is based on Linux 2.4.24-rc4 too.

NAK.

You cannot make 32 bit BIOS calls in a 64 bit OS.

This will (and does) segfault on x86-64 (tested on my Aspire 5020, where
call_bios wistron-btns just segfaults on x86-64 with this patch).

This is a known issue, and the reason why wistron-btns (and the out-of-tree
acerhk) have not been ported to x86-64.

-Carlos
--
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D

2008-01-03 00:37:45

by Rémi Hérilier

[permalink] [raw]
Subject: Re: PATCH] adding wistron_btns support for X86_64 systems.

Carlos Corbacho wrote:
> (CC'ing linux-input, as that is the relevant subsystem list for wistron-btns).
>
> R?mi H?rilier wrote:
>> To use my previous patch (wistron_btns support for fujitsu-siemens amilo
>> pro edition v3505) with my laptop, I need to make the wistron module
>> compile for x86_64. It is based on Linux 2.4.24-rc4 too.
>
> NAK.
>
> You cannot make 32 bit BIOS calls in a 64 bit OS.
>
> This will (and does) segfault on x86-64 (tested on my Aspire 5020, where
> call_bios wistron-btns just segfaults on x86-64 with this patch).
>
> This is a known issue, and the reason why wistron-btns (and the out-of-tree
> acerhk) have not been ported to x86-64.
>
> -Carlos

Yes, in theory, this must segfault on x86-64.

In pratice, there is one laptop where it seems to works (no problem
for 3 weeks). A good reason to find why.


Best regards

Remi Herilier

2008-01-03 16:22:12

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: PATCH] adding wistron_btns support for X86_64 systems.

Hi R?mi,

On Jan 2, 2008 5:31 PM, R?mi H?rilier <[email protected]> wrote:
> Carlos Corbacho wrote:
> > (CC'ing linux-input, as that is the relevant subsystem list for wistron-btns).
> >
> > R?mi H?rilier wrote:
> >> To use my previous patch (wistron_btns support for fujitsu-siemens amilo
> >> pro edition v3505) with my laptop, I need to make the wistron module
> >> compile for x86_64. It is based on Linux 2.4.24-rc4 too.
> >
> > NAK.
> >
> > You cannot make 32 bit BIOS calls in a 64 bit OS.
> >
> > This will (and does) segfault on x86-64 (tested on my Aspire 5020, where
> > call_bios wistron-btns just segfaults on x86-64 with this patch).
> >
> > This is a known issue, and the reason why wistron-btns (and the out-of-tree
> > acerhk) have not been ported to x86-64.
> >
> > -Carlos
>
> Yes, in theory, this must segfault on x86-64.
>
> In pratice, there is one laptop where it seems to works (no problem
> for 3 weeks). A good reason to find why.
>

My concern that even on that particular model this may stop wotking if
you upgrade BIOS. Otherwise the fact that it doe snot work on some
other laptop should not stop us - we using DMI matching in wistron
buttons anyway.

--
Dmitry