I have a device I need to hard reset while the system is running. In which case I need to restore all of config space. What are my options?
Your best option by far is to fix the hardware problem that leads you to want a hard reset. Hard reset should NEVER be used in a production system. Ever. It’s a band aid in an attempt to hide a failure.
If the system is hotplug-enabled (most are not), you can drop off the bus and re-appear, and the OS will re-enumerate you. Otherwise, whatever you do is going to be a horrible hack.
Would love to fix it in hardware, but not sure how. I have an issue with tx credit counters. Half are in our logic the other half are in the pcie core. CvP resets our logic counters, but the pcie core counters don’t reset. Hard reset gets them back both in sync. Maybe there’s a way to get the pcie cores counters to reset without a hard reset. If there is, I don’t know it.
Could I use WdfDeviceSetDeviceState to disable/enable my device to notify the PnP manager in some way to reconfigure the device?