PC Review


Reply
Thread Tools Rate Thread

Allocating Physical Memory Block for PCI Base Address Regisrer Mapping

 
 
Boby George
Guest
Posts: n/a
 
      25th Nov 2008
Hi Everyone,

In my current project, I have a requirement to map a piece of physical
memory into one of the PCI base address register. This BAR maps the
inbound PCI cycles to the local memory of this board. This PCI device
do not support DMA. I have added the following code in the AddDevice
function for this PCI WDM Driver.

LowestAcceptableAddress.QuadPart = 0x0000000000000000;
HighestAcceptableAddress.QuadPart = 0x00000000FFFFFFFF;
BoundaryAddressMultiple.QuadPart = 0x0000000000000000;

fdoData->pNPVirtualMemory =
(PULONG)MmAllocateContiguousMemorySpecifyCache(
0x10000,
LowestAcceptableAddress,
HighestAcceptableAddress,
BoundaryAddressMultiple,
MmNonCached
);

fdoData->pNPPhysicalMemory = MmGetPhysicalAddress(
fdoData->pNPVirtualMemory);
PI7C9X110DebugPrint(INFO,
"NP MEMORY VA:0x%x PA:0x%x\n",
fdoData->pNPVirtualMemory,fdoData->pNPPhysicalMemory);

Note:
fdoData->pNPVirtualMemory is declared as PULONG
fdoData->pNPPhysicalMemory is declared as PHYSICAL_ADDRESS


I plug in the value in fdoData->pNPPhysicalMemory variable to the PCI
Device BAR. But somehow inbound mapping still don't seem to work.

One of the question is, is MmGetPhysicalAddress really returning a
physical address of the memory that can be used with PCI devices. I see
that in places in MSDN, not to use the physical address returned by
MmGetPhysicalAddress for DMA. Even though I am not using DMA, does this
statement still apply to my design?

Below is what I get from windbg for the pool, which says 0x10000 is my
physical address for the non-paged pool.

Windbg Output:
PI7C9X110: NP MEMORY VA:0xf6a21000 PA:0x10000

Thanks in Advance,

Boby
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Vista 64 Installed Physical Memory vs Total Physical Memory measekite Windows Vista General Discussion 0 27th Mar 2009 02:31 AM
32bit physical address memory extension ntnewbie Windows XP General 6 29th Dec 2008 03:03 PM
Calculating Physical Address of users Virtual Memory John Windows XP Drivers 0 30th Nov 2007 07:47 PM
Allocating a continuous block of memory for a structure? Kourosh Microsoft C# .NET 2 27th Oct 2007 09:22 AM
SharedMemory Base address mapping =?Utf-8?B?TmFkYXY=?= Microsoft VC .NET 3 4th May 2004 06:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 AM.