Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jan 2000 21:21:19 +0900
From:      Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
To:        iwasaki@jp.freebsd.org
Cc:        imp@village.org, gallatin@cs.duke.edu, freebsd-mobile@FreeBSD.ORG
Subject:   Re: pc card removal lockup 
Message-ID:  <200001271221.VAA21926@tasogare.imasy.or.jp>
In-Reply-To: Your message of "Thu, 27 Jan 2000 17:56:26 %2B0900" <200001270856.RAA07853@tasogare.imasy.or.jp>
References:  <200001270856.RAA07853@tasogare.imasy.or.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
> I basically agree with you.  I have two things to say.
> 
> How about adding splhigh() and splx() around calling disable_slot() as
> same as pccard_suspend()?  It will make removal event handling more
> safty, I beleave.
> 
> And Is disable_slot_to() necessary if we don't use spl0 code?
> I think calling disable_slot() would be almost the same as the code in
> pccard_suspend().
> 
> # I'm sorry, no time to make pactch...

I've just made the patch including the latest patch from Warner-san.

Mr. Andrew Gallatin, could you try this again and see if the machine
locking up when you remove ep0 while the machine is running?
# spl stuff have been added against the last patch.

Warner-san, I'd like to add this to 4.0-RELEASE.

Index: pccard.c
===================================================================
RCS file: /home/ncvs/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 11:16:50
@@ -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,6 @@
 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 int		invalid_io_memory(unsigned long, int);
 static void		power_off_slot(void *);
 
@@ -184,27 +177,6 @@
 	slt->pwr_off_pending = 1;
 }
 
-static void
-disable_slot_to(void *argp)
-{
-	struct slot *slt = (struct slot *) argp;
-
-	slt->state = empty;
-	disable_slot(slt);
-	printf("pccard: card removed, slot %d\n", slt->slotnum);
-	pccard_remove_beep();
-	selwakeup(&slt->selp);
-}
-
-/*
- * 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
@@ -232,7 +204,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 +272,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);
@@ -337,8 +308,13 @@
 		 *	data structures are not unlinked.
 		 */
 		if (slt->state == filled) {
+			int s = splhigh();
 			slt->state = empty;
-			disable_slot_spl0(slt);
+			disable_slot(slt);
+			splx(s);
+			printf("pccard: card removed, slot %d\n", slt->slotnum);
+			pccard_remove_beep();
+			selwakeup(&slt->selp);
 		}
 		break;
 	case card_inserted:
@@ -705,7 +681,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/ncvs/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 11:15:14
@@ -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?200001271221.VAA21926>