| Summary: | pccardd looses track of available I/O space | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | pa <pa> | ||||
| Component: | bin | Assignee: | Warner Losh <imp> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.1-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: freebsd-bugs->imp Over to the maintainer. 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 */
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 Committed in rev 1.61 usr.sbin/pccard/pccardd/cardd.c |
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. Fix: Works for me, but might not be the best solution: 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.