/* Return the child objects buffer from AML Handle's buffer. */
EFI_STATUS AmlGetChildFromObjectBuffer(IN EFI_AML_HANDLE *AmlParentHandle, IN UINT8 *CurrentBuffer, OUT VOID **Buffer)
/* Return the child objects buffer from AML Handle's buffer. */
EFI_STATUS AmlGetChildFromObjectBuffer(IN EFI_AML_HANDLE *AmlParentHandle, IN UINT8 *CurrentBuffer, OUT VOID **Buffer)
{
  AML_BYTE_ENCODING  *AmlByteEncoding;
  UINTN              DataSize;
  while ((UINTN)CurrentBuffer < (UINTN)(AmlParentHandle->Buffer + AmlParentHandle->Size)) {
    AmlByteEncoding = AmlSearchByOpByte (CurrentBuffer);
    if (AmlByteEncoding == NULL) {
      return EFI_INVALID_PARAMETER;
    }
    if ((AmlByteEncoding->Attribute & AML_IS_NAME_CHAR) == 0) {
      *Buffer = CurrentBuffer;
      return EFI_SUCCESS;
    }
    DataSize = AmlGetObjectSize (
                 AmlByteEncoding,
                 CurrentBuffer,
                 (UINTN)AmlParentHandle->Buffer + AmlParentHandle->Size - (UINTN)CurrentBuffer
                 );
    if (DataSize == 0) {
      return EFI_INVALID_PARAMETER;
    }
    CurrentBuffer += DataSize;
  }
  *Buffer = NULL;
  return EFI_SUCCESS;
}