/* 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 AtapiGetBlockDeviceMediaInfo2(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 AtapiGetBlockDeviceMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
{
  ATAPI_BLK_IO_DEV        *AtapiBlkIoDev;
  EFI_STATUS              Status;
  EFI_PEI_BLOCK_IO_MEDIA  Media;
  AtapiBlkIoDev = NULL;
  if ((This == NULL) || (MediaInfo == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  AtapiBlkIoDev = PEI_RECOVERY_ATAPI_FROM_BLKIO2_THIS (This);
  Status = AtapiGetBlockDeviceMediaInfo (
             PeiServices,
             &AtapiBlkIoDev->AtapiBlkIo,
             DeviceIndex,
             &Media
             );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  CopyMem (MediaInfo, &AtapiBlkIoDev->DeviceInfo[DeviceIndex - 1].MediaInfo2, sizeof (EFI_PEI_BLOCK_IO2_MEDIA));
  return EFI_SUCCESS;
}