Why the high part of the logical address produced by AllocateCommonBuffer always equals 0x0 in my 64

Hello all,

I’m writing a driver for our special PCIe device which needs to
communicate with host trough DMA. The driver works OK in both 32-bit
WinXP and 64-bit Win7, but there is one point that I feel
uncomfortable. As the title implies, I thought that the high part of
logical address shouldn’t be zero.

See this code:

memVa = (PUCHAR)
pDevExt->DmaAdapter->DmaOperations->AllocateCommonBuffer(
pDevExt->DmaAdapter, GIO_MEM_BUF_SIZE, &memPa, FALSE );

turns out that memPa.HighPart == 0x0 on both 32-bit and 64-bit Win.

Why? Thanks.

>

Hello all,

I’m writing a driver for our special PCIe device which needs to
communicate with host trough DMA. The driver works OK in both 32-bit
WinXP and 64-bit Win7, but there is one point that I feel
uncomfortable. As the title implies, I thought that the high part of
logical address shouldn’t be zero.

See this code:

memVa = (PUCHAR)
pDevExt->DmaAdapter->DmaOperations->AllocateCommonBuffer(
pDevExt->DmaAdapter, GIO_MEM_BUF_SIZE, &memPa, FALSE );

turns out that memPa.HighPart == 0x0 on both 32-bit and 64-bit Win.

Why? Thanks.

Are you DMAing to memory over the 4GB mark? If you don’t have more than
about 3.5GB of memory then you probably won’t see any physical addresses
over 32 bits. IOMMU’s aside, PCI seems pretty much the same address
space as the CPU.

Also, if you didn’t tell your driver that you could do 64 bit DMA then I
think it would allocate a bounce buffer for you under the 4GB mark.

James

Thank you. You corrected my thoughts on memory addressing.

2010/12/2 James Harper :
>>
>> Hello all,
>>
>> I’m writing a driver for our special PCIe device which needs to
>> communicate with host trough DMA. The driver works OK in both 32-bit
>> WinXP and 64-bit Win7, but there is one point that I feel
>> uncomfortable. As the title implies, I thought that the high part of
>> logical address shouldn’t be zero.
>>
>> See this code:
>>
>> ?memVa = (PUCHAR)
>> pDevExt->DmaAdapter->DmaOperations->AllocateCommonBuffer(
>> pDevExt->DmaAdapter, GIO_MEM_BUF_SIZE, &memPa, FALSE );
>>
>> turns out that memPa.HighPart == 0x0 on both 32-bit and 64-bit Win.
>>
>> Why? Thanks.
>>
>
> Are you DMAing to memory over the 4GB mark? If you don’t have more than
> about 3.5GB of memory then you probably won’t see any physical addresses
> over 32 bits. IOMMU’s aside, PCI seems pretty much the same address
> space as the CPU.
>
> Also, if you didn’t tell your driver that you could do 64 bit DMA then I
> think it would allocate a bounce buffer for you under the 4GB mark.
>
> James
>
>
> —
> 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
>