17c478bd9Sstevel@tonic-gate /******************************************************************************
27c478bd9Sstevel@tonic-gate  *
3*db2bae30SDana Myers  * Name: acos2.h - OS/2 specific defines, etc.
4*db2bae30SDana Myers  *       $Revision: 1.0 $
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  *****************************************************************************/
77c478bd9Sstevel@tonic-gate 
87c478bd9Sstevel@tonic-gate /******************************************************************************
97c478bd9Sstevel@tonic-gate  *
107c478bd9Sstevel@tonic-gate  * 1. Copyright Notice
117c478bd9Sstevel@tonic-gate  *
12*db2bae30SDana Myers  * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
137c478bd9Sstevel@tonic-gate  * All rights reserved.
147c478bd9Sstevel@tonic-gate  *
157c478bd9Sstevel@tonic-gate  * 2. License
167c478bd9Sstevel@tonic-gate  *
177c478bd9Sstevel@tonic-gate  * 2.1. This is your license from Intel Corp. under its intellectual property
187c478bd9Sstevel@tonic-gate  * rights.  You may have additional license terms from the party that provided
197c478bd9Sstevel@tonic-gate  * you this software, covering your right to use that party's intellectual
207c478bd9Sstevel@tonic-gate  * property rights.
217c478bd9Sstevel@tonic-gate  *
227c478bd9Sstevel@tonic-gate  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
237c478bd9Sstevel@tonic-gate  * copy of the source code appearing in this file ("Covered Code") an
247c478bd9Sstevel@tonic-gate  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
257c478bd9Sstevel@tonic-gate  * base code distributed originally by Intel ("Original Intel Code") to copy,
267c478bd9Sstevel@tonic-gate  * make derivatives, distribute, use and display any portion of the Covered
277c478bd9Sstevel@tonic-gate  * Code in any form, with the right to sublicense such rights; and
287c478bd9Sstevel@tonic-gate  *
297c478bd9Sstevel@tonic-gate  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
307c478bd9Sstevel@tonic-gate  * license (with the right to sublicense), under only those claims of Intel
317c478bd9Sstevel@tonic-gate  * patents that are infringed by the Original Intel Code, to make, use, sell,
327c478bd9Sstevel@tonic-gate  * offer to sell, and import the Covered Code and derivative works thereof
337c478bd9Sstevel@tonic-gate  * solely to the minimum extent necessary to exercise the above copyright
347c478bd9Sstevel@tonic-gate  * license, and in no event shall the patent license extend to any additions
357c478bd9Sstevel@tonic-gate  * to or modifications of the Original Intel Code.  No other license or right
367c478bd9Sstevel@tonic-gate  * is granted directly or by implication, estoppel or otherwise;
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  * The above copyright and patent license is granted only if the following
397c478bd9Sstevel@tonic-gate  * conditions are met:
407c478bd9Sstevel@tonic-gate  *
417c478bd9Sstevel@tonic-gate  * 3. Conditions
427c478bd9Sstevel@tonic-gate  *
437c478bd9Sstevel@tonic-gate  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
447c478bd9Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
457c478bd9Sstevel@tonic-gate  * Code or modification with rights to further distribute source must include
467c478bd9Sstevel@tonic-gate  * the above Copyright Notice, the above License, this list of Conditions,
477c478bd9Sstevel@tonic-gate  * and the following Disclaimer and Export Compliance provision.  In addition,
487c478bd9Sstevel@tonic-gate  * Licensee must cause all Covered Code to which Licensee contributes to
497c478bd9Sstevel@tonic-gate  * contain a file documenting the changes Licensee made to create that Covered
507c478bd9Sstevel@tonic-gate  * Code and the date of any change.  Licensee must include in that file the
517c478bd9Sstevel@tonic-gate  * documentation of any changes made by any predecessor Licensee.  Licensee
527c478bd9Sstevel@tonic-gate  * must include a prominent statement that the modification is derived,
537c478bd9Sstevel@tonic-gate  * directly or indirectly, from Original Intel Code.
547c478bd9Sstevel@tonic-gate  *
557c478bd9Sstevel@tonic-gate  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
567c478bd9Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
577c478bd9Sstevel@tonic-gate  * Code or modification without rights to further distribute source must
587c478bd9Sstevel@tonic-gate  * include the following Disclaimer and Export Compliance provision in the
597c478bd9Sstevel@tonic-gate  * documentation and/or other materials provided with distribution.  In
607c478bd9Sstevel@tonic-gate  * addition, Licensee may not authorize further sublicense of source of any
617c478bd9Sstevel@tonic-gate  * portion of the Covered Code, and must include terms to the effect that the
627c478bd9Sstevel@tonic-gate  * license from Licensee to its licensee is limited to the intellectual
637c478bd9Sstevel@tonic-gate  * property embodied in the software Licensee provides to its licensee, and
647c478bd9Sstevel@tonic-gate  * not to intellectual property embodied in modifications its licensee may
657c478bd9Sstevel@tonic-gate  * make.
667c478bd9Sstevel@tonic-gate  *
677c478bd9Sstevel@tonic-gate  * 3.3. Redistribution of Executable. Redistribution in executable form of any
687c478bd9Sstevel@tonic-gate  * substantial portion of the Covered Code or modification must reproduce the
697c478bd9Sstevel@tonic-gate  * above Copyright Notice, and the following Disclaimer and Export Compliance
707c478bd9Sstevel@tonic-gate  * provision in the documentation and/or other materials provided with the
717c478bd9Sstevel@tonic-gate  * distribution.
727c478bd9Sstevel@tonic-gate  *
737c478bd9Sstevel@tonic-gate  * 3.4. Intel retains all right, title, and interest in and to the Original
747c478bd9Sstevel@tonic-gate  * Intel Code.
757c478bd9Sstevel@tonic-gate  *
767c478bd9Sstevel@tonic-gate  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
777c478bd9Sstevel@tonic-gate  * Intel shall be used in advertising or otherwise to promote the sale, use or
787c478bd9Sstevel@tonic-gate  * other dealings in products derived from or relating to the Covered Code
797c478bd9Sstevel@tonic-gate  * without prior written authorization from Intel.
807c478bd9Sstevel@tonic-gate  *
817c478bd9Sstevel@tonic-gate  * 4. Disclaimer and Export Compliance
827c478bd9Sstevel@tonic-gate  *
837c478bd9Sstevel@tonic-gate  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
847c478bd9Sstevel@tonic-gate  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
857c478bd9Sstevel@tonic-gate  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
867c478bd9Sstevel@tonic-gate  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
877c478bd9Sstevel@tonic-gate  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
887c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
897c478bd9Sstevel@tonic-gate  * PARTICULAR PURPOSE.
907c478bd9Sstevel@tonic-gate  *
917c478bd9Sstevel@tonic-gate  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
927c478bd9Sstevel@tonic-gate  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
937c478bd9Sstevel@tonic-gate  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
947c478bd9Sstevel@tonic-gate  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
957c478bd9Sstevel@tonic-gate  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
967c478bd9Sstevel@tonic-gate  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
977c478bd9Sstevel@tonic-gate  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
987c478bd9Sstevel@tonic-gate  * LIMITED REMEDY.
997c478bd9Sstevel@tonic-gate  *
1007c478bd9Sstevel@tonic-gate  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1017c478bd9Sstevel@tonic-gate  * software or system incorporating such software without first obtaining any
1027c478bd9Sstevel@tonic-gate  * required license or other approval from the U. S. Department of Commerce or
1037c478bd9Sstevel@tonic-gate  * any other agency or department of the United States Government.  In the
1047c478bd9Sstevel@tonic-gate  * event Licensee exports any such software from the United States or
1057c478bd9Sstevel@tonic-gate  * re-exports any such software from a foreign destination, Licensee shall
1067c478bd9Sstevel@tonic-gate  * ensure that the distribution and export/re-export of the software is in
1077c478bd9Sstevel@tonic-gate  * compliance with all laws, regulations, orders, or other restrictions of the
1087c478bd9Sstevel@tonic-gate  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1097c478bd9Sstevel@tonic-gate  * any of its subsidiaries will export/re-export any technical data, process,
1107c478bd9Sstevel@tonic-gate  * software, or service, directly or indirectly, to any country for which the
1117c478bd9Sstevel@tonic-gate  * United States government or any agency thereof requires an export license,
1127c478bd9Sstevel@tonic-gate  * other governmental approval, or letter of assurance, without first obtaining
1137c478bd9Sstevel@tonic-gate  * such license, approval or letter.
1147c478bd9Sstevel@tonic-gate  *
1157c478bd9Sstevel@tonic-gate  *****************************************************************************/
1167c478bd9Sstevel@tonic-gate 
117*db2bae30SDana Myers #ifndef __ACOS2_H__
118*db2bae30SDana Myers #define __ACOS2_H__
119*db2bae30SDana Myers #define INCL_LONGLONG
120*db2bae30SDana Myers #include <os2.h>
121*db2bae30SDana Myers 
122*db2bae30SDana Myers 
123*db2bae30SDana Myers #define ACPI_MACHINE_WIDTH          32
124*db2bae30SDana Myers 
125*db2bae30SDana Myers #define COMPILER_DEPENDENT_INT64    long long
126*db2bae30SDana Myers #define COMPILER_DEPENDENT_UINT64   unsigned long long
127*db2bae30SDana Myers #define ACPI_USE_NATIVE_DIVIDE
128*db2bae30SDana Myers 
129*db2bae30SDana Myers #define ACPI_SYSTEM_XFACE           APIENTRY
130*db2bae30SDana Myers #define ACPI_EXTERNAL_XFACE         APIENTRY
131*db2bae30SDana Myers #define ACPI_INTERNAL_XFACE         APIENTRY
132*db2bae30SDana Myers #define ACPI_INTERNAL_VAR_XFACE     APIENTRY
133*db2bae30SDana Myers 
134*db2bae30SDana Myers /*
135*db2bae30SDana Myers  * Some compilers complain about unused variables. Sometimes we don't want to
136*db2bae30SDana Myers  * use all the variables (most specifically for _THIS_MODULE). This allow us
137*db2bae30SDana Myers  * to to tell the compiler warning in a per-variable manner that a variable
138*db2bae30SDana Myers  * is unused.
139*db2bae30SDana Myers  */
140*db2bae30SDana Myers #define ACPI_UNUSED_VAR
141*db2bae30SDana Myers 
142*db2bae30SDana Myers #define ACPI_USE_STANDARD_HEADERS
143*db2bae30SDana Myers #include <io.h>
144*db2bae30SDana Myers 
145*db2bae30SDana Myers #define ACPI_ASM_MACROS
146*db2bae30SDana Myers 
147*db2bae30SDana Myers #define BREAKPOINT3            __interrupt(3)
148*db2bae30SDana Myers #define ACPI_DISABLE_IRQS()    __disable()
149*db2bae30SDana Myers #define ACPI_ENABLE_IRQS()     __enable()
150*db2bae30SDana Myers #define ACPI_FLUSH_CPU_CACHE() Wbinvd()
151*db2bae30SDana Myers void Wbinvd(void);
152*db2bae30SDana Myers 
153*db2bae30SDana Myers #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)       Acq = OSPMAcquireGlobalLock(GLptr)
154*db2bae30SDana Myers #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd)       Pnd = OSPMReleaseGlobalLock(GLptr)
155*db2bae30SDana Myers unsigned short OSPMAcquireGlobalLock (void *);
156*db2bae30SDana Myers unsigned short OSPMReleaseGlobalLock (void *);
157*db2bae30SDana Myers 
158*db2bae30SDana Myers #define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
159*db2bae30SDana Myers { \
160*db2bae30SDana Myers     unsigned long long val = 0LL; \
161*db2bae30SDana Myers     val = n_lo | ( ((unsigned long long)h_hi) << 32 ); \
162*db2bae30SDana Myers     __llrotr (val,1); \
163*db2bae30SDana Myers     n_hi = (unsigned long)((val >> 32 ) & 0xffffffff ); \
164*db2bae30SDana Myers     n_lo = (unsigned long)(val & 0xffffffff); \
165*db2bae30SDana Myers }
1667c478bd9Sstevel@tonic-gate 
167*db2bae30SDana Myers /* IBM VAC does not have inline */
1687c478bd9Sstevel@tonic-gate 
169*db2bae30SDana Myers #if __IBMC__ || __IBMCPP__
170*db2bae30SDana Myers #define inline
171*db2bae30SDana Myers #endif
1727c478bd9Sstevel@tonic-gate 
173*db2bae30SDana Myers #ifndef ACPI_ASL_COMPILER
174*db2bae30SDana Myers #define ACPI_USE_LOCAL_CACHE
175*db2bae30SDana Myers #undef ACPI_DEBUGGER
176*db2bae30SDana Myers #endif
1777c478bd9Sstevel@tonic-gate 
178*db2bae30SDana Myers #endif /* __ACOS2_H__ */
179