acenv.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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 - 2022, 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. /*
  100. * acpisrc CR\LF support
  101. * Unix file line endings do not include the carriage return.
  102. * If the acpisrc utility is being built using a microsoft compiler, it means
  103. * that it will be running on a windows machine which means that the output is
  104. * expected to have CR/LF newlines. If the acpisrc utility is built with
  105. * anything else, it will likely run on a system with LF newlines. This flag
  106. * tells the acpisrc utility that newlines will be in the LF format.
  107. */
  108. #define ACPI_SRC_OS_LF_ONLY 0
  109. /*! [Begin] no source code translation */
  110. /******************************************************************************
  111. *
  112. * Host configuration files. The compiler configuration files are included
  113. * first.
  114. *
  115. *****************************************************************************/
  116. #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  117. #include <acpi/platform/acgcc.h>
  118. #elif defined(_MSC_VER)
  119. #include "acmsvc.h"
  120. #elif defined(__INTEL_COMPILER)
  121. #include <acpi/platform/acintel.h>
  122. #endif
  123. #if defined(_LINUX) || defined(__linux__)
  124. #include <acpi/platform/aclinux.h>
  125. #elif defined(_APPLE) || defined(__APPLE__)
  126. #include "acmacosx.h"
  127. #elif defined(__DragonFly__)
  128. #include "acdragonfly.h"
  129. #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
  130. #include "acfreebsd.h"
  131. #elif defined(__NetBSD__)
  132. #include "acnetbsd.h"
  133. #elif defined(__sun)
  134. #include "acsolaris.h"
  135. #elif defined(MODESTO)
  136. #include "acmodesto.h"
  137. #elif defined(NETWARE)
  138. #include "acnetware.h"
  139. #elif defined(_CYGWIN)
  140. #include "accygwin.h"
  141. #elif defined(WIN32)
  142. #include "acwin.h"
  143. #elif defined(WIN64)
  144. #include "acwin64.h"
  145. #elif defined(_WRS_LIB_BUILD)
  146. #include "acvxworks.h"
  147. #elif defined(__OS2__)
  148. #include "acos2.h"
  149. #elif defined(__HAIKU__)
  150. #include "achaiku.h"
  151. #elif defined(__QNX__)
  152. #include "acqnx.h"
  153. /*
  154. * EFI applications can be built with -nostdlib, in this case, it must be
  155. * included after including all other host environmental definitions, in
  156. * order to override the definitions.
  157. */
  158. #elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)
  159. #include "acefi.h"
  160. #else
  161. /* Unknown environment */
  162. #error Unknown target environment
  163. #endif
  164. /*! [End] no source code translation !*/
  165. /******************************************************************************
  166. *
  167. * Setup defaults for the required symbols that were not defined in one of
  168. * the host/compiler files above.
  169. *
  170. *****************************************************************************/
  171. /* 64-bit data types */
  172. #ifndef COMPILER_DEPENDENT_INT64
  173. #define COMPILER_DEPENDENT_INT64 long long
  174. #endif
  175. #ifndef COMPILER_DEPENDENT_UINT64
  176. #define COMPILER_DEPENDENT_UINT64 unsigned long long
  177. #endif
  178. /* Type of mutex supported by host. Default is binary semaphores. */
  179. #ifndef ACPI_MUTEX_TYPE
  180. #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
  181. #endif
  182. /* Global Lock acquire/release */
  183. #ifndef ACPI_ACQUIRE_GLOBAL_LOCK
  184. #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acquired) acquired = 1
  185. #endif
  186. #ifndef ACPI_RELEASE_GLOBAL_LOCK
  187. #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0
  188. #endif
  189. /* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
  190. #ifndef ACPI_FLUSH_CPU_CACHE
  191. #define ACPI_FLUSH_CPU_CACHE()
  192. #endif
  193. /* "inline" keywords - configurable since inline is not standardized */
  194. #ifndef ACPI_INLINE
  195. #define ACPI_INLINE
  196. #endif
  197. /* Use ordered initialization if compiler doesn't support designated. */
  198. #ifndef ACPI_STRUCT_INIT
  199. #define ACPI_STRUCT_INIT(field, value) value
  200. #endif
  201. /*
  202. * Configurable calling conventions:
  203. *
  204. * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
  205. * ACPI_EXTERNAL_XFACE - External ACPI interfaces
  206. * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
  207. * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
  208. */
  209. #ifndef ACPI_SYSTEM_XFACE
  210. #define ACPI_SYSTEM_XFACE
  211. #endif
  212. #ifndef ACPI_EXTERNAL_XFACE
  213. #define ACPI_EXTERNAL_XFACE
  214. #endif
  215. #ifndef ACPI_INTERNAL_XFACE
  216. #define ACPI_INTERNAL_XFACE
  217. #endif
  218. #ifndef ACPI_INTERNAL_VAR_XFACE
  219. #define ACPI_INTERNAL_VAR_XFACE
  220. #endif
  221. /*
  222. * Debugger threading model
  223. * Use single threaded if the entire subsystem is contained in an application
  224. * Use multiple threaded when the subsystem is running in the kernel.
  225. *
  226. * By default the model is single threaded if ACPI_APPLICATION is set,
  227. * multi-threaded if ACPI_APPLICATION is not set.
  228. */
  229. #ifndef DEBUGGER_THREADING
  230. #if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP)
  231. #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED
  232. #else
  233. #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
  234. #endif
  235. #endif /* !DEBUGGER_THREADING */
  236. /******************************************************************************
  237. *
  238. * C library configuration
  239. *
  240. *****************************************************************************/
  241. /*
  242. * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
  243. * Otherwise, local versions of string/memory functions will be used.
  244. * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
  245. * the standard header files may be used. Defining this implies that
  246. * ACPI_USE_SYSTEM_CLIBRARY has been defined.
  247. *
  248. * The ACPICA subsystem only uses low level C library functions that do not
  249. * call operating system services and may therefore be inlined in the code.
  250. *
  251. * It may be necessary to tailor these include files to the target
  252. * generation environment.
  253. */
  254. /* Use the standard C library headers. We want to keep these to a minimum. */
  255. #ifdef ACPI_USE_STANDARD_HEADERS
  256. /* Use the standard headers from the standard locations */
  257. #include <stdlib.h>
  258. #include <string.h>
  259. #include <ctype.h>
  260. #if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)
  261. #include <stdio.h>
  262. #include <fcntl.h>
  263. #include <errno.h>
  264. #include <time.h>
  265. #include <signal.h>
  266. #endif
  267. #endif /* ACPI_USE_STANDARD_HEADERS */
  268. #ifdef ACPI_APPLICATION
  269. #define ACPI_FILE FILE *
  270. #define ACPI_FILE_OUT stdout
  271. #define ACPI_FILE_ERR stderr
  272. #else
  273. #define ACPI_FILE void *
  274. #define ACPI_FILE_OUT NULL
  275. #define ACPI_FILE_ERR NULL
  276. #endif /* ACPI_APPLICATION */
  277. #ifndef ACPI_INIT_FUNCTION
  278. #define ACPI_INIT_FUNCTION
  279. #endif
  280. #endif /* __ACENV_H__ */