acenv.h revision 126372
1141240Snjl/****************************************************************************** 2167905Snjl * 3141240Snjl * Name: acenv.h - Generation environment specific items 4141240Snjl * $Revision: 106 $ 5141240Snjl * 6141240Snjl *****************************************************************************/ 7141240Snjl 8141240Snjl/****************************************************************************** 9141240Snjl * 10141240Snjl * 1. Copyright Notice 11141240Snjl * 12141240Snjl * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. 13141240Snjl * All rights reserved. 14141240Snjl * 15141240Snjl * 2. License 16141240Snjl * 17141240Snjl * 2.1. This is your license from Intel Corp. under its intellectual property 18141240Snjl * rights. You may have additional license terms from the party that provided 19141240Snjl * you this software, covering your right to use that party's intellectual 20141240Snjl * property rights. 21141240Snjl * 22141240Snjl * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23141240Snjl * copy of the source code appearing in this file ("Covered Code") an 24141240Snjl * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25141240Snjl * base code distributed originally by Intel ("Original Intel Code") to copy, 26141240Snjl * make derivatives, distribute, use and display any portion of the Covered 27141240Snjl * Code in any form, with the right to sublicense such rights; and 28141240Snjl * 29141240Snjl * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30141240Snjl * license (with the right to sublicense), under only those claims of Intel 31141240Snjl * patents that are infringed by the Original Intel Code, to make, use, sell, 32141240Snjl * offer to sell, and import the Covered Code and derivative works thereof 33141240Snjl * solely to the minimum extent necessary to exercise the above copyright 34141240Snjl * license, and in no event shall the patent license extend to any additions 35142603Snjl * to or modifications of the Original Intel Code. No other license or right 36141240Snjl * is granted directly or by implication, estoppel or otherwise; 37141240Snjl * 38141240Snjl * The above copyright and patent license is granted only if the following 39141240Snjl * conditions are met: 40141240Snjl * 41141240Snjl * 3. Conditions 42141240Snjl * 43141240Snjl * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44142603Snjl * Redistribution of source code of any substantial portion of the Covered 45141814Snjl * Code or modification with rights to further distribute source must include 46167905Snjl * the above Copyright Notice, the above License, this list of Conditions, 47141240Snjl * and the following Disclaimer and Export Compliance provision. In addition, 48141240Snjl * Licensee must cause all Covered Code to which Licensee contributes to 49141240Snjl * contain a file documenting the changes Licensee made to create that Covered 50141240Snjl * Code and the date of any change. Licensee must include in that file the 51141240Snjl * documentation of any changes made by any predecessor Licensee. Licensee 52141240Snjl * must include a prominent statement that the modification is derived, 53141240Snjl * directly or indirectly, from Original Intel Code. 54141240Snjl * 55141240Snjl * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56141240Snjl * Redistribution of source code of any substantial portion of the Covered 57142395Snjl * Code or modification without rights to further distribute source must 58141240Snjl * include the following Disclaimer and Export Compliance provision in the 59142395Snjl * documentation and/or other materials provided with distribution. In 60141240Snjl * addition, Licensee may not authorize further sublicense of source of any 61150847Sume * portion of the Covered Code, and must include terms to the effect that the 62150847Sume * license from Licensee to its licensee is limited to the intellectual 63150847Sume * property embodied in the software Licensee provides to its licensee, and 64150847Sume * not to intellectual property embodied in modifications its licensee may 65150847Sume * make. 66150847Sume * 67141240Snjl * 3.3. Redistribution of Executable. Redistribution in executable form of any 68142603Snjl * substantial portion of the Covered Code or modification must reproduce the 69141240Snjl * above Copyright Notice, and the following Disclaimer and Export Compliance 70141923Snjl * provision in the documentation and/or other materials provided with the 71150847Sume * distribution. 72141923Snjl * 73141413Snjl * 3.4. Intel retains all right, title, and interest in and to the Original 74141945Snjl * Intel Code. 75141240Snjl * 76141240Snjl * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77167905Snjl * Intel shall be used in advertising or otherwise to promote the sale, use or 78141240Snjl * other dealings in products derived from or relating to the Covered Code 79141240Snjl * without prior written authorization from Intel. 80141240Snjl * 81141240Snjl * 4. Disclaimer and Export Compliance 82141240Snjl * 83141240Snjl * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84141240Snjl * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85141240Snjl * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86141240Snjl * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87141240Snjl * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88142603Snjl * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89142603Snjl * PARTICULAR PURPOSE. 90142603Snjl * 91142603Snjl * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92142603Snjl * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93144876Snjl * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94144876Snjl * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95144876Snjl * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96144876Snjl * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97144876Snjl * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98141240Snjl * LIMITED REMEDY. 99167905Snjl * 100141240Snjl * 4.3. Licensee shall not export, either directly or indirectly, any of this 101141240Snjl * software or system incorporating such software without first obtaining any 102141240Snjl * required license or other approval from the U. S. Department of Commerce or 103141240Snjl * any other agency or department of the United States Government. In the 104141240Snjl * event Licensee exports any such software from the United States or 105141240Snjl * re-exports any such software from a foreign destination, Licensee shall 106141413Snjl * ensure that the distribution and export/re-export of the software is in 107141240Snjl * compliance with all laws, regulations, orders, or other restrictions of the 108141413Snjl * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109141413Snjl * any of its subsidiaries will export/re-export any technical data, process, 110141413Snjl * software, or service, directly or indirectly, to any country for which the 111141413Snjl * United States government or any agency thereof requires an export license, 112141240Snjl * other governmental approval, or letter of assurance, without first obtaining 113141240Snjl * such license, approval or letter. 114142114Snjl * 115141240Snjl *****************************************************************************/ 116141240Snjl 117141240Snjl#ifndef __ACENV_H__ 118141240Snjl#define __ACENV_H__ 119141240Snjl 120141240Snjl 121141240Snjl/* 122141240Snjl * Configuration for ACPI tools and utilities 123141240Snjl */ 124141240Snjl 125141240Snjl#ifdef _ACPI_DUMP_APP 126141240Snjl#ifndef MSDOS 127141240Snjl#define ACPI_DEBUG_OUTPUT 128141240Snjl#endif 129141240Snjl#define ACPI_APPLICATION 130141240Snjl#define ACPI_DISASSEMBLER 131141240Snjl#define ACPI_NO_METHOD_EXECUTION 132142590Snjl#define ACPI_USE_SYSTEM_CLIBRARY 133144876Snjl#endif 134142590Snjl 135144876Snjl#ifdef _ACPI_EXEC_APP 136142590Snjl#undef DEBUGGER_THREADING 137142590Snjl#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED 138142590Snjl#define ACPI_DEBUG_OUTPUT 139144876Snjl#define ACPI_APPLICATION 140144876Snjl#define ACPI_DEBUGGER 141142590Snjl#define ACPI_DISASSEMBLER 142141240Snjl#define ACPI_USE_SYSTEM_CLIBRARY 143141240Snjl#endif 144141240Snjl 145141240Snjl#ifdef _ACPI_ASL_COMPILER 146141240Snjl#define ACPI_DEBUG_OUTPUT 147141240Snjl#define ACPI_APPLICATION 148141240Snjl#define ACPI_DISASSEMBLER 149144876Snjl#define ACPI_CONSTANT_EVAL_ONLY 150141240Snjl#define ACPI_USE_SYSTEM_CLIBRARY 151141240Snjl#endif 152141240Snjl 153141240Snjl/* 154141240Snjl * Environment configuration. The purpose of this file is to interface to the 155142603Snjl * local generation environment. 156141240Snjl * 157150847Sume * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. 158141945Snjl * Otherwise, local versions of string/memory functions will be used. 159141240Snjl * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and 160141240Snjl * the standard header files may be used. 161141240Snjl * 162141240Snjl * The ACPI subsystem only uses low level C library functions that do not call 163141240Snjl * operating system services and may therefore be inlined in the code. 164141240Snjl * 165141240Snjl * It may be necessary to tailor these include files to the target 166141240Snjl * generation environment. 167141240Snjl * 168141240Snjl * 169144876Snjl * Functions and constants used from each header: 170144876Snjl * 171141240Snjl * string.h: memcpy 172141240Snjl * memset 173141240Snjl * strcat 174141240Snjl * strcmp 175141240Snjl * strcpy 176141240Snjl * strlen 177141240Snjl * strncmp 178141240Snjl * strncat 179141240Snjl * strncpy 180167905Snjl * 181167905Snjl * stdlib.h: strtoul 182167905Snjl * 183167905Snjl * stdarg.h: va_list 184167905Snjl * va_arg 185167905Snjl * va_start 186167905Snjl * va_end 187141240Snjl * 188141240Snjl */ 189141240Snjl 190167905Snjl/*! [Begin] no source code translation */ 191167905Snjl 192167905Snjl#if defined(__linux__) 193167905Snjl#include "aclinux.h" 194167905Snjl 195167905Snjl#elif defined(_AED_EFI) 196167905Snjl#include "acefi.h" 197167905Snjl 198141240Snjl#elif defined(WIN32) 199141240Snjl#include "acwin.h" 200141240Snjl 201141240Snjl#elif defined(WIN64) 202150847Sume#include "acwin64.h" 203141240Snjl 204141240Snjl#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ 205144876Snjl#include "acdos16.h" 206141240Snjl 207141240Snjl#elif defined(__FreeBSD__) 208141240Snjl#include "acfreebsd.h" 209150847Sume 210150847Sume#elif defined(__NetBSD__) 211150847Sume#include "acnetbsd.h" 212150847Sume 213150847Sume#elif defined(MODESTO) 214141240Snjl#include "acmodesto.h" 215141240Snjl 216144876Snjl#elif defined(NETWARE) 217144876Snjl#include "acnetware.h" 218144876Snjl 219141240Snjl#else 220141240Snjl 221141240Snjl/* All other environments */ 222141240Snjl 223141240Snjl#define ACPI_USE_STANDARD_HEADERS 224141240Snjl 225141240Snjl#define COMPILER_DEPENDENT_INT64 long long 226141240Snjl#define COMPILER_DEPENDENT_UINT64 unsigned long long 227141240Snjl 228150847Sume 229141814Snjl/* Name of host operating system (returned by the _OS_ namespace object) */ 230171898Snjl 231141240Snjl#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem" 232141240Snjl 233142603Snjl/* This macro is used to tag functions as "printf-like" because 234142603Snjl * some compilers can catch printf format string problems. MSVC 235150847Sume * doesn't, so this is proprocessed away. 236141240Snjl */ 237167905Snjl#define ACPI_PRINTF_LIKE_FUNC 238167905Snjl 239167905Snjl#endif 240167905Snjl 241167905Snjl/* 242156228Smnag * Memory allocation tracking. Used only if 243141814Snjl * 1) This is the debug version 244150847Sume * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) 245150847Sume */ 246141923Snjl#ifdef ACPI_DEBUG_OUTPUT 247150847Sume#if ACPI_MACHINE_WIDTH != 16 248150847Sume#define ACPI_DBG_TRACK_ALLOCATIONS 249150847Sume#endif 250150847Sume#endif 251150847Sume 252150847Sume/*! [End] no source code translation !*/ 253150847Sume 254150847Sume 255150847Sume/* 256150847Sume * Debugger threading model 257150847Sume * Use single threaded if the entire subsystem is contained in an application 258141923Snjl * Use multiple threaded when the subsystem is running in the kernel. 259141923Snjl * 260141923Snjl * By default the model is single threaded if ACPI_APPLICATION is set, 261141923Snjl * multi-threaded if ACPI_APPLICATION is not set. 262150847Sume */ 263150847Sume#define DEBUGGER_SINGLE_THREADED 0 264144876Snjl#define DEBUGGER_MULTI_THREADED 1 265142603Snjl 266142603Snjl#ifndef DEBUGGER_THREADING 267142603Snjl#ifdef ACPI_APPLICATION 268150847Sume#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED 269150847Sume 270150847Sume#else 271150847Sume#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED 272142603Snjl#endif 273141923Snjl#endif /* !DEBUGGER_THREADING */ 274142590Snjl 275148972Snjl/****************************************************************************** 276144876Snjl * 277144876Snjl * C library configuration 278142603Snjl * 279142603Snjl *****************************************************************************/ 280142603Snjl 281142590Snjl#ifdef ACPI_USE_SYSTEM_CLIBRARY 282141240Snjl/* 283144876Snjl * Use the standard C library headers. 284144876Snjl * We want to keep these to a minimum. 285144876Snjl */ 286149239Sume 287144876Snjl#ifdef ACPI_USE_STANDARD_HEADERS 288141240Snjl/* 289141240Snjl * Use the standard headers from the standard locations 290141240Snjl */ 291141240Snjl#include <stdarg.h> 292141240Snjl#include <stdlib.h> 293141240Snjl#include <string.h> 294141240Snjl#include <ctype.h> 295141240Snjl 296141943Snjl#endif /* ACPI_USE_STANDARD_HEADERS */ 297171898Snjl 298141943Snjl/* 299171898Snjl * We will be linking to the standard Clib functions 300171898Snjl */ 301171898Snjl 302144876Snjl#define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) 303144876Snjl#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s)) 304141240Snjl#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s)) 305171898Snjl#define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) 306171898Snjl#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) 307171898Snjl#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n)) 308141240Snjl#define ACPI_STRCMP(d,s) strcmp((d), (s)) 309141240Snjl#define ACPI_STRCAT(d,s) (void) strcat((d), (s)) 310141240Snjl#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) 311141240Snjl#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) 312141240Snjl#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) 313141413Snjl#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) 314141413Snjl 315141413Snjl#define ACPI_TOUPPER toupper 316141413Snjl#define ACPI_TOLOWER tolower 317141413Snjl#define ACPI_IS_XDIGIT isxdigit 318141413Snjl#define ACPI_IS_DIGIT isdigit 319141413Snjl#define ACPI_IS_SPACE isspace 320141943Snjl#define ACPI_IS_UPPER isupper 321171898Snjl#define ACPI_IS_PRINT isprint 322141943Snjl#define ACPI_IS_ALPHA isalpha 323171898Snjl#define ACPI_IS_ASCII isascii 324171898Snjl 325171898Snjl/****************************************************************************** 326144876Snjl * 327144876Snjl * Not using native C library, use local implementations 328141413Snjl * 329171898Snjl *****************************************************************************/ 330171898Snjl#else 331171898Snjl 332141413Snjl/* 333141413Snjl * Use local definitions of C library macros and functions 334141413Snjl * NOTE: The function implementations may not be as efficient 335141413Snjl * as an inline or assembly code implementation provided by a 336141413Snjl * native C library. 337141240Snjl */ 338149239Sume 339141923Snjl#ifndef va_arg 340141923Snjl 341150847Sume#ifndef _VALIST 342141923Snjl#define _VALIST 343141923Snjltypedef char *va_list; 344150847Sume#endif /* _VALIST */ 345144876Snjl 346144876Snjl/* 347150847Sume * Storage alignment properties 348150847Sume */ 349150847Sume 350150847Sume#define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1) 351150847Sume#define _ADNBND (sizeof (ACPI_NATIVE_INT) - 1) 352150847Sume 353150847Sume/* 354150847Sume * Variable argument list macro definitions 355141923Snjl */ 356141240Snjl 357141923Snjl#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) 358141240Snjl#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND)))) 359150847Sume#define va_end(ap) (void) 0 360150847Sume#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND)))) 361150847Sume 362150847Sume#endif /* va_arg */ 363150847Sume 364150847Sume 365150847Sume#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) 366150847Sume#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s)) 367141240Snjl#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s)) 368142603Snjl#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s)) 369167905Snjl#define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n)) 370167905Snjl#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n)) 371167905Snjl#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s)) 372167905Snjl#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s)) 373167905Snjl#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n)) 374167905Snjl#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n)) 375142603Snjl#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n)) 376141240Snjl#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n)) 377167905Snjl#define ACPI_TOUPPER AcpiUtToUpper 378141240Snjl#define ACPI_TOLOWER AcpiUtToLower 379141240Snjl 380141240Snjl#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 381141240Snjl 382141240Snjl 383141240Snjl/****************************************************************************** 384141240Snjl * 385141240Snjl * Assembly code macros 386141240Snjl * 387141240Snjl *****************************************************************************/ 388141240Snjl 389171896Snjl/* 390141240Snjl * Handle platform- and compiler-specific assembly language differences. 391141240Snjl * These should already have been defined by the platform includes above. 392141240Snjl * 393142603Snjl * Notes: 394141240Snjl * 1) Interrupt 3 is used to break into a debugger 395141240Snjl * 2) Interrupts are turned off during ACPI register setup 396141240Snjl */ 397142603Snjl 398142603Snjl/* Unrecognized compiler, use defaults */ 399144876Snjl 400144876Snjl#ifndef ACPI_ASM_MACROS 401141240Snjl 402144876Snjl/* 403142603Snjl * Calling conventions: 404141240Snjl * 405141240Snjl * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) 406141240Snjl * ACPI_EXTERNAL_XFACE - External ACPI interfaces 407141240Snjl * ACPI_INTERNAL_XFACE - Internal ACPI interfaces 408141240Snjl * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces 409141240Snjl */ 410141240Snjl#define ACPI_SYSTEM_XFACE 411141240Snjl#define ACPI_EXTERNAL_XFACE 412141240Snjl#define ACPI_INTERNAL_XFACE 413141240Snjl#define ACPI_INTERNAL_VAR_XFACE 414141240Snjl 415142395Snjl#define ACPI_ASM_MACROS 416142395Snjl#define BREAKPOINT3 417142395Snjl#define ACPI_DISABLE_IRQS() 418142603Snjl#define ACPI_ENABLE_IRQS() 419142603Snjl#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) 420142395Snjl#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) 421141240Snjl 422142603Snjl#endif /* ACPI_ASM_MACROS */ 423142603Snjl 424142603Snjl 425142603Snjl#ifdef ACPI_APPLICATION 426142603Snjl 427142603Snjl/* Don't want software interrupts within a ring3 application */ 428142603Snjl 429142603Snjl#undef BREAKPOINT3 430142603Snjl#define BREAKPOINT3 431142603Snjl#endif 432142603Snjl 433142603Snjl 434142603Snjl/****************************************************************************** 435142603Snjl * 436171896Snjl * Compiler-specific information is contained in the compiler-specific 437171896Snjl * headers. 438141240Snjl * 439171896Snjl *****************************************************************************/ 440141240Snjl#endif /* __ACENV_H__ */ 441141240Snjl