From owner-freebsd-mobile Thu Sep 24 10:51:57 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA10880 for freebsd-mobile-outgoing; Thu, 24 Sep 1998 10:51:57 -0700 (PDT) (envelope-from owner-freebsd-mobile@FreeBSD.ORG) Received: from ns.mt.sri.com (sri-gw.MT.net [206.127.105.141]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA10870; Thu, 24 Sep 1998 10:51:53 -0700 (PDT) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.8.8/8.8.8) with SMTP id LAA24932; Thu, 24 Sep 1998 11:51:40 -0600 (MDT) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id LAA06047; Thu, 24 Sep 1998 11:51:40 -0600 Date: Thu, 24 Sep 1998 11:51:40 -0600 Message-Id: <199809241751.LAA06047@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Brian Somers Cc: Robert Watson , freebsd-bugs@FreeBSD.ORG, freebsd-mobile@FreeBSD.ORG Subject: Re: after wakeup from apm sleep: pccardd[46]: No free configuration for card 3... In-Reply-To: <199809240928.KAA04905@woof.lan.awfulhak.org> References: <199809240928.KAA04905@woof.lan.awfulhak.org> X-Mailer: VM 6.34 under 19.16 "Lille" XEmacs Lucid Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > Short fix (sometimes works): kill & restart pccardd. > > My machine's doing this too... > > It looks like there's a problem with the slot power off code. It > waits a second (via timeout()) after the card has been removed before > removing power. But, if you note 'power_off_slot' just does a control disable, which happens anyway in suspend, so it's doesn't make any difference. power_off_slot(void *arg) { struct slot *slt = (struct slot *)arg; /* Power off the slot. */ slt->pwr_off_pending = 0; slt->ctrl->disable(slt); } And, suspend: slot_suspend(void *arg) { struct slot *slt = arg; /* This code stolen from pccard_event:card_removed */ if (slt->state == filled) { int s = splhigh(); disable_slot(slt); slt->state = suspend; splx(s); printf("Card disabled, slot %d\n", slt->slotnum); } slt->ctrl->disable(slt); return (0); } Note that even though the slot disable is set into a timeout, we also 'disable' the slot anyway (which is all the power_off_slot does anyway). So, the slot is still powered off (but we do have a timeout still pending to disable the slot that may not have been fired.) > This is a problem if the removal event is the result > of a suspend as the timeout() doesn't wake up 'till *after* resuming. Agreed. > If the card is still there, sometimes the attach happens before the > remove, resulting in the remove being untimeout()'d and pccardd > thinking the driver entry is already in use. > > The fix (which I plan to add in the next couple of days): Sounds way too codiff -u -r1.27.2.7 pccard.c --- pccard.c 1998/04/18 23:24:47 1.27.2.7 +++ pccard.c 1998/09/24 17:50:48 @@ -378,6 +378,11 @@ splx(s); printf("Card disabled, slot %d\n", slt->slotnum); } + /* + * Disable any pending timeouts for this slot since we're + * powering it down/disabling now. + */ + untimeout(power_off_slot, (caddr_t)slt); slt->ctrl->disable(slt); return (0); } > Any objections ? Too complex. Also, I don't see how this 'bug' could cause the problems we're seeing, but agree that this is a bug. Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message