From owner-freebsd-bugs Tue Sep 11 0:40: 9 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1F16C37B40E for ; Tue, 11 Sep 2001 00:40:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f8B7e2Q66007; Tue, 11 Sep 2001 00:40:02 -0700 (PDT) (envelope-from gnats) Received: from arbi.Informatik.Uni-Oldenburg.DE (co2.Informatik.Uni-Oldenburg.DE [134.106.11.107]) by hub.freebsd.org (Postfix) with ESMTP id 4FCC037B401 for ; Tue, 11 Sep 2001 00:33:13 -0700 (PDT) Received: from troja.Informatik.Uni-Oldenburg.DE ([134.106.1.36]) by arbi.Informatik.Uni-Oldenburg.DE (Exim 3.16) id 15gi2g-0006Vt-00; Tue, 11 Sep 2001 09:33:10 +0200 Received: from flunder.Informatik.Uni-Oldenburg.DE ([134.106.1.50]) by troja.Informatik.Uni-Oldenburg.DE (Exim 3.16) id 15gZ0J-0007Yd-00; Mon, 10 Sep 2001 23:54:08 +0200 Received: by flunder.Informatik.Uni-Oldenburg.DE (Exim 3.16) id 15gYyY-0000Fb-00; Mon, 10 Sep 2001 23:52:18 +0200 Message-Id: Date: Mon, 10 Sep 2001 23:52:18 +0200 From: "Joerg Lehners" Reply-To: "Joerg Lehners" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: i386/30503: stray pccard card insertion events after resume Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 30503 >Category: i386 >Synopsis: stray pccard card insertion events after resume >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 11 00:40:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Joerg Lehners >Release: FreeBSD 4.4-RC i386 >Organization: private >Environment: System: FreeBSD flunder 4.4-RC FreeBSD 4.4-RC #8: Mon Sep 10 22:57:06 MEST 2001 root@flunder:/usr/src/sys/compile/FLUNDER i386 Toshiba Tecra 750 and Toshiba Libretto 100CT Problem: I get stray pccard insertion events after a suspend/resume cycle. This is only when using IRQ driven pccard management. >Description: >How-To-Repeat: Power down a pccard slot with pccardc, remove the card while the notebook runs, suspend the notebook, insert a card while the notebook is suspend, resume the notebook. I'll get a 'pccard: card inserted, slot X' messages. The pccardd activates the driver. All is fine until I use the associated device. I get another 'pccard: card inserted, slot X' messages after opening and using the device (for instance a sio device with kermit). The second sequence of power_off_slot()/slt->ctrl->power() in pccard.c:inserted() wegdes the card. Results possible are a hung machine or even a panic (depending on the hardware/driver/device). When I set PCIC comptibility in the BIOS with polling mode, I do not have this problem. Kernel Messages (for reference): Using BIOS-setting PCIC compatible: Sep 10 22:08:25 flunder /kernel: pcic0: at port 0x3e0-0x3e1 on isa0 Sep 10 22:08:25 flunder /kernel: pcic0: Polling mode Sep 10 22:08:25 flunder /kernel: pccard0: on pcic0 Sep 10 22:08:25 flunder /kernel: pccard1: on pcic0 Using BIOS-setting Automatic: Sep 10 22:03:29 flunder /kernel: pci_cfgintr_virgin: using routable interrupt 3 Sep 10 22:03:29 flunder /kernel: pci_cfgintr: 0:2 INTA routed to irq 3 Sep 10 22:03:29 flunder /kernel: pcic0: irq 3 at device 2.0 on pci0 Sep 10 22:03:29 flunder /kernel: pcic0: PCI Memory allocated: 0x44000000 Sep 10 22:03:29 flunder /kernel: pccard0: on pcic0 Sep 10 22:03:29 flunder /kernel: pci_cfgintr_search: linked (1) to configured irq 3 at 0:2:0 Sep 10 22:03:29 flunder /kernel: pci_cfgintr: 0:2 INTB routed to irq 3 Sep 10 22:03:29 flunder /kernel: pcic1: irq 3 at device 2.1 on pci0 Sep 10 22:03:29 flunder /kernel: pcic1: PCI Memory allocated: 0x44001000 Sep 10 22:03:29 flunder /kernel: pccard1: on pcic1 Using BIOS-setting Cardbus/16 Bit: Sep 8 23:13:35 flunder /kernel: pcic0: irq 11 at device 2.0 on pci0 Sep 8 23:13:35 flunder /kernel: pcic0: PCI Memory allocated: 0x44000000 Sep 8 23:13:35 flunder /kernel: pccard0: on pcic0 Sep 8 23:13:35 flunder /kernel: pcic1: irq 11 at device 2.1 on pci0 Sep 8 23:13:35 flunder /kernel: pcic1: PCI Memory allocated: 0x44001000 Sep 8 23:13:35 flunder /kernel: pccard1: on pcic1 I think there is a small error in the suspend/resume handling of the pccard system when using IRQ management: After resuming the machine pcic_resume() may call pcic_do_stat_delta() which in turn may active a slot (the first card inserted event after the resume). The card is ready to use now. But it seems some pccard controller still have a management event in the hardware pending. An unlash of the corresponding IRQ seems to fire the second card inserted event (more or less the real one). My suggested fix: either clear all pending managment events after resuming or do even better debouncing of insertion events. As a first measure I inserted some code at the top of pccard.c:inserted(): if (slt->state == filled) { printf("pccard: card already inserted, slot %d\n", slt->slotnum); return; } But I'm not 100% confident that this is the right way to handle this problem. >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message