Path: blob/main/sys/contrib/dev/acpica/include/platform/acenv.h
48426 views
/******************************************************************************1*2* Name: acenv.h - Host and compiler configuration3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#ifndef __ACENV_H__152#define __ACENV_H__153154/*155* Environment configuration. The purpose of this file is to interface ACPICA156* to the local environment. This includes compiler-specific, OS-specific,157* and machine-specific configuration.158*/159160/* Types for ACPI_MUTEX_TYPE */161162#define ACPI_BINARY_SEMAPHORE 0163#define ACPI_OSL_MUTEX 1164165/* Types for DEBUGGER_THREADING */166167#define DEBUGGER_SINGLE_THREADED 0168#define DEBUGGER_MULTI_THREADED 1169170171/******************************************************************************172*173* Configuration for ACPI tools and utilities174*175*****************************************************************************/176177/* Common application configuration. All single threaded except for AcpiExec. */178179#if (defined ACPI_ASL_COMPILER) || \180(defined ACPI_BIN_APP) || \181(defined ACPI_DUMP_APP) || \182(defined ACPI_HELP_APP) || \183(defined ACPI_NAMES_APP) || \184(defined ACPI_SRC_APP) || \185(defined ACPI_XTRACT_APP) || \186(defined ACPI_EXAMPLE_APP) || \187(defined ACPI_EFI_HELLO)188#define ACPI_APPLICATION189#define ACPI_SINGLE_THREADED190#define USE_NATIVE_ALLOCATE_ZEROED191#endif192193/* iASL configuration */194195#ifdef ACPI_ASL_COMPILER196#define ACPI_DEBUG_OUTPUT197#define ACPI_CONSTANT_EVAL_ONLY198#define ACPI_LARGE_NAMESPACE_NODE199#define ACPI_DATA_TABLE_DISASSEMBLY200#define ACPI_32BIT_PHYSICAL_ADDRESS201#define ACPI_DISASSEMBLER 1202#endif203204/* AcpiExec configuration. Multithreaded with full AML debugger */205206#ifdef ACPI_EXEC_APP207#define ACPI_APPLICATION208#define ACPI_FULL_DEBUG209#define ACPI_MUTEX_DEBUG210#define ACPI_DBG_TRACK_ALLOCATIONS211#endif212213/* AcpiHelp configuration. Error messages disabled. */214215#ifdef ACPI_HELP_APP216#define ACPI_NO_ERROR_MESSAGES217#endif218219/* AcpiNames configuration. Debug output enabled. */220221#ifdef ACPI_NAMES_APP222#define ACPI_DEBUG_OUTPUT223#endif224225/* AcpiExec/AcpiNames/Example configuration. Native RSDP used. */226227#if (defined ACPI_EXEC_APP) || \228(defined ACPI_EXAMPLE_APP) || \229(defined ACPI_NAMES_APP)230#define ACPI_USE_NATIVE_RSDP_POINTER231#endif232233/* AcpiDump configuration. Native mapping used if provided by the host */234235#ifdef ACPI_DUMP_APP236#define ACPI_USE_NATIVE_MEMORY_MAPPING237#endif238239/* AcpiNames/Example configuration. Hardware disabled */240241#if (defined ACPI_EXAMPLE_APP) || \242(defined ACPI_NAMES_APP)243#define ACPI_REDUCED_HARDWARE 1244#endif245246/* Linkable ACPICA library. Two versions, one with full debug. */247248#ifdef ACPI_LIBRARY249#define ACPI_USE_LOCAL_CACHE250#define ACPI_DEBUGGER 1251#define ACPI_DISASSEMBLER 1252253#ifdef _DEBUG254#define ACPI_DEBUG_OUTPUT255#endif256#endif257258/* Common for all ACPICA applications */259260#ifdef ACPI_APPLICATION261#define ACPI_USE_LOCAL_CACHE262#endif263264/* Common debug/disassembler support */265266#ifdef ACPI_FULL_DEBUG267#define ACPI_DEBUG_OUTPUT268#define ACPI_DEBUGGER 1269#define ACPI_DISASSEMBLER 1270#endif271272/*273* acpisrc CR\LF support274* Unix file line endings do not include the carriage return.275* If the acpisrc utility is being built using a microsoft compiler, it means276* that it will be running on a windows machine which means that the output is277* expected to have CR/LF newlines. If the acpisrc utility is built with278* anything else, it will likely run on a system with LF newlines. This flag279* tells the acpisrc utility that newlines will be in the LF format.280*/281#if defined(ACPI_SRC_APP) && !defined(_MSC_VER)282#define ACPI_SRC_OS_LF_ONLY 1283#else284#define ACPI_SRC_OS_LF_ONLY 0285#endif286287/*! [Begin] no source code translation */288289/******************************************************************************290*291* Host configuration files. The compiler configuration files are included292* first.293*294*****************************************************************************/295296#if defined(__GNUC__) && !defined(__INTEL_COMPILER)297#include <contrib/dev/acpica/include/platform/acgcc.h>298299#elif defined(_MSC_VER)300#include "acmsvc.h"301302#elif defined(__INTEL_COMPILER)303#include "acintel.h"304305#endif306307#if defined(_LINUX) || defined(__linux__)308#include "aclinux.h"309310#elif defined(_APPLE) || defined(__APPLE__)311#include "acmacosx.h"312313#elif defined(__DragonFly__)314#include "acdragonfly.h"315316#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)317#include <contrib/dev/acpica/include/platform/acfreebsd.h>318319#elif defined(__NetBSD__)320#include "acnetbsd.h"321322#elif defined(__sun)323#include "acsolaris.h"324325#elif defined(MODESTO)326#include "acmodesto.h"327328#elif defined(NETWARE)329#include "acnetware.h"330331#elif defined(_CYGWIN)332#include "accygwin.h"333334#elif defined(WIN32)335#include "acwin.h"336337#elif defined(WIN64)338#include "acwin64.h"339340#elif defined(_WRS_LIB_BUILD)341#include "acvxworks.h"342343#elif defined(__OS2__)344#include "acos2.h"345346#elif defined(__HAIKU__)347#include "achaiku.h"348349#elif defined(__QNX__)350#include "acqnx.h"351352/*353* EFI applications can be built with -nostdlib, in this case, it must be354* included after including all other host environmental definitions, in355* order to override the definitions.356*/357#elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)358#include "acefi.h"359360#elif defined(__ZEPHYR__)361#include "aczephyr.h"362#else363364/* Unknown environment */365366#error Unknown target environment367#endif368369/*! [End] no source code translation !*/370371372/******************************************************************************373*374* Setup defaults for the required symbols that were not defined in one of375* the host/compiler files above.376*377*****************************************************************************/378379/* 64-bit data types */380381#ifndef COMPILER_DEPENDENT_INT64382#define COMPILER_DEPENDENT_INT64 long long383#endif384385#ifndef COMPILER_DEPENDENT_UINT64386#define COMPILER_DEPENDENT_UINT64 unsigned long long387#endif388389/* Type of mutex supported by host. Default is binary semaphores. */390391#ifndef ACPI_MUTEX_TYPE392#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE393#endif394395/* Global Lock acquire/release */396397#ifndef ACPI_ACQUIRE_GLOBAL_LOCK398#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = 1399#endif400401#ifndef ACPI_RELEASE_GLOBAL_LOCK402#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 0403#endif404405/* NULL/invalid value to use for destroyed or not-yet-created semaphores. */406407#ifndef ACPI_SEMAPHORE_NULL408#define ACPI_SEMAPHORE_NULL NULL409#endif410411/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */412413#ifndef ACPI_FLUSH_CPU_CACHE414#define ACPI_FLUSH_CPU_CACHE()415#endif416417/* "inline" keywords - configurable since inline is not standardized */418419#ifndef ACPI_INLINE420#define ACPI_INLINE421#endif422423/* Use ordered initialization if compiler doesn't support designated. */424#ifndef ACPI_STRUCT_INIT425#define ACPI_STRUCT_INIT(field, value) value426#endif427428/*429* Configurable calling conventions:430*431* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)432* ACPI_EXTERNAL_XFACE - External ACPI interfaces433* ACPI_INTERNAL_XFACE - Internal ACPI interfaces434* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces435*/436#ifndef ACPI_SYSTEM_XFACE437#define ACPI_SYSTEM_XFACE438#endif439440#ifndef ACPI_EXTERNAL_XFACE441#define ACPI_EXTERNAL_XFACE442#endif443444#ifndef ACPI_INTERNAL_XFACE445#define ACPI_INTERNAL_XFACE446#endif447448#ifndef ACPI_INTERNAL_VAR_XFACE449#define ACPI_INTERNAL_VAR_XFACE450#endif451452453/*454* Debugger threading model455* Use single threaded if the entire subsystem is contained in an application456* Use multiple threaded when the subsystem is running in the kernel.457*458* By default the model is single threaded if ACPI_APPLICATION is set,459* multi-threaded if ACPI_APPLICATION is not set.460*/461#ifndef DEBUGGER_THREADING462#if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP)463#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED464465#else466#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED467#endif468#endif /* !DEBUGGER_THREADING */469470471/******************************************************************************472*473* C library configuration474*475*****************************************************************************/476477/*478* ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.479* Otherwise, local versions of string/memory functions will be used.480* ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and481* the standard header files may be used. Defining this implies that482* ACPI_USE_SYSTEM_CLIBRARY has been defined.483*484* The ACPICA subsystem only uses low level C library functions that do not485* call operating system services and may therefore be inlined in the code.486*487* It may be necessary to tailor these include files to the target488* generation environment.489*/490491/* Use the standard C library headers. We want to keep these to a minimum. */492493#ifdef ACPI_USE_STANDARD_HEADERS494495/* Use the standard headers from the standard locations */496497#include <stdlib.h>498#include <string.h>499#include <ctype.h>500#if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)501#include <stdio.h>502#include <fcntl.h>503#include <errno.h>504#include <time.h>505#include <signal.h>506#endif507508#endif /* ACPI_USE_STANDARD_HEADERS */509510#ifdef ACPI_APPLICATION511#define ACPI_FILE FILE *512#define ACPI_FILE_OUT stdout513#define ACPI_FILE_ERR stderr514#else515#define ACPI_FILE void *516#define ACPI_FILE_OUT NULL517#define ACPI_FILE_ERR NULL518#endif /* ACPI_APPLICATION */519520#ifndef ACPI_INIT_FUNCTION521#define ACPI_INIT_FUNCTION522#endif523524#endif /* __ACENV_H__ */525526527