Reading/restoring PCI config space

There have been several times where I’ve found myself wanting to read/write to PCI config space, but I haven’t yet actually done it. Well, the time has come. Are there any WDM vs WDF, or Win Xp vs Win8 concerns that I need to take into consideration?

I want to read PCI config space, initiate a process on the device that clears out config space, then I’ll need to restore what was previously saved from config space. The BARs and resources themselves will not change, but the data needs preserved.

I was planning on using http://www.osronline.com/ddkx/kmarch/iputoput_4pev.htm as a starting point, but wanted to query for any advice before I waste any time trying to do something that clearly won’t work.

xxxxx@hotmail.com wrote:

There have been several times where I’ve found myself wanting to read/write to PCI config space, but I haven’t yet actually done it. Well, the time has come. Are there any WDM vs WDF, or Win Xp vs Win8 concerns that I need to take into consideration?

Lots of them, but if you are the function driver for the device,
IRP_MN_READ_CONFIG and IRP_MN_WRITE_CONFIG are the right answer.

I want to read PCI config space, initiate a process on the device that clears out config space, then I’ll need to restore what was previously saved from config space. The BARs and resources themselves will not change, but the data needs preserved.

Wow. I’m not entirely convinced that’s possible. There are fields in
the configuration space that render the device unusable.

Is this actually a PCI device, or is it PCI Express? XP will not touch
the PCI Express extended configuration space.

Are you resetting the device? Will there be power interruptions? There
is some danger that the PCI bus controller will shut you down when this
happens. Protocol violations result in an NMI, which triggers a blue
screen.

This should be interesting…


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.