2007-10-28 17:31:58

by Bradley Smith

[permalink] [raw]
Subject: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems

From: Bradley Smith <[email protected]>

Adds #if clause and additional inline assembly so that the driver
builds on x86_64 systems.

Signed-off-by: Bradley Smith <[email protected]>

---

--- linux-2.6/drivers/char/i8k.c.orig 2007-10-28 12:27:34.000000000 +0000
+++ linux-2.6/drivers/char/i8k.c 2007-10-28 14:27:56.000000000 +0000
@@ -113,6 +113,33 @@ static int i8k_smm(struct smm_regs *regs
int rc;
int eax = regs->eax;

+#if defined(__x86_64__)
+ asm("pushq %%rax\n\t"
+ "movl 0(%%rax),%%edx\n\t"
+ "pushq %%rdx\n\t"
+ "movl 4(%%rax),%%ebx\n\t"
+ "movl 8(%%rax),%%ecx\n\t"
+ "movl 12(%%rax),%%edx\n\t"
+ "movl 16(%%rax),%%esi\n\t"
+ "movl 20(%%rax),%%edi\n\t"
+ "popq %%rax\n\t"
+ "out %%al,$0xb2\n\t"
+ "out %%al,$0x84\n\t"
+ "xchgq %%rax,(%%rsp)\n\t"
+ "movl %%ebx,4(%%rax)\n\t"
+ "movl %%ecx,8(%%rax)\n\t"
+ "movl %%edx,12(%%rax)\n\t"
+ "movl %%esi,16(%%rax)\n\t"
+ "movl %%edi,20(%%rax)\n\t"
+ "popq %%rdx\n\t"
+ "movl %%edx,0(%%rax)\n\t"
+ "lahf\n\t"
+ "shrl $8,%%eax\n\t"
+ "andl $1,%%eax\n"
+ :"=a"(rc)
+ : "a"(regs)
+ : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
+#else
asm("pushl %%eax\n\t"
"movl 0(%%eax),%%edx\n\t"
"push %%edx\n\t"
@@ -137,7 +164,7 @@ static int i8k_smm(struct smm_regs *regs
"andl $1,%%eax\n":"=a"(rc)
: "a"(regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
-
+#endif
if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax)
return -EINVAL;


2007-10-28 17:37:23

by Adrian Bunk

[permalink] [raw]
Subject: Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems

On Sun, Oct 28, 2007 at 05:25:19PM +0000, Bradley Smith wrote:
> From: Bradley Smith <[email protected]>
>
> Adds #if clause and additional inline assembly so that the driver
> builds on x86_64 systems.
>
> Signed-off-by: Bradley Smith <[email protected]>
>
> ---
>
> --- linux-2.6/drivers/char/i8k.c.orig 2007-10-28 12:27:34.000000000 +0000
> +++ linux-2.6/drivers/char/i8k.c 2007-10-28 14:27:56.000000000 +0000
> @@ -113,6 +113,33 @@ static int i8k_smm(struct smm_regs *regs
> int rc;
> int eax = regs->eax;
>
> +#if defined(__x86_64__)
>...

Please use CONFIG_X86_64.

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2007-10-28 17:59:37

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems

Bradley Smith wrote:
> From: Bradley Smith <[email protected]>
>
> Adds #if clause and additional inline assembly so that the driver
> builds on x86_64 systems.
>
> Signed-off-by: Bradley Smith <[email protected]>

Is this actually known to be working on a Dell laptop?

Jeff



2007-10-28 18:03:12

by Bradley Smith

[permalink] [raw]
Subject: Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems

On Sun, 28 Oct 2007 13:59:22 -0400
Jeff Garzik <[email protected]> wrote:

> Bradley Smith wrote:
> > From: Bradley Smith <[email protected]>
> >
> > Adds #if clause and additional inline assembly so that the driver
> > builds on x86_64 systems.
> >
> > Signed-off-by: Bradley Smith <[email protected]>
>
> Is this actually known to be working on a Dell laptop?
>
> Jeff
>

Yes, I have a dell laptop, and it works. (I have been using it for quite a while).

Brad.

2007-10-28 23:19:43

by Bradley Smith

[permalink] [raw]
Subject: Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems

On Sun, 28 Oct 2007 18:37:24 +0100
Adrian Bunk <[email protected]> wrote:

>
> Please use CONFIG_X86_64.
>
> cu
> Adrian
>

Now uses CONFIG_X86_64.

Brad.

--- linux-2.6/drivers/char/i8k.c.orig 2007-10-28 12:27:34.000000000 +0000
+++ linux-2.6/drivers/char/i8k.c 2007-10-28 14:27:56.000000000 +0000
@@ -113,6 +113,33 @@ static int i8k_smm(struct smm_regs *regs
int rc;
int eax = regs->eax;

+#if defined(CONFIG_X86_64)
+ asm("pushq %%rax\n\t"
+ "movl 0(%%rax),%%edx\n\t"
+ "pushq %%rdx\n\t"
+ "movl 4(%%rax),%%ebx\n\t"
+ "movl 8(%%rax),%%ecx\n\t"
+ "movl 12(%%rax),%%edx\n\t"
+ "movl 16(%%rax),%%esi\n\t"
+ "movl 20(%%rax),%%edi\n\t"
+ "popq %%rax\n\t"
+ "out %%al,$0xb2\n\t"
+ "out %%al,$0x84\n\t"
+ "xchgq %%rax,(%%rsp)\n\t"
+ "movl %%ebx,4(%%rax)\n\t"
+ "movl %%ecx,8(%%rax)\n\t"
+ "movl %%edx,12(%%rax)\n\t"
+ "movl %%esi,16(%%rax)\n\t"
+ "movl %%edi,20(%%rax)\n\t"
+ "popq %%rdx\n\t"
+ "movl %%edx,0(%%rax)\n\t"
+ "lahf\n\t"
+ "shrl $8,%%eax\n\t"
+ "andl $1,%%eax\n"
+ :"=a"(rc)
+ : "a"(regs)
+ : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
+#else
asm("pushl %%eax\n\t"
"movl 0(%%eax),%%edx\n\t"
"push %%edx\n\t"
@@ -137,7 +164,7 @@ static int i8k_smm(struct smm_regs *regs
"andl $1,%%eax\n":"=a"(rc)
: "a"(regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
-
+#endif
if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax)
return -EINVAL;

2007-10-29 07:07:56

by Frank Sorenson

[permalink] [raw]
Subject: Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff Garzik wrote:
> Bradley Smith wrote:
>> From: Bradley Smith <[email protected]>
>>
>> Adds #if clause and additional inline assembly so that the driver
>> builds on x86_64 systems.
>>
>> Signed-off-by: Bradley Smith <[email protected]>
>
> Is this actually known to be working on a Dell laptop?
>
> Jeff

Yes, the patch works well on my Dell, and I've got several
follow-up patches to Brad's. During the last i8k refresh
(http://lkml.org/lkml/2005/2/24/11), not everything made it
into mainline, so i8k is due for another facelift.

Needs the following in order to work correctly on my Inspiron E1705:


Add DMI Product name to i8k for Dell MP061 hardware (Inspiron 9400/E1705)

Signed-off-by: Frank Sorenson <[email protected]>
- ---
drivers/char/i8k.c | 7 +++++++
1 file changed, 7 insertions(+)

Index: linux-2.6.24-rc1/drivers/char/i8k.c
===================================================================
- --- linux-2.6.24-rc1.orig/drivers/char/i8k.c 2007-10-29 00:27:21.000000000 -0500
+++ linux-2.6.24-rc1/drivers/char/i8k.c 2007-10-29 00:30:05.000000000 -0500
@@ -468,6 +468,13 @@
DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"),
},
},
+ {
+ .ident = "Dell Inspiron 3",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MP061"),
+ },
+ },
{ }
};


Frank
- --
Frank Sorenson - KD7TZK
Linux Systems Engineer, DSS Engineering, UBS AG
[email protected]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHJXnUaI0dwg4A47wRApQrAKDKb0Zq+QrG+CUsXrpfoxVxLyM+PQCg5uZc
kvUjuY3a1F7MIx0Z9DSrYbg=
=IcmN
-----END PGP SIGNATURE-----