1118611Snjl/****************************************************************************** 2118611Snjl * 3118611Snjl * Module Name: asloperands - AML operand processing 4118611Snjl * 5118611Snjl *****************************************************************************/ 6118611Snjl 7217365Sjkim/* 8306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp. 9118611Snjl * All rights reserved. 10118611Snjl * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 25118611Snjl * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 29118611Snjl * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 43118611Snjl 44151937Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h> 45118611Snjl#include "aslcompiler.y.h" 46193529Sjkim#include <contrib/dev/acpica/include/amlcode.h> 47118611Snjl 48118611Snjl#define _COMPONENT ACPI_COMPILER 49118611Snjl ACPI_MODULE_NAME ("asloperands") 50118611Snjl 51151937Sjkim/* Local prototypes */ 52118611Snjl 53151937Sjkimstatic void 54151937SjkimOpnDoField ( 55151937Sjkim ACPI_PARSE_OBJECT *Op); 56151937Sjkim 57151937Sjkimstatic void 58151937SjkimOpnDoBankField ( 59151937Sjkim ACPI_PARSE_OBJECT *Op); 60151937Sjkim 61151937Sjkimstatic void 62151937SjkimOpnDoBuffer ( 63151937Sjkim ACPI_PARSE_OBJECT *Op); 64151937Sjkim 65151937Sjkimstatic void 66151937SjkimOpnDoDefinitionBlock ( 67151937Sjkim ACPI_PARSE_OBJECT *Op); 68151937Sjkim 69151937Sjkimstatic void 70151937SjkimOpnDoFieldCommon ( 71151937Sjkim ACPI_PARSE_OBJECT *FieldOp, 72151937Sjkim ACPI_PARSE_OBJECT *Op); 73151937Sjkim 74151937Sjkimstatic void 75151937SjkimOpnDoIndexField ( 76151937Sjkim ACPI_PARSE_OBJECT *Op); 77151937Sjkim 78151937Sjkimstatic void 79151937SjkimOpnDoLoadTable ( 80151937Sjkim ACPI_PARSE_OBJECT *Op); 81151937Sjkim 82151937Sjkimstatic void 83151937SjkimOpnDoMethod ( 84151937Sjkim ACPI_PARSE_OBJECT *Op); 85151937Sjkim 86151937Sjkimstatic void 87151937SjkimOpnDoMutex ( 88151937Sjkim ACPI_PARSE_OBJECT *Op); 89151937Sjkim 90151937Sjkimstatic void 91151937SjkimOpnDoRegion ( 92151937Sjkim ACPI_PARSE_OBJECT *Op); 93151937Sjkim 94151937Sjkimstatic void 95151937SjkimOpnAttachNameToNode ( 96151937Sjkim ACPI_PARSE_OBJECT *Op); 97151937Sjkim 98151937Sjkim 99118611Snjl/******************************************************************************* 100118611Snjl * 101151937Sjkim * FUNCTION: OpnDoMutex 102151937Sjkim * 103151937Sjkim * PARAMETERS: Op - The parent parse node 104151937Sjkim * 105151937Sjkim * RETURN: None 106151937Sjkim * 107151937Sjkim * DESCRIPTION: Construct the operands for the MUTEX ASL keyword. 108151937Sjkim * 109151937Sjkim ******************************************************************************/ 110151937Sjkim 111151937Sjkimstatic void 112151937SjkimOpnDoMutex ( 113151937Sjkim ACPI_PARSE_OBJECT *Op) 114151937Sjkim{ 115151937Sjkim ACPI_PARSE_OBJECT *Next; 116151937Sjkim 117151937Sjkim 118151937Sjkim Next = Op->Asl.Child; 119151937Sjkim Next = Next->Asl.Next; 120151937Sjkim 121151937Sjkim if (Next->Asl.Value.Integer > 15) 122151937Sjkim { 123151937Sjkim AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); 124151937Sjkim } 125151937Sjkim return; 126151937Sjkim} 127151937Sjkim 128151937Sjkim 129151937Sjkim/******************************************************************************* 130151937Sjkim * 131118611Snjl * FUNCTION: OpnDoMethod 132118611Snjl * 133118611Snjl * PARAMETERS: Op - The parent parse node 134118611Snjl * 135118611Snjl * RETURN: None 136118611Snjl * 137118611Snjl * DESCRIPTION: Construct the operands for the METHOD ASL keyword. 138118611Snjl * 139118611Snjl ******************************************************************************/ 140118611Snjl 141151937Sjkimstatic void 142118611SnjlOpnDoMethod ( 143118611Snjl ACPI_PARSE_OBJECT *Op) 144118611Snjl{ 145118611Snjl ACPI_PARSE_OBJECT *Next; 146118611Snjl 147118611Snjl /* Optional arguments for this opcode with defaults */ 148118611Snjl 149118611Snjl UINT8 NumArgs = 0; 150118611Snjl UINT8 Serialized = 0; 151118611Snjl UINT8 Concurrency = 0; 152118611Snjl UINT8 MethodFlags; 153118611Snjl 154118611Snjl 155118611Snjl /* Opcode and package length first */ 156118611Snjl /* Method name */ 157118611Snjl 158118611Snjl Next = Op->Asl.Child; 159118611Snjl 160118611Snjl /* Num args */ 161118611Snjl 162118611Snjl Next = Next->Asl.Next; 163118611Snjl if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) 164118611Snjl { 165118611Snjl NumArgs = (UINT8) Next->Asl.Value.Integer; 166118611Snjl Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 167118611Snjl } 168118611Snjl 169118611Snjl /* Serialized Flag */ 170118611Snjl 171118611Snjl Next = Next->Asl.Next; 172118611Snjl if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) 173118611Snjl { 174118611Snjl Serialized = (UINT8) Next->Asl.Value.Integer; 175118611Snjl Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 176118611Snjl } 177118611Snjl 178151937Sjkim /* Concurrency value (valid values are 0-15) */ 179118611Snjl 180118611Snjl Next = Next->Asl.Next; 181118611Snjl if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) 182118611Snjl { 183240716Sjkim /* This is a ByteConstExpr, so eval the constant now */ 184240716Sjkim 185240716Sjkim OpcAmlConstantWalk (Next, 0, NULL); 186240716Sjkim 187151937Sjkim if (Next->Asl.Value.Integer > 15) 188151937Sjkim { 189151937Sjkim AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); 190151937Sjkim } 191306536Sjkim 192118611Snjl Concurrency = (UINT8) Next->Asl.Value.Integer; 193118611Snjl } 194118611Snjl 195118611Snjl /* Put the bits in their proper places */ 196118611Snjl 197306536Sjkim MethodFlags = (UINT8) 198306536Sjkim ((NumArgs & 0x7) | 199306536Sjkim ((Serialized & 0x1) << 3) | 200306536Sjkim ((Concurrency & 0xF) << 4)); 201118611Snjl 202118611Snjl /* Use the last node for the combined flags byte */ 203118611Snjl 204118611Snjl Next->Asl.Value.Integer = MethodFlags; 205118611Snjl Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; 206118611Snjl Next->Asl.AmlLength = 1; 207118611Snjl Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; 208118611Snjl 209118611Snjl /* Save the arg count in the first node */ 210118611Snjl 211118611Snjl Op->Asl.Extra = NumArgs; 212118611Snjl} 213118611Snjl 214118611Snjl 215118611Snjl/******************************************************************************* 216118611Snjl * 217118611Snjl * FUNCTION: OpnDoFieldCommon 218118611Snjl * 219118611Snjl * PARAMETERS: FieldOp - Node for an ASL field 220118611Snjl * Op - The parent parse node 221118611Snjl * 222118611Snjl * RETURN: None 223118611Snjl * 224118611Snjl * DESCRIPTION: Construct the AML operands for the various field keywords, 225118611Snjl * FIELD, BANKFIELD, INDEXFIELD 226118611Snjl * 227118611Snjl ******************************************************************************/ 228118611Snjl 229151937Sjkimstatic void 230118611SnjlOpnDoFieldCommon ( 231118611Snjl ACPI_PARSE_OBJECT *FieldOp, 232118611Snjl ACPI_PARSE_OBJECT *Op) 233118611Snjl{ 234118611Snjl ACPI_PARSE_OBJECT *Next; 235118611Snjl ACPI_PARSE_OBJECT *PkgLengthNode; 236118611Snjl UINT32 CurrentBitOffset; 237118611Snjl UINT32 NewBitOffset; 238118611Snjl UINT8 AccessType; 239118611Snjl UINT8 LockRule; 240118611Snjl UINT8 UpdateRule; 241118611Snjl UINT8 FieldFlags; 242118611Snjl UINT32 MinimumLength; 243118611Snjl 244118611Snjl 245118611Snjl /* AccessType -- not optional, so no need to check for DEFAULT_ARG */ 246118611Snjl 247118611Snjl AccessType = (UINT8) Op->Asl.Value.Integer; 248118611Snjl Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 249118611Snjl 250118611Snjl /* Set the access type in the parent (field) node for use later */ 251118611Snjl 252118611Snjl FieldOp->Asl.Value.Integer = AccessType; 253118611Snjl 254118611Snjl /* LockRule -- not optional, so no need to check for DEFAULT_ARG */ 255118611Snjl 256118611Snjl Next = Op->Asl.Next; 257118611Snjl LockRule = (UINT8) Next->Asl.Value.Integer; 258118611Snjl Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 259118611Snjl 260118611Snjl /* UpdateRule -- not optional, so no need to check for DEFAULT_ARG */ 261118611Snjl 262118611Snjl Next = Next->Asl.Next; 263118611Snjl UpdateRule = (UINT8) Next->Asl.Value.Integer; 264118611Snjl 265118611Snjl /* 266241973Sjkim * Generate the flags byte. The various fields are already 267118611Snjl * in the right bit position via translation from the 268118611Snjl * keywords by the parser. 269118611Snjl */ 270118611Snjl FieldFlags = (UINT8) (AccessType | LockRule | UpdateRule); 271118611Snjl 272118611Snjl /* Use the previous node to be the FieldFlags node */ 273118611Snjl 274118611Snjl /* Set the node to RAW_DATA */ 275118611Snjl 276118611Snjl Next->Asl.Value.Integer = FieldFlags; 277306536Sjkim Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; 278306536Sjkim Next->Asl.AmlLength = 1; 279306536Sjkim Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; 280118611Snjl 281118611Snjl /* Process the FieldUnitList */ 282118611Snjl 283118611Snjl Next = Next->Asl.Next; 284118611Snjl CurrentBitOffset = 0; 285118611Snjl 286118611Snjl while (Next) 287118611Snjl { 288118611Snjl /* Save the offset of this field unit */ 289118611Snjl 290118611Snjl Next->Asl.ExtraValue = CurrentBitOffset; 291118611Snjl 292118611Snjl switch (Next->Asl.ParseOpcode) 293118611Snjl { 294118611Snjl case PARSEOP_ACCESSAS: 295118611Snjl 296118611Snjl PkgLengthNode = Next->Asl.Child; 297118611Snjl AccessType = (UINT8) PkgLengthNode->Asl.Value.Integer; 298118611Snjl 299118611Snjl /* Nothing additional to do */ 300118611Snjl break; 301118611Snjl 302118611Snjl case PARSEOP_OFFSET: 303118611Snjl 304118611Snjl /* New offset into the field */ 305118611Snjl 306118611Snjl PkgLengthNode = Next->Asl.Child; 307118611Snjl NewBitOffset = ((UINT32) PkgLengthNode->Asl.Value.Integer) * 8; 308118611Snjl 309118611Snjl /* 310118611Snjl * Examine the specified offset in relation to the 311118611Snjl * current offset counter. 312118611Snjl */ 313118611Snjl if (NewBitOffset < CurrentBitOffset) 314118611Snjl { 315118611Snjl /* 316118611Snjl * Not allowed to specify a backwards offset! 317118611Snjl * Issue error and ignore this node. 318118611Snjl */ 319151937Sjkim AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode, 320151937Sjkim NULL); 321118611Snjl Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 322118611Snjl PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 323118611Snjl } 324118611Snjl else if (NewBitOffset == CurrentBitOffset) 325118611Snjl { 326118611Snjl /* 327118611Snjl * Offset is redundant; we don't need to output an 328241973Sjkim * offset opcode. Just set these nodes to default 329118611Snjl */ 330118611Snjl Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 331118611Snjl PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 332118611Snjl } 333118611Snjl else 334118611Snjl { 335118611Snjl /* 336118611Snjl * Valid new offset - set the value to be inserted into the AML 337118611Snjl * and update the offset counter. 338118611Snjl */ 339151937Sjkim PkgLengthNode->Asl.Value.Integer = 340151937Sjkim NewBitOffset - CurrentBitOffset; 341118611Snjl CurrentBitOffset = NewBitOffset; 342118611Snjl } 343118611Snjl break; 344118611Snjl 345118611Snjl case PARSEOP_NAMESEG: 346118611Snjl case PARSEOP_RESERVED_BYTES: 347118611Snjl 348118611Snjl /* Named or reserved field entry */ 349118611Snjl 350306536Sjkim PkgLengthNode = Next->Asl.Child; 351306536Sjkim NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer; 352118611Snjl CurrentBitOffset += NewBitOffset; 353118611Snjl 354118611Snjl /* Save the current AccessAs value for error checking later */ 355118611Snjl 356118611Snjl switch (AccessType) 357118611Snjl { 358118611Snjl case AML_FIELD_ACCESS_ANY: 359118611Snjl case AML_FIELD_ACCESS_BYTE: 360118611Snjl case AML_FIELD_ACCESS_BUFFER: 361118611Snjl default: 362250838Sjkim 363118611Snjl MinimumLength = 8; 364118611Snjl break; 365118611Snjl 366118611Snjl case AML_FIELD_ACCESS_WORD: 367118611Snjl MinimumLength = 16; 368118611Snjl break; 369118611Snjl 370118611Snjl case AML_FIELD_ACCESS_DWORD: 371118611Snjl MinimumLength = 32; 372118611Snjl break; 373118611Snjl 374118611Snjl case AML_FIELD_ACCESS_QWORD: 375118611Snjl MinimumLength = 64; 376118611Snjl break; 377118611Snjl } 378118611Snjl 379118611Snjl PkgLengthNode->Asl.ExtraValue = MinimumLength; 380118611Snjl break; 381118611Snjl 382118611Snjl default: 383250838Sjkim 384118611Snjl /* All supported field opcodes must appear above */ 385250838Sjkim 386118611Snjl break; 387118611Snjl } 388118611Snjl 389118611Snjl /* Move on to next entry in the field list */ 390118611Snjl 391118611Snjl Next = Next->Asl.Next; 392118611Snjl } 393118611Snjl} 394118611Snjl 395118611Snjl 396118611Snjl/******************************************************************************* 397118611Snjl * 398118611Snjl * FUNCTION: OpnDoField 399118611Snjl * 400118611Snjl * PARAMETERS: Op - The parent parse node 401118611Snjl * 402118611Snjl * RETURN: None 403118611Snjl * 404118611Snjl * DESCRIPTION: Construct the AML operands for the FIELD ASL keyword 405118611Snjl * 406118611Snjl ******************************************************************************/ 407118611Snjl 408151937Sjkimstatic void 409118611SnjlOpnDoField ( 410118611Snjl ACPI_PARSE_OBJECT *Op) 411118611Snjl{ 412118611Snjl ACPI_PARSE_OBJECT *Next; 413118611Snjl 414118611Snjl 415118611Snjl /* Opcode is parent node */ 416118611Snjl /* First child is field name */ 417118611Snjl 418118611Snjl Next = Op->Asl.Child; 419118611Snjl 420118611Snjl /* Second child is the AccessType */ 421118611Snjl 422118611Snjl OpnDoFieldCommon (Op, Next->Asl.Next); 423118611Snjl} 424118611Snjl 425118611Snjl 426118611Snjl/******************************************************************************* 427118611Snjl * 428118611Snjl * FUNCTION: OpnDoIndexField 429118611Snjl * 430118611Snjl * PARAMETERS: Op - The parent parse node 431118611Snjl * 432118611Snjl * RETURN: None 433118611Snjl * 434118611Snjl * DESCRIPTION: Construct the AML operands for the INDEXFIELD ASL keyword 435118611Snjl * 436118611Snjl ******************************************************************************/ 437118611Snjl 438151937Sjkimstatic void 439118611SnjlOpnDoIndexField ( 440118611Snjl ACPI_PARSE_OBJECT *Op) 441118611Snjl{ 442118611Snjl ACPI_PARSE_OBJECT *Next; 443118611Snjl 444118611Snjl 445118611Snjl /* Opcode is parent node */ 446118611Snjl /* First child is the index name */ 447118611Snjl 448118611Snjl Next = Op->Asl.Child; 449118611Snjl 450118611Snjl /* Second child is the data name */ 451118611Snjl 452118611Snjl Next = Next->Asl.Next; 453118611Snjl 454118611Snjl /* Third child is the AccessType */ 455118611Snjl 456118611Snjl OpnDoFieldCommon (Op, Next->Asl.Next); 457118611Snjl} 458118611Snjl 459118611Snjl 460118611Snjl/******************************************************************************* 461118611Snjl * 462118611Snjl * FUNCTION: OpnDoBankField 463118611Snjl * 464118611Snjl * PARAMETERS: Op - The parent parse node 465118611Snjl * 466118611Snjl * RETURN: None 467118611Snjl * 468118611Snjl * DESCRIPTION: Construct the AML operands for the BANKFIELD ASL keyword 469118611Snjl * 470118611Snjl ******************************************************************************/ 471118611Snjl 472151937Sjkimstatic void 473118611SnjlOpnDoBankField ( 474118611Snjl ACPI_PARSE_OBJECT *Op) 475118611Snjl{ 476118611Snjl ACPI_PARSE_OBJECT *Next; 477118611Snjl 478118611Snjl 479118611Snjl /* Opcode is parent node */ 480118611Snjl /* First child is the region name */ 481118611Snjl 482118611Snjl Next = Op->Asl.Child; 483118611Snjl 484118611Snjl /* Second child is the bank name */ 485118611Snjl 486118611Snjl Next = Next->Asl.Next; 487118611Snjl 488118611Snjl /* Third child is the bank value */ 489118611Snjl 490118611Snjl Next = Next->Asl.Next; 491118611Snjl 492118611Snjl /* Fourth child is the AccessType */ 493118611Snjl 494118611Snjl OpnDoFieldCommon (Op, Next->Asl.Next); 495118611Snjl} 496118611Snjl 497118611Snjl 498118611Snjl/******************************************************************************* 499118611Snjl * 500118611Snjl * FUNCTION: OpnDoRegion 501118611Snjl * 502118611Snjl * PARAMETERS: Op - The parent parse node 503118611Snjl * 504118611Snjl * RETURN: None 505118611Snjl * 506241973Sjkim * DESCRIPTION: Tries to get the length of the region. Can only do this at 507118611Snjl * compile time if the length is a constant. 508118611Snjl * 509118611Snjl ******************************************************************************/ 510118611Snjl 511151937Sjkimstatic void 512118611SnjlOpnDoRegion ( 513118611Snjl ACPI_PARSE_OBJECT *Op) 514118611Snjl{ 515118611Snjl ACPI_PARSE_OBJECT *Next; 516118611Snjl 517118611Snjl 518118611Snjl /* Opcode is parent node */ 519118611Snjl /* First child is the region name */ 520118611Snjl 521118611Snjl Next = Op->Asl.Child; 522118611Snjl 523118611Snjl /* Second child is the space ID*/ 524118611Snjl 525118611Snjl Next = Next->Asl.Next; 526118611Snjl 527118611Snjl /* Third child is the region offset */ 528118611Snjl 529118611Snjl Next = Next->Asl.Next; 530118611Snjl 531118611Snjl /* Fourth child is the region length */ 532118611Snjl 533118611Snjl Next = Next->Asl.Next; 534118611Snjl if (Next->Asl.ParseOpcode == PARSEOP_INTEGER) 535118611Snjl { 536118611Snjl Op->Asl.Value.Integer = Next->Asl.Value.Integer; 537118611Snjl } 538118611Snjl else 539118611Snjl { 540202771Sjkim Op->Asl.Value.Integer = ACPI_UINT64_MAX; 541118611Snjl } 542118611Snjl} 543118611Snjl 544118611Snjl 545118611Snjl/******************************************************************************* 546118611Snjl * 547118611Snjl * FUNCTION: OpnDoBuffer 548118611Snjl * 549118611Snjl * PARAMETERS: Op - The parent parse node 550118611Snjl * 551118611Snjl * RETURN: None 552118611Snjl * 553241973Sjkim * DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword. We 554118611Snjl * build a single raw byte buffer from the initialization nodes, 555118611Snjl * each parse node contains a buffer byte. 556118611Snjl * 557118611Snjl ******************************************************************************/ 558118611Snjl 559151937Sjkimstatic void 560118611SnjlOpnDoBuffer ( 561118611Snjl ACPI_PARSE_OBJECT *Op) 562118611Snjl{ 563118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 564118611Snjl ACPI_PARSE_OBJECT *BufferLengthOp; 565118611Snjl 566118611Snjl /* Optional arguments for this opcode with defaults */ 567118611Snjl 568118611Snjl UINT32 BufferLength = 0; 569118611Snjl 570118611Snjl 571118611Snjl /* Opcode and package length first */ 572118611Snjl /* Buffer Length is next, followed by the initializer list */ 573118611Snjl 574118611Snjl BufferLengthOp = Op->Asl.Child; 575118611Snjl InitializerOp = BufferLengthOp->Asl.Next; 576118611Snjl 577118611Snjl /* 578118611Snjl * If the BufferLength is not an INTEGER or was not specified in the ASL 579118611Snjl * (DEFAULT_ARG), it is a TermArg that is 580118611Snjl * evaluated at run-time, and we are therefore finished. 581118611Snjl */ 582118611Snjl if ((BufferLengthOp->Asl.ParseOpcode != PARSEOP_INTEGER) && 583118611Snjl (BufferLengthOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) 584118611Snjl { 585118611Snjl return; 586118611Snjl } 587118611Snjl 588118611Snjl /* 589118611Snjl * We want to count the number of items in the initializer list, because if 590118611Snjl * it is larger than the buffer length, we will define the buffer size 591118611Snjl * to be the size of the initializer list (as per the ACPI Specification) 592118611Snjl */ 593118611Snjl switch (InitializerOp->Asl.ParseOpcode) 594118611Snjl { 595118611Snjl case PARSEOP_INTEGER: 596118611Snjl case PARSEOP_BYTECONST: 597118611Snjl case PARSEOP_WORDCONST: 598118611Snjl case PARSEOP_DWORDCONST: 599118611Snjl 600118611Snjl /* The peer list contains the byte list (if any...) */ 601118611Snjl 602118611Snjl while (InitializerOp) 603118611Snjl { 604118611Snjl /* For buffers, this is a list of raw bytes */ 605118611Snjl 606306536Sjkim InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; 607306536Sjkim InitializerOp->Asl.AmlLength = 1; 608306536Sjkim InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; 609118611Snjl 610118611Snjl BufferLength++; 611118611Snjl InitializerOp = ASL_GET_PEER_NODE (InitializerOp); 612118611Snjl } 613118611Snjl break; 614118611Snjl 615118611Snjl case PARSEOP_STRING_LITERAL: 616118611Snjl 617118611Snjl /* 618241973Sjkim * Only one initializer, the string. Buffer must be big enough to hold 619118611Snjl * the string plus the null termination byte 620118611Snjl */ 621118611Snjl BufferLength = strlen (InitializerOp->Asl.Value.String) + 1; 622118611Snjl 623306536Sjkim InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; 624306536Sjkim InitializerOp->Asl.AmlLength = BufferLength; 625306536Sjkim InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; 626118611Snjl break; 627118611Snjl 628118611Snjl case PARSEOP_RAW_DATA: 629118611Snjl 630118611Snjl /* Buffer nodes are already initialized (e.g. Unicode operator) */ 631118611Snjl return; 632118611Snjl 633118611Snjl case PARSEOP_DEFAULT_ARG: 634118611Snjl break; 635118611Snjl 636250838Sjkim default: 637118611Snjl 638118611Snjl AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp, 639118611Snjl "Unknown buffer initializer opcode"); 640118611Snjl printf ("Unknown buffer initializer opcode [%s]\n", 641306536Sjkim UtGetOpName (InitializerOp->Asl.ParseOpcode)); 642118611Snjl return; 643118611Snjl } 644118611Snjl 645118611Snjl /* Check if initializer list is longer than the buffer length */ 646118611Snjl 647118611Snjl if (BufferLengthOp->Asl.Value.Integer > BufferLength) 648118611Snjl { 649118611Snjl BufferLength = (UINT32) BufferLengthOp->Asl.Value.Integer; 650118611Snjl } 651118611Snjl 652118611Snjl if (!BufferLength) 653118611Snjl { 654151937Sjkim /* No length AND no items -- issue notice */ 655118611Snjl 656151937Sjkim AslError (ASL_REMARK, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL); 657118611Snjl 658118611Snjl /* But go ahead and put the buffer length of zero into the AML */ 659118611Snjl } 660118611Snjl 661118611Snjl /* 662118611Snjl * Just set the buffer size node to be the buffer length, regardless 663118611Snjl * of whether it was previously an integer or a default_arg placeholder 664118611Snjl */ 665306536Sjkim BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; 666306536Sjkim BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; 667118611Snjl BufferLengthOp->Asl.Value.Integer = BufferLength; 668118611Snjl 669118611Snjl (void) OpcSetOptimalIntegerSize (BufferLengthOp); 670118611Snjl 671118611Snjl /* Remaining nodes are handled via the tree walk */ 672118611Snjl} 673118611Snjl 674118611Snjl 675118611Snjl/******************************************************************************* 676118611Snjl * 677118611Snjl * FUNCTION: OpnDoPackage 678118611Snjl * 679118611Snjl * PARAMETERS: Op - The parent parse node 680118611Snjl * 681118611Snjl * RETURN: None 682118611Snjl * 683241973Sjkim * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword. NOTE: 684151937Sjkim * can only be called after constants have been folded, to ensure 685151937Sjkim * that the PackageLength operand has been fully reduced. 686118611Snjl * 687118611Snjl ******************************************************************************/ 688118611Snjl 689118611Snjlvoid 690118611SnjlOpnDoPackage ( 691118611Snjl ACPI_PARSE_OBJECT *Op) 692118611Snjl{ 693118611Snjl ACPI_PARSE_OBJECT *InitializerOp; 694118611Snjl ACPI_PARSE_OBJECT *PackageLengthOp; 695151937Sjkim UINT32 PackageLength = 0; 696118611Snjl 697118611Snjl 698151937Sjkim /* Opcode and package length first, followed by the initializer list */ 699118611Snjl 700118611Snjl PackageLengthOp = Op->Asl.Child; 701118611Snjl InitializerOp = PackageLengthOp->Asl.Next; 702118611Snjl 703151937Sjkim /* Count the number of items in the initializer list */ 704151937Sjkim 705118611Snjl if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) 706118611Snjl { 707118611Snjl /* The peer list contains the byte list (if any...) */ 708118611Snjl 709118611Snjl while (InitializerOp) 710118611Snjl { 711118611Snjl PackageLength++; 712118611Snjl InitializerOp = InitializerOp->Asl.Next; 713118611Snjl } 714118611Snjl } 715118611Snjl 716151937Sjkim /* If package length is a constant, compare to the initializer list */ 717118611Snjl 718118611Snjl if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || 719151937Sjkim (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST)) 720118611Snjl { 721199337Sjkim if (PackageLengthOp->Asl.Value.Integer > PackageLength) 722118611Snjl { 723199337Sjkim /* 724199337Sjkim * Allow package length to be longer than the initializer 725199337Sjkim * list -- but if the length of initializer list is nonzero, 726199337Sjkim * issue a message since this is probably a coding error, 727199337Sjkim * even though technically legal. 728199337Sjkim */ 729199337Sjkim if (PackageLength > 0) 730199337Sjkim { 731199337Sjkim AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT, 732199337Sjkim PackageLengthOp, NULL); 733199337Sjkim } 734151937Sjkim 735118611Snjl PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer; 736118611Snjl } 737199337Sjkim else if (PackageLengthOp->Asl.Value.Integer < PackageLength) 738151937Sjkim { 739151937Sjkim /* 740199337Sjkim * The package length is smaller than the length of the 741199337Sjkim * initializer list. This is an error as per the ACPI spec. 742151937Sjkim */ 743199337Sjkim AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG, 744199337Sjkim PackageLengthOp, NULL); 745151937Sjkim } 746118611Snjl } 747118611Snjl 748151937Sjkim if (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) 749151937Sjkim { 750151937Sjkim /* 751151937Sjkim * This is the case if the PackageLength was left empty - Package() 752151937Sjkim * The package length becomes the length of the initializer list 753151937Sjkim */ 754151937Sjkim Op->Asl.Child->Asl.ParseOpcode = PARSEOP_INTEGER; 755151937Sjkim Op->Asl.Child->Asl.Value.Integer = PackageLength; 756151937Sjkim 757151937Sjkim /* Set the AML opcode */ 758151937Sjkim 759151937Sjkim (void) OpcSetOptimalIntegerSize (Op->Asl.Child); 760151937Sjkim } 761151937Sjkim 762151937Sjkim /* If not a variable-length package, check for a zero package length */ 763151937Sjkim 764118611Snjl if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || 765151937Sjkim (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST) || 766228110Sjkim (PackageLengthOp->Asl.ParseOpcode == PARSEOP_ZERO) || 767118611Snjl (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)) 768118611Snjl { 769118611Snjl if (!PackageLength) 770118611Snjl { 771151937Sjkim /* No length AND no initializer list -- issue a remark */ 772118611Snjl 773151937Sjkim AslError (ASL_REMARK, ASL_MSG_PACKAGE_LENGTH, 774151937Sjkim PackageLengthOp, NULL); 775118611Snjl 776118611Snjl /* But go ahead and put the buffer length of zero into the AML */ 777118611Snjl } 778118611Snjl } 779118611Snjl 780118611Snjl /* 781151937Sjkim * If the PackageLength is a constant <= 255, we can change the 782151937Sjkim * AML opcode from VarPackage to a simple (ACPI 1.0) Package opcode. 783118611Snjl */ 784228110Sjkim if (((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) && 785228110Sjkim (Op->Asl.Child->Asl.Value.Integer <= 255)) || 786228110Sjkim (Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ONE) || 787228110Sjkim (Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ONES)|| 788228110Sjkim (Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ZERO)) 789151937Sjkim { 790151937Sjkim Op->Asl.AmlOpcode = AML_PACKAGE_OP; 791151937Sjkim Op->Asl.ParseOpcode = PARSEOP_PACKAGE; 792118611Snjl 793151937Sjkim /* 794151937Sjkim * Just set the package size node to be the package length, regardless 795151937Sjkim * of whether it was previously an integer or a default_arg placeholder 796151937Sjkim */ 797151937Sjkim PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; 798151937Sjkim PackageLengthOp->Asl.AmlLength = 1; 799151937Sjkim PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; 800151937Sjkim PackageLengthOp->Asl.Value.Integer = PackageLength; 801151937Sjkim } 802151937Sjkim 803118611Snjl /* Remaining nodes are handled via the tree walk */ 804118611Snjl} 805118611Snjl 806118611Snjl 807118611Snjl/******************************************************************************* 808118611Snjl * 809118611Snjl * FUNCTION: OpnDoLoadTable 810118611Snjl * 811118611Snjl * PARAMETERS: Op - The parent parse node 812118611Snjl * 813118611Snjl * RETURN: None 814118611Snjl * 815118611Snjl * DESCRIPTION: Construct the AML operands for the LOADTABLE ASL keyword. 816118611Snjl * 817118611Snjl ******************************************************************************/ 818118611Snjl 819151937Sjkimstatic void 820118611SnjlOpnDoLoadTable ( 821118611Snjl ACPI_PARSE_OBJECT *Op) 822118611Snjl{ 823118611Snjl ACPI_PARSE_OBJECT *Next; 824118611Snjl 825118611Snjl 826118611Snjl /* Opcode is parent node */ 827118611Snjl /* First child is the table signature */ 828118611Snjl 829118611Snjl Next = Op->Asl.Child; 830118611Snjl 831118611Snjl /* Second child is the OEM ID*/ 832118611Snjl 833118611Snjl Next = Next->Asl.Next; 834118611Snjl 835118611Snjl /* Third child is the OEM table ID */ 836118611Snjl 837118611Snjl Next = Next->Asl.Next; 838118611Snjl 839118611Snjl /* Fourth child is the RootPath string */ 840118611Snjl 841118611Snjl Next = Next->Asl.Next; 842118611Snjl if (Next->Asl.ParseOpcode == PARSEOP_ZERO) 843118611Snjl { 844306536Sjkim Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; 845306536Sjkim Next->Asl.Value.String = "\\"; 846306536Sjkim Next->Asl.AmlLength = 2; 847118611Snjl OpcGenerateAmlOpcode (Next); 848118611Snjl } 849118611Snjl 850151937Sjkim#ifdef ASL_FUTURE_IMPLEMENTATION 851151937Sjkim 852151937Sjkim /* TBD: NOT IMPLEMENTED */ 853118611Snjl /* Fifth child is the [optional] ParameterPathString */ 854118611Snjl /* Sixth child is the [optional] ParameterData */ 855118611Snjl 856118611Snjl Next = Next->Asl.Next; 857118611Snjl if (Next->Asl.ParseOpcode == DEFAULT_ARG) 858118611Snjl { 859118611Snjl Next->Asl.AmlLength = 1; 860118611Snjl Next->Asl.ParseOpcode = ZERO; 861118611Snjl OpcGenerateAmlOpcode (Next); 862118611Snjl } 863118611Snjl 864118611Snjl 865118611Snjl Next = Next->Asl.Next; 866118611Snjl if (Next->Asl.ParseOpcode == DEFAULT_ARG) 867118611Snjl { 868118611Snjl Next->Asl.AmlLength = 1; 869118611Snjl Next->Asl.ParseOpcode = ZERO; 870118611Snjl OpcGenerateAmlOpcode (Next); 871118611Snjl } 872151937Sjkim#endif 873118611Snjl} 874118611Snjl 875118611Snjl 876118611Snjl/******************************************************************************* 877118611Snjl * 878118611Snjl * FUNCTION: OpnDoDefinitionBlock 879118611Snjl * 880118611Snjl * PARAMETERS: Op - The parent parse node 881118611Snjl * 882118611Snjl * RETURN: None 883118611Snjl * 884118611Snjl * DESCRIPTION: Construct the AML operands for the DEFINITIONBLOCK ASL keyword 885118611Snjl * 886118611Snjl ******************************************************************************/ 887118611Snjl 888151937Sjkimstatic void 889118611SnjlOpnDoDefinitionBlock ( 890118611Snjl ACPI_PARSE_OBJECT *Op) 891118611Snjl{ 892118611Snjl ACPI_PARSE_OBJECT *Child; 893118611Snjl ACPI_SIZE Length; 894193529Sjkim UINT32 i; 895193529Sjkim char *Filename; 896118611Snjl 897118611Snjl 898118611Snjl /* 899241973Sjkim * These nodes get stuffed into the table header. They are special 900118611Snjl * cased when the table is written to the output file. 901118611Snjl * 902118611Snjl * Mark all of these nodes as non-usable so they won't get output 903118611Snjl * as AML opcodes! 904118611Snjl */ 905118611Snjl 906167802Sjkim /* Get AML filename. Use it if non-null */ 907118611Snjl 908118611Snjl Child = Op->Asl.Child; 909167802Sjkim if (Child->Asl.Value.Buffer && 910167802Sjkim *Child->Asl.Value.Buffer && 911167802Sjkim (Gbl_UseDefaultAmlFilename)) 912118611Snjl { 913193529Sjkim /* 914193529Sjkim * We will use the AML filename that is embedded in the source file 915193529Sjkim * for the output filename. 916193529Sjkim */ 917281075Sdim Filename = UtStringCacheCalloc (strlen (Gbl_DirectoryPath) + 918281075Sdim strlen ((char *) Child->Asl.Value.Buffer) + 1); 919193529Sjkim 920193529Sjkim /* Prepend the current directory path */ 921193529Sjkim 922193529Sjkim strcpy (Filename, Gbl_DirectoryPath); 923193529Sjkim strcat (Filename, (char *) Child->Asl.Value.Buffer); 924193529Sjkim 925193529Sjkim Gbl_OutputFilenamePrefix = Filename; 926281075Sdim UtConvertBackslashes (Gbl_OutputFilenamePrefix); 927118611Snjl } 928306536Sjkim 929118611Snjl Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 930118611Snjl 931118611Snjl /* Signature */ 932118611Snjl 933118611Snjl Child = Child->Asl.Next; 934118611Snjl Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 935118611Snjl if (Child->Asl.Value.String) 936118611Snjl { 937118611Snjl Gbl_TableSignature = Child->Asl.Value.String; 938306536Sjkim if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE) 939118611Snjl { 940151937Sjkim AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, 941306536Sjkim "Length is not exactly 4"); 942118611Snjl } 943118611Snjl 944306536Sjkim for (i = 0; i < ACPI_NAME_SIZE; i++) 945118611Snjl { 946202771Sjkim if (!isalnum ((int) Gbl_TableSignature[i])) 947118611Snjl { 948151937Sjkim AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, 949151937Sjkim "Contains non-alphanumeric characters"); 950118611Snjl } 951118611Snjl } 952118611Snjl } 953118611Snjl 954118611Snjl /* Revision */ 955118611Snjl 956118611Snjl Child = Child->Asl.Next; 957118611Snjl Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 958167802Sjkim /* 959167802Sjkim * We used the revision to set the integer width earlier 960167802Sjkim */ 961118611Snjl 962118611Snjl /* OEMID */ 963118611Snjl 964118611Snjl Child = Child->Asl.Next; 965118611Snjl Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 966118611Snjl 967118611Snjl /* OEM TableID */ 968118611Snjl 969118611Snjl Child = Child->Asl.Next; 970118611Snjl Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 971118611Snjl if (Child->Asl.Value.String) 972118611Snjl { 973306536Sjkim Length = strlen (Child->Asl.Value.String); 974281075Sdim Gbl_TableId = UtStringCacheCalloc (Length + 1); 975306536Sjkim strcpy (Gbl_TableId, Child->Asl.Value.String); 976118611Snjl 977253690Sjkim /* 978253690Sjkim * Convert anything non-alphanumeric to an underscore. This 979253690Sjkim * allows us to use the TableID to generate unique C symbols. 980253690Sjkim */ 981118611Snjl for (i = 0; i < Length; i++) 982118611Snjl { 983253690Sjkim if (!isalnum ((int) Gbl_TableId[i])) 984118611Snjl { 985253690Sjkim Gbl_TableId[i] = '_'; 986118611Snjl } 987118611Snjl } 988118611Snjl } 989118611Snjl 990118611Snjl /* OEM Revision */ 991118611Snjl 992118611Snjl Child = Child->Asl.Next; 993118611Snjl Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; 994118611Snjl} 995118611Snjl 996118611Snjl 997118611Snjl/******************************************************************************* 998118611Snjl * 999118611Snjl * FUNCTION: UtGetArg 1000118611Snjl * 1001118611Snjl * PARAMETERS: Op - Get an argument for this op 1002118611Snjl * Argn - Nth argument to get 1003118611Snjl * 1004241973Sjkim * RETURN: The argument (as an Op object). NULL if argument does not exist 1005118611Snjl * 1006118611Snjl * DESCRIPTION: Get the specified op's argument (peer) 1007118611Snjl * 1008118611Snjl ******************************************************************************/ 1009118611Snjl 1010118611SnjlACPI_PARSE_OBJECT * 1011118611SnjlUtGetArg ( 1012118611Snjl ACPI_PARSE_OBJECT *Op, 1013118611Snjl UINT32 Argn) 1014118611Snjl{ 1015118611Snjl ACPI_PARSE_OBJECT *Arg = NULL; 1016118611Snjl 1017118611Snjl 1018118611Snjl /* Get the requested argument object */ 1019118611Snjl 1020118611Snjl Arg = Op->Asl.Child; 1021118611Snjl while (Arg && Argn) 1022118611Snjl { 1023118611Snjl Argn--; 1024118611Snjl Arg = Arg->Asl.Next; 1025118611Snjl } 1026118611Snjl 1027118611Snjl return (Arg); 1028118611Snjl} 1029118611Snjl 1030118611Snjl 1031118611Snjl/******************************************************************************* 1032118611Snjl * 1033118611Snjl * FUNCTION: OpnAttachNameToNode 1034118611Snjl * 1035118611Snjl * PARAMETERS: Op - The parent parse node 1036118611Snjl * 1037118611Snjl * RETURN: None 1038118611Snjl * 1039118611Snjl * DESCRIPTION: For the named ASL/AML operators, get the actual name from the 1040118611Snjl * argument list and attach it to the parent node so that we 1041118611Snjl * can get to it quickly later. 1042118611Snjl * 1043118611Snjl ******************************************************************************/ 1044118611Snjl 1045151937Sjkimstatic void 1046118611SnjlOpnAttachNameToNode ( 1047118611Snjl ACPI_PARSE_OBJECT *Op) 1048118611Snjl{ 1049118611Snjl ACPI_PARSE_OBJECT *Child = NULL; 1050118611Snjl 1051118611Snjl 1052306536Sjkim switch (Op->Asl.AmlOpcode) 1053118611Snjl { 1054118611Snjl case AML_DATA_REGION_OP: 1055118611Snjl case AML_DEVICE_OP: 1056118611Snjl case AML_EVENT_OP: 1057306536Sjkim case AML_EXTERNAL_OP: 1058118611Snjl case AML_METHOD_OP: 1059118611Snjl case AML_MUTEX_OP: 1060118611Snjl case AML_REGION_OP: 1061118611Snjl case AML_POWER_RES_OP: 1062118611Snjl case AML_PROCESSOR_OP: 1063118611Snjl case AML_THERMAL_ZONE_OP: 1064118611Snjl case AML_NAME_OP: 1065118611Snjl case AML_SCOPE_OP: 1066118611Snjl 1067118611Snjl Child = UtGetArg (Op, 0); 1068118611Snjl break; 1069118611Snjl 1070118611Snjl case AML_ALIAS_OP: 1071118611Snjl 1072118611Snjl Child = UtGetArg (Op, 1); 1073118611Snjl break; 1074118611Snjl 1075118611Snjl case AML_CREATE_BIT_FIELD_OP: 1076118611Snjl case AML_CREATE_BYTE_FIELD_OP: 1077118611Snjl case AML_CREATE_WORD_FIELD_OP: 1078118611Snjl case AML_CREATE_DWORD_FIELD_OP: 1079118611Snjl case AML_CREATE_QWORD_FIELD_OP: 1080118611Snjl 1081118611Snjl Child = UtGetArg (Op, 2); 1082118611Snjl break; 1083118611Snjl 1084118611Snjl case AML_CREATE_FIELD_OP: 1085118611Snjl 1086118611Snjl Child = UtGetArg (Op, 3); 1087118611Snjl break; 1088118611Snjl 1089118611Snjl case AML_BANK_FIELD_OP: 1090118611Snjl case AML_INDEX_FIELD_OP: 1091118611Snjl case AML_FIELD_OP: 1092118611Snjl 1093118611Snjl return; 1094118611Snjl 1095118611Snjl default: 1096250838Sjkim 1097118611Snjl return; 1098118611Snjl } 1099118611Snjl 1100118611Snjl if (Child) 1101118611Snjl { 1102118611Snjl UtAttachNamepathToOwner (Op, Child); 1103118611Snjl } 1104118611Snjl} 1105118611Snjl 1106118611Snjl 1107118611Snjl/******************************************************************************* 1108118611Snjl * 1109118611Snjl * FUNCTION: OpnGenerateAmlOperands 1110118611Snjl * 1111118611Snjl * PARAMETERS: Op - The parent parse node 1112118611Snjl * 1113118611Snjl * RETURN: None 1114118611Snjl * 1115241973Sjkim * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more 1116118611Snjl * complex AML opcodes require processing of the child nodes 1117118611Snjl * (arguments/operands). 1118118611Snjl * 1119118611Snjl ******************************************************************************/ 1120118611Snjl 1121118611Snjlvoid 1122118611SnjlOpnGenerateAmlOperands ( 1123118611Snjl ACPI_PARSE_OBJECT *Op) 1124118611Snjl{ 1125118611Snjl 1126118611Snjl 1127118611Snjl if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) 1128118611Snjl { 1129118611Snjl return; 1130118611Snjl } 1131118611Snjl 1132118611Snjl switch (Op->Asl.ParseOpcode) 1133118611Snjl { 1134306536Sjkim case PARSEOP_DEFINITION_BLOCK: 1135250838Sjkim 1136118611Snjl OpnDoDefinitionBlock (Op); 1137118611Snjl break; 1138118611Snjl 1139118611Snjl case PARSEOP_METHOD: 1140250838Sjkim 1141118611Snjl OpnDoMethod (Op); 1142118611Snjl break; 1143118611Snjl 1144151937Sjkim case PARSEOP_MUTEX: 1145250838Sjkim 1146151937Sjkim OpnDoMutex (Op); 1147151937Sjkim break; 1148151937Sjkim 1149118611Snjl case PARSEOP_FIELD: 1150250838Sjkim 1151118611Snjl OpnDoField (Op); 1152118611Snjl break; 1153118611Snjl 1154118611Snjl case PARSEOP_INDEXFIELD: 1155250838Sjkim 1156118611Snjl OpnDoIndexField (Op); 1157118611Snjl break; 1158118611Snjl 1159118611Snjl case PARSEOP_BANKFIELD: 1160250838Sjkim 1161118611Snjl OpnDoBankField (Op); 1162118611Snjl break; 1163118611Snjl 1164118611Snjl case PARSEOP_BUFFER: 1165250838Sjkim 1166118611Snjl OpnDoBuffer (Op); 1167118611Snjl break; 1168118611Snjl 1169118611Snjl case PARSEOP_LOADTABLE: 1170250838Sjkim 1171118611Snjl OpnDoLoadTable (Op); 1172118611Snjl break; 1173118611Snjl 1174118611Snjl case PARSEOP_OPERATIONREGION: 1175250838Sjkim 1176118611Snjl OpnDoRegion (Op); 1177118611Snjl break; 1178118611Snjl 1179118611Snjl case PARSEOP_RESOURCETEMPLATE: 1180250838Sjkim 1181118611Snjl RsDoResourceTemplate (Op); 1182118611Snjl break; 1183118611Snjl 1184118611Snjl case PARSEOP_NAMESEG: 1185118611Snjl case PARSEOP_NAMESTRING: 1186118611Snjl case PARSEOP_METHODCALL: 1187118611Snjl case PARSEOP_STRING_LITERAL: 1188118611Snjl default: 1189250838Sjkim 1190118611Snjl break; 1191118611Snjl } 1192118611Snjl 1193118611Snjl /* TBD: move */ 1194118611Snjl 1195118611Snjl OpnAttachNameToNode (Op); 1196118611Snjl} 1197