/* Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry, and initilize any state variables. Read the Depex from the FV and store it in DriverEntry. Pre-process the Depex to set the SOR, Before and After state. The Discovered list is never free'ed and contains booleans that represent the other possible DXE driver states. */
EFI_STATUS CoreAddToDriverList(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, IN EFI_GUID *DriverName, IN EFI_FV_FILETYPE Type)
/* Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry, and initilize any state variables. Read the Depex from the FV and store it in DriverEntry. Pre-process the Depex to set the SOR, Before and After state. The Discovered list is never free'ed and contains booleans that represent the other possible DXE driver states. */
EFI_STATUS CoreAddToDriverList(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, IN EFI_GUID *DriverName, IN EFI_FV_FILETYPE Type)
{
  EFI_CORE_DRIVER_ENTRY  *DriverEntry;
  DriverEntry = AllocateZeroPool (sizeof (EFI_CORE_DRIVER_ENTRY));
  ASSERT (DriverEntry != NULL);
  if (Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
    DriverEntry->IsFvImage = TRUE;
  }
  DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE;
  CopyGuid (&DriverEntry->FileName, DriverName);
  DriverEntry->FvHandle         = FvHandle;
  DriverEntry->Fv               = Fv;
  DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);
  CoreGetDepexSectionAndPreProccess (DriverEntry);
  CoreAcquireDispatcherLock ();
  InsertTailList (&mDiscoveredList, &DriverEntry->Link);
  CoreReleaseDispatcherLock ();
  return EFI_SUCCESS;
}