ATA TRIM (Developers)
Hi,
I'm studying the ATA TRIM command to try it under DOS. Currently I successfully implemented detection of TRIM capability in my SMB tool. My SSD supports TRIM, DRAT, RZAT. ATA TRIM is described in ACS-4 page 112. The ATA command code is 06h. Before ATA command code is executed some parameters have to be set, in my case named:
ide_current_cmr.data; // set data
ide_current_cmr.feat_err; // set features
ide_current_cmr.seccnt; // set sector count
ide_current_cmr.secnum; // set sector number
ide_current_cmr.cyllo; // set cylinder low
ide_current_cmr.cylhi; // set cylinder high
ide_current_cmr.drvsel_hd // bit3:0 = head, bit4 = drive, bit5 = sect. size (1~512B), bit6 LBA/CHS (0~CHS), bit7 = 1
ide_current_cmr.cmd_stat; // set IDE command
In ASC-4 specs there's no description for data field (maybe assume to be 0) and I'm trying to figure out the difference between TRIM bit set to 0 or 1 in features word (bit 0). If TRIM bit is 1 then LBA (CHS) fields are not used (reserved) if TRIM bit is 0 there should be something. Also DSM FUNCTION field bits 15:8 have different meaning according to TRIM bit.
Then if I understand well I have to prepare at least one sector with TRIM range list - 64 QWord entries where each contains LBA start and number of sectors to trim. So for the simplest case I need to create one 64b entry with LBA and count, e.g. number of sectors per cluster (I should find some LBA of unused disk area, fill it with a test pattern and then examine if it was trimmed). I'm not sure if something else need to be set and how to set DSM FUNCTION field and TRIM bit, any idea?
---
DOS gives me freedom to unlimited HW access.
Complete thread:
- ATA TRIM - RayeR, 08.08.2017, 20:19 (Developers)
![Open in board view [Board]](img/board_d.gif)
![Open in mix view [Mix]](img/mix_d.gif)
Mix view