[tlinux-users:08138] Re: New release of omnibook module soon: testing welcome

Holger Nelson <[email protected]>
Newsgroups gmane.linux.hardware.toshiba
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 11 Sep 2006, Holger Nelson wrote:

> On Mon, 11 Sep 2006, Mathieu Bérard wrote:
> 
> > Which mean that I will have to recode the
> > whole block in asm to control precisely what is going on.
> > This might also explain the failures reported by Renato S. Yamane
> >
> > * While not precised anywhere in the doc I have assumed it does
> > not include esp or I fail to see how we can recover.
> 
> Setting/reading display brightness works after applying the patch below,
> but it complains about bad return-codes from smi-commands.

Ok, next try. This time the return-codes are working. I also changed the 
code for ATI-chipsets this time.

Holger

diff -urpN -X /usr/src/linux-2.6.17.3/Documentation/dontdiff xxx/trunk/nbsmi.c trunk/nbsmi.c
- --- xxx/trunk/nbsmi.c	2006-09-11 01:45:42.000000000 +0200
+++ trunk/nbsmi.c	2006-09-11 16:00:16.000000000 +0200
@@ -84,21 +84,27 @@ extern const struct pci_device_id lpc_br
 static inline void save_all_regs_flag(void)
 {	
 	spin_lock_irq(&smi_spinlock);
- -	__asm__ __volatile__("pushal ; pushfl");
 }
 
 static inline void restore_all_regs_flag(void)
 {
- -	__asm__ __volatile__("popfl; popal"
- -			     :
- -			     : 
- -			     : "eax", "ecx", "edx", "ebx", "esp", "esi", "edi");
 	spin_unlock_irq(&smi_spinlock);	
 }
 
 static inline void ati_do_smi_call(int *retval, u16 function)
 {
- -	outw( function, ATI_SMI_PORT ); /* Call to SMI */
+
+	// Call to SMI
+	
+	__asm__ __volatile__("pushf;
+			      pusha;
+			      out %w0,%w1;
+			      popa;
+			      popf;"
+			     :
+			     : "a"(function), "Nd"(ATI_SMI_PORT)
+			     : "ecx", "esp");
+	/*	outw( function, ATI_SMI_PORT ); Call to SMI */
 	*retval = inw(ATI_SMI_PORT + 1);
 }
 
@@ -109,17 +115,20 @@ static inline void intel_do_smi_call(int
 	state = inl(sci_en);
 	outl( 0, sci_en );
 
- -	outw( function, INTEL_SMI_PORT ); /* Call to SMI */
+	/* Success/Failure is saved in eax so don't save is on stack */
 	
- -/*
- - * Success/Failure state in now stored in eax
- - */
- -	__asm__ __volatile__("movl %%eax, %0"
+	__asm__ __volatile__("pushf;
+			      push %%ecx;push %%edx;push %%ebx;push %%esi;push %%edi; push %%ebp;
+			      out %w0,%w1;
+			      pop %%ebp; pop %%edi; pop %%esi; pop %%ebx; pop %%edx; pop %%ecx; 
+			      popf; 
+			      movl %%eax, (%2)"
 			     :
- -			     : "m" (retval)
- -			    );
- -
+			     : "a"(function), "Nd"(INTEL_SMI_PORT), "b"(retval)
+			     : "ecx", "edx", "esi", "edi", "ebp", "esp");
+	
 	outl( state, sci_en );	
+
 }
 
 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Made with pgp4pine 1.76

iD8DBQFFBW0JV71P2fDJM84RAl5VAJ9Gt6gqXjQyn2HRlLCsWGGfJNWBvwCgi61D
ZAcaGtsNFwwcRvO2BrfPW5Q=
=MCRW
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.