/* Report status code with EFI_RETURN_STATUS_EXTENDED_DATA about LoadImage() or StartImage() failure. */
VOID BmReportLoadFailure(IN UINT32 ErrorCode, IN EFI_STATUS FailureStatus)
/* Report status code with EFI_RETURN_STATUS_EXTENDED_DATA about LoadImage() or StartImage() failure. */
VOID BmReportLoadFailure(IN UINT32 ErrorCode, IN EFI_STATUS FailureStatus)
{
  EFI_RETURN_STATUS_EXTENDED_DATA  ExtendedData;
  if (!ReportErrorCodeEnabled ()) {
    return;
  }
  ASSERT (
    (ErrorCode == EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) ||
    (ErrorCode == EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED)
    );
  ZeroMem (&ExtendedData, sizeof (ExtendedData));
  ExtendedData.ReturnStatus = FailureStatus;
  REPORT_STATUS_CODE_EX (
    (EFI_ERROR_CODE | EFI_ERROR_MINOR),
    (EFI_SOFTWARE_DXE_BS_DRIVER | ErrorCode),
    0,
    NULL,
    NULL,
    &ExtendedData.DataHeader + 1,
    sizeof (ExtendedData) - sizeof (ExtendedData.DataHeader)
    );
}