StorPortPutScatterGatherList

Hi,
In continuation with my previous thread http://www.osronline.com/showthread.cfm?link=192910, I have a query on the
StorPortPutScatterGatherList API.

From my understanding of DMA operations, for an adapter supporting ScatterGather, a bounce buffer is setup by the OS if the
following conditions are met:

a. The adapter supports only 32-bit DMA
b. One or more of the physical pages setup for DMA reside at physical addresses beyond 4GB.

In such a case, the OS would
a. copy the contents from the virtual memory of the driver to the bounce buffer for write operations prior to invoking the
“ExecutionRoutine” supplied as part of StorPortBuildScatterGatherList().
b. copy the contents to the virtual memory of the driver from the bounce buffer for read operations after the driver invokes
StorPortPutScatterGatherList().

My questions:

  1. Is my understanding correct and complete?
  2. Does the condition that StorPortPutScatterGatherList() be called before accessing the buffer (for read operations) only apply
    to adapters that do not support 64-bit DMA?
  3. If it applies to all adapters irrespective of their DMA capabilities, what could be the scenarios under which a bounce buffer
    could be setup for adapters that support 64-bit DMA?

I would like to be able to access the contents of the DMA buffer (after a DMA operation is complete) without having to un-map
and re-map the SG list (for a future DMA operation), and hence these questions.

Regards,
Girish.

Every call to GetScatterGatherList should be paired with eventual PutScatterGatherList. No exceptions.

If you were using your own DMA_ADAPTER and called its GetScatterGatherList, to access the bounce buffer you could use BuildMdlFromScatterGatherList.

You’re understanding is PARTIALLY correct.

See: http://www.osronline.com/article.cfm?article=539

When the adapter does not support scatter/gather.

Peter
OSR

Thanks grigora and Peter.

< If you were using your own DMA_ADAPTER and called its GetScatterGatherList, to access the bounce buffer you could use
BuildMdlFromScatterGatherList.

Unfortunately, in a storport miniport I do not (seem to) have access to the DMA_ADAPTER directly.

Regards,
Girish.