Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jan 2000 01:24:27 -0700
From:      Warner Losh <imp@village.org>
To:        Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
Cc:        gallatin@cs.duke.edu, freebsd-mobile@FreeBSD.ORG
Subject:   Re: pc card removal lockup 
Message-ID:  <200001270824.BAA43895@harmony.village.org>
In-Reply-To: Your message of "Thu, 27 Jan 2000 13:36:14 %2B0900." <200001270436.NAA03328@tasogare.imasy.or.jp> 
References:  <200001270436.NAA03328@tasogare.imasy.or.jp>  <200001270031.RAA04501@harmony.village.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
Hi isasaki-san,

In message <200001270436.NAA03328@tasogare.imasy.or.jp> Mitsuru IWASAKI writes:
: I thought that delay by disable_slot_spl0() cause some sort of race
: condition and miss an interrupt as result...
: I'm testing this patch and seem to solve the problem for my
: environment so far.

OK.  IF that solves the problem, then what about this patch?  It is
the same as yours, except it also garbage collects the unused code.
Getting rid of the spl0 code was on my list (since bruce pointed out
to me that it wasn't really running at spl0), but I wasn't motivated
until now to try to track it down.

I also included removing the PCIC_RESUME_RESET option, at least
partially.  Users that have problems with resume reset can set it in
their sysctl.conf file to be off.  No need for both an option and a
sysctl.  It is whole contained in the first chunk of the diff.

Let me know if this helps anybody with freeing problems...

Warner

Index: pccard.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/pccard/pccard.c,v
retrieving revision 1.104
diff -u -r1.104 pccard.c
--- pccard.c	2000/01/16 06:44:45	1.104
+++ pccard.c	2000/01/27 08:19:57
@@ -71,12 +71,7 @@
 
 SYSCTL_NODE(_machdep, OID_AUTO, pccard, CTLFLAG_RW, 0, "pccard");
 
-static int pcic_resume_reset =
-#ifdef PCIC_RESUME_RESET	/* opt_pcic.h */
-	1;
-#else
-	0;
-#endif
+static int pcic_resume_reset = 1;
 
 SYSCTL_INT(_machdep_pccard, OID_AUTO, pcic_resume_reset, CTLFLAG_RW, 
 	&pcic_resume_reset, 0, "");
@@ -88,8 +83,7 @@
 static int		allocate_driver(struct slot *, struct dev_desc *);
 static void		inserted(void *);
 static void		disable_slot(struct slot *);
-static void		disable_slot_spl0(struct slot *);
-static void		disable_slot_to(void *);
+static void		disable_slot_to(struct slot *);
 static int		invalid_io_memory(unsigned long, int);
 static void		power_off_slot(void *);
 
@@ -185,10 +179,8 @@
 }
 
 static void
-disable_slot_to(void *argp)
+disable_slot_to(struct slot *slt)
 {
-	struct slot *slt = (struct slot *) argp;
-
 	slt->state = empty;
 	disable_slot(slt);
 	printf("pccard: card removed, slot %d\n", slt->slotnum);
@@ -197,15 +189,6 @@
 }
 
 /*
- * Disables the slot later when we drop to spl0 via a timeout.
- */
-static void
-disable_slot_spl0(struct slot *slt)
-{
-	slt->disable_ch = timeout(disable_slot_to, (caddr_t) slt, 0);
-}
-
-/*
  *	pccard_alloc_slot - Called from controller probe
  *	routine, this function allocates a new PC-CARD slot
  *	and initialises the data structures using the data provided.
@@ -232,7 +215,6 @@
 	pccard_slots[slotno] = slt;
 	callout_handle_init(&slt->insert_ch);
 	callout_handle_init(&slt->poff_ch);
-	callout_handle_init(&slt->disable_ch);
 	return(slt);
 }
 
@@ -301,12 +283,12 @@
 	 */
 	slt->pwr.vcc = 50;
 	slt->pwr.vpp = 0;
+
 	/*
 	 * Disable any pending timeouts for this slot, and explicitly
 	 * power it off right now.  Then, re-enable the power using
 	 * the (possibly new) power settings.
 	 */
-	untimeout(power_off_slot, (caddr_t)slt, slt->disable_ch);
 	untimeout(power_off_slot, (caddr_t)slt, slt->poff_ch);
 	power_off_slot(slt);
 	slt->ctrl->power(slt);
@@ -338,7 +320,7 @@
 		 */
 		if (slt->state == filled) {
 			slt->state = empty;
-			disable_slot_spl0(slt);
+			disable_slot_to(slt);
 		}
 		break;
 	case card_inserted:
@@ -705,7 +687,6 @@
 	 * Disable any pending timeouts for this slot since we're
 	 * powering it down/disabling now.
 	 */
-	untimeout(power_off_slot, (caddr_t)slt, slt->disable_ch);
 	untimeout(power_off_slot, (caddr_t)slt, slt->poff_ch);
 	slt->ctrl->disable(slt);
 	return (0);
Index: slot.h
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/pccard/slot.h,v
retrieving revision 1.22
diff -u -r1.22 slot.h
--- slot.h	1999/12/08 07:55:20	1.22
+++ slot.h	2000/01/27 08:20:04
@@ -110,7 +110,6 @@
 	unsigned int 	insert_seq;	/* Firing up under the card */
 	struct callout_handle insert_ch;/* Insert event timeout handle */
 	struct callout_handle poff_ch;	/* Power Off timeout handle */
-	struct callout_handle disable_ch; /* Disable spl0 kludge */
 
 	enum cardstate 	state, laststate; /* Current/last card states */
 	struct selinfo	selp;		/* Info for select */


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001270824.BAA43895>