Home | History | Annotate | Line # | Download | only in acpihelp
ahgrammar.c revision 1.1.1.2
      1 /******************************************************************************
      2  *
      3  * Module Name: ahgrammar - AML grammar items
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2017, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions, and the following disclaimer,
     16  *    without modification.
     17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  *    including a substantially similar Disclaimer requirement for further
     21  *    binary redistribution.
     22  * 3. Neither the names of the above-listed copyright holders nor the names
     23  *    of any contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * Alternatively, this software may be distributed under the terms of the
     27  * GNU General Public License ("GPL") version 2 as published by the Free
     28  * Software Foundation.
     29  *
     30  * NO WARRANTY
     31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  * POSSIBILITY OF SUCH DAMAGES.
     42  */
     43 
     44 #include "acpihelp.h"
     45 
     46 const AH_AML_TYPE           Gbl_AmlTypesInfo[] =
     47 {
     48     {"ComputationalData",
     49         "ComputationalData :=\n"
     50         "ByteConst | WordConst | DWordConst | QWordConst |\n"
     51         "String | ConstObj | RevisionOp | DefBuffer\n\n"
     52         "DataObject := ComputationalData | DefPackage | DefVarPackage\n"
     53         "DataRefObject := DataObject | ObjectReference | DDBHandle\n\n"
     54 
     55         "ByteConst := BytePrefix ByteData\n"
     56         "BytePrefix := 0x0A\n"
     57         "ByteList := Nothing | <ByteData ByteList>\n"
     58         "ByteData := 0x00 - 0xFF\n\n"
     59 
     60         "WordConst := WordPrefix WordData\n"
     61         "WordPrefix := 0x0B\n"
     62         "WordData := 0x0000-0xFFFF\n\n"
     63 
     64         "DWordConst := DWordPrefix DWordData\n"
     65         "DWordPrefix := 0x0C\n"
     66         "DWordData := 0x00000000-0xFFFFFFFF\n\n"
     67 
     68         "QWordConst := QWordPrefix QWordData\n"
     69         "QWordPrefix := 0x0E\n"
     70         "QWordData := 0x0000000000000000-0xFFFFFFFFFFFFFFFF\n\n"
     71 
     72         "String := StringPrefix AsciiCharList NullChar\n"
     73         "StringPrefix := 0x0D\n"
     74         "AsciiCharList := Nothing | <AsciiChar AsciiCharList>\n"
     75         "AsciiChar := 0x01 - 0x7F\n"
     76         "NullChar := 0x00\n\n"
     77 
     78         "ConstObj := ZeroOp | OneOp | OnesOp\n\n"},
     79 
     80     {"DefinitionBlock",
     81         "DefinitionBlockHeader :=\n"
     82         "TableSignature TableLength SpecCompliance Checksum\n"
     83         "OemID OemTableID OemRevision CreatorID CreatorRevision\n\n"
     84 
     85         "TableSignature := AsciiChar AsciiChar AsciiChar AsciiChar\n"
     86         "TableLength := DWordData\n"
     87         "// Length of the table in bytes including\n"
     88         "// the block header.\n\n"
     89 
     90         "SpecCompliance := ByteData\n"
     91         "// The revision of the structure\n\n"
     92 
     93         "CheckSum := ByteData\n"
     94         "// Byte checksum of the entire table\n\n"
     95 
     96         "OemID := ByteData(6)\n"
     97         "// OEM ID of up to 6 characters. If the OEM\n"
     98         "// ID is shorter than 6 characters, it\n"
     99         "// can be terminated with a NULL\n"
    100         "// character.\n\n"
    101 
    102         "OemTableID := ByteData(8)\n"
    103         "// OEM Table ID of up to 8 characters. If\n"
    104         "// the OEM Table ID is shorter than 8\n"
    105         "// characters, it can be terminated with\n"
    106         "// a NULL character.\n"
    107         "OemRevision := DWordData\n"
    108         "// OEM Table Revision\n\n"
    109         "CreatorID := DWordData\n"
    110         "// Vendor ID of the ASL compiler\n"
    111         "CreatorRevision := DWordData\n"
    112         "// Revision of the ASL compiler\n"},
    113 
    114     {"FieldFlags",
    115         "FieldFlags := ByteData\n"
    116         "// bits 0-3: AccessType\n"
    117         "//     0 AnyAcc\n"
    118         "//     1 ByteAcc\n"
    119         "//     2 WordAcc\n"
    120         "//     3 DWordAcc\n"
    121         "//     4 QWordAcc\n"
    122         "//     5 BufferAcc\n"
    123         "//     6 Reserved\n"
    124         "//     7 Reserved\n"
    125         "// bit 4: LockRule\n"
    126         "//     0 NoLock\n"
    127         "//     1 Lock\n"
    128         "// bits 5-6: UpdateRule\n"
    129         "//     0 Preserve\n"
    130         "//     1 WriteAsOnes\n"
    131         "//     2 WriteAsZeros\n"
    132         "// bit 7:\n"
    133         "//     0 Reserved (must be 0)\n"},
    134 
    135     {"FieldList",
    136         "FieldList := Nothing | <FieldElement FieldList>\n\n"
    137         "FieldElement := NamedField | ReservedField | AccessField |\n"
    138         "    ExtendedAccessField | ConnectField\n\n"
    139         "NamedField := NameSeg PkgLength\n"
    140         "ReservedField := 0x00 PkgLength\n\n"
    141 
    142         "AccessField := 0x01 AccessType\n"
    143         "AccessField := 0x01 AccessType AccessAttrib\n\n"
    144 
    145         "AccessType := ByteData\n"
    146         "// Bits 0:3 - Same as AccessType bits of FieldFlags.\n"
    147         "// Bits 4:5 - Reserved\n"
    148         "// Bits 7:6 - 0 = AccessAttribute\n"
    149         "//     Normal Access Attributes\n"
    150         "//     1 = AttribBytes (x)\n"
    151         "//     2 = AttribRawBytes (x)\n"
    152         "//     3 = AttribRawProcessBytes (x)\n"
    153         "//     Note: 'x' is encoded as bits 0:7 of the AccessAttrib byte.\n\n"
    154 
    155         "AccessAttrib := ByteData\n"
    156         "// bits 0:7: Byte length\n"
    157         "//\n"
    158         "// If AccessType is BufferAcc for the SMB or\n"
    159         "// GPIO OpRegions, AccessAttrib can be one of\n"
    160         "// the following values:\n"
    161         "// 0x02 AttribQuick\n"
    162         "// 0x04 AttribSendReceive\n"
    163         "// 0x06 AttribByte\n"
    164         "// 0x08 AttribWord\n"
    165         "// 0x0A AttribBlock\n"
    166         "// 0x0C AttribProcessCall\n"
    167         "// 0x0D AttribBlockProcessCall\n\n"
    168 
    169         "ExtendedAccessField := 0x03 AccessType ExtendedAccessAttrib AccessLength\n"
    170         "ExtendedAccessAttrib := ByteData\n"
    171         "// 0x0B AttribBytes\n"
    172         "// 0x0E AttribRawBytes\n"
    173         "// 0x0F AttribRawProcess\n\n"
    174 
    175         "ConnectField := 0x02 NameString> | <0x02 BufferData\n"},
    176 
    177     {"MatchOpcode",
    178         "DefMatch := MatchOp SearchPkg MatchOpcode Operand MatchOpcode Operand StartIndex\n"
    179         "MatchOp := 0x89\n"
    180         "SearchPkg := TermArg => Package\n"
    181         "MatchOpcode := ByteData\n"
    182         "// 0 MTR\n"
    183         "// 1 MEQ\n"
    184         "// 2 MLE\n"
    185         "// 3 MLT\n"
    186         "// 4 MGE\n"
    187         "// 5 MGT\n"},
    188 
    189    {"MethodFlags",
    190         "DefMethod := MethodOp PkgLength NameString MethodFlags TermList\n"
    191         "MethodOp := 0x14\n"
    192         "MethodFlags := ByteData\n"
    193         "// bit 0-2: ArgCount (0-7)\n"
    194         "// bit 3: SerializeFlag\n"
    195         "//   0 NotSerialized\n"
    196         "//   1 Serialized\n"
    197         "// bit 4-7: SyncLevel (0x00-0x0f)\n"},
    198 
    199     {"Miscellaneous",
    200         "ZeroOp := 0x00\n"
    201         "OneOp := 0x01\n"
    202         "OnesOp := 0xFF\n"
    203         "RevisionOp := ExtOpPrefix 0x30\n"
    204         "ExtOpPrefix := 0x5B\n"},
    205 
    206     {"NameSeg",
    207         "NameSeg := <LeadNameChar NameChar NameChar NameChar>\n"
    208         "// Note: NameSegs shorter than 4 characters are filled with\n"
    209         "// trailing underscores.\n\n"
    210         "NameChar := DigitChar | LeadNameChar\n"
    211         "LeadNameChar := 'A'-'Z' | '_' (0x41 - 0x5A) | (0x5F)\n"
    212         "DigitChar := '0'-'9' (0x30 - 0x39)\n"},
    213 
    214     {"NameString",
    215         "NameString := <RootChar NamePath> | <PrefixPath NamePath>\n"
    216         "PrefixPath := Nothing | <ParentPrefixChar PrefixPath>\n"
    217         "RootChar := '\\' (0x5C)\n"
    218         "ParentPrefixChar := '^' (0x5E)\n"},
    219 
    220     {"NamePath",
    221         "NamePath := NameSeg | DualNamePath | MultiNamePath | NullName\n"
    222         "DualNamePath := DualNamePrefix NameSeg NameSeg\n"
    223         "DualNamePrefix := 0x2E\n"
    224         "MultiNamePath := MultiNamePrefix SegCount NameSeg(SegCount)\n"
    225         "MultiNamePrefix := 0x2F\n"
    226         "SegCount := ByteData\n"
    227         "// Note: SegCount can be from 1 to 255. For example: MultiNamePrefix(35)\n"
    228         "// is encoded as 0x2f 0x23 and followed by 35 NameSegs. So, the total\n"
    229         "// encoding length will be 1 + 1 + (35 * 4) = 142. Notice that:\n"
    230         "// DualNamePrefix NameSeg NameSeg has a smaller encoding than the\n"
    231         "// encoding of: MultiNamePrefix(2) NameSeg NameSeg\n\n"
    232 
    233         "SimpleName := NameString | ArgObj | LocalObj\n"
    234         "SuperName := SimpleName | DebugObj | Type6Opcode\n"
    235         "NullName := 0x00\n"
    236         "Target := SuperName | NullName\n"},
    237 
    238     {"PkgLength",
    239         "PkgLength := PkgLeadByte |\n"
    240         "<PkgLeadByte ByteData> |\n"
    241         "<PkgLeadByte ByteData ByteData> |\n"
    242         "<PkgLeadByte ByteData ByteData ByteData>\n\n"
    243 
    244         "PkgLeadByte :=\n"
    245         "bit 7-6: Count of ByteData that follows (0-3)\n"
    246         "bit 5-4: Only used if (PkgLength < 63)\n"
    247         "bit 3-0: Least significant package length nybble\n"
    248         "// Note: The high 2 bits of the first byte reveal how many follow bytes\n"
    249         "// are in the PkgLength. If the PkgLength has only one byte, bit 0 through 5\n"
    250         "// are used to encode the package length (in other words, values 0-63). If\n"
    251         "// the package length value is more than 63, more than one byte must be\n"
    252         "// used for the encoding in which case bit 4 and 5 of the PkgLeadByte are\n"
    253         "// reserved and must be zero. If the multiple bytes encoding is used, bits\n"
    254         "// 0-3 of the PkgLeadByte become the least significant 4 bits of the\n"
    255         "// resulting package length value. The next ByteData will become the next\n"
    256         "// least significant 8 bits of the resulting value and so on, up to 3\n"
    257         "// ByteData bytes. Thus, the maximum package length is 2**28.\n"},
    258 
    259     {"RegionSpace",
    260         "RegionSpace := ByteData\n"
    261         "// 0x00 SystemMemory\n"
    262         "// 0x01 SystemIO\n"
    263         "// 0x02 PCI_Config\n"
    264         "// 0x03 EmbeddedControl\n"
    265         "// 0x04 SMBus\n"
    266         "// 0x05 SystemCMOS\n"
    267         "// 0x06 PciBarTarget\n"
    268         "// 0x07 IPMI\n"
    269         "// 0x08 GeneralPurposeIO\n"
    270         "// 0x09 GenericSerialBus\n"
    271         "// 0x0A Platform Communications Channel\n"
    272         "// 0x0B-0x7E: Reserved\n"
    273         "// 0x7F: Functional Fixed Hardware\n"
    274         "// 0x80-0xBF: Reserved\n"
    275         "// 0xC0-0xFF: OEM Defined\n"},
    276 
    277     {"TermObj",
    278         "TermObj := NameSpaceModifierObj | NamedObj | Type1Opcode | Type2Opcode\n"
    279         "TermList := Nothing | <TermObj TermList>\n\n"
    280 
    281         "MethodInvocation := NameString TermArgList\n"
    282         "TermArgList := Nothing | <TermArg TermArgList>\n"
    283         "TermArg := Type2Opcode | DataObject | ArgObj | LocalObj\n\n"
    284 
    285         "ObjectList := Nothing | <Object ObjectList>\n"
    286         "Object := NameSpaceModifierObj | NamedObj\n"},
    287 
    288     {NULL, NULL}
    289 };
    290