/* Set the calculated Best transfer mode to a detected device. */
EFI_STATUS EFIAPI SetDeviceTransferMode(IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN UINT8 Channel, IN UINT8 Device, IN EFI_ATA_TRANSFER_MODE *TransferMode, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock)
/* Set the calculated Best transfer mode to a detected device. */
EFI_STATUS EFIAPI SetDeviceTransferMode(IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN UINT8 Channel, IN UINT8 Device, IN EFI_ATA_TRANSFER_MODE *TransferMode, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock)
{
  EFI_STATUS             Status;
  EFI_ATA_COMMAND_BLOCK  AtaCommandBlock;
  ZeroMem (&AtaCommandBlock, sizeof (EFI_ATA_COMMAND_BLOCK));
  AtaCommandBlock.AtaCommand     = ATA_CMD_SET_FEATURES;
  AtaCommandBlock.AtaDeviceHead  = (UINT8)(Device << 0x4);
  AtaCommandBlock.AtaFeatures    = 0x03;
  AtaCommandBlock.AtaSectorCount = *((UINT8 *)TransferMode);
  Status = AtaNonDataCommandIn (
             Instance->PciIo,
             &Instance->IdeRegisters[Channel],
             &AtaCommandBlock,
             AtaStatusBlock,
             ATA_ATAPI_TIMEOUT,
             NULL
             );
  return Status;
}