0

after windows boot up, I use windbg to check PCI config space to take a look six bars.

3: kd> !pci 100 3 0 0

10: BAR0 d000000c ‭11010000000000000000000000001100‬

14: BAR1 00000000

18: BAR2 e000000c ‭11100000000000000000000000001100‬

1c: BAR3 00000000

20: BAR4 0000e001 ‭1110000000000001‬

24: BAR5 efd00000 ‭11101111110100000000000000000000‬

from this i can know there are two 64-bit memory location and one 32-bit memory location.

At the same time i open device manager --> device properties --> Resources and i get this:

Memory Range 00000000D0000000 - 00000000DFFFFFFF

Memory Range 00000000E0000000 - 00000000E01FFFFF

Memory Range 00000000EFD00000 - 00000000EFD7FFFF

Memory Range 00000000000A0000 - 00000000000BFFFF

from this list there are four memory addresses, while PCI config space indicates three, why? and also how does device manger know size of each memory ?

Tony
  • 89
  • 10

1 Answers1

0

I can't answer the portion about where memory range A0000 showed up but I can answer some of your questions.

how does device manger know size of each memory ?

This is actually fairly easy to answer. Sadly I cannot link to a direct source since I lack access to the spec but I can explain it. Before the Host OS (Windows) allocates addresses to place at the BARs register (configuration space), the device has data placed in the BAR register. The content found there is the length of data to allocate for that BAR. What is the Base Address Register (BAR) in PCIe? https://en.wikipedia.org/wiki/PCI_configuration_space

reads back the device's requested memory size

Now with that said I do notice some strange things with your BARs so please reference this (https://wiki.osdev.org/PCI) for what I'm saying. enter image description here Your first 2 BARs (BAR0, and BAR2) are indeed 64bit memory BARs but specifically they are prefetchable. BAR1 and BAR3 are the other half of the 64bit BAR which is unused, not terribly uncommon for 64bit BARs to waste that space. Next on BAR4 we see that bit1 is set implying this is I/O space and not memory space. Then the last one BAR5 I believe you are wrong, to me this looks like a 32bit not prefetchable Memory space BAR. In my experience systems set BARs to 00000000 when they are unused, not this random address.

Now looking at what windows is reporting we see 4 BARs (makes sense to me). With a size that it determined when it first read the BAR (so you have no way to verify at this point it's already changed and long gone). However, strangely your I/O address changed from 0000e000 to ....A0000. This could be to do with how I/O space works I honestly have no experience with I/O space BARs. But hopefully the other info helps.

arduic
  • 659
  • 3
  • 12
  • thx arduic, for IO address reported in windows device manager has NOT been pasted by me in the post. i just focus on the memory , so i did not mention IO in device manager, but in deed device manager has reported such IO BAR. and Memory Range 00000000000A0000 - 00000000000BFFFF is not IO space, i am sure about this. – Tony Jul 19 '19 at 03:44