Subject: PCMCIA madness
To: None <>
From: Lennart Augustsson <>
List: tech-kern
Date: 09/06/1998 22:01:29
I was reading the pcmcia driver source to try and figure out how
I could make my CompactFlash cards work.  I then made an appauling
discovery: when I plug in a PCMCIA card and the controller interrupt
occurs it will try and enable the card by calling pcic_chip_socket_enable().
This function calls delay() with a total time of OVER 0.5 SECONDS!
FROM AN INTERRUPT CONTEXT!!  Sorry about shouting, but I thought NetBSD
was supposed to be the system where we did things right.  Calling
delay() for 0.5 seconds from the interrupt routine surely isn't The Right Way.

Is this going to be fixed in the near future?  If not, I'm going to
fix it myself.  The fix I envision is the same way as I do it in
the USB drivers.  The interrupt routine just sets a flags that a
bus enumeration is needed.  The actual enumeration is then done
by a deamon process where we can sleep.  During boot the driver
will run in a polling mode, so we can get up and running without the

There seem to be other problems in the PCMCIA code as well.  E.g., plugging
in my CompactFlash card hangs kernel (I've fixed it so it doesn't hang
now, but only sporadically recognized the card.  The card works in Windoze.)

     -- Lennart