From pa@bigblue.cdg.chalmers.se Mon Aug 7 06:07:24 2000 Return-Path: Received: from bigblue.cdg.chalmers.se (bigblue.cdg.chalmers.se [129.16.12.19]) by hub.freebsd.org (Postfix) with ESMTP id 390C237B570 for ; Mon, 7 Aug 2000 06:07:21 -0700 (PDT) (envelope-from pa@bigblue.cdg.chalmers.se) Received: (from pa@localhost) by bigblue.cdg.chalmers.se (8.9.3/8.9.3) id PAA00340; Mon, 7 Aug 2000 15:07:12 +0200 (CEST) (envelope-from pa) Message-Id: <200008071307.PAA00340@bigblue.cdg.chalmers.se> Date: Mon, 7 Aug 2000 15:07:12 +0200 (CEST) From: pa@cdg.chalmers.se Sender: pa@bigblue.cdg.chalmers.se Reply-To: pa@cdg.chalmers.se To: FreeBSD-gnats-submit@freebsd.org Subject: pccardd looses track of available I/O space X-Send-Pr-Version: 3.2 >Number: 20454 >Category: bin >Synopsis: pccardd looses track of available I/O space >Confidential: no >Severity: serious >Priority: medium >Responsible: imp >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 07 06:10:05 PDT 2000 >Closed-Date: Wed Oct 4 08:22:07 PDT 2000 >Last-Modified: Wed Oct 04 08:23:45 PDT 2000 >Originator: Per Andersson >Release: FreeBSD 4.1-STABLE i386 >Organization: >Environment: 4.1-STABLE from about 2000-08-01 IBM Tp570E + 3Com 3C574 cardc.c: "$FreeBSD: src/usr.sbin/pccard/pccardd/cardd.c,v 1.46.2.4 2000/07/18 04:59:39 imp Exp $"; >Description: If pccardd fails to allocate I/O space when you insert a card it will release the cards I/O space in the wrong place when you remove it. >How-To-Repeat: Make an pccard.conf with to little I/O space: ------------------------------------------------ # PCCARD configuration file # # Removing all IRQ conflicts from this file can't be done because of some # IRQ-selfish PC-cards. So if you want to use some of these cards in # your machine, you will be forced to modify their IRQ parameters from # the following list. # # IRQ == 0 means "allocate free IRQ from IRQ pool" # IRQ == 16 means "do not use IRQ (e.g. PIO mode)" # # # Generally available IO ports io 0x300-0x310 # Generally available IRQs (Built-in sound-card owners remove 5) irq 3 5 # Available memory slots memory 0xd4000 96k # debuglevel 9 # 3Com Megahertz 574B card "3Com" "Megahertz 574B" config 0x1 "ep0" ? 0x1 insert /etc/pccard_ether $device remove /sbin/ifconfig $device delete ------------------------------------------------ Insert card: Aug 7 14:27:59 bigblue pccardd[47]: Card "3Com"("Megahertz 574B") [B] [001] matched "3Com" ("Megahertz 574B") [(null)] [(null)] Aug 7 14:27:59 bigblue pccardd[47]: Resource allocation failure for 3Com Remove card: Aug 7 14:28:08 bigblue /kernel: pccard: card removed, slot 1 Aug 7 14:28:08 bigblue pccardd[47]: ep0: 3Com (Megahertz 574B) removed. Aug 7 14:28:08 bigblue pccardd[47]: Releasing I/O addr 0x0, size 32 (I have added the above log message) Insert card again: Aug 7 14:28:21 bigblue /kernel: pccard: card inserted, slot 1 Machine either crashes or hangs. >Fix: Works for me, but might not be the best solution: *** cardd.c.orig Thu Aug 3 17:15:21 2000 --- cardd.c Mon Aug 7 14:59:14 2000 *************** *** 204,213 **** sp->cis = 0; sp->config = 0; /* release io */ ! bit_nset(io_avail, sp->io.addr, sp->io.addr + sp->io.size - 1); /* release irq */ ! if (sp->irq) pool_irq[sp->irq] = 1; } /* CIS string comparison */ --- 204,218 ---- sp->cis = 0; sp->config = 0; /* release io */ ! if(sp->io.addr) { ! logmsg("Releasing I/O addr 0x%x, size %d\n", sp->io.addr, sp->io.size); ! bit_nset(io_avail, sp->io.addr, sp->io.addr + sp->io.size - 1); ! } /* release irq */ ! if (sp->irq) { ! logmsg("Releasing IRQ %d\n", sp->irq); pool_irq[sp->irq] = 1; + } } /* CIS string comparison */ >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->imp Responsible-Changed-By: sheldonh Responsible-Changed-When: Mon Aug 7 06:20:03 PDT 2000 Responsible-Changed-Why: Over to the maintainer. http://www.freebsd.org/cgi/query-pr.cgi?pr=20454 From: MIHIRA Sanpei Yoshiro To: freebsd-gnats-submit@FreeBSD.org, pa@cdg.chalmers.se Cc: Subject: Re: bin/20454: pccardd looses track of available I/O space Date: Mon, 02 Oct 2000 23:47:09 +0900 I created below patch for Per Andersson's bug report. How about this patch, Warner-san and Andersson-san? obtained from PAO3 --- MIHIRA, Sanpei Yoshiro Yokohama, Japan. Index: src/usr.sbin/pccard/pccardd/cardd.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/pccard/pccardd/cardd.c,v retrieving revision 1.60 diff -u -r1.60 cardd.c --- src/usr.sbin/pccard/pccardd/cardd.c 2000/10/01 12:36:14 1.60 +++ src/usr.sbin/pccard/pccardd/cardd.c 2000/10/02 14:24:39 @@ -192,6 +192,7 @@ card_removed(struct slot *sp) { struct card *cp; + struct allocblk *sio; int in_use = 0; if (sp->config && sp->config->driver && sp->card) @@ -210,10 +211,14 @@ sp->cis = 0; sp->config = 0; /* release io */ - bit_nset(io_avail, sp->io.addr, sp->io.addr + sp->io.size - 1); + if (sp->flags & IO_ASSIGNED) + for (sio = &sp->io; sio; sio = sio->next) + if (sio->addr && sio->size) + bit_nset(io_avail, sio->addr, sio->addr + sio->size - 1); /* release irq */ - if (sp->irq) - pool_irq[sp->irq] = 1; + if (sp->flags & IRQ_ASSIGNED) + if (sp->irq >= 1 && sp->irq <= 15) + pool_irq[sp->irq] = 1; } /* CIS string comparison */ From: Per Andersson To: MIHIRA Sanpei Yoshiro Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: bin/20454: pccardd looses track of available I/O space Date: Wed, 4 Oct 2000 17:01:29 +0200 (MET DST) On Mon, 2 Oct 2000, MIHIRA Sanpei Yoshiro wrote: > I created below patch for Per Andersson's bug report. > How about this patch, Warner-san and Andersson-san? obtained from > PAO3 It looks OK as far as I can see (I'm running -stable, and patched the version i have (cardd.c 1.46.2.5) and it seems to have solved the problem. /Per Andersson State-Changed-From-To: open->closed State-Changed-By: sanpei State-Changed-When: Wed Oct 4 08:22:07 PDT 2000 State-Changed-Why: Committed in rev 1.61 usr.sbin/pccard/pccardd/cardd.c http://www.freebsd.org/cgi/query-pr.cgi?pr=20454 >Unformatted: