aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/platform
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2013-10-28 21:30:41 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-31 09:36:41 -0400
commit93220587f76b8a4eca89cb655fc0cc04e9da663d (patch)
tree0a8e1ba1334ce49e13388b45eeb07aed42471deb /include/acpi/platform
parent7e94632fc530d990de3110e6c53425d6e28dd238 (diff)
ACPICA: Update aclinux.h for new OSL override mechanism.
The new ACPICA OSL override mechanism is used to solve these issues for the Linux OSL: 1. Linux can implement OSL using a macro. 2. Linux can implement OSL using an inlined function. 3. Linux can leave OSL not implemented for __KERNEL__ undefined code fragments. 4. Linux can add sparse declarators (__iomem) to OSL. 5. Linux can add memory tuning declarators (__init/__exit) to OSL. This patch also moves Linux specific OSL to aclinux.h which has not been maintained in the ACPICA code base. Lv Zheng. Known issue: From ACPICA's perspective, actypes.h should be included after inclusion of acenv.h. But currently in Linux, aclinux.h included by acenv.h has included actypes.h to find ACPICA types for inline functions. This is a known and existing issue and currently there is no real problem caused by this issue for Linux kernel build. Thus this issue is not covered by this cleanup commit. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi/platform')
-rw-r--r--include/acpi/platform/aclinux.h118
1 files changed, 88 insertions, 30 deletions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 04e87a3b8086..ab57930794a5 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -50,7 +50,6 @@
50#define ACPI_USE_DO_WHILE_0 50#define ACPI_USE_DO_WHILE_0
51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE 51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
52 52
53
54#ifdef __KERNEL__ 53#ifdef __KERNEL__
55 54
56#include <linux/string.h> 55#include <linux/string.h>
@@ -58,11 +57,13 @@
58#include <linux/ctype.h> 57#include <linux/ctype.h>
59#include <linux/sched.h> 58#include <linux/sched.h>
60#include <linux/atomic.h> 59#include <linux/atomic.h>
61#include <asm/div64.h> 60#include <linux/math64.h>
62#include <asm/acpi.h>
63#include <linux/slab.h> 61#include <linux/slab.h>
64#include <linux/spinlock_types.h> 62#include <linux/spinlock_types.h>
65#include <asm/current.h> 63#ifdef EXPORT_ACPI_INTERFACES
64#include <linux/export.h>
65#endif
66#include <asm/acpi.h>
66 67
67/* Host-dependent types and defines for in-kernel ACPICA */ 68/* Host-dependent types and defines for in-kernel ACPICA */
68 69
@@ -109,23 +110,29 @@
109#include <acpi/platform/acgcc.h> 110#include <acpi/platform/acgcc.h>
110 111
111#ifdef __KERNEL__ 112#ifdef __KERNEL__
113
114/*
115 * FIXME: Inclusion of actypes.h
116 * Linux kernel need this before defining inline OSL interfaces as
117 * actypes.h need to be included to find ACPICA type definitions.
118 * Since from ACPICA's perspective, the actypes.h should be included after
119 * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
120 */
112#include <acpi/actypes.h> 121#include <acpi/actypes.h>
122
113/* 123/*
114 * Overrides for in-kernel ACPICA 124 * Overrides for in-kernel ACPICA
115 */ 125 */
116static inline acpi_thread_id acpi_os_get_thread_id(void) 126acpi_status __init acpi_os_initialize(void);
117{ 127#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
118 return (acpi_thread_id)(unsigned long)current; 128
119} 129acpi_status acpi_os_terminate(void);
130#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
120 131
121/* 132/*
122 * Memory allocation/deallocation 133 * Memory allocation/deallocation
123 */ 134 */
124 135
125/* Use native linux version of acpi_os_allocate_zeroed */
126
127#define USE_NATIVE_ALLOCATE_ZEROED
128
129/* 136/*
130 * The irqs_disabled() check is for resume from RAM. 137 * The irqs_disabled() check is for resume from RAM.
131 * Interrupts are off during resume, just like they are for boot. 138 * Interrupts are off during resume, just like they are for boot.
@@ -134,26 +141,45 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
134 */ 141 */
135static inline void *acpi_os_allocate(acpi_size size) 142static inline void *acpi_os_allocate(acpi_size size)
136{ 143{
137 return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 144 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
138} 145}
139 146
147#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
148
149/* Use native linux version of acpi_os_allocate_zeroed */
150
140static inline void *acpi_os_allocate_zeroed(acpi_size size) 151static inline void *acpi_os_allocate_zeroed(acpi_size size)
141{ 152{
142 return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 153 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
154}
155
156#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
157#define USE_NATIVE_ALLOCATE_ZEROED
158
159static inline void acpi_os_free(void *memory)
160{
161 kfree(memory);
143} 162}
144 163
164#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
165
145static inline void *acpi_os_acquire_object(acpi_cache_t * cache) 166static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
146{ 167{
147 return kmem_cache_zalloc(cache, 168 return kmem_cache_zalloc(cache,
148 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 169 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
149} 170}
150 171
151static inline void acpi_os_free(void *a) 172#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
173
174static inline acpi_thread_id acpi_os_get_thread_id(void)
152{ 175{
153 kfree(a); 176 return (acpi_thread_id) (unsigned long)current;
154} 177}
155 178
179#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
180
156#ifndef CONFIG_PREEMPT 181#ifndef CONFIG_PREEMPT
182
157/* 183/*
158 * Used within ACPICA to show where it is safe to preempt execution 184 * Used within ACPICA to show where it is safe to preempt execution
159 * when CONFIG_PREEMPT=n 185 * when CONFIG_PREEMPT=n
@@ -163,6 +189,7 @@ static inline void acpi_os_free(void *a)
163 if (!irqs_disabled()) \ 189 if (!irqs_disabled()) \
164 cond_resched(); \ 190 cond_resched(); \
165 } while (0) 191 } while (0)
192
166#endif 193#endif
167 194
168/* 195/*
@@ -172,21 +199,52 @@ static inline void acpi_os_free(void *a)
172 * all locks to the name of the argument of acpi_os_create_lock(), which 199 * all locks to the name of the argument of acpi_os_create_lock(), which
173 * prevents lockdep from reporting false positives for ACPICA locks. 200 * prevents lockdep from reporting false positives for ACPICA locks.
174 */ 201 */
175#define acpi_os_create_lock(__handle) \ 202#define acpi_os_create_lock(__handle) \
176({ \ 203 ({ \
177 spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ 204 spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
178 \ 205 if (lock) { \
179 if (lock) { \ 206 *(__handle) = lock; \
180 *(__handle) = lock; \ 207 spin_lock_init(*(__handle)); \
181 spin_lock_init(*(__handle)); \ 208 } \
182 } \ 209 lock ? AE_OK : AE_NO_MEMORY; \
183 lock ? AE_OK : AE_NO_MEMORY; \ 210 })
184})
185#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock 211#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
186 212
187#ifdef EXPORT_ACPI_INTERFACES 213void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
188#include <linux/export.h> 214#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
189#endif 215
216void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
217#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
218
219/*
220 * OSL interfaces used by debugger/disassembler
221 */
222#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
223#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
224
225/*
226 * OSL interfaces used by utilities
227 */
228#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
229#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
230#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
231#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
232#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
233#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
234#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
235#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
236
237/*
238 * OSL interfaces added by Linux
239 */
240void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
241
242void acpi_os_gpe_count(u32 gpe_number);
243
244void acpi_os_fixed_event_count(u32 fixed_event_number);
245
246acpi_status
247acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context);
190 248
191#endif /* __KERNEL__ */ 249#endif /* __KERNEL__ */
192 250