Subject: Re: funny PCMCIA card irq allocations on an IBM ThinkPad 560E
To: Thorsten Frueauf <s_frueau@ira.uka.de>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-i386
Date: 04/23/1999 16:01:04
On Sat, 24 Apr 1999 00:49:16 +0200 (MET DST) 
 Thorsten Frueauf <s_frueau@ira.uka.de> wrote:

 > Of course, here it is again:
 > 
 > --- snip ---
 > --- src/sys/dev/pcmcia/aic_pcmcia.c	Fri Nov 20 03:12:15 1998
 > +++ /src/sys/dev/pcmcia/aic_pcmcia.c	Fri Apr 23 22:16:02 1999
 > @@ -182,6 +182,8 @@
 >  	printf(": %s\n", app->app_name);
 >  
 >  	aicattach(sc);
 > +
 > +	aic_pcmcia_enable (psc, 1);
 >  }

This patch is not correct.  It defeats the entire purpose of power management.
The SCSI code will automatically call this as soon as the reference count
on the bus goes non-zero (i.e. "someone opened a device on the bus").

I would suggest the following, more correct patch, to disable power management
in the driver, until the real bug can be tracked down:

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>

Index: aic_pcmcia.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pcmcia/aic_pcmcia.c,v
retrieving revision 1.8
diff -c -r1.8 aic_pcmcia.c
*** aic_pcmcia.c	1998/11/20 02:12:15	1.8
--- aic_pcmcia.c	1999/04/23 23:00:19
***************
*** 170,175 ****
--- 170,176 ----
  		panic("aic_pcmcia_attach: impossible");
  	}
  
+ #if 0	/* XXX power management broken somehow. */
  	/* We can enable and disable the controller. */
  	sc->sc_adapter.scsipi_enable = aic_pcmcia_enable;
  
***************
*** 180,185 ****
--- 181,197 ----
  	pcmcia_function_disable(pf);
  
  	printf(": %s\n", app->app_name);
+ #else
+ 	printf(": %s\n", app->app_name);
+ 
+ 	psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_BIO,
+ 	    aicintr, &psc->sc_aic);
+ 	if (psc->sc_ih == NULL) {
+ 		printf("%s: couldn't establish interrupt handler\n",
+ 		    psc->sc_aic.sc_dev.dv_xname);
+ 		return;
+ 	}
+ #endif
  
  	aicattach(sc);
  }