1 1.1 jruoho /******************************************************************************* 2 1.1 jruoho * 3 1.1 jruoho * Module Name: dmopcode - AML disassembler, specific AML opcodes 4 1.1 jruoho * 5 1.1 jruoho ******************************************************************************/ 6 1.1 jruoho 7 1.1.1.20 christos /****************************************************************************** 8 1.1.1.20 christos * 9 1.1.1.20 christos * 1. Copyright Notice 10 1.1.1.20 christos * 11 1.1.1.21 christos * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp. 12 1.1 jruoho * All rights reserved. 13 1.1 jruoho * 14 1.1.1.20 christos * 2. License 15 1.1.1.20 christos * 16 1.1.1.20 christos * 2.1. This is your license from Intel Corp. under its intellectual property 17 1.1.1.20 christos * rights. You may have additional license terms from the party that provided 18 1.1.1.20 christos * you this software, covering your right to use that party's intellectual 19 1.1.1.20 christos * property rights. 20 1.1.1.20 christos * 21 1.1.1.20 christos * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 1.1.1.20 christos * copy of the source code appearing in this file ("Covered Code") an 23 1.1.1.20 christos * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 1.1.1.20 christos * base code distributed originally by Intel ("Original Intel Code") to copy, 25 1.1.1.20 christos * make derivatives, distribute, use and display any portion of the Covered 26 1.1.1.20 christos * Code in any form, with the right to sublicense such rights; and 27 1.1.1.20 christos * 28 1.1.1.20 christos * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 1.1.1.20 christos * license (with the right to sublicense), under only those claims of Intel 30 1.1.1.20 christos * patents that are infringed by the Original Intel Code, to make, use, sell, 31 1.1.1.20 christos * offer to sell, and import the Covered Code and derivative works thereof 32 1.1.1.20 christos * solely to the minimum extent necessary to exercise the above copyright 33 1.1.1.20 christos * license, and in no event shall the patent license extend to any additions 34 1.1.1.20 christos * to or modifications of the Original Intel Code. No other license or right 35 1.1.1.20 christos * is granted directly or by implication, estoppel or otherwise; 36 1.1.1.20 christos * 37 1.1.1.20 christos * The above copyright and patent license is granted only if the following 38 1.1.1.20 christos * conditions are met: 39 1.1.1.20 christos * 40 1.1.1.20 christos * 3. Conditions 41 1.1.1.20 christos * 42 1.1.1.20 christos * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 1.1.1.20 christos * Redistribution of source code of any substantial portion of the Covered 44 1.1.1.20 christos * Code or modification with rights to further distribute source must include 45 1.1.1.20 christos * the above Copyright Notice, the above License, this list of Conditions, 46 1.1.1.20 christos * and the following Disclaimer and Export Compliance provision. In addition, 47 1.1.1.20 christos * Licensee must cause all Covered Code to which Licensee contributes to 48 1.1.1.20 christos * contain a file documenting the changes Licensee made to create that Covered 49 1.1.1.20 christos * Code and the date of any change. Licensee must include in that file the 50 1.1.1.20 christos * documentation of any changes made by any predecessor Licensee. Licensee 51 1.1.1.20 christos * must include a prominent statement that the modification is derived, 52 1.1.1.20 christos * directly or indirectly, from Original Intel Code. 53 1.1.1.20 christos * 54 1.1.1.20 christos * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 1.1.1.20 christos * Redistribution of source code of any substantial portion of the Covered 56 1.1.1.20 christos * Code or modification without rights to further distribute source must 57 1.1.1.20 christos * include the following Disclaimer and Export Compliance provision in the 58 1.1.1.20 christos * documentation and/or other materials provided with distribution. In 59 1.1.1.20 christos * addition, Licensee may not authorize further sublicense of source of any 60 1.1.1.20 christos * portion of the Covered Code, and must include terms to the effect that the 61 1.1.1.20 christos * license from Licensee to its licensee is limited to the intellectual 62 1.1.1.20 christos * property embodied in the software Licensee provides to its licensee, and 63 1.1.1.20 christos * not to intellectual property embodied in modifications its licensee may 64 1.1.1.20 christos * make. 65 1.1.1.20 christos * 66 1.1.1.20 christos * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 1.1.1.20 christos * substantial portion of the Covered Code or modification must reproduce the 68 1.1.1.20 christos * above Copyright Notice, and the following Disclaimer and Export Compliance 69 1.1.1.20 christos * provision in the documentation and/or other materials provided with the 70 1.1.1.20 christos * distribution. 71 1.1.1.20 christos * 72 1.1.1.20 christos * 3.4. Intel retains all right, title, and interest in and to the Original 73 1.1.1.20 christos * Intel Code. 74 1.1.1.20 christos * 75 1.1.1.20 christos * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 1.1.1.20 christos * Intel shall be used in advertising or otherwise to promote the sale, use or 77 1.1.1.20 christos * other dealings in products derived from or relating to the Covered Code 78 1.1.1.20 christos * without prior written authorization from Intel. 79 1.1.1.20 christos * 80 1.1.1.20 christos * 4. Disclaimer and Export Compliance 81 1.1.1.20 christos * 82 1.1.1.20 christos * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 1.1.1.20 christos * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 1.1.1.20 christos * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 1.1.1.20 christos * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 1.1.1.20 christos * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 1.1.1.20 christos * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 1.1.1.20 christos * PARTICULAR PURPOSE. 89 1.1.1.20 christos * 90 1.1.1.20 christos * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 1.1.1.20 christos * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 1.1.1.20 christos * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 1.1.1.20 christos * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 1.1.1.20 christos * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 1.1.1.20 christos * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 1.1.1.20 christos * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 1.1.1.20 christos * LIMITED REMEDY. 98 1.1.1.20 christos * 99 1.1.1.20 christos * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 1.1.1.20 christos * software or system incorporating such software without first obtaining any 101 1.1.1.20 christos * required license or other approval from the U. S. Department of Commerce or 102 1.1.1.20 christos * any other agency or department of the United States Government. In the 103 1.1.1.20 christos * event Licensee exports any such software from the United States or 104 1.1.1.20 christos * re-exports any such software from a foreign destination, Licensee shall 105 1.1.1.20 christos * ensure that the distribution and export/re-export of the software is in 106 1.1.1.20 christos * compliance with all laws, regulations, orders, or other restrictions of the 107 1.1.1.20 christos * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 1.1.1.20 christos * any of its subsidiaries will export/re-export any technical data, process, 109 1.1.1.20 christos * software, or service, directly or indirectly, to any country for which the 110 1.1.1.20 christos * United States government or any agency thereof requires an export license, 111 1.1.1.20 christos * other governmental approval, or letter of assurance, without first obtaining 112 1.1.1.20 christos * such license, approval or letter. 113 1.1.1.20 christos * 114 1.1.1.20 christos ***************************************************************************** 115 1.1.1.20 christos * 116 1.1.1.20 christos * Alternatively, you may choose to be licensed under the terms of the 117 1.1.1.20 christos * following license: 118 1.1.1.20 christos * 119 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without 120 1.1.1.2 jruoho * modification, are permitted provided that the following conditions 121 1.1.1.2 jruoho * are met: 122 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright 123 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer, 124 1.1.1.2 jruoho * without modification. 125 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below 127 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon 128 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further 129 1.1.1.2 jruoho * binary redistribution. 130 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names 131 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived 132 1.1.1.2 jruoho * from this software without specific prior written permission. 133 1.1.1.2 jruoho * 134 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136 1.1.1.17 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138 1.1.1.20 christos * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139 1.1.1.20 christos * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140 1.1.1.20 christos * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141 1.1.1.20 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142 1.1.1.20 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143 1.1.1.20 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144 1.1.1.20 christos * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145 1.1.1.20 christos * 146 1.1.1.20 christos * Alternatively, you may choose to be licensed under the terms of the 147 1.1.1.20 christos * GNU General Public License ("GPL") version 2 as published by the Free 148 1.1.1.20 christos * Software Foundation. 149 1.1.1.20 christos * 150 1.1.1.20 christos *****************************************************************************/ 151 1.1 jruoho 152 1.1 jruoho #include "acpi.h" 153 1.1 jruoho #include "accommon.h" 154 1.1 jruoho #include "acparser.h" 155 1.1 jruoho #include "amlcode.h" 156 1.1.1.4 christos #include "acinterp.h" 157 1.1.1.4 christos #include "acnamesp.h" 158 1.1.1.6 christos #include "acdebug.h" 159 1.1.1.12 christos #include "acconvert.h" 160 1.1 jruoho 161 1.1 jruoho 162 1.1 jruoho #define _COMPONENT ACPI_CA_DEBUGGER 163 1.1 jruoho ACPI_MODULE_NAME ("dmopcode") 164 1.1 jruoho 165 1.1.1.5 christos 166 1.1 jruoho /* Local prototypes */ 167 1.1 jruoho 168 1.1 jruoho static void 169 1.1 jruoho AcpiDmMatchKeyword ( 170 1.1 jruoho ACPI_PARSE_OBJECT *Op); 171 1.1 jruoho 172 1.1.1.7 christos static void 173 1.1.1.7 christos AcpiDmConvertToElseIf ( 174 1.1.1.7 christos ACPI_PARSE_OBJECT *Op); 175 1.1.1.7 christos 176 1.1.1.10 christos static void 177 1.1.1.10 christos AcpiDmPromoteSubtree ( 178 1.1.1.10 christos ACPI_PARSE_OBJECT *StartOp); 179 1.1.1.10 christos 180 1.1 jruoho /******************************************************************************* 181 1.1 jruoho * 182 1.1.1.4 christos * FUNCTION: AcpiDmDisplayTargetPathname 183 1.1.1.4 christos * 184 1.1.1.4 christos * PARAMETERS: Op - Parse object 185 1.1.1.4 christos * 186 1.1.1.4 christos * RETURN: None 187 1.1.1.4 christos * 188 1.1.1.4 christos * DESCRIPTION: For AML opcodes that have a target operand, display the full 189 1.1.1.4 christos * pathname for the target, in a comment field. Handles Return() 190 1.1.1.4 christos * statements also. 191 1.1.1.4 christos * 192 1.1.1.4 christos ******************************************************************************/ 193 1.1.1.4 christos 194 1.1.1.4 christos void 195 1.1.1.4 christos AcpiDmDisplayTargetPathname ( 196 1.1.1.4 christos ACPI_PARSE_OBJECT *Op) 197 1.1.1.4 christos { 198 1.1.1.4 christos ACPI_PARSE_OBJECT *NextOp; 199 1.1.1.4 christos ACPI_PARSE_OBJECT *PrevOp = NULL; 200 1.1.1.4 christos char *Pathname; 201 1.1.1.4 christos const ACPI_OPCODE_INFO *OpInfo; 202 1.1.1.4 christos 203 1.1.1.4 christos 204 1.1.1.4 christos if (Op->Common.AmlOpcode == AML_RETURN_OP) 205 1.1.1.4 christos { 206 1.1.1.4 christos PrevOp = Op->Asl.Value.Arg; 207 1.1.1.4 christos } 208 1.1.1.4 christos else 209 1.1.1.4 christos { 210 1.1.1.4 christos OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 211 1.1.1.4 christos if (!(OpInfo->Flags & AML_HAS_TARGET)) 212 1.1.1.4 christos { 213 1.1.1.4 christos return; 214 1.1.1.4 christos } 215 1.1.1.4 christos 216 1.1.1.4 christos /* Target is the last Op in the arg list */ 217 1.1.1.4 christos 218 1.1.1.4 christos NextOp = Op->Asl.Value.Arg; 219 1.1.1.4 christos while (NextOp) 220 1.1.1.4 christos { 221 1.1.1.4 christos PrevOp = NextOp; 222 1.1.1.4 christos NextOp = PrevOp->Asl.Next; 223 1.1.1.4 christos } 224 1.1.1.4 christos } 225 1.1.1.4 christos 226 1.1.1.4 christos if (!PrevOp) 227 1.1.1.4 christos { 228 1.1.1.4 christos return; 229 1.1.1.4 christos } 230 1.1.1.4 christos 231 1.1.1.4 christos /* We must have a namepath AML opcode */ 232 1.1.1.4 christos 233 1.1.1.4 christos if (PrevOp->Asl.AmlOpcode != AML_INT_NAMEPATH_OP) 234 1.1.1.4 christos { 235 1.1.1.4 christos return; 236 1.1.1.4 christos } 237 1.1.1.4 christos 238 1.1.1.4 christos /* A null string is the "no target specified" case */ 239 1.1.1.4 christos 240 1.1.1.4 christos if (!PrevOp->Asl.Value.String) 241 1.1.1.4 christos { 242 1.1.1.4 christos return; 243 1.1.1.4 christos } 244 1.1.1.4 christos 245 1.1.1.4 christos /* No node means "unresolved external reference" */ 246 1.1.1.4 christos 247 1.1.1.4 christos if (!PrevOp->Asl.Node) 248 1.1.1.4 christos { 249 1.1.1.4 christos AcpiOsPrintf (" /* External reference */"); 250 1.1.1.4 christos return; 251 1.1.1.4 christos } 252 1.1.1.4 christos 253 1.1.1.4 christos /* Ignore if path is already from the root */ 254 1.1.1.4 christos 255 1.1.1.4 christos if (*PrevOp->Asl.Value.String == '\\') 256 1.1.1.4 christos { 257 1.1.1.4 christos return; 258 1.1.1.4 christos } 259 1.1.1.4 christos 260 1.1.1.4 christos /* Now: we can get the full pathname */ 261 1.1.1.4 christos 262 1.1.1.4 christos Pathname = AcpiNsGetExternalPathname (PrevOp->Asl.Node); 263 1.1.1.4 christos if (!Pathname) 264 1.1.1.4 christos { 265 1.1.1.4 christos return; 266 1.1.1.4 christos } 267 1.1.1.4 christos 268 1.1.1.4 christos AcpiOsPrintf (" /* %s */", Pathname); 269 1.1.1.4 christos ACPI_FREE (Pathname); 270 1.1.1.4 christos } 271 1.1.1.4 christos 272 1.1.1.4 christos 273 1.1.1.4 christos /******************************************************************************* 274 1.1.1.4 christos * 275 1.1.1.4 christos * FUNCTION: AcpiDmNotifyDescription 276 1.1.1.4 christos * 277 1.1.1.4 christos * PARAMETERS: Op - Name() parse object 278 1.1.1.4 christos * 279 1.1.1.4 christos * RETURN: None 280 1.1.1.4 christos * 281 1.1.1.4 christos * DESCRIPTION: Emit a description comment for the value associated with a 282 1.1.1.4 christos * Notify() operator. 283 1.1.1.4 christos * 284 1.1.1.4 christos ******************************************************************************/ 285 1.1.1.4 christos 286 1.1.1.4 christos void 287 1.1.1.4 christos AcpiDmNotifyDescription ( 288 1.1.1.4 christos ACPI_PARSE_OBJECT *Op) 289 1.1.1.4 christos { 290 1.1.1.4 christos ACPI_PARSE_OBJECT *NextOp; 291 1.1.1.4 christos ACPI_NAMESPACE_NODE *Node; 292 1.1.1.4 christos UINT8 NotifyValue; 293 1.1.1.4 christos UINT8 Type = ACPI_TYPE_ANY; 294 1.1.1.4 christos 295 1.1.1.4 christos 296 1.1.1.4 christos /* The notify value is the second argument */ 297 1.1.1.4 christos 298 1.1.1.4 christos NextOp = Op->Asl.Value.Arg; 299 1.1.1.4 christos NextOp = NextOp->Asl.Next; 300 1.1.1.4 christos 301 1.1.1.4 christos switch (NextOp->Common.AmlOpcode) 302 1.1.1.4 christos { 303 1.1.1.4 christos case AML_ZERO_OP: 304 1.1.1.4 christos case AML_ONE_OP: 305 1.1.1.4 christos 306 1.1.1.4 christos NotifyValue = (UINT8) NextOp->Common.AmlOpcode; 307 1.1.1.4 christos break; 308 1.1.1.4 christos 309 1.1.1.4 christos case AML_BYTE_OP: 310 1.1.1.4 christos 311 1.1.1.4 christos NotifyValue = (UINT8) NextOp->Asl.Value.Integer; 312 1.1.1.4 christos break; 313 1.1.1.4 christos 314 1.1.1.4 christos default: 315 1.1.1.4 christos return; 316 1.1.1.4 christos } 317 1.1.1.4 christos 318 1.1.1.4 christos /* 319 1.1.1.4 christos * Attempt to get the namespace node so we can determine the object type. 320 1.1.1.4 christos * Some notify values are dependent on the object type (Device, Thermal, 321 1.1.1.4 christos * or Processor). 322 1.1.1.4 christos */ 323 1.1.1.4 christos Node = Op->Asl.Node; 324 1.1.1.4 christos if (Node) 325 1.1.1.4 christos { 326 1.1.1.4 christos Type = Node->Type; 327 1.1.1.4 christos } 328 1.1.1.4 christos 329 1.1.1.4 christos AcpiOsPrintf (" // %s", AcpiUtGetNotifyName (NotifyValue, Type)); 330 1.1.1.4 christos } 331 1.1.1.4 christos 332 1.1.1.4 christos 333 1.1.1.4 christos /******************************************************************************* 334 1.1.1.4 christos * 335 1.1.1.3 christos * FUNCTION: AcpiDmPredefinedDescription 336 1.1.1.3 christos * 337 1.1.1.3 christos * PARAMETERS: Op - Name() parse object 338 1.1.1.3 christos * 339 1.1.1.3 christos * RETURN: None 340 1.1.1.3 christos * 341 1.1.1.3 christos * DESCRIPTION: Emit a description comment for a predefined ACPI name. 342 1.1.1.3 christos * Used for iASL compiler only. 343 1.1.1.3 christos * 344 1.1.1.3 christos ******************************************************************************/ 345 1.1.1.3 christos 346 1.1.1.3 christos void 347 1.1.1.3 christos AcpiDmPredefinedDescription ( 348 1.1.1.3 christos ACPI_PARSE_OBJECT *Op) 349 1.1.1.3 christos { 350 1.1.1.3 christos #ifdef ACPI_ASL_COMPILER 351 1.1.1.3 christos const AH_PREDEFINED_NAME *Info; 352 1.1.1.3 christos char *NameString; 353 1.1.1.3 christos int LastCharIsDigit; 354 1.1.1.3 christos int LastCharsAreHex; 355 1.1.1.3 christos 356 1.1.1.3 christos 357 1.1.1.3 christos if (!Op) 358 1.1.1.3 christos { 359 1.1.1.3 christos return; 360 1.1.1.3 christos } 361 1.1.1.3 christos 362 1.1.1.3 christos /* Ensure that the comment field is emitted only once */ 363 1.1.1.3 christos 364 1.1.1.8 christos if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEFINED_CHECKED) 365 1.1.1.3 christos { 366 1.1.1.3 christos return; 367 1.1.1.3 christos } 368 1.1.1.8 christos Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEFINED_CHECKED; 369 1.1.1.3 christos 370 1.1.1.3 christos /* Predefined name must start with an underscore */ 371 1.1.1.3 christos 372 1.1.1.3 christos NameString = ACPI_CAST_PTR (char, &Op->Named.Name); 373 1.1.1.3 christos if (NameString[0] != '_') 374 1.1.1.3 christos { 375 1.1.1.3 christos return; 376 1.1.1.3 christos } 377 1.1.1.3 christos 378 1.1.1.3 christos /* 379 1.1.1.3 christos * Check for the special ACPI names: 380 1.1.1.3 christos * _ACd, _ALd, _EJd, _Exx, _Lxx, _Qxx, _Wxx, _T_a 381 1.1.1.3 christos * (where d=decimal_digit, x=hex_digit, a=anything) 382 1.1.1.3 christos * 383 1.1.1.3 christos * Convert these to the generic name for table lookup. 384 1.1.1.3 christos * Note: NameString is guaranteed to be upper case here. 385 1.1.1.3 christos */ 386 1.1.1.3 christos LastCharIsDigit = 387 1.1.1.6 christos (isdigit ((int) NameString[3])); /* d */ 388 1.1.1.3 christos LastCharsAreHex = 389 1.1.1.6 christos (isxdigit ((int) NameString[2]) && /* xx */ 390 1.1.1.6 christos isxdigit ((int) NameString[3])); 391 1.1.1.3 christos 392 1.1.1.3 christos switch (NameString[1]) 393 1.1.1.3 christos { 394 1.1.1.3 christos case 'A': 395 1.1.1.3 christos 396 1.1.1.3 christos if ((NameString[2] == 'C') && (LastCharIsDigit)) 397 1.1.1.3 christos { 398 1.1.1.3 christos NameString = "_ACx"; 399 1.1.1.3 christos } 400 1.1.1.3 christos else if ((NameString[2] == 'L') && (LastCharIsDigit)) 401 1.1.1.3 christos { 402 1.1.1.3 christos NameString = "_ALx"; 403 1.1.1.3 christos } 404 1.1.1.3 christos break; 405 1.1.1.3 christos 406 1.1.1.3 christos case 'E': 407 1.1.1.3 christos 408 1.1.1.3 christos if ((NameString[2] == 'J') && (LastCharIsDigit)) 409 1.1.1.3 christos { 410 1.1.1.3 christos NameString = "_EJx"; 411 1.1.1.3 christos } 412 1.1.1.3 christos else if (LastCharsAreHex) 413 1.1.1.3 christos { 414 1.1.1.3 christos NameString = "_Exx"; 415 1.1.1.3 christos } 416 1.1.1.3 christos break; 417 1.1.1.3 christos 418 1.1.1.3 christos case 'L': 419 1.1.1.3 christos 420 1.1.1.3 christos if (LastCharsAreHex) 421 1.1.1.3 christos { 422 1.1.1.3 christos NameString = "_Lxx"; 423 1.1.1.3 christos } 424 1.1.1.3 christos break; 425 1.1.1.3 christos 426 1.1.1.3 christos case 'Q': 427 1.1.1.3 christos 428 1.1.1.3 christos if (LastCharsAreHex) 429 1.1.1.3 christos { 430 1.1.1.3 christos NameString = "_Qxx"; 431 1.1.1.3 christos } 432 1.1.1.3 christos break; 433 1.1.1.3 christos 434 1.1.1.3 christos case 'T': 435 1.1.1.3 christos 436 1.1.1.3 christos if (NameString[2] == '_') 437 1.1.1.3 christos { 438 1.1.1.3 christos NameString = "_T_x"; 439 1.1.1.3 christos } 440 1.1.1.3 christos break; 441 1.1.1.3 christos 442 1.1.1.3 christos case 'W': 443 1.1.1.3 christos 444 1.1.1.3 christos if (LastCharsAreHex) 445 1.1.1.3 christos { 446 1.1.1.3 christos NameString = "_Wxx"; 447 1.1.1.3 christos } 448 1.1.1.3 christos break; 449 1.1.1.3 christos 450 1.1.1.3 christos default: 451 1.1.1.3 christos 452 1.1.1.3 christos break; 453 1.1.1.3 christos } 454 1.1.1.3 christos 455 1.1.1.3 christos /* Match the name in the info table */ 456 1.1.1.3 christos 457 1.1.1.4 christos Info = AcpiAhMatchPredefinedName (NameString); 458 1.1.1.4 christos if (Info) 459 1.1.1.3 christos { 460 1.1.1.4 christos AcpiOsPrintf (" // %4.4s: %s", 461 1.1.1.4 christos NameString, ACPI_CAST_PTR (char, Info->Description)); 462 1.1.1.3 christos } 463 1.1.1.3 christos 464 1.1.1.3 christos #endif 465 1.1.1.3 christos return; 466 1.1.1.3 christos } 467 1.1.1.3 christos 468 1.1.1.3 christos 469 1.1.1.3 christos /******************************************************************************* 470 1.1.1.3 christos * 471 1.1.1.3 christos * FUNCTION: AcpiDmFieldPredefinedDescription 472 1.1.1.3 christos * 473 1.1.1.3 christos * PARAMETERS: Op - Parse object 474 1.1.1.3 christos * 475 1.1.1.3 christos * RETURN: None 476 1.1.1.3 christos * 477 1.1.1.3 christos * DESCRIPTION: Emit a description comment for a resource descriptor tag 478 1.1.1.3 christos * (which is a predefined ACPI name.) Used for iASL compiler only. 479 1.1.1.3 christos * 480 1.1.1.3 christos ******************************************************************************/ 481 1.1.1.3 christos 482 1.1.1.3 christos void 483 1.1.1.3 christos AcpiDmFieldPredefinedDescription ( 484 1.1.1.3 christos ACPI_PARSE_OBJECT *Op) 485 1.1.1.3 christos { 486 1.1.1.3 christos #ifdef ACPI_ASL_COMPILER 487 1.1.1.3 christos ACPI_PARSE_OBJECT *IndexOp; 488 1.1.1.3 christos char *Tag; 489 1.1.1.3 christos const ACPI_OPCODE_INFO *OpInfo; 490 1.1.1.3 christos const AH_PREDEFINED_NAME *Info; 491 1.1.1.3 christos 492 1.1.1.3 christos 493 1.1.1.3 christos if (!Op) 494 1.1.1.3 christos { 495 1.1.1.3 christos return; 496 1.1.1.3 christos } 497 1.1.1.3 christos 498 1.1.1.3 christos /* Ensure that the comment field is emitted only once */ 499 1.1.1.3 christos 500 1.1.1.8 christos if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEFINED_CHECKED) 501 1.1.1.3 christos { 502 1.1.1.3 christos return; 503 1.1.1.3 christos } 504 1.1.1.8 christos Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEFINED_CHECKED; 505 1.1.1.3 christos 506 1.1.1.3 christos /* 507 1.1.1.3 christos * Op must be one of the Create* operators: CreateField, CreateBitField, 508 1.1.1.3 christos * CreateByteField, CreateWordField, CreateDwordField, CreateQwordField 509 1.1.1.3 christos */ 510 1.1.1.3 christos OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 511 1.1.1.3 christos if (!(OpInfo->Flags & AML_CREATE)) 512 1.1.1.3 christos { 513 1.1.1.3 christos return; 514 1.1.1.3 christos } 515 1.1.1.3 christos 516 1.1.1.3 christos /* Second argument is the Index argument */ 517 1.1.1.3 christos 518 1.1.1.3 christos IndexOp = Op->Common.Value.Arg; 519 1.1.1.3 christos IndexOp = IndexOp->Common.Next; 520 1.1.1.3 christos 521 1.1.1.3 christos /* Index argument must be a namepath */ 522 1.1.1.3 christos 523 1.1.1.3 christos if (IndexOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP) 524 1.1.1.3 christos { 525 1.1.1.3 christos return; 526 1.1.1.3 christos } 527 1.1.1.3 christos 528 1.1.1.3 christos /* Major cheat: We previously put the Tag ptr in the Node field */ 529 1.1.1.3 christos 530 1.1.1.3 christos Tag = ACPI_CAST_PTR (char, IndexOp->Common.Node); 531 1.1.1.13 christos if (!Tag || (*Tag == 0)) 532 1.1.1.3 christos { 533 1.1.1.3 christos return; 534 1.1.1.3 christos } 535 1.1.1.3 christos 536 1.1.1.13 christos /* Is the tag a predefined name? */ 537 1.1.1.3 christos 538 1.1.1.4 christos Info = AcpiAhMatchPredefinedName (Tag); 539 1.1.1.13 christos if (!Info) 540 1.1.1.3 christos { 541 1.1.1.13 christos /* Not a predefined name (does not start with underscore) */ 542 1.1.1.13 christos 543 1.1.1.13 christos return; 544 1.1.1.3 christos } 545 1.1.1.3 christos 546 1.1.1.13 christos AcpiOsPrintf (" // %4.4s: %s", Tag, 547 1.1.1.13 christos ACPI_CAST_PTR (char, Info->Description)); 548 1.1.1.12 christos 549 1.1.1.13 christos /* String contains the prefix path, free it */ 550 1.1.1.12 christos 551 1.1.1.13 christos ACPI_FREE (IndexOp->Common.Value.String); 552 1.1.1.13 christos IndexOp->Common.Value.String = NULL; 553 1.1.1.3 christos #endif 554 1.1.1.13 christos 555 1.1.1.3 christos return; 556 1.1.1.3 christos } 557 1.1.1.3 christos 558 1.1.1.3 christos 559 1.1.1.3 christos /******************************************************************************* 560 1.1.1.3 christos * 561 1.1 jruoho * FUNCTION: AcpiDmMethodFlags 562 1.1 jruoho * 563 1.1 jruoho * PARAMETERS: Op - Method Object to be examined 564 1.1 jruoho * 565 1.1 jruoho * RETURN: None 566 1.1 jruoho * 567 1.1 jruoho * DESCRIPTION: Decode control method flags 568 1.1 jruoho * 569 1.1 jruoho ******************************************************************************/ 570 1.1 jruoho 571 1.1 jruoho void 572 1.1 jruoho AcpiDmMethodFlags ( 573 1.1 jruoho ACPI_PARSE_OBJECT *Op) 574 1.1 jruoho { 575 1.1 jruoho UINT32 Flags; 576 1.1 jruoho UINT32 Args; 577 1.1 jruoho 578 1.1 jruoho 579 1.1 jruoho /* The next Op contains the flags */ 580 1.1 jruoho 581 1.1 jruoho Op = AcpiPsGetDepthNext (NULL, Op); 582 1.1 jruoho Flags = (UINT8) Op->Common.Value.Integer; 583 1.1 jruoho Args = Flags & 0x07; 584 1.1 jruoho 585 1.1 jruoho /* Mark the Op as completed */ 586 1.1 jruoho 587 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 588 1.1 jruoho 589 1.1 jruoho /* 1) Method argument count */ 590 1.1 jruoho 591 1.1 jruoho AcpiOsPrintf (", %u, ", Args); 592 1.1 jruoho 593 1.1 jruoho /* 2) Serialize rule */ 594 1.1 jruoho 595 1.1 jruoho if (!(Flags & 0x08)) 596 1.1 jruoho { 597 1.1 jruoho AcpiOsPrintf ("Not"); 598 1.1 jruoho } 599 1.1 jruoho 600 1.1 jruoho AcpiOsPrintf ("Serialized"); 601 1.1 jruoho 602 1.1 jruoho /* 3) SyncLevel */ 603 1.1 jruoho 604 1.1 jruoho if (Flags & 0xF0) 605 1.1 jruoho { 606 1.1 jruoho AcpiOsPrintf (", %u", Flags >> 4); 607 1.1 jruoho } 608 1.1 jruoho } 609 1.1 jruoho 610 1.1 jruoho 611 1.1 jruoho /******************************************************************************* 612 1.1 jruoho * 613 1.1 jruoho * FUNCTION: AcpiDmFieldFlags 614 1.1 jruoho * 615 1.1 jruoho * PARAMETERS: Op - Field Object to be examined 616 1.1 jruoho * 617 1.1 jruoho * RETURN: None 618 1.1 jruoho * 619 1.1 jruoho * DESCRIPTION: Decode Field definition flags 620 1.1 jruoho * 621 1.1 jruoho ******************************************************************************/ 622 1.1 jruoho 623 1.1 jruoho void 624 1.1 jruoho AcpiDmFieldFlags ( 625 1.1 jruoho ACPI_PARSE_OBJECT *Op) 626 1.1 jruoho { 627 1.1 jruoho UINT32 Flags; 628 1.1 jruoho 629 1.1 jruoho 630 1.1 jruoho Op = Op->Common.Next; 631 1.1 jruoho Flags = (UINT8) Op->Common.Value.Integer; 632 1.1 jruoho 633 1.1 jruoho /* Mark the Op as completed */ 634 1.1 jruoho 635 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 636 1.1 jruoho 637 1.1 jruoho AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]); 638 1.1 jruoho AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]); 639 1.1 jruoho AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]); 640 1.1 jruoho } 641 1.1 jruoho 642 1.1 jruoho 643 1.1 jruoho /******************************************************************************* 644 1.1 jruoho * 645 1.1 jruoho * FUNCTION: AcpiDmAddressSpace 646 1.1 jruoho * 647 1.1 jruoho * PARAMETERS: SpaceId - ID to be translated 648 1.1 jruoho * 649 1.1 jruoho * RETURN: None 650 1.1 jruoho * 651 1.1 jruoho * DESCRIPTION: Decode a SpaceId to an AddressSpaceKeyword 652 1.1 jruoho * 653 1.1 jruoho ******************************************************************************/ 654 1.1 jruoho 655 1.1 jruoho void 656 1.1 jruoho AcpiDmAddressSpace ( 657 1.1 jruoho UINT8 SpaceId) 658 1.1 jruoho { 659 1.1 jruoho 660 1.1 jruoho if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) 661 1.1 jruoho { 662 1.1 jruoho if (SpaceId == 0x7F) 663 1.1 jruoho { 664 1.1 jruoho AcpiOsPrintf ("FFixedHW, "); 665 1.1 jruoho } 666 1.1 jruoho else 667 1.1 jruoho { 668 1.1 jruoho AcpiOsPrintf ("0x%.2X, ", SpaceId); 669 1.1 jruoho } 670 1.1 jruoho } 671 1.1 jruoho else 672 1.1 jruoho { 673 1.1 jruoho AcpiOsPrintf ("%s, ", AcpiGbl_RegionTypes [SpaceId]); 674 1.1 jruoho } 675 1.1 jruoho } 676 1.1 jruoho 677 1.1 jruoho 678 1.1 jruoho /******************************************************************************* 679 1.1 jruoho * 680 1.1 jruoho * FUNCTION: AcpiDmRegionFlags 681 1.1 jruoho * 682 1.1 jruoho * PARAMETERS: Op - Object to be examined 683 1.1 jruoho * 684 1.1 jruoho * RETURN: None 685 1.1 jruoho * 686 1.1 jruoho * DESCRIPTION: Decode OperationRegion flags 687 1.1 jruoho * 688 1.1 jruoho ******************************************************************************/ 689 1.1 jruoho 690 1.1 jruoho void 691 1.1 jruoho AcpiDmRegionFlags ( 692 1.1 jruoho ACPI_PARSE_OBJECT *Op) 693 1.1 jruoho { 694 1.1 jruoho 695 1.1 jruoho /* The next Op contains the SpaceId */ 696 1.1 jruoho 697 1.1 jruoho Op = AcpiPsGetDepthNext (NULL, Op); 698 1.1 jruoho 699 1.1 jruoho /* Mark the Op as completed */ 700 1.1 jruoho 701 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 702 1.1 jruoho 703 1.1 jruoho AcpiOsPrintf (", "); 704 1.1 jruoho AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer); 705 1.1 jruoho } 706 1.1 jruoho 707 1.1 jruoho 708 1.1 jruoho /******************************************************************************* 709 1.1 jruoho * 710 1.1 jruoho * FUNCTION: AcpiDmMatchOp 711 1.1 jruoho * 712 1.1 jruoho * PARAMETERS: Op - Match Object to be examined 713 1.1 jruoho * 714 1.1 jruoho * RETURN: None 715 1.1 jruoho * 716 1.1 jruoho * DESCRIPTION: Decode Match opcode operands 717 1.1 jruoho * 718 1.1 jruoho ******************************************************************************/ 719 1.1 jruoho 720 1.1 jruoho void 721 1.1 jruoho AcpiDmMatchOp ( 722 1.1 jruoho ACPI_PARSE_OBJECT *Op) 723 1.1 jruoho { 724 1.1 jruoho ACPI_PARSE_OBJECT *NextOp; 725 1.1 jruoho 726 1.1 jruoho 727 1.1 jruoho NextOp = AcpiPsGetDepthNext (NULL, Op); 728 1.1 jruoho NextOp = NextOp->Common.Next; 729 1.1 jruoho 730 1.1 jruoho if (!NextOp) 731 1.1 jruoho { 732 1.1 jruoho /* Handle partial tree during single-step */ 733 1.1 jruoho 734 1.1 jruoho return; 735 1.1 jruoho } 736 1.1 jruoho 737 1.1 jruoho /* Mark the two nodes that contain the encoding for the match keywords */ 738 1.1 jruoho 739 1.1 jruoho NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP; 740 1.1 jruoho 741 1.1 jruoho NextOp = NextOp->Common.Next; 742 1.1 jruoho NextOp = NextOp->Common.Next; 743 1.1 jruoho NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP; 744 1.1 jruoho } 745 1.1 jruoho 746 1.1 jruoho 747 1.1 jruoho /******************************************************************************* 748 1.1 jruoho * 749 1.1 jruoho * FUNCTION: AcpiDmMatchKeyword 750 1.1 jruoho * 751 1.1 jruoho * PARAMETERS: Op - Match Object to be examined 752 1.1 jruoho * 753 1.1 jruoho * RETURN: None 754 1.1 jruoho * 755 1.1 jruoho * DESCRIPTION: Decode Match opcode operands 756 1.1 jruoho * 757 1.1 jruoho ******************************************************************************/ 758 1.1 jruoho 759 1.1 jruoho static void 760 1.1 jruoho AcpiDmMatchKeyword ( 761 1.1 jruoho ACPI_PARSE_OBJECT *Op) 762 1.1 jruoho { 763 1.1 jruoho 764 1.1 jruoho if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE) 765 1.1 jruoho { 766 1.1 jruoho AcpiOsPrintf ("/* Unknown Match Keyword encoding */"); 767 1.1 jruoho } 768 1.1 jruoho else 769 1.1 jruoho { 770 1.1.1.8 christos AcpiOsPrintf ("%s", 771 1.1.1.8 christos AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]); 772 1.1 jruoho } 773 1.1 jruoho } 774 1.1 jruoho 775 1.1 jruoho 776 1.1 jruoho /******************************************************************************* 777 1.1 jruoho * 778 1.1 jruoho * FUNCTION: AcpiDmDisassembleOneOp 779 1.1 jruoho * 780 1.1 jruoho * PARAMETERS: WalkState - Current walk info 781 1.1 jruoho * Info - Parse tree walk info 782 1.1 jruoho * Op - Op that is to be printed 783 1.1 jruoho * 784 1.1 jruoho * RETURN: None 785 1.1 jruoho * 786 1.1 jruoho * DESCRIPTION: Disassemble a single AML opcode 787 1.1 jruoho * 788 1.1 jruoho ******************************************************************************/ 789 1.1 jruoho 790 1.1 jruoho void 791 1.1 jruoho AcpiDmDisassembleOneOp ( 792 1.1 jruoho ACPI_WALK_STATE *WalkState, 793 1.1 jruoho ACPI_OP_WALK_INFO *Info, 794 1.1 jruoho ACPI_PARSE_OBJECT *Op) 795 1.1 jruoho { 796 1.1 jruoho const ACPI_OPCODE_INFO *OpInfo = NULL; 797 1.1 jruoho UINT32 Offset; 798 1.1 jruoho UINT32 Length; 799 1.1 jruoho ACPI_PARSE_OBJECT *Child; 800 1.1 jruoho ACPI_STATUS Status; 801 1.1.1.3 christos UINT8 *Aml; 802 1.1.1.4 christos const AH_DEVICE_ID *IdInfo; 803 1.1 jruoho 804 1.1 jruoho 805 1.1 jruoho if (!Op) 806 1.1 jruoho { 807 1.1 jruoho AcpiOsPrintf ("<NULL OP PTR>"); 808 1.1 jruoho return; 809 1.1 jruoho } 810 1.1 jruoho 811 1.1.1.7 christos if (Op->Common.DisasmFlags & ACPI_PARSEOP_ELSEIF) 812 1.1.1.7 christos { 813 1.1.1.7 christos return; /* ElseIf macro was already emitted */ 814 1.1.1.7 christos } 815 1.1.1.7 christos 816 1.1 jruoho switch (Op->Common.DisasmOpcode) 817 1.1 jruoho { 818 1.1 jruoho case ACPI_DASM_MATCHOP: 819 1.1 jruoho 820 1.1 jruoho AcpiDmMatchKeyword (Op); 821 1.1 jruoho return; 822 1.1 jruoho 823 1.1 jruoho case ACPI_DASM_LNOT_SUFFIX: 824 1.1.1.3 christos 825 1.1.1.5 christos if (!AcpiGbl_CstyleDisassembly) 826 1.1 jruoho { 827 1.1.1.5 christos switch (Op->Common.AmlOpcode) 828 1.1.1.5 christos { 829 1.1.1.12 christos case AML_LOGICAL_EQUAL_OP: 830 1.1.1.5 christos AcpiOsPrintf ("LNotEqual"); 831 1.1.1.5 christos break; 832 1.1.1.3 christos 833 1.1.1.12 christos case AML_LOGICAL_GREATER_OP: 834 1.1.1.5 christos AcpiOsPrintf ("LLessEqual"); 835 1.1.1.5 christos break; 836 1.1 jruoho 837 1.1.1.12 christos case AML_LOGICAL_LESS_OP: 838 1.1.1.5 christos AcpiOsPrintf ("LGreaterEqual"); 839 1.1.1.5 christos break; 840 1.1.1.3 christos 841 1.1.1.5 christos default: 842 1.1.1.5 christos break; 843 1.1.1.5 christos } 844 1.1 jruoho } 845 1.1.1.5 christos 846 1.1 jruoho Op->Common.DisasmOpcode = 0; 847 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 848 1.1 jruoho return; 849 1.1 jruoho 850 1.1 jruoho default: 851 1.1 jruoho break; 852 1.1 jruoho } 853 1.1 jruoho 854 1.1 jruoho OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 855 1.1 jruoho 856 1.1 jruoho /* The op and arguments */ 857 1.1 jruoho 858 1.1 jruoho switch (Op->Common.AmlOpcode) 859 1.1 jruoho { 860 1.1.1.12 christos case AML_LOGICAL_NOT_OP: 861 1.1 jruoho 862 1.1 jruoho Child = Op->Common.Value.Arg; 863 1.1.1.12 christos if ((Child->Common.AmlOpcode == AML_LOGICAL_EQUAL_OP) || 864 1.1.1.12 christos (Child->Common.AmlOpcode == AML_LOGICAL_GREATER_OP) || 865 1.1.1.12 christos (Child->Common.AmlOpcode == AML_LOGICAL_LESS_OP)) 866 1.1 jruoho { 867 1.1 jruoho Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX; 868 1.1 jruoho Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX; 869 1.1 jruoho } 870 1.1 jruoho else 871 1.1 jruoho { 872 1.1 jruoho AcpiOsPrintf ("%s", OpInfo->Name); 873 1.1 jruoho } 874 1.1 jruoho break; 875 1.1 jruoho 876 1.1 jruoho case AML_BYTE_OP: 877 1.1 jruoho 878 1.1 jruoho AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer); 879 1.1 jruoho break; 880 1.1 jruoho 881 1.1 jruoho case AML_WORD_OP: 882 1.1 jruoho 883 1.1 jruoho if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID) 884 1.1 jruoho { 885 1.1.1.4 christos AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer); 886 1.1 jruoho } 887 1.1 jruoho else 888 1.1 jruoho { 889 1.1 jruoho AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer); 890 1.1 jruoho } 891 1.1 jruoho break; 892 1.1 jruoho 893 1.1 jruoho case AML_DWORD_OP: 894 1.1 jruoho 895 1.1 jruoho if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID) 896 1.1 jruoho { 897 1.1.1.4 christos AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer); 898 1.1 jruoho } 899 1.1 jruoho else 900 1.1 jruoho { 901 1.1 jruoho AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer); 902 1.1 jruoho } 903 1.1 jruoho break; 904 1.1 jruoho 905 1.1 jruoho case AML_QWORD_OP: 906 1.1 jruoho 907 1.1 jruoho AcpiOsPrintf ("0x%8.8X%8.8X", 908 1.1 jruoho ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); 909 1.1 jruoho break; 910 1.1 jruoho 911 1.1 jruoho case AML_STRING_OP: 912 1.1 jruoho 913 1.1.1.3 christos AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX); 914 1.1.1.4 christos 915 1.1.1.4 christos /* For _HID/_CID strings, attempt to output a descriptive comment */ 916 1.1.1.4 christos 917 1.1.1.4 christos if (Op->Common.DisasmOpcode == ACPI_DASM_HID_STRING) 918 1.1.1.4 christos { 919 1.1.1.4 christos /* If we know about the ID, emit the description */ 920 1.1.1.4 christos 921 1.1.1.4 christos IdInfo = AcpiAhMatchHardwareId (Op->Common.Value.String); 922 1.1.1.4 christos if (IdInfo) 923 1.1.1.4 christos { 924 1.1.1.4 christos AcpiOsPrintf (" /* %s */", IdInfo->Description); 925 1.1.1.4 christos } 926 1.1.1.4 christos } 927 1.1 jruoho break; 928 1.1 jruoho 929 1.1 jruoho case AML_BUFFER_OP: 930 1.1 jruoho /* 931 1.1.1.3 christos * Determine the type of buffer. We can have one of the following: 932 1.1 jruoho * 933 1.1 jruoho * 1) ResourceTemplate containing Resource Descriptors. 934 1.1 jruoho * 2) Unicode String buffer 935 1.1 jruoho * 3) ASCII String buffer 936 1.1 jruoho * 4) Raw data buffer (if none of the above) 937 1.1 jruoho * 938 1.1 jruoho * Since there are no special AML opcodes to differentiate these 939 1.1 jruoho * types of buffers, we have to closely look at the data in the 940 1.1 jruoho * buffer to determine the type. 941 1.1 jruoho */ 942 1.1.1.3 christos if (!AcpiGbl_NoResourceDisassembly) 943 1.1 jruoho { 944 1.1.1.3 christos Status = AcpiDmIsResourceTemplate (WalkState, Op); 945 1.1.1.3 christos if (ACPI_SUCCESS (Status)) 946 1.1.1.3 christos { 947 1.1.1.3 christos Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; 948 1.1.1.3 christos AcpiOsPrintf ("ResourceTemplate"); 949 1.1.1.3 christos break; 950 1.1.1.3 christos } 951 1.1.1.3 christos else if (Status == AE_AML_NO_RESOURCE_END_TAG) 952 1.1.1.3 christos { 953 1.1.1.7 christos AcpiOsPrintf ( 954 1.1.1.7 christos "/**** Is ResourceTemplate, " 955 1.1.1.7 christos "but EndTag not at buffer end ****/ "); 956 1.1.1.3 christos } 957 1.1 jruoho } 958 1.1 jruoho 959 1.1.1.4 christos if (AcpiDmIsUuidBuffer (Op)) 960 1.1.1.4 christos { 961 1.1.1.4 christos Op->Common.DisasmOpcode = ACPI_DASM_UUID; 962 1.1.1.4 christos AcpiOsPrintf ("ToUUID ("); 963 1.1.1.4 christos } 964 1.1.1.4 christos else if (AcpiDmIsUnicodeBuffer (Op)) 965 1.1 jruoho { 966 1.1 jruoho Op->Common.DisasmOpcode = ACPI_DASM_UNICODE; 967 1.1 jruoho AcpiOsPrintf ("Unicode ("); 968 1.1 jruoho } 969 1.1 jruoho else if (AcpiDmIsStringBuffer (Op)) 970 1.1 jruoho { 971 1.1 jruoho Op->Common.DisasmOpcode = ACPI_DASM_STRING; 972 1.1 jruoho AcpiOsPrintf ("Buffer"); 973 1.1 jruoho } 974 1.1.1.3 christos else if (AcpiDmIsPldBuffer (Op)) 975 1.1.1.3 christos { 976 1.1.1.3 christos Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD; 977 1.1.1.5 christos AcpiOsPrintf ("ToPLD ("); 978 1.1.1.3 christos } 979 1.1 jruoho else 980 1.1 jruoho { 981 1.1 jruoho Op->Common.DisasmOpcode = ACPI_DASM_BUFFER; 982 1.1 jruoho AcpiOsPrintf ("Buffer"); 983 1.1 jruoho } 984 1.1 jruoho break; 985 1.1 jruoho 986 1.1 jruoho case AML_INT_NAMEPATH_OP: 987 1.1 jruoho 988 1.1 jruoho AcpiDmNamestring (Op->Common.Value.Name); 989 1.1 jruoho break; 990 1.1 jruoho 991 1.1 jruoho case AML_INT_NAMEDFIELD_OP: 992 1.1 jruoho 993 1.1 jruoho Length = AcpiDmDumpName (Op->Named.Name); 994 1.1.1.12 christos 995 1.1.1.12 christos AcpiOsPrintf (","); 996 1.1.1.12 christos ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0); 997 1.1.1.12 christos AcpiOsPrintf ("%*.s %u", (unsigned) (5 - Length), " ", 998 1.1 jruoho (UINT32) Op->Common.Value.Integer); 999 1.1.1.12 christos 1000 1.1 jruoho AcpiDmCommaIfFieldMember (Op); 1001 1.1 jruoho 1002 1.1 jruoho Info->BitOffset += (UINT32) Op->Common.Value.Integer; 1003 1.1 jruoho break; 1004 1.1 jruoho 1005 1.1 jruoho case AML_INT_RESERVEDFIELD_OP: 1006 1.1 jruoho 1007 1.1 jruoho /* Offset() -- Must account for previous offsets */ 1008 1.1 jruoho 1009 1.1 jruoho Offset = (UINT32) Op->Common.Value.Integer; 1010 1.1 jruoho Info->BitOffset += Offset; 1011 1.1 jruoho 1012 1.1 jruoho if (Info->BitOffset % 8 == 0) 1013 1.1 jruoho { 1014 1.1.1.3 christos AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset)); 1015 1.1 jruoho } 1016 1.1 jruoho else 1017 1.1 jruoho { 1018 1.1 jruoho AcpiOsPrintf (" , %u", Offset); 1019 1.1 jruoho } 1020 1.1 jruoho 1021 1.1 jruoho AcpiDmCommaIfFieldMember (Op); 1022 1.1 jruoho break; 1023 1.1 jruoho 1024 1.1 jruoho case AML_INT_ACCESSFIELD_OP: 1025 1.1.1.3 christos case AML_INT_EXTACCESSFIELD_OP: 1026 1.1.1.3 christos 1027 1.1.1.3 christos AcpiOsPrintf ("AccessAs (%s, ", 1028 1.1.1.3 christos AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer & 0x7)]); 1029 1.1.1.3 christos 1030 1.1.1.3 christos AcpiDmDecodeAttribute ((UINT8) (Op->Common.Value.Integer >> 8)); 1031 1.1 jruoho 1032 1.1.1.3 christos if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP) 1033 1.1.1.3 christos { 1034 1.1.1.7 christos AcpiOsPrintf (" (0x%2.2X)", (unsigned) 1035 1.1.1.7 christos ((Op->Common.Value.Integer >> 16) & 0xFF)); 1036 1.1.1.3 christos } 1037 1.1 jruoho 1038 1.1 jruoho AcpiOsPrintf (")"); 1039 1.1 jruoho AcpiDmCommaIfFieldMember (Op); 1040 1.1.1.12 christos ASL_CV_PRINT_ONE_COMMENT (Op, AML_COMMENT_END_NODE, NULL, 0); 1041 1.1 jruoho break; 1042 1.1 jruoho 1043 1.1.1.3 christos case AML_INT_CONNECTION_OP: 1044 1.1.1.3 christos /* 1045 1.1.1.3 christos * Two types of Connection() - one with a buffer object, the 1046 1.1.1.3 christos * other with a namestring that points to a buffer object. 1047 1.1.1.3 christos */ 1048 1.1.1.3 christos AcpiOsPrintf ("Connection ("); 1049 1.1.1.3 christos Child = Op->Common.Value.Arg; 1050 1.1.1.3 christos 1051 1.1.1.3 christos if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP) 1052 1.1.1.3 christos { 1053 1.1.1.3 christos AcpiOsPrintf ("\n"); 1054 1.1.1.3 christos 1055 1.1.1.3 christos Aml = Child->Named.Data; 1056 1.1.1.3 christos Length = (UINT32) Child->Common.Value.Integer; 1057 1.1.1.3 christos 1058 1.1.1.3 christos Info->Level += 1; 1059 1.1.1.4 christos Info->MappingOp = Op; 1060 1.1.1.3 christos Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; 1061 1.1.1.4 christos 1062 1.1.1.3 christos AcpiDmResourceTemplate (Info, Op->Common.Parent, Aml, Length); 1063 1.1.1.3 christos 1064 1.1.1.3 christos Info->Level -= 1; 1065 1.1.1.3 christos AcpiDmIndent (Info->Level); 1066 1.1.1.3 christos } 1067 1.1.1.3 christos else 1068 1.1.1.3 christos { 1069 1.1.1.3 christos AcpiDmNamestring (Child->Common.Value.Name); 1070 1.1.1.3 christos } 1071 1.1.1.3 christos 1072 1.1.1.3 christos AcpiOsPrintf (")"); 1073 1.1.1.3 christos AcpiDmCommaIfFieldMember (Op); 1074 1.1.1.12 christos ASL_CV_PRINT_ONE_COMMENT (Op, AML_COMMENT_END_NODE, NULL, 0); 1075 1.1.1.12 christos ASL_CV_PRINT_ONE_COMMENT (Op, AMLCOMMENT_INLINE, NULL, 0); 1076 1.1.1.3 christos AcpiOsPrintf ("\n"); 1077 1.1.1.3 christos 1078 1.1.1.3 christos Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; /* for now, ignore in AcpiDmAscendingOp */ 1079 1.1.1.3 christos Child->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 1080 1.1.1.3 christos break; 1081 1.1 jruoho 1082 1.1 jruoho case AML_INT_BYTELIST_OP: 1083 1.1 jruoho 1084 1.1 jruoho AcpiDmByteList (Info, Op); 1085 1.1 jruoho break; 1086 1.1 jruoho 1087 1.1 jruoho case AML_INT_METHODCALL_OP: 1088 1.1 jruoho 1089 1.1 jruoho Op = AcpiPsGetDepthNext (NULL, Op); 1090 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 1091 1.1 jruoho 1092 1.1 jruoho AcpiDmNamestring (Op->Common.Value.Name); 1093 1.1 jruoho break; 1094 1.1 jruoho 1095 1.1.1.11 christos case AML_WHILE_OP: 1096 1.1.1.11 christos 1097 1.1.1.12 christos if (Op->Common.DisasmOpcode == ACPI_DASM_SWITCH) 1098 1.1.1.11 christos { 1099 1.1.1.11 christos AcpiOsPrintf ("%s", "Switch"); 1100 1.1.1.11 christos break; 1101 1.1.1.11 christos } 1102 1.1.1.11 christos 1103 1.1.1.11 christos AcpiOsPrintf ("%s", OpInfo->Name); 1104 1.1.1.11 christos break; 1105 1.1.1.11 christos 1106 1.1.1.11 christos case AML_IF_OP: 1107 1.1.1.11 christos 1108 1.1.1.11 christos if (Op->Common.DisasmOpcode == ACPI_DASM_CASE) 1109 1.1.1.11 christos { 1110 1.1.1.11 christos AcpiOsPrintf ("%s", "Case"); 1111 1.1.1.11 christos break; 1112 1.1.1.11 christos } 1113 1.1.1.11 christos 1114 1.1.1.11 christos AcpiOsPrintf ("%s", OpInfo->Name); 1115 1.1.1.11 christos break; 1116 1.1.1.11 christos 1117 1.1.1.7 christos case AML_ELSE_OP: 1118 1.1.1.7 christos 1119 1.1.1.7 christos AcpiDmConvertToElseIf (Op); 1120 1.1.1.7 christos break; 1121 1.1.1.7 christos 1122 1.1.1.8 christos case AML_EXTERNAL_OP: 1123 1.1.1.8 christos 1124 1.1.1.9 christos if (AcpiGbl_DmEmitExternalOpcodes) 1125 1.1.1.9 christos { 1126 1.1.1.13 christos AcpiDmEmitExternal (Op, AcpiPsGetArg(Op, 0)); 1127 1.1.1.9 christos } 1128 1.1.1.8 christos 1129 1.1.1.12 christos break; 1130 1.1.1.12 christos 1131 1.1 jruoho default: 1132 1.1 jruoho 1133 1.1 jruoho /* Just get the opcode name and print it */ 1134 1.1 jruoho 1135 1.1 jruoho AcpiOsPrintf ("%s", OpInfo->Name); 1136 1.1 jruoho 1137 1.1 jruoho 1138 1.1 jruoho #ifdef ACPI_DEBUGGER 1139 1.1 jruoho 1140 1.1 jruoho if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) && 1141 1.1 jruoho (WalkState) && 1142 1.1 jruoho (WalkState->Results) && 1143 1.1 jruoho (WalkState->ResultCount)) 1144 1.1 jruoho { 1145 1.1.1.6 christos AcpiDbDecodeInternalObject ( 1146 1.1 jruoho WalkState->Results->Results.ObjDesc [ 1147 1.1 jruoho (WalkState->ResultCount - 1) % 1148 1.1 jruoho ACPI_RESULTS_FRAME_OBJ_NUM]); 1149 1.1 jruoho } 1150 1.1 jruoho #endif 1151 1.1 jruoho 1152 1.1 jruoho break; 1153 1.1 jruoho } 1154 1.1 jruoho } 1155 1.1 jruoho 1156 1.1.1.7 christos 1157 1.1.1.7 christos /******************************************************************************* 1158 1.1.1.7 christos * 1159 1.1.1.7 christos * FUNCTION: AcpiDmConvertToElseIf 1160 1.1.1.7 christos * 1161 1.1.1.7 christos * PARAMETERS: OriginalElseOp - ELSE Object to be examined 1162 1.1.1.7 christos * 1163 1.1.1.7 christos * RETURN: None. Emits either an "Else" or an "ElseIf" ASL operator. 1164 1.1.1.7 christos * 1165 1.1.1.7 christos * DESCRIPTION: Detect and convert an If..Else..If sequence to If..ElseIf 1166 1.1.1.7 christos * 1167 1.1.1.7 christos * EXAMPLE: 1168 1.1.1.7 christos * 1169 1.1.1.7 christos * This If..Else..If nested sequence: 1170 1.1.1.7 christos * 1171 1.1.1.7 christos * If (Arg0 == 1) 1172 1.1.1.7 christos * { 1173 1.1.1.7 christos * Local0 = 4 1174 1.1.1.7 christos * } 1175 1.1.1.7 christos * Else 1176 1.1.1.7 christos * { 1177 1.1.1.7 christos * If (Arg0 == 2) 1178 1.1.1.7 christos * { 1179 1.1.1.7 christos * Local0 = 5 1180 1.1.1.7 christos * } 1181 1.1.1.7 christos * } 1182 1.1.1.7 christos * 1183 1.1.1.7 christos * Is converted to this simpler If..ElseIf sequence: 1184 1.1.1.7 christos * 1185 1.1.1.7 christos * If (Arg0 == 1) 1186 1.1.1.7 christos * { 1187 1.1.1.7 christos * Local0 = 4 1188 1.1.1.7 christos * } 1189 1.1.1.7 christos * ElseIf (Arg0 == 2) 1190 1.1.1.7 christos * { 1191 1.1.1.7 christos * Local0 = 5 1192 1.1.1.7 christos * } 1193 1.1.1.7 christos * 1194 1.1.1.7 christos * NOTE: There is no actual ElseIf AML opcode. ElseIf is essentially an ASL 1195 1.1.1.7 christos * macro that emits an Else opcode followed by an If opcode. This function 1196 1.1.1.7 christos * reverses these AML sequences back to an ElseIf macro where possible. This 1197 1.1.1.7 christos * can make the disassembled ASL code simpler and more like the original code. 1198 1.1.1.7 christos * 1199 1.1.1.7 christos ******************************************************************************/ 1200 1.1.1.7 christos 1201 1.1.1.7 christos static void 1202 1.1.1.7 christos AcpiDmConvertToElseIf ( 1203 1.1.1.7 christos ACPI_PARSE_OBJECT *OriginalElseOp) 1204 1.1.1.7 christos { 1205 1.1.1.7 christos ACPI_PARSE_OBJECT *IfOp; 1206 1.1.1.7 christos ACPI_PARSE_OBJECT *ElseOp; 1207 1.1.1.7 christos 1208 1.1.1.7 christos 1209 1.1.1.8 christos /* 1210 1.1.1.8 christos * To be able to perform the conversion, two conditions must be satisfied: 1211 1.1.1.8 christos * 1) The first child of the Else must be an If statement. 1212 1.1.1.8 christos * 2) The If block can only be followed by an Else block and these must 1213 1.1.1.8 christos * be the only blocks under the original Else. 1214 1.1.1.8 christos */ 1215 1.1.1.7 christos IfOp = OriginalElseOp->Common.Value.Arg; 1216 1.1.1.10 christos 1217 1.1.1.8 christos if (!IfOp || 1218 1.1.1.8 christos (IfOp->Common.AmlOpcode != AML_IF_OP) || 1219 1.1.1.8 christos (IfOp->Asl.Next && (IfOp->Asl.Next->Common.AmlOpcode != AML_ELSE_OP))) 1220 1.1.1.7 christos { 1221 1.1.1.10 christos /* Not a proper Else..If sequence, cannot convert to ElseIf */ 1222 1.1.1.10 christos 1223 1.1.1.11 christos if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT) 1224 1.1.1.11 christos { 1225 1.1.1.11 christos AcpiOsPrintf ("%s", "Default"); 1226 1.1.1.11 christos return; 1227 1.1.1.11 christos } 1228 1.1.1.11 christos 1229 1.1.1.10 christos AcpiOsPrintf ("%s", "Else"); 1230 1.1.1.10 christos return; 1231 1.1.1.10 christos } 1232 1.1.1.10 christos 1233 1.1.1.10 christos /* Cannot have anything following the If...Else block */ 1234 1.1.1.7 christos 1235 1.1.1.10 christos ElseOp = IfOp->Common.Next; 1236 1.1.1.10 christos if (ElseOp && ElseOp->Common.Next) 1237 1.1.1.10 christos { 1238 1.1.1.11 christos if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT) 1239 1.1.1.11 christos { 1240 1.1.1.11 christos AcpiOsPrintf ("%s", "Default"); 1241 1.1.1.11 christos return; 1242 1.1.1.11 christos } 1243 1.1.1.11 christos 1244 1.1.1.7 christos AcpiOsPrintf ("%s", "Else"); 1245 1.1.1.7 christos return; 1246 1.1.1.7 christos } 1247 1.1.1.7 christos 1248 1.1.1.11 christos if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT) 1249 1.1.1.11 christos { 1250 1.1.1.11 christos /* 1251 1.1.1.11 christos * There is an ElseIf but in this case the Else is actually 1252 1.1.1.11 christos * a Default block for a Switch/Case statement. No conversion. 1253 1.1.1.11 christos */ 1254 1.1.1.11 christos AcpiOsPrintf ("%s", "Default"); 1255 1.1.1.11 christos return; 1256 1.1.1.11 christos } 1257 1.1.1.11 christos 1258 1.1.1.11 christos if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_CASE) 1259 1.1.1.11 christos { 1260 1.1.1.11 christos /* 1261 1.1.1.11 christos * This ElseIf is actually a Case block for a Switch/Case 1262 1.1.1.11 christos * statement. Print Case but do not return so that we can 1263 1.1.1.11 christos * promote the subtree and keep the indentation level. 1264 1.1.1.11 christos */ 1265 1.1.1.11 christos AcpiOsPrintf ("%s", "Case"); 1266 1.1.1.11 christos } 1267 1.1.1.11 christos else 1268 1.1.1.11 christos { 1269 1.1.1.11 christos /* Emit ElseIf, mark the IF as now an ELSEIF */ 1270 1.1.1.11 christos 1271 1.1.1.11 christos AcpiOsPrintf ("%s", "ElseIf"); 1272 1.1.1.11 christos } 1273 1.1.1.7 christos 1274 1.1.1.7 christos IfOp->Common.DisasmFlags |= ACPI_PARSEOP_ELSEIF; 1275 1.1.1.7 christos 1276 1.1.1.7 christos /* The IF parent will now be the same as the original ELSE parent */ 1277 1.1.1.7 christos 1278 1.1.1.7 christos IfOp->Common.Parent = OriginalElseOp->Common.Parent; 1279 1.1.1.7 christos 1280 1.1.1.7 christos /* 1281 1.1.1.7 christos * Update the NEXT pointers to restructure the parse tree, essentially 1282 1.1.1.7 christos * promoting an If..Else block up to the same level as the original 1283 1.1.1.7 christos * Else. 1284 1.1.1.7 christos * 1285 1.1.1.7 christos * Check if the IF has a corresponding ELSE peer 1286 1.1.1.7 christos */ 1287 1.1.1.7 christos ElseOp = IfOp->Common.Next; 1288 1.1.1.7 christos if (ElseOp && 1289 1.1.1.7 christos (ElseOp->Common.AmlOpcode == AML_ELSE_OP)) 1290 1.1.1.7 christos { 1291 1.1.1.7 christos /* If an ELSE matches the IF, promote it also */ 1292 1.1.1.7 christos 1293 1.1.1.7 christos ElseOp->Common.Parent = OriginalElseOp->Common.Parent; 1294 1.1.1.10 christos 1295 1.1.1.10 christos /* Promote the entire block under the ElseIf (All Next OPs) */ 1296 1.1.1.10 christos 1297 1.1.1.10 christos AcpiDmPromoteSubtree (OriginalElseOp); 1298 1.1.1.7 christos } 1299 1.1.1.7 christos else 1300 1.1.1.7 christos { 1301 1.1.1.7 christos /* Otherwise, set the IF NEXT to the original ELSE NEXT */ 1302 1.1.1.7 christos 1303 1.1.1.7 christos IfOp->Common.Next = OriginalElseOp->Common.Next; 1304 1.1.1.7 christos } 1305 1.1.1.7 christos 1306 1.1.1.7 christos /* Detach the child IF block from the original ELSE */ 1307 1.1.1.7 christos 1308 1.1.1.7 christos OriginalElseOp->Common.Value.Arg = NULL; 1309 1.1.1.7 christos 1310 1.1.1.7 christos /* Ignore the original ELSE from now on */ 1311 1.1.1.7 christos 1312 1.1.1.7 christos OriginalElseOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 1313 1.1.1.7 christos OriginalElseOp->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX; 1314 1.1.1.7 christos 1315 1.1.1.7 christos /* Insert IF (now ELSEIF) as next peer of the original ELSE */ 1316 1.1.1.7 christos 1317 1.1.1.7 christos OriginalElseOp->Common.Next = IfOp; 1318 1.1.1.7 christos } 1319 1.1.1.10 christos 1320 1.1.1.10 christos 1321 1.1.1.10 christos /******************************************************************************* 1322 1.1.1.10 christos * 1323 1.1.1.10 christos * FUNCTION: AcpiDmPromoteSubtree 1324 1.1.1.10 christos * 1325 1.1.1.10 christos * PARAMETERS: StartOpOp - Original parent of the entire subtree 1326 1.1.1.10 christos * 1327 1.1.1.10 christos * RETURN: None 1328 1.1.1.10 christos * 1329 1.1.1.10 christos * DESCRIPTION: Promote an entire parse subtree up one level. 1330 1.1.1.10 christos * 1331 1.1.1.10 christos ******************************************************************************/ 1332 1.1.1.10 christos 1333 1.1.1.10 christos static void 1334 1.1.1.10 christos AcpiDmPromoteSubtree ( 1335 1.1.1.10 christos ACPI_PARSE_OBJECT *StartOp) 1336 1.1.1.10 christos { 1337 1.1.1.10 christos ACPI_PARSE_OBJECT *Op; 1338 1.1.1.10 christos ACPI_PARSE_OBJECT *ParentOp; 1339 1.1.1.10 christos 1340 1.1.1.10 christos 1341 1.1.1.10 christos /* New parent for subtree elements */ 1342 1.1.1.10 christos 1343 1.1.1.10 christos ParentOp = StartOp->Common.Parent; 1344 1.1.1.10 christos 1345 1.1.1.10 christos /* First child starts the subtree */ 1346 1.1.1.10 christos 1347 1.1.1.10 christos Op = StartOp->Common.Value.Arg; 1348 1.1.1.10 christos 1349 1.1.1.10 christos /* Walk the top-level elements of the subtree */ 1350 1.1.1.10 christos 1351 1.1.1.10 christos while (Op) 1352 1.1.1.10 christos { 1353 1.1.1.10 christos Op->Common.Parent = ParentOp; 1354 1.1.1.10 christos if (!Op->Common.Next) 1355 1.1.1.10 christos { 1356 1.1.1.10 christos /* Last Op in list, update its next field */ 1357 1.1.1.10 christos 1358 1.1.1.10 christos Op->Common.Next = StartOp->Common.Next; 1359 1.1.1.10 christos break; 1360 1.1.1.10 christos } 1361 1.1.1.10 christos Op = Op->Common.Next; 1362 1.1.1.10 christos } 1363 1.1.1.10 christos } 1364