Ata miniport, on primary slave disk removal crashing.

Hi Experts,
I have written Ata miniport for IDE controller for native mode (CC_01018F, Non Ahci )
OS disk connected to primary Master channel, when test disk is connected (PnP insertion) to primary slave, disk detection is working,
Test disk removal (PnP remove) on primary slave channel causing system crash.

When debugged after com reset, on primary master busy bit is not cleared.

What may be the issue?

Thanks in advance.