2 /******************************************************************************
4 * Module Name: asloperands - AML operand processing
7 *****************************************************************************/
9 /******************************************************************************
13 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
14 * All rights reserved.
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
39 * The above copyright and patent license is granted only if the following
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
74 * 3.4. Intel retains all right, title, and interest in and to the Original
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
82 * 4. Disclaimer and Export Compliance
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
116 *****************************************************************************/
119 #include "aslcompiler.h"
120 #include "aslcompiler.y.h"
123 #define _COMPONENT ACPI_COMPILER
124 ACPI_MODULE_NAME ("asloperands")
127 /*******************************************************************************
129 * FUNCTION: OpnDoMethod
131 * PARAMETERS: Op - The parent parse node
135 * DESCRIPTION: Construct the operands for the METHOD ASL keyword.
137 ******************************************************************************/
141 ACPI_PARSE_OBJECT *Op)
143 ACPI_PARSE_OBJECT *Next;
145 /* Optional arguments for this opcode with defaults */
148 UINT8 Serialized = 0;
149 UINT8 Concurrency = 0;
153 /* Opcode and package length first */
156 Next = Op->Asl.Child;
160 Next = Next->Asl.Next;
161 if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
163 NumArgs = (UINT8) Next->Asl.Value.Integer;
164 Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
167 /* Serialized Flag */
169 Next = Next->Asl.Next;
170 if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
172 Serialized = (UINT8) Next->Asl.Value.Integer;
173 Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
176 /* Concurrency value (0-15 valid) */
178 Next = Next->Asl.Next;
179 if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
181 Concurrency = (UINT8) Next->Asl.Value.Integer;
184 /* Put the bits in their proper places */
186 MethodFlags = (UINT8) ((NumArgs & 0x7) |
187 ((Serialized & 0x1) << 3) |
188 ((Concurrency & 0xF) << 4));
190 /* Use the last node for the combined flags byte */
192 Next->Asl.Value.Integer = MethodFlags;
193 Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
194 Next->Asl.AmlLength = 1;
195 Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
197 /* Save the arg count in the first node */
199 Op->Asl.Extra = NumArgs;
203 /*******************************************************************************
205 * FUNCTION: OpnDoFieldCommon
207 * PARAMETERS: FieldOp - Node for an ASL field
208 * Op - The parent parse node
212 * DESCRIPTION: Construct the AML operands for the various field keywords,
213 * FIELD, BANKFIELD, INDEXFIELD
215 ******************************************************************************/
219 ACPI_PARSE_OBJECT *FieldOp,
220 ACPI_PARSE_OBJECT *Op)
222 ACPI_PARSE_OBJECT *Next;
223 ACPI_PARSE_OBJECT *PkgLengthNode;
224 UINT32 CurrentBitOffset;
230 UINT32 MinimumLength;
233 /* AccessType -- not optional, so no need to check for DEFAULT_ARG */
235 AccessType = (UINT8) Op->Asl.Value.Integer;
236 Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
238 /* Set the access type in the parent (field) node for use later */
240 FieldOp->Asl.Value.Integer = AccessType;
242 /* LockRule -- not optional, so no need to check for DEFAULT_ARG */
245 LockRule = (UINT8) Next->Asl.Value.Integer;
246 Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
248 /* UpdateRule -- not optional, so no need to check for DEFAULT_ARG */
250 Next = Next->Asl.Next;
251 UpdateRule = (UINT8) Next->Asl.Value.Integer;
254 * Generate the flags byte. The various fields are already
255 * in the right bit position via translation from the
256 * keywords by the parser.
258 FieldFlags = (UINT8) (AccessType | LockRule | UpdateRule);
260 /* Use the previous node to be the FieldFlags node */
262 /* Set the node to RAW_DATA */
264 Next->Asl.Value.Integer = FieldFlags;
265 Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
266 Next->Asl.AmlLength = 1;
267 Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
269 /* Process the FieldUnitList */
271 Next = Next->Asl.Next;
272 CurrentBitOffset = 0;
276 /* Save the offset of this field unit */
278 Next->Asl.ExtraValue = CurrentBitOffset;
280 switch (Next->Asl.ParseOpcode)
282 case PARSEOP_ACCESSAS:
284 PkgLengthNode = Next->Asl.Child;
285 AccessType = (UINT8) PkgLengthNode->Asl.Value.Integer;
287 /* Nothing additional to do */
293 /* New offset into the field */
295 PkgLengthNode = Next->Asl.Child;
296 NewBitOffset = ((UINT32) PkgLengthNode->Asl.Value.Integer) * 8;
299 * Examine the specified offset in relation to the
300 * current offset counter.
302 if (NewBitOffset < CurrentBitOffset)
305 * Not allowed to specify a backwards offset!
306 * Issue error and ignore this node.
308 AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode, NULL);
309 Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
310 PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
312 else if (NewBitOffset == CurrentBitOffset)
315 * Offset is redundant; we don't need to output an
316 * offset opcode. Just set these nodes to default
318 Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
319 PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
324 * Valid new offset - set the value to be inserted into the AML
325 * and update the offset counter.
327 PkgLengthNode->Asl.Value.Integer = NewBitOffset - CurrentBitOffset;
328 CurrentBitOffset = NewBitOffset;
333 case PARSEOP_NAMESEG:
334 case PARSEOP_RESERVED_BYTES:
336 /* Named or reserved field entry */
338 PkgLengthNode = Next->Asl.Child;
339 NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer;
340 CurrentBitOffset += NewBitOffset;
342 /* Save the current AccessAs value for error checking later */
346 case AML_FIELD_ACCESS_ANY:
347 case AML_FIELD_ACCESS_BYTE:
348 case AML_FIELD_ACCESS_BUFFER:
353 case AML_FIELD_ACCESS_WORD:
357 case AML_FIELD_ACCESS_DWORD:
361 case AML_FIELD_ACCESS_QWORD:
366 PkgLengthNode->Asl.ExtraValue = MinimumLength;
370 /* All supported field opcodes must appear above */
374 /* Move on to next entry in the field list */
376 Next = Next->Asl.Next;
381 /*******************************************************************************
383 * FUNCTION: OpnDoField
385 * PARAMETERS: Op - The parent parse node
389 * DESCRIPTION: Construct the AML operands for the FIELD ASL keyword
391 ******************************************************************************/
395 ACPI_PARSE_OBJECT *Op)
397 ACPI_PARSE_OBJECT *Next;
400 /* Opcode is parent node */
401 /* First child is field name */
403 Next = Op->Asl.Child;
405 /* Second child is the AccessType */
407 OpnDoFieldCommon (Op, Next->Asl.Next);
411 /*******************************************************************************
413 * FUNCTION: OpnDoIndexField
415 * PARAMETERS: Op - The parent parse node
419 * DESCRIPTION: Construct the AML operands for the INDEXFIELD ASL keyword
421 ******************************************************************************/
425 ACPI_PARSE_OBJECT *Op)
427 ACPI_PARSE_OBJECT *Next;
430 /* Opcode is parent node */
431 /* First child is the index name */
433 Next = Op->Asl.Child;
435 /* Second child is the data name */
437 Next = Next->Asl.Next;
439 /* Third child is the AccessType */
441 OpnDoFieldCommon (Op, Next->Asl.Next);
445 /*******************************************************************************
447 * FUNCTION: OpnDoBankField
449 * PARAMETERS: Op - The parent parse node
453 * DESCRIPTION: Construct the AML operands for the BANKFIELD ASL keyword
455 ******************************************************************************/
459 ACPI_PARSE_OBJECT *Op)
461 ACPI_PARSE_OBJECT *Next;
464 /* Opcode is parent node */
465 /* First child is the region name */
467 Next = Op->Asl.Child;
469 /* Second child is the bank name */
471 Next = Next->Asl.Next;
473 /* Third child is the bank value */
475 Next = Next->Asl.Next;
477 /* Fourth child is the AccessType */
479 OpnDoFieldCommon (Op, Next->Asl.Next);
483 /*******************************************************************************
485 * FUNCTION: OpnDoRegion
487 * PARAMETERS: Op - The parent parse node
491 * DESCRIPTION: Tries to get the length of the region. Can only do this at
492 * compile time if the length is a constant.
494 ******************************************************************************/
498 ACPI_PARSE_OBJECT *Op)
500 ACPI_PARSE_OBJECT *Next;
503 /* Opcode is parent node */
504 /* First child is the region name */
506 Next = Op->Asl.Child;
508 /* Second child is the space ID*/
510 Next = Next->Asl.Next;
512 /* Third child is the region offset */
514 Next = Next->Asl.Next;
516 /* Fourth child is the region length */
518 Next = Next->Asl.Next;
519 if (Next->Asl.ParseOpcode == PARSEOP_INTEGER)
521 Op->Asl.Value.Integer = Next->Asl.Value.Integer;
525 Op->Asl.Value.Integer = ACPI_INTEGER_MAX;
530 /*******************************************************************************
532 * FUNCTION: OpnDoBuffer
534 * PARAMETERS: Op - The parent parse node
538 * DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword. We
539 * build a single raw byte buffer from the initialization nodes,
540 * each parse node contains a buffer byte.
542 ******************************************************************************/
546 ACPI_PARSE_OBJECT *Op)
548 ACPI_PARSE_OBJECT *InitializerOp;
549 ACPI_PARSE_OBJECT *BufferLengthOp;
551 /* Optional arguments for this opcode with defaults */
553 UINT32 BufferLength = 0;
556 /* Opcode and package length first */
557 /* Buffer Length is next, followed by the initializer list */
559 BufferLengthOp = Op->Asl.Child;
560 InitializerOp = BufferLengthOp->Asl.Next;
563 * If the BufferLength is not an INTEGER or was not specified in the ASL
564 * (DEFAULT_ARG), it is a TermArg that is
565 * evaluated at run-time, and we are therefore finished.
567 if ((BufferLengthOp->Asl.ParseOpcode != PARSEOP_INTEGER) &&
568 (BufferLengthOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
574 * We want to count the number of items in the initializer list, because if
575 * it is larger than the buffer length, we will define the buffer size
576 * to be the size of the initializer list (as per the ACPI Specification)
578 switch (InitializerOp->Asl.ParseOpcode)
580 case PARSEOP_INTEGER:
581 case PARSEOP_BYTECONST:
582 case PARSEOP_WORDCONST:
583 case PARSEOP_DWORDCONST:
585 /* The peer list contains the byte list (if any...) */
587 while (InitializerOp)
589 /* For buffers, this is a list of raw bytes */
591 InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
592 InitializerOp->Asl.AmlLength = 1;
593 InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
596 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
601 case PARSEOP_STRING_LITERAL:
604 * Only one initializer, the string. Buffer must be big enough to hold
605 * the string plus the null termination byte
607 BufferLength = strlen (InitializerOp->Asl.Value.String) + 1;
609 InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
610 InitializerOp->Asl.AmlLength = BufferLength;
611 InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
615 case PARSEOP_RAW_DATA:
617 /* Buffer nodes are already initialized (e.g. Unicode operator) */
621 case PARSEOP_DEFAULT_ARG:
626 AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp,
627 "Unknown buffer initializer opcode");
628 printf ("Unknown buffer initializer opcode [%s]\n",
629 UtGetOpName (InitializerOp->Asl.ParseOpcode));
633 /* Check if initializer list is longer than the buffer length */
635 if (BufferLengthOp->Asl.Value.Integer > BufferLength)
637 BufferLength = (UINT32) BufferLengthOp->Asl.Value.Integer;
642 /* No length AND no items -- issue a warning */
644 AslError (ASL_WARNING, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL);
646 /* But go ahead and put the buffer length of zero into the AML */
650 * Just set the buffer size node to be the buffer length, regardless
651 * of whether it was previously an integer or a default_arg placeholder
653 BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
654 BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
655 BufferLengthOp->Asl.Value.Integer = BufferLength;
657 (void) OpcSetOptimalIntegerSize (BufferLengthOp);
659 /* Remaining nodes are handled via the tree walk */
663 /*******************************************************************************
665 * FUNCTION: OpnDoPackage
667 * PARAMETERS: Op - The parent parse node
671 * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword.
673 ******************************************************************************/
677 ACPI_PARSE_OBJECT *Op)
679 ACPI_PARSE_OBJECT *InitializerOp;
680 ACPI_PARSE_OBJECT *PackageLengthOp;
682 /* Optional arguments for this opcode with defaults */
684 UINT32 PackageLength = 0;
687 /* Opcode and package length first */
688 /* Buffer Length is next, followed by the initializer list */
690 PackageLengthOp = Op->Asl.Child;
691 InitializerOp = PackageLengthOp->Asl.Next;
694 * We always count the number of items in the initializer list, because if
695 * it is larger than the buffer length, we will define the buffer size
696 * to be the size of the initializer list (Per ACPI Spec)
698 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
700 /* The peer list contains the byte list (if any...) */
702 while (InitializerOp)
705 InitializerOp = InitializerOp->Asl.Next;
709 /* Check if initializer list is longer than the buffer length */
711 if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
712 (PackageLengthOp->Asl.ParseOpcode == PARSEOP_BYTECONST))
714 if (PackageLengthOp->Asl.Value.Integer > PackageLength)
716 PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer;
721 * If not a variable-length package, check for a zero
724 if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
725 (PackageLengthOp->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
726 (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG))
730 /* No length AND no items -- issue a warning */
732 AslError (ASL_WARNING, ASL_MSG_PACKAGE_LENGTH, PackageLengthOp, NULL);
734 /* But go ahead and put the buffer length of zero into the AML */
739 * Just set the buffer size node to be the buffer length, regardless
740 * of whether it was previously an integer or a default_arg placeholder
742 PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
743 PackageLengthOp->Asl.AmlLength = 1;
744 PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
745 PackageLengthOp->Asl.Value.Integer = PackageLength;
747 /* Remaining nodes are handled via the tree walk */
751 /*******************************************************************************
753 * FUNCTION: OpnDoLoadTable
755 * PARAMETERS: Op - The parent parse node
759 * DESCRIPTION: Construct the AML operands for the LOADTABLE ASL keyword.
761 ******************************************************************************/
765 ACPI_PARSE_OBJECT *Op)
767 ACPI_PARSE_OBJECT *Next;
770 /* Opcode is parent node */
771 /* First child is the table signature */
773 Next = Op->Asl.Child;
775 /* Second child is the OEM ID*/
777 Next = Next->Asl.Next;
779 /* Third child is the OEM table ID */
781 Next = Next->Asl.Next;
783 /* Fourth child is the RootPath string */
785 Next = Next->Asl.Next;
786 if (Next->Asl.ParseOpcode == PARSEOP_ZERO)
788 Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
789 Next->Asl.Value.String = "\\";
790 Next->Asl.AmlLength = 2;
791 OpcGenerateAmlOpcode (Next);
794 /* Fifth child is the [optional] ParameterPathString */
795 /* Sixth child is the [optional] ParameterData */
798 Next = Next->Asl.Next;
799 if (Next->Asl.ParseOpcode == DEFAULT_ARG)
801 Next->Asl.AmlLength = 1;
802 Next->Asl.ParseOpcode = ZERO;
803 OpcGenerateAmlOpcode (Next);
807 Next = Next->Asl.Next;
808 if (Next->Asl.ParseOpcode == DEFAULT_ARG)
810 Next->Asl.AmlLength = 1;
811 Next->Asl.ParseOpcode = ZERO;
812 OpcGenerateAmlOpcode (Next);
818 /*******************************************************************************
820 * FUNCTION: OpnDoDefinitionBlock
822 * PARAMETERS: Op - The parent parse node
826 * DESCRIPTION: Construct the AML operands for the DEFINITIONBLOCK ASL keyword
828 ******************************************************************************/
831 OpnDoDefinitionBlock (
832 ACPI_PARSE_OBJECT *Op)
834 ACPI_PARSE_OBJECT *Child;
840 * These nodes get stuffed into the table header. They are special
841 * cased when the table is written to the output file.
843 * Mark all of these nodes as non-usable so they won't get output
849 Child = Op->Asl.Child;
850 if ((Child->Asl.Value.Buffer) && (Gbl_UseDefaultAmlFilename))
852 Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer;
854 Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
858 Child = Child->Asl.Next;
859 Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
860 if (Child->Asl.Value.String)
862 Gbl_TableSignature = Child->Asl.Value.String;
863 if (ACPI_STRLEN (Gbl_TableSignature) != 4)
865 AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Length not exactly 4");
868 for (i = 0; i < 4; i++)
870 if (!isalnum (Gbl_TableSignature[i]))
872 AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Contains non-alphanumeric characters");
879 Child = Child->Asl.Next;
880 Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
882 /* Use the revision to set the integer width */
884 AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
888 Child = Child->Asl.Next;
889 Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
893 Child = Child->Asl.Next;
894 Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
895 if (Child->Asl.Value.String)
897 Length = ACPI_STRLEN (Child->Asl.Value.String);
898 Gbl_TableId = AcpiOsAllocate (Length + 1);
899 ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String);
901 for (i = 0; i < Length; i++)
903 if (Gbl_TableId[i] == ' ')
913 Child = Child->Asl.Next;
914 Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
918 /*******************************************************************************
922 * PARAMETERS: Op - Get an argument for this op
923 * Argn - Nth argument to get
925 * RETURN: The argument (as an Op object). NULL if argument does not exist
927 * DESCRIPTION: Get the specified op's argument (peer)
929 ******************************************************************************/
933 ACPI_PARSE_OBJECT *Op,
936 ACPI_PARSE_OBJECT *Arg = NULL;
939 /* Get the requested argument object */
952 /*******************************************************************************
954 * FUNCTION: OpnAttachNameToNode
956 * PARAMETERS: Op - The parent parse node
960 * DESCRIPTION: For the named ASL/AML operators, get the actual name from the
961 * argument list and attach it to the parent node so that we
962 * can get to it quickly later.
964 ******************************************************************************/
967 OpnAttachNameToNode (
968 ACPI_PARSE_OBJECT *Op)
970 ACPI_PARSE_OBJECT *Child = NULL;
973 if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)
975 Child = UtGetArg (Op, 0);
977 else switch (Op->Asl.AmlOpcode)
979 case AML_DATA_REGION_OP:
985 case AML_POWER_RES_OP:
986 case AML_PROCESSOR_OP:
987 case AML_THERMAL_ZONE_OP:
991 Child = UtGetArg (Op, 0);
996 Child = UtGetArg (Op, 1);
999 case AML_CREATE_BIT_FIELD_OP:
1000 case AML_CREATE_BYTE_FIELD_OP:
1001 case AML_CREATE_WORD_FIELD_OP:
1002 case AML_CREATE_DWORD_FIELD_OP:
1003 case AML_CREATE_QWORD_FIELD_OP:
1005 Child = UtGetArg (Op, 2);
1008 case AML_CREATE_FIELD_OP:
1010 Child = UtGetArg (Op, 3);
1013 case AML_BANK_FIELD_OP:
1014 case AML_INDEX_FIELD_OP:
1025 UtAttachNamepathToOwner (Op, Child);
1030 /*******************************************************************************
1032 * FUNCTION: OpnGenerateAmlOperands
1034 * PARAMETERS: Op - The parent parse node
1038 * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more
1039 * complex AML opcodes require processing of the child nodes
1040 * (arguments/operands).
1042 ******************************************************************************/
1045 OpnGenerateAmlOperands (
1046 ACPI_PARSE_OBJECT *Op)
1050 if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE)
1055 switch (Op->Asl.ParseOpcode)
1057 case PARSEOP_DEFINITIONBLOCK:
1058 OpnDoDefinitionBlock (Op);
1061 case PARSEOP_METHOD:
1069 case PARSEOP_INDEXFIELD:
1070 OpnDoIndexField (Op);
1073 case PARSEOP_BANKFIELD:
1074 OpnDoBankField (Op);
1077 case PARSEOP_BUFFER:
1081 case PARSEOP_LOADTABLE:
1082 OpnDoLoadTable (Op);
1085 case PARSEOP_PACKAGE:
1089 case PARSEOP_OPERATIONREGION:
1093 case PARSEOP_RESOURCETEMPLATE:
1094 RsDoResourceTemplate (Op);
1097 case PARSEOP_NAMESEG:
1098 case PARSEOP_NAMESTRING:
1099 case PARSEOP_METHODCALL:
1100 case PARSEOP_STRING_LITERAL:
1109 OpnAttachNameToNode (Op);