aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
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/ia64
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/ia64')
-rw-r--r--arch/ia64/include/asm/acenv.h71
-rw-r--r--arch/ia64/include/asm/acpi.h50
2 files changed, 71 insertions, 50 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 */