I have a PCI device embedded into the system chipset installed on the
motherboard. The motherboard is in a notebook that has a docking station.
The following behavior is observed:
- Boot the notebook while docked.
- Disable the device in the Device Manager.
- The device receives a remove IRP, as usual, the red cross appears upon
it. - Start->Undock, physically remove the laptop from the dock when the OS
says it is safe to do. - The OS automatically starts the device, it is now fully functional, the
red cross disappears. - Dock the notebook.
- The device receives a surprise removal IRP, followed by a remove IRP.
- In the Device Manager, the red cross appears upon it.
The steps 4…8 can now be repeated multiple times.
I can understand the automatic enable/disable action, since the notebook
appears to have 2 Hardware Profiles, so the OS maintains a separate
enabled/disabled device state in each profile.
What I’m confused with is the surprise removal. It appear that it would be
safer to use the normal remove IRP, given that the device is physically
non-removable. Needless to say, this surprise removal IRP comes as a real
surprise to me (and my driver
In the “Handling an IRP_MN_SURPRISE_REMOVAL Request” in the DDK, of the four
reasons listed for it, only the following one seems to be vaguely applicable
to my device:
a… The bus is enumerated for another reason and the surprise-removed device
is not included in the list of children. The PnP Manager initiates its
surprise removal operations.
But why would the pci.sys not include my device into the list of children in
this particular case, when the whole device removal seems to be initiated
not by a hardware event at all, but because the “docked” hardware profile
has this device disabled?