psargs.c revision 70243
1/****************************************************************************** 2 * 3 * Module Name: psargs - Parse AML opcode arguments 4 * $Revision: 42 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 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 PARSER 125 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 FUNCTION_TRACE ("PsGetNextPackageLength"); 150 151 152 EncodedLength = (UINT32) 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 = ((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 = ((GET8 (ParserState->Aml + 1) << 12) | 175 (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 = ((GET8 (ParserState->Aml + 2) << 20) | 184 (GET8 (ParserState->Aml + 1) << 12) | 185 (GET8 (ParserState->Aml) << 04) | 186 (EncodedLength & 0x0F)); 187 ParserState->Aml += 3; 188 break; 189 } 190 191 return_VALUE (Length); 192} 193 194 195/******************************************************************************* 196 * 197 * FUNCTION: AcpiPsGetNextPackageEnd 198 * 199 * PARAMETERS: ParserState - Current parser state object 200 * 201 * RETURN: Pointer to end-of-package +1 202 * 203 * DESCRIPTION: Get next package length and return a pointer past the end of 204 * the package. Consumes the package length field 205 * 206 ******************************************************************************/ 207 208UINT8 * 209AcpiPsGetNextPackageEnd ( 210 ACPI_PARSE_STATE *ParserState) 211{ 212 UINT8 *Start = ParserState->Aml; 213 NATIVE_UINT Length; 214 215 216 FUNCTION_TRACE ("PsGetNextPackageEnd"); 217 218 219 Length = (NATIVE_UINT) AcpiPsGetNextPackageLength (ParserState); 220 221 return_PTR (Start + Length); /* end of package */ 222} 223 224 225/******************************************************************************* 226 * 227 * FUNCTION: AcpiPsGetNextNamestring 228 * 229 * PARAMETERS: ParserState - Current parser state object 230 * 231 * RETURN: Pointer to the start of the name string (pointer points into 232 * the AML. 233 * 234 * DESCRIPTION: Get next raw namestring within the AML stream. Handles all name 235 * prefix characters. Set parser state to point past the string. 236 * (Name is consumed from the AML.) 237 * 238 ******************************************************************************/ 239 240NATIVE_CHAR * 241AcpiPsGetNextNamestring ( 242 ACPI_PARSE_STATE *ParserState) 243{ 244 UINT8 *Start = ParserState->Aml; 245 UINT8 *End = ParserState->Aml; 246 UINT32 Length; 247 248 249 FUNCTION_TRACE ("PsGetNextNamestring"); 250 251 252 /* Handle multiple prefix characters */ 253 254 while (AcpiPsIsPrefixChar (GET8 (End))) 255 { 256 /* include prefix '\\' or '^' */ 257 258 End++; 259 } 260 261 /* Decode the path */ 262 263 switch (GET8 (End)) 264 { 265 case 0: 266 267 /* NullName */ 268 269 if (End == Start) 270 { 271 Start = NULL; 272 } 273 End++; 274 break; 275 276 277 case AML_DUAL_NAME_PREFIX: 278 279 /* two name segments */ 280 281 End += 9; 282 break; 283 284 285 case AML_MULTI_NAME_PREFIX_OP: 286 287 /* multiple name segments */ 288 289 Length = (UINT32) GET8 (End + 1) * 4; 290 End += 2 + Length; 291 break; 292 293 294 default: 295 296 /* single name segment */ 297 /* assert (AcpiPsIsLead (GET8 (End))); */ 298 299 End += 4; 300 break; 301 } 302 303 ParserState->Aml = (UINT8*) End; 304 305 return_PTR ((NATIVE_CHAR *) Start); 306} 307 308 309/******************************************************************************* 310 * 311 * FUNCTION: AcpiPsGetNextNamepath 312 * 313 * PARAMETERS: ParserState - Current parser state object 314 * Arg - Where the namepath will be stored 315 * ArgCount - If the namepath points to a control method 316 * the method's argument is returned here. 317 * MethodCall - Whether the namepath can be the start 318 * of a method call 319 * 320 * RETURN: None 321 * 322 * DESCRIPTION: Get next name (if method call, push appropriate # args). Names 323 * are looked up in either the parsed or internal namespace to 324 * determine if the name represents a control method. If a method 325 * is found, the number of arguments to the method is returned. 326 * This information is critical for parsing to continue correctly. 327 * 328 ******************************************************************************/ 329 330 331#ifdef PARSER_ONLY 332 333void 334AcpiPsGetNextNamepath ( 335 ACPI_PARSE_STATE *ParserState, 336 ACPI_PARSE_OBJECT *Arg, 337 UINT32 *ArgCount, 338 BOOLEAN MethodCall) 339{ 340 NATIVE_CHAR *Path; 341 ACPI_PARSE_OBJECT *NameOp; 342 ACPI_PARSE_OBJECT *Op; 343 ACPI_PARSE_OBJECT *Count; 344 345 346 FUNCTION_TRACE ("PsGetNextNamepath"); 347 348 349 Path = AcpiPsGetNextNamestring (ParserState); 350 if (!Path || !MethodCall) 351 { 352 /* Null name case, create a null namepath object */ 353 354 AcpiPsInitOp (Arg, AML_NAMEPATH_OP); 355 Arg->Value.Name = Path; 356 return_VOID; 357 } 358 359 360 if (AcpiGbl_ParsedNamespaceRoot) 361 { 362 /* 363 * Lookup the name in the parsed namespace 364 */ 365 366 Op = NULL; 367 if (MethodCall) 368 { 369 Op = AcpiPsFind (AcpiPsGetParentScope (ParserState), 370 Path, AML_METHOD_OP, 0); 371 } 372 373 if (Op) 374 { 375 if (Op->Opcode == AML_METHOD_OP) 376 { 377 /* 378 * The name refers to a control method, so this namepath is a 379 * method invocation. We need to 1) Get the number of arguments 380 * associated with this method, and 2) Change the NAMEPATH 381 * object into a METHODCALL object. 382 */ 383 384 Count = AcpiPsGetArg (Op, 0); 385 if (Count && Count->Opcode == AML_BYTE_OP) 386 { 387 NameOp = AcpiPsAllocOp (AML_NAMEPATH_OP); 388 if (NameOp) 389 { 390 /* Change arg into a METHOD CALL and attach the name */ 391 392 AcpiPsInitOp (Arg, AML_METHODCALL_OP); 393 394 NameOp->Value.Name = Path; 395 396 /* Point METHODCALL/NAME to the METHOD Node */ 397 398 NameOp->Node = (ACPI_NAMESPACE_NODE *) Op; 399 AcpiPsAppendArg (Arg, NameOp); 400 401 *ArgCount = Count->Value.Integer & 402 METHOD_FLAGS_ARG_COUNT; 403 } 404 } 405 406 return_VOID; 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 /* 419 * Either we didn't find the object in the namespace, or the object is 420 * something other than a control method. Just initialize the Op with the 421 * pathname 422 */ 423 424 AcpiPsInitOp (Arg, AML_NAMEPATH_OP); 425 Arg->Value.Name = Path; 426 427 428 return_VOID; 429} 430 431 432#else 433 434 435void 436AcpiPsGetNextNamepath ( 437 ACPI_PARSE_STATE *ParserState, 438 ACPI_PARSE_OBJECT *Arg, 439 UINT32 *ArgCount, 440 BOOLEAN MethodCall) 441{ 442 NATIVE_CHAR *Path; 443 ACPI_PARSE_OBJECT *NameOp; 444 ACPI_STATUS Status; 445 ACPI_NAMESPACE_NODE *MethodNode = NULL; 446 ACPI_NAMESPACE_NODE *Node; 447 ACPI_GENERIC_STATE ScopeInfo; 448 449 450 FUNCTION_TRACE ("PsGetNextNamepath"); 451 452 453 Path = AcpiPsGetNextNamestring (ParserState); 454 if (!Path || !MethodCall) 455 { 456 /* Null name case, create a null namepath object */ 457 458 AcpiPsInitOp (Arg, AML_NAMEPATH_OP); 459 Arg->Value.Name = Path; 460 return_VOID; 461 } 462 463 464 if (MethodCall) 465 { 466 /* 467 * Lookup the name in the internal namespace 468 */ 469 ScopeInfo.Scope.Node = NULL; 470 Node = ParserState->StartNode; 471 if (Node) 472 { 473 ScopeInfo.Scope.Node = Node; 474 } 475 476 /* 477 * Lookup object. We don't want to add anything new to the namespace 478 * here, however. So we use MODE_EXECUTE. Allow searching of the 479 * parent tree, but don't open a new scope -- we just want to lookup the 480 * object (MUST BE mode EXECUTE to perform upsearch) 481 */ 482 483 Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, IMODE_EXECUTE, 484 NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, 485 &Node); 486 if (ACPI_SUCCESS (Status)) 487 { 488 if (Node->Type == ACPI_TYPE_METHOD) 489 { 490 MethodNode = Node; 491 DEBUG_PRINT (TRACE_PARSE, 492 ("PsGetNextNamepath: method - %p Path=%p\n", 493 MethodNode, Path)); 494 495 NameOp = AcpiPsAllocOp (AML_NAMEPATH_OP); 496 if (NameOp) 497 { 498 /* Change arg into a METHOD CALL and attach name to it */ 499 500 AcpiPsInitOp (Arg, AML_METHODCALL_OP); 501 502 NameOp->Value.Name = Path; 503 504 /* Point METHODCALL/NAME to the METHOD Node */ 505 506 NameOp->Node = MethodNode; 507 AcpiPsAppendArg (Arg, NameOp); 508 509 if (!(ACPI_OPERAND_OBJECT *) MethodNode->Object) 510 { 511 return_VOID; 512 } 513 514 *ArgCount = ((ACPI_OPERAND_OBJECT *) MethodNode->Object)->Method.ParamCount; 515 } 516 517 return_VOID; 518 } 519 520 /* 521 * Else this is normal named object reference. 522 * Just init the NAMEPATH object with the pathname. 523 * (See code below) 524 */ 525 } 526 } 527 528 /* 529 * Either we didn't find the object in the namespace, or the object is 530 * something other than a control method. Just initialize the Op with the 531 * pathname. 532 */ 533 534 AcpiPsInitOp (Arg, AML_NAMEPATH_OP); 535 Arg->Value.Name = Path; 536 537 538 return_VOID; 539} 540 541#endif 542 543/******************************************************************************* 544 * 545 * FUNCTION: AcpiPsGetNextSimpleArg 546 * 547 * PARAMETERS: ParserState - Current parser state object 548 * ArgType - The argument type (AML_*_ARG) 549 * Arg - Where the argument is returned 550 * 551 * RETURN: None 552 * 553 * DESCRIPTION: Get the next simple argument (constant, string, or namestring) 554 * 555 ******************************************************************************/ 556 557void 558AcpiPsGetNextSimpleArg ( 559 ACPI_PARSE_STATE *ParserState, 560 UINT32 ArgType, 561 ACPI_PARSE_OBJECT *Arg) 562{ 563 564 565 FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType); 566 567 568 switch (ArgType) 569 { 570 571 case ARGP_BYTEDATA: 572 573 AcpiPsInitOp (Arg, AML_BYTE_OP); 574 Arg->Value.Integer = (UINT32) GET8 (ParserState->Aml); 575 ParserState->Aml++; 576 break; 577 578 579 case ARGP_WORDDATA: 580 581 AcpiPsInitOp (Arg, AML_WORD_OP); 582 583 /* Get 2 bytes from the AML stream */ 584 585 MOVE_UNALIGNED16_TO_32 (&Arg->Value.Integer, ParserState->Aml); 586 ParserState->Aml += 2; 587 break; 588 589 590 case ARGP_DWORDDATA: 591 592 AcpiPsInitOp (Arg, AML_DWORD_OP); 593 594 /* Get 4 bytes from the AML stream */ 595 596 MOVE_UNALIGNED32_TO_32 (&Arg->Value.Integer, ParserState->Aml); 597 ParserState->Aml += 4; 598 break; 599 600 601 case ARGP_CHARLIST: 602 603 AcpiPsInitOp (Arg, AML_STRING_OP); 604 Arg->Value.String = (char*) ParserState->Aml; 605 606 while (GET8 (ParserState->Aml) != '\0') 607 { 608 ParserState->Aml++; 609 } 610 ParserState->Aml++; 611 break; 612 613 614 case ARGP_NAME: 615 case ARGP_NAMESTRING: 616 617 AcpiPsInitOp (Arg, AML_NAMEPATH_OP); 618 Arg->Value.Name = AcpiPsGetNextNamestring (ParserState); 619 break; 620 } 621 622 return_VOID; 623} 624 625 626/******************************************************************************* 627 * 628 * FUNCTION: AcpiPsGetNextField 629 * 630 * PARAMETERS: ParserState - Current parser state object 631 * 632 * RETURN: A newly allocated FIELD op 633 * 634 * DESCRIPTION: Get next field (NamedField, ReservedField, or AccessField) 635 * 636 ******************************************************************************/ 637 638ACPI_PARSE_OBJECT * 639AcpiPsGetNextField ( 640 ACPI_PARSE_STATE *ParserState) 641{ 642 ACPI_PTRDIFF AmlOffset = ParserState->Aml - 643 ParserState->AmlStart; 644 ACPI_PARSE_OBJECT *Field; 645 UINT16 Opcode; 646 UINT32 Name; 647 648 649 FUNCTION_TRACE ("PsGetNextField"); 650 651 652 /* determine field type */ 653 654 switch (GET8 (ParserState->Aml)) 655 { 656 657 default: 658 659 Opcode = AML_NAMEDFIELD_OP; 660 break; 661 662 663 case 0x00: 664 665 Opcode = AML_RESERVEDFIELD_OP; 666 ParserState->Aml++; 667 break; 668 669 670 case 0x01: 671 672 Opcode = AML_ACCESSFIELD_OP; 673 ParserState->Aml++; 674 break; 675 } 676 677 678 /* Allocate a new field op */ 679 680 Field = AcpiPsAllocOp (Opcode); 681 if (Field) 682 { 683 Field->AmlOffset = AmlOffset; 684 685 /* Decode the field type */ 686 687 switch (Opcode) 688 { 689 case AML_NAMEDFIELD_OP: 690 691 /* Get the 4-character name */ 692 693 MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml); 694 AcpiPsSetName (Field, Name); 695 ParserState->Aml += 4; 696 697 /* Get the length which is encoded as a package length */ 698 699 Field->Value.Size = AcpiPsGetNextPackageLength (ParserState); 700 break; 701 702 703 case AML_RESERVEDFIELD_OP: 704 705 /* Get the length which is encoded as a package length */ 706 707 Field->Value.Size = AcpiPsGetNextPackageLength (ParserState); 708 break; 709 710 711 case AML_ACCESSFIELD_OP: 712 713 /* Get AccessType and AccessAtrib and merge into the field Op */ 714 715 Field->Value.Integer = ((GET8 (ParserState->Aml) << 8) | 716 GET8 (ParserState->Aml)); 717 ParserState->Aml += 2; 718 break; 719 } 720 } 721 722 return_PTR (Field); 723} 724 725 726/******************************************************************************* 727 * 728 * FUNCTION: AcpiPsGetNextArg 729 * 730 * PARAMETERS: ParserState - Current parser state object 731 * ArgType - The argument type (AML_*_ARG) 732 * ArgCount - If the argument points to a control method 733 * the method's argument is returned here. 734 * 735 * RETURN: An op object containing the next argument. 736 * 737 * DESCRIPTION: Get next argument (including complex list arguments that require 738 * pushing the parser stack) 739 * 740 ******************************************************************************/ 741 742ACPI_PARSE_OBJECT * 743AcpiPsGetNextArg ( 744 ACPI_PARSE_STATE *ParserState, 745 UINT32 ArgType, 746 UINT32 *ArgCount) 747{ 748 ACPI_PARSE_OBJECT *Arg = NULL; 749 ACPI_PARSE_OBJECT *Prev = NULL; 750 ACPI_PARSE_OBJECT *Field; 751 UINT32 Subop; 752 753 754 FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState); 755 756 757 switch (ArgType) 758 { 759 case ARGP_BYTEDATA: 760 case ARGP_WORDDATA: 761 case ARGP_DWORDDATA: 762 case ARGP_CHARLIST: 763 case ARGP_NAME: 764 case ARGP_NAMESTRING: 765 766 /* constants, strings, and namestrings are all the same size */ 767 768 Arg = AcpiPsAllocOp (AML_BYTE_OP); 769 if (Arg) 770 { 771 AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg); 772 } 773 break; 774 775 776 case ARGP_PKGLENGTH: 777 778 /* package length, nothing returned */ 779 780 ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState); 781 break; 782 783 784 case ARGP_FIELDLIST: 785 786 if (ParserState->Aml < ParserState->PkgEnd) 787 { 788 /* non-empty list */ 789 790 while (ParserState->Aml < ParserState->PkgEnd) 791 { 792 Field = AcpiPsGetNextField (ParserState); 793 if (!Field) 794 { 795 break; 796 } 797 798 if (Prev) 799 { 800 Prev->Next = Field; 801 } 802 803 else 804 { 805 Arg = Field; 806 } 807 808 Prev = Field; 809 } 810 811 /* skip to End of byte data */ 812 813 ParserState->Aml = ParserState->PkgEnd; 814 } 815 break; 816 817 818 case ARGP_BYTELIST: 819 820 if (ParserState->Aml < ParserState->PkgEnd) 821 { 822 /* non-empty list */ 823 824 Arg = AcpiPsAllocOp (AML_BYTELIST_OP); 825 if (Arg) 826 { 827 /* fill in bytelist data */ 828 829 Arg->Value.Size = (ParserState->PkgEnd - ParserState->Aml); 830 ((ACPI_PARSE2_OBJECT *) Arg)->Data = ParserState->Aml; 831 } 832 833 /* skip to End of byte data */ 834 835 ParserState->Aml = ParserState->PkgEnd; 836 } 837 break; 838 839 840 case ARGP_TARGET: 841 case ARGP_SUPERNAME: 842 { 843 Subop = AcpiPsPeekOpcode (ParserState); 844 if (Subop == 0 || 845 AcpiPsIsLeadingChar (Subop) || 846 AcpiPsIsPrefixChar (Subop)) 847 { 848 /* NullName or NameString */ 849 850 Arg = AcpiPsAllocOp (AML_NAMEPATH_OP); 851 if (Arg) 852 { 853 AcpiPsGetNextNamepath (ParserState, Arg, ArgCount, 0); 854 } 855 } 856 857 else 858 { 859 /* single complex argument, nothing returned */ 860 861 *ArgCount = 1; 862 } 863 } 864 break; 865 866 867 case ARGP_DATAOBJ: 868 case ARGP_TERMARG: 869 870 /* single complex argument, nothing returned */ 871 872 *ArgCount = 1; 873 break; 874 875 876 case ARGP_DATAOBJLIST: 877 case ARGP_TERMLIST: 878 case ARGP_OBJLIST: 879 880 if (ParserState->Aml < ParserState->PkgEnd) 881 { 882 /* non-empty list of variable arguments, nothing returned */ 883 884 *ArgCount = ACPI_VAR_ARGS; 885 } 886 break; 887 } 888 889 return_PTR (Arg); 890} 891