ReactOS 0.4.16-dev-319-g6cf4263
psargs.c
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Module Name: psargs - Parse AML opcode arguments
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2022, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include "acpi.h"
45#include "accommon.h"
46#include "acparser.h"
47#include "amlcode.h"
48#include "acnamesp.h"
49#include "acdispat.h"
50#include "acconvert.h"
51
52#define _COMPONENT ACPI_PARSER
53 ACPI_MODULE_NAME ("psargs")
54
55/* Local prototypes */
56
57static UINT32
59 ACPI_PARSE_STATE *ParserState);
60
61static ACPI_PARSE_OBJECT *
63 ACPI_PARSE_STATE *ParserState);
64
65
66/*******************************************************************************
67 *
68 * FUNCTION: AcpiPsGetNextPackageLength
69 *
70 * PARAMETERS: ParserState - Current parser state object
71 *
72 * RETURN: Decoded package length. On completion, the AML pointer points
73 * past the length byte or bytes.
74 *
75 * DESCRIPTION: Decode and return a package length field.
76 * Note: Largest package length is 28 bits, from ACPI specification
77 *
78 ******************************************************************************/
79
80static UINT32
82 ACPI_PARSE_STATE *ParserState)
83{
84 UINT8 *Aml = ParserState->Aml;
85 UINT32 PackageLength = 0;
87 UINT8 ByteZeroMask = 0x3F; /* Default [0:5] */
88
89
90 ACPI_FUNCTION_TRACE (PsGetNextPackageLength);
91
92
93 /*
94 * Byte 0 bits [6:7] contain the number of additional bytes
95 * used to encode the package length, either 0,1,2, or 3
96 */
97 ByteCount = (Aml[0] >> 6);
98 ParserState->Aml += ((ACPI_SIZE) ByteCount + 1);
99
100 /* Get bytes 3, 2, 1 as needed */
101
102 while (ByteCount)
103 {
104 /*
105 * Final bit positions for the package length bytes:
106 * Byte3->[20:27]
107 * Byte2->[12:19]
108 * Byte1->[04:11]
109 * Byte0->[00:03]
110 */
111 PackageLength |= (Aml[ByteCount] << ((ByteCount << 3) - 4));
112
113 ByteZeroMask = 0x0F; /* Use bits [0:3] of byte 0 */
114 ByteCount--;
115 }
116
117 /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
118
119 PackageLength |= (Aml[0] & ByteZeroMask);
120 return_UINT32 (PackageLength);
121}
122
123
124/*******************************************************************************
125 *
126 * FUNCTION: AcpiPsGetNextPackageEnd
127 *
128 * PARAMETERS: ParserState - Current parser state object
129 *
130 * RETURN: Pointer to end-of-package +1
131 *
132 * DESCRIPTION: Get next package length and return a pointer past the end of
133 * the package. Consumes the package length field
134 *
135 ******************************************************************************/
136
137UINT8 *
139 ACPI_PARSE_STATE *ParserState)
140{
141 UINT8 *Start = ParserState->Aml;
142 UINT32 PackageLength;
143
144
145 ACPI_FUNCTION_TRACE (PsGetNextPackageEnd);
146
147
148 /* Function below updates ParserState->Aml */
149
150 PackageLength = AcpiPsGetNextPackageLength (ParserState);
151
152 return_PTR (Start + PackageLength); /* end of package */
153}
154
155
156/*******************************************************************************
157 *
158 * FUNCTION: AcpiPsGetNextNamestring
159 *
160 * PARAMETERS: ParserState - Current parser state object
161 *
162 * RETURN: Pointer to the start of the name string (pointer points into
163 * the AML.
164 *
165 * DESCRIPTION: Get next raw namestring within the AML stream. Handles all name
166 * prefix characters. Set parser state to point past the string.
167 * (Name is consumed from the AML.)
168 *
169 ******************************************************************************/
170
171char *
173 ACPI_PARSE_STATE *ParserState)
174{
175 UINT8 *Start = ParserState->Aml;
176 UINT8 *End = ParserState->Aml;
177
178
179 ACPI_FUNCTION_TRACE (PsGetNextNamestring);
180
181
182 /* Point past any namestring prefix characters (backslash or carat) */
183
184 while (ACPI_IS_ROOT_PREFIX (*End) ||
186 {
187 End++;
188 }
189
190 /* Decode the path prefix character */
191
192 switch (*End)
193 {
194 case 0:
195
196 /* NullName */
197
198 if (End == Start)
199 {
200 Start = NULL;
201 }
202 End++;
203 break;
204
206
207 /* Two name segments */
208
209 End += 1 + (2 * ACPI_NAMESEG_SIZE);
210 break;
211
213
214 /* Multiple name segments, 4 chars each, count in next byte */
215
216 End += 2 + (*(End + 1) * ACPI_NAMESEG_SIZE);
217 break;
218
219 default:
220
221 /* Single name segment */
222
223 End += ACPI_NAMESEG_SIZE;
224 break;
225 }
226
227 ParserState->Aml = End;
228 return_PTR ((char *) Start);
229}
230
231
232/*******************************************************************************
233 *
234 * FUNCTION: AcpiPsGetNextNamepath
235 *
236 * PARAMETERS: ParserState - Current parser state object
237 * Arg - Where the namepath will be stored
238 * ArgCount - If the namepath points to a control method
239 * the method's argument is returned here.
240 * PossibleMethodCall - Whether the namepath can possibly be the
241 * start of a method call
242 *
243 * RETURN: Status
244 *
245 * DESCRIPTION: Get next name (if method call, return # of required args).
246 * Names are looked up in the internal namespace to determine
247 * if the name represents a control method. If a method
248 * is found, the number of arguments to the method is returned.
249 * This information is critical for parsing to continue correctly.
250 *
251 ******************************************************************************/
252
255 ACPI_WALK_STATE *WalkState,
256 ACPI_PARSE_STATE *ParserState,
258 BOOLEAN PossibleMethodCall)
259{
261 char *Path;
262 ACPI_PARSE_OBJECT *NameOp;
263 ACPI_OPERAND_OBJECT *MethodDesc;
265 UINT8 *Start = ParserState->Aml;
266
267
268 ACPI_FUNCTION_TRACE (PsGetNextNamepath);
269
270
271 Path = AcpiPsGetNextNamestring (ParserState);
273
274 /* Null path case is allowed, just exit */
275
276 if (!Path)
277 {
278 Arg->Common.Value.Name = Path;
280 }
281
282 /*
283 * Lookup the name in the internal namespace, starting with the current
284 * scope. We don't want to add anything new to the namespace here,
285 * however, so we use MODE_EXECUTE.
286 * Allow searching of the parent tree, but don't open a new scope -
287 * we just want to lookup the object (must be mode EXECUTE to perform
288 * the upsearch)
289 */
290 Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
293
294 /*
295 * If this name is a control method invocation, we must
296 * setup the method call
297 */
298 if (ACPI_SUCCESS (Status) &&
299 PossibleMethodCall &&
300 (Node->Type == ACPI_TYPE_METHOD))
301 {
302 if ((GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_SUPERNAME) ||
303 (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_TARGET))
304 {
305 /*
306 * AcpiPsGetNextNamestring has increased the AML pointer past
307 * the method invocation namestring, so we need to restore the
308 * saved AML pointer back to the original method invocation
309 * namestring.
310 */
311 WalkState->ParserState.Aml = Start;
312 WalkState->ArgCount = 1;
314 }
315
316 /* This name is actually a control method invocation */
317
318 MethodDesc = AcpiNsGetAttachedObject (Node);
320 "Control Method invocation %4.4s - %p Desc %p Path=%p\n",
321 Node->Name.Ascii, Node, MethodDesc, Path));
322
324 if (!NameOp)
325 {
327 }
328
329 /* Change Arg into a METHOD CALL and attach name to it */
330
332 NameOp->Common.Value.Name = Path;
333
334 /* Point METHODCALL/NAME to the METHOD Node */
335
336 NameOp->Common.Node = Node;
337 AcpiPsAppendArg (Arg, NameOp);
338
339 if (!MethodDesc)
340 {
342 "Control Method %p has no attached object",
343 Node));
345 }
346
348 "Control Method - %p Args %X\n",
349 Node, MethodDesc->Method.ParamCount));
350
351 /* Get the number of arguments to expect */
352
353 WalkState->ArgCount = MethodDesc->Method.ParamCount;
355 }
356
357 /*
358 * Special handling if the name was not found during the lookup -
359 * some NotFound cases are allowed
360 */
361 if (Status == AE_NOT_FOUND)
362 {
363 /* 1) NotFound is ok during load pass 1/2 (allow forward references) */
364
365 if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) !=
367 {
368 Status = AE_OK;
369 }
370
371 /* 2) NotFound during a CondRefOf(x) is ok by definition */
372
373 else if (WalkState->Op->Common.AmlOpcode == AML_CONDITIONAL_REF_OF_OP)
374 {
375 Status = AE_OK;
376 }
377
378 /*
379 * 3) NotFound while building a Package is ok at this point, we
380 * may flag as an error later if slack mode is not enabled.
381 * (Some ASL code depends on allowing this behavior)
382 */
383 else if ((Arg->Common.Parent) &&
384 ((Arg->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
385 (Arg->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
386 {
387 Status = AE_OK;
388 }
389 }
390
391 /* Final exception check (may have been changed from code above) */
392
393 if (ACPI_FAILURE (Status))
394 {
396
397 if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) ==
399 {
400 /* Report a control method execution error */
401
402 Status = AcpiDsMethodError (Status, WalkState);
403 }
404 }
405
406 /* Save the namepath */
407
408 Arg->Common.Value.Name = Path;
410}
411
412
413/*******************************************************************************
414 *
415 * FUNCTION: AcpiPsGetNextSimpleArg
416 *
417 * PARAMETERS: ParserState - Current parser state object
418 * ArgType - The argument type (AML_*_ARG)
419 * Arg - Where the argument is returned
420 *
421 * RETURN: None
422 *
423 * DESCRIPTION: Get the next simple argument (constant, string, or namestring)
424 *
425 ******************************************************************************/
426
427void
429 ACPI_PARSE_STATE *ParserState,
430 UINT32 ArgType,
432{
435 UINT8 *Aml = ParserState->Aml;
436
437
438 ACPI_FUNCTION_TRACE_U32 (PsGetNextSimpleArg, ArgType);
439
440
441 switch (ArgType)
442 {
443 case ARGP_BYTEDATA:
444
445 /* Get 1 byte from the AML stream */
446
448 Arg->Common.Value.Integer = (UINT64) *Aml;
449 Length = 1;
450 break;
451
452 case ARGP_WORDDATA:
453
454 /* Get 2 bytes from the AML stream */
455
457 ACPI_MOVE_16_TO_64 (&Arg->Common.Value.Integer, Aml);
458 Length = 2;
459 break;
460
461 case ARGP_DWORDDATA:
462
463 /* Get 4 bytes from the AML stream */
464
466 ACPI_MOVE_32_TO_64 (&Arg->Common.Value.Integer, Aml);
467 Length = 4;
468 break;
469
470 case ARGP_QWORDDATA:
471
472 /* Get 8 bytes from the AML stream */
473
475 ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, Aml);
476 Length = 8;
477 break;
478
479 case ARGP_CHARLIST:
480
481 /* Get a pointer to the string, point past the string */
482
484 Arg->Common.Value.String = ACPI_CAST_PTR (char, Aml);
485
486 /* Find the null terminator */
487
488 Length = 0;
489 while (Aml[Length])
490 {
491 Length++;
492 }
493 Length++;
494 break;
495
496 case ARGP_NAME:
497 case ARGP_NAMESTRING:
498
500 Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
502
503 default:
504
505 ACPI_ERROR ((AE_INFO, "Invalid ArgType 0x%X", ArgType));
507 }
508
509 AcpiPsInitOp (Arg, Opcode);
510 ParserState->Aml += Length;
512}
513
514
515/*******************************************************************************
516 *
517 * FUNCTION: AcpiPsGetNextField
518 *
519 * PARAMETERS: ParserState - Current parser state object
520 *
521 * RETURN: A newly allocated FIELD op
522 *
523 * DESCRIPTION: Get next field (NamedField, ReservedField, or AccessField)
524 *
525 ******************************************************************************/
526
527static ACPI_PARSE_OBJECT *
529 ACPI_PARSE_STATE *ParserState)
530{
531 UINT8 *Aml;
532 ACPI_PARSE_OBJECT *Field;
533 ACPI_PARSE_OBJECT *Arg = NULL;
535 UINT32 Name;
536 UINT8 AccessType;
537 UINT8 AccessAttribute;
538 UINT8 AccessLength;
539 UINT32 PkgLength;
540 UINT8 *PkgEnd;
542
543
544 ACPI_FUNCTION_TRACE (PsGetNextField);
545
546
547 ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
548 Aml = ParserState->Aml;
549
550 /* Determine field type */
551
552 switch (ACPI_GET8 (ParserState->Aml))
553 {
555
557 ParserState->Aml++;
558 break;
559
561
563 ParserState->Aml++;
564 break;
565
567
569 ParserState->Aml++;
570 break;
571
573
575 ParserState->Aml++;
576 break;
577
578 default:
579
581 break;
582 }
583
584 /* Allocate a new field op */
585
586 Field = AcpiPsAllocOp (Opcode, Aml);
587 if (!Field)
588 {
590 }
591
592 /* Decode the field type */
593
594 ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
595 switch (Opcode)
596 {
598
599 /* Get the 4-character name */
600
601 ACPI_MOVE_32_TO_32 (&Name, ParserState->Aml);
602 AcpiPsSetName (Field, Name);
603 ParserState->Aml += ACPI_NAMESEG_SIZE;
604
605
606 ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
607
608#ifdef ACPI_ASL_COMPILER
609 /*
610 * Because the package length isn't represented as a parse tree object,
611 * take comments surrounding this and add to the previously created
612 * parse node.
613 */
614 if (Field->Common.InlineComment)
615 {
616 Field->Common.NameComment = Field->Common.InlineComment;
617 }
618 Field->Common.InlineComment = AcpiGbl_CurrentInlineComment;
619 AcpiGbl_CurrentInlineComment = NULL;
620#endif
621
622 /* Get the length which is encoded as a package length */
623
624 Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
625 break;
626
627
629
630 /* Get the length which is encoded as a package length */
631
632 Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
633 break;
634
635
638
639 /*
640 * Get AccessType and AccessAttrib and merge into the field Op
641 * AccessType is first operand, AccessAttribute is second. stuff
642 * these bytes into the node integer value for convenience.
643 */
644
645 /* Get the two bytes (Type/Attribute) */
646
647 AccessType = ACPI_GET8 (ParserState->Aml);
648 ParserState->Aml++;
649 AccessAttribute = ACPI_GET8 (ParserState->Aml);
650 ParserState->Aml++;
651
652 Field->Common.Value.Integer = (UINT8) AccessType;
653 Field->Common.Value.Integer |= (UINT16) (AccessAttribute << 8);
654
655 /* This opcode has a third byte, AccessLength */
656
658 {
659 AccessLength = ACPI_GET8 (ParserState->Aml);
660 ParserState->Aml++;
661
662 Field->Common.Value.Integer |= (UINT32) (AccessLength << 16);
663 }
664 break;
665
666
668
669 /*
670 * Argument for Connection operator can be either a Buffer
671 * (resource descriptor), or a NameString.
672 */
673 Aml = ParserState->Aml;
674 if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP)
675 {
676 ParserState->Aml++;
677
678 ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
679 PkgEnd = ParserState->Aml;
680 PkgLength = AcpiPsGetNextPackageLength (ParserState);
681 PkgEnd += PkgLength;
682
683 ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
684 if (ParserState->Aml < PkgEnd)
685 {
686 /* Non-empty list */
687
689 if (!Arg)
690 {
691 AcpiPsFreeOp (Field);
693 }
694
695 /* Get the actual buffer length argument */
696
697 Opcode = ACPI_GET8 (ParserState->Aml);
698 ParserState->Aml++;
699
700 ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
701 switch (Opcode)
702 {
703 case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
704
705 BufferLength = ACPI_GET8 (ParserState->Aml);
706 ParserState->Aml += 1;
707 break;
708
709 case AML_WORD_OP: /* AML_WORDDATA_ARG */
710
711 BufferLength = ACPI_GET16 (ParserState->Aml);
712 ParserState->Aml += 2;
713 break;
714
715 case AML_DWORD_OP: /* AML_DWORDATA_ARG */
716
717 BufferLength = ACPI_GET32 (ParserState->Aml);
718 ParserState->Aml += 4;
719 break;
720
721 default:
722
723 BufferLength = 0;
724 break;
725 }
726
727 /* Fill in bytelist data */
728
729 ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
730 Arg->Named.Value.Size = BufferLength;
731 Arg->Named.Data = ParserState->Aml;
732 }
733
734 /* Skip to End of byte data */
735
736 ParserState->Aml = PkgEnd;
737 }
738 else
739 {
741 if (!Arg)
742 {
743 AcpiPsFreeOp (Field);
745 }
746
747 /* Get the Namestring argument */
748
749 Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
750 }
751
752 /* Link the buffer/namestring to parent (CONNECTION_OP) */
753
754 AcpiPsAppendArg (Field, Arg);
755 break;
756
757
758 default:
759
760 /* Opcode was set in previous switch */
761 break;
762 }
763
764 return_PTR (Field);
765}
766
767
768/*******************************************************************************
769 *
770 * FUNCTION: AcpiPsGetNextArg
771 *
772 * PARAMETERS: WalkState - Current state
773 * ParserState - Current parser state object
774 * ArgType - The argument type (AML_*_ARG)
775 * ReturnArg - Where the next arg is returned
776 *
777 * RETURN: Status, and an op object containing the next argument.
778 *
779 * DESCRIPTION: Get next argument (including complex list arguments that require
780 * pushing the parser stack)
781 *
782 ******************************************************************************/
783
786 ACPI_WALK_STATE *WalkState,
787 ACPI_PARSE_STATE *ParserState,
788 UINT32 ArgType,
789 ACPI_PARSE_OBJECT **ReturnArg)
790{
791 ACPI_PARSE_OBJECT *Arg = NULL;
792 ACPI_PARSE_OBJECT *Prev = NULL;
793 ACPI_PARSE_OBJECT *Field;
794 UINT32 Subop;
796
797
798 ACPI_FUNCTION_TRACE_PTR (PsGetNextArg, ParserState);
799
800
802 "Expected argument type ARGP: %s (%2.2X)\n",
803 AcpiUtGetArgumentTypeName (ArgType), ArgType));
804
805 switch (ArgType)
806 {
807 case ARGP_BYTEDATA:
808 case ARGP_WORDDATA:
809 case ARGP_DWORDDATA:
810 case ARGP_CHARLIST:
811 case ARGP_NAME:
812 case ARGP_NAMESTRING:
813
814 /* Constants, strings, and namestrings are all the same size */
815
816 Arg = AcpiPsAllocOp (AML_BYTE_OP, ParserState->Aml);
817 if (!Arg)
818 {
820 }
821
822 AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg);
823 break;
824
825 case ARGP_PKGLENGTH:
826
827 /* Package length, nothing returned */
828
829 ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState);
830 break;
831
832 case ARGP_FIELDLIST:
833
834 if (ParserState->Aml < ParserState->PkgEnd)
835 {
836 /* Non-empty list */
837
838 while (ParserState->Aml < ParserState->PkgEnd)
839 {
840 Field = AcpiPsGetNextField (ParserState);
841 if (!Field)
842 {
844 }
845
846 if (Prev)
847 {
848 Prev->Common.Next = Field;
849 }
850 else
851 {
852 Arg = Field;
853 }
854 Prev = Field;
855 }
856
857 /* Skip to End of byte data */
858
859 ParserState->Aml = ParserState->PkgEnd;
860 }
861 break;
862
863 case ARGP_BYTELIST:
864
865 if (ParserState->Aml < ParserState->PkgEnd)
866 {
867 /* Non-empty list */
868
870 ParserState->Aml);
871 if (!Arg)
872 {
874 }
875
876 /* Fill in bytelist data */
877
878 Arg->Common.Value.Size = (UINT32)
879 ACPI_PTR_DIFF (ParserState->PkgEnd, ParserState->Aml);
880 Arg->Named.Data = ParserState->Aml;
881
882 /* Skip to End of byte data */
883
884 ParserState->Aml = ParserState->PkgEnd;
885 }
886 break;
887
888 case ARGP_SIMPLENAME:
889 case ARGP_NAME_OR_REF:
890
892 "**** SimpleName/NameOrRef: %s (%2.2X)\n",
893 AcpiUtGetArgumentTypeName (ArgType), ArgType));
894
895 Subop = AcpiPsPeekOpcode (ParserState);
896 if (Subop == 0 ||
897 AcpiPsIsLeadingChar (Subop) ||
898 ACPI_IS_ROOT_PREFIX (Subop) ||
899 ACPI_IS_PARENT_PREFIX (Subop))
900 {
901 /* NullName or NameString */
902
903 Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, ParserState->Aml);
904 if (!Arg)
905 {
907 }
908
909 Status = AcpiPsGetNextNamepath (WalkState, ParserState,
911 }
912 else
913 {
914 /* Single complex argument, nothing returned */
915
916 WalkState->ArgCount = 1;
917 }
918 break;
919
920 case ARGP_TARGET:
921 case ARGP_SUPERNAME:
922
924 "**** Target/Supername: %s (%2.2X)\n",
925 AcpiUtGetArgumentTypeName (ArgType), ArgType));
926
927 Subop = AcpiPsPeekOpcode (ParserState);
928 if (Subop == 0 ||
929 AcpiPsIsLeadingChar (Subop) ||
930 ACPI_IS_ROOT_PREFIX (Subop) ||
931 ACPI_IS_PARENT_PREFIX (Subop))
932 {
933 /* NULL target (zero). Convert to a NULL namepath */
934
935 Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP, ParserState->Aml);
936 if (!Arg)
937 {
939 }
940
941 Status = AcpiPsGetNextNamepath (WalkState, ParserState,
943
944 if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP)
945 {
946 /* Free method call op and corresponding namestring sub-ob */
947
948 AcpiPsFreeOp (Arg->Common.Value.Arg);
949 AcpiPsFreeOp (Arg);
950 Arg = NULL;
951 WalkState->ArgCount = 1;
952 }
953 }
954 else
955 {
956 /* Single complex argument, nothing returned */
957
958 WalkState->ArgCount = 1;
959 }
960 break;
961
962 case ARGP_DATAOBJ:
963 case ARGP_TERMARG:
964
966 "**** TermArg/DataObj: %s (%2.2X)\n",
967 AcpiUtGetArgumentTypeName (ArgType), ArgType));
968
969 /* Single complex argument, nothing returned */
970
971 WalkState->ArgCount = 1;
972 break;
973
974 case ARGP_DATAOBJLIST:
975 case ARGP_TERMLIST:
976 case ARGP_OBJLIST:
977
978 if (ParserState->Aml < ParserState->PkgEnd)
979 {
980 /* Non-empty list of variable arguments, nothing returned */
981
982 WalkState->ArgCount = ACPI_VAR_ARGS;
983 }
984 break;
985
986 default:
987
988 ACPI_ERROR ((AE_INFO, "Invalid ArgType: 0x%X", ArgType));
990 break;
991 }
992
993 *ReturnArg = Arg;
995}
unsigned short UINT16
unsigned char BOOLEAN
unsigned long long UINT64
unsigned char UINT8
unsigned int UINT32
PRTL_UNICODE_STRING_BUFFER Path
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define AE_OK
Definition: acexcep.h:97
@ ACPI_IMODE_EXECUTE
Definition: aclocal.h:169
#define ACPI_GET16(ptr)
Definition: acmacros.h:58
#define ACPI_MOVE_16_TO_64(d, s)
Definition: acmacros.h:143
#define ASL_CV_CAPTURE_COMMENTS_ONLY(a)
Definition: acmacros.h:525
#define ACPI_GET32(ptr)
Definition: acmacros.h:59
#define ACPI_IS_PARENT_PREFIX(c)
Definition: acmacros.h:402
#define ACPI_GET8(ptr)
Definition: acmacros.h:57
#define GET_CURRENT_ARG_TYPE(List)
Definition: acmacros.h:450
#define ACPI_MOVE_64_TO_64(d, s)
Definition: acmacros.h:155
#define ACPI_IS_ROOT_PREFIX(c)
Definition: acmacros.h:401
#define ACPI_MOVE_32_TO_64(d, s)
Definition: acmacros.h:149
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
#define ACPI_MOVE_32_TO_32(d, s)
Definition: acmacros.h:148
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:328
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_PARSE
Definition: acoutput.h:162
#define ACPI_MODULE_NAME(Name)
Definition: acoutput.h:216
#define ACPI_FUNCTION_TRACE_U32(a, b)
Definition: acoutput.h:482
#define return_PTR(s)
Definition: acoutput.h:497
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define return_VOID
Definition: acoutput.h:495
#define return_UINT32(s)
Definition: acoutput.h:501
#define ACPI_PARSE_EXECUTE
Definition: acparser.h:61
UINT16 AcpiPsPeekOpcode(ACPI_PARSE_STATE *state)
Definition: psparse.c:108
void AcpiPsInitOp(ACPI_PARSE_OBJECT *op, UINT16 opcode)
Definition: psutils.c:98
#define ACPI_PARSE_MODE_MASK
Definition: acparser.h:62
BOOLEAN AcpiPsIsLeadingChar(UINT32 c)
Definition: psutils.c:249
#define ACPI_VAR_ARGS
Definition: acparser.h:52
#define ACPI_POSSIBLE_METHOD_CALL
Definition: acparser.h:118
void AcpiPsSetName(ACPI_PARSE_OBJECT *op, UINT32 name)
Definition: psutils.c:281
void AcpiPsFreeOp(ACPI_PARSE_OBJECT *Op)
Definition: psutils.c:212
void AcpiPsAppendArg(ACPI_PARSE_OBJECT *op, ACPI_PARSE_OBJECT *arg)
Definition: pstree.c:138
#define ACPI_NOT_METHOD_CALL
Definition: acparser.h:117
ACPI_PARSE_OBJECT * AcpiPsAllocOp(UINT16 Opcode, UINT8 *Aml)
Definition: psutils.c:130
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 const char BOOLEAN UINT8 * Aml
Definition: acpixf.h:1302
#define ACPI_TYPE_ANY
Definition: actypes.h:687
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_PTR_DIFF(a, b)
Definition: actypes.h:548
#define ACPI_TYPE_METHOD
Definition: actypes.h:695
#define ACPI_NAMESEG_SIZE
Definition: actypes.h:415
const char * AcpiUtGetArgumentTypeName(UINT32 ArgType)
#define AML_INT_NAMEDFIELD_OP
Definition: amlcode.h:206
#define ARGP_DWORDDATA
Definition: amlcode.h:229
#define ARGP_TERMARG
Definition: amlcode.h:237
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define ARGP_CHARLIST
Definition: amlcode.h:226
#define AML_DWORD_OP
Definition: amlcode.h:57
#define ARGP_NAME_OR_REF
Definition: amlcode.h:242
#define ARGP_BYTELIST
Definition: amlcode.h:225
#define AML_INT_BYTELIST_OP
Definition: amlcode.h:209
#define AML_FIELD_EXT_ACCESS_OP
Definition: amlcode.h:197
#define ARGP_SIMPLENAME
Definition: amlcode.h:241
#define AML_BYTE_OP
Definition: amlcode.h:55
#define AML_FIELD_ACCESS_OP
Definition: amlcode.h:195
#define ARGP_DATAOBJLIST
Definition: amlcode.h:228
#define ARGP_BYTEDATA
Definition: amlcode.h:224
#define ARGP_DATAOBJ
Definition: amlcode.h:227
#define ARGP_FIELDLIST
Definition: amlcode.h:230
#define ARGP_QWORDDATA
Definition: amlcode.h:240
#define AML_INT_METHODCALL_OP
Definition: amlcode.h:210
#define AML_INT_RESERVEDFIELD_OP
Definition: amlcode.h:207
#define AML_STRING_OP
Definition: amlcode.h:58
#define AML_FIELD_CONNECTION_OP
Definition: amlcode.h:196
#define ARGP_NAME
Definition: amlcode.h:231
#define AML_DUAL_NAME_PREFIX
Definition: amlcode.h:66
#define AML_MULTI_NAME_PREFIX
Definition: amlcode.h:67
#define AML_CONDITIONAL_REF_OF_OP
Definition: amlcode.h:162
#define AML_BUFFER_OP
Definition: amlcode.h:61
#define AML_FIELD_OFFSET_OP
Definition: amlcode.h:194
#define ARGP_TARGET
Definition: amlcode.h:236
#define ARGP_TERMLIST
Definition: amlcode.h:238
#define AML_WORD_OP
Definition: amlcode.h:56
#define ARGP_SUPERNAME
Definition: amlcode.h:235
#define ARGP_PKGLENGTH
Definition: amlcode.h:234
#define AML_PACKAGE_OP
Definition: amlcode.h:62
#define AML_INT_EXTACCESSFIELD_OP
Definition: amlcode.h:214
#define ARGP_OBJLIST
Definition: amlcode.h:233
#define AML_QWORD_OP
Definition: amlcode.h:59
#define AML_INT_CONNECTION_OP
Definition: amlcode.h:213
#define ARGP_NAMESTRING
Definition: amlcode.h:232
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define AML_INT_ACCESSFIELD_OP
Definition: amlcode.h:208
#define ARGP_WORDDATA
Definition: amlcode.h:239
struct NameRec_ * Name
Definition: cdprocs.h:460
#define NULL
Definition: types.h:112
union node Node
Definition: types.h:1255
ACPI_STATUS AcpiDsMethodError(ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:223
return pTarget Start()
Status
Definition: gdiplustypes.h:25
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:331
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
void AcpiPsGetNextSimpleArg(ACPI_PARSE_STATE *ParserState, UINT32 ArgType, ACPI_PARSE_OBJECT *Arg)
Definition: psargs.c:428
static UINT32 AcpiPsGetNextPackageLength(ACPI_PARSE_STATE *ParserState)
Definition: psargs.c:81
ACPI_STATUS AcpiPsGetNextArg(ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, UINT32 ArgType, ACPI_PARSE_OBJECT **ReturnArg)
Definition: psargs.c:785
char * AcpiPsGetNextNamestring(ACPI_PARSE_STATE *ParserState)
Definition: psargs.c:172
ACPI_STATUS AcpiPsGetNextNamepath(ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Arg, BOOLEAN PossibleMethodCall)
Definition: psargs.c:254
static ACPI_PARSE_OBJECT * AcpiPsGetNextField(ACPI_PARSE_STATE *ParserState)
Definition: psargs.c:528
UINT8 * AcpiPsGetNextPackageEnd(ACPI_PARSE_STATE *ParserState)
Definition: psargs.c:138
UINT8 * PkgEnd
Definition: aclocal.h:1105
UINT32 ArgTypes
Definition: acstruct.h:92
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
UINT32 ArgCount
Definition: acstruct.h:99
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
UINT32 ParseFlags
Definition: acstruct.h:95
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
ACPI_OBJECT_METHOD Method
Definition: acobject.h:525
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
Definition: dlist.c:348
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1099