Path: blob/main/sys/contrib/dev/acpica/compiler/asldefine.h
48373 views
/******************************************************************************1*2* Module Name: asldefine.h - Common defines for the iASL compiler3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#ifndef __ASLDEFINE_H152#define __ASLDEFINE_H153154155/*156* Compiler versions and names157*/158#define ASL_COMPILER_NAME "ASL+ Optimizing Compiler/Disassembler"159#define AML_DISASSEMBLER_NAME "AML/ASL+ Disassembler"160#define ASL_INVOCATION_NAME "iasl"161#define ASL_CREATOR_ID "INTL"162#define ASL_DEFINE "__IASL__"163#define ASL_PREFIX "iASL: "164#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.5"165166167/* Configuration constants */168169#define ASL_MAX_ERROR_COUNT 200170#define ASL_PARSEOP_CACHE_SIZE (1024 * 16)171#define ASL_STRING_CACHE_SIZE (1024 * 64)172173#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS174#define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */175176177/*178* Per-parser-generator configuration. These values are used to cheat and179* directly access the bison/yacc token name table (yyname or yytname).180* Note: These values are the index in yyname for the first lex token181* (PARSEOP_ACCCESSAS).182*/183#if defined (YYBISON)184#define ASL_YYTNAME_START 3 /* Bison */185#elif defined (YYBYACC)186#define ASL_YYTNAME_START 257 /* Berkeley yacc */187#endif188189190/*191* Macros192*/193#define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (AML_RESOURCE, m)194#define ASL_PTR_DIFF(a,b) ((UINT8 *)(b) - (UINT8 *)(a))195#define ASL_PTR_ADD(a,b) ((UINT8 *)(a) = ((UINT8 *)(a) + (b)))196#define ASL_GET_CHILD_NODE(a) (a)->Asl.Child197#define ASL_GET_PEER_NODE(a) (a)->Asl.Next198#define OP_TABLE_ENTRY(a,b,c,d) {b,d,a,c}199200201/* Internal AML opcodes */202203#define AML_RAW_DATA_BYTE (UINT16) 0xAA01 /* write one raw byte */204#define AML_RAW_DATA_WORD (UINT16) 0xAA02 /* write 2 raw bytes */205#define AML_RAW_DATA_DWORD (UINT16) 0xAA04 /* write 4 raw bytes */206#define AML_RAW_DATA_QWORD (UINT16) 0xAA08 /* write 8 raw bytes */207#define AML_RAW_DATA_BUFFER (UINT16) 0xAA0B /* raw buffer with length */208#define AML_RAW_DATA_CHAIN (UINT16) 0xAA0C /* chain of raw buffers */209#define AML_PACKAGE_LENGTH (UINT16) 0xAA10210#define AML_UNASSIGNED_OPCODE (UINT16) 0xEEEE211#define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD212213214/* Types for input files */215216#define ASL_INPUT_TYPE_BINARY 0217#define ASL_INPUT_TYPE_BINARY_ACPI_TABLE 1218#define ASL_INPUT_TYPE_ASCII_ASL 2219#define ASL_INPUT_TYPE_ASCII_DATA 3220221222/* Misc */223224#define ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS 255225#define ASL_ABORT TRUE226#define ASL_NO_ABORT FALSE227#define ASL_EOF ACPI_UINT32_MAX228#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1)229#define ASL_ERROR_CODE_LENGTH 4230231232/* Listings */233234#define ASL_LISTING_LINE_PREFIX ": "235236237/* Support for reserved method names */238239#define ACPI_VALID_RESERVED_NAME_MAX 0x80000000240#define ACPI_NOT_RESERVED_NAME ACPI_UINT32_MAX241#define ACPI_PREDEFINED_NAME (ACPI_UINT32_MAX - 1)242#define ACPI_EVENT_RESERVED_NAME (ACPI_UINT32_MAX - 2)243#define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3)244245246/* Helper macros for resource tag creation */247248#define RsCreateMultiBitField \249RsCreateResourceField250251#define RsCreateBitField(Op, Name, ByteOffset, BitOffset) \252RsCreateResourceField (Op, Name, ByteOffset, BitOffset, 1)253254#define RsCreateByteField(Op, Name, ByteOffset) \255RsCreateResourceField (Op, Name, ByteOffset, 0, 8);256257#define RsCreateWordField(Op, Name, ByteOffset) \258RsCreateResourceField (Op, Name, ByteOffset, 0, 16);259260#define RsCreateDwordField(Op, Name, ByteOffset) \261RsCreateResourceField (Op, Name, ByteOffset, 0, 32);262263#define RsCreateQwordField(Op, Name, ByteOffset) \264RsCreateResourceField (Op, Name, ByteOffset, 0, 64);265266267/*268* Macros for debug output269*/270#define DEBUG_MAX_LINE_LENGTH 61271#define DEBUG_SPACES_PER_INDENT 3272#define DEBUG_FULL_LINE_LENGTH 71273274#define ASL_PARSE_TREE_FULL_LINE "\n%71.71s"275276/* Header/Trailer for original parse tree directly from the parser */277278#define ASL_PARSE_TREE_HEADER1 \279"%*s Value P_Op Flags Line# End# LogL# EndL#\n", 65, " "280281#define ASL_PARSE_TREE_DEBUG1 \282" %4.4X %8.8X %5d %5d %5d %5d"283284/* Header/Trailer for processed parse tree used for AML generation */285286#define ASL_PARSE_TREE_HEADER2 \287"%*s NameString Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr"\288" Parent Child Next Flags AcTyp Final Col"\289" Line# End# LogL# EndL#\n", 60, " "290291#define ASL_PARSE_TREE_DEBUG2 \292" %08X %04X %04X %01X %04X %04X %05X %05X "\293"%8p %8p %8p %8p %08X %08X %04X %02d %5d %5d %5d %5d"294295/*296* Macros for ASL/ASL+ converter297*/298#define COMMENT_CAPTURE_ON AslGbl_CommentState.CaptureComments = TRUE;299#define COMMENT_CAPTURE_OFF AslGbl_CommentState.CaptureComments = FALSE;300301/*302* Special name segments - these must only be declared at the root scope303*/304#define NAMESEG__PTS "_PTS"305#define NAMESEG__WAK "_WAK"306#define NAMESEG__S0 "_S0_"307#define NAMESEG__S1 "_S1_"308#define NAMESEG__S2 "_S2_"309#define NAMESEG__S3 "_S3_"310#define NAMESEG__S4 "_S4_"311#define NAMESEG__S5 "_S5_"312#define NAMESEG__TTS "_TTS"313314#define MAX_SPECIAL_NAMES 9315316317#endif /* ASLDEFINE.H */318319320