Date: Fri, 28 Jan 2000 02:20:44 +0900 From: Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org> To: imp@village.org Cc: iwasaki@jp.FreeBSD.org, gallatin@cs.duke.edu, freebsd-mobile@FreeBSD.ORG Subject: Re: pc card removal lockup Message-ID: <200001271720.CAA12938@tasogare.imasy.or.jp> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
> : 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001271720.CAA12938>