dsobject.c revision 87031
1/****************************************************************************** 2 * 3 * Module Name: dsobject - Dispatcher object management routines 4 * $Revision: 85 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 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_TYPE8 Type; 158 ACPI_STATUS Status; 159 ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; 160 UINT8 TableRevision; 161 162 163 PROC_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 187 case ACPI_TYPE_REGION: 188 189 AcpiDsInitializeRegion (ObjHandle); 190 191 Info->OpRegionCount++; 192 break; 193 194 195 case ACPI_TYPE_METHOD: 196 197 Info->MethodCount++; 198 199 if (!(AcpiDbgLevel & ACPI_LV_INIT)) 200 { 201 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ".")); 202 } 203 204 /* 205 * Set the execution data width (32 or 64) based upon the 206 * revision number of the parent ACPI table. 207 */ 208 if (TableRevision == 1) 209 { 210 ((ACPI_NAMESPACE_NODE *)ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32; 211 } 212 213 /* 214 * Always parse methods to detect errors, we may delete 215 * the parse tree below 216 */ 217 Status = AcpiDsParseMethod (ObjHandle); 218 if (ACPI_FAILURE (Status)) 219 { 220 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", 221 ObjHandle, (char*)&((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, 222 AcpiFormatException (Status))); 223 224 /* This parse failed, but we will continue parsing more methods */ 225 226 break; 227 } 228 229 /* 230 * Delete the parse tree. We simple re-parse the method 231 * for every execution since there isn't much overhead 232 */ 233 AcpiNsDeleteNamespaceSubtree (ObjHandle); 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 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 PROC_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 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 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 = 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 UINT32 Length; 538 char *Name; 539 540 541 FUNCTION_TRACE ("DsBuildInternalSimpleObj"); 542 543 544 if (Op->Opcode == AML_INT_NAMEPATH_OP) 545 { 546 /* 547 * This is an object reference. If this name was 548 * previously looked up in the namespace, it was stored in this op. 549 * Otherwise, go ahead and look it up now 550 */ 551 if (!Op->Node) 552 { 553 Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String, 554 ACPI_TYPE_ANY, IMODE_EXECUTE, 555 NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, 556 (ACPI_NAMESPACE_NODE **)&(Op->Node)); 557 558 if (ACPI_FAILURE (Status)) 559 { 560 if (Status == AE_NOT_FOUND) 561 { 562 Name = NULL; 563 AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, &Length, &Name); 564 565 if (Name) 566 { 567 REPORT_WARNING (("Reference %s at AML %X not found\n", 568 Name, Op->AmlOffset)); 569 ACPI_MEM_FREE (Name); 570 } 571 572 else 573 { 574 REPORT_WARNING (("Reference %s at AML %X not found\n", 575 Op->Value.String, Op->AmlOffset)); 576 } 577 578 *ObjDescPtr = NULL; 579 } 580 581 else 582 { 583 return_ACPI_STATUS (Status); 584 } 585 } 586 } 587 } 588 589 /* Create and init the internal ACPI object */ 590 591 ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Opcode))->ObjectType); 592 if (!ObjDesc) 593 { 594 return_ACPI_STATUS (AE_NO_MEMORY); 595 } 596 597 Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Opcode, &ObjDesc); 598 if (ACPI_FAILURE (Status)) 599 { 600 AcpiUtRemoveReference (ObjDesc); 601 return_ACPI_STATUS (Status); 602 } 603 604 *ObjDescPtr = ObjDesc; 605 606 return_ACPI_STATUS (AE_OK); 607} 608 609 610/***************************************************************************** 611 * 612 * FUNCTION: AcpiDsBuildInternalPackageObj 613 * 614 * PARAMETERS: Op - Parser object to be translated 615 * ObjDescPtr - Where the ACPI internal object is returned 616 * 617 * RETURN: Status 618 * 619 * DESCRIPTION: Translate a parser Op package object to the equivalent 620 * namespace object 621 * 622 ****************************************************************************/ 623 624ACPI_STATUS 625AcpiDsBuildInternalPackageObj ( 626 ACPI_WALK_STATE *WalkState, 627 ACPI_PARSE_OBJECT *Op, 628 ACPI_OPERAND_OBJECT **ObjDescPtr) 629{ 630 ACPI_PARSE_OBJECT *Arg; 631 ACPI_OPERAND_OBJECT *ObjDesc; 632 ACPI_STATUS Status = AE_OK; 633 634 635 FUNCTION_TRACE ("DsBuildInternalPackageObj"); 636 637 638 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); 639 *ObjDescPtr = ObjDesc; 640 if (!ObjDesc) 641 { 642 return_ACPI_STATUS (AE_NO_MEMORY); 643 } 644 645 if (Op->Opcode == AML_VAR_PACKAGE_OP) 646 { 647 /* 648 * Variable length package parameters are evaluated JIT 649 */ 650 return_ACPI_STATUS (AE_OK); 651 } 652 653 /* The first argument must be the package length */ 654 655 Arg = Op->Value.Arg; 656 ObjDesc->Package.Count = Arg->Value.Integer32; 657 658 /* 659 * Allocate the array of pointers (ptrs to the 660 * individual objects) Add an extra pointer slot so 661 * that the list is always null terminated. 662 */ 663 ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE ( 664 (ObjDesc->Package.Count + 1) * sizeof (void *)); 665 666 if (!ObjDesc->Package.Elements) 667 { 668 AcpiUtDeleteObjectDesc (ObjDesc); 669 return_ACPI_STATUS (AE_NO_MEMORY); 670 } 671 672 ObjDesc->Package.NextElement = ObjDesc->Package.Elements; 673 674 /* 675 * Now init the elements of the package 676 */ 677 Arg = Arg->Next; 678 while (Arg) 679 { 680 if (Arg->Opcode == AML_PACKAGE_OP) 681 { 682 Status = AcpiDsBuildInternalPackageObj (WalkState, Arg, 683 ObjDesc->Package.NextElement); 684 } 685 686 else 687 { 688 Status = AcpiDsBuildInternalSimpleObj (WalkState, Arg, 689 ObjDesc->Package.NextElement); 690 } 691 692 ObjDesc->Package.NextElement++; 693 Arg = Arg->Next; 694 } 695 696 ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; 697 return_ACPI_STATUS (Status); 698} 699 700 701/***************************************************************************** 702 * 703 * FUNCTION: AcpiDsBuildInternalObject 704 * 705 * PARAMETERS: Op - Parser object to be translated 706 * ObjDescPtr - Where the ACPI internal object is returned 707 * 708 * RETURN: Status 709 * 710 * DESCRIPTION: Translate a parser Op object to the equivalent namespace 711 * object 712 * 713 ****************************************************************************/ 714 715ACPI_STATUS 716AcpiDsBuildInternalObject ( 717 ACPI_WALK_STATE *WalkState, 718 ACPI_PARSE_OBJECT *Op, 719 ACPI_OPERAND_OBJECT **ObjDescPtr) 720{ 721 ACPI_STATUS Status; 722 723 724 switch (Op->Opcode) 725 { 726 case AML_PACKAGE_OP: 727 case AML_VAR_PACKAGE_OP: 728 729 Status = AcpiDsBuildInternalPackageObj (WalkState, Op, ObjDescPtr); 730 break; 731 732 733 default: 734 735 Status = AcpiDsBuildInternalSimpleObj (WalkState, Op, ObjDescPtr); 736 break; 737 } 738 739 return (Status); 740} 741 742 743/***************************************************************************** 744 * 745 * FUNCTION: AcpiDsCreateNode 746 * 747 * PARAMETERS: Op - Parser object to be translated 748 * ObjDescPtr - Where the ACPI internal object is returned 749 * 750 * RETURN: Status 751 * 752 * DESCRIPTION: 753 * 754 ****************************************************************************/ 755 756ACPI_STATUS 757AcpiDsCreateNode ( 758 ACPI_WALK_STATE *WalkState, 759 ACPI_NAMESPACE_NODE *Node, 760 ACPI_PARSE_OBJECT *Op) 761{ 762 ACPI_STATUS Status; 763 ACPI_OPERAND_OBJECT *ObjDesc; 764 765 766 FUNCTION_TRACE_PTR ("DsCreateNode", Op); 767 768 769 /* 770 * Because of the execution pass through the non-control-method 771 * parts of the table, we can arrive here twice. Only init 772 * the named object node the first time through 773 */ 774 if (AcpiNsGetAttachedObject (Node)) 775 { 776 return_ACPI_STATUS (AE_OK); 777 } 778 779 if (!Op->Value.Arg) 780 { 781 /* No arguments, there is nothing to do */ 782 783 return_ACPI_STATUS (AE_OK); 784 } 785 786 /* Build an internal object for the argument(s) */ 787 788 Status = AcpiDsBuildInternalObject (WalkState, Op->Value.Arg, &ObjDesc); 789 if (ACPI_FAILURE (Status)) 790 { 791 return_ACPI_STATUS (Status); 792 } 793 794 /* Re-type the object according to it's argument */ 795 796 Node->Type = ObjDesc->Common.Type; 797 798 /* Init obj */ 799 800 Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) Node->Type); 801 802 /* Remove local reference to the object */ 803 804 AcpiUtRemoveReference (ObjDesc); 805 return_ACPI_STATUS (Status); 806} 807 808 809