Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
0002 /******************************************************************************
0003  *
0004  * Name: acenv.h - Host and compiler configuration
0005  *
0006  * Copyright (C) 2000 - 2022, Intel Corp.
0007  *
0008  *****************************************************************************/
0009 
0010 #ifndef __ACENV_H__
0011 #define __ACENV_H__
0012 
0013 /*
0014  * Environment configuration. The purpose of this file is to interface ACPICA
0015  * to the local environment. This includes compiler-specific, OS-specific,
0016  * and machine-specific configuration.
0017  */
0018 
0019 /* Types for ACPI_MUTEX_TYPE */
0020 
0021 #define ACPI_BINARY_SEMAPHORE       0
0022 #define ACPI_OSL_MUTEX              1
0023 
0024 /* Types for DEBUGGER_THREADING */
0025 
0026 #define DEBUGGER_SINGLE_THREADED    0
0027 #define DEBUGGER_MULTI_THREADED     1
0028 
0029 /******************************************************************************
0030  *
0031  * Configuration for ACPI tools and utilities
0032  *
0033  *****************************************************************************/
0034 
0035 /* Common application configuration. All single threaded except for acpi_exec. */
0036 
0037 #if (defined ACPI_ASL_COMPILER) || \
0038     (defined ACPI_BIN_APP)      || \
0039     (defined ACPI_DUMP_APP)     || \
0040     (defined ACPI_HELP_APP)     || \
0041     (defined ACPI_NAMES_APP)    || \
0042     (defined ACPI_SRC_APP)      || \
0043     (defined ACPI_XTRACT_APP)   || \
0044     (defined ACPI_EXAMPLE_APP)  || \
0045     (defined ACPI_EFI_HELLO)
0046 #define ACPI_APPLICATION
0047 #define ACPI_SINGLE_THREADED
0048 #define USE_NATIVE_ALLOCATE_ZEROED
0049 #endif
0050 
0051 /* iASL configuration */
0052 
0053 #ifdef ACPI_ASL_COMPILER
0054 #define ACPI_DEBUG_OUTPUT
0055 #define ACPI_CONSTANT_EVAL_ONLY
0056 #define ACPI_LARGE_NAMESPACE_NODE
0057 #define ACPI_DATA_TABLE_DISASSEMBLY
0058 #define ACPI_32BIT_PHYSICAL_ADDRESS
0059 #define ACPI_DISASSEMBLER 1
0060 #endif
0061 
0062 /* acpi_exec configuration. Multithreaded with full AML debugger */
0063 
0064 #ifdef ACPI_EXEC_APP
0065 #define ACPI_APPLICATION
0066 #define ACPI_FULL_DEBUG
0067 #define ACPI_MUTEX_DEBUG
0068 #define ACPI_DBG_TRACK_ALLOCATIONS
0069 #endif
0070 
0071 /* acpi_help configuration. Error messages disabled. */
0072 
0073 #ifdef ACPI_HELP_APP
0074 #define ACPI_NO_ERROR_MESSAGES
0075 #endif
0076 
0077 /* acpi_names configuration. Debug output enabled. */
0078 
0079 #ifdef ACPI_NAMES_APP
0080 #define ACPI_DEBUG_OUTPUT
0081 #endif
0082 
0083 /* acpi_exec/acpi_names/Example configuration. Native RSDP used. */
0084 
0085 #if (defined ACPI_EXEC_APP)     || \
0086     (defined ACPI_EXAMPLE_APP)  || \
0087     (defined ACPI_NAMES_APP)
0088 #define ACPI_USE_NATIVE_RSDP_POINTER
0089 #endif
0090 
0091 /* acpi_dump configuration. Native mapping used if provided by the host */
0092 
0093 #ifdef ACPI_DUMP_APP
0094 #define ACPI_USE_NATIVE_MEMORY_MAPPING
0095 #endif
0096 
0097 /* acpi_names/Example configuration. Hardware disabled */
0098 
0099 #if (defined ACPI_EXAMPLE_APP)  || \
0100     (defined ACPI_NAMES_APP)
0101 #define ACPI_REDUCED_HARDWARE 1
0102 #endif
0103 
0104 /* Linkable ACPICA library. Two versions, one with full debug. */
0105 
0106 #ifdef ACPI_LIBRARY
0107 #define ACPI_USE_LOCAL_CACHE
0108 #define ACPI_DEBUGGER 1
0109 #define ACPI_DISASSEMBLER 1
0110 
0111 #ifdef _DEBUG
0112 #define ACPI_DEBUG_OUTPUT
0113 #endif
0114 #endif
0115 
0116 /* Common for all ACPICA applications */
0117 
0118 #ifdef ACPI_APPLICATION
0119 #define ACPI_USE_LOCAL_CACHE
0120 #endif
0121 
0122 /* Common debug/disassembler support */
0123 
0124 #ifdef ACPI_FULL_DEBUG
0125 #define ACPI_DEBUG_OUTPUT
0126 #define ACPI_DEBUGGER 1
0127 #define ACPI_DISASSEMBLER 1
0128 #endif
0129 
0130 
0131 /*
0132  * acpisrc CR\LF support
0133  * Unix file line endings do not include the carriage return.
0134  * If the acpisrc utility is being built using a microsoft compiler, it means
0135  * that it will be running on a windows machine which means that the output is
0136  * expected to have CR/LF newlines. If the acpisrc utility is built with
0137  * anything else, it will likely run on a system with LF newlines. This flag
0138  * tells the acpisrc utility that newlines will be in the LF format.
0139  */
0140 #define ACPI_SRC_OS_LF_ONLY 0
0141 
0142 /*! [Begin] no source code translation */
0143 
0144 /******************************************************************************
0145  *
0146  * Host configuration files. The compiler configuration files are included
0147  * first.
0148  *
0149  *****************************************************************************/
0150 
0151 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
0152 #include <acpi/platform/acgcc.h>
0153 
0154 #elif defined(_MSC_VER)
0155 #include "acmsvc.h"
0156 
0157 #elif defined(__INTEL_COMPILER)
0158 #include <acpi/platform/acintel.h>
0159 
0160 #endif
0161 
0162 #if defined(_LINUX) || defined(__linux__)
0163 #include <acpi/platform/aclinux.h>
0164 
0165 #elif defined(_APPLE) || defined(__APPLE__)
0166 #include "acmacosx.h"
0167 
0168 #elif defined(__DragonFly__)
0169 #include "acdragonfly.h"
0170 
0171 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
0172 #include "acfreebsd.h"
0173 
0174 #elif defined(__NetBSD__)
0175 #include "acnetbsd.h"
0176 
0177 #elif defined(__sun)
0178 #include "acsolaris.h"
0179 
0180 #elif defined(MODESTO)
0181 #include "acmodesto.h"
0182 
0183 #elif defined(NETWARE)
0184 #include "acnetware.h"
0185 
0186 #elif defined(_CYGWIN)
0187 #include "accygwin.h"
0188 
0189 #elif defined(WIN32)
0190 #include "acwin.h"
0191 
0192 #elif defined(WIN64)
0193 #include "acwin64.h"
0194 
0195 #elif defined(_WRS_LIB_BUILD)
0196 #include "acvxworks.h"
0197 
0198 #elif defined(__OS2__)
0199 #include "acos2.h"
0200 
0201 #elif defined(__HAIKU__)
0202 #include "achaiku.h"
0203 
0204 #elif defined(__QNX__)
0205 #include "acqnx.h"
0206 
0207 /*
0208  * EFI applications can be built with -nostdlib, in this case, it must be
0209  * included after including all other host environmental definitions, in
0210  * order to override the definitions.
0211  */
0212 #elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)
0213 #include "acefi.h"
0214 
0215 #else
0216 
0217 /* Unknown environment */
0218 
0219 #error Unknown target environment
0220 #endif
0221 
0222 /*! [End] no source code translation !*/
0223 
0224 /******************************************************************************
0225  *
0226  * Setup defaults for the required symbols that were not defined in one of
0227  * the host/compiler files above.
0228  *
0229  *****************************************************************************/
0230 
0231 /* 64-bit data types */
0232 
0233 #ifndef COMPILER_DEPENDENT_INT64
0234 #define COMPILER_DEPENDENT_INT64   long long
0235 #endif
0236 
0237 #ifndef COMPILER_DEPENDENT_UINT64
0238 #define COMPILER_DEPENDENT_UINT64  unsigned long long
0239 #endif
0240 
0241 /* Type of mutex supported by host. Default is binary semaphores. */
0242 #ifndef ACPI_MUTEX_TYPE
0243 #define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
0244 #endif
0245 
0246 /* Global Lock acquire/release */
0247 
0248 #ifndef ACPI_ACQUIRE_GLOBAL_LOCK
0249 #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acquired) acquired = 1
0250 #endif
0251 
0252 #ifndef ACPI_RELEASE_GLOBAL_LOCK
0253 #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0
0254 #endif
0255 
0256 /* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
0257 
0258 #ifndef ACPI_FLUSH_CPU_CACHE
0259 #define ACPI_FLUSH_CPU_CACHE()
0260 #endif
0261 
0262 /* "inline" keywords - configurable since inline is not standardized */
0263 
0264 #ifndef ACPI_INLINE
0265 #define ACPI_INLINE
0266 #endif
0267 
0268 /* Use ordered initialization if compiler doesn't support designated. */
0269 #ifndef ACPI_STRUCT_INIT
0270 #define ACPI_STRUCT_INIT(field, value)  value
0271 #endif
0272 
0273 /*
0274  * Configurable calling conventions:
0275  *
0276  * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
0277  * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
0278  * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
0279  * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
0280  */
0281 #ifndef ACPI_SYSTEM_XFACE
0282 #define ACPI_SYSTEM_XFACE
0283 #endif
0284 
0285 #ifndef ACPI_EXTERNAL_XFACE
0286 #define ACPI_EXTERNAL_XFACE
0287 #endif
0288 
0289 #ifndef ACPI_INTERNAL_XFACE
0290 #define ACPI_INTERNAL_XFACE
0291 #endif
0292 
0293 #ifndef ACPI_INTERNAL_VAR_XFACE
0294 #define ACPI_INTERNAL_VAR_XFACE
0295 #endif
0296 
0297 /*
0298  * Debugger threading model
0299  * Use single threaded if the entire subsystem is contained in an application
0300  * Use multiple threaded when the subsystem is running in the kernel.
0301  *
0302  * By default the model is single threaded if ACPI_APPLICATION is set,
0303  * multi-threaded if ACPI_APPLICATION is not set.
0304  */
0305 #ifndef DEBUGGER_THREADING
0306 #if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP)
0307 #define DEBUGGER_THREADING          DEBUGGER_MULTI_THREADED
0308 
0309 #else
0310 #define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
0311 #endif
0312 #endif              /* !DEBUGGER_THREADING */
0313 
0314 /******************************************************************************
0315  *
0316  * C library configuration
0317  *
0318  *****************************************************************************/
0319 
0320 /*
0321  * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
0322  *      Otherwise, local versions of string/memory functions will be used.
0323  * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
0324  *      the standard header files may be used. Defining this implies that
0325  *      ACPI_USE_SYSTEM_CLIBRARY has been defined.
0326  *
0327  * The ACPICA subsystem only uses low level C library functions that do not
0328  * call operating system services and may therefore be inlined in the code.
0329  *
0330  * It may be necessary to tailor these include files to the target
0331  * generation environment.
0332  */
0333 
0334 /* Use the standard C library headers. We want to keep these to a minimum. */
0335 
0336 #ifdef ACPI_USE_STANDARD_HEADERS
0337 
0338 /* Use the standard headers from the standard locations */
0339 
0340 #include <stdlib.h>
0341 #include <string.h>
0342 #include <ctype.h>
0343 #if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)
0344 #include <stdio.h>
0345 #include <fcntl.h>
0346 #include <errno.h>
0347 #include <time.h>
0348 #include <signal.h>
0349 #endif
0350 
0351 #endif              /* ACPI_USE_STANDARD_HEADERS */
0352 
0353 #ifdef ACPI_APPLICATION
0354 #define ACPI_FILE              FILE *
0355 #define ACPI_FILE_OUT          stdout
0356 #define ACPI_FILE_ERR          stderr
0357 #else
0358 #define ACPI_FILE              void *
0359 #define ACPI_FILE_OUT          NULL
0360 #define ACPI_FILE_ERR          NULL
0361 #endif              /* ACPI_APPLICATION */
0362 
0363 #ifndef ACPI_INIT_FUNCTION
0364 #define ACPI_INIT_FUNCTION
0365 #endif
0366 
0367 #endif              /* __ACENV_H__ */