From: eagersh on
On Jul 26, 9:34 pm, hitesh <hitesh.ughr...(a)gmail.com> wrote:
> On Jul 26, 11:13 pm, "Maxim S. Shatskih"
>
>
>
> <ma...(a)storagecraft.com.no.spam> wrote:
> > > i am writing a storport miniport driver and i have to allocate memory..
> > > which is the best option for allocating memory?
>
> > What memory? to what is it associated? to device? to LUN? to a request in progress?
>
> > Enlarge the device/LUN/SRB extension on this size.
>
> > > my requirement is i have to use that memory which can be accessed by
> > > both host and device, want to use DMA also.
>
> > Device and SRB extensions are DMAable using the same ScsiPortGetPhysicalAddress (at least in ScsiPort).
>
> > --
> > Maxim S. Shatskih
> > Windows DDK MVP
> > ma...(a)storagecraft.comhttp://www.storagecraft.com
>
> thanks maxim,
> but if i am not wrong as per my understanding i have to know the
> extension size before i start the driver.
> is it possible to allocate memory which i dont know during the
> initialization but dynamically e.g. in build io and start io i found
> that i am running out of memory for my command/data transfer and i
> need to allocate some more memory? will this function
> "ScsiPortGetPhysicalAddress" works during that time also?
> if i can't use the same function then what is the alternate? if i use
> other functions then will there be any problem? how it is different ?
> thanks,
> Hitesh

>also i want
>to allocate memory in some large amount which could be upto 2 MB.
>is it fine to allocate so much memory permanently?

You could use ScsiPortGetPhysicalAddress for both type of memory
either allocated by StorPortGetUncachedExtension or
StorPortAllocateContiguousMemorySpecifyCacheNode.
If you could predict how much memory you could use for DMA it is
better to use StorPortGetUncachedExtension. 2MB memory allocation
should be OK for a system.
It would not hurt a system.

Igor Sharovar