dsobject.c revision 91116
1/****************************************************************************** 2 * 3 * Module Name: dsobject - Dispatcher object management routines 4 * $Revision: 90 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89 * PARTICULAR PURPOSE. 90 * 91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98 * LIMITED REMEDY. 99 * 100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 101 * software or system incorporating such software without first obtaining any 102 * required license or other approval from the U. S. Department of Commerce or 103 * any other agency or department of the United States Government. In the 104 * event Licensee exports any such software from the United States or 105 * re-exports any such software from a foreign destination, Licensee shall 106 * ensure that the distribution and export/re-export of the software is in 107 * compliance with all laws, regulations, orders, or other restrictions of the 108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109 * any of its subsidiaries will export/re-export any technical data, process, 110 * software, or service, directly or indirectly, to any country for which the 111 * United States government or any agency thereof requires an export license, 112 * other governmental approval, or letter of assurance, without first obtaining 113 * such license, approval or letter. 114 * 115 *****************************************************************************/ 116 117#define __DSOBJECT_C__ 118 119#include "acpi.h" 120#include "acparser.h" 121#include "amlcode.h" 122#include "acdispat.h" 123#include "acinterp.h" 124#include "acnamesp.h" 125 126#define _COMPONENT ACPI_DISPATCHER 127 ACPI_MODULE_NAME ("dsobject") 128 129 130/******************************************************************************* 131 * 132 * FUNCTION: AcpiDsInitOneObject 133 * 134 * PARAMETERS: ObjHandle - Node 135 * Level - Current nesting level 136 * Context - Points to a init info struct 137 * ReturnValue - Not used 138 * 139 * RETURN: Status 140 * 141 * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object 142 * within the namespace. 143 * 144 * Currently, the only objects that require initialization are: 145 * 1) Methods 146 * 2) Op Regions 147 * 148 ******************************************************************************/ 149 150ACPI_STATUS 151AcpiDsInitOneObject ( 152 ACPI_HANDLE ObjHandle, 153 UINT32 Level, 154 void *Context, 155 void **ReturnValue) 156{ 157 ACPI_OBJECT_TYPE Type; 158 ACPI_STATUS Status; 159 ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; 160 UINT8 TableRevision; 161 162 163 ACPI_FUNCTION_NAME ("DsInitOneObject"); 164 165 166 Info->ObjectCount++; 167 TableRevision = Info->TableDesc->Pointer->Revision; 168 169 /* 170 * We are only interested in objects owned by the table that 171 * was just loaded 172 */ 173 if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId != 174 Info->TableDesc->TableId) 175 { 176 return (AE_OK); 177 } 178 179 180 /* And even then, we are only interested in a few object types */ 181 182 Type = AcpiNsGetType (ObjHandle); 183 184 switch (Type) 185 { 186 case ACPI_TYPE_REGION: 187 188 AcpiDsInitializeRegion (ObjHandle); 189 190 Info->OpRegionCount++; 191 break; 192 193 194 case ACPI_TYPE_METHOD: 195 196 Info->MethodCount++; 197 198 if (!(AcpiDbgLevel & ACPI_LV_INIT)) 199 { 200 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ".")); 201 } 202 203 /* 204 * Set the execution data width (32 or 64) based upon the 205 * revision number of the parent ACPI table. 206 */ 207 if (TableRevision == 1) 208 { 209 ((ACPI_NAMESPACE_NODE *)ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32; 210 } 211 212 /* 213 * Always parse methods to detect errors, we may delete 214 * the parse tree below 215 */ 216 Status = AcpiDsParseMethod (ObjHandle); 217 if (ACPI_FAILURE (Status)) 218 { 219 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", 220 ObjHandle, (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, 221 AcpiFormatException (Status))); 222 223 /* This parse failed, but we will continue parsing more methods */ 224 225 break; 226 } 227 228 /* 229 * Delete the parse tree. We simple re-parse the method 230 * for every execution since there isn't much overhead 231 */ 232 AcpiNsDeleteNamespaceSubtree (ObjHandle); 233 AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId); 234 break; 235 236 default: 237 break; 238 } 239 240 /* 241 * We ignore errors from above, and always return OK, since 242 * we don't want to abort the walk on a single error. 243 */ 244 return (AE_OK); 245} 246 247 248/******************************************************************************* 249 * 250 * FUNCTION: AcpiDsInitializeObjects 251 * 252 * PARAMETERS: None 253 * 254 * RETURN: Status 255 * 256 * DESCRIPTION: Walk the entire namespace and perform any necessary 257 * initialization on the objects found therein 258 * 259 ******************************************************************************/ 260 261ACPI_STATUS 262AcpiDsInitializeObjects ( 263 ACPI_TABLE_DESC *TableDesc, 264 ACPI_NAMESPACE_NODE *StartNode) 265{ 266 ACPI_STATUS Status; 267 ACPI_INIT_WALK_INFO Info; 268 269 270 ACPI_FUNCTION_TRACE ("DsInitializeObjects"); 271 272 273 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 274 "**** Starting initialization of namespace objects ****\n")); 275 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Parsing Methods:")); 276 277 278 Info.MethodCount = 0; 279 Info.OpRegionCount = 0; 280 Info.ObjectCount = 0; 281 Info.TableDesc = TableDesc; 282 283 284 /* Walk entire namespace from the supplied root */ 285 286 Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, 287 AcpiDsInitOneObject, &Info, NULL); 288 if (ACPI_FAILURE (Status)) 289 { 290 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status)); 291 } 292 293 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, 294 "\n%d Control Methods found and parsed (%d nodes total)\n", 295 Info.MethodCount, Info.ObjectCount)); 296 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 297 "%d Control Methods found\n", Info.MethodCount)); 298 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 299 "%d Op Regions found\n", Info.OpRegionCount)); 300 301 return_ACPI_STATUS (AE_OK); 302} 303 304 305/***************************************************************************** 306 * 307 * FUNCTION: AcpiDsInitObjectFromOp 308 * 309 * PARAMETERS: Op - Parser op used to init the internal object 310 * Opcode - AML opcode associated with the object 311 * ObjDesc - Namespace object to be initialized 312 * 313 * RETURN: Status 314 * 315 * DESCRIPTION: Initialize a namespace object from a parser Op and its 316 * associated arguments. The namespace object is a more compact 317 * representation of the Op and its arguments. 318 * 319 ****************************************************************************/ 320 321ACPI_STATUS 322AcpiDsInitObjectFromOp ( 323 ACPI_WALK_STATE *WalkState, 324 ACPI_PARSE_OBJECT *Op, 325 UINT16 Opcode, 326 ACPI_OPERAND_OBJECT **RetObjDesc) 327{ 328 ACPI_STATUS Status; 329 ACPI_PARSE_OBJECT *Arg; 330 ACPI_PARSE2_OBJECT *ByteList; 331 ACPI_OPERAND_OBJECT *ArgDesc; 332 const ACPI_OPCODE_INFO *OpInfo; 333 ACPI_OPERAND_OBJECT *ObjDesc; 334 335 336 ACPI_FUNCTION_NAME ("DsInitObjectFromOp"); 337 338 339 ObjDesc = *RetObjDesc; 340 OpInfo = AcpiPsGetOpcodeInfo (Opcode); 341 if (OpInfo->Class == AML_CLASS_UNKNOWN) 342 { 343 /* Unknown opcode */ 344 345 return (AE_TYPE); 346 } 347 348 349 /* Get and prepare the first argument */ 350 351 switch (ObjDesc->Common.Type) 352 { 353 case ACPI_TYPE_BUFFER: 354 355 ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; 356 357 /* First arg is a number */ 358 359 AcpiDsCreateOperand (WalkState, Op->Value.Arg, 0); 360 ArgDesc = WalkState->Operands [WalkState->NumOperands - 1]; 361 AcpiDsObjStackPop (1, WalkState); 362 363 /* Resolve the object (could be an arg or local) */ 364 365 Status = AcpiExResolveToValue (&ArgDesc, WalkState); 366 if (ACPI_FAILURE (Status)) 367 { 368 AcpiUtRemoveReference (ArgDesc); 369 return (Status); 370 } 371 372 /* We are expecting a number */ 373 374 if (ArgDesc->Common.Type != ACPI_TYPE_INTEGER) 375 { 376 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 377 "Expecting number, got obj: %p type %X\n", 378 ArgDesc, ArgDesc->Common.Type)); 379 AcpiUtRemoveReference (ArgDesc); 380 return (AE_TYPE); 381 } 382 383 /* Get the value, delete the internal object */ 384 385 ObjDesc->Buffer.Length = (UINT32) ArgDesc->Integer.Value; 386 AcpiUtRemoveReference (ArgDesc); 387 388 /* Allocate the buffer */ 389 390 if (ObjDesc->Buffer.Length == 0) 391 { 392 ObjDesc->Buffer.Pointer = NULL; 393 ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n")); 394 break; 395 } 396 397 else 398 { 399 ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE ( 400 ObjDesc->Buffer.Length); 401 402 if (!ObjDesc->Buffer.Pointer) 403 { 404 return (AE_NO_MEMORY); 405 } 406 } 407 408 /* 409 * Second arg is the buffer data (optional) ByteList can be either 410 * individual bytes or a string initializer. 411 */ 412 Arg = Op->Value.Arg; /* skip first arg */ 413 414 ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next; 415 if (ByteList) 416 { 417 if (ByteList->Opcode != AML_INT_BYTELIST_OP) 418 { 419 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Expecting bytelist, got: %p\n", 420 ByteList)); 421 return (AE_TYPE); 422 } 423 424 ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Data, 425 ObjDesc->Buffer.Length); 426 } 427 428 break; 429 430 431 case ACPI_TYPE_PACKAGE: 432 433 /* 434 * When called, an internal package object has already been built and 435 * is pointed to by ObjDesc. AcpiDsBuildInternalObject builds another 436 * internal package object, so remove reference to the original so 437 * that it is deleted. Error checking is done within the remove 438 * reference function. 439 */ 440 AcpiUtRemoveReference (ObjDesc); 441 Status = AcpiDsBuildInternalObject (WalkState, Op, RetObjDesc); 442 break; 443 444 case ACPI_TYPE_INTEGER: 445 ObjDesc->Integer.Value = Op->Value.Integer; 446 break; 447 448 449 case ACPI_TYPE_STRING: 450 ObjDesc->String.Pointer = Op->Value.String; 451 ObjDesc->String.Length = ACPI_STRLEN (Op->Value.String); 452 453 /* 454 * The string is contained in the ACPI table, don't ever try 455 * to delete it 456 */ 457 ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; 458 break; 459 460 461 case ACPI_TYPE_METHOD: 462 break; 463 464 465 case INTERNAL_TYPE_REFERENCE: 466 467 switch (OpInfo->Type) 468 { 469 case AML_TYPE_LOCAL_VARIABLE: 470 471 /* Split the opcode into a base opcode + offset */ 472 473 ObjDesc->Reference.Opcode = AML_LOCAL_OP; 474 ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP; 475 break; 476 477 478 case AML_TYPE_METHOD_ARGUMENT: 479 480 /* Split the opcode into a base opcode + offset */ 481 482 ObjDesc->Reference.Opcode = AML_ARG_OP; 483 ObjDesc->Reference.Offset = Opcode - AML_ARG_OP; 484 break; 485 486 487 default: /* Constants, Literals, etc.. */ 488 489 if (Op->Opcode == AML_INT_NAMEPATH_OP) 490 { 491 /* Node was saved in Op */ 492 493 ObjDesc->Reference.Node = Op->Node; 494 } 495 496 ObjDesc->Reference.Opcode = Opcode; 497 break; 498 } 499 500 break; 501 502 503 default: 504 505 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %x\n", 506 ObjDesc->Common.Type)); 507 508 break; 509 } 510 511 return (AE_OK); 512} 513 514 515/***************************************************************************** 516 * 517 * FUNCTION: AcpiDsBuildInternalSimpleObj 518 * 519 * PARAMETERS: Op - Parser object to be translated 520 * ObjDescPtr - Where the ACPI internal object is returned 521 * 522 * RETURN: Status 523 * 524 * DESCRIPTION: Translate a parser Op object to the equivalent namespace object 525 * Simple objects are any objects other than a package object! 526 * 527 ****************************************************************************/ 528 529static ACPI_STATUS 530AcpiDsBuildInternalSimpleObj ( 531 ACPI_WALK_STATE *WalkState, 532 ACPI_PARSE_OBJECT *Op, 533 ACPI_OPERAND_OBJECT **ObjDescPtr) 534{ 535 ACPI_OPERAND_OBJECT *ObjDesc; 536 ACPI_STATUS Status; 537 char *Name; 538 539 540 ACPI_FUNCTION_TRACE ("DsBuildInternalSimpleObj"); 541 542 543 if (Op->Opcode == AML_INT_NAMEPATH_OP) 544 { 545 /* 546 * This is an object reference. If this name was 547 * previously looked up in the namespace, it was stored in this op. 548 * Otherwise, go ahead and look it up now 549 */ 550 if (!Op->Node) 551 { 552 Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String, 553 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 554 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, 555 (ACPI_NAMESPACE_NODE **) &(Op->Node)); 556 557 if (ACPI_FAILURE (Status)) 558 { 559 if (Status == AE_NOT_FOUND) 560 { 561 Name = NULL; 562 AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, NULL, &Name); 563 564 if (Name) 565 { 566 ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n", 567 Name, Op->AmlOffset)); 568 ACPI_MEM_FREE (Name); 569 } 570 571 else 572 { 573 ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n", 574 Op->Value.String, Op->AmlOffset)); 575 } 576 577 *ObjDescPtr = NULL; 578 } 579 580 else 581 { 582 return_ACPI_STATUS (Status); 583 } 584 } 585 } 586 } 587 588 /* Create and init the internal ACPI object */ 589 590 ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Opcode))->ObjectType); 591 if (!ObjDesc) 592 { 593 return_ACPI_STATUS (AE_NO_MEMORY); 594 } 595 596 Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Opcode, &ObjDesc); 597 if (ACPI_FAILURE (Status)) 598 { 599 AcpiUtRemoveReference (ObjDesc); 600 return_ACPI_STATUS (Status); 601 } 602 603 *ObjDescPtr = ObjDesc; 604 605 return_ACPI_STATUS (AE_OK); 606} 607 608 609/***************************************************************************** 610 * 611 * FUNCTION: AcpiDsBuildInternalPackageObj 612 * 613 * PARAMETERS: Op - Parser object to be translated 614 * ObjDescPtr - Where the ACPI internal object is returned 615 * 616 * RETURN: Status 617 * 618 * DESCRIPTION: Translate a parser Op package object to the equivalent 619 * namespace object 620 * 621 ****************************************************************************/ 622 623ACPI_STATUS 624AcpiDsBuildInternalPackageObj ( 625 ACPI_WALK_STATE *WalkState, 626 ACPI_PARSE_OBJECT *Op, 627 ACPI_OPERAND_OBJECT **ObjDescPtr) 628{ 629 ACPI_PARSE_OBJECT *Arg; 630 ACPI_OPERAND_OBJECT *ObjDesc; 631 ACPI_STATUS Status = AE_OK; 632 633 634 ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj"); 635 636 637 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); 638 *ObjDescPtr = ObjDesc; 639 if (!ObjDesc) 640 { 641 return_ACPI_STATUS (AE_NO_MEMORY); 642 } 643 644 if (Op->Opcode == AML_VAR_PACKAGE_OP) 645 { 646 /* 647 * Variable length package parameters are evaluated JIT 648 */ 649 return_ACPI_STATUS (AE_OK); 650 } 651 652 /* The first argument must be the package length */ 653 654 Arg = Op->Value.Arg; 655 ObjDesc->Package.Count = Arg->Value.Integer32; 656 657 /* 658 * Allocate the array of pointers (ptrs to the 659 * individual objects) Add an extra pointer slot so 660 * that the list is always null terminated. 661 */ 662 ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE ( 663 (ObjDesc->Package.Count + 1) * sizeof (void *)); 664 665 if (!ObjDesc->Package.Elements) 666 { 667 AcpiUtDeleteObjectDesc (ObjDesc); 668 return_ACPI_STATUS (AE_NO_MEMORY); 669 } 670 671 ObjDesc->Package.NextElement = ObjDesc->Package.Elements; 672 673 /* 674 * Now init the elements of the package 675 */ 676 Arg = Arg->Next; 677 while (Arg) 678 { 679 if (Arg->Opcode == AML_PACKAGE_OP) 680 { 681 Status = AcpiDsBuildInternalPackageObj (WalkState, Arg, 682 ObjDesc->Package.NextElement); 683 } 684 685 else 686 { 687 Status = AcpiDsBuildInternalSimpleObj (WalkState, Arg, 688 ObjDesc->Package.NextElement); 689 } 690 691 ObjDesc->Package.NextElement++; 692 Arg = Arg->Next; 693 } 694 695 ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; 696 return_ACPI_STATUS (Status); 697} 698 699 700/***************************************************************************** 701 * 702 * FUNCTION: AcpiDsBuildInternalObject 703 * 704 * PARAMETERS: Op - Parser object to be translated 705 * ObjDescPtr - Where the ACPI internal object is returned 706 * 707 * RETURN: Status 708 * 709 * DESCRIPTION: Translate a parser Op object to the equivalent namespace 710 * object 711 * 712 ****************************************************************************/ 713 714ACPI_STATUS 715AcpiDsBuildInternalObject ( 716 ACPI_WALK_STATE *WalkState, 717 ACPI_PARSE_OBJECT *Op, 718 ACPI_OPERAND_OBJECT **ObjDescPtr) 719{ 720 ACPI_STATUS Status; 721 722 723 switch (Op->Opcode) 724 { 725 case AML_PACKAGE_OP: 726 case AML_VAR_PACKAGE_OP: 727 728 Status = AcpiDsBuildInternalPackageObj (WalkState, Op, ObjDescPtr); 729 break; 730 731 732 default: 733 734 Status = AcpiDsBuildInternalSimpleObj (WalkState, Op, ObjDescPtr); 735 break; 736 } 737 738 return (Status); 739} 740 741 742/***************************************************************************** 743 * 744 * FUNCTION: AcpiDsCreateNode 745 * 746 * PARAMETERS: Op - Parser object to be translated 747 * ObjDescPtr - Where the ACPI internal object is returned 748 * 749 * RETURN: Status 750 * 751 * DESCRIPTION: 752 * 753 ****************************************************************************/ 754 755ACPI_STATUS 756AcpiDsCreateNode ( 757 ACPI_WALK_STATE *WalkState, 758 ACPI_NAMESPACE_NODE *Node, 759 ACPI_PARSE_OBJECT *Op) 760{ 761 ACPI_STATUS Status; 762 ACPI_OPERAND_OBJECT *ObjDesc; 763 764 765 ACPI_FUNCTION_TRACE_PTR ("DsCreateNode", Op); 766 767 768 /* 769 * Because of the execution pass through the non-control-method 770 * parts of the table, we can arrive here twice. Only init 771 * the named object node the first time through 772 */ 773 if (AcpiNsGetAttachedObject (Node)) 774 { 775 return_ACPI_STATUS (AE_OK); 776 } 777 778 if (!Op->Value.Arg) 779 { 780 /* No arguments, there is nothing to do */ 781 782 return_ACPI_STATUS (AE_OK); 783 } 784 785 /* Build an internal object for the argument(s) */ 786 787 Status = AcpiDsBuildInternalObject (WalkState, Op->Value.Arg, &ObjDesc); 788 if (ACPI_FAILURE (Status)) 789 { 790 return_ACPI_STATUS (Status); 791 } 792 793 /* Re-type the object according to it's argument */ 794 795 Node->Type = ObjDesc->Common.Type; 796 797 /* Init obj */ 798 799 Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type); 800 801 /* Remove local reference to the object */ 802 803 AcpiUtRemoveReference (ObjDesc); 804 return_ACPI_STATUS (Status); 805} 806 807 808