/* This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly. */
EFI_STATUS EFIAPI NvmeBlockIoPeimGetMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
/* This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly. */
EFI_STATUS EFIAPI NvmeBlockIoPeimGetMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
{
  EFI_STATUS                        Status;
  PEI_NVME_CONTROLLER_PRIVATE_DATA  *Private;
  EFI_PEI_BLOCK_IO_MEDIA            Media;
  if ((This == NULL) || (MediaInfo == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  Private = GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2 (This);
  Status = NvmeBlockIoPeimGetMediaInfo (
             PeiServices,
             &Private->BlkIoPpi,
             DeviceIndex,
             &Media
             );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  CopyMem (
    MediaInfo,
    &(Private->NamespaceInfo[DeviceIndex - 1].Media),
    sizeof (EFI_PEI_BLOCK_IO2_MEDIA)
    );
  return EFI_SUCCESS;
}