ahci: fixed endless loop, and missing bit.
* The value for trim is bit 0, not 0; added sata_request::SetFeature() to change this. * The lba range fill loop never ended. * Thanks to Marcus for proof-reading!
This commit is contained in:
committed by
Axel Dörfler
parent
930cb4206b
commit
2e4e1eb2d9
@@ -837,12 +837,14 @@ AHCIPort::ScsiUnmap(scsi_ccb* request, scsi_unmap_parameter_list* unmapBlocks)
|
||||
lbaRanges[i++] = B_HOST_TO_LENDIAN_INT64(
|
||||
((uint64)blocks << 48) | lba);
|
||||
lba += blocks;
|
||||
bytesLeft -= blocks;
|
||||
}
|
||||
}
|
||||
|
||||
sata_request sreq;
|
||||
sreq.set_ata48_cmd(ATA_COMMAND_DATA_SET_MANAGEMENT, 0,
|
||||
(lbaRangesSize + 511) / 512);
|
||||
sreq.SetFeature(1);
|
||||
sreq.set_data(lbaRanges, lbaRangesSize);
|
||||
|
||||
ExecuteSataRequest(&sreq);
|
||||
|
||||
@@ -94,6 +94,14 @@ sata_request::set_ata48_cmd(uint8 command, uint64 lba, uint16 sectorCount)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sata_request::SetFeature(uint16 feature)
|
||||
{
|
||||
fFis[3] = (uint8)(feature & 0xff);
|
||||
fFis[11] = (uint8)(feature >> 8);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sata_request::set_atapi_cmd(size_t transferLength)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
void set_ata_cmd(uint8 command);
|
||||
void set_ata28_cmd(uint8 command, uint32 lba, uint8 sectorCount);
|
||||
void set_ata48_cmd(uint8 command, uint64 lba, uint16 sectorCount);
|
||||
void SetFeature(uint16 feature);
|
||||
|
||||
void set_atapi_cmd(size_t transferLength);
|
||||
bool is_atapi();
|
||||
|
||||
Reference in New Issue
Block a user