/* The HwInfoParser shall use the information provided by the HwDataSource to initialise the internal state of the parser or to index the data. This internal state shall be linked to the ParserHandle using an implementation defined mechanism. */
EFI_STATUS EFIAPI HwInfoParserInit(IN VOID *HwDataSource, IN VOID *Context, IN HW_INFO_ADD_OBJECT HwInfoAdd, OUT HW_INFO_PARSER_HANDLE *ParserHandle)
/* The HwInfoParser shall use the information provided by the HwDataSource to initialise the internal state of the parser or to index the data. This internal state shall be linked to the ParserHandle using an implementation defined mechanism. */
EFI_STATUS EFIAPI HwInfoParserInit(IN VOID *HwDataSource, IN VOID *Context, IN HW_INFO_ADD_OBJECT HwInfoAdd, OUT HW_INFO_PARSER_HANDLE *ParserHandle)
{
  FDT_HW_INFO_PARSER  *FdtParserHandle;
  if ((ParserHandle == NULL)  ||
      (HwInfoAdd == NULL)     ||
      (HwDataSource == NULL)  ||
      (fdt_check_header (HwDataSource) < 0))
  {
    ASSERT (0);
    return EFI_INVALID_PARAMETER;
  }
  FdtParserHandle = AllocateZeroPool (sizeof (FDT_HW_INFO_PARSER));
  if (FdtParserHandle == NULL) {
    *ParserHandle = NULL;
    return EFI_OUT_OF_RESOURCES;
  }
  FdtParserHandle->Fdt       = HwDataSource;
  FdtParserHandle->Context   = Context;
  FdtParserHandle->HwInfoAdd = HwInfoAdd;
  *ParserHandle = (HW_INFO_PARSER_HANDLE)FdtParserHandle;
  return EFI_SUCCESS;
}