Skip to contentSkip to conversation

Cross platform method for detecting hot unplug in irq handler

DISCUSSION James Courtier-Dutton 2 participants 2 messages Jul 23, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I am writing a driver for a PCMCIA device.
When the card is removed, the driver's IRQ handler is called. The first thing the IRQ handler does is read a status register from the card's IOPORT. On the ia32 (i386) platform, the resulting status read will return 0xffffffff. If the driver reads this value, it assumes the card has been removed and acts accordingly.

Is this a reliable way of detecting PCMCIA or Hotplug card removal inside an IRQ handler?
Is it consistent cross platforms. E.g. ia64, amd64, PPC, MIPS etc.? Does a more reliable detection method exist in the kernel?

James

#1 lore raw
Quoted 9 lines · On Sun, 23 Jul 2006 14:11:01 +0100 James Courtier-Dutton…

Hi,

I am writing a driver for a PCMCIA device.
When the card is removed, the driver's IRQ handler is called. The first thing the IRQ handler does is read a status register from the card's IOPORT. On the ia32 (i386) platform, the resulting status read will return 0xffffffff. If the driver reads this value, it assumes the card has been removed and acts accordingly.

Quoted 4 lines

Is this a reliable way of detecting PCMCIA or Hotplug card removal inside an IRQ handler?
Is it consistent cross platforms. E.g. ia64, amd64, PPC, MIPS etc.? Does a more reliable detection method exist in the kernel?

Cardbus has detection pins, ad they can be queried via the controller. But it's too slow and afaik cardbus will reliably rern 0xffffffff for a removed card.

Lots of drivers treat a read of all-ones as indicating a removed card. It works.