aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-05-12 03:46:38 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-27 12:13:07 -0400
commit07d8391433380fc72f999d99c554b1cfedea9778 (patch)
treee497e4aff2a785ab234c60bc6d89db4da2d8a72f /arch
parentd13bd5a602982cd7f697e39b13ac736c2c553af1 (diff)
ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h>
There is a mis-order inclusion for <asm/acpi.h>. As we will enforce including <linux/acpi.h> for all Linux ACPI users, we can find the inclusion order is as follows: <linux/acpi.h> <acpi/acpi.h> <acpi/platform/acenv.h> (acenv.h before including aclinux.h) <acpi/platform/aclinux.h> ........................................................................... (aclinux.h before including asm/acpi.h) <asm/acpi.h> @Redundant@ (ACPICA specific stuff) ........................................................................... ........................................................................... (Linux ACPI specific stuff) ? - - - - - - - - - - - - + (aclinux.h after including asm/acpi.h) @Invisible@ | (acenv.h after including aclinux.h) @Invisible@ | other ACPICA headers @Invisible@ | ............................................................|.............. <acpi/acpi_bus.h> | <acpi/acpi_drivers.h> | <asm/acpi.h> (Excluded) | (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - + NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig generated <generated/autoconf.h> for Linux, it is meant to be included before including any ACPICA code. In the above figure, there is a question mark for "Linux ACPI specific stuff" in <asm/acpi.h> which should be included after including all other ACPICA header files. Thus they really need to be moved to the position marked with exclaimation mark or the definitions in the blocks marked with "@Invisible@" will be invisible to such architecture specific "Linux ACPI specific stuff" header blocks. This leaves 2 issues: 1. All environmental definitions in these blocks should have a copy in the area marked with "@Redundant@" if they are required by the "Linux ACPI specific stuff". 2. We cannot use any ACPICA defined types in <asm/acpi.h>. This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to fix this issue. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch')
-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
4 files changed, 136 insertions, 95 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;