/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */1/******************************************************************************2*3* Name: acenv.h - Host and compiler configuration4*5* Copyright (C) 2000 - 2025, Intel Corp.6*7*****************************************************************************/89#ifndef __ACENV_H__10#define __ACENV_H__1112/*13* Environment configuration. The purpose of this file is to interface ACPICA14* to the local environment. This includes compiler-specific, OS-specific,15* and machine-specific configuration.16*/1718/* Types for ACPI_MUTEX_TYPE */1920#define ACPI_BINARY_SEMAPHORE 021#define ACPI_OSL_MUTEX 12223/* Types for DEBUGGER_THREADING */2425#define DEBUGGER_SINGLE_THREADED 026#define DEBUGGER_MULTI_THREADED 12728/******************************************************************************29*30* Configuration for ACPI tools and utilities31*32*****************************************************************************/3334/* Common application configuration. All single threaded except for acpi_exec. */3536#if (defined ACPI_ASL_COMPILER) || \37(defined ACPI_BIN_APP) || \38(defined ACPI_DUMP_APP) || \39(defined ACPI_HELP_APP) || \40(defined ACPI_NAMES_APP) || \41(defined ACPI_SRC_APP) || \42(defined ACPI_XTRACT_APP) || \43(defined ACPI_EXAMPLE_APP) || \44(defined ACPI_EFI_HELLO)45#define ACPI_APPLICATION46#define ACPI_SINGLE_THREADED47#define USE_NATIVE_ALLOCATE_ZEROED48#endif4950/* iASL configuration */5152#ifdef ACPI_ASL_COMPILER53#define ACPI_DEBUG_OUTPUT54#define ACPI_CONSTANT_EVAL_ONLY55#define ACPI_LARGE_NAMESPACE_NODE56#define ACPI_DATA_TABLE_DISASSEMBLY57#define ACPI_32BIT_PHYSICAL_ADDRESS58#define ACPI_DISASSEMBLER 159#endif6061/* acpi_exec configuration. Multithreaded with full AML debugger */6263#ifdef ACPI_EXEC_APP64#define ACPI_APPLICATION65#define ACPI_FULL_DEBUG66#define ACPI_MUTEX_DEBUG67#define ACPI_DBG_TRACK_ALLOCATIONS68#endif6970/* acpi_help configuration. Error messages disabled. */7172#ifdef ACPI_HELP_APP73#define ACPI_NO_ERROR_MESSAGES74#endif7576/* acpi_names configuration. Debug output enabled. */7778#ifdef ACPI_NAMES_APP79#define ACPI_DEBUG_OUTPUT80#endif8182/* acpi_exec/acpi_names/Example configuration. Native RSDP used. */8384#if (defined ACPI_EXEC_APP) || \85(defined ACPI_EXAMPLE_APP) || \86(defined ACPI_NAMES_APP)87#define ACPI_USE_NATIVE_RSDP_POINTER88#endif8990/* acpi_dump configuration. Native mapping used if provided by the host */9192#ifdef ACPI_DUMP_APP93#define ACPI_USE_NATIVE_MEMORY_MAPPING94#endif9596/* acpi_names/Example configuration. Hardware disabled */9798#if (defined ACPI_EXAMPLE_APP) || \99(defined ACPI_NAMES_APP)100#define ACPI_REDUCED_HARDWARE 1101#endif102103/* Linkable ACPICA library. Two versions, one with full debug. */104105#ifdef ACPI_LIBRARY106#define ACPI_USE_LOCAL_CACHE107#define ACPI_DEBUGGER 1108#define ACPI_DISASSEMBLER 1109110#ifdef _DEBUG111#define ACPI_DEBUG_OUTPUT112#endif113#endif114115/* Common for all ACPICA applications */116117#ifdef ACPI_APPLICATION118#define ACPI_USE_LOCAL_CACHE119#endif120121/* Common debug/disassembler support */122123#ifdef ACPI_FULL_DEBUG124#define ACPI_DEBUG_OUTPUT125#define ACPI_DEBUGGER 1126#define ACPI_DISASSEMBLER 1127#endif128129130/*131* acpisrc CR\LF support132* Unix file line endings do not include the carriage return.133* If the acpisrc utility is being built using a microsoft compiler, it means134* that it will be running on a windows machine which means that the output is135* expected to have CR/LF newlines. If the acpisrc utility is built with136* anything else, it will likely run on a system with LF newlines. This flag137* tells the acpisrc utility that newlines will be in the LF format.138*/139#define ACPI_SRC_OS_LF_ONLY 0140141/*! [Begin] no source code translation */142143/******************************************************************************144*145* Host configuration files. The compiler configuration files are included146* first.147*148*****************************************************************************/149150#if defined(__GNUC__)151#include <acpi/platform/acgcc.h>152153#elif defined(_MSC_VER)154#include "acmsvc.h"155156#endif157158#if defined(_LINUX) || defined(__linux__)159#include <acpi/platform/aclinux.h>160161#elif defined(_APPLE) || defined(__APPLE__)162#include "acmacosx.h"163164#elif defined(__DragonFly__)165#include "acdragonfly.h"166167#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)168#include "acfreebsd.h"169170#elif defined(__NetBSD__)171#include "acnetbsd.h"172173#elif defined(__sun)174#include "acsolaris.h"175176#elif defined(MODESTO)177#include "acmodesto.h"178179#elif defined(NETWARE)180#include "acnetware.h"181182#elif defined(_CYGWIN)183#include "accygwin.h"184185#elif defined(WIN32)186#include "acwin.h"187188#elif defined(WIN64)189#include "acwin64.h"190191#elif defined(_WRS_LIB_BUILD)192#include "acvxworks.h"193194#elif defined(__OS2__)195#include "acos2.h"196197#elif defined(__HAIKU__)198#include "achaiku.h"199200#elif defined(__QNX__)201#include "acqnx.h"202203/*204* EFI applications can be built with -nostdlib, in this case, it must be205* included after including all other host environmental definitions, in206* order to override the definitions.207*/208#elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)209#include "acefi.h"210211#elif defined(__ZEPHYR__)212#include "aczephyr.h"213#else214215/* Unknown environment */216217#error Unknown target environment218#endif219220/*! [End] no source code translation !*/221222/******************************************************************************223*224* Setup defaults for the required symbols that were not defined in one of225* the host/compiler files above.226*227*****************************************************************************/228229/* 64-bit data types */230231#ifndef COMPILER_DEPENDENT_INT64232#define COMPILER_DEPENDENT_INT64 long long233#endif234235#ifndef COMPILER_DEPENDENT_UINT64236#define COMPILER_DEPENDENT_UINT64 unsigned long long237#endif238239/* Type of mutex supported by host. Default is binary semaphores. */240#ifndef ACPI_MUTEX_TYPE241#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE242#endif243244/* Global Lock acquire/release */245246#ifndef ACPI_ACQUIRE_GLOBAL_LOCK247#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acquired) acquired = 1248#endif249250#ifndef ACPI_RELEASE_GLOBAL_LOCK251#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0252#endif253254/* NULL/invalid value to use for destroyed or not-yet-created semaphores. */255256#ifndef ACPI_SEMAPHORE_NULL257#define ACPI_SEMAPHORE_NULL NULL258#endif259260/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */261262#ifndef ACPI_FLUSH_CPU_CACHE263#define ACPI_FLUSH_CPU_CACHE()264#endif265266/* "inline" keywords - configurable since inline is not standardized */267268#ifndef ACPI_INLINE269#define ACPI_INLINE270#endif271272/* Use ordered initialization if compiler doesn't support designated. */273#ifndef ACPI_STRUCT_INIT274#define ACPI_STRUCT_INIT(field, value) value275#endif276277/*278* Configurable calling conventions:279*280* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)281* ACPI_EXTERNAL_XFACE - External ACPI interfaces282* ACPI_INTERNAL_XFACE - Internal ACPI interfaces283* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces284*/285#ifndef ACPI_SYSTEM_XFACE286#define ACPI_SYSTEM_XFACE287#endif288289#ifndef ACPI_EXTERNAL_XFACE290#define ACPI_EXTERNAL_XFACE291#endif292293#ifndef ACPI_INTERNAL_XFACE294#define ACPI_INTERNAL_XFACE295#endif296297#ifndef ACPI_INTERNAL_VAR_XFACE298#define ACPI_INTERNAL_VAR_XFACE299#endif300301/*302* Debugger threading model303* Use single threaded if the entire subsystem is contained in an application304* Use multiple threaded when the subsystem is running in the kernel.305*306* By default the model is single threaded if ACPI_APPLICATION is set,307* multi-threaded if ACPI_APPLICATION is not set.308*/309#ifndef DEBUGGER_THREADING310#if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP)311#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED312313#else314#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED315#endif316#endif /* !DEBUGGER_THREADING */317318/******************************************************************************319*320* C library configuration321*322*****************************************************************************/323324/*325* ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.326* Otherwise, local versions of string/memory functions will be used.327* ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and328* the standard header files may be used. Defining this implies that329* ACPI_USE_SYSTEM_CLIBRARY has been defined.330*331* The ACPICA subsystem only uses low level C library functions that do not332* call operating system services and may therefore be inlined in the code.333*334* It may be necessary to tailor these include files to the target335* generation environment.336*/337338/* Use the standard C library headers. We want to keep these to a minimum. */339340#ifdef ACPI_USE_STANDARD_HEADERS341342/* Use the standard headers from the standard locations */343344#include <stdlib.h>345#include <string.h>346#include <ctype.h>347#if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)348#include <stdio.h>349#include <fcntl.h>350#include <errno.h>351#include <time.h>352#include <signal.h>353#endif354355#endif /* ACPI_USE_STANDARD_HEADERS */356357#ifdef ACPI_APPLICATION358#define ACPI_FILE FILE *359#define ACPI_FILE_OUT stdout360#define ACPI_FILE_ERR stderr361#else362#define ACPI_FILE void *363#define ACPI_FILE_OUT NULL364#define ACPI_FILE_ERR NULL365#endif /* ACPI_APPLICATION */366367#ifndef ACPI_INIT_FUNCTION368#define ACPI_INIT_FUNCTION369#endif370371#endif /* __ACENV_H__ */372373374