Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Sept/Oct 2019 Issue of The NT Insider available


Download PDF here: http://insider.osr.com/2019/ntinsider_2019_01.pdf

It’s a particularly BIG issue, too: 40 pages of technical goodness, ranging from WDF to Minifilters. Check it out.
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

how does windows device manger resources correspond to PCI config space six BARs

tony_zhutony_zhu Member Posts: 20

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 ?

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,409

    I can’t answer your first question... but as to this:

    how does device manger know size of each memory

    It gets it from the resource data, which gets it from the PCI Bus Driver, which gets it from Config Space via a standard procedure.

    Does that help at all?

    Is there something more behind your question than just “What is Device Manager doing” that we can help with?

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • tony_zhutony_zhu Member Posts: 20
    edited July 10

    thx Peter_Viscarola,
    i have these question is because i read about https://wiki.osdev.org/PCI#Base_Address_Registers , and from this knowledge six BARs is the way that OS/BIOS/system frimware any of them tells PCI device what system address it can use.
    But from my finding, my pci device has two 64-bit memory location and one 32-bit memory location and plus one IO space.
    then my guess Device manger should have reported this same thing, which is not.
    so what i want to find out is why Device manager reports another "Memory Range 00000000000A0000 - 00000000000BFFFF" which PCI BAR doesn't have.
    By the way, this device is PCIe AMD video card.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,063
    edited July 10

    ... my pci device has two 64-bit memory location and one 32-bit memory location and plus one IO space.

    No, you do not have an I/O space BAR. You have a ROM BAR. That gets assigned to memory below the 1MB boundary.

    ... why Device Manager reports another "Memory Range 00000000000A0000 - 00000000000BFFFF" which PCI BAR doesn't have

    Yes, it does. That's BAR4. Video cards always have a ROM BAR so the BIOS can use it at boot.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • tony_zhutony_zhu Member Posts: 20

    hi Time_Roberts,
    thx for your input.

    ACCORDING to https://wiki.osdev.org/PCI#Base_Address_Registers

    I/O Space BAR Layout
    31 - 2 1 0
    4-Byte Aligned Base Address Reserved Always 1

    20: BAR4 0000e001 ‭1110000000000001 isn't this I/O space BAR?

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,409

    If the low bit is set, it is an I/O space resource, yes.

    I’d like to hear more from Mr. Roberts... perhaps he can explain this for us.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,063

    Yes, I should have remembered that the option ROM BAR is separate from the other BARs, at offset 0x30.

    Yes, BAR4 is an I/O space at 0xE000. Based on the ROM location (A0000-BFFFF), this adapter is trying to be VGA compatible, so Device Manager should also list I/O spaces at 3B0-3BB and 3C0-3DF that are magically assigned by the BIOS. Is it possible you have two graphics chips in your machine? Perhaps the other one is used at boot time and gets the I/O port assignments.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,409

    Yes, I should have remembered that the option ROM BAR is separate from the other BARs, at offset 0x30

    Shit... I didn’t even know there was such a thing. But what I know about video and graphics wouldn’t even fill a thimble.

    Thanks, Mr. Roberts, for helping solve the mystery. Though I’m still it sure why the I/O range isn’t shown in Device Manager, assuming the OP has things right and reported them accurately.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • tony_zhutony_zhu Member Posts: 20

    thx Perter and Robert.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Writing WDF Drivers 21 Oct 2019 OSR Seminar Space & ONLINE
Internals & Software Drivers 18 Nov 2019 Dulles, VA
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 27 Apr 2020 OSR Seminar Space & ONLINE