StorPort driver: No "START STOP UNIT" SCSI command received

Hi,

I’m writing a StorPort driver for our hardware, and I successfully receive and handle READ, WRITE, INQUIRY and other SCSI commands. However I never receive a START STOP UNIT command that I’m planning to use to actually start and stop the underlying hardware.

Is it normal, i.e. Windows never sends that command? Or am I missing something? Thank you

> Is it normal, i.e. Windows never sends that command?

CD eject is this command.

Power management on hard disks - too.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

If your device is currently handling READ/WRITE successfully, there is no reason for the OS to send start/stop unit (except in the cases already mentioned). If your device was to respond to a SCSI execute command with SCSI response 02020402h (check condition, not ready, initializing command required) that would indicate to the OS that a START UNIT was needed.

I have not verified that Windows will send the START UNIT when it receives this error condition, but I’ve used it in drivers when dealing with external arrays.

~kenny

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Tuesday, July 23, 2013 4:11 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] StorPort driver: No “START STOP UNIT” SCSI command received

Is it normal, i.e. Windows never sends that command?

CD eject is this command.

Power management on hard disks - too.


Maxim S. Shatskih
Microsoft MVP on File System And Storage xxxxx@storagecraft.com http://www.storagecraft.com


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

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

Maxim,

Thank you for your reply. This is a hard drive. However I can see START STOP UNIT command for none of the power state changes. I tried sleep, shutdown etc with no results. Any ideas why the Storport doesn’t receive it? Thank you

Kenny,

I’m expecting the driver to receive the START STOP UNIT command when the power state changes. But I don’t see it. I’m not taking into account error conditions at this moment. Thank you

A little bit more information - from what I can see the power events get transformed into HwAdapterControl function call rather than HwStartIo.

Can I assume that I need to handle the device start/stop within HwAdapterControl rather than expecting to receive START STOP SCSI command in HwStartIo? Thank you

You can try running the SCSI compliance tests from the HCK, this may help you isolate the issue.

http://msdn.microsoft.com/en-us/library/windows/hardware/hh998707.aspx

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, July 23, 2013 4:41 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] StorPort driver: No “START STOP UNIT” SCSI command received

A little bit more information - from what I can see the power events get transformed into HwAdapterControl function call rather than HwStartIo.

Can I assume that I need to handle the device start/stop within HwAdapterControl rather than expecting to receive START STOP SCSI command in HwStartIo? Thank you


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

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

Kenny,

SCSI compliance test was passed just fine. The problem here is not the behavior of my driver, but the behavior of Windows. I.e. I’m trying to figure out does it ever send the START STOP command. If I can make Windows to send the START STOP command it would be ideal solution as it fits best into the driver structure. If not I’ll apparently need to use HwAdapterControl

Thank you

The source code for the disk class driver is published in the WDK (or it was in the past), so you can see exactly what scsi commands get generated.

Jan

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, July 23, 2013 4:41 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] StorPort driver: No “START STOP UNIT” SCSI command received

A little bit more information - from what I can see the power events get transformed into HwAdapterControl function call rather than HwStartIo.

Can I assume that I need to handle the device start/stop within HwAdapterControl rather than expecting to receive START STOP SCSI command in HwStartIo? Thank you


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

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

I see, my assumption (incorrectly) was the driver was being debugged.

Here is more info on IPM: (hint: google “msdn scsi stop unit”)

http://msdn.microsoft.com/en-us/library/windows/hardware/ff567559(v=vs.85).aspx

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, July 23, 2013 4:49 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] StorPort driver: No “START STOP UNIT” SCSI command received

Kenny,

SCSI compliance test was passed just fine. The problem here is not the behavior of my driver, but the behavior of Windows. I.e. I’m trying to figure out does it ever send the START STOP command. If I can make Windows to send the START STOP command it would be ideal solution as it fits best into the driver structure. If not I’ll apparently need to use HwAdapterControl

Thank you


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

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

Kenny,

Thank you for the link. This however applies only to the drive transition to idle state. But I’m mainly interested in receiving that command when the OS shuts down or goes to sleep. The question is - is Windows supposed to send “START STOP UNIT” SCSI command when it shuts down? I don’t receive it and I’m wondering if there are any flags or settings that I’m missing. Thank you

>Windows supposed to send “START STOP UNIT” SCSI command when it shuts down?

No.

Nevertheless, spindown of the disks - “Turn off hard disks after” - is exactly this command.

Probably your disks have some property on it so they are not spun down.

AdapterControl is about adapter itself, not the LUNs hanging off it.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

Thank you Maxim.

If Windows is not supposed to send START STOP when it shuts down, and AdapterControl is for adapter, how do I shut down the LUNs properly? I don’t receive any suitable command.

I’m not sure that START STOP UNIT is really needed on shutdown.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Thank you Maxim.
>
> If Windows is not supposed to send START STOP when it shuts down, and AdapterControl is for adapter, how do I shut down the LUNs properly? I don’t receive any suitable command.
>

Let me give some more details, maybe that way my question would make more sense:

My hardware is a sort of RAID adapter that has a couple of SATA drives connected to it. The Storport driver is receiving SCSI requests from OS, translating them to ATA commands and sending to the SATA drives via the adapter.

Now in order to properly shut down each of the SATA drives I need to send them “STANDBY IMMEDIATE” ATA command when the OS shuts down or sleeps. The problem is that I don’t seem to receive any SCSI request that could be mapped to “STANDBY IMMEDIATE” ATA command. I thought it would be “START STOP”, but I don’t receive that command.

Any ideas on when to send the “STANDBY IMMEDIATE” to the LUNs? Thank you

> Now in order to properly shut down each of the SATA drives I need to send them "STANDBY

IMMEDIATE" ATA command when the OS shuts down or sleeps

For sleep, if the disks are spun down, then START STOP UNIT will be sent.

For shutdown, the SYNCHRONIZE CACHE will be sent, if you have the CachesData flag set.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

I do receive SYNCHRONIZE CACHE, but can I send “STANDBY IMMEDIATE” to the LUNs every time I receive SYNCHRONIZE CACHE command? I don’t think those are related, but I might be missing something…

Are you really sure “STANDBY IMMEDIATE” is a must on powering down the disk?

wrote in message news:xxxxx@ntdev…
>I do receive SYNCHRONIZE CACHE, but can I send “STANDBY IMMEDIATE” to the LUNs every time I receive SYNCHRONIZE CACHE command? I don’t think those are related, but I might be missing something…
>

Absolutely. If you use a SATA analyzer you’ll see that it’s the last command that Windows sends to a SATA drive every time you power down or sleep (otherwise the “Unexpected Power Loss” SMART counter will increase). Strange that Windows doesn’t send anything similar to the Storport driver.

So I guess my only option at this moment is to send that command whenever HwAdapterControl is called. Any better ideas?

Hi Arshak,

STOP UNIT command is sent as part of D3 irp handling in classpnp. The command is sent after SYNC CACHE. Your miniport driver should be able to receive it by default during Sleep/Hibernate/Shutdown process.

Which Windows version you are working on please?

Regards,
Michael Xing