Parent repository is http://linux-acpi.bkbits.net/linux-acpi-test-2.6.4 khc@pm.waw.pl|ChangeSet|20040308002825|48427 khc diff -Nru a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c --- a/drivers/acpi/hardware/hwsleep.c Sun Mar 7 18:41:44 2004 +++ b/drivers/acpi/hardware/hwsleep.c Sun Mar 7 18:41:44 2004 @@ -394,7 +394,7 @@ * ******************************************************************************/ -acpi_status +acpi_status asmlinkage acpi_enter_sleep_state_s4bios ( void) { diff -Nru a/drivers/acpi/power.c b/drivers/acpi/power.c --- a/drivers/acpi/power.c Sun Mar 7 18:41:44 2004 +++ b/drivers/acpi/power.c Sun Mar 7 18:41:44 2004 @@ -23,6 +23,18 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* + * ACPI power-managed devices may be controlled in two ways: + * 1. via "Device Specific (D-State) Control" + * 2. via "Power Resource Control". + * This module is used to manage devices relying on Power Resource Control. + * + * An ACPI "power resource object" describes a software controllable power + * plane, clock plane, or other resource used by a power managed device. + * A device may rely on multiple power resources, and a power resource + * may be shared by multiple devices. + */ + #include #include #include diff -Nru a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h --- a/include/asm-i386/acpi.h Sun Mar 7 18:41:44 2004 +++ b/include/asm-i386/acpi.h Sun Mar 7 18:41:44 2004 @@ -61,33 +61,36 @@ * Immediate values in the assembly are preceded by "$" as in "$0x1" * The final asm parameter are the operation altered non-output registers. */ + +static inline int +__acpi_acquire_global_lock (unsigned int *lock) +{ + unsigned int old, new, val; + do { + old = *lock; + new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1)); + val = cmpxchg(lock, old, new); + } while (unlikely (val != old)); + return (new < 3) ? -1 : 0; +} + +static inline int +__acpi_release_global_lock (unsigned int *lock) +{ + unsigned int old, new, val; + do { + old = *lock; + new = old & ~0x3; + val = cmpxchg(lock, old, new); + } while (unlikely (val != old)); + return old & 0x1; +} + #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - int dummy; \ - asm("1: movl (%1),%%eax;" \ - "movl %%eax,%%edx;" \ - "andl %2,%%edx;" \ - "btsl $0x1,%%edx;" \ - "adcl $0x0,%%edx;" \ - "lock; cmpxchgl %%edx,(%1);" \ - "jnz 1b;" \ - "cmpb $0x3,%%dl;" \ - "sbbl %%eax,%%eax" \ - :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \ - } while(0) + ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - int dummy; \ - asm("1: movl (%1),%%eax;" \ - "movl %%eax,%%edx;" \ - "andl %2,%%edx;" \ - "lock; cmpxchgl %%edx,(%1);" \ - "jnz 1b;" \ - "andl $0x1,%%eax" \ - :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \ - } while(0) - + ((Acq) = __acpi_release_global_lock((unsigned int *) GLptr)) /* * Math helper asm macros diff -Nru a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h --- a/include/asm-x86_64/acpi.h Sun Mar 7 18:41:44 2004 +++ b/include/asm-x86_64/acpi.h Sun Mar 7 18:41:44 2004 @@ -60,7 +60,7 @@ do { old = *lock; new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1)); - val = cmpxchg4_locked(lock, new, old); + val = cmpxchg(lock, old, new); } while (unlikely (val != old)); return (new < 3) ? -1 : 0; } @@ -72,7 +72,7 @@ do { old = *lock; new = old & ~0x3; - val = cmpxchg4_locked(lock, new, old); + val = cmpxchg(lock, old, new); } while (unlikely (val != old)); return old & 0x1; } diff -Nru a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h --- a/include/asm-x86_64/system.h Sun Mar 7 18:41:44 2004 +++ b/include/asm-x86_64/system.h Sun Mar 7 18:41:44 2004 @@ -276,13 +276,6 @@ ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ (unsigned long)(n),sizeof(*(ptr)))) -static inline __u32 cmpxchg4_locked(__u32 *ptr, __u32 old, __u32 new) -{ - asm volatile("lock ; cmpxchgl %k1,%2" : - "=r" (new) : "0" (old), "m" (*(__u32 *)ptr) : "memory"); - return new; -} - #ifdef CONFIG_SMP #define smp_mb() mb() #define smp_rmb() rmb()