From owner-freebsd-mobile Thu Jan 27 9:20:55 2000 Delivered-To: freebsd-mobile@freebsd.org Received: from tasogare.imasy.or.jp (tasogare.imasy.or.jp [202.227.24.5]) by hub.freebsd.org (Postfix) with ESMTP id 948B314C3F for ; Thu, 27 Jan 2000 09:20:50 -0800 (PST) (envelope-from iwasaki@jp.FreeBSD.org) Received: from localhost (isdn52.imasy.or.jp [202.227.24.244]) by tasogare.imasy.or.jp (8.9.3+3.2W/3.7W-tasogare/smtpfeed 1.01) with ESMTP id CAA12938; Fri, 28 Jan 2000 02:20:45 +0900 (JST) (envelope-from iwasaki@jp.FreeBSD.org) Message-Id: <200001271720.CAA12938@tasogare.imasy.or.jp> To: imp@village.org Cc: iwasaki@jp.FreeBSD.org, gallatin@cs.duke.edu, freebsd-mobile@FreeBSD.ORG Subject: Re: pc card removal lockup In-Reply-To: Your message of "Thu, 27 Jan 2000 09:39:30 -0700" <200001271639.JAA45996@harmony.village.org> References: <200001271639.JAA45996@harmony.village.org> X-Mailer: Mew version 1.93 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 28 Jan 2000 02:20:44 +0900 From: Mitsuru IWASAKI X-Dispatcher: imput version 980905(IM100) Lines: 142 Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > : 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. > > It was there and took it out. I think that it can be added back w/o > problem. Now I understand, my last conclusion was the same as original code and original code had same kind of problems, then you introduced the spl0 code... I'm sorry about that. # it seems that we need to continue to solve this... > : 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(). > > Yes. I think that moving disable_slot_to inline would be good. OK, like this? I've tested this by insertion/removal for about 100 times, no problems so far for my machine. # final version? 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 16:56:07 @@ -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 *); @@ -184,28 +178,19 @@ slt->pwr_off_pending = 1; } -static void -disable_slot_to(void *argp) +__inline static void +disable_slot_to(struct slot *slt) { - struct slot *slt = (struct slot *) argp; - + int s = splhigh(); slt->state = empty; disable_slot(slt); + splx(s); 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 * and initialises the data structures using the data provided. @@ -232,7 +217,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 +285,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 +322,7 @@ */ if (slt->state == filled) { slt->state = empty; - disable_slot_spl0(slt); + disable_slot_to(slt); } break; case card_inserted: @@ -705,7 +689,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 16:53:24 @@ -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