Surprise removal

What happens if the device is removed when my driver is executing its
ISR??? Do I get Surprise removal after my ISR??

Thanks
Daniel


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Yes.

----- Original Message -----
From: “Pradeep Daniel”
To: “NT Developers Interest List”
Sent: Thursday, August 16, 2001 10:31 PM
Subject: [ntdev] Surprise removal

> What happens if the device is removed when my driver is executing its
> ISR??? Do I get Surprise removal after my ISR??
>
> Thanks
> Daniel
>
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

>What happens if the device is removed when my driver is executing its

ISR??? Do I get Surprise removal after my ISR??

The ACTUAL device removal can happen at ANY moment, users don’t obey
spinlocks or IRQL’s. When writing a driver for a removable device it’s
desirable to not make any assumptions in your code that will cause horrible
problems. For example, say your device is a cardbus device, and somebody
ejects it while you happen to be in your ISR or DPC. The values you read
from what are supposed to be device registers may now be pure garbage. On
some busses (like PCI), in theory you will get a a target abort indication
from the master hardware (which may be a cardbus controller or a processor
bus bridge). Unfortunately, I don’t believe this info is passed to your
driver, as your driver doesn’t own the master. I seem to fuzzily remember
machines of long ago (maybe VAX’s or TI minicomputers I once worked on)
that used to indicate a bus fault, which would be intercepted by the
processor and dispatched as an appropriate exception.

PCI master hardware generally (always?) has error registers, and generally
(always?) these can cause interrupts. Does anybody know how to get the OS
(the owner of bridges) to inform driver code that a target access just
failed? Sometime after the device is removed, you should get a PNP
surprise removal event, although I don’t believe this will get delivered
instantly.

Perhaps future API’s to read/write target memory/registers could also
examine the correct bus master status registers and return a status value.

  • Jan

You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

If that is so what happens if I have to access the hardware in my ISR??

“Maxim S. Shatskih” wrote:

Yes.

----- Original Message -----
From: “Pradeep Daniel”
> To: “NT Developers Interest List”
> Sent: Thursday, August 16, 2001 10:31 PM
> Subject: [ntdev] Surprise removal
>
> > What happens if the device is removed when my driver is executing its
> > ISR??? Do I get Surprise removal after my ISR??
> >
> > Thanks
> > Daniel
> >
> >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
> —
> You are currently subscribed to ntdev as: xxxxx@atheros.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

What bus do you use?

----- Original Message -----
From: “Pradeep Daniel”
To: “NT Developers Interest List”
Sent: Friday, August 17, 2001 2:26 AM
Subject: [ntdev] Re: Surprise removal

> If that is so what happens if I have to access the hardware in my ISR??
>
> “Maxim S. Shatskih” wrote:
>
> > Yes.
> >
> > ----- Original Message -----
> > From: “Pradeep Daniel”
> > To: “NT Developers Interest List”
> > Sent: Thursday, August 16, 2001 10:31 PM
> > Subject: [ntdev] Surprise removal
> >
> > > What happens if the device is removed when my driver is executing its
> > > ISR??? Do I get Surprise removal after my ISR??
> > >
> > > Thanks
> > > Daniel
> > >
> > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@atheros.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

CardBus.

“Maxim S. Shatskih” wrote:

What bus do you use?

----- Original Message -----
From: “Pradeep Daniel”
> To: “NT Developers Interest List”
> Sent: Friday, August 17, 2001 2:26 AM
> Subject: [ntdev] Re: Surprise removal
>
> > If that is so what happens if I have to access the hardware in my ISR??
> >
> > “Maxim S. Shatskih” wrote:
> >
> > > Yes.
> > >
> > > ----- Original Message -----
> > > From: “Pradeep Daniel”
> > > To: “NT Developers Interest List”
> > > Sent: Thursday, August 16, 2001 10:31 PM
> > > Subject: [ntdev] Surprise removal
> > >
> > > > What happens if the device is removed when my driver is executing its
> > > > ISR??? Do I get Surprise removal after my ISR??
> > > >
> > > > Thanks
> > > > Daniel
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@atheros.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
> —
> You are currently subscribed to ntdev as: xxxxx@atheros.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Then the user can indeed pop out the hardware device and your isr can
indeed be running before, durring, or after this sort of ‘rude’ removal.

Your driver should be written such that at a minimum it does not have
any unbounded loops waiting for hardware registers to change value, and
it should also have a testable register on your hardware that will never
have the value 0xffff (or whatever the register width is - all filled
with 1’s,) if the hardware is present (and always have this value when
it is not present.) However, if your driver currently does not handle
this sort of low level device departure event, not to worry too much -
neither do most other NT drivers.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pradeep Daniel
Sent: Thursday, August 16, 2001 11:21 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Surprise removal

CardBus.

“Maxim S. Shatskih” wrote:

> What bus do you use?
>
> ----- Original Message -----
> From: “Pradeep Daniel”
> > To: “NT Developers Interest List”
> > Sent: Friday, August 17, 2001 2:26 AM
> > Subject: [ntdev] Re: Surprise removal
> >
> > > If that is so what happens if I have to access the hardware in my
> > > ISR??
> > >
> > > “Maxim S. Shatskih” wrote:
> > >
> > > > Yes.
> > > >
> > > > ----- Original Message -----
> > > > From: “Pradeep Daniel”
> > > > To: “NT Developers Interest List”
> > > > Sent: Thursday, August 16, 2001 10:31 PM
> > > > Subject: [ntdev] Surprise removal
> > > >
> > > > > What happens if the device is removed when my driver is
> > > > > executing its ISR??? Do I get Surprise removal after my ISR??
> > > > >
> > > > > Thanks
> > > > > Daniel
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntdev as:
> xxxxx@storagecraft.com
> > > > > To unsubscribe send a blank email to
> > > > > leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@atheros.com To
> > > > unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
> xxxxx@storagecraft.com To
> > > unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@atheros.com To
> > unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@hollistech.com To unsubscribe send a blank email to
> leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com