17c478bdstevel@tonic-gate/******************************************************************************
27c478bdstevel@tonic-gate *
37c478bdstevel@tonic-gate * Name: acgcc.h - GCC specific defines, etc.
47c478bdstevel@tonic-gate *
57c478bdstevel@tonic-gate *****************************************************************************/
67c478bdstevel@tonic-gate
735786f6Robert Mustacchi/******************************************************************************
835786f6Robert Mustacchi *
935786f6Robert Mustacchi * 1. Copyright Notice
1035786f6Robert Mustacchi *
1135786f6Robert Mustacchi * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
127c478bdstevel@tonic-gate * All rights reserved.
137c478bdstevel@tonic-gate *
1435786f6Robert Mustacchi * 2. License
1535786f6Robert Mustacchi *
1635786f6Robert Mustacchi * 2.1. This is your license from Intel Corp. under its intellectual property
1735786f6Robert Mustacchi * rights. You may have additional license terms from the party that provided
1835786f6Robert Mustacchi * you this software, covering your right to use that party's intellectual
1935786f6Robert Mustacchi * property rights.
2035786f6Robert Mustacchi *
2135786f6Robert Mustacchi * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2235786f6Robert Mustacchi * copy of the source code appearing in this file ("Covered Code") an
2335786f6Robert Mustacchi * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2435786f6Robert Mustacchi * base code distributed originally by Intel ("Original Intel Code") to copy,
2535786f6Robert Mustacchi * make derivatives, distribute, use and display any portion of the Covered
2635786f6Robert Mustacchi * Code in any form, with the right to sublicense such rights; and
2735786f6Robert Mustacchi *
2835786f6Robert Mustacchi * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
2935786f6Robert Mustacchi * license (with the right to sublicense), under only those claims of Intel
3035786f6Robert Mustacchi * patents that are infringed by the Original Intel Code, to make, use, sell,
3135786f6Robert Mustacchi * offer to sell, and import the Covered Code and derivative works thereof
3235786f6Robert Mustacchi * solely to the minimum extent necessary to exercise the above copyright
3335786f6Robert Mustacchi * license, and in no event shall the patent license extend to any additions
3435786f6Robert Mustacchi * to or modifications of the Original Intel Code. No other license or right
3535786f6Robert Mustacchi * is granted directly or by implication, estoppel or otherwise;
3635786f6Robert Mustacchi *
3735786f6Robert Mustacchi * The above copyright and patent license is granted only if the following
3835786f6Robert Mustacchi * conditions are met:
3935786f6Robert Mustacchi *
4035786f6Robert Mustacchi * 3. Conditions
4135786f6Robert Mustacchi *
4235786f6Robert Mustacchi * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4335786f6Robert Mustacchi * Redistribution of source code of any substantial portion of the Covered
4435786f6Robert Mustacchi * Code or modification with rights to further distribute source must include
4535786f6Robert Mustacchi * the above Copyright Notice, the above License, this list of Conditions,
4635786f6Robert Mustacchi * and the following Disclaimer and Export Compliance provision. In addition,
4735786f6Robert Mustacchi * Licensee must cause all Covered Code to which Licensee contributes to
4835786f6Robert Mustacchi * contain a file documenting the changes Licensee made to create that Covered
4935786f6Robert Mustacchi * Code and the date of any change. Licensee must include in that file the
5035786f6Robert Mustacchi * documentation of any changes made by any predecessor Licensee. Licensee
5135786f6Robert Mustacchi * must include a prominent statement that the modification is derived,
5235786f6Robert Mustacchi * directly or indirectly, from Original Intel Code.
5335786f6Robert Mustacchi *
5435786f6Robert Mustacchi * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5535786f6Robert Mustacchi * Redistribution of source code of any substantial portion of the Covered
5635786f6Robert Mustacchi * Code or modification without rights to further distribute source must
5735786f6Robert Mustacchi * include the following Disclaimer and Export Compliance provision in the
5835786f6Robert Mustacchi * documentation and/or other materials provided with distribution. In
5935786f6Robert Mustacchi * addition, Licensee may not authorize further sublicense of source of any
6035786f6Robert Mustacchi * portion of the Covered Code, and must include terms to the effect that the
6135786f6Robert Mustacchi * license from Licensee to its licensee is limited to the intellectual
6235786f6Robert Mustacchi * property embodied in the software Licensee provides to its licensee, and
6335786f6Robert Mustacchi * not to intellectual property embodied in modifications its licensee may
6435786f6Robert Mustacchi * make.
6535786f6Robert Mustacchi *
6635786f6Robert Mustacchi * 3.3. Redistribution of Executable. Redistribution in executable form of any
6735786f6Robert Mustacchi * substantial portion of the Covered Code or modification must reproduce the
6835786f6Robert Mustacchi * above Copyright Notice, and the following Disclaimer and Export Compliance
6935786f6Robert Mustacchi * provision in the documentation and/or other materials provided with the
7035786f6Robert Mustacchi * distribution.
7135786f6Robert Mustacchi *
7235786f6Robert Mustacchi * 3.4. Intel retains all right, title, and interest in and to the Original
7335786f6Robert Mustacchi * Intel Code.
7435786f6Robert Mustacchi *
7535786f6Robert Mustacchi * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7635786f6Robert Mustacchi * Intel shall be used in advertising or otherwise to promote the sale, use or
7735786f6Robert Mustacchi * other dealings in products derived from or relating to the Covered Code
7835786f6Robert Mustacchi * without prior written authorization from Intel.
7935786f6Robert Mustacchi *
8035786f6Robert Mustacchi * 4. Disclaimer and Export Compliance
8135786f6Robert Mustacchi *
8235786f6Robert Mustacchi * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8335786f6Robert Mustacchi * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8435786f6Robert Mustacchi * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
8535786f6Robert Mustacchi * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
8635786f6Robert Mustacchi * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
8735786f6Robert Mustacchi * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8835786f6Robert Mustacchi * PARTICULAR PURPOSE.
8935786f6Robert Mustacchi *
9035786f6Robert Mustacchi * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9135786f6Robert Mustacchi * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9235786f6Robert Mustacchi * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9335786f6Robert Mustacchi * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9435786f6Robert Mustacchi * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9535786f6Robert Mustacchi * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
9635786f6Robert Mustacchi * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9735786f6Robert Mustacchi * LIMITED REMEDY.
9835786f6Robert Mustacchi *
9935786f6Robert Mustacchi * 4.3. Licensee shall not export, either directly or indirectly, any of this
10035786f6Robert Mustacchi * software or system incorporating such software without first obtaining any
10135786f6Robert Mustacchi * required license or other approval from the U. S. Department of Commerce or
10235786f6Robert Mustacchi * any other agency or department of the United States Government. In the
10335786f6Robert Mustacchi * event Licensee exports any such software from the United States or
10435786f6Robert Mustacchi * re-exports any such software from a foreign destination, Licensee shall
10535786f6Robert Mustacchi * ensure that the distribution and export/re-export of the software is in
10635786f6Robert Mustacchi * compliance with all laws, regulations, orders, or other restrictions of the
10735786f6Robert Mustacchi * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10835786f6Robert Mustacchi * any of its subsidiaries will export/re-export any technical data, process,
10935786f6Robert Mustacchi * software, or service, directly or indirectly, to any country for which the
11035786f6Robert Mustacchi * United States government or any agency thereof requires an export license,
11135786f6Robert Mustacchi * other governmental approval, or letter of assurance, without first obtaining
11235786f6Robert Mustacchi * such license, approval or letter.
11335786f6Robert Mustacchi *
11435786f6Robert Mustacchi *****************************************************************************
11535786f6Robert Mustacchi *
11635786f6Robert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
11735786f6Robert Mustacchi * following license:
11835786f6Robert Mustacchi *
11926f3cdfGordon Ross * Redistribution and use in source and binary forms, with or without
12026f3cdfGordon Ross * modification, are permitted provided that the following conditions
12126f3cdfGordon Ross * are met:
12226f3cdfGordon Ross * 1. Redistributions of source code must retain the above copyright
12326f3cdfGordon Ross *    notice, this list of conditions, and the following disclaimer,
12426f3cdfGordon Ross *    without modification.
12526f3cdfGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12626f3cdfGordon Ross *    substantially similar to the "NO WARRANTY" disclaimer below
12726f3cdfGordon Ross *    ("Disclaimer") and any redistribution must be conditioned upon
12826f3cdfGordon Ross *    including a substantially similar Disclaimer requirement for further
12926f3cdfGordon Ross *    binary redistribution.
13026f3cdfGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
13126f3cdfGordon Ross *    of any contributors may be used to endorse or promote products derived
13226f3cdfGordon Ross *    from this software without specific prior written permission.
13326f3cdfGordon Ross *
13426f3cdfGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13526f3cdfGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13635786f6Robert Mustacchi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13726f3cdfGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
13835786f6Robert Mustacchi * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
13935786f6Robert Mustacchi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14035786f6Robert Mustacchi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14135786f6Robert Mustacchi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14235786f6Robert Mustacchi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14335786f6Robert Mustacchi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14435786f6Robert Mustacchi * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14535786f6Robert Mustacchi *
14635786f6Robert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
14735786f6Robert Mustacchi * GNU General Public License ("GPL") version 2 as published by the Free
14835786f6Robert Mustacchi * Software Foundation.
14935786f6Robert Mustacchi *
15035786f6Robert Mustacchi *****************************************************************************/
1517c478bdstevel@tonic-gate
1527c478bdstevel@tonic-gate#ifndef __ACGCC_H__
1537c478bdstevel@tonic-gate#define __ACGCC_H__
1547c478bdstevel@tonic-gate
15535786f6Robert Mustacchi/*
15635786f6Robert Mustacchi * Use compiler specific <stdarg.h> is a good practice for even when
15735786f6Robert Mustacchi * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
15835786f6Robert Mustacchi */
15935786f6Robert Mustacchi#ifndef va_arg
16035786f6Robert Mustacchi#ifdef ACPI_USE_BUILTIN_STDARG
16135786f6Robert Mustacchitypedef __builtin_va_list       va_list;
16235786f6Robert Mustacchi#define va_start(v, l)          __builtin_va_start(v, l)
16335786f6Robert Mustacchi#define va_end(v)               __builtin_va_end(v)
16435786f6Robert Mustacchi#define va_arg(v, l)            __builtin_va_arg(v, l)
16535786f6Robert Mustacchi#define va_copy(d, s)           __builtin_va_copy(d, s)
16635786f6Robert Mustacchi#else
16735786f6Robert Mustacchi#ifdef	_KERNEL
16835786f6Robert Mustacchi#include <sys/va_list.h>
16935786f6Robert Mustacchi#else
17035786f6Robert Mustacchi#include <stdarg.h>
17135786f6Robert Mustacchi#endif	/* _KERNEL */
17235786f6Robert Mustacchi#endif
17335786f6Robert Mustacchi#endif
17435786f6Robert Mustacchi
17526f3cdfGordon Ross#define ACPI_INLINE             __inline__
17626f3cdfGordon Ross
177450d696myers/* Function name is used for debug output. Non-ANSI, compiler-dependent */
178450d696myers
1797b1019aJerry Jelinek#define ACPI_GET_FUNCTION_NAME          __func__
180450d696myers
18130082d0myers/*
18230082d0myers * This macro is used to tag functions as "printf-like" because
1837c478bdstevel@tonic-gate * some compilers (like GCC) can catch printf format string problems.
1847c478bdstevel@tonic-gate */
18530082d0myers#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))
1867c478bdstevel@tonic-gate
18730082d0myers/*
18830082d0myers * Some compilers complain about unused variables. Sometimes we don't want to
189450d696myers * use all the variables (for example, _AcpiModuleName). This allows us
1907b1019aJerry Jelinek * to tell the compiler warning in a per-variable manner that a variable
1917c478bdstevel@tonic-gate * is unused.
1927c478bdstevel@tonic-gate */
1937c478bdstevel@tonic-gate#define ACPI_UNUSED_VAR __attribute__ ((unused))
1947c478bdstevel@tonic-gate
1957b1019aJerry Jelinek/* GCC supports __VA_ARGS__ in macros */
1967b1019aJerry Jelinek
1977b1019aJerry Jelinek#define COMPILER_VA_MACRO               1
1987b1019aJerry Jelinek
19935786f6Robert Mustacchi/* GCC supports native multiply/shift on 32-bit platforms */
20035786f6Robert Mustacchi
20135786f6Robert Mustacchi#define ACPI_USE_NATIVE_MATH64
20235786f6Robert Mustacchi
2037c478bdstevel@tonic-gate#endif /* __ACGCC_H__ */
204