raspberrypi / windows-drivers

Windows IOT drivers
MIT License
121 stars 33 forks source link

bcm2836sdhc & rpisdhc cause a crash when unloaded #24

Open mariobalanica opened 3 years ago

mariobalanica commented 3 years ago

From WinDbg:

PNP_DETECTED_FATAL_ERROR (ca) PnP encountered a severe error, either as a result of a problem in a driver or a problem in PnP itself. The first argument describes the nature of the problem, the second argument is the address of the PDO. The other arguments vary depending on argument 1. Arguments: Arg1: 0000000000000014, Device removed without disconnecting interrupts Driver failed to disconnect interrupts when the device was removed. Arg2: ffffe00b37049b20, PDO. Arg3: 0000000000000008 Arg4: 0000000000000000

All drivers based on https://github.com/microsoft/Windows-driver-samples/tree/master/sd/miniport/sdhc exhibit this issue.

Recent updates to the final release of Windows seem to cause a driver reset during the first boot, so users are not able to complete the installation process.

CE1CECL commented 3 years ago

Which build of windows is this on?

mariobalanica commented 3 years ago

I'm only testing builds 19041 and newer. The unload issue happens on all the builds in this range, but recent updates to 19041/2 make it worse by causing a driver reset during the first boot of a clean installation.

According to @idigdoug, sdport.sys is actually responsible for detaching the interrupts, but it fails to do so.

idigdoug commented 3 years ago

There is a known bug in sdport.sys that causes a consistent crash on unload. This has been fixed in Windows build 21343, but that doesn't help those who can't update to that version yet.

There is a known bug in bcm2836sdhc.sys that causes a consistent crash on unload. PR open with a fix for that.

There appears to be a not-yet-understood bug in sdport.sys that causes a crash if you load more than one miniport (e.g. load both rpisdhc and bcm2836sdhc) and then unload them.

There appears to be a not-yet-understood bug in sdport.sys such that when you try to unload a miniport, sdport disables the miniport but doesn't unload it, so you can't actually replace or restart the miniport without a reboot.

mariobalanica commented 3 years ago

Merged the pull request. I'll keep this issue open until the sdport bug gets fixed in a stable release of Windows.

Thanks for the info!