xref: /onnv-gate/usr/src/uts/intel/sys/acpi/platform/acenv.h (revision 9980:13d7f3eec672)
10Sstevel@tonic-gate /******************************************************************************
20Sstevel@tonic-gate  *
3*9980SDana.Myers@Sun.COM  * Name: acenv.h - Host and compiler configuration
40Sstevel@tonic-gate  *
50Sstevel@tonic-gate  *****************************************************************************/
60Sstevel@tonic-gate 
70Sstevel@tonic-gate /******************************************************************************
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * 1. Copyright Notice
100Sstevel@tonic-gate  *
11*9980SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
120Sstevel@tonic-gate  * All rights reserved.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * 2. License
150Sstevel@tonic-gate  *
160Sstevel@tonic-gate  * 2.1. This is your license from Intel Corp. under its intellectual property
170Sstevel@tonic-gate  * rights.  You may have additional license terms from the party that provided
180Sstevel@tonic-gate  * you this software, covering your right to use that party's intellectual
190Sstevel@tonic-gate  * property rights.
200Sstevel@tonic-gate  *
210Sstevel@tonic-gate  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220Sstevel@tonic-gate  * copy of the source code appearing in this file ("Covered Code") an
230Sstevel@tonic-gate  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240Sstevel@tonic-gate  * base code distributed originally by Intel ("Original Intel Code") to copy,
250Sstevel@tonic-gate  * make derivatives, distribute, use and display any portion of the Covered
260Sstevel@tonic-gate  * Code in any form, with the right to sublicense such rights; and
270Sstevel@tonic-gate  *
280Sstevel@tonic-gate  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290Sstevel@tonic-gate  * license (with the right to sublicense), under only those claims of Intel
300Sstevel@tonic-gate  * patents that are infringed by the Original Intel Code, to make, use, sell,
310Sstevel@tonic-gate  * offer to sell, and import the Covered Code and derivative works thereof
320Sstevel@tonic-gate  * solely to the minimum extent necessary to exercise the above copyright
330Sstevel@tonic-gate  * license, and in no event shall the patent license extend to any additions
340Sstevel@tonic-gate  * to or modifications of the Original Intel Code.  No other license or right
350Sstevel@tonic-gate  * is granted directly or by implication, estoppel or otherwise;
360Sstevel@tonic-gate  *
370Sstevel@tonic-gate  * The above copyright and patent license is granted only if the following
380Sstevel@tonic-gate  * conditions are met:
390Sstevel@tonic-gate  *
400Sstevel@tonic-gate  * 3. Conditions
410Sstevel@tonic-gate  *
420Sstevel@tonic-gate  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
440Sstevel@tonic-gate  * Code or modification with rights to further distribute source must include
450Sstevel@tonic-gate  * the above Copyright Notice, the above License, this list of Conditions,
460Sstevel@tonic-gate  * and the following Disclaimer and Export Compliance provision.  In addition,
470Sstevel@tonic-gate  * Licensee must cause all Covered Code to which Licensee contributes to
480Sstevel@tonic-gate  * contain a file documenting the changes Licensee made to create that Covered
490Sstevel@tonic-gate  * Code and the date of any change.  Licensee must include in that file the
500Sstevel@tonic-gate  * documentation of any changes made by any predecessor Licensee.  Licensee
510Sstevel@tonic-gate  * must include a prominent statement that the modification is derived,
520Sstevel@tonic-gate  * directly or indirectly, from Original Intel Code.
530Sstevel@tonic-gate  *
540Sstevel@tonic-gate  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
560Sstevel@tonic-gate  * Code or modification without rights to further distribute source must
570Sstevel@tonic-gate  * include the following Disclaimer and Export Compliance provision in the
580Sstevel@tonic-gate  * documentation and/or other materials provided with distribution.  In
590Sstevel@tonic-gate  * addition, Licensee may not authorize further sublicense of source of any
600Sstevel@tonic-gate  * portion of the Covered Code, and must include terms to the effect that the
610Sstevel@tonic-gate  * license from Licensee to its licensee is limited to the intellectual
620Sstevel@tonic-gate  * property embodied in the software Licensee provides to its licensee, and
630Sstevel@tonic-gate  * not to intellectual property embodied in modifications its licensee may
640Sstevel@tonic-gate  * make.
650Sstevel@tonic-gate  *
660Sstevel@tonic-gate  * 3.3. Redistribution of Executable. Redistribution in executable form of any
670Sstevel@tonic-gate  * substantial portion of the Covered Code or modification must reproduce the
680Sstevel@tonic-gate  * above Copyright Notice, and the following Disclaimer and Export Compliance
690Sstevel@tonic-gate  * provision in the documentation and/or other materials provided with the
700Sstevel@tonic-gate  * distribution.
710Sstevel@tonic-gate  *
720Sstevel@tonic-gate  * 3.4. Intel retains all right, title, and interest in and to the Original
730Sstevel@tonic-gate  * Intel Code.
740Sstevel@tonic-gate  *
750Sstevel@tonic-gate  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760Sstevel@tonic-gate  * Intel shall be used in advertising or otherwise to promote the sale, use or
770Sstevel@tonic-gate  * other dealings in products derived from or relating to the Covered Code
780Sstevel@tonic-gate  * without prior written authorization from Intel.
790Sstevel@tonic-gate  *
800Sstevel@tonic-gate  * 4. Disclaimer and Export Compliance
810Sstevel@tonic-gate  *
820Sstevel@tonic-gate  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830Sstevel@tonic-gate  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840Sstevel@tonic-gate  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
850Sstevel@tonic-gate  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
860Sstevel@tonic-gate  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
870Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880Sstevel@tonic-gate  * PARTICULAR PURPOSE.
890Sstevel@tonic-gate  *
900Sstevel@tonic-gate  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910Sstevel@tonic-gate  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920Sstevel@tonic-gate  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930Sstevel@tonic-gate  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940Sstevel@tonic-gate  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950Sstevel@tonic-gate  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
960Sstevel@tonic-gate  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970Sstevel@tonic-gate  * LIMITED REMEDY.
980Sstevel@tonic-gate  *
990Sstevel@tonic-gate  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000Sstevel@tonic-gate  * software or system incorporating such software without first obtaining any
1010Sstevel@tonic-gate  * required license or other approval from the U. S. Department of Commerce or
1020Sstevel@tonic-gate  * any other agency or department of the United States Government.  In the
1030Sstevel@tonic-gate  * event Licensee exports any such software from the United States or
1040Sstevel@tonic-gate  * re-exports any such software from a foreign destination, Licensee shall
1050Sstevel@tonic-gate  * ensure that the distribution and export/re-export of the software is in
1060Sstevel@tonic-gate  * compliance with all laws, regulations, orders, or other restrictions of the
1070Sstevel@tonic-gate  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080Sstevel@tonic-gate  * any of its subsidiaries will export/re-export any technical data, process,
1090Sstevel@tonic-gate  * software, or service, directly or indirectly, to any country for which the
1100Sstevel@tonic-gate  * United States government or any agency thereof requires an export license,
1110Sstevel@tonic-gate  * other governmental approval, or letter of assurance, without first obtaining
1120Sstevel@tonic-gate  * such license, approval or letter.
1130Sstevel@tonic-gate  *
1140Sstevel@tonic-gate  *****************************************************************************/
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate #ifndef __ACENV_H__
1170Sstevel@tonic-gate #define __ACENV_H__
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate /*
120*9980SDana.Myers@Sun.COM  * Environment configuration. The purpose of this file is to interface ACPICA
121*9980SDana.Myers@Sun.COM  * to the local environment. This includes compiler-specific, OS-specific,
122*9980SDana.Myers@Sun.COM  * and machine-specific configuration.
1230Sstevel@tonic-gate  */
1240Sstevel@tonic-gate 
125*9980SDana.Myers@Sun.COM /* Types for ACPI_MUTEX_TYPE */
126*9980SDana.Myers@Sun.COM 
127*9980SDana.Myers@Sun.COM #define ACPI_BINARY_SEMAPHORE       0
128*9980SDana.Myers@Sun.COM #define ACPI_OSL_MUTEX              1
129*9980SDana.Myers@Sun.COM 
130*9980SDana.Myers@Sun.COM /* Types for DEBUGGER_THREADING */
131*9980SDana.Myers@Sun.COM 
132*9980SDana.Myers@Sun.COM #define DEBUGGER_SINGLE_THREADED    0
133*9980SDana.Myers@Sun.COM #define DEBUGGER_MULTI_THREADED     1
134*9980SDana.Myers@Sun.COM 
135*9980SDana.Myers@Sun.COM 
136*9980SDana.Myers@Sun.COM /******************************************************************************
137*9980SDana.Myers@Sun.COM  *
138*9980SDana.Myers@Sun.COM  * Configuration for ACPI tools and utilities
139*9980SDana.Myers@Sun.COM  *
140*9980SDana.Myers@Sun.COM  *****************************************************************************/
141*9980SDana.Myers@Sun.COM 
142*9980SDana.Myers@Sun.COM /* iASL configuration */
143347Smyers 
144347Smyers #ifdef ACPI_ASL_COMPILER
1450Sstevel@tonic-gate #define ACPI_APPLICATION
1460Sstevel@tonic-gate #define ACPI_DISASSEMBLER
147*9980SDana.Myers@Sun.COM #define ACPI_DEBUG_OUTPUT
1480Sstevel@tonic-gate #define ACPI_CONSTANT_EVAL_ONLY
1492623Smyers #define ACPI_LARGE_NAMESPACE_NODE
1502623Smyers #define ACPI_DATA_TABLE_DISASSEMBLY
1512623Smyers #endif
1522623Smyers 
153*9980SDana.Myers@Sun.COM /* AcpiExec configuration */
154*9980SDana.Myers@Sun.COM 
1552623Smyers #ifdef ACPI_EXEC_APP
156*9980SDana.Myers@Sun.COM #define ACPI_APPLICATION
1572623Smyers #define ACPI_FULL_DEBUG
1582623Smyers #define ACPI_MUTEX_DEBUG
1592623Smyers #define ACPI_DBG_TRACK_ALLOCATIONS
1602623Smyers #endif
1612623Smyers 
162*9980SDana.Myers@Sun.COM /* Linkable ACPICA library */
163*9980SDana.Myers@Sun.COM 
164*9980SDana.Myers@Sun.COM #ifdef ACPI_LIBRARY
165*9980SDana.Myers@Sun.COM #define ACPI_USE_LOCAL_CACHE
1662623Smyers #endif
167*9980SDana.Myers@Sun.COM 
168*9980SDana.Myers@Sun.COM /* Common for all ACPICA applications */
169347Smyers 
170347Smyers #ifdef ACPI_APPLICATION
1710Sstevel@tonic-gate #define ACPI_USE_SYSTEM_CLIBRARY
172347Smyers #define ACPI_USE_LOCAL_CACHE
1730Sstevel@tonic-gate #endif
1740Sstevel@tonic-gate 
175*9980SDana.Myers@Sun.COM /* Common debug support */
176*9980SDana.Myers@Sun.COM 
1772623Smyers #ifdef ACPI_FULL_DEBUG
1782623Smyers #define ACPI_DEBUGGER
1792623Smyers #define ACPI_DEBUG_OUTPUT
1802623Smyers #define ACPI_DISASSEMBLER
1812623Smyers #endif
1822623Smyers 
1832623Smyers 
184*9980SDana.Myers@Sun.COM /*! [Begin] no source code translation */
185*9980SDana.Myers@Sun.COM 
186*9980SDana.Myers@Sun.COM /******************************************************************************
1870Sstevel@tonic-gate  *
188*9980SDana.Myers@Sun.COM  * Host configuration files. The compiler configuration files are included
189*9980SDana.Myers@Sun.COM  * by the host files.
1900Sstevel@tonic-gate  *
191*9980SDana.Myers@Sun.COM  *****************************************************************************/
1920Sstevel@tonic-gate 
1937851SDana.Myers@Sun.COM #if defined(_LINUX) || defined(__linux__)
1940Sstevel@tonic-gate #include "aclinux.h"
1950Sstevel@tonic-gate 
196*9980SDana.Myers@Sun.COM #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
197*9980SDana.Myers@Sun.COM #include "acfreebsd.h"
198*9980SDana.Myers@Sun.COM 
199*9980SDana.Myers@Sun.COM #elif defined(__NetBSD__)
200*9980SDana.Myers@Sun.COM #include "acnetbsd.h"
201*9980SDana.Myers@Sun.COM 
202*9980SDana.Myers@Sun.COM #elif defined(__sun)
203*9980SDana.Myers@Sun.COM #include "acsolaris.h"
204*9980SDana.Myers@Sun.COM 
205*9980SDana.Myers@Sun.COM #elif defined(MODESTO)
206*9980SDana.Myers@Sun.COM #include "acmodesto.h"
207*9980SDana.Myers@Sun.COM 
208*9980SDana.Myers@Sun.COM #elif defined(NETWARE)
209*9980SDana.Myers@Sun.COM #include "acnetware.h"
210*9980SDana.Myers@Sun.COM 
211*9980SDana.Myers@Sun.COM #elif defined(_CYGWIN)
212*9980SDana.Myers@Sun.COM #include "accygwin.h"
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate #elif defined(WIN32)
2150Sstevel@tonic-gate #include "acwin.h"
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate #elif defined(WIN64)
2180Sstevel@tonic-gate #include "acwin64.h"
2190Sstevel@tonic-gate 
220*9980SDana.Myers@Sun.COM #elif defined(_WRS_LIB_BUILD)
221*9980SDana.Myers@Sun.COM #include "acvxworks.h"
2220Sstevel@tonic-gate 
2237851SDana.Myers@Sun.COM #elif defined(__OS2__)
2247851SDana.Myers@Sun.COM #include "acos2.h"
2257851SDana.Myers@Sun.COM 
226*9980SDana.Myers@Sun.COM #elif defined(_AED_EFI)
227*9980SDana.Myers@Sun.COM #include "acefi.h"
228*9980SDana.Myers@Sun.COM 
2290Sstevel@tonic-gate #else
2300Sstevel@tonic-gate 
231*9980SDana.Myers@Sun.COM /* Unknown environment */
2320Sstevel@tonic-gate 
233*9980SDana.Myers@Sun.COM #error Unknown target environment
2340Sstevel@tonic-gate #endif
2350Sstevel@tonic-gate 
2360Sstevel@tonic-gate /*! [End] no source code translation !*/
2370Sstevel@tonic-gate 
2380Sstevel@tonic-gate 
239*9980SDana.Myers@Sun.COM /******************************************************************************
240*9980SDana.Myers@Sun.COM  *
241*9980SDana.Myers@Sun.COM  * Setup defaults for the required symbols that were not defined in one of
242*9980SDana.Myers@Sun.COM  * the host/compiler files above.
243*9980SDana.Myers@Sun.COM  *
244*9980SDana.Myers@Sun.COM  *****************************************************************************/
245*9980SDana.Myers@Sun.COM 
246*9980SDana.Myers@Sun.COM /* 64-bit data types */
247*9980SDana.Myers@Sun.COM 
248*9980SDana.Myers@Sun.COM #ifndef COMPILER_DEPENDENT_INT64
249*9980SDana.Myers@Sun.COM #define COMPILER_DEPENDENT_INT64   long long
250*9980SDana.Myers@Sun.COM #endif
251*9980SDana.Myers@Sun.COM 
252*9980SDana.Myers@Sun.COM #ifndef COMPILER_DEPENDENT_UINT64
253*9980SDana.Myers@Sun.COM #define COMPILER_DEPENDENT_UINT64  unsigned long long
254*9980SDana.Myers@Sun.COM #endif
255*9980SDana.Myers@Sun.COM 
256*9980SDana.Myers@Sun.COM /* Type of mutex supported by host. Default is binary semaphores. */
257*9980SDana.Myers@Sun.COM 
258*9980SDana.Myers@Sun.COM #ifndef ACPI_MUTEX_TYPE
259*9980SDana.Myers@Sun.COM #define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
260*9980SDana.Myers@Sun.COM #endif
261*9980SDana.Myers@Sun.COM 
262*9980SDana.Myers@Sun.COM /* Global Lock acquire/release */
263*9980SDana.Myers@Sun.COM 
264*9980SDana.Myers@Sun.COM #ifndef ACPI_ACQUIRE_GLOBAL_LOCK
265*9980SDana.Myers@Sun.COM #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) Acq = 1
266*9980SDana.Myers@Sun.COM #endif
267*9980SDana.Myers@Sun.COM 
268*9980SDana.Myers@Sun.COM #ifndef ACPI_RELEASE_GLOBAL_LOCK
269*9980SDana.Myers@Sun.COM #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) Acq = 0
270*9980SDana.Myers@Sun.COM #endif
271*9980SDana.Myers@Sun.COM 
272*9980SDana.Myers@Sun.COM /* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
273*9980SDana.Myers@Sun.COM 
274*9980SDana.Myers@Sun.COM #ifndef ACPI_FLUSH_CPU_CACHE
275*9980SDana.Myers@Sun.COM #define ACPI_FLUSH_CPU_CACHE()
276*9980SDana.Myers@Sun.COM #endif
277*9980SDana.Myers@Sun.COM 
278*9980SDana.Myers@Sun.COM /*
279*9980SDana.Myers@Sun.COM  * Configurable calling conventions:
280*9980SDana.Myers@Sun.COM  *
281*9980SDana.Myers@Sun.COM  * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
282*9980SDana.Myers@Sun.COM  * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
283*9980SDana.Myers@Sun.COM  * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
284*9980SDana.Myers@Sun.COM  * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
285*9980SDana.Myers@Sun.COM  */
286*9980SDana.Myers@Sun.COM #ifndef ACPI_SYSTEM_XFACE
287*9980SDana.Myers@Sun.COM #define ACPI_SYSTEM_XFACE
288*9980SDana.Myers@Sun.COM #endif
289*9980SDana.Myers@Sun.COM 
290*9980SDana.Myers@Sun.COM #ifndef ACPI_EXTERNAL_XFACE
291*9980SDana.Myers@Sun.COM #define ACPI_EXTERNAL_XFACE
292*9980SDana.Myers@Sun.COM #endif
293*9980SDana.Myers@Sun.COM 
294*9980SDana.Myers@Sun.COM #ifndef ACPI_INTERNAL_XFACE
295*9980SDana.Myers@Sun.COM #define ACPI_INTERNAL_XFACE
296*9980SDana.Myers@Sun.COM #endif
297*9980SDana.Myers@Sun.COM 
298*9980SDana.Myers@Sun.COM #ifndef ACPI_INTERNAL_VAR_XFACE
299*9980SDana.Myers@Sun.COM #define ACPI_INTERNAL_VAR_XFACE
300*9980SDana.Myers@Sun.COM #endif
301*9980SDana.Myers@Sun.COM 
3020Sstevel@tonic-gate /*
3030Sstevel@tonic-gate  * Debugger threading model
3040Sstevel@tonic-gate  * Use single threaded if the entire subsystem is contained in an application
3050Sstevel@tonic-gate  * Use multiple threaded when the subsystem is running in the kernel.
3060Sstevel@tonic-gate  *
3070Sstevel@tonic-gate  * By default the model is single threaded if ACPI_APPLICATION is set,
3080Sstevel@tonic-gate  * multi-threaded if ACPI_APPLICATION is not set.
3090Sstevel@tonic-gate  */
3100Sstevel@tonic-gate #ifndef DEBUGGER_THREADING
3110Sstevel@tonic-gate #ifdef ACPI_APPLICATION
3120Sstevel@tonic-gate #define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate #else
3150Sstevel@tonic-gate #define DEBUGGER_THREADING          DEBUGGER_MULTI_THREADED
3160Sstevel@tonic-gate #endif
3170Sstevel@tonic-gate #endif /* !DEBUGGER_THREADING */
3180Sstevel@tonic-gate 
3190Sstevel@tonic-gate 
3200Sstevel@tonic-gate /******************************************************************************
3210Sstevel@tonic-gate  *
3220Sstevel@tonic-gate  * C library configuration
3230Sstevel@tonic-gate  *
3240Sstevel@tonic-gate  *****************************************************************************/
3250Sstevel@tonic-gate 
326*9980SDana.Myers@Sun.COM /*
327*9980SDana.Myers@Sun.COM  * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
328*9980SDana.Myers@Sun.COM  *      Otherwise, local versions of string/memory functions will be used.
329*9980SDana.Myers@Sun.COM  * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
330*9980SDana.Myers@Sun.COM  *      the standard header files may be used.
331*9980SDana.Myers@Sun.COM  *
332*9980SDana.Myers@Sun.COM  * The ACPICA subsystem only uses low level C library functions that do not call
333*9980SDana.Myers@Sun.COM  * operating system services and may therefore be inlined in the code.
334*9980SDana.Myers@Sun.COM  *
335*9980SDana.Myers@Sun.COM  * It may be necessary to tailor these include files to the target
336*9980SDana.Myers@Sun.COM  * generation environment.
337*9980SDana.Myers@Sun.COM  */
3380Sstevel@tonic-gate #ifdef ACPI_USE_SYSTEM_CLIBRARY
339*9980SDana.Myers@Sun.COM 
340*9980SDana.Myers@Sun.COM /* Use the standard C library headers. We want to keep these to a minimum */
341*9980SDana.Myers@Sun.COM 
3420Sstevel@tonic-gate #ifdef ACPI_USE_STANDARD_HEADERS
343*9980SDana.Myers@Sun.COM 
344*9980SDana.Myers@Sun.COM /* Use the standard headers from the standard locations */
345*9980SDana.Myers@Sun.COM 
3460Sstevel@tonic-gate #include <stdarg.h>
3470Sstevel@tonic-gate #include <stdlib.h>
3480Sstevel@tonic-gate #include <string.h>
3490Sstevel@tonic-gate #include <ctype.h>
3500Sstevel@tonic-gate 
3510Sstevel@tonic-gate #endif /* ACPI_USE_STANDARD_HEADERS */
3520Sstevel@tonic-gate 
353*9980SDana.Myers@Sun.COM /* We will be linking to the standard Clib functions */
354*9980SDana.Myers@Sun.COM 
3550Sstevel@tonic-gate #define ACPI_STRSTR(s1,s2)      strstr((s1), (s2))
3560Sstevel@tonic-gate #define ACPI_STRCHR(s1,c)       strchr((s1), (c))
3570Sstevel@tonic-gate #define ACPI_STRLEN(s)          (ACPI_SIZE) strlen((s))
3580Sstevel@tonic-gate #define ACPI_STRCPY(d,s)        (void) strcpy((d), (s))
3590Sstevel@tonic-gate #define ACPI_STRNCPY(d,s,n)     (void) strncpy((d), (s), (ACPI_SIZE)(n))
3600Sstevel@tonic-gate #define ACPI_STRNCMP(d,s,n)     strncmp((d), (s), (ACPI_SIZE)(n))
3610Sstevel@tonic-gate #define ACPI_STRCMP(d,s)        strcmp((d), (s))
3620Sstevel@tonic-gate #define ACPI_STRCAT(d,s)        (void) strcat((d), (s))
3630Sstevel@tonic-gate #define ACPI_STRNCAT(d,s,n)     strncat((d), (s), (ACPI_SIZE)(n))
3640Sstevel@tonic-gate #define ACPI_STRTOUL(d,s,n)     strtoul((d), (s), (ACPI_SIZE)(n))
3651560Smyers #define ACPI_MEMCMP(s1,s2,n)    memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n))
3660Sstevel@tonic-gate #define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (ACPI_SIZE)(n))
3670Sstevel@tonic-gate #define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (ACPI_SIZE)(n))
368941Smyers #define ACPI_TOUPPER(i)         toupper((int) (i))
369941Smyers #define ACPI_TOLOWER(i)         tolower((int) (i))
370941Smyers #define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
371941Smyers #define ACPI_IS_DIGIT(i)        isdigit((int) (i))
372941Smyers #define ACPI_IS_SPACE(i)        isspace((int) (i))
373941Smyers #define ACPI_IS_UPPER(i)        isupper((int) (i))
374941Smyers #define ACPI_IS_PRINT(i)        isprint((int) (i))
375941Smyers #define ACPI_IS_ALPHA(i)        isalpha((int) (i))
3760Sstevel@tonic-gate 
3770Sstevel@tonic-gate #else
3780Sstevel@tonic-gate 
3790Sstevel@tonic-gate /******************************************************************************
3800Sstevel@tonic-gate  *
3810Sstevel@tonic-gate  * Not using native C library, use local implementations
3820Sstevel@tonic-gate  *
3830Sstevel@tonic-gate  *****************************************************************************/
3840Sstevel@tonic-gate 
385*9980SDana.Myers@Sun.COM /*
386*9980SDana.Myers@Sun.COM  * Use local definitions of C library macros and functions. These function
387*9980SDana.Myers@Sun.COM  * implementations may not be as efficient as an inline or assembly code
388*9980SDana.Myers@Sun.COM  * implementation provided by a native C library, but they are functionally
389*9980SDana.Myers@Sun.COM  * equivalent.
3900Sstevel@tonic-gate  */
3910Sstevel@tonic-gate #ifndef va_arg
3920Sstevel@tonic-gate 
3930Sstevel@tonic-gate #ifndef _VALIST
3940Sstevel@tonic-gate #define _VALIST
3950Sstevel@tonic-gate typedef char *va_list;
3960Sstevel@tonic-gate #endif /* _VALIST */
3970Sstevel@tonic-gate 
398*9980SDana.Myers@Sun.COM /* Storage alignment properties */
399*9980SDana.Myers@Sun.COM 
4000Sstevel@tonic-gate #define  _AUPBND                (sizeof (ACPI_NATIVE_INT) - 1)
4010Sstevel@tonic-gate #define  _ADNBND                (sizeof (ACPI_NATIVE_INT) - 1)
4020Sstevel@tonic-gate 
403*9980SDana.Myers@Sun.COM /* Variable argument list macro definitions */
404*9980SDana.Myers@Sun.COM 
4050Sstevel@tonic-gate #define _Bnd(X, bnd)            (((sizeof (X)) + (bnd)) & (~(bnd)))
4060Sstevel@tonic-gate #define va_arg(ap, T)           (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
4070Sstevel@tonic-gate #define va_end(ap)              (void) 0
4080Sstevel@tonic-gate #define va_start(ap, A)         (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND))))
4090Sstevel@tonic-gate 
4100Sstevel@tonic-gate #endif /* va_arg */
4110Sstevel@tonic-gate 
412*9980SDana.Myers@Sun.COM /* Use the local (ACPICA) definitions of the clib functions */
4130Sstevel@tonic-gate 
4140Sstevel@tonic-gate #define ACPI_STRSTR(s1,s2)      AcpiUtStrstr ((s1), (s2))
4150Sstevel@tonic-gate #define ACPI_STRCHR(s1,c)       AcpiUtStrchr ((s1), (c))
4160Sstevel@tonic-gate #define ACPI_STRLEN(s)          (ACPI_SIZE) AcpiUtStrlen ((s))
4170Sstevel@tonic-gate #define ACPI_STRCPY(d,s)        (void) AcpiUtStrcpy ((d), (s))
4180Sstevel@tonic-gate #define ACPI_STRNCPY(d,s,n)     (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n))
4190Sstevel@tonic-gate #define ACPI_STRNCMP(d,s,n)     AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n))
4200Sstevel@tonic-gate #define ACPI_STRCMP(d,s)        AcpiUtStrcmp ((d), (s))
4210Sstevel@tonic-gate #define ACPI_STRCAT(d,s)        (void) AcpiUtStrcat ((d), (s))
4220Sstevel@tonic-gate #define ACPI_STRNCAT(d,s,n)     AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n))
4230Sstevel@tonic-gate #define ACPI_STRTOUL(d,s,n)     AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n))
4241560Smyers #define ACPI_MEMCMP(s1,s2,n)    AcpiUtMemcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n))
4250Sstevel@tonic-gate #define ACPI_MEMCPY(d,s,n)      (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n))
4260Sstevel@tonic-gate #define ACPI_MEMSET(d,v,n)      (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n))
4270Sstevel@tonic-gate #define ACPI_TOUPPER            AcpiUtToUpper
4280Sstevel@tonic-gate #define ACPI_TOLOWER            AcpiUtToLower
4290Sstevel@tonic-gate 
4300Sstevel@tonic-gate #endif /* ACPI_USE_SYSTEM_CLIBRARY */
4310Sstevel@tonic-gate 
4320Sstevel@tonic-gate #endif /* __ACENV_H__ */
433