/* Get the index at which the name of the node is stored. */
EFI_STATUS AmlNodeGetNameIndex(IN CONST AML_OBJECT_NODE *ObjectNode, OUT EAML_PARSE_INDEX *Index)
/* Get the index at which the name of the node is stored. */
EFI_STATUS AmlNodeGetNameIndex(IN CONST AML_OBJECT_NODE *ObjectNode, OUT EAML_PARSE_INDEX *Index)
{
  EAML_PARSE_INDEX  NameIndex;
  if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE)   ||
      (ObjectNode->AmlByteEncoding == NULL)                 ||
      (Index == NULL))
  {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  NameIndex = ObjectNode->AmlByteEncoding->NameIndex;
  if ((NameIndex > ObjectNode->AmlByteEncoding->MaxIndex)   ||
      (ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName))
  {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  *Index = NameIndex;
  return EFI_SUCCESS;
}