diff options
-rw-r--r-- | arch/i386/kernel/acpi/boot.c | 22 | ||||
-rw-r--r-- | include/asm-i386/acpi.h | 26 | ||||
-rw-r--r-- | include/asm-x86_64/acpi.h | 26 |
3 files changed, 26 insertions, 48 deletions
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index ab974ff97073..bf7099ca41a5 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -1319,3 +1319,25 @@ static int __init setup_acpi_sci(char *s) | |||
1319 | return 0; | 1319 | return 0; |
1320 | } | 1320 | } |
1321 | early_param("acpi_sci", setup_acpi_sci); | 1321 | early_param("acpi_sci", setup_acpi_sci); |
1322 | |||
1323 | int __acpi_acquire_global_lock(unsigned int *lock) | ||
1324 | { | ||
1325 | unsigned int old, new, val; | ||
1326 | do { | ||
1327 | old = *lock; | ||
1328 | new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1)); | ||
1329 | val = cmpxchg(lock, old, new); | ||
1330 | } while (unlikely (val != old)); | ||
1331 | return (new < 3) ? -1 : 0; | ||
1332 | } | ||
1333 | |||
1334 | int __acpi_release_global_lock(unsigned int *lock) | ||
1335 | { | ||
1336 | unsigned int old, new, val; | ||
1337 | do { | ||
1338 | old = *lock; | ||
1339 | new = old & ~0x3; | ||
1340 | val = cmpxchg(lock, old, new); | ||
1341 | } while (unlikely (val != old)); | ||
1342 | return old & 0x1; | ||
1343 | } | ||
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h index 6016632d032f..29bee1dcde72 100644 --- a/include/asm-i386/acpi.h +++ b/include/asm-i386/acpi.h | |||
@@ -56,30 +56,8 @@ | |||
56 | #define ACPI_ENABLE_IRQS() local_irq_enable() | 56 | #define ACPI_ENABLE_IRQS() local_irq_enable() |
57 | #define ACPI_FLUSH_CPU_CACHE() wbinvd() | 57 | #define ACPI_FLUSH_CPU_CACHE() wbinvd() |
58 | 58 | ||
59 | 59 | int __acpi_acquire_global_lock(unsigned int *lock); | |
60 | static inline int | 60 | int __acpi_release_global_lock(unsigned int *lock); |
61 | __acpi_acquire_global_lock (unsigned int *lock) | ||
62 | { | ||
63 | unsigned int old, new, val; | ||
64 | do { | ||
65 | old = *lock; | ||
66 | new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1)); | ||
67 | val = cmpxchg(lock, old, new); | ||
68 | } while (unlikely (val != old)); | ||
69 | return (new < 3) ? -1 : 0; | ||
70 | } | ||
71 | |||
72 | static inline int | ||
73 | __acpi_release_global_lock (unsigned int *lock) | ||
74 | { | ||
75 | unsigned int old, new, val; | ||
76 | do { | ||
77 | old = *lock; | ||
78 | new = old & ~0x3; | ||
79 | val = cmpxchg(lock, old, new); | ||
80 | } while (unlikely (val != old)); | ||
81 | return old & 0x1; | ||
82 | } | ||
83 | 61 | ||
84 | #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ | 62 | #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ |
85 | ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) | 63 | ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) |
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h index ed59aa4c6ff9..1371e88666ed 100644 --- a/include/asm-x86_64/acpi.h +++ b/include/asm-x86_64/acpi.h | |||
@@ -54,30 +54,8 @@ | |||
54 | #define ACPI_ENABLE_IRQS() local_irq_enable() | 54 | #define ACPI_ENABLE_IRQS() local_irq_enable() |
55 | #define ACPI_FLUSH_CPU_CACHE() wbinvd() | 55 | #define ACPI_FLUSH_CPU_CACHE() wbinvd() |
56 | 56 | ||
57 | 57 | int __acpi_acquire_global_lock(unsigned int *lock); | |
58 | static inline int | 58 | int __acpi_release_global_lock(unsigned int *lock); |
59 | __acpi_acquire_global_lock (unsigned int *lock) | ||
60 | { | ||
61 | unsigned int old, new, val; | ||
62 | do { | ||
63 | old = *lock; | ||
64 | new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1)); | ||
65 | val = cmpxchg(lock, old, new); | ||
66 | } while (unlikely (val != old)); | ||
67 | return (new < 3) ? -1 : 0; | ||
68 | } | ||
69 | |||
70 | static inline int | ||
71 | __acpi_release_global_lock (unsigned int *lock) | ||
72 | { | ||
73 | unsigned int old, new, val; | ||
74 | do { | ||
75 | old = *lock; | ||
76 | new = old & ~0x3; | ||
77 | val = cmpxchg(lock, old, new); | ||
78 | } while (unlikely (val != old)); | ||
79 | return old & 0x1; | ||
80 | } | ||
81 | 59 | ||
82 | #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ | 60 | #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ |
83 | ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) | 61 | ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) |