aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/include/asm/acenv.h71
-rw-r--r--arch/ia64/include/asm/acpi.h50
-rw-r--r--arch/x86/include/asm/acenv.h65
-rw-r--r--arch/x86/include/asm/acpi.h45
-rw-r--r--include/acpi/platform/aclinux.h2
5 files changed, 137 insertions, 96 deletions
diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 000000000000..e0896eb26bf1
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
1/*
2 * IA64 specific ACPICA environments and implementation
3 *
4 * Copyright (C) 2014, Intel Corporation
5 * Author: Lv Zheng <lv.zheng@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_IA64_ACENV_H
13#define _ASM_IA64_ACENV_H
14
15#include <asm/intrinsics.h>
16
17#define COMPILER_DEPENDENT_INT64 long
18#define COMPILER_DEPENDENT_UINT64 unsigned long
19
20/*
21 * Calling conventions:
22 *
23 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
24 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
25 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
26 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
27 */
28#define ACPI_SYSTEM_XFACE
29#define ACPI_EXTERNAL_XFACE
30#define ACPI_INTERNAL_XFACE
31#define ACPI_INTERNAL_VAR_XFACE
32
33/* Asm macros */
34
35#define ACPI_FLUSH_CPU_CACHE()
36
37#ifdef CONFIG_ACPI
38
39static inline int
40ia64_acpi_acquire_global_lock(unsigned int *lock)
41{
42 unsigned int old, new, val;
43 do {
44 old = *lock;
45 new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
46 val = ia64_cmpxchg4_acq(lock, new, old);
47 } while (unlikely (val != old));
48 return (new < 3) ? -1 : 0;
49}
50
51static inline int
52ia64_acpi_release_global_lock(unsigned int *lock)
53{
54 unsigned int old, new, val;
55 do {
56 old = *lock;
57 new = old & ~0x3;
58 val = ia64_cmpxchg4_acq(lock, new, old);
59 } while (unlikely (val != old));
60 return old & 0x1;
61}
62
63#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
64 ((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
65
66#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
67 ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
68
69#endif
70
71#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102a4d45..b0ddcfd384a4 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
34#include <linux/numa.h> 34#include <linux/numa.h>
35#include <asm/numa.h> 35#include <asm/numa.h>
36 36
37#define COMPILER_DEPENDENT_INT64 long
38#define COMPILER_DEPENDENT_UINT64 unsigned long
39
40/*
41 * Calling conventions:
42 *
43 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
44 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
45 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
46 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
47 */
48#define ACPI_SYSTEM_XFACE
49#define ACPI_EXTERNAL_XFACE
50#define ACPI_INTERNAL_XFACE
51#define ACPI_INTERNAL_VAR_XFACE
52
53/* Asm macros */
54
55#define ACPI_FLUSH_CPU_CACHE()
56
57static inline int
58ia64_acpi_acquire_global_lock (unsigned int *lock)
59{
60 unsigned int old, new, val;
61 do {
62 old = *lock;
63 new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
64 val = ia64_cmpxchg4_acq(lock, new, old);
65 } while (unlikely (val != old));
66 return (new < 3) ? -1 : 0;
67}
68
69static inline int
70ia64_acpi_release_global_lock (unsigned int *lock)
71{
72 unsigned int old, new, val;
73 do {
74 old = *lock;
75 new = old & ~0x3;
76 val = ia64_cmpxchg4_acq(lock, new, old);
77 } while (unlikely (val != old));
78 return old & 0x1;
79}
80
81#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
82 ((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
83
84#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
85 ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
86
87#ifdef CONFIG_ACPI 37#ifdef CONFIG_ACPI
88#define acpi_disabled 0 /* ACPI always enabled on IA64 */ 38#define acpi_disabled 0 /* ACPI always enabled on IA64 */
89#define acpi_noirq 0 /* ACPI always enabled on IA64 */ 39#define acpi_noirq 0 /* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 000000000000..6978584934f7
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
1/*
2 * X86 specific ACPICA environments and implementation
3 *
4 * Copyright (C) 2014, Intel Corporation
5 * Author: Lv Zheng <lv.zheng@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_X86_ACENV_H
13#define _ASM_X86_ACENV_H
14
15#include <asm/special_insns.h>
16
17#define COMPILER_DEPENDENT_INT64 long long
18#define COMPILER_DEPENDENT_UINT64 unsigned long long
19
20/*
21 * Calling conventions:
22 *
23 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
24 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
25 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
26 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
27 */
28#define ACPI_SYSTEM_XFACE
29#define ACPI_EXTERNAL_XFACE
30#define ACPI_INTERNAL_XFACE
31#define ACPI_INTERNAL_VAR_XFACE
32
33/* Asm macros */
34
35#define ACPI_FLUSH_CPU_CACHE() wbinvd()
36
37#ifdef CONFIG_ACPI
38
39int __acpi_acquire_global_lock(unsigned int *lock);
40int __acpi_release_global_lock(unsigned int *lock);
41
42#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
43 ((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
44
45#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
46 ((Acq) = __acpi_release_global_lock(&facs->global_lock))
47
48/*
49 * Math helper asm macros
50 */
51#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
52 asm("divl %2;" \
53 : "=a"(q32), "=d"(r32) \
54 : "r"(d32), \
55 "0"(n_lo), "1"(n_hi))
56
57#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
58 asm("shrl $1,%2 ;" \
59 "rcrl $1,%3;" \
60 : "=r"(n_hi), "=r"(n_lo) \
61 : "0"(n_hi), "1"(n_lo))
62
63#endif
64
65#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e700c26e..e06225eda635 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
32#include <asm/mpspec.h> 32#include <asm/mpspec.h>
33#include <asm/realmode.h> 33#include <asm/realmode.h>
34 34
35#define COMPILER_DEPENDENT_INT64 long long
36#define COMPILER_DEPENDENT_UINT64 unsigned long long
37
38/*
39 * Calling conventions:
40 *
41 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
42 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
43 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
44 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
45 */
46#define ACPI_SYSTEM_XFACE
47#define ACPI_EXTERNAL_XFACE
48#define ACPI_INTERNAL_XFACE
49#define ACPI_INTERNAL_VAR_XFACE
50
51/* Asm macros */
52
53#define ACPI_FLUSH_CPU_CACHE() wbinvd()
54
55int __acpi_acquire_global_lock(unsigned int *lock);
56int __acpi_release_global_lock(unsigned int *lock);
57
58#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
59 ((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
60
61#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
62 ((Acq) = __acpi_release_global_lock(&facs->global_lock))
63
64/*
65 * Math helper asm macros
66 */
67#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
68 asm("divl %2;" \
69 : "=a"(q32), "=d"(r32) \
70 : "r"(d32), \
71 "0"(n_lo), "1"(n_hi))
72
73
74#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
75 asm("shrl $1,%2 ;" \
76 "rcrl $1,%3;" \
77 : "=r"(n_hi), "=r"(n_lo) \
78 : "0"(n_hi), "1"(n_lo))
79
80#ifdef CONFIG_ACPI 35#ifdef CONFIG_ACPI
81extern int acpi_lapic; 36extern int acpi_lapic;
82extern int acpi_ioapic; 37extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 0ab05d95e3a3..5d27e560a48e 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
71#ifdef EXPORT_ACPI_INTERFACES 71#ifdef EXPORT_ACPI_INTERFACES
72#include <linux/export.h> 72#include <linux/export.h>
73#endif 73#endif
74#include <asm/acpi.h> 74#include <asm/acenv.h>
75 75
76#ifndef CONFIG_ACPI 76#ifndef CONFIG_ACPI
77 77