Re: IRP_MN_SURPRISE_REMOVE

From: Mark Roddy (markr_at_hollistech.com)
Date: 07/28/04


Date: Tue, 27 Jul 2004 23:36:12 -0400

I agree with Calvin. Unless you can find a mechanism to convince the bus
driver to believe that the PDO is gone you will have what amounts to a dead
PDO. Virtualization works here: that is turning a function driver for a
hardware device into a bus driver for a virtual bus and enumerating virtual
PDOs on that virtual bus. See toaster for bus driver implementations.
Consider why you want to introduce this level of complexity into your
driver.
.

-- 
=====================
Mark Roddy
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
markr@hollistech.com
"Calvin Guan" <cguan@pleasenospam.ati.com> wrote in message
news:%23SdV85BdEHA.1384@TK2MSFTNGP10.phx.gbl...
> Maybe I didn't make it clear, see comments inline.
>
> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> news:O41aBVBdEHA.2408@tk2msftngp13.phx.gbl...
> > It's not correct.
> >
> > When your bus driver doesn't return a PDO in QUERY_DEVICE_RELATIONS, it
> > first receives SURPRISE_REMOVAL. Then all appications (and kernel
clients)
> > get notification for the device removal. They all are supposed to close
> all
> > handles and release all FILE_OBJECT references. The PDO stack is also
> > supposed to cancel all I/O requests on SIRPRISE_REMOVAL (each request
> holds
> > a FILE_OBJECT reference and the upper DEVICE_OBJECT reference).
> > Only when there are no open references to the stack left, it will
receive
> > IRP_MN_REMOVE_DEVICE. The bus driver is then supposed to delete the PDO.
>
> This is correct but I didn't see how it's related to my previous post.
There
> is not problem if the bus driver (assuming it's not written by you or me)
> doesn't report  the PDO. In such case, the behavior you mentioned above is
> expected.
>
> The OP's question was "to remove device from a
IRP_MN_QUERY_DEVICE_RELATIONS
> response". I assumed he didn't mean in a BUS_DRIVER because it's
absolutely
> ok for a bus driver to do so.
>
> In case of any non-bus driver in the stack doing so, the stack still gets
> surprise_remove and remove_dev. But the bus driver will NOT attempt to
> delete the PDO at all after SURPRISE_REMOVE/REMOVE_DEV because he has
> reported it in the most recent query but someone above just tossed it.
>
> Quoted from DDK doc:
> "If the bus driver reported this device in its most recent response to an
> IRP_MN_QUERY_DEVICE_RELATIONS request for BusRelations, the device is
still
> physically present on the machine. In this case, the bus driver:
>   a.. Retains the PDO for the device until the device has been physically
> removed. "
> > You should not keep the PDO after that. If your child device appears
> again,
> > you should create another PDO for it.
> Again, if the bus driver does not report the PDO in the QUERY_RELATIONS.
>
> >but should not remove lower bus driver's PDOs
> >from the list.
>
> I was trying to explain how bad it would be if someone does so.
>
> >There is no way to convince a real bus driver to delete and
> > recreate the PDO.
> This is what I was saying in my previous post.
>
> > It's not correct.
>
> What do you see wrong though?
>
> -
> Calvin Guan      Software Engineer
> ATI Technologies Inc.  www.ati.com
>
>


Relevant Pages

  • Re: Getting the device information for modification
    ... I think the easier thing for you to do is to write a function driver that is ... assigned to the PDO for your device. ... > our printer USB chips. ... > The problem today is that we use an USB chip that doesn't report Class_07 ...
    (microsoft.public.win32.programmer.kernel)
  • Re: NDIS WDM driver installation for multi-port NIC
    ... I also have some questions regarding which class the bus driver should be ... PDO for each port, and have one IOCTL you can issue that will return the ...
    (microsoft.public.development.device.drivers)
  • Re: Difference in PDO and FDO.
    ... class driver is confusing so lets use the real term ... Function Driver. ... exported as seperate device interfaces) on a single PDO. ... For instance I've written bus ...
    (microsoft.public.development.device.drivers)
  • Re: Drive letter not visible in Explorer
    ... Seems like the only way I can get a PDO is in the AddDevice handler when my ... driver is called by the PnP subsystem. ... device is plugged into a bus, and then the bus notifies the PnP subsystem of ... Should I process with writing my own bus driver? ...
    (microsoft.public.development.device.drivers)
  • Re: IoGetDeviceProperty() failed with property DevicePropertyBusTypeGu
    ... is your PDO a PDO created by disk.sys that was actually reported to the ... > This piece of code has been tested in toaster driver ... > information about the bus to which a device is attached.". ... > So, like toaster bus driverdoes, this call should not fail ...
    (microsoft.public.development.device.drivers)

Loading