acenv.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
  2. /******************************************************************************
  3. *
  4. * Name: acenv.h - Host and compiler configuration
  5. *
  6. * Copyright (C) 2000 - 2018, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. #ifndef __ACENV_H__
  10. #define __ACENV_H__
  11. /*
  12. * Environment configuration. The purpose of this file is to interface ACPICA
  13. * to the local environment. This includes compiler-specific, OS-specific,
  14. * and machine-specific configuration.
  15. */
  16. /* Types for ACPI_MUTEX_TYPE */
  17. #define ACPI_BINARY_SEMAPHORE 0
  18. #define ACPI_OSL_MUTEX 1
  19. /* Types for DEBUGGER_THREADING */
  20. #define DEBUGGER_SINGLE_THREADED 0
  21. #define DEBUGGER_MULTI_THREADED 1
  22. /******************************************************************************
  23. *
  24. * Configuration for ACPI tools and utilities
  25. *
  26. *****************************************************************************/
  27. /* Common application configuration. All single threaded except for acpi_exec. */
  28. #if (defined ACPI_ASL_COMPILER) || \
  29. (defined ACPI_BIN_APP) || \
  30. (defined ACPI_DUMP_APP) || \
  31. (defined ACPI_HELP_APP) || \
  32. (defined ACPI_NAMES_APP) || \
  33. (defined ACPI_SRC_APP) || \
  34. (defined ACPI_XTRACT_APP) || \
  35. (defined ACPI_EXAMPLE_APP) || \
  36. (defined ACPI_EFI_HELLO)
  37. #define ACPI_APPLICATION
  38. #define ACPI_SINGLE_THREADED
  39. #define USE_NATIVE_ALLOCATE_ZEROED
  40. #endif
  41. /* iASL configuration */
  42. #ifdef ACPI_ASL_COMPILER
  43. #define ACPI_DEBUG_OUTPUT
  44. #define ACPI_CONSTANT_EVAL_ONLY
  45. #define ACPI_LARGE_NAMESPACE_NODE
  46. #define ACPI_DATA_TABLE_DISASSEMBLY
  47. #define ACPI_32BIT_PHYSICAL_ADDRESS
  48. #define ACPI_DISASSEMBLER 1
  49. #endif
  50. /* acpi_exec configuration. Multithreaded with full AML debugger */
  51. #ifdef ACPI_EXEC_APP
  52. #define ACPI_APPLICATION
  53. #define ACPI_FULL_DEBUG
  54. #define ACPI_MUTEX_DEBUG
  55. #define ACPI_DBG_TRACK_ALLOCATIONS
  56. #endif
  57. /* acpi_help configuration. Error messages disabled. */
  58. #ifdef ACPI_HELP_APP
  59. #define ACPI_NO_ERROR_MESSAGES
  60. #endif
  61. /* acpi_names configuration. Debug output enabled. */
  62. #ifdef ACPI_NAMES_APP
  63. #define ACPI_DEBUG_OUTPUT
  64. #endif
  65. /* acpi_exec/acpi_names/Example configuration. Native RSDP used. */
  66. #if (defined ACPI_EXEC_APP) || \
  67. (defined ACPI_EXAMPLE_APP) || \
  68. (defined ACPI_NAMES_APP)
  69. #define ACPI_USE_NATIVE_RSDP_POINTER
  70. #endif
  71. /* acpi_dump configuration. Native mapping used if provided by the host */
  72. #ifdef ACPI_DUMP_APP
  73. #define ACPI_USE_NATIVE_MEMORY_MAPPING
  74. #endif
  75. /* acpi_names/Example configuration. Hardware disabled */
  76. #if (defined ACPI_EXAMPLE_APP) || \
  77. (defined ACPI_NAMES_APP)
  78. #define ACPI_REDUCED_HARDWARE 1
  79. #endif
  80. /* Linkable ACPICA library. Two versions, one with full debug. */
  81. #ifdef ACPI_LIBRARY
  82. #define ACPI_USE_LOCAL_CACHE
  83. #define ACPI_DEBUGGER 1
  84. #define ACPI_DISASSEMBLER 1
  85. #ifdef _DEBUG
  86. #define ACPI_DEBUG_OUTPUT
  87. #endif
  88. #endif
  89. /* Common for all ACPICA applications */
  90. #ifdef ACPI_APPLICATION
  91. #define ACPI_USE_LOCAL_CACHE
  92. #endif
  93. /* Common debug/disassembler support */
  94. #ifdef ACPI_FULL_DEBUG
  95. #define ACPI_DEBUG_OUTPUT
  96. #define ACPI_DEBUGGER 1
  97. #define ACPI_DISASSEMBLER 1
  98. #endif
  99. /*! [Begin] no source code translation */
  100. /******************************************************************************
  101. *
  102. * Host configuration files. The compiler configuration files are included
  103. * first.
  104. *
  105. *****************************************************************************/
  106. #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  107. #include <acpi/platform/acgcc.h>
  108. #elif defined(_MSC_VER)
  109. #include "acmsvc.h"
  110. #elif defined(__INTEL_COMPILER)
  111. #include <acpi/platform/acintel.h>
  112. #endif
  113. #if defined(_LINUX) || defined(__linux__)
  114. #include <acpi/platform/aclinux.h>
  115. #elif defined(_APPLE) || defined(__APPLE__)
  116. #include "acmacosx.h"
  117. #elif defined(__DragonFly__)
  118. #include "acdragonfly.h"
  119. #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
  120. #include "acfreebsd.h"
  121. #elif defined(__NetBSD__)
  122. #include "acnetbsd.h"
  123. #elif defined(__sun)
  124. #include "acsolaris.h"
  125. #elif defined(MODESTO)
  126. #include "acmodesto.h"
  127. #elif defined(NETWARE)
  128. #include "acnetware.h"
  129. #elif defined(_CYGWIN)
  130. #include "accygwin.h"
  131. #elif defined(WIN32)
  132. #include "acwin.h"
  133. #elif defined(WIN64)
  134. #include "acwin64.h"
  135. #elif defined(_WRS_LIB_BUILD)
  136. #include "acvxworks.h"
  137. #elif defined(__OS2__)
  138. #include "acos2.h"
  139. #elif defined(__HAIKU__)
  140. #include "achaiku.h"
  141. #elif defined(__QNX__)
  142. #include "acqnx.h"
  143. /*
  144. * EFI applications can be built with -nostdlib, in this case, it must be
  145. * included after including all other host environmental definitions, in
  146. * order to override the definitions.
  147. */
  148. #elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)
  149. #include "acefi.h"
  150. #else
  151. /* Unknown environment */
  152. #error Unknown target environment
  153. #endif
  154. /*! [End] no source code translation !*/
  155. /******************************************************************************
  156. *
  157. * Setup defaults for the required symbols that were not defined in one of
  158. * the host/compiler files above.
  159. *
  160. *****************************************************************************/
  161. /* 64-bit data types */
  162. #ifndef COMPILER_DEPENDENT_INT64
  163. #define COMPILER_DEPENDENT_INT64 long long
  164. #endif
  165. #ifndef COMPILER_DEPENDENT_UINT64
  166. #define COMPILER_DEPENDENT_UINT64 unsigned long long
  167. #endif
  168. /* Type of mutex supported by host. Default is binary semaphores. */
  169. #ifndef ACPI_MUTEX_TYPE
  170. #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
  171. #endif
  172. /* Global Lock acquire/release */
  173. #ifndef ACPI_ACQUIRE_GLOBAL_LOCK
  174. #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acquired) acquired = 1
  175. #endif
  176. #ifndef ACPI_RELEASE_GLOBAL_LOCK
  177. #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0
  178. #endif
  179. /* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
  180. #ifndef ACPI_FLUSH_CPU_CACHE
  181. #define ACPI_FLUSH_CPU_CACHE()
  182. #endif
  183. /* "inline" keywords - configurable since inline is not standardized */
  184. #ifndef ACPI_INLINE
  185. #define ACPI_INLINE
  186. #endif
  187. /* Use ordered initialization if compiler doesn't support designated. */
  188. #ifndef ACPI_STRUCT_INIT
  189. #define ACPI_STRUCT_INIT(field, value) value
  190. #endif
  191. /*
  192. * Configurable calling conventions:
  193. *
  194. * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
  195. * ACPI_EXTERNAL_XFACE - External ACPI interfaces
  196. * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
  197. * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
  198. */
  199. #ifndef ACPI_SYSTEM_XFACE
  200. #define ACPI_SYSTEM_XFACE
  201. #endif
  202. #ifndef ACPI_EXTERNAL_XFACE
  203. #define ACPI_EXTERNAL_XFACE
  204. #endif
  205. #ifndef ACPI_INTERNAL_XFACE
  206. #define ACPI_INTERNAL_XFACE
  207. #endif
  208. #ifndef ACPI_INTERNAL_VAR_XFACE
  209. #define ACPI_INTERNAL_VAR_XFACE
  210. #endif
  211. /*
  212. * Debugger threading model
  213. * Use single threaded if the entire subsystem is contained in an application
  214. * Use multiple threaded when the subsystem is running in the kernel.
  215. *
  216. * By default the model is single threaded if ACPI_APPLICATION is set,
  217. * multi-threaded if ACPI_APPLICATION is not set.
  218. */
  219. #ifndef DEBUGGER_THREADING
  220. #if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP)
  221. #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
  222. #else
  223. #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
  224. #endif
  225. #endif /* !DEBUGGER_THREADING */
  226. /******************************************************************************
  227. *
  228. * C library configuration
  229. *
  230. *****************************************************************************/
  231. /*
  232. * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
  233. * Otherwise, local versions of string/memory functions will be used.
  234. * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
  235. * the standard header files may be used. Defining this implies that
  236. * ACPI_USE_SYSTEM_CLIBRARY has been defined.
  237. *
  238. * The ACPICA subsystem only uses low level C library functions that do not
  239. * call operating system services and may therefore be inlined in the code.
  240. *
  241. * It may be necessary to tailor these include files to the target
  242. * generation environment.
  243. */
  244. /* Use the standard C library headers. We want to keep these to a minimum. */
  245. #ifdef ACPI_USE_STANDARD_HEADERS
  246. /* Use the standard headers from the standard locations */
  247. #include <stdlib.h>
  248. #include <string.h>
  249. #include <ctype.h>
  250. #if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)
  251. #include <stdio.h>
  252. #include <fcntl.h>
  253. #include <errno.h>
  254. #include <time.h>
  255. #include <signal.h>
  256. #endif
  257. #endif /* ACPI_USE_STANDARD_HEADERS */
  258. #ifdef ACPI_APPLICATION
  259. #define ACPI_FILE FILE *
  260. #define ACPI_FILE_OUT stdout
  261. #define ACPI_FILE_ERR stderr
  262. #else
  263. #define ACPI_FILE void *
  264. #define ACPI_FILE_OUT NULL
  265. #define ACPI_FILE_ERR NULL
  266. #endif /* ACPI_APPLICATION */
  267. #ifndef ACPI_INIT_FUNCTION
  268. #define ACPI_INIT_FUNCTION
  269. #endif
  270. #endif /* __ACENV_H__ */