Subject: Re: PCMCIA madness
To: Lennart Augustsson <>
From: Stefan Grefen <>
List: tech-kern
Date: 09/06/1998 22:31:32
In message <>  Lennart Augustsson wrote:
> 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
> deamon.

I hate deamon processes for this and that. 
With 0.5 seconds timeout driven state machine is a better solution.
The problems with daemons is that they may get killed ...

Of course if we had kernel-threads (wich are simmering for 2 years
or more ....)

> 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.)
Whats the problem? If the Card doesn't get ready try increasing the timeouts,
if I remember correctly you've more than 15 MB and AFAIK the Card does some
kind of inventory during powerup.


>      -- Lennart

Stefan Grefen                                Tandem Computers Europe Inc.                       High Performance Research Center
 --- Hacking's just another word for nothing left to kludge. ---