acenv.h revision 92388
1206625Syongari/******************************************************************************
2206625Syongari *
3206625Syongari * Name: acenv.h - Generation environment specific items
4206625Syongari *       $Revision: 85 $
5206625Syongari *
6206625Syongari *****************************************************************************/
7206625Syongari
8206625Syongari/******************************************************************************
9206625Syongari *
10206625Syongari * 1. Copyright Notice
11206625Syongari *
12206625Syongari * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
13206625Syongari * All rights reserved.
14206625Syongari *
15206625Syongari * 2. License
16206625Syongari *
17206625Syongari * 2.1. This is your license from Intel Corp. under its intellectual property
18206625Syongari * rights.  You may have additional license terms from the party that provided
19206625Syongari * you this software, covering your right to use that party's intellectual
20206625Syongari * property rights.
21206625Syongari *
22206625Syongari * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23206625Syongari * copy of the source code appearing in this file ("Covered Code") an
24206625Syongari * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25206625Syongari * base code distributed originally by Intel ("Original Intel Code") to copy,
26206625Syongari * make derivatives, distribute, use and display any portion of the Covered
27206625Syongari * Code in any form, with the right to sublicense such rights; and
28206625Syongari *
29206625Syongari * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30206625Syongari * license (with the right to sublicense), under only those claims of Intel
31206625Syongari * patents that are infringed by the Original Intel Code, to make, use, sell,
32206625Syongari * offer to sell, and import the Covered Code and derivative works thereof
33206625Syongari * solely to the minimum extent necessary to exercise the above copyright
34206625Syongari * license, and in no event shall the patent license extend to any additions
35206625Syongari * to or modifications of the Original Intel Code.  No other license or right
36206625Syongari * is granted directly or by implication, estoppel or otherwise;
37206625Syongari *
38206625Syongari * The above copyright and patent license is granted only if the following
39206625Syongari * conditions are met:
40206625Syongari *
41206625Syongari * 3. Conditions
42206625Syongari *
43206625Syongari * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44206625Syongari * Redistribution of source code of any substantial portion of the Covered
45206625Syongari * Code or modification with rights to further distribute source must include
46206625Syongari * the above Copyright Notice, the above License, this list of Conditions,
47206625Syongari * and the following Disclaimer and Export Compliance provision.  In addition,
48206625Syongari * Licensee must cause all Covered Code to which Licensee contributes to
49206625Syongari * contain a file documenting the changes Licensee made to create that Covered
50206625Syongari * Code and the date of any change.  Licensee must include in that file the
51206625Syongari * documentation of any changes made by any predecessor Licensee.  Licensee
52206625Syongari * must include a prominent statement that the modification is derived,
53206625Syongari * directly or indirectly, from Original Intel Code.
54206625Syongari *
55206625Syongari * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56206625Syongari * Redistribution of source code of any substantial portion of the Covered
57206625Syongari * Code or modification without rights to further distribute source must
58206625Syongari * include the following Disclaimer and Export Compliance provision in the
59206625Syongari * documentation and/or other materials provided with distribution.  In
60206625Syongari * addition, Licensee may not authorize further sublicense of source of any
61206625Syongari * portion of the Covered Code, and must include terms to the effect that the
62206625Syongari * license from Licensee to its licensee is limited to the intellectual
63206625Syongari * property embodied in the software Licensee provides to its licensee, and
64206625Syongari * not to intellectual property embodied in modifications its licensee may
65206625Syongari * make.
66206625Syongari *
67206625Syongari * 3.3. Redistribution of Executable. Redistribution in executable form of any
68206625Syongari * substantial portion of the Covered Code or modification must reproduce the
69206625Syongari * above Copyright Notice, and the following Disclaimer and Export Compliance
70206625Syongari * provision in the documentation and/or other materials provided with the
71206625Syongari * distribution.
72206625Syongari *
73206625Syongari * 3.4. Intel retains all right, title, and interest in and to the Original
74206625Syongari * Intel Code.
75206625Syongari *
76206625Syongari * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77206625Syongari * Intel shall be used in advertising or otherwise to promote the sale, use or
78206625Syongari * other dealings in products derived from or relating to the Covered Code
79206625Syongari * without prior written authorization from Intel.
80206625Syongari *
81206625Syongari * 4. Disclaimer and Export Compliance
82206625Syongari *
83206625Syongari * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84206625Syongari * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85206625Syongari * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86206625Syongari * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87206625Syongari * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88206625Syongari * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89206625Syongari * PARTICULAR PURPOSE.
90206625Syongari *
91206625Syongari * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92206625Syongari * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93206625Syongari * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94206625Syongari * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95206625Syongari * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96206625Syongari * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97206625Syongari * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98206625Syongari * LIMITED REMEDY.
99206625Syongari *
100206625Syongari * 4.3. Licensee shall not export, either directly or indirectly, any of this
101206625Syongari * software or system incorporating such software without first obtaining any
102206625Syongari * required license or other approval from the U. S. Department of Commerce or
103206625Syongari * any other agency or department of the United States Government.  In the
104206625Syongari * event Licensee exports any such software from the United States or
105206625Syongari * re-exports any such software from a foreign destination, Licensee shall
106206625Syongari * ensure that the distribution and export/re-export of the software is in
107206625Syongari * compliance with all laws, regulations, orders, or other restrictions of the
108206625Syongari * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109206625Syongari * any of its subsidiaries will export/re-export any technical data, process,
110206625Syongari * software, or service, directly or indirectly, to any country for which the
111206625Syongari * United States government or any agency thereof requires an export license,
112206625Syongari * other governmental approval, or letter of assurance, without first obtaining
113206625Syongari * such license, approval or letter.
114206625Syongari *
115206625Syongari *****************************************************************************/
116206625Syongari
117206625Syongari#ifndef __ACENV_H__
118206625Syongari#define __ACENV_H__
119206625Syongari
120206625Syongari
121206625Syongari/*
122206625Syongari * Configuration for ACPI tools and utilities
123206625Syongari */
124206625Syongari
125206625Syongari#ifdef _ACPI_DUMP_APP
126206625Syongari#define ACPI_DEBUG
127206625Syongari#define ACPI_APPLICATION
128206625Syongari#define ENABLE_DEBUGGER
129206625Syongari#define ACPI_USE_SYSTEM_CLIBRARY
130206625Syongari#define PARSER_ONLY
131206625Syongari#endif
132206625Syongari
133206625Syongari#ifdef _ACPI_EXEC_APP
134206625Syongari#undef DEBUGGER_THREADING
135206625Syongari#define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED
136206625Syongari#define ACPI_DEBUG
137206625Syongari#define ACPI_APPLICATION
138206625Syongari#define ENABLE_DEBUGGER
139206625Syongari#define ACPI_USE_SYSTEM_CLIBRARY
140207380Syongari#endif
141207379Syongari
142207379Syongari#ifdef _ACPI_ASL_COMPILER
143209818Syongari#define ACPI_DEBUG
144206625Syongari#define ACPI_APPLICATION
145207379Syongari#define ENABLE_DEBUGGER
146207379Syongari#define ACPI_USE_SYSTEM_CLIBRARY
147206625Syongari#endif
148206625Syongari
149206625Syongari/*
150206625Syongari * Memory allocation tracking.  Used only if
151206625Syongari * 1) This is the debug version
152206625Syongari * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
153206625Syongari */
154206625Syongari#ifdef ACPI_DEBUG
155206625Syongari#ifndef _IA16
156206625Syongari#define ACPI_DBG_TRACK_ALLOCATIONS
157206625Syongari#endif
158206625Syongari#endif
159206625Syongari
160206625Syongari/*
161206625Syongari * Environment configuration.  The purpose of this file is to interface to the
162206625Syongari * local generation environment.
163206625Syongari *
164206625Syongari * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
165206625Syongari *      Otherwise, local versions of string/memory functions will be used.
166206625Syongari * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
167206625Syongari *      the standard header files may be used.
168206625Syongari *
169206625Syongari * The ACPI subsystem only uses low level C library functions that do not call
170206625Syongari * operating system services and may therefore be inlined in the code.
171206625Syongari *
172206625Syongari * It may be necessary to tailor these include files to the target
173206625Syongari * generation environment.
174206625Syongari *
175206625Syongari *
176206625Syongari * Functions and constants used from each header:
177206625Syongari *
178206625Syongari * string.h:    memcpy
179206625Syongari *              memset
180206625Syongari *              strcat
181206625Syongari *              strcmp
182206625Syongari *              strcpy
183206625Syongari *              strlen
184206625Syongari *              strncmp
185206625Syongari *              strncat
186206625Syongari *              strncpy
187206625Syongari *
188206625Syongari * stdlib.h:    strtoul
189206625Syongari *
190206625Syongari * stdarg.h:    va_list
191206625Syongari *              va_arg
192207380Syongari *              va_start
193206625Syongari *              va_end
194206625Syongari *
195206625Syongari */
196206625Syongari
197206625Syongari/*! [Begin] no source code translation */
198206625Syongari
199207380Syongari#if defined(_LINUX)
200206625Syongari#include "aclinux.h"
201206625Syongari
202206625Syongari#elif defined(_AED_EFI)
203206625Syongari#include "acefi.h"
204206625Syongari
205206625Syongari#elif defined(MSDOS)
206206625Syongari#include "acdos16.h"
207206625Syongari
208206625Syongari#elif defined(WIN32)
209206625Syongari#include "acwin.h"
210206625Syongari
211206625Syongari#elif defined(WIN64)
212206625Syongari#include "acwin64.h"
213206625Syongari
214206625Syongari#elif defined(__FreeBSD__)
215206625Syongari#include "acfreebsd.h"
216206625Syongari
217206625Syongari#elif defined(MODESTO)
218206625Syongari#include "acmodesto.h"
219206625Syongari
220206625Syongari#elif defined(NETWARE)
221206625Syongari#include "acnetware.h"
222206625Syongari
223206625Syongari#else
224206625Syongari
225206625Syongari/* All other environments */
226207380Syongari
227206625Syongari#define ACPI_USE_STANDARD_HEADERS
228206625Syongari
229206625Syongari/* Name of host operating system (returned by the _OS_ namespace object) */
230206625Syongari
231207380Syongari#define ACPI_OS_NAME         "Intel ACPI/CA Core Subsystem"
232206625Syongari
233206625Syongari/* This macro is used to tag functions as "printf-like" because
234206625Syongari * some compilers can catch printf format string problems. MSVC
235206625Syongari * doesn't, so this is proprocessed away.
236206625Syongari */
237206625Syongari#define ACPI_PRINTF_LIKE_FUNC
238206625Syongari
239206625Syongari#endif
240206625Syongari
241206625Syongari/*! [End] no source code translation !*/
242206625Syongari
243206625Syongari/******************************************************************************
244206625Syongari *
245206625Syongari * C library configuration
246206625Syongari *
247206625Syongari *****************************************************************************/
248207380Syongari
249206625Syongari#ifdef ACPI_USE_SYSTEM_CLIBRARY
250206625Syongari/*
251206625Syongari * Use the standard C library headers.
252206625Syongari * We want to keep these to a minimum.
253206625Syongari *
254206625Syongari */
255206625Syongari
256206625Syongari#ifdef ACPI_USE_STANDARD_HEADERS
257206625Syongari/*
258206625Syongari * Use the standard headers from the standard locations
259206625Syongari */
260206625Syongari#include <stdarg.h>
261206625Syongari#include <stdlib.h>
262206625Syongari#include <string.h>
263206625Syongari#include <ctype.h>
264206625Syongari
265206625Syongari#endif /* ACPI_USE_STANDARD_HEADERS */
266206625Syongari
267206625Syongari/*
268206625Syongari * We will be linking to the standard Clib functions
269206625Syongari */
270206625Syongari
271206625Syongari#define ACPI_STRSTR(s1,s2)      strstr((s1), (s2))
272206625Syongari#define ACPI_STRUPR(s)          AcpiUtStrupr  ((s))
273206625Syongari#define ACPI_STRLEN(s)          (UINT32) strlen((s))
274206625Syongari#define ACPI_STRCPY(d,s)        strcpy((d), (s))
275206625Syongari#define ACPI_STRNCPY(d,s,n)     strncpy((d), (s), (NATIVE_INT)(n))
276206625Syongari#define ACPI_STRNCMP(d,s,n)     strncmp((d), (s), (NATIVE_INT)(n))
277206625Syongari#define ACPI_STRCMP(d,s)        strcmp((d), (s))
278206625Syongari#define ACPI_STRCAT(d,s)        strcat((d), (s))
279206625Syongari#define ACPI_STRNCAT(d,s,n)     strncat((d), (s), (NATIVE_INT)(n))
280206625Syongari#define ACPI_STRTOUL(d,s,n)     strtoul((d), (s), (NATIVE_INT)(n))
281206625Syongari#define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (NATIVE_INT)(n))
282206625Syongari#define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (NATIVE_INT)(n))
283206625Syongari#define ACPI_TOUPPER            toupper
284206625Syongari#define ACPI_TOLOWER            tolower
285206625Syongari#define ACPI_IS_XDIGIT          isxdigit
286206625Syongari
287263957Syongari/******************************************************************************
288207851Syongari *
289207851Syongari * Not using native C library, use local implementations
290206625Syongari *
291206625Syongari *****************************************************************************/
292206625Syongari#else
293206625Syongari
294206625Syongari/*
295206625Syongari * Use local definitions of C library macros and functions
296206625Syongari * NOTE: The function implementations may not be as efficient
297206625Syongari * as an inline or assembly code implementation provided by a
298206625Syongari * native C library.
299206625Syongari */
300206625Syongari
301206625Syongari#ifndef va_arg
302206625Syongari
303206625Syongari#ifndef _VALIST
304207628Syongari#define _VALIST
305207628Syongaritypedef char *va_list;
306207628Syongari#endif /* _VALIST */
307207628Syongari
308207628Syongari/*
309207628Syongari * Storage alignment properties
310207628Syongari */
311207628Syongari
312207628Syongari#define  _AUPBND                (sizeof (NATIVE_INT) - 1)
313207628Syongari#define  _ADNBND                (sizeof (NATIVE_INT) - 1)
314207628Syongari
315206625Syongari/*
316206625Syongari * Variable argument list macro definitions
317206625Syongari */
318206625Syongari
319206625Syongari#define _Bnd(X, bnd)            (((sizeof (X)) + (bnd)) & (~(bnd)))
320206625Syongari#define va_arg(ap, T)           (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
321206625Syongari#define va_end(ap)              (void) 0
322206625Syongari#define va_start(ap, A)         (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND))))
323207628Syongari
324207628Syongari#endif /* va_arg */
325206625Syongari
326206625Syongari
327206625Syongari#define ACPI_STRSTR(s1,s2)      AcpiUtStrstr  ((s1), (s2))
328206625Syongari#define ACPI_STRUPR(s)          AcpiUtStrupr  ((s))
329206625Syongari#define ACPI_STRLEN(s)          AcpiUtStrlen  ((s))
330206625Syongari#define ACPI_STRCPY(d,s)        AcpiUtStrcpy  ((d), (s))
331206625Syongari#define ACPI_STRNCPY(d,s,n)     AcpiUtStrncpy ((d), (s), (n))
332206625Syongari#define ACPI_STRNCMP(d,s,n)     AcpiUtStrncmp ((d), (s), (n))
333206625Syongari#define ACPI_STRCMP(d,s)        AcpiUtStrcmp  ((d), (s))
334206625Syongari#define ACPI_STRCAT(d,s)        AcpiUtStrcat  ((d), (s))
335206625Syongari#define ACPI_STRNCAT(d,s,n)     AcpiUtStrncat ((d), (s), (n))
336206625Syongari#define ACPI_STRTOUL(d,s,n)     AcpiUtStrtoul ((d), (s),(n))
337206625Syongari#define ACPI_MEMCPY(d,s,n)      (void) AcpiUtMemcpy  ((d), (s), (n))
338206625Syongari#define ACPI_MEMSET(d,v,n)      (void) AcpiUtMemset  ((d), (v), (n))
339206625Syongari#define ACPI_TOUPPER            AcpiUtToUpper
340206625Syongari#define ACPI_TOLOWER            AcpiUtToLower
341206625Syongari
342206625Syongari#endif /* ACPI_USE_SYSTEM_CLIBRARY */
343206625Syongari
344206625Syongari
345206625Syongari/******************************************************************************
346206625Syongari *
347206625Syongari * Assembly code macros
348206625Syongari *
349206625Syongari *****************************************************************************/
350206625Syongari
351206625Syongari/*
352206625Syongari * Handle platform- and compiler-specific assembly language differences.
353206625Syongari * These should already have been defined by the platform includes above.
354207377Syongari *
355206625Syongari * Notes:
356206625Syongari * 1) Interrupt 3 is used to break into a debugger
357206625Syongari * 2) Interrupts are turned off during ACPI register setup
358206625Syongari */
359206625Syongari
360206625Syongari/* Unrecognized compiler, use defaults */
361206625Syongari
362206625Syongari#ifndef ACPI_ASM_MACROS
363206625Syongari
364206625Syongari/*
365206625Syongari * Calling conventions:
366206625Syongari *
367206625Syongari * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
368206625Syongari * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
369206625Syongari * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
370206625Syongari * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
371206625Syongari */
372#define ACPI_SYSTEM_XFACE
373#define ACPI_EXTERNAL_XFACE
374#define ACPI_INTERNAL_XFACE
375#define ACPI_INTERNAL_VAR_XFACE
376
377#define ACPI_ASM_MACROS
378#define causeinterrupt(level)
379#define BREAKPOINT3
380#define acpi_disable_irqs()
381#define acpi_enable_irqs()
382#define halt()
383#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)
384#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)
385
386#endif /* ACPI_ASM_MACROS */
387
388
389#ifdef ACPI_APPLICATION
390
391/* Don't want software interrupts within a ring3 application */
392
393#undef causeinterrupt
394#undef BREAKPOINT3
395#define causeinterrupt(level)
396#define BREAKPOINT3
397#endif
398
399
400/******************************************************************************
401 *
402 * Compiler-specific information is contained in the compiler-specific
403 * headers.
404 *
405 *****************************************************************************/
406#endif /* __ACENV_H__ */
407