Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Aug 2000 15:07:12 +0200 (CEST)
From:      pa@cdg.chalmers.se
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/20454: pccardd looses track of available I/O space
Message-ID:  <200008071307.PAA00340@bigblue.cdg.chalmers.se>

next in thread | raw e-mail | index | archive | help

>Number:         20454
>Category:       bin
>Synopsis:       pccardd looses track of available I/O space
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 07 06:10:05 PDT 2000
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008071307.PAA00340>