aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/platform/acenv.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/acpi/platform/acenv.h')
-rw-r--r--include/acpi/platform/acenv.h319
1 files changed, 166 insertions, 153 deletions
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 89cee88dd2a5..ef04b36ca6ed 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -1,11 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: acenv.h - Generation environment specific items 3 * Name: acenv.h - Host and compiler configuration
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2012, Intel Corp. 8 * Copyright (C) 2000 - 2013, 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,6 +44,12 @@
44#ifndef __ACENV_H__ 44#ifndef __ACENV_H__
45#define __ACENV_H__ 45#define __ACENV_H__
46 46
47/*
48 * Environment configuration. The purpose of this file is to interface ACPICA
49 * to the local environment. This includes compiler-specific, OS-specific,
50 * and machine-specific configuration.
51 */
52
47/* Types for ACPI_MUTEX_TYPE */ 53/* Types for ACPI_MUTEX_TYPE */
48 54
49#define ACPI_BINARY_SEMAPHORE 0 55#define ACPI_BINARY_SEMAPHORE 0
@@ -60,139 +66,170 @@
60 * 66 *
61 *****************************************************************************/ 67 *****************************************************************************/
62 68
63#ifdef ACPI_LIBRARY 69/* iASL configuration */
64/*
65 * Note: The non-debug version of the acpi_library does not contain any
66 * debug support, for minimal size. The debug version uses ACPI_FULL_DEBUG
67 */
68#define ACPI_USE_LOCAL_CACHE
69#endif
70 70
71#ifdef ACPI_ASL_COMPILER 71#ifdef ACPI_ASL_COMPILER
72#define ACPI_DEBUG_OUTPUT
73#define ACPI_APPLICATION 72#define ACPI_APPLICATION
74#define ACPI_DISASSEMBLER 73#define ACPI_DISASSEMBLER
74#define ACPI_DEBUG_OUTPUT
75#define ACPI_CONSTANT_EVAL_ONLY 75#define ACPI_CONSTANT_EVAL_ONLY
76#define ACPI_LARGE_NAMESPACE_NODE 76#define ACPI_LARGE_NAMESPACE_NODE
77#define ACPI_DATA_TABLE_DISASSEMBLY 77#define ACPI_DATA_TABLE_DISASSEMBLY
78#define ACPI_SINGLE_THREADED
78#endif 79#endif
79 80
81/* acpi_exec configuration. Multithreaded with full AML debugger */
82
80#ifdef ACPI_EXEC_APP 83#ifdef ACPI_EXEC_APP
81#undef DEBUGGER_THREADING
82#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
83#define ACPI_FULL_DEBUG
84#define ACPI_APPLICATION 84#define ACPI_APPLICATION
85#define ACPI_DEBUGGER 85#define ACPI_FULL_DEBUG
86#define ACPI_MUTEX_DEBUG 86#define ACPI_MUTEX_DEBUG
87#define ACPI_DBG_TRACK_ALLOCATIONS 87#define ACPI_DBG_TRACK_ALLOCATIONS
88#endif 88#endif
89 89
90/* acpi_names configuration. Single threaded with debugger output enabled. */
91
92#ifdef ACPI_NAMES_APP
93#define ACPI_DEBUGGER
94#define ACPI_APPLICATION
95#define ACPI_SINGLE_THREADED
96#endif
97
98/*
99 * acpi_bin/acpi_help/acpi_src configuration. All single threaded, with
100 * no debug output.
101 */
102#if (defined ACPI_BIN_APP) || \
103 (defined ACPI_SRC_APP) || \
104 (defined ACPI_XTRACT_APP)
105#define ACPI_APPLICATION
106#define ACPI_SINGLE_THREADED
107#endif
108
109#ifdef ACPI_HELP_APP
110#define ACPI_APPLICATION
111#define ACPI_SINGLE_THREADED
112#define ACPI_NO_ERROR_MESSAGES
113#endif
114
115/* Linkable ACPICA library */
116
117#ifdef ACPI_LIBRARY
118#define ACPI_USE_LOCAL_CACHE
119#define ACPI_FUTURE_USAGE
120#endif
121
122/* Common for all ACPICA applications */
123
90#ifdef ACPI_APPLICATION 124#ifdef ACPI_APPLICATION
91#define ACPI_USE_SYSTEM_CLIBRARY 125#define ACPI_USE_SYSTEM_CLIBRARY
92#define ACPI_USE_LOCAL_CACHE 126#define ACPI_USE_LOCAL_CACHE
93#endif 127#endif
94 128
129/* Common debug support */
130
95#ifdef ACPI_FULL_DEBUG 131#ifdef ACPI_FULL_DEBUG
96#define ACPI_DEBUGGER 132#define ACPI_DEBUGGER
97#define ACPI_DEBUG_OUTPUT 133#define ACPI_DEBUG_OUTPUT
98#define ACPI_DISASSEMBLER 134#define ACPI_DISASSEMBLER
99#endif 135#endif
100 136
101/*
102 * Environment configuration. The purpose of this file is to interface to the
103 * local generation environment.
104 *
105 * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
106 * Otherwise, local versions of string/memory functions will be used.
107 * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
108 * the standard header files may be used.
109 *
110 * The ACPI subsystem only uses low level C library functions that do not call
111 * operating system services and may therefore be inlined in the code.
112 *
113 * It may be necessary to tailor these include files to the target
114 * generation environment.
115 *
116 *
117 * Functions and constants used from each header:
118 *
119 * string.h: memcpy
120 * memset
121 * strcat
122 * strcmp
123 * strcpy
124 * strlen
125 * strncmp
126 * strncat
127 * strncpy
128 *
129 * stdlib.h: strtoul
130 *
131 * stdarg.h: va_list
132 * va_arg
133 * va_start
134 * va_end
135 *
136 */
137 137
138/*! [Begin] no source code translation */ 138/*! [Begin] no source code translation */
139 139
140/******************************************************************************
141 *
142 * Host configuration files. The compiler configuration files are included
143 * by the host files.
144 *
145 *****************************************************************************/
146
140#if defined(_LINUX) || defined(__linux__) 147#if defined(_LINUX) || defined(__linux__)
141#include <acpi/platform/aclinux.h> 148#include <acpi/platform/aclinux.h>
142 149
143#elif defined(_AED_EFI)
144#include "acefi.h"
145
146#elif defined(WIN32)
147#include "acwin.h"
148
149#elif defined(WIN64)
150#include "acwin64.h"
151
152#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
153#include "acdos16.h"
154
155#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) 150#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
156#include "acfreebsd.h" 151#include "acfreebsd.h"
157 152
158#elif defined(__NetBSD__) 153#elif defined(__NetBSD__)
159#include "acnetbsd.h" 154#include "acnetbsd.h"
160 155
156#elif defined(__sun)
157#include "acsolaris.h"
158
161#elif defined(MODESTO) 159#elif defined(MODESTO)
162#include "acmodesto.h" 160#include "acmodesto.h"
163 161
164#elif defined(NETWARE) 162#elif defined(NETWARE)
165#include "acnetware.h" 163#include "acnetware.h"
166 164
167#elif defined(__sun) 165#elif defined(_CYGWIN)
168#include "acsolaris.h" 166#include "accygwin.h"
169 167
170#else 168#elif defined(WIN32)
169#include "acwin.h"
170
171#elif defined(WIN64)
172#include "acwin64.h"
171 173
172/* All other environments */ 174#elif defined(_WRS_LIB_BUILD)
175#include "acvxworks.h"
173 176
174#define ACPI_USE_STANDARD_HEADERS 177#elif defined(__OS2__)
178#include "acos2.h"
175 179
176#define COMPILER_DEPENDENT_INT64 long long 180#elif defined(_AED_EFI)
177#define COMPILER_DEPENDENT_UINT64 unsigned long long 181#include "acefi.h"
182
183#elif defined(__HAIKU__)
184#include "achaiku.h"
178 185
186#else
187
188/* Unknown environment */
189
190#error Unknown target environment
179#endif 191#endif
180 192
181/*! [End] no source code translation !*/ 193/*! [End] no source code translation !*/
182 194
183/****************************************************************************** 195/******************************************************************************
184 * 196 *
185 * Miscellaneous configuration 197 * Setup defaults for the required symbols that were not defined in one of
198 * the host/compiler files above.
186 * 199 *
187 *****************************************************************************/ 200 *****************************************************************************/
188 201
189/* 202/* 64-bit data types */
190 * Are mutexes supported by the host? default is no, use binary semaphores. 203
191 */ 204#ifndef COMPILER_DEPENDENT_INT64
205#define COMPILER_DEPENDENT_INT64 long long
206#endif
207
208#ifndef COMPILER_DEPENDENT_UINT64
209#define COMPILER_DEPENDENT_UINT64 unsigned long long
210#endif
211
212/* Type of mutex supported by host. Default is binary semaphores. */
192#ifndef ACPI_MUTEX_TYPE 213#ifndef ACPI_MUTEX_TYPE
193#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE 214#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
194#endif 215#endif
195 216
217/* Global Lock acquire/release */
218
219#ifndef ACPI_ACQUIRE_GLOBAL_LOCK
220#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acquired) acquired = 1
221#endif
222
223#ifndef ACPI_RELEASE_GLOBAL_LOCK
224#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0
225#endif
226
227/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
228
229#ifndef ACPI_FLUSH_CPU_CACHE
230#define ACPI_FLUSH_CPU_CACHE()
231#endif
232
196/* "inline" keywords - configurable since inline is not standardized */ 233/* "inline" keywords - configurable since inline is not standardized */
197 234
198#ifndef ACPI_INLINE 235#ifndef ACPI_INLINE
@@ -200,6 +237,30 @@
200#endif 237#endif
201 238
202/* 239/*
240 * Configurable calling conventions:
241 *
242 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
243 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
244 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
245 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
246 */
247#ifndef ACPI_SYSTEM_XFACE
248#define ACPI_SYSTEM_XFACE
249#endif
250
251#ifndef ACPI_EXTERNAL_XFACE
252#define ACPI_EXTERNAL_XFACE
253#endif
254
255#ifndef ACPI_INTERNAL_XFACE
256#define ACPI_INTERNAL_XFACE
257#endif
258
259#ifndef ACPI_INTERNAL_VAR_XFACE
260#define ACPI_INTERNAL_VAR_XFACE
261#endif
262
263/*
203 * Debugger threading model 264 * Debugger threading model
204 * Use single threaded if the entire subsystem is contained in an application 265 * Use single threaded if the entire subsystem is contained in an application
205 * Use multiple threaded when the subsystem is running in the kernel. 266 * Use multiple threaded when the subsystem is running in the kernel.
@@ -222,17 +283,26 @@
222 * 283 *
223 *****************************************************************************/ 284 *****************************************************************************/
224 285
225#define ACPI_IS_ASCII(c) ((c) < 0x80)
226
227#ifdef ACPI_USE_SYSTEM_CLIBRARY
228/* 286/*
229 * Use the standard C library headers. 287 * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
230 * We want to keep these to a minimum. 288 * Otherwise, local versions of string/memory functions will be used.
289 * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
290 * the standard header files may be used.
291 *
292 * The ACPICA subsystem only uses low level C library functions that do not call
293 * operating system services and may therefore be inlined in the code.
294 *
295 * It may be necessary to tailor these include files to the target
296 * generation environment.
231 */ 297 */
298#ifdef ACPI_USE_SYSTEM_CLIBRARY
299
300/* Use the standard C library headers. We want to keep these to a minimum. */
301
232#ifdef ACPI_USE_STANDARD_HEADERS 302#ifdef ACPI_USE_STANDARD_HEADERS
233/* 303
234 * Use the standard headers from the standard locations 304/* Use the standard headers from the standard locations */
235 */ 305
236#include <stdarg.h> 306#include <stdarg.h>
237#include <stdlib.h> 307#include <stdlib.h>
238#include <string.h> 308#include <string.h>
@@ -240,9 +310,8 @@
240 310
241#endif /* ACPI_USE_STANDARD_HEADERS */ 311#endif /* ACPI_USE_STANDARD_HEADERS */
242 312
243/* 313/* We will be linking to the standard Clib functions */
244 * We will be linking to the standard Clib functions 314
245 */
246#define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) 315#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
247#define ACPI_STRCHR(s1,c) strchr((s1), (c)) 316#define ACPI_STRCHR(s1,c) strchr((s1), (c))
248#define ACPI_STRLEN(s) (acpi_size) strlen((s)) 317#define ACPI_STRLEN(s) (acpi_size) strlen((s))
@@ -274,13 +343,12 @@
274 * 343 *
275 *****************************************************************************/ 344 *****************************************************************************/
276 345
277 /* 346/*
278 * Use local definitions of C library macros and functions 347 * Use local definitions of C library macros and functions. These function
279 * NOTE: The function implementations may not be as efficient 348 * implementations may not be as efficient as an inline or assembly code
280 * as an inline or assembly code implementation provided by a 349 * implementation provided by a native C library, but they are functionally
281 * native C library. 350 * equivalent.
282 */ 351 */
283
284#ifndef va_arg 352#ifndef va_arg
285 353
286#ifndef _VALIST 354#ifndef _VALIST
@@ -288,22 +356,22 @@
288typedef char *va_list; 356typedef char *va_list;
289#endif /* _VALIST */ 357#endif /* _VALIST */
290 358
291/* 359/* Storage alignment properties */
292 * Storage alignment properties 360
293 */
294#define _AUPBND (sizeof (acpi_native_int) - 1) 361#define _AUPBND (sizeof (acpi_native_int) - 1)
295#define _ADNBND (sizeof (acpi_native_int) - 1) 362#define _ADNBND (sizeof (acpi_native_int) - 1)
296 363
297/* 364/* Variable argument list macro definitions */
298 * Variable argument list macro definitions 365
299 */
300#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) 366#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
301#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND)))) 367#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
302#define va_end(ap) (void) 0 368#define va_end(ap) (ap = (va_list) NULL)
303#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND)))) 369#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
304 370
305#endif /* va_arg */ 371#endif /* va_arg */
306 372
373/* Use the local (ACPICA) definitions of the clib functions */
374
307#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) 375#define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2))
308#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) 376#define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c))
309#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s)) 377#define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s))
@@ -322,59 +390,4 @@ typedef char *va_list;
322 390
323#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 391#endif /* ACPI_USE_SYSTEM_CLIBRARY */
324 392
325/******************************************************************************
326 *
327 * Assembly code macros
328 *
329 *****************************************************************************/
330
331/*
332 * Handle platform- and compiler-specific assembly language differences.
333 * These should already have been defined by the platform includes above.
334 *
335 * Notes:
336 * 1) Interrupt 3 is used to break into a debugger
337 * 2) Interrupts are turned off during ACPI register setup
338 */
339
340/* Unrecognized compiler, use defaults */
341
342#ifndef ACPI_ASM_MACROS
343
344/*
345 * Calling conventions:
346 *
347 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
348 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
349 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
350 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
351 */
352#define ACPI_SYSTEM_XFACE
353#define ACPI_EXTERNAL_XFACE
354#define ACPI_INTERNAL_XFACE
355#define ACPI_INTERNAL_VAR_XFACE
356
357#define ACPI_ASM_MACROS
358#define BREAKPOINT3
359#define ACPI_DISABLE_IRQS()
360#define ACPI_ENABLE_IRQS()
361#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
362#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
363
364#endif /* ACPI_ASM_MACROS */
365
366#ifdef ACPI_APPLICATION
367
368/* Don't want software interrupts within a ring3 application */
369
370#undef BREAKPOINT3
371#define BREAKPOINT3
372#endif
373
374/******************************************************************************
375 *
376 * Compiler-specific information is contained in the compiler-specific
377 * headers.
378 *
379 *****************************************************************************/
380#endif /* __ACENV_H__ */ 393#endif /* __ACENV_H__ */