Sending TRIM using IOCTL_ATA_PASS_THROUGH fails in XP

Hi,

I’m using IOCTL_ATA_PASS_THROUGH to send a ATA TRIM (06h) command to a SSD drive.

For Windows 7 and 8 it works fine, but for XP the DeviceIoControl call hangs for about 30 sec, then returns error 21 (Device not ready). Any ideas what might be the reason? Thank you

Yup. Not surprising. The storage port driver on XP is different. I don’t even recall whether it supports IOCTL_ATA_PASS_THROUGH. Have you tried IOCTL_IDE_PASSTHROUGH or one of the other variants?

Peter
OSR

Thank you Peter.

The thing is that all other commands (like IDENTIFY or SMART) sent by using IOCTL_ATA_PASS_THROUGH work fine. Only TRIM is the problem. Any ideas why? Thank you

I haven’t tried IOCTL_IDE_PASSTHROUGH though, will check it, thank you

I didn’t think TRIM was supported on Windows7. Also, are you sure your device supports TRIM?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, April 30, 2013 3:09 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Sending TRIM using IOCTL_ATA_PASS_THROUGH fails in XP

I haven’t tried IOCTL_IDE_PASSTHROUGH though, will check it, thank you


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Verified, it is certainly supported on Win7. You can also check if TRIM is supported via fsutil:

Fsutil behavior query DisableDeleteNotify

0 = trim enabled, 1 = trim disabled

You can then use fsutil to enable trim via: fsutil behavior set DisableDeleteNotify 0

~kenny

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Speer, Kenny
Sent: Tuesday, April 30, 2013 3:24 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Sending TRIM using IOCTL_ATA_PASS_THROUGH fails in XP

I didn’t think TRIM was supported on Windows7. Also, are you sure your device supports TRIM?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, April 30, 2013 3:09 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Sending TRIM using IOCTL_ATA_PASS_THROUGH fails in XP

I haven’t tried IOCTL_IDE_PASSTHROUGH though, will check it, thank you


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hmmmmmm… Is it getting through disk class? To where are you sending it?

Odd, verynodd, that particular function wouldn’t work… But other pass through requests would. You’re sure? Got a drive analyzer?

Peter
OSR

I was able to find a solution - one just needs to use IOCTL_ATA_PASS_THROUGH_DIRECT instead of IOCTL_ATA_PASS_THROUGH. Looks like by some reason XP doesn’t like the latter.

Peter, yes I’m sure all commands get through to the SSD.

Kenny, OS support for TRIM doesn’t matter, I’m sending the command directly to the device.

Bravo Mr. Isajanyan. Well done. Glad you got your problem sorted out.

Peter
OSR