We have a PCIe device that creates a BAR0 as non-prefetchable as it contains registers that clear on read. the BAR0 is mapped like:
mRegisters = (PUINT8)MmMapIoSpace(paBar, length, MmNonCached);
we use a function, readRegister32(offset) to read from the PCIe “registers” that boils down to:
READ_REGISTER_ULONG((PULONG)&mRegisters[offset]);
I am seeing an issue where the virtual address mRegsters[offset] contents are not the same as the physical address (in this case b4000) as read using !dd. The regs at the physical address + offset are correct and reflect the hardware, but the same read from the corresponding VA are wrong - caching, right?
However, when I examine the virtual address for mRegisters, in this case,
5: kd> !pte 0xffffd000`22aeb000
VA ffffd00022aeb000
PXE at FFFFF6FB7DBEDD00 PPE at FFFFF6FB7DBA0000 PDE at FFFFF6FB740008A8 PTE at FFFFF6E800115758
contains 00000000005A6863 contains 00000000005A5863 contains 0000000117876863 contains 00000000B400097B
pfn 5a6 —DA–KWEV pfn 5a5 —DA–KWEV pfn 117876 —DA–KWEV pfn b4000 -G-DANTKWEV
FYI…
5: kd> !devext 0xffffe000ad2cc9d0
PDO Extension, Bus 0x7, Device 0, Function 0.
DevObj 0xffffe000ad2cc880 Parent FDO DevExt 0xffffe000ad12ccf0
Device State = PciStarted
Vendor ID ;-)), Device ID 0002
Subsystem Vendor ID ;-)), Subsystem ID 0002
Header Type 0, Class Base/Sub 05/80 (Memory Controller/‘Other’)
Programming Interface: 00, Revision: 00, IntPin: 00, RawLine 00
Possible Decodes ((cmd & 7) = 7): BMI
Capabilities: Ptr=40, power msi express
Express capabilities: (BIOS controlled)
Logical Device Power State: D0
Device Wake Level: D3
WaitWakeIrp:
Requirements: Alignment Length Minimum Maximum
BAR0 Mem: 00010000 00010000 0000000000000000 00000000ffffffff
Resources: Start Length
BAR0 Mem: 00000000b4000000 00010000
Interrupt Requirement:
Message Based: Type - Msi, 0x4 messages requested
Interrupt Resource: Type - MSI, 0x4 Messages Granted
I see that the resultant physical page, our BAR0, is non-cached.
Is there another level of caching that needs to be disabled, and if so, how?
Thanks for any help!
Regards,
-wd