public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems
@ 2007-10-28 17:25 Bradley Smith
  2007-10-28 17:37 ` Adrian Bunk
  2007-10-28 17:59 ` Jeff Garzik
  0 siblings, 2 replies; 6+ messages in thread
From: Bradley Smith @ 2007-10-28 17:25 UTC (permalink / raw)
  To: linux-kernel, dz

From: Bradley Smith <bradjsmith@btinternet.com>

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

Signed-off-by: Bradley Smith <bradjsmith@btinternet.com>

---

--- 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;
 

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

* Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems
  2007-10-28 17:25 [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems Bradley Smith
@ 2007-10-28 17:37 ` Adrian Bunk
  2007-10-28 23:19   ` Bradley Smith
  2007-10-28 17:59 ` Jeff Garzik
  1 sibling, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2007-10-28 17:37 UTC (permalink / raw)
  To: Bradley Smith; +Cc: linux-kernel, dz

On Sun, Oct 28, 2007 at 05:25:19PM +0000, Bradley Smith wrote:
> From: Bradley Smith <bradjsmith@btinternet.com>
> 
> Adds #if clause and additional inline assembly so that the driver
> builds on x86_64 systems.
> 
> Signed-off-by: Bradley Smith <bradjsmith@btinternet.com>
> 
> ---
> 
> --- 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


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

* Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems
  2007-10-28 17:25 [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems Bradley Smith
  2007-10-28 17:37 ` Adrian Bunk
@ 2007-10-28 17:59 ` Jeff Garzik
  2007-10-28 18:03   ` Bradley Smith
  2007-10-29  6:12   ` Frank Sorenson
  1 sibling, 2 replies; 6+ messages in thread
From: Jeff Garzik @ 2007-10-28 17:59 UTC (permalink / raw)
  To: Bradley Smith; +Cc: linux-kernel, dz

Bradley Smith wrote:
> From: Bradley Smith <bradjsmith@btinternet.com>
> 
> Adds #if clause and additional inline assembly so that the driver
> builds on x86_64 systems.
> 
> Signed-off-by: Bradley Smith <bradjsmith@btinternet.com>

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

	Jeff




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

* Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems
  2007-10-28 17:59 ` Jeff Garzik
@ 2007-10-28 18:03   ` Bradley Smith
  2007-10-29  6:12   ` Frank Sorenson
  1 sibling, 0 replies; 6+ messages in thread
From: Bradley Smith @ 2007-10-28 18:03 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, dz

On Sun, 28 Oct 2007 13:59:22 -0400
Jeff Garzik <jeff@garzik.org> wrote:

> Bradley Smith wrote:
> > From: Bradley Smith <bradjsmith@btinternet.com>
> > 
> > Adds #if clause and additional inline assembly so that the driver
> > builds on x86_64 systems.
> > 
> > Signed-off-by: Bradley Smith <bradjsmith@btinternet.com>
> 
> 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.

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

* Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems
  2007-10-28 17:37 ` Adrian Bunk
@ 2007-10-28 23:19   ` Bradley Smith
  0 siblings, 0 replies; 6+ messages in thread
From: Bradley Smith @ 2007-10-28 23:19 UTC (permalink / raw)
  To: Adrian Bunk, linux-kernel, dz

On Sun, 28 Oct 2007 18:37:24 +0100
Adrian Bunk <bunk@kernel.org> 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;
 

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

* Re: [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems
  2007-10-28 17:59 ` Jeff Garzik
  2007-10-28 18:03   ` Bradley Smith
@ 2007-10-29  6:12   ` Frank Sorenson
  1 sibling, 0 replies; 6+ messages in thread
From: Frank Sorenson @ 2007-10-29  6:12 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Bradley Smith, linux-kernel, dz

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

Jeff Garzik wrote:
> Bradley Smith wrote:
>> From: Bradley Smith <bradjsmith@btinternet.com>
>>
>> Adds #if clause and additional inline assembly so that the driver
>> builds on x86_64 systems.
>>
>> Signed-off-by: Bradley Smith <bradjsmith@btinternet.com>
> 
> 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 <frank@tuxrocks.com>
- ---
 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
frank@tuxrocks.com

-----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-----

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

end of thread, other threads:[~2007-10-29  7:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-28 17:25 [PATCH 1/2] I8K: Allow i8k driver to be built on x86_64 systems Bradley Smith
2007-10-28 17:37 ` Adrian Bunk
2007-10-28 23:19   ` Bradley Smith
2007-10-28 17:59 ` Jeff Garzik
2007-10-28 18:03   ` Bradley Smith
2007-10-29  6:12   ` Frank Sorenson

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