1 /******************************************************************************
3 * Module Name: aslxref - Namespace cross-reference
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2014, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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 MERCHANTIBILITY 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.
44 #include "aslcompiler.h"
45 #include "aslcompiler.y.h"
52 #define _COMPONENT ACPI_COMPILER
53 ACPI_MODULE_NAME ("aslxref")
55 /* Local prototypes */
58 XfNamespaceLocateBegin (
59 ACPI_PARSE_OBJECT *Op,
64 XfNamespaceLocateEnd (
65 ACPI_PARSE_OBJECT *Op,
74 XfCompareOneNamespaceObject (
75 ACPI_HANDLE ObjHandle,
82 ACPI_PARSE_OBJECT *Op,
83 UINT32 RegionBitLength,
84 UINT32 FieldBitOffset,
85 UINT32 FieldBitLength,
86 UINT32 AccessBitWidth);
90 ACPI_PARSE_OBJECT *MethodOp1,
91 ACPI_PARSE_OBJECT *MethodOp2);
93 static ACPI_PARSE_OBJECT *
95 ACPI_PARSE_OBJECT *Op);
98 XfCheckIllegalReference (
99 ACPI_PARSE_OBJECT *Op,
100 ACPI_NAMESPACE_NODE *Node);
103 /*******************************************************************************
105 * FUNCTION: XfCrossReferenceNamespace
111 * DESCRIPTION: Perform a cross reference check of the parse tree against the
112 * namespace. Every named referenced within the parse tree
113 * should be get resolved with a namespace lookup. If not, the
114 * original reference in the ASL code is invalid -- i.e., refers
115 * to a non-existent object.
117 * NOTE: The ASL "External" operator causes the name to be inserted into the
118 * namespace so that references to the external name will be resolved
121 ******************************************************************************/
124 XfCrossReferenceNamespace (
127 ACPI_WALK_STATE *WalkState;
130 DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n");
133 * Create a new walk state for use when looking up names
134 * within the namespace (Passed as context to the callbacks)
136 WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
139 return (AE_NO_MEMORY);
142 /* Walk the entire parse tree */
144 TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin,
145 XfNamespaceLocateEnd, WalkState);
147 ACPI_FREE (WalkState);
152 /*******************************************************************************
154 * FUNCTION: XfObjectExists
156 * PARAMETERS: Name - 4 char ACPI name
158 * RETURN: TRUE if name exists in namespace
160 * DESCRIPTION: Walk the namespace to find an object
162 ******************************************************************************/
171 /* Walk entire namespace from the supplied root */
173 Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
174 ACPI_UINT32_MAX, FALSE, XfCompareOneNamespaceObject, NULL,
176 if (Status == AE_CTRL_TRUE)
178 /* At least one instance of the name was found */
187 /*******************************************************************************
189 * FUNCTION: XfCompareOneNamespaceObject
191 * PARAMETERS: ACPI_WALK_CALLBACK
195 * DESCRIPTION: Compare name of one object.
197 ******************************************************************************/
200 XfCompareOneNamespaceObject (
201 ACPI_HANDLE ObjHandle,
206 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
209 /* Simply check the name */
211 if (*((UINT32 *) (Context)) == Node->Name.Integer)
213 /* Abort walk if we found one instance */
215 return (AE_CTRL_TRUE);
222 /*******************************************************************************
224 * FUNCTION: XfCheckFieldRange
226 * PARAMETERS: RegionBitLength - Length of entire parent region
227 * FieldBitOffset - Start of the field unit (within region)
228 * FieldBitLength - Entire length of field unit
229 * AccessBitWidth - Access width of the field unit
233 * DESCRIPTION: Check one field unit to make sure it fits in the parent
236 * Note: AccessBitWidth must be either 8,16,32, or 64
238 ******************************************************************************/
242 ACPI_PARSE_OBJECT *Op,
243 UINT32 RegionBitLength,
244 UINT32 FieldBitOffset,
245 UINT32 FieldBitLength,
246 UINT32 AccessBitWidth)
248 UINT32 FieldEndBitOffset;
252 * Check each field unit against the region size. The entire
253 * field unit (start offset plus length) must fit within the
256 FieldEndBitOffset = FieldBitOffset + FieldBitLength;
258 if (FieldEndBitOffset > RegionBitLength)
260 /* Field definition itself is beyond the end-of-region */
262 AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL);
267 * Now check that the field plus AccessWidth doesn't go beyond
268 * the end-of-region. Assumes AccessBitWidth is a power of 2
270 FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth);
272 if (FieldEndBitOffset > RegionBitLength)
274 /* Field definition combined with the access is beyond EOR */
276 AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL);
281 /*******************************************************************************
283 * FUNCTION: XfIsObjectParental
285 * PARAMETERS: ChildOp - Op to be checked
286 * PossibleParentOp - Determine if this op is in the family
288 * RETURN: TRUE if ChildOp is a descendent of PossibleParentOp
290 * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to
291 * detect if a method is declared within another method.
293 ******************************************************************************/
297 ACPI_PARSE_OBJECT *ChildOp,
298 ACPI_PARSE_OBJECT *PossibleParentOp)
300 ACPI_PARSE_OBJECT *ParentOp;
303 /* Search upwards through the tree for possible parent */
308 if (ParentOp == PossibleParentOp)
313 ParentOp = ParentOp->Asl.Parent;
320 /*******************************************************************************
322 * FUNCTION: XfGetParentMethod
324 * PARAMETERS: Op - Op to be checked
326 * RETURN: Op for parent method. NULL if object is not within a method.
328 * DESCRIPTION: Determine if an object is within a control method. Used to
329 * implement special rules for named references from within a
332 * NOTE: It would be better to have the parser set a flag in the Op if possible.
334 ******************************************************************************/
336 static ACPI_PARSE_OBJECT *
338 ACPI_PARSE_OBJECT *Op)
340 ACPI_PARSE_OBJECT *ParentOp;
348 if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
353 /* Walk upwards through the parse tree, up to the root if necessary */
358 if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD)
363 ParentOp = ParentOp->Asl.Parent;
366 /* Object is not within a method */
371 /*******************************************************************************
373 * FUNCTION: XfCheckIllegalReference
375 * PARAMETERS: Op - Op referring to the target
376 * TargetNode - Target of the reference
378 * RETURN: None. Emits error message for an illegal reference
380 * DESCRIPTION: Determine if a named reference is legal. A "named" reference
381 * is something like: Store(ABCD, ...), where ABCD is an AML
382 * Nameseg or Namepath.
384 * NOTE: Caller must ensure that the name Op is in fact a reference, and not
385 * an actual name declaration (creation of a named object).
387 ******************************************************************************/
390 XfCheckIllegalReference (
391 ACPI_PARSE_OBJECT *Op,
392 ACPI_NAMESPACE_NODE *TargetNode)
394 ACPI_PARSE_OBJECT *MethodOp1;
395 ACPI_PARSE_OBJECT *MethodOp2;
396 ACPI_PARSE_OBJECT *TargetOp;
400 * Check for an illegal reference to a named object:
402 * 1) References from one control method to another, non-parent
403 * method are not allowed, they will fail at runtime.
405 * 2) Forward references within a control method are not allowed.
406 * AML interpreters use a one-pass parse of control methods
407 * so these forward references will fail at runtime.
409 TargetOp = TargetNode->Op;
411 MethodOp1 = XfGetParentMethod (Op);
412 MethodOp2 = XfGetParentMethod (TargetOp);
414 /* Are both objects within control method(s)? */
416 if (!MethodOp1 || !MethodOp2)
421 /* Objects not in the same method? */
423 if (MethodOp1 != MethodOp2)
426 * 1) Cross-method named reference
428 * This is OK if and only if the target reference is within in a
429 * method that is a parent of current method
431 if (!XfIsObjectParental (MethodOp1, MethodOp2))
433 AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op,
434 Op->Asl.ExternalName);
439 * 2) Both reference and target are in the same method. Check if this is
440 * an (illegal) forward reference by examining the exact source code
441 * location of each (the referenced object and the object declaration).
442 * This is a bit nasty, yet effective.
444 else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset)
446 AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op,
447 Op->Asl.ExternalName);
452 /*******************************************************************************
454 * FUNCTION: XfNamespaceLocateBegin
456 * PARAMETERS: ASL_WALK_CALLBACK
460 * DESCRIPTION: Descending callback used during cross-reference. For named
461 * object references, attempt to locate the name in the
464 * NOTE: ASL references to named fields within resource descriptors are
465 * resolved to integer values here. Therefore, this step is an
466 * important part of the code generation. We don't know that the
467 * name refers to a resource descriptor until now.
469 ******************************************************************************/
472 XfNamespaceLocateBegin (
473 ACPI_PARSE_OBJECT *Op,
477 ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
478 ACPI_NAMESPACE_NODE *Node;
480 ACPI_OBJECT_TYPE ObjectType;
483 ACPI_PARSE_OBJECT *NextOp;
484 ACPI_PARSE_OBJECT *OwningOp;
485 ACPI_PARSE_OBJECT *SpaceIdOp;
486 UINT32 MinimumLength;
488 UINT32 FieldBitLength;
491 const ACPI_OPCODE_INFO *OpInfo;
495 ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op);
498 * If this node is the actual declaration of a name
499 * [such as the XXXX name in "Method (XXXX)"],
500 * we are not interested in it here. We only care about names that are
501 * references to other objects within the namespace and the parent objects
502 * of name declarations
504 if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
506 return_ACPI_STATUS (AE_OK);
509 /* We are only interested in opcodes that have an associated name */
511 OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
513 if ((!(OpInfo->Flags & AML_NAMED)) &&
514 (!(OpInfo->Flags & AML_CREATE)) &&
515 (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
516 (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) &&
517 (Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
519 return_ACPI_STATUS (AE_OK);
523 * One special case: CondRefOf operator - we don't care if the name exists
524 * or not at this point, just ignore it, the point of the operator is to
525 * determine if the name exists at runtime.
527 if ((Op->Asl.Parent) &&
528 (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
530 return_ACPI_STATUS (AE_OK);
534 * We must enable the "search-to-root" for single NameSegs, but
535 * we have to be very careful about opening up scopes
537 Flags = ACPI_NS_SEARCH_PARENT;
538 if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
539 (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
540 (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
543 * These are name references, do not push the scope stack
546 Flags |= ACPI_NS_DONT_OPEN_SCOPE;
549 /* Get the NamePath from the appropriate place */
551 if (OpInfo->Flags & AML_NAMED)
553 /* For nearly all NAMED operators, the name reference is the first child */
555 Path = Op->Asl.Child->Asl.Value.String;
556 if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
559 * ALIAS is the only oddball opcode, the name declaration
560 * (alias name) is the second operand
562 Path = Op->Asl.Child->Asl.Next->Asl.Value.String;
565 else if (OpInfo->Flags & AML_CREATE)
567 /* Name must appear as the last parameter */
569 NextOp = Op->Asl.Child;
570 while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
572 NextOp = NextOp->Asl.Next;
574 Path = NextOp->Asl.Value.String;
578 Path = Op->Asl.Value.String;
581 ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
582 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
583 "Type=%s\n", AcpiUtGetTypeName (ObjectType)));
586 * Lookup the name in the namespace. Name must exist at this point, or it
587 * is an invalid reference.
589 * The namespace is also used as a lookup table for references to resource
590 * descriptors and the fields within them.
594 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
595 ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
596 if (ACPI_FAILURE (Status))
598 if (Status == AE_NOT_FOUND)
601 * We didn't find the name reference by path -- we can qualify this
602 * a little better before we print an error message
604 if (strlen (Path) == ACPI_NAME_SIZE)
606 /* A simple, one-segment ACPI name */
608 if (XfObjectExists (Path))
611 * There exists such a name, but we couldn't get to it
614 AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op,
615 Op->Asl.ExternalName);
619 /* The name doesn't exist, period */
621 AslError (ASL_ERROR, ASL_MSG_NOT_EXIST,
622 Op, Op->Asl.ExternalName);
627 /* Check for a fully qualified path */
629 if (Path[0] == AML_ROOT_PREFIX)
631 /* Gave full path, the object does not exist */
633 AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op,
634 Op->Asl.ExternalName);
639 * We can't tell whether it doesn't exist or just
642 AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
643 Op->Asl.ExternalName);
650 return_ACPI_STATUS (Status);
653 /* Check for a reference vs. name declaration */
655 if (!(OpInfo->Flags & AML_NAMED) &&
656 !(OpInfo->Flags & AML_CREATE))
658 /* This node has been referenced, mark it for reference check */
660 Node->Flags |= ANOBJ_IS_REFERENCED;
662 /* Check for an illegal reference */
664 XfCheckIllegalReference (Op, Node);
667 /* Attempt to optimize the NamePath */
669 OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
672 * 1) Dereference an alias (A name reference that is an alias)
673 * Aliases are not nested, the alias always points to the final object
675 if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) &&
676 (Node->Type == ACPI_TYPE_LOCAL_ALIAS))
678 /* This node points back to the original PARSEOP_ALIAS */
682 /* The first child is the alias target op */
684 NextOp = NextOp->Asl.Child;
686 /* That in turn points back to original target alias node */
688 if (NextOp->Asl.Node)
690 Node = NextOp->Asl.Node;
693 /* Else - forward reference to alias, will be resolved later */
696 /* 2) Check for a reference to a resource descriptor */
698 if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
699 (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
702 * This was a reference to a field within a resource descriptor.
703 * Extract the associated field offset (either a bit or byte
704 * offset depending on the field type) and change the named
705 * reference into an integer for AML code generation
707 Offset = Node->Value;
708 TagBitLength = Node->Length;
711 * If a field is being created, generate the length (in bits) of
712 * the field. Note: Opcodes other than CreateXxxField and Index
713 * can come through here. For other opcodes, we just need to
714 * convert the resource tag reference to an integer offset.
716 switch (Op->Asl.Parent->Asl.AmlOpcode)
718 case AML_CREATE_FIELD_OP: /* Variable "Length" field, in bits */
720 * We know the length operand is an integer constant because
721 * we know that it contains a reference to a resource
724 FieldBitLength = (UINT32) Op->Asl.Next->Asl.Value.Integer;
727 case AML_CREATE_BIT_FIELD_OP:
732 case AML_CREATE_BYTE_FIELD_OP:
738 case AML_CREATE_WORD_FIELD_OP:
743 case AML_CREATE_DWORD_FIELD_OP:
748 case AML_CREATE_QWORD_FIELD_OP:
759 /* Check the field length against the length of the resource tag */
763 if (TagBitLength < FieldBitLength)
765 Message = ASL_MSG_TAG_SMALLER;
767 else if (TagBitLength > FieldBitLength)
769 Message = ASL_MSG_TAG_LARGER;
774 sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s",
775 TagBitLength, (TagBitLength > 1) ? "s" : "",
776 FieldBitLength, (FieldBitLength > 1) ? "s" : "");
778 AslError (ASL_WARNING, Message, Op, MsgBuffer);
782 /* Convert the BitOffset to a ByteOffset for certain opcodes */
784 switch (Op->Asl.Parent->Asl.AmlOpcode)
786 case AML_CREATE_BYTE_FIELD_OP:
787 case AML_CREATE_WORD_FIELD_OP:
788 case AML_CREATE_DWORD_FIELD_OP:
789 case AML_CREATE_QWORD_FIELD_OP:
792 Offset = ACPI_DIV_8 (Offset);
800 /* Now convert this node to an integer whose value is the field offset */
802 Op->Asl.AmlLength = 0;
803 Op->Asl.ParseOpcode = PARSEOP_INTEGER;
804 Op->Asl.Value.Integer = (UINT64) Offset;
805 Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
807 OpcGenerateAmlOpcode (Op);
810 /* 3) Check for a method invocation */
812 else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) &&
813 (Node->Type == ACPI_TYPE_METHOD) &&
815 (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) ||
817 (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
820 * A reference to a method within one of these opcodes is not an
821 * invocation of the method, it is simply a reference to the method.
823 if ((Op->Asl.Parent) &&
824 ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) ||
825 (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) ||
826 (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))
828 return_ACPI_STATUS (AE_OK);
831 * There are two types of method invocation:
832 * 1) Invocation with arguments -- the parser recognizes this
834 * 2) Invocation with no arguments --the parser cannot determine that
835 * this is a method invocation, therefore we have to figure it out
838 if (Node->Type != ACPI_TYPE_METHOD)
840 sprintf (MsgBuffer, "%s is a %s",
841 Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
843 AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
844 return_ACPI_STATUS (AE_OK);
847 /* Save the method node in the caller's op */
850 if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)
852 return_ACPI_STATUS (AE_OK);
856 * This is a method invocation, with or without arguments.
857 * Count the number of arguments, each appears as a child
858 * under the parent node
860 Op->Asl.ParseOpcode = PARSEOP_METHODCALL;
861 UtSetParseOpName (Op);
864 NextOp = Op->Asl.Child;
869 NextOp = NextOp->Asl.Next;
872 if (Node->Value != ASL_EXTERNAL_METHOD)
875 * Check the parsed arguments with the number expected by the
876 * method declaration itself
878 if (PassedArgs != Node->Value)
880 sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
883 if (PassedArgs < Node->Value)
885 AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer);
889 AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer);
895 /* 4) Check for an ASL Field definition */
897 else if ((Op->Asl.Parent) &&
898 ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) ||
899 (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))
902 * Offset checking for fields. If the parent operation region has a
903 * constant length (known at compile time), we can check fields
904 * defined in that region against the region length. This will catch
905 * fields and field units that cannot possibly fit within the region.
907 * Note: Index fields do not directly reference an operation region,
908 * thus they are not included in this check.
910 if (Op == Op->Asl.Parent->Asl.Child)
913 * This is the first child of the field node, which is
914 * the name of the region. Get the parse node for the
915 * region -- which contains the length of the region.
918 Op->Asl.Parent->Asl.ExtraValue =
919 ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer);
921 /* Examine the field access width */
923 switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer)
925 case AML_FIELD_ACCESS_ANY:
926 case AML_FIELD_ACCESS_BYTE:
927 case AML_FIELD_ACCESS_BUFFER:
933 case AML_FIELD_ACCESS_WORD:
938 case AML_FIELD_ACCESS_DWORD:
943 case AML_FIELD_ACCESS_QWORD:
950 * Is the region at least as big as the access width?
951 * Note: DataTableRegions have 0 length
953 if (((UINT32) OwningOp->Asl.Value.Integer) &&
954 ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength))
956 AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL);
960 * Check EC/CMOS/SMBUS fields to make sure that the correct
961 * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS)
963 SpaceIdOp = OwningOp->Asl.Child->Asl.Next;
964 switch ((UINT32) SpaceIdOp->Asl.Value.Integer)
966 case ACPI_ADR_SPACE_EC:
967 case ACPI_ADR_SPACE_CMOS:
968 case ACPI_ADR_SPACE_GPIO:
970 if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
972 AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL);
976 case ACPI_ADR_SPACE_SMBUS:
977 case ACPI_ADR_SPACE_IPMI:
978 case ACPI_ADR_SPACE_GSBUS:
980 if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
982 AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL);
988 /* Nothing to do for other address spaces */
996 * This is one element of the field list. Check to make sure
997 * that it does not go beyond the end of the parent operation region.
1000 * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits)
1001 * Op->Asl.ExtraValue - Field start offset (bits)
1002 * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits)
1003 * Op->Asl.Child->Asl.ExtraValue - Field access width (bits)
1005 if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child)
1007 XfCheckFieldRange (Op,
1008 Op->Asl.Parent->Asl.ExtraValue,
1010 (UINT32) Op->Asl.Child->Asl.Value.Integer,
1011 Op->Asl.Child->Asl.ExtraValue);
1016 Op->Asl.Node = Node;
1017 return_ACPI_STATUS (Status);
1021 /*******************************************************************************
1023 * FUNCTION: XfNamespaceLocateEnd
1025 * PARAMETERS: ASL_WALK_CALLBACK
1029 * DESCRIPTION: Ascending callback used during cross reference. We only
1030 * need to worry about scope management here.
1032 ******************************************************************************/
1035 XfNamespaceLocateEnd (
1036 ACPI_PARSE_OBJECT *Op,
1040 ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
1041 const ACPI_OPCODE_INFO *OpInfo;
1044 ACPI_FUNCTION_TRACE (XfNamespaceLocateEnd);
1047 /* We are only interested in opcodes that have an associated name */
1049 OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
1050 if (!(OpInfo->Flags & AML_NAMED))
1052 return_ACPI_STATUS (AE_OK);
1055 /* Not interested in name references, we did not open a scope for them */
1057 if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
1058 (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
1059 (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
1061 return_ACPI_STATUS (AE_OK);
1064 /* Pop the scope stack if necessary */
1066 if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode)))
1069 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
1070 "%s: Popping scope for Op %p\n",
1071 AcpiUtGetTypeName (OpInfo->ObjectType), Op));
1073 (void) AcpiDsScopeStackPop (WalkState);
1076 return_ACPI_STATUS (AE_OK);