/* Find the AML NameSeg in the children of AmlParentNodeList. */
EFI_AML_NODE_LIST* AmlFindNodeInThis(IN UINT8 *NameSeg, IN EFI_AML_NODE_LIST *AmlParentNodeList, IN BOOLEAN Create)
/* Find the AML NameSeg in the children of AmlParentNodeList. */
EFI_AML_NODE_LIST* AmlFindNodeInThis(IN UINT8 *NameSeg, IN EFI_AML_NODE_LIST *AmlParentNodeList, IN BOOLEAN Create)
{
  EFI_AML_NODE_LIST  *CurrentAmlNodeList;
  LIST_ENTRY         *CurrentLink;
  LIST_ENTRY         *StartLink;
  EFI_AML_NODE_LIST  *AmlNodeList;
  StartLink   = &AmlParentNodeList->Children;
  CurrentLink = StartLink->ForwardLink;
  while (CurrentLink != StartLink) {
    CurrentAmlNodeList = EFI_AML_NODE_LIST_FROM_LINK (CurrentLink);
    if (CompareMem (CurrentAmlNodeList->Name, NameSeg, AML_NAME_SEG_SIZE) == 0) {
      return CurrentAmlNodeList;
    }
    CurrentLink = CurrentLink->ForwardLink;
  }
  if (!Create) {
    return NULL;
  }
  AmlNodeList = AmlCreateNode (NameSeg, AmlParentNodeList, NULL);
  InsertTailList (&AmlParentNodeList->Children, &AmlNodeList->Link);
  return AmlNodeList;
}