aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/platform/aclinux.h
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2009-04-22 01:39:47 -0400
committerLen Brown <len.brown@intel.com>2009-05-27 00:30:50 -0400
commite0c437bcca6926b541c738b5c64445654750b365 (patch)
tree0f6cdbfe724b726991426bc0ab960a38afda3cfb /include/acpi/platform/aclinux.h
parent2b09ce98a25e467455ecd81354cc18381628be75 (diff)
ACPICA: Linux OSL: cleanup/update/merge
Merge the OSL with the actual file used by Linux, so that the file does not require patching when integrated with Linux. General cleanup and some restructuring. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/acpi/platform/aclinux.h')
-rw-r--r--include/acpi/platform/aclinux.h63
1 files changed, 38 insertions, 25 deletions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 6d49b2a498c4..fcb8e4b159b1 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -1,11 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: aclinux.h - OS specific defines, etc. 3 * Name: aclinux.h - OS specific defines, etc. for Linux
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2009, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,10 +44,13 @@
44#ifndef __ACLINUX_H__ 44#ifndef __ACLINUX_H__
45#define __ACLINUX_H__ 45#define __ACLINUX_H__
46 46
47/* Common (in-kernel/user-space) ACPICA configuration */
48
47#define ACPI_USE_SYSTEM_CLIBRARY 49#define ACPI_USE_SYSTEM_CLIBRARY
48#define ACPI_USE_DO_WHILE_0 50#define ACPI_USE_DO_WHILE_0
49#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE 51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
50 52
53
51#ifdef __KERNEL__ 54#ifdef __KERNEL__
52 55
53#include <linux/string.h> 56#include <linux/string.h>
@@ -63,15 +66,18 @@
63#include <linux/spinlock_types.h> 66#include <linux/spinlock_types.h>
64#include <asm/current.h> 67#include <asm/current.h>
65 68
66/* Host-dependent types and defines */ 69/* Host-dependent types and defines for in-kernel ACPICA */
67 70
68#define ACPI_MACHINE_WIDTH BITS_PER_LONG 71#define ACPI_MACHINE_WIDTH BITS_PER_LONG
69#define acpi_cache_t struct kmem_cache
70#define acpi_spinlock spinlock_t *
71#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 72#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
72#define strtoul simple_strtoul 73#define strtoul simple_strtoul
73 74
74#else /* !__KERNEL__ */ 75#define acpi_cache_t struct kmem_cache
76#define acpi_spinlock spinlock_t *
77#define acpi_cpu_flags unsigned long
78#define acpi_thread_id struct task_struct *
79
80#else /* !__KERNEL__ */
75 81
76#include <stdarg.h> 82#include <stdarg.h>
77#include <string.h> 83#include <string.h>
@@ -79,6 +85,11 @@
79#include <ctype.h> 85#include <ctype.h>
80#include <unistd.h> 86#include <unistd.h>
81 87
88/* Host-dependent types and defines for user-space ACPICA */
89
90#define ACPI_FLUSH_CPU_CACHE()
91#define acpi_thread_id pthread_t
92
82#if defined(__ia64__) || defined(__x86_64__) 93#if defined(__ia64__) || defined(__x86_64__)
83#define ACPI_MACHINE_WIDTH 64 94#define ACPI_MACHINE_WIDTH 64
84#define COMPILER_DEPENDENT_INT64 long 95#define COMPILER_DEPENDENT_INT64 long
@@ -94,17 +105,17 @@
94#define __cdecl 105#define __cdecl
95#endif 106#endif
96 107
97#define ACPI_FLUSH_CPU_CACHE() 108#endif /* __KERNEL__ */
98#endif /* __KERNEL__ */
99 109
100/* Linux uses GCC */ 110/* Linux uses GCC */
101 111
102#include "acgcc.h" 112#include "acgcc.h"
103 113
104#define acpi_cpu_flags unsigned long
105
106#define acpi_thread_id struct task_struct *
107 114
115#ifdef __KERNEL__
116/*
117 * Overrides for in-kernel ACPICA
118 */
108static inline acpi_thread_id acpi_os_get_thread_id(void) 119static inline acpi_thread_id acpi_os_get_thread_id(void)
109{ 120{
110 return current; 121 return current;
@@ -119,30 +130,32 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
119#include <acpi/actypes.h> 130#include <acpi/actypes.h>
120static inline void *acpi_os_allocate(acpi_size size) 131static inline void *acpi_os_allocate(acpi_size size)
121{ 132{
122 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 133 return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
123} 134}
135
124static inline void *acpi_os_allocate_zeroed(acpi_size size) 136static inline void *acpi_os_allocate_zeroed(acpi_size size)
125{ 137{
126 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 138 return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
127} 139}
128 140
129static inline void *acpi_os_acquire_object(acpi_cache_t * cache) 141static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
130{ 142{
131 return kmem_cache_zalloc(cache, 143 return kmem_cache_zalloc(cache,
132 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 144 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
133} 145}
134 146
135#define ACPI_ALLOCATE(a) acpi_os_allocate(a) 147#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
136#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) 148#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
137#define ACPI_FREE(a) kfree(a) 149#define ACPI_FREE(a) kfree(a)
138 150
139/* 151/* Used within ACPICA to show where it is safe to preempt execution */
140 * We need to show where it is safe to preempt execution of ACPICA 152
141 */ 153#define ACPI_PREEMPTION_POINT() \
142#define ACPI_PREEMPTION_POINT() \ 154 do { \
143 do { \ 155 if (!irqs_disabled()) \
144 if (!irqs_disabled()) \ 156 cond_resched(); \
145 cond_resched(); \
146 } while (0) 157 } while (0)
147 158
148#endif /* __ACLINUX_H__ */ 159#endif /* __KERNEL__ */
160
161#endif /* __ACLINUX_H__ */