AHCI: use a minimum of 1 block for trim ranges.

* Word 105 of ATA IDENTIFY should contain the maximum number of block
  ranges the device supports, but it always supports at least a single
  one.
* This change lets the trim command do something on Virtual Box.
This commit is contained in:
Axel Dörfler
2014-06-11 00:56:09 +02:00
parent c57c62505e
commit bc4db40c40
@@ -623,6 +623,9 @@ AHCIPort::ScsiInquiry(scsi_ccb* request)
fUse48BitCommands, ataData.lba_sector_count,
ataData.lba48_sector_count, fSectorCount * fSectorSize);
if (fTrimSupported) {
if (fMaxTrimRangeBlocks == 0)
fMaxTrimRangeBlocks = 1;
bool deterministic = ataData.supports_deterministic_read_after_trim;
TRACE("trim supported, %" B_PRIu32 " ranges blocks, reads are "
"%sdeterministic%s.\n", fMaxTrimRangeBlocks,