psargs.c revision 102550
1/****************************************************************************** 2 * 3 * Module Name: psargs - Parse AML opcode arguments 4 * $Revision: 64 $ 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 __PSARGS_C__ 118 119#include "acpi.h" 120#include "acparser.h" 121#include "amlcode.h" 122#include "acnamesp.h" 123 124#define _COMPONENT ACPI_PARSER 125 ACPI_MODULE_NAME ("psargs") 126 127 128/******************************************************************************* 129 * 130 * FUNCTION: AcpiPsGetNextPackageLength 131 * 132 * PARAMETERS: ParserState - Current parser state object 133 * 134 * RETURN: Decoded package length. On completion, the AML pointer points 135 * past the length byte or bytes. 136 * 137 * DESCRIPTION: Decode and return a package length field 138 * 139 ******************************************************************************/ 140 141UINT32 142AcpiPsGetNextPackageLength ( 143 ACPI_PARSE_STATE *ParserState) 144{ 145 UINT32 EncodedLength; 146 UINT32 Length = 0; 147 148 149 ACPI_FUNCTION_TRACE ("PsGetNextPackageLength"); 150 151 152 EncodedLength = (UINT32) ACPI_GET8 (ParserState->Aml); 153 ParserState->Aml++; 154 155 156 switch (EncodedLength >> 6) /* bits 6-7 contain encoding scheme */ 157 { 158 case 0: /* 1-byte encoding (bits 0-5) */ 159 160 Length = (EncodedLength & 0x3F); 161 break; 162 163 164 case 1: /* 2-byte encoding (next byte + bits 0-3) */ 165 166 Length = ((ACPI_GET8 (ParserState->Aml) << 04) | 167 (EncodedLength & 0x0F)); 168 ParserState->Aml++; 169 break; 170 171 172 case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */ 173 174 Length = ((ACPI_GET8 (ParserState->Aml + 1) << 12) | 175 (ACPI_GET8 (ParserState->Aml) << 04) | 176 (EncodedLength & 0x0F)); 177 ParserState->Aml += 2; 178 break; 179 180 181 case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */ 182 183 Length = ((ACPI_GET8 (ParserState->Aml + 2) << 20) | 184 (ACPI_GET8 (ParserState->Aml + 1) << 12) | 185 (ACPI_GET8 (ParserState->Aml) << 04) | 186 (EncodedLength & 0x0F)); 187 ParserState->Aml += 3; 188 break; 189 190 default: 191 /* Can't get here, only 2 bits / 4 cases */ 192 break; 193 } 194 195 return_VALUE (Length); 196} 197 198 199/******************************************************************************* 200 * 201 * FUNCTION: AcpiPsGetNextPackageEnd 202 * 203 * PARAMETERS: ParserState - Current parser state object 204 * 205 * RETURN: Pointer to end-of-package +1 206 * 207 * DESCRIPTION: Get next package length and return a pointer past the end of 208 * the package. Consumes the package length field 209 * 210 ******************************************************************************/ 211 212UINT8 * 213AcpiPsGetNextPackageEnd ( 214 ACPI_PARSE_STATE *ParserState) 215{ 216 UINT8 *Start = ParserState->Aml; 217 NATIVE_UINT Length; 218 219 220 ACPI_FUNCTION_TRACE ("PsGetNextPackageEnd"); 221 222 223 Length = (NATIVE_UINT) AcpiPsGetNextPackageLength (ParserState); 224 225 return_PTR (Start + Length); /* end of package */ 226} 227 228 229/******************************************************************************* 230 * 231 * FUNCTION: AcpiPsGetNextNamestring 232 * 233 * PARAMETERS: ParserState - Current parser state object 234 * 235 * RETURN: Pointer to the start of the name string (pointer points into 236 * the AML. 237 * 238 * DESCRIPTION: Get next raw namestring within the AML stream. Handles all name 239 * prefix characters. Set parser state to point past the string. 240 * (Name is consumed from the AML.) 241 * 242 ******************************************************************************/ 243 244NATIVE_CHAR * 245AcpiPsGetNextNamestring ( 246 ACPI_PARSE_STATE *ParserState) 247{ 248 UINT8 *Start = ParserState->Aml; 249 UINT8 *End = ParserState->Aml; 250 251 252 ACPI_FUNCTION_TRACE ("PsGetNextNamestring"); 253 254 255 /* Handle multiple prefix characters */ 256 257 while (AcpiPsIsPrefixChar (ACPI_GET8 (End))) 258 { 259 /* Include prefix '\\' or '^' */ 260 261 End++; 262 } 263 264 /* Decode the path */ 265 266 switch (ACPI_GET8 (End)) 267 { 268 case 0: 269 270 /* NullName */ 271 272 if (End == Start) 273 { 274 Start = NULL; 275 } 276 End++; 277 break; 278 279 case AML_DUAL_NAME_PREFIX: 280 281 /* Two name segments */ 282 283 End += 9; 284 break; 285 286 case AML_MULTI_NAME_PREFIX_OP: 287 288 /* Multiple name segments, 4 chars each */ 289 290 End += 2 + ((ACPI_SIZE) ACPI_GET8 (End + 1) * 4); 291 break; 292 293 default: 294 295 /* Single name segment */ 296 297 End += 4; 298 break; 299 } 300 301 ParserState->Aml = (UINT8*) End; 302 return_PTR ((NATIVE_CHAR *) Start); 303} 304 305 306/******************************************************************************* 307 * 308 * FUNCTION: AcpiPsGetNextNamepath 309 * 310 * PARAMETERS: ParserState - Current parser state object 311 * Arg - Where the namepath will be stored 312 * ArgCount - If the namepath points to a control method 313 * the method's argument is returned here. 314 * MethodCall - Whether the namepath can be the start 315 * of a method call 316 * 317 * RETURN: Status 318 * 319 * DESCRIPTION: Get next name (if method call, return # of required args). 320 * Names are looked up in the internal namespace to determine 321 * if the name represents a control method. If a method 322 * is found, the number of arguments to the method is returned. 323 * This information is critical for parsing to continue correctly. 324 * 325 ******************************************************************************/ 326 327ACPI_STATUS 328AcpiPsGetNextNamepath ( 329 ACPI_PARSE_STATE *ParserState, 330 ACPI_PARSE_OBJECT *Arg, 331 UINT32 *ArgCount, 332 BOOLEAN MethodCall) 333{ 334 NATIVE_CHAR *Path; 335 ACPI_PARSE_OBJECT *NameOp; 336 ACPI_STATUS Status = AE_OK; 337 ACPI_OPERAND_OBJECT *MethodDesc; 338 ACPI_NAMESPACE_NODE *Node; 339 ACPI_GENERIC_STATE ScopeInfo; 340 341 342 ACPI_FUNCTION_TRACE ("PsGetNextNamepath"); 343 344 345 Path = AcpiPsGetNextNamestring (ParserState); 346 347 /* Null path case is allowed */ 348 349 if (Path) 350 { 351 /* 352 * Lookup the name in the internal namespace 353 */ 354 ScopeInfo.Scope.Node = NULL; 355 Node = ParserState->StartNode; 356 if (Node) 357 { 358 ScopeInfo.Scope.Node = Node; 359 } 360 361 /* 362 * Lookup object. We don't want to add anything new to the namespace 363 * here, however. So we use MODE_EXECUTE. Allow searching of the 364 * parent tree, but don't open a new scope -- we just want to lookup the 365 * object (MUST BE mode EXECUTE to perform upsearch) 366 */ 367 Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 368 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, 369 &Node); 370 if (ACPI_SUCCESS (Status) && MethodCall) 371 { 372 if (Node->Type == ACPI_TYPE_METHOD) 373 { 374 MethodDesc = AcpiNsGetAttachedObject (Node); 375 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Desc %p Path=%p\n", 376 Node, MethodDesc, Path)); 377 378 NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); 379 if (!NameOp) 380 { 381 return_ACPI_STATUS (AE_NO_MEMORY); 382 } 383 384 /* Change arg into a METHOD CALL and attach name to it */ 385 386 AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); 387 388 NameOp->Common.Value.Name = Path; 389 390 /* Point METHODCALL/NAME to the METHOD Node */ 391 392 NameOp->Common.Node = Node; 393 AcpiPsAppendArg (Arg, NameOp); 394 395 if (!MethodDesc) 396 { 397 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p has no attached object\n", 398 Node)); 399 return_ACPI_STATUS (AE_AML_INTERNAL); 400 } 401 402 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Args %X\n", 403 Node, MethodDesc->Method.ParamCount)); 404 405 *ArgCount = MethodDesc->Method.ParamCount; 406 return_ACPI_STATUS (AE_OK); 407 } 408 409 /* 410 * Else this is normal named object reference. 411 * Just init the NAMEPATH object with the pathname. 412 * (See code below) 413 */ 414 } 415 } 416 417 /* 418 * Regardless of success/failure above, 419 * Just initialize the Op with the pathname. 420 */ 421 AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); 422 Arg->Common.Value.Name = Path; 423 424 return_ACPI_STATUS (Status); 425} 426 427 428/******************************************************************************* 429 * 430 * FUNCTION: AcpiPsGetNextSimpleArg 431 * 432 * PARAMETERS: ParserState - Current parser state object 433 * ArgType - The argument type (AML_*_ARG) 434 * Arg - Where the argument is returned 435 * 436 * RETURN: None 437 * 438 * DESCRIPTION: Get the next simple argument (constant, string, or namestring) 439 * 440 ******************************************************************************/ 441 442void 443AcpiPsGetNextSimpleArg ( 444 ACPI_PARSE_STATE *ParserState, 445 UINT32 ArgType, 446 ACPI_PARSE_OBJECT *Arg) 447{ 448 449 ACPI_FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType); 450 451 452 switch (ArgType) 453 { 454 case ARGP_BYTEDATA: 455 456 AcpiPsInitOp (Arg, AML_BYTE_OP); 457 Arg->Common.Value.Integer = (UINT32) ACPI_GET8 (ParserState->Aml); 458 ParserState->Aml++; 459 break; 460 461 462 case ARGP_WORDDATA: 463 464 AcpiPsInitOp (Arg, AML_WORD_OP); 465 466 /* Get 2 bytes from the AML stream */ 467 468 ACPI_MOVE_UNALIGNED16_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml); 469 ParserState->Aml += 2; 470 break; 471 472 473 case ARGP_DWORDDATA: 474 475 AcpiPsInitOp (Arg, AML_DWORD_OP); 476 477 /* Get 4 bytes from the AML stream */ 478 479 ACPI_MOVE_UNALIGNED32_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml); 480 ParserState->Aml += 4; 481 break; 482 483 484 case ARGP_QWORDDATA: 485 486 AcpiPsInitOp (Arg, AML_QWORD_OP); 487 488 /* Get 8 bytes from the AML stream */ 489 490 ACPI_MOVE_UNALIGNED64_TO_64 (&Arg->Common.Value.Integer, ParserState->Aml); 491 ParserState->Aml += 8; 492 break; 493 494 495 case ARGP_CHARLIST: 496 497 AcpiPsInitOp (Arg, AML_STRING_OP); 498 Arg->Common.Value.String = (char *) ParserState->Aml; 499 500 while (ACPI_GET8 (ParserState->Aml) != '\0') 501 { 502 ParserState->Aml++; 503 } 504 ParserState->Aml++; 505 break; 506 507 508 case ARGP_NAME: 509 case ARGP_NAMESTRING: 510 511 AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); 512 Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState); 513 break; 514 515 516 default: 517 ACPI_REPORT_ERROR (("Invalid ArgType %X\n", ArgType)); 518 break; 519 } 520 521 return_VOID; 522} 523 524 525/******************************************************************************* 526 * 527 * FUNCTION: AcpiPsGetNextField 528 * 529 * PARAMETERS: ParserState - Current parser state object 530 * 531 * RETURN: A newly allocated FIELD op 532 * 533 * DESCRIPTION: Get next field (NamedField, ReservedField, or AccessField) 534 * 535 ******************************************************************************/ 536 537ACPI_PARSE_OBJECT * 538AcpiPsGetNextField ( 539 ACPI_PARSE_STATE *ParserState) 540{ 541 UINT32 AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, 542 ParserState->AmlStart); 543 ACPI_PARSE_OBJECT *Field; 544 UINT16 Opcode; 545 UINT32 Name; 546 547 548 ACPI_FUNCTION_TRACE ("PsGetNextField"); 549 550 551 /* determine field type */ 552 553 switch (ACPI_GET8 (ParserState->Aml)) 554 { 555 default: 556 557 Opcode = AML_INT_NAMEDFIELD_OP; 558 break; 559 560 case 0x00: 561 562 Opcode = AML_INT_RESERVEDFIELD_OP; 563 ParserState->Aml++; 564 break; 565 566 case 0x01: 567 568 Opcode = AML_INT_ACCESSFIELD_OP; 569 ParserState->Aml++; 570 break; 571 } 572 573 574 /* Allocate a new field op */ 575 576 Field = AcpiPsAllocOp (Opcode); 577 if (!Field) 578 { 579 return_PTR (NULL); 580 } 581 582 Field->Common.AmlOffset = AmlOffset; 583 584 /* Decode the field type */ 585 586 switch (Opcode) 587 { 588 case AML_INT_NAMEDFIELD_OP: 589 590 /* Get the 4-character name */ 591 592 ACPI_MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml); 593 AcpiPsSetName (Field, Name); 594 ParserState->Aml += 4; 595 596 /* Get the length which is encoded as a package length */ 597 598 Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState); 599 break; 600 601 602 case AML_INT_RESERVEDFIELD_OP: 603 604 /* Get the length which is encoded as a package length */ 605 606 Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState); 607 break; 608 609 610 case AML_INT_ACCESSFIELD_OP: 611 612 /* 613 * Get AccessType and AccessAttrib and merge into the field Op 614 * AccessType is first operand, AccessAttribute is second 615 */ 616 Field->Common.Value.Integer32 = (ACPI_GET8 (ParserState->Aml) << 8); 617 ParserState->Aml++; 618 Field->Common.Value.Integer32 |= ACPI_GET8 (ParserState->Aml); 619 ParserState->Aml++; 620 break; 621 622 default: 623 /* Opcode was set in previous switch */ 624 break; 625 } 626 627 return_PTR (Field); 628} 629 630 631/******************************************************************************* 632 * 633 * FUNCTION: AcpiPsGetNextArg 634 * 635 * PARAMETERS: ParserState - Current parser state object 636 * ArgType - The argument type (AML_*_ARG) 637 * ArgCount - If the argument points to a control method 638 * the method's argument is returned here. 639 * 640 * RETURN: Status, and an op object containing the next argument. 641 * 642 * DESCRIPTION: Get next argument (including complex list arguments that require 643 * pushing the parser stack) 644 * 645 ******************************************************************************/ 646 647ACPI_STATUS 648AcpiPsGetNextArg ( 649 ACPI_PARSE_STATE *ParserState, 650 UINT32 ArgType, 651 UINT32 *ArgCount, 652 ACPI_PARSE_OBJECT **ReturnArg) 653{ 654 ACPI_PARSE_OBJECT *Arg = NULL; 655 ACPI_PARSE_OBJECT *Prev = NULL; 656 ACPI_PARSE_OBJECT *Field; 657 UINT32 Subop; 658 ACPI_STATUS Status = AE_OK; 659 660 661 ACPI_FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState); 662 663 664 switch (ArgType) 665 { 666 case ARGP_BYTEDATA: 667 case ARGP_WORDDATA: 668 case ARGP_DWORDDATA: 669 case ARGP_CHARLIST: 670 case ARGP_NAME: 671 case ARGP_NAMESTRING: 672 673 /* constants, strings, and namestrings are all the same size */ 674 675 Arg = AcpiPsAllocOp (AML_BYTE_OP); 676 if (!Arg) 677 { 678 return_ACPI_STATUS (AE_NO_MEMORY); 679 } 680 AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg); 681 break; 682 683 684 case ARGP_PKGLENGTH: 685 686 /* Package length, nothing returned */ 687 688 ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState); 689 break; 690 691 692 case ARGP_FIELDLIST: 693 694 if (ParserState->Aml < ParserState->PkgEnd) 695 { 696 /* Non-empty list */ 697 698 while (ParserState->Aml < ParserState->PkgEnd) 699 { 700 Field = AcpiPsGetNextField (ParserState); 701 if (!Field) 702 { 703 return_ACPI_STATUS (AE_NO_MEMORY); 704 } 705 706 if (Prev) 707 { 708 Prev->Common.Next = Field; 709 } 710 else 711 { 712 Arg = Field; 713 } 714 715 Prev = Field; 716 } 717 718 /* Skip to End of byte data */ 719 720 ParserState->Aml = ParserState->PkgEnd; 721 } 722 break; 723 724 725 case ARGP_BYTELIST: 726 727 if (ParserState->Aml < ParserState->PkgEnd) 728 { 729 /* Non-empty list */ 730 731 Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP); 732 if (!Arg) 733 { 734 return_ACPI_STATUS (AE_NO_MEMORY); 735 } 736 737 /* Fill in bytelist data */ 738 739 Arg->Common.Value.Size = ACPI_PTR_DIFF (ParserState->PkgEnd, ParserState->Aml); 740 Arg->Named.Data = ParserState->Aml; 741 742 /* Skip to End of byte data */ 743 744 ParserState->Aml = ParserState->PkgEnd; 745 } 746 break; 747 748 749 case ARGP_TARGET: 750 case ARGP_SUPERNAME: 751 case ARGP_SIMPLENAME: 752 753 Subop = AcpiPsPeekOpcode (ParserState); 754 if (Subop == 0 || 755 AcpiPsIsLeadingChar (Subop) || 756 AcpiPsIsPrefixChar (Subop)) 757 { 758 /* NullName or NameString */ 759 760 Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); 761 if (!Arg) 762 { 763 return_ACPI_STATUS (AE_NO_MEMORY); 764 } 765 766 Status = AcpiPsGetNextNamepath (ParserState, Arg, ArgCount, 0); 767 } 768 else 769 { 770 /* single complex argument, nothing returned */ 771 772 *ArgCount = 1; 773 } 774 break; 775 776 777 case ARGP_DATAOBJ: 778 case ARGP_TERMARG: 779 780 /* single complex argument, nothing returned */ 781 782 *ArgCount = 1; 783 break; 784 785 786 case ARGP_DATAOBJLIST: 787 case ARGP_TERMLIST: 788 case ARGP_OBJLIST: 789 790 if (ParserState->Aml < ParserState->PkgEnd) 791 { 792 /* non-empty list of variable arguments, nothing returned */ 793 794 *ArgCount = ACPI_VAR_ARGS; 795 } 796 break; 797 798 799 default: 800 801 ACPI_REPORT_ERROR (("Invalid ArgType: %X\n", ArgType)); 802 Status = AE_AML_OPERAND_TYPE; 803 break; 804 } 805 806 *ReturnArg = Arg; 807 return_ACPI_STATUS (Status); 808} 809