Databuffer NULL in virtual storport driver

I must be doing something stupid here… Shortly after boot, my virtual
storport driver gets issued with SRB’s that have a NULL DataBuffer.
Given that I’m virtual, I need the DataBuffer to point to real memory.

In DriverEntry I set:

HwInitializationData.MapBuffers = TRUE;
HwInitializationData.TaggedQueuing = TRUE;
HwInitializationData.AutoRequestSense = TRUE;
HwInitializationData.MultipleRequestPerLu = TRUE;
HwInitializationData.ReceiveEvent = TRUE;
HwInitializationData.PortVersionFlags = 0;

And in VirtualHwStorFindAdapter I set:

ConfigInfo->VirtualDevice = TRUE;
ConfigInfo->ScatterGather = TRUE;
ConfigInfo->Master = TRUE;
ConfigInfo->CachesData = FALSE;
ConfigInfo->MapBuffers = STOR_MAP_ALL_BUFFERS;
ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex;
ConfigInfo->BufferAccessScsiPortControlled = FALSE;

And the Dma members depending on the value of Dma64BitAddresses (as per
docs, although it’s not supposed to matter for a virtual storport…)

Any suggestions? Hopefully I’m just missing something obvious. I suspect
that Windows isn’t mapping the buffers of the read and write requests
which is the non-virtual behaviour.

Thanks

James

Hi James,

You’ll have to use the StorPortGetSystemAddress API to get the virtual address in system space for the data buffer represented by the SCSI Request Block (SRB).

Also, you might want to go thro’ the NT Insider’s articles which nicely describe the intricacies of Virtual Storport Miniport drivers.

Regards,
AY

Storport docs describe STOR_MAP_ALL_BUFFERS as not implemented.

NULL buffer is possible if the operation is a paging one, or operating on the file cache (which is implemented through the paging path, too). Use StorPortGetSystemAddress, as told.

>

Hi James,

You’ll have to use the StorPortGetSystemAddress API to get the virtual
address
in system space for the data buffer represented by the SCSI Request
Block
(SRB).

Thanks for the tip. I’ll try that now.

Also, you might want to go thro’ the NT Insider’s articles which
nicely
describe the intricacies of Virtual Storport Miniport drivers.

I did. No mention of StorPortGetPhysicalAddress that I could see. And in
fact it seems to get the MDL and use that rather than make any call to
StorPortGetSystemAddress…

James

>

Storport docs describe STOR_MAP_ALL_BUFFERS as not implemented.

The OSR article sets that value so I assumed it was valid for virtual
storport drivers.

Thanks

James

A father of virtual storport/miniport model, as far as I remember, was very bent on limiting what a virtual miniport can do. He assumed that a virtual miniport will never ever need an SGL or physical address, and will never need uncached extension.

In fact, it won’t prevent you from allocating an uncached extension, but will explicitly bypass freeing it when your miniport unloads. Neat, isn’t it?