physical address allocation

Hello,

I can use the various kernel APIs to map physiical address to virtual, or to
get the actual physical address of a virtual address, but is there a way for
a device driver programmer to guarentee that the Physical address allocated
would always fall below 4 GB for all windows OSs of all but depths? Also,
even if the machine has more than 4GB of physical RAM installed, then too
this allocation mechanism should work.

Thanks

B

Check MmAllocateContiguousMemory() and friends documentation- this is what you need here…

Anton Bassov

What is the need in this? for DMA? use ->AllocateCommonBuffer

For DMA adapter object implementation? use MmAllocateContiguousMemory

For other needs? and why the other needs? Windows only suggests you use these addresses for DMA


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
“Bedanto” wrote in message news:xxxxx@ntdev…
Hello,

I can use the various kernel APIs to map physiical address to virtual, or to get the actual physical address of a virtual address, but is there a way for a device driver programmer to guarentee that the Physical address allocated would always fall below 4 GB for all windows OSs of all but depths? Also, even if the machine has more than 4GB of physical RAM installed, then too this allocation mechanism should work.

Thanks

B

Maxim,

it 'is ’ for DMA. But I am facing with a weird problem. I find that our
device which has a 32 bit DMA controller, cannot access over 4GB. So on a 64
bit windows machine when we have > 4GB installed (PAE disabled), and when
ever the allocation of physical address is over 4GB the device fails.
However, this is hypothesis, to prove it, I need a way to allocate
everything below 4GB to verfiy.

B

On Sun, Jan 4, 2009 at 6:44 PM, Maxim S. Shatskih wrote:

> What is the need in this? for DMA? use ->AllocateCommonBuffer
>
> For DMA adapter object implementation? use MmAllocateContiguousMemory
>
> For other needs? and why the other needs? Windows only suggests you use
> these addresses for DMA
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> “Bedanto” wrote in message news:xxxxx@ntdev…
> Hello,
>
> I can use the various kernel APIs to map physiical address to virtual, or
> to get the actual physical address of a virtual address, but is there a way
> for a device driver programmer to guarentee that the Physical address
> allocated would always fall below 4 GB for all windows OSs of all but
> depths? Also, even if the machine has more than 4GB of physical RAM
> installed, then too this allocation mechanism should work.
>
> Thanks
>
> B
>
>
> —
> NTDEV is sponsored by OSR
>
> 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
>

You have not mentioned which type of device you are writing a driver to support. Some stacks have unique interfaces to indicate that a particular device cannot support 64-bit DMA. Reading a good book such as the one from Viscarola and Mason (written for NT4) will have some answers to how to handle this type of problem.

“Bedanto” wrote in message news:xxxxx@ntdev…
Maxim,

it 'is ’ for DMA. But I am facing with a weird problem. I find that our device which has a 32 bit DMA controller, cannot access over 4GB. So on a 64 bit windows machine when we have > 4GB installed (PAE disabled), and when ever the allocation of physical address is over 4GB the device fails. However, this is hypothesis, to prove it, I need a way to allocate everything below 4GB to verfiy.

B

On Sun, Jan 4, 2009 at 6:44 PM, Maxim S. Shatskih wrote:

What is the need in this? for DMA? use ->AllocateCommonBuffer

For DMA adapter object implementation? use MmAllocateContiguousMemory

For other needs? and why the other needs? Windows only suggests you use these addresses for DMA


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
“Bedanto” wrote in message news:xxxxx@ntdev…
Hello,

I can use the various kernel APIs to map physiical address to virtual, or to get the actual physical address of a virtual address, but is there a way for a device driver programmer to guarentee that the Physical address allocated would always fall below 4 GB for all windows OSs of all but depths? Also, even if the machine has more than 4GB of physical RAM installed, then too this allocation mechanism should work.

Thanks

B



NTDEV is sponsored by OSR

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

Presumably if you indicated that your device could not use 64-bit addresses,
the DMA will be simulated by using buffers which are magically preallocated
< 4GB. So even if you can “allocate” all the < 4GB memory, that would not
include the space which is reserved to handle this case.
joe


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bedanto
Sent: Sunday, January 04, 2009 10:01 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] physical address allocation

Maxim,

it 'is ’ for DMA. But I am facing with a weird problem. I find that our
device which has a 32 bit DMA controller, cannot access over 4GB. So on a 64
bit windows machine when we have > 4GB installed (PAE disabled), and when
ever the allocation of physical address is over 4GB the device fails.
However, this is hypothesis, to prove it, I need a way to allocate
everything below 4GB to verfiy.

B

On Sun, Jan 4, 2009 at 6:44 PM, Maxim S. Shatskih
wrote:

What is the need in this? for DMA? use ->AllocateCommonBuffer

For DMA adapter object implementation? use MmAllocateContiguousMemory

For other needs? and why the other needs? Windows only suggests you use
these addresses for DMA


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com http:</http:>

“Bedanto” wrote in message news:xxxxx@ntdev…
Hello,

I can use the various kernel APIs to map physiical address to virtual, or to
get the actual physical address of a virtual address, but is there a way for
a device driver programmer to guarentee that the Physical address allocated
would always fall below 4 GB for all windows OSs of all but depths? Also,
even if the machine has more than 4GB of physical RAM installed, then too
this allocation mechanism should work.

Thanks

B



NTDEV is sponsored by OSR

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 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

This message has been scanned for viruses and
dangerous content by http:</http:> MailScanner, and is
believed to be clean.

Bedanto wrote:

it 'is ’ for DMA. But I am facing with a weird problem. I find that
our device which has a 32 bit DMA controller, cannot access over 4GB.

Very common.

So on a 64 bit windows machine when we have > 4GB installed (PAE
disabled), and when ever the allocation of physical address is over
4GB the device fails. However, this is hypothesis, to prove it, I need
a way to allocate everything below 4GB to verfiy.

If you use the kernel DMA adapter routines for doing DMA, then you can
tell the system that your device can only handle 32-bit physical
addresses, and the system will take care of allocating bounce buffers in
the lower 4GB when you do a DMA operation. That’s the proper solution.
If you are rolling your own DMA code, now you know why this was a bad
thing to do.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Specify Dma64BitAddresses as FALSE to IoGetDmaAdapter


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
“Bedanto” wrote in message news:xxxxx@ntdev…
Maxim,

it 'is ’ for DMA. But I am facing with a weird problem. I find that our device which has a 32 bit DMA controller, cannot access over 4GB. So on a 64 bit windows machine when we have > 4GB installed (PAE disabled), and when ever the allocation of physical address is over 4GB the device fails. However, this is hypothesis, to prove it, I need a way to allocate everything below 4GB to verfiy.

B

On Sun, Jan 4, 2009 at 6:44 PM, Maxim S. Shatskih wrote:

What is the need in this? for DMA? use ->AllocateCommonBuffer

For DMA adapter object implementation? use MmAllocateContiguousMemory

For other needs? and why the other needs? Windows only suggests you use these addresses for DMA


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
“Bedanto” wrote in message news:xxxxx@ntdev…
Hello,

I can use the various kernel APIs to map physiical address to virtual, or to get the actual physical address of a virtual address, but is there a way for a device driver programmer to guarentee that the Physical address allocated would always fall below 4 GB for all windows OSs of all but depths? Also, even if the machine has more than 4GB of physical RAM installed, then too this allocation mechanism should work.

Thanks

B



NTDEV is sponsored by OSR

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