diff options
Diffstat (limited to 'include/acpi/platform/acenv.h')
| -rw-r--r-- | include/acpi/platform/acenv.h | 415 |
1 files changed, 228 insertions, 187 deletions
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index adf969efa51..e863dd5c4e0 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h @@ -1,11 +1,11 @@ /****************************************************************************** * - * Name: acenv.h - Generation environment specific items + * Name: acenv.h - Host and compiler configuration * *****************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2014, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,139 +44,226 @@ #ifndef __ACENV_H__ #define __ACENV_H__ - /* - * Configuration for ACPI tools and utilities + * Environment configuration. The purpose of this file is to interface ACPICA + * to the local environment. This includes compiler-specific, OS-specific, + * and machine-specific configuration. */ -#ifdef _ACPI_DUMP_APP -#ifndef MSDOS -#define ACPI_DEBUG_OUTPUT -#endif +/* Types for ACPI_MUTEX_TYPE */ + +#define ACPI_BINARY_SEMAPHORE 0 +#define ACPI_OSL_MUTEX 1 + +/* Types for DEBUGGER_THREADING */ + +#define DEBUGGER_SINGLE_THREADED 0 +#define DEBUGGER_MULTI_THREADED 1 + +/****************************************************************************** + * + * Configuration for ACPI tools and utilities + * + *****************************************************************************/ + +/* iASL configuration */ + +#ifdef ACPI_ASL_COMPILER #define ACPI_APPLICATION #define ACPI_DISASSEMBLER -#define ACPI_NO_METHOD_EXECUTION -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE +#define ACPI_DEBUG_OUTPUT +#define ACPI_CONSTANT_EVAL_ONLY +#define ACPI_LARGE_NAMESPACE_NODE +#define ACPI_DATA_TABLE_DISASSEMBLY +#define ACPI_SINGLE_THREADED #endif -#ifdef _ACPI_EXEC_APP -#undef DEBUGGER_THREADING -#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED -#define ACPI_DEBUG_OUTPUT +/* acpi_exec configuration. Multithreaded with full AML debugger */ + +#ifdef ACPI_EXEC_APP #define ACPI_APPLICATION -#define ACPI_DEBUGGER -#define ACPI_DISASSEMBLER -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE +#define ACPI_FULL_DEBUG +#define ACPI_MUTEX_DEBUG +#define ACPI_DBG_TRACK_ALLOCATIONS #endif -#ifdef _ACPI_ASL_COMPILER -#define ACPI_DEBUG_OUTPUT +/* acpi_names configuration. Single threaded with debugger output enabled. */ + +#ifdef ACPI_NAMES_APP +#define ACPI_DEBUGGER #define ACPI_APPLICATION -#define ACPI_DISASSEMBLER -#define ACPI_CONSTANT_EVAL_ONLY -#define ACPI_USE_SYSTEM_CLIBRARY -#define ACPI_ENABLE_OBJECT_CACHE +#define ACPI_SINGLE_THREADED #endif /* - * Environment configuration. The purpose of this file is to interface to the - * local generation environment. - * - * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. - * Otherwise, local versions of string/memory functions will be used. - * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and - * the standard header files may be used. - * - * The ACPI subsystem only uses low level C library functions that do not call - * operating system services and may therefore be inlined in the code. - * - * It may be necessary to tailor these include files to the target - * generation environment. - * - * - * Functions and constants used from each header: - * - * string.h: memcpy - * memset - * strcat - * strcmp - * strcpy - * strlen - * strncmp - * strncat - * strncpy - * - * stdlib.h: strtoul - * - * stdarg.h: va_list - * va_arg - * va_start - * va_end - * + * acpi_bin/acpi_dump/acpi_src/acpi_xtract/Example configuration. All single + * threaded, with no debug output. */ +#if (defined ACPI_BIN_APP) || \ + (defined ACPI_DUMP_APP) || \ + (defined ACPI_SRC_APP) || \ + (defined ACPI_XTRACT_APP) || \ + (defined ACPI_EXAMPLE_APP) +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#endif -/*! [Begin] no source code translation */ +#ifdef ACPI_HELP_APP +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#define ACPI_NO_ERROR_MESSAGES +#endif -#if defined(__linux__) -#include "aclinux.h" +/* Linkable ACPICA library */ -#elif defined(_AED_EFI) -#include "acefi.h" +#ifdef ACPI_LIBRARY +#define ACPI_USE_LOCAL_CACHE +#define ACPI_FUTURE_USAGE +#endif -#elif defined(WIN32) -#include "acwin.h" +/* Common for all ACPICA applications */ -#elif defined(WIN64) -#include "acwin64.h" +#ifdef ACPI_APPLICATION +#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_LOCAL_CACHE +#endif + +/* Common debug support */ + +#ifdef ACPI_FULL_DEBUG +#define ACPI_DEBUGGER +#define ACPI_DEBUG_OUTPUT +#define ACPI_DISASSEMBLER +#endif + + +/*! [Begin] no source code translation */ + +/****************************************************************************** + * + * Host configuration files. The compiler configuration files are included + * by the host files. + * + *****************************************************************************/ + +#if defined(_LINUX) || defined(__linux__) +#include <acpi/platform/aclinux.h> -#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ -#include "acdos16.h" +#elif defined(_APPLE) || defined(__APPLE__) +#include "acmacosx.h" -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include "acfreebsd.h" #elif defined(__NetBSD__) #include "acnetbsd.h" +#elif defined(__sun) +#include "acsolaris.h" + #elif defined(MODESTO) #include "acmodesto.h" #elif defined(NETWARE) #include "acnetware.h" +#elif defined(_CYGWIN) +#include "accygwin.h" + +#elif defined(WIN32) +#include "acwin.h" + +#elif defined(WIN64) +#include "acwin64.h" + +#elif defined(_WRS_LIB_BUILD) +#include "acvxworks.h" + +#elif defined(__OS2__) +#include "acos2.h" + +#elif defined(_AED_EFI) +#include "acefi.h" + +#elif defined(__HAIKU__) +#include "achaiku.h" + #else -/* All other environments */ +/* Unknown environment */ + +#error Unknown target environment +#endif + +/*! [End] no source code translation !*/ + +/****************************************************************************** + * + * Setup defaults for the required symbols that were not defined in one of + * the host/compiler files above. + * + *****************************************************************************/ -#define ACPI_USE_STANDARD_HEADERS +/* 64-bit data types */ +#ifndef COMPILER_DEPENDENT_INT64 #define COMPILER_DEPENDENT_INT64 long long +#endif + +#ifndef COMPILER_DEPENDENT_UINT64 #define COMPILER_DEPENDENT_UINT64 unsigned long long +#endif -/* - * This macro is used to tag functions as "printf-like" because - * some compilers can catch printf format string problems. MSVC - * doesn't, so this is proprocessed away. - */ -#define ACPI_PRINTF_LIKE_FUNC +/* Type of mutex supported by host. Default is binary semaphores. */ +#ifndef ACPI_MUTEX_TYPE +#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE +#endif + +/* Global Lock acquire/release */ + +#ifndef ACPI_ACQUIRE_GLOBAL_LOCK +#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acquired) acquired = 1 +#endif +#ifndef ACPI_RELEASE_GLOBAL_LOCK +#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0 +#endif + +/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */ + +#ifndef ACPI_FLUSH_CPU_CACHE +#define ACPI_FLUSH_CPU_CACHE() +#endif + +/* "inline" keywords - configurable since inline is not standardized */ + +#ifndef ACPI_INLINE +#define ACPI_INLINE #endif /* - * Memory allocation tracking. Used only if - * 1) This is the debug version - * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) + * Configurable calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces */ -#ifdef ACPI_DEBUG_OUTPUT -#if ACPI_MACHINE_WIDTH != 16 -#define ACPI_DBG_TRACK_ALLOCATIONS +#ifndef ACPI_SYSTEM_XFACE +#define ACPI_SYSTEM_XFACE #endif + +#ifndef ACPI_EXTERNAL_XFACE +#define ACPI_EXTERNAL_XFACE #endif -/*! [End] no source code translation !*/ +#ifndef ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#endif +#ifndef ACPI_INTERNAL_VAR_XFACE +#define ACPI_INTERNAL_VAR_XFACE +#endif /* * Debugger threading model @@ -186,9 +273,6 @@ * By default the model is single threaded if ACPI_APPLICATION is set, * multi-threaded if ACPI_APPLICATION is not set. */ -#define DEBUGGER_SINGLE_THREADED 0 -#define DEBUGGER_MULTI_THREADED 1 - #ifndef DEBUGGER_THREADING #ifdef ACPI_APPLICATION #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED @@ -196,8 +280,7 @@ #else #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED #endif -#endif /* !DEBUGGER_THREADING */ - +#endif /* !DEBUGGER_THREADING */ /****************************************************************************** * @@ -205,25 +288,35 @@ * *****************************************************************************/ -#ifdef ACPI_USE_SYSTEM_CLIBRARY /* - * Use the standard C library headers. - * We want to keep these to a minimum. + * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. + * Otherwise, local versions of string/memory functions will be used. + * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and + * the standard header files may be used. + * + * The ACPICA subsystem only uses low level C library functions that do not call + * operating system services and may therefore be inlined in the code. + * + * It may be necessary to tailor these include files to the target + * generation environment. */ +#ifdef ACPI_USE_SYSTEM_CLIBRARY + +/* Use the standard C library headers. We want to keep these to a minimum. */ + #ifdef ACPI_USE_STANDARD_HEADERS -/* - * Use the standard headers from the standard locations - */ + +/* Use the standard headers from the standard locations */ + #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <ctype.h> -#endif /* ACPI_USE_STANDARD_HEADERS */ +#endif /* ACPI_USE_STANDARD_HEADERS */ + +/* We will be linking to the standard Clib functions */ -/* - * We will be linking to the standard Clib functions - */ #define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) #define ACPI_STRCHR(s1,c) strchr((s1), (c)) #define ACPI_STRLEN(s) (acpi_size) strlen((s)) @@ -234,19 +327,18 @@ #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) -#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) -#define ACPI_TOUPPER toupper -#define ACPI_TOLOWER tolower -#define ACPI_IS_XDIGIT isxdigit -#define ACPI_IS_DIGIT isdigit -#define ACPI_IS_SPACE isspace -#define ACPI_IS_UPPER isupper -#define ACPI_IS_PRINT isprint -#define ACPI_IS_ALPHA isalpha -#define ACPI_IS_ASCII isascii +#define ACPI_TOUPPER(i) toupper((int) (i)) +#define ACPI_TOLOWER(i) tolower((int) (i)) +#define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) +#define ACPI_IS_DIGIT(i) isdigit((int) (i)) +#define ACPI_IS_SPACE(i) isspace((int) (i)) +#define ACPI_IS_UPPER(i) isupper((int) (i)) +#define ACPI_IS_PRINT(i) isprint((int) (i)) +#define ACPI_IS_ALPHA(i) isalpha((int) (i)) #else @@ -256,36 +348,34 @@ * *****************************************************************************/ - /* - * Use local definitions of C library macros and functions - * NOTE: The function implementations may not be as efficient - * as an inline or assembly code implementation provided by a - * native C library. +/* + * Use local definitions of C library macros and functions. These function + * implementations may not be as efficient as an inline or assembly code + * implementation provided by a native C library, but they are functionally + * equivalent. */ - #ifndef va_arg #ifndef _VALIST #define _VALIST typedef char *va_list; -#endif /* _VALIST */ +#endif /* _VALIST */ + +/* Storage alignment properties */ -/* - * Storage alignment properties - */ #define _AUPBND (sizeof (acpi_native_int) - 1) #define _ADNBND (sizeof (acpi_native_int) - 1) -/* - * Variable argument list macro definitions - */ +/* Variable argument list macro definitions */ + #define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) #define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND)))) -#define va_end(ap) (void) 0 +#define va_end(ap) (ap = (va_list) NULL) #define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND)))) -#endif /* va_arg */ +#endif /* va_arg */ +/* Use the local (ACPICA) definitions of the clib functions */ #define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) #define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) @@ -297,70 +387,21 @@ typedef char *va_list; #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) -#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n)) +#define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) -#define ACPI_TOUPPER acpi_ut_to_upper -#define ACPI_TOLOWER acpi_ut_to_lower - -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ - - -/****************************************************************************** - * - * Assembly code macros - * - *****************************************************************************/ - -/* - * Handle platform- and compiler-specific assembly language differences. - * These should already have been defined by the platform includes above. - * - * Notes: - * 1) Interrupt 3 is used to break into a debugger - * 2) Interrupts are turned off during ACPI register setup - */ - -/* Unrecognized compiler, use defaults */ - -#ifndef ACPI_ASM_MACROS - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE - -#define ACPI_ASM_MACROS -#define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() -#define ACPI_ENABLE_IRQS() -#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq) -#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq) - -#endif /* ACPI_ASM_MACROS */ +#define ACPI_TOUPPER(c) acpi_ut_to_upper ((int) (c)) +#define ACPI_TOLOWER(c) acpi_ut_to_lower ((int) (c)) +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ +#ifndef ACPI_FILE #ifdef ACPI_APPLICATION +#include <stdio.h> +#define ACPI_FILE FILE * +#else +#define ACPI_FILE void * +#endif /* ACPI_APPLICATION */ +#endif /* ACPI_FILE */ -/* Don't want software interrupts within a ring3 application */ - -#undef BREAKPOINT3 -#define BREAKPOINT3 -#endif - - -/****************************************************************************** - * - * Compiler-specific information is contained in the compiler-specific - * headers. - * - *****************************************************************************/ -#endif /* __ACENV_H__ */ +#endif /* __ACENV_H__ */ |
