[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 32MB BAR Limitation with NT?



At 09:20 1/23/97 -0600, you wrote:
>Hello,
>
>Last week Ken Crocker identified an apparent limitation 
>of a maximum of 32MB of BAR memory space allocation under
>Windows NT.  We independently verified that when over a 
>32MB region was requested in the BAR, that NT (3.51 and 4.0) displayed:
>
>"Insufficient system resources exist to complete the 
>requested service."
>I would like to allocate a 256MB region for my application,
>but this prevents me from doing it. 
>
>Does anyone know what is causing this limitation, is it
>documented anywhere, and is there any way around it?  
>
>Could it be caused by the PCI BIOS, NT kernal services,
>or the PCI bridge?
>
>Any information on this topic would be appreciated.


We ran into this problem at Matrox and solved it. In fact it is
possible to allocate more than 32MB of BAR memory space with NT.
The problem is related to the allocation of page table entry (PTE) 
by the operating system. When NT operating system loads it reserves
physical memory space to create PTEs. This is related to the 
physical to logical address translation done by the memory management
of the CPU. This memory allocation algorithm by the NT operating 
system for creating PTE is based on the amount of physical memory 
at loading time.

Now the operating system needs PTEs to map the BAR memory space to
system memory space. It seem that PTE are fixed at boot time and
cannot change dynamically. Thus the operating system may ran out of
PTE when try to load a driver and allocate PTE to map BAR memory.
This will surely happen is your operating system has for example
32 MBytes of memory and a device declare 256 MBytes of BAR memory
space. It doesn't make sense for NT to reserve PTE for 256 MBytes
when operating system memory space is 32 MBytes.

Fortunately there is a registry KEY which can be used to force
NT to allocate a lot more PTEs than needed and bypass the algorithm
allocation at boot time. The KEY is located under:


\\HKEY_LOCAL_MACHINE\SYSTEM\CuurentControlSet\Control\SessionManager\MemoryM
anagement\SystemPages

The number under this key seems to define the number of PTE entries.
Since each entry is 4K then the relationship between physical memory
and PTE is:  Number * 4K.

For example I was able to map a BAR memory space of 64 MBytes in a
32 MBytes system memory machine. SystemPages was set to 0x8000 (HEX)
This is enough for a 128 MBytes PTE table. For a 256 Mbytes BAR memory 
space you would need at least 0x10000 + the operating system memory.
For a 32 MBytes machine try 0x14000.

After changing that key you must reboot the NT operating system

Guy Bonneau



______________________________________________________________________

 Guy Bonneau,                         
 Senior Software Engineer,             Email : Guy.Bonneau@matrox.com
 Video Products Group                  voice : (514) 685-7230 X-2718
 Matrox Electronic Systems Ltd         fax   : (514) 685-7030 
                                       WWW   : http://www.matrox.com

 Head Office :                          US Mail :
 1055 St-Regis, Dorval, Qc              Trimex Building, 2330 Route 11
 CANADA   H9P 2T4                       Mooers N.Y. 12958-0219


 God be gracious to us and bless us,
 And cause His face to shine upon us
 That Thy way may be known on the earth,
 Thy salvation among all nations.

 Psalms 67
_____________________________________________________________________
ô