diff options
Diffstat (limited to 'include/acpi/platform/acenv.h')
| -rw-r--r-- | include/acpi/platform/acenv.h | 329 | 
1 files changed, 178 insertions, 151 deletions
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index a3e334ab111..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 - 2010, Intel Corp. + * Copyright (C) 2000 - 2014, Intel Corp.   * All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,12 @@  #ifndef __ACENV_H__  #define __ACENV_H__ +/* + * 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. + */ +  /* Types for ACPI_MUTEX_TYPE */  #define ACPI_BINARY_SEMAPHORE       0 @@ -60,97 +66,91 @@   *   *****************************************************************************/ -#ifdef ACPI_LIBRARY -/* - * Note: The non-debug version of the acpi_library does not contain any - * debug support, for minimal size. The debug version uses ACPI_FULL_DEBUG - */ -#define ACPI_USE_LOCAL_CACHE -#endif +/* iASL configuration */  #ifdef ACPI_ASL_COMPILER -#define ACPI_DEBUG_OUTPUT  #define ACPI_APPLICATION  #define ACPI_DISASSEMBLER +#define ACPI_DEBUG_OUTPUT  #define ACPI_CONSTANT_EVAL_ONLY  #define ACPI_LARGE_NAMESPACE_NODE  #define ACPI_DATA_TABLE_DISASSEMBLY +#define ACPI_SINGLE_THREADED  #endif +/* acpi_exec configuration. Multithreaded with full AML debugger */ +  #ifdef ACPI_EXEC_APP -#undef DEBUGGER_THREADING -#define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED -#define ACPI_FULL_DEBUG  #define ACPI_APPLICATION -#define ACPI_DEBUGGER +#define ACPI_FULL_DEBUG  #define ACPI_MUTEX_DEBUG  #define ACPI_DBG_TRACK_ALLOCATIONS  #endif +/* acpi_names configuration. Single threaded with debugger output enabled. */ + +#ifdef ACPI_NAMES_APP +#define ACPI_DEBUGGER +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#endif + +/* + * 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 + +#ifdef ACPI_HELP_APP +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#define ACPI_NO_ERROR_MESSAGES +#endif + +/* Linkable ACPICA library */ + +#ifdef ACPI_LIBRARY +#define ACPI_USE_LOCAL_CACHE +#define ACPI_FUTURE_USAGE +#endif + +/* Common for all ACPICA applications */ +  #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 -/* - * 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 - * - */  /*! [Begin] no source code translation */ -#if defined(_LINUX) || defined(__linux__) -#include "aclinux.h" - -#elif defined(_AED_EFI) -#include "acefi.h" - -#elif defined(WIN32) -#include "acwin.h" +/****************************************************************************** + * + * Host configuration files. The compiler configuration files are included + * by the host files. + * + *****************************************************************************/ -#elif defined(WIN64) -#include "acwin64.h" +#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__) || defined(__FreeBSD_kernel__)  #include "acfreebsd.h" @@ -158,41 +158,83 @@  #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(__sun) -#include "acsolaris.h" +#elif defined(_CYGWIN) +#include "accygwin.h" -#else +#elif defined(WIN32) +#include "acwin.h" -/* All other environments */ +#elif defined(WIN64) +#include "acwin64.h" -#define ACPI_USE_STANDARD_HEADERS +#elif defined(_WRS_LIB_BUILD) +#include "acvxworks.h" -#define COMPILER_DEPENDENT_INT64   long long -#define COMPILER_DEPENDENT_UINT64  unsigned long long +#elif defined(__OS2__) +#include "acos2.h" + +#elif defined(_AED_EFI) +#include "acefi.h" + +#elif defined(__HAIKU__) +#include "achaiku.h" +#else + +/* Unknown environment */ + +#error Unknown target environment  #endif  /*! [End] no source code translation !*/  /******************************************************************************   * - * Miscellaneous configuration + * Setup defaults for the required symbols that were not defined in one of + * the host/compiler files above.   *   *****************************************************************************/ -/* - * Are mutexes supported by the host? default is no, use binary semaphores. - */ +/* 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 + +/* 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 @@ -200,6 +242,30 @@  #endif  /* + * 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 + */ +#ifndef ACPI_SYSTEM_XFACE +#define ACPI_SYSTEM_XFACE +#endif + +#ifndef ACPI_EXTERNAL_XFACE +#define ACPI_EXTERNAL_XFACE +#endif + +#ifndef ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#endif + +#ifndef ACPI_INTERNAL_VAR_XFACE +#define ACPI_INTERNAL_VAR_XFACE +#endif + +/*   * Debugger threading model   * Use single threaded if the entire subsystem is contained in an application   * Use multiple threaded when the subsystem is running in the kernel. @@ -222,17 +288,26 @@   *   *****************************************************************************/ -#define ACPI_IS_ASCII(c)  ((c) < 0x80) - -#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> @@ -240,9 +315,8 @@  #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)) @@ -274,13 +348,12 @@   *   *****************************************************************************/ - /* -  * 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 @@ -288,22 +361,22 @@  typedef char *va_list;  #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 */ +/* 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))  #define ACPI_STRLEN(s)          (acpi_size) acpi_ut_strlen ((s)) @@ -322,59 +395,13 @@ typedef char *va_list;  #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 */ - +#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__ */  | 
