Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:41

0001 /******************************************************************************
0002  *
0003  * Name: acenv.h - Host and compiler configuration
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights. You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code. No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision. In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change. Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee. Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution. In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government. In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************
0115  *
0116  * Alternatively, you may choose to be licensed under the terms of the
0117  * following license:
0118  *
0119  * Redistribution and use in source and binary forms, with or without
0120  * modification, are permitted provided that the following conditions
0121  * are met:
0122  * 1. Redistributions of source code must retain the above copyright
0123  *    notice, this list of conditions, and the following disclaimer,
0124  *    without modification.
0125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0126  *    substantially similar to the "NO WARRANTY" disclaimer below
0127  *    ("Disclaimer") and any redistribution must be conditioned upon
0128  *    including a substantially similar Disclaimer requirement for further
0129  *    binary redistribution.
0130  * 3. Neither the names of the above-listed copyright holders nor the names
0131  *    of any contributors may be used to endorse or promote products derived
0132  *    from this software without specific prior written permission.
0133  *
0134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0145  *
0146  * Alternatively, you may choose to be licensed under the terms of the
0147  * GNU General Public License ("GPL") version 2 as published by the Free
0148  * Software Foundation.
0149  *
0150  *****************************************************************************/
0151 
0152 #ifndef __ACENV_H__
0153 #define __ACENV_H__
0154 
0155 /*
0156  * Environment configuration. The purpose of this file is to interface ACPICA
0157  * to the local environment. This includes compiler-specific, OS-specific,
0158  * and machine-specific configuration.
0159  */
0160 
0161 /* Types for ACPI_MUTEX_TYPE */
0162 
0163 #define ACPI_BINARY_SEMAPHORE       0
0164 #define ACPI_OSL_MUTEX              1
0165 
0166 /* Types for DEBUGGER_THREADING */
0167 
0168 #define DEBUGGER_SINGLE_THREADED    0
0169 #define DEBUGGER_MULTI_THREADED     1
0170 
0171 
0172 /******************************************************************************
0173  *
0174  * Configuration for ACPI tools and utilities
0175  *
0176  *****************************************************************************/
0177 
0178 /* Common application configuration. All single threaded except for AcpiExec. */
0179 
0180 #if (defined ACPI_ASL_COMPILER) || \
0181     (defined ACPI_BIN_APP)      || \
0182     (defined ACPI_DUMP_APP)     || \
0183     (defined ACPI_HELP_APP)     || \
0184     (defined ACPI_NAMES_APP)    || \
0185     (defined ACPI_SRC_APP)      || \
0186     (defined ACPI_XTRACT_APP)   || \
0187     (defined ACPI_EXAMPLE_APP)  || \
0188     (defined ACPI_EFI_HELLO)
0189 #define ACPI_APPLICATION
0190 #define ACPI_SINGLE_THREADED
0191 #define USE_NATIVE_ALLOCATE_ZEROED
0192 #endif
0193 
0194 /* iASL configuration */
0195 
0196 #ifdef ACPI_ASL_COMPILER
0197 #define ACPI_DEBUG_OUTPUT
0198 #define ACPI_CONSTANT_EVAL_ONLY
0199 #define ACPI_LARGE_NAMESPACE_NODE
0200 #define ACPI_DATA_TABLE_DISASSEMBLY
0201 #define ACPI_32BIT_PHYSICAL_ADDRESS
0202 #define ACPI_DISASSEMBLER 1
0203 #endif
0204 
0205 /* AcpiExec configuration. Multithreaded with full AML debugger */
0206 
0207 #ifdef ACPI_EXEC_APP
0208 #define ACPI_APPLICATION
0209 #define ACPI_FULL_DEBUG
0210 #define ACPI_MUTEX_DEBUG
0211 #define ACPI_DBG_TRACK_ALLOCATIONS
0212 #endif
0213 
0214 /* AcpiHelp configuration. Error messages disabled. */
0215 
0216 #ifdef ACPI_HELP_APP
0217 #define ACPI_NO_ERROR_MESSAGES
0218 #endif
0219 
0220 /* AcpiNames configuration. Debug output enabled. */
0221 
0222 #ifdef ACPI_NAMES_APP
0223 #define ACPI_DEBUG_OUTPUT
0224 #endif
0225 
0226 /* AcpiExec/AcpiNames/Example configuration. Native RSDP used. */
0227 
0228 #if (defined ACPI_EXEC_APP)     || \
0229     (defined ACPI_EXAMPLE_APP)  || \
0230     (defined ACPI_NAMES_APP)
0231 #define ACPI_USE_NATIVE_RSDP_POINTER
0232 #endif
0233 
0234 /* AcpiDump configuration. Native mapping used if provided by the host */
0235 
0236 #ifdef ACPI_DUMP_APP
0237 #define ACPI_USE_NATIVE_MEMORY_MAPPING
0238 #endif
0239 
0240 /* AcpiNames/Example configuration. Hardware disabled */
0241 
0242 #if (defined ACPI_EXAMPLE_APP)  || \
0243     (defined ACPI_NAMES_APP)
0244 #define ACPI_REDUCED_HARDWARE 1
0245 #endif
0246 
0247 /* Linkable ACPICA library. Two versions, one with full debug. */
0248 
0249 #ifdef ACPI_LIBRARY
0250 #define ACPI_USE_LOCAL_CACHE
0251 #define ACPI_DEBUGGER 1
0252 #define ACPI_DISASSEMBLER 1
0253 
0254 #ifdef _DEBUG
0255 #define ACPI_DEBUG_OUTPUT
0256 #endif
0257 #endif
0258 
0259 /* Common for all ACPICA applications */
0260 
0261 #ifdef ACPI_APPLICATION
0262 #define ACPI_USE_LOCAL_CACHE
0263 #endif
0264 
0265 /* Common debug/disassembler support */
0266 
0267 #ifdef ACPI_FULL_DEBUG
0268 #define ACPI_DEBUG_OUTPUT
0269 #define ACPI_DEBUGGER 1
0270 #define ACPI_DISASSEMBLER 1
0271 #endif
0272 
0273 /*
0274  * acpisrc CR\LF support
0275  * Unix file line endings do not include the carriage return.
0276  * If the acpisrc utility is being built using a microsoft compiler, it means
0277  * that it will be running on a windows machine which means that the output is
0278  * expected to have CR/LF newlines. If the acpisrc utility is built with
0279  * anything else, it will likely run on a system with LF newlines. This flag
0280  * tells the acpisrc utility that newlines will be in the LF format.
0281  */
0282 #if defined(ACPI_SRC_APP) && !defined(_MSC_VER)
0283 #define ACPI_SRC_OS_LF_ONLY 1
0284 #else
0285 #define ACPI_SRC_OS_LF_ONLY 0
0286 #endif
0287 
0288 /*! [Begin] no source code translation */
0289 
0290 /******************************************************************************
0291  *
0292  * Host configuration files. The compiler configuration files are included
0293  * first.
0294  *
0295  *****************************************************************************/
0296 
0297 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
0298 #include "acgcc.h"
0299 
0300 #elif defined(_MSC_VER)
0301 #include "acmsvc.h"
0302 
0303 #elif defined(__INTEL_COMPILER)
0304 #include "acintel.h"
0305 
0306 #endif
0307 
0308 #if defined(_LINUX) || defined(__linux__)
0309 #include "aclinux.h"
0310 
0311 #elif defined(_APPLE) || defined(__APPLE__)
0312 #include "acmacosx.h"
0313 
0314 #elif defined(__DragonFly__)
0315 #include "acdragonfly.h"
0316 
0317 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
0318 #include "acfreebsd.h"
0319 
0320 #elif defined(__NetBSD__)
0321 #include "acnetbsd.h"
0322 
0323 #elif defined(__sun)
0324 #include "acsolaris.h"
0325 
0326 #elif defined(MODESTO)
0327 #include "acmodesto.h"
0328 
0329 #elif defined(NETWARE)
0330 #include "acnetware.h"
0331 
0332 #elif defined(_CYGWIN)
0333 #include "accygwin.h"
0334 
0335 #elif defined(WIN32)
0336 #include "acwin.h"
0337 
0338 #elif defined(WIN64)
0339 #include "acwin64.h"
0340 
0341 #elif defined(_WRS_LIB_BUILD)
0342 #include "acvxworks.h"
0343 
0344 #elif defined(__OS2__)
0345 #include "acos2.h"
0346 
0347 #elif defined(__HAIKU__)
0348 #include "achaiku.h"
0349 
0350 #elif defined(__QNX__)
0351 #include "acqnx.h"
0352 
0353 /*
0354  * EFI applications can be built with -nostdlib, in this case, it must be
0355  * included after including all other host environmental definitions, in
0356  * order to override the definitions.
0357  */
0358 #elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)
0359 #include "acefi.h"
0360 
0361 #elif defined(__ZEPHYR__)
0362 #include "aczephyr.h"
0363 
0364 #elif defined(__rtems__)
0365 #include <acpi/acpica/platform/acrtems.h>
0366 #else
0367 
0368 /* Unknown environment */
0369 
0370 #error Unknown target environment
0371 #endif
0372 
0373 /*! [End] no source code translation !*/
0374 
0375 
0376 /******************************************************************************
0377  *
0378  * Setup defaults for the required symbols that were not defined in one of
0379  * the host/compiler files above.
0380  *
0381  *****************************************************************************/
0382 
0383 /* 64-bit data types */
0384 
0385 #ifndef COMPILER_DEPENDENT_INT64
0386 #define COMPILER_DEPENDENT_INT64   long long
0387 #endif
0388 
0389 #ifndef COMPILER_DEPENDENT_UINT64
0390 #define COMPILER_DEPENDENT_UINT64  unsigned long long
0391 #endif
0392 
0393 /* Type of mutex supported by host. Default is binary semaphores. */
0394 
0395 #ifndef ACPI_MUTEX_TYPE
0396 #define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
0397 #endif
0398 
0399 /* Global Lock acquire/release */
0400 
0401 #ifndef ACPI_ACQUIRE_GLOBAL_LOCK
0402 #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = 1
0403 #endif
0404 
0405 #ifndef ACPI_RELEASE_GLOBAL_LOCK
0406 #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 0
0407 #endif
0408 
0409 /* NULL/invalid value to use for destroyed or not-yet-created semaphores. */
0410 
0411 #ifndef ACPI_SEMAPHORE_NULL
0412 #define ACPI_SEMAPHORE_NULL NULL
0413 #endif
0414 
0415 /* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
0416 
0417 #ifndef ACPI_FLUSH_CPU_CACHE
0418 #define ACPI_FLUSH_CPU_CACHE()
0419 #endif
0420 
0421 /* "inline" keywords - configurable since inline is not standardized */
0422 
0423 #ifndef ACPI_INLINE
0424 #define ACPI_INLINE
0425 #endif
0426 
0427 /* Use ordered initialization if compiler doesn't support designated. */
0428 #ifndef ACPI_STRUCT_INIT
0429 #define ACPI_STRUCT_INIT(field, value)  value
0430 #endif
0431 
0432 /*
0433  * Configurable calling conventions:
0434  *
0435  * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
0436  * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
0437  * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
0438  * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
0439  */
0440 #ifndef ACPI_SYSTEM_XFACE
0441 #define ACPI_SYSTEM_XFACE
0442 #endif
0443 
0444 #ifndef ACPI_EXTERNAL_XFACE
0445 #define ACPI_EXTERNAL_XFACE
0446 #endif
0447 
0448 #ifndef ACPI_INTERNAL_XFACE
0449 #define ACPI_INTERNAL_XFACE
0450 #endif
0451 
0452 #ifndef ACPI_INTERNAL_VAR_XFACE
0453 #define ACPI_INTERNAL_VAR_XFACE
0454 #endif
0455 
0456 
0457 /*
0458  * Debugger threading model
0459  * Use single threaded if the entire subsystem is contained in an application
0460  * Use multiple threaded when the subsystem is running in the kernel.
0461  *
0462  * By default the model is single threaded if ACPI_APPLICATION is set,
0463  * multi-threaded if ACPI_APPLICATION is not set.
0464  */
0465 #ifndef DEBUGGER_THREADING
0466 #if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP)
0467 #define DEBUGGER_THREADING          DEBUGGER_MULTI_THREADED
0468 
0469 #else
0470 #define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
0471 #endif
0472 #endif /* !DEBUGGER_THREADING */
0473 
0474 
0475 /******************************************************************************
0476  *
0477  * C library configuration
0478  *
0479  *****************************************************************************/
0480 
0481 /*
0482  * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
0483  *      Otherwise, local versions of string/memory functions will be used.
0484  * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
0485  *      the standard header files may be used. Defining this implies that
0486  *      ACPI_USE_SYSTEM_CLIBRARY has been defined.
0487  *
0488  * The ACPICA subsystem only uses low level C library functions that do not
0489  * call operating system services and may therefore be inlined in the code.
0490  *
0491  * It may be necessary to tailor these include files to the target
0492  * generation environment.
0493  */
0494 
0495 /* Use the standard C library headers. We want to keep these to a minimum. */
0496 
0497 #ifdef ACPI_USE_STANDARD_HEADERS
0498 
0499 /* Use the standard headers from the standard locations */
0500 
0501 #include <stdlib.h>
0502 #include <string.h>
0503 #include <ctype.h>
0504 #if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)
0505 #include <stdio.h>
0506 #include <fcntl.h>
0507 #include <errno.h>
0508 #include <time.h>
0509 #include <signal.h>
0510 #endif
0511 
0512 #endif /* ACPI_USE_STANDARD_HEADERS */
0513 
0514 #ifdef ACPI_APPLICATION
0515 #define ACPI_FILE              FILE *
0516 #define ACPI_FILE_OUT          stdout
0517 #define ACPI_FILE_ERR          stderr
0518 #else
0519 #define ACPI_FILE              void *
0520 #define ACPI_FILE_OUT          NULL
0521 #define ACPI_FILE_ERR          NULL
0522 #endif /* ACPI_APPLICATION */
0523 
0524 #ifndef ACPI_INIT_FUNCTION
0525 #define ACPI_INIT_FUNCTION
0526 #endif
0527 
0528 #endif /* __ACENV_H__ */