ATAMINIPORT layer surprise remove

Hi All,

I have ATA miniport driver for PCIe card and have to support surprise removal. How will the ATAPORT layer get removal notification and respond to it?.The driver could be executing in any path. Will the removal immediately cause the memory mapping for the PCI card invalidated or will it be after several processor cycle this gets done.

I am looking at making code software fault tolerant in such a scenario.

Other than checking for mapped register reads for all 1’s for detecting card removal which would add little overhead on the performance of the driver is there a way to register a callback with PCI/OS on such event from MINIPORT driver?

or other mechanism to detect card removal immediately and take necessary steps to stop the driver from entering an unstable situation.

Regards,
Selvan

The physical removal of the device will result in read pci memory operations
from the host to the device to return all bits set to ‘1’ (all ff’s). Your
driver needs to be written such that it can detect these conditions and
respond appropriately (i.e. not hang, and perform appropriate error
notifications to the port driver.)

The memory mapping of pci resources is not invalidated until the pnp removal
is complete by the function driver, which would be the port driver in this
case.

ATAport may or may not get notified by its parent driver (pci.sys) that the
device is missing, depending on the platform support for hot unplug. Your
driver should be written to detect a missing device (all ff’s condition on
register read) and help the process along. On some platforms hot unplug of
pci devices does not directly signal the pci bus driver, instead function
drivers discover that their device is missing (they read all ffs from some
register, a watchdog timer expires, etc.) and have to poke the bus driver to
do something.

“Help the process along” is always a bit of a mystery for miniports.
Complete all outstanding requests with some sort of “device gone” error,
fail all incoming new requests, convince the port driver to re-enumerate.

Mark Roddy

On Tue, Sep 14, 2010 at 7:38 AM, wrote:

> Hi All,
>
> I have ATA miniport driver for PCIe card and have to support surprise
> removal. How will the ATAPORT layer get removal notification and respond to
> it?.The driver could be executing in any path. Will the removal immediately
> cause the memory mapping for the PCI card invalidated or will it be after
> several processor cycle this gets done.
>
> I am looking at making code software fault tolerant in such a scenario.
>
> Other than checking for mapped register reads for all 1’s for detecting
> card removal which would add little overhead on the performance of the
> driver is there a way to register a callback with PCI/OS on such event from
> MINIPORT driver?
>
> or other mechanism to detect card removal immediately and take necessary
> steps to stop the driver from entering an unstable situation.
>
> Regards,
> Selvan
>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

thanks mark