/* Caution: The caller need validate the input firmware volume to follow PI specification. DxeCore will trust the input data and process firmware volume directly. */
EFI_STATUS EFIAPI CoreProcessFirmwareVolume(IN VOID *FvHeader, IN UINTN Size, OUT EFI_HANDLE *FVProtocolHandle)
/* Caution: The caller need validate the input firmware volume to follow PI specification. DxeCore will trust the input data and process firmware volume directly. */
EFI_STATUS EFIAPI CoreProcessFirmwareVolume(IN VOID *FvHeader, IN UINTN Size, OUT EFI_HANDLE *FVProtocolHandle)
{
  VOID        *Ptr;
  EFI_STATUS  Status;
  *FVProtocolHandle = NULL;
  Status            = ProduceFVBProtocolOnBuffer (
                        (EFI_PHYSICAL_ADDRESS)(UINTN)FvHeader,
                        (UINT64)Size,
                        NULL,
                        0,
                        FVProtocolHandle
                        );
  if (!EFI_ERROR (Status)) {
    ASSERT (*FVProtocolHandle != NULL);
    Ptr    = NULL;
    Status = CoreHandleProtocol (*FVProtocolHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Ptr);
    if (EFI_ERROR (Status) || (Ptr == NULL)) {
      return EFI_VOLUME_CORRUPTED;
    }
    return EFI_SUCCESS;
  }
  return Status;
}