Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Mar 2000 21:38:51 +0200
From:      "D. Rock" <rock@dead-end.net>
To:        current@freebsd.org
Subject:   Resource allocation error in new pnp code
Message-ID:  <38E10A4B.129A7C27@dead-end.net>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------53A353B57F098AF27051730B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I already mentioned this bug a few months ago but didn't got a reply. Maybe
I'm the only one who is affected by this bug.

I have several PnP cards in my system (see attached output of pnpinfo).

Especially one card requests a resource:

    I/O Range 0x100 .. 0x3ff, alignment 0x1, len 0x1
        [16-bit addr]

My ISDN controller also requests a resource from this range:
    I/O Range 0x100 .. 0x3f0, alignment 0x8, len 0x8
        [not 16-bit addr]

Now the following happens:
first card gets assigned:
Mar 28 21:12:00 gate /kernel: unknown10: <EEPROM> at port 0x100 on isa0
and the ISDN card gets assigned:
Mar 28 21:12:00 gate /kernel: isic0: <Sedlbauer WinSpeed> at port 0x101-0x108
irq 11 on isa0

which is wrong since it requests an alignment of 8. The code in
/sys/isa/isa_common.c, which should prevent this is useless, since most
work is done in /sys/kern/subr_rman.c which automatically tries to find
an alternate region, but without honouring any alignment.

Also attached is my (ugly) hack for this problem, but I think the problem
should be addressed elsewhere (in the resource manager), since it may affect
any type of resource allocation which requires different alignment.

-- 
Daniel
--------------53A353B57F098AF27051730B
Content-Type: text/plain; charset=us-ascii;
 name="pnpinfo"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="pnpinfo"

Checking for Plug-n-Play devices...

Card assigned CSN #1
Vendor ID AZT3002 (0x02305407), Serial Number 0xffffffff
PnP Version 1.0, Vendor Version 1
Device Description: AZT3002 PnP SOUND DEVICE

Logical Device ID: AZT0500 0x00055407 #0
	Device supports I/O Range Check
Device Description: IDE CDROM DISABLED
TAG Start DF
Good Configuration
    I/O Range 0x0 .. 0x0, alignment 0x8, len 0x0
	[16-bit addr]
    I/O Range 0x0 .. 0x0, alignment 0x2, len 0x0
	[16-bit addr]
    IRQ: IRQ: High true edge sensitive
TAG End DF

Logical Device ID: AZT1004 0x04105407 #1
	Device supports I/O Range Check
Device Description: AUDIO
TAG Start DF
Good Configuration
    I/O Range 0x220 .. 0x220, alignment 0x10, len 0x10
	[16-bit addr]
    I/O Range 0x388 .. 0x388, alignment 0x8, len 0x8
	[16-bit addr]
    I/O Range 0x534 .. 0x534, alignment 0x4, len 0x4
	[16-bit addr]
    IRQ: 5 IRQ: High true edge sensitive
    DMA: channel(s) 1 
	8-bit, not a bus master, count by byte, , Compatibility mode
    DMA: channel(s) 3 
	8-bit, not a bus master, count by byte, , Compatibility mode
TAG Start DF
    I/O Range 0x220 .. 0x240, alignment 0x20, len 0x10
	[16-bit addr]
    I/O Range 0x388 .. 0x388, alignment 0x8, len 0x8
	[16-bit addr]
    I/O Range 0x534 .. 0x608, alignment 0xd4, len 0x4
	[16-bit addr]
    IRQ: 5 9 10 IRQ: High true edge sensitive
    DMA: channel(s) 0 1 3 
	8-bit, not a bus master, count by byte, , Compatibility mode
    DMA: channel(s) 0 1 3 
	8-bit, not a bus master, count by byte, , Compatibility mode
TAG Start DF
    I/O Range 0x220 .. 0x240, alignment 0x20, len 0x10
	[16-bit addr]
    I/O Range 0x388 .. 0x388, alignment 0x8, len 0x8
	[16-bit addr]
    I/O Range 0xe84 .. 0xf44, alignment 0xc0, len 0x4
	[16-bit addr]
    IRQ: 5 9 10 IRQ: High true edge sensitive
    DMA: channel(s) 0 1 3 
	8-bit, not a bus master, count by byte, , Compatibility mode
    DMA: channel(s) 0 1 3 
	8-bit, not a bus master, count by byte, , Compatibility mode
TAG Start DF
    I/O Range 0x100 .. 0x3f0, alignment 0x10, len 0x10
	[16-bit addr]
    I/O Range 0x100 .. 0x3f8, alignment 0x8, len 0x8
	[16-bit addr]
    I/O Range 0x100 .. 0xffc, alignment 0x4, len 0x4
	[16-bit addr]
    IRQ: 5 9 10 11 15 IRQ: High true edge sensitive
    DMA: channel(s) 0 1 3 
	8-bit, not a bus master, count by byte, , Compatibility mode
    DMA: channel(s) 0 1 3 
	8-bit, not a bus master, count by byte, , Compatibility mode
TAG Start DF
    I/O Range 0x100 .. 0x3f0, alignment 0x10, len 0x10
	[16-bit addr]
    I/O Range 0x100 .. 0x3f8, alignment 0x8, len 0x8
	[16-bit addr]
    I/O Range 0x100 .. 0xffc, alignment 0x4, len 0x4
	[16-bit addr]
    IRQ: 5 9 10 11 15 IRQ: High true edge sensitive
    DMA: channel(s) 0 1 3 
	8-bit, not a bus master, count by byte, , Compatibility mode
TAG End DF

Logical Device ID: AZT2001 0x01205407 #2
	Device supports I/O Range Check
Device Description: MPU401 MIDI
TAG Start DF
Good Configuration
    I/O Range 0x330 .. 0x330, alignment 0x2, len 0x2
	[16-bit addr]
    IRQ: 9 IRQ: High true edge sensitive
TAG Start DF
    I/O Range 0x300 .. 0x330, alignment 0x30, len 0x2
	[16-bit addr]
    IRQ: 5 9 10 11 15 IRQ: High true edge sensitive
TAG Start DF
    I/O Range 0x100 .. 0x3fe, alignment 0x2, len 0x2
	[16-bit addr]
    IRQ: 5 9 10 11 15 IRQ: High true edge sensitive
TAG End DF

Logical Device ID: AZT3001 0x01305407 #3
	Device supports I/O Range Check
Device Description: GAME PORT
TAG Start DF
Good Configuration
    I/O Range 0x200 .. 0x200, alignment 0x8, len 0x8
	[16-bit addr]
TAG Start DF
    I/O Range 0x208 .. 0x208, alignment 0x8, len 0x8
	[16-bit addr]
TAG End DF

Logical Device ID: AZT4003 0x03405407 #4
	Device supports I/O Range Check
Device Description: MODEM
TAG Start DF
Good Configuration
    I/O Range 0x3e8 .. 0x3e8, alignment 0x8, len 0x8
	[16-bit addr]
    IRQ: 3 4 5 9 10 11 15 IRQ: High true edge sensitive
TAG Start DF
    I/O Range 0x2f8 .. 0x2f8, alignment 0x8, len 0x8
	[16-bit addr]
    IRQ: 3 IRQ: High true edge sensitive
TAG Start DF
    I/O Range 0x3f8 .. 0x3f8, alignment 0x8, len 0x8
	[16-bit addr]
    IRQ: 3 4 5 9 10 11 15 IRQ: High true edge sensitive
TAG Start DF
    I/O Range 0x2e8 .. 0x2e8, alignment 0x8, len 0x8
	[16-bit addr]
    IRQ: 3 4 5 9 10 11 15 IRQ: High true edge sensitive
TAG Start DF
    I/O Range 0x100 .. 0x3f8, alignment 0x8, len 0x8
	[16-bit addr]
    IRQ: 3 4 5 9 10 11 15 IRQ: High true edge sensitive
TAG End DF

Logical Device ID: AZT5001 0x01505407 #5
	Device supports I/O Range Check
Device Description: EEPROM
TAG Start DF
Good Configuration
    I/O Range 0x100 .. 0x3ff, alignment 0x1, len 0x1
	[16-bit addr]
TAG End DF
End Tag

Successfully got 88 resources, 6 logical fdevs
-- card select # 0x0001

CSN AZT3002 (0x02305407), Serial Number 0xffffffff

Logical device #0
IO:  0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
IRQ 0 0
DMA 4 4
IO range check 0x00 activate 0x00

Logical device #1
IO:  0x0388 0x0388 0x0388 0x0388 0x0388 0x0388 0x0388 0x0388
IRQ 5 0
DMA 0 1
IO range check 0x00 activate 0x01

Logical device #2
IO:  0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
IRQ 9 0
DMA 4 4
IO range check 0x00 activate 0x01

Logical device #3
IO:  0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
IRQ 0 0
DMA 4 4
IO range check 0x00 activate 0x01

Logical device #4
IO:  0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
IRQ 10 0
DMA 4 4
IO range check 0x00 activate 0x01

Logical device #5
IO:  0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
IRQ 0 0
DMA 4 4
IO range check 0x00 activate 0x01

Card assigned CSN #2
Vendor ID SAG0001 (0x0100274c), Serial Number 0x050044b0
PnP Version 1.0, Vendor Version 1
Device Description: speed win SEDLBAUER AG

Logical Device ID: SAG0001 0x0100274c #0
	Device supports I/O Range Check
TAG Start DF
    I/O Range 0x100 .. 0x3f0, alignment 0x8, len 0x8
	[not 16-bit addr]
    IRQ: 3 4 5 7 10 11 12 13 15  - only one type (true/edge)
TAG Start DF
    I/O Range 0x100 .. 0x3f0, alignment 0x8, len 0x8
	[not 16-bit addr]
    IRQ: 5  - only one type (true/edge)
TAG Start DF
    I/O Range 0x100 .. 0x3f0, alignment 0x8, len 0x8
	[not 16-bit addr]
    IRQ: 7  - only one type (true/edge)
TAG End DF
End Tag

Successfully got 13 resources, 1 logical fdevs
-- card select # 0x0002

CSN SAG0001 (0x0100274c), Serial Number 0x050044b0

Logical device #0
IO:  0x0108 0x0108 0x0108 0x0108 0x0108 0x0108 0x0108 0x0108
IRQ 11 0
DMA 4 0
IO range check 0x00 activate 0x01

--------------53A353B57F098AF27051730B
Content-Type: text/plain; charset=us-ascii;
 name="isa_common.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="isa_common.diff"

Index: isa_common.c
===================================================================
RCS file: /data/cvs/src/sys/isa/isa_common.c,v
retrieving revision 1.16
diff -u -r1.16 isa_common.c
--- isa_common.c	2000/02/11 04:35:07	1.16
+++ isa_common.c	2000/03/28 19:26:44
@@ -207,6 +207,13 @@
 						    SYS_RES_IOPORT, &i,
 						    0, ~0, 1, 0 /* !RF_ACTIVE */);
 			if (res[i]) {
+				/* HACK */
+				if(res[i]->r_start != start) {
+					bus_release_resource(child,
+							SYS_RES_IOPORT, i,
+							res[i]);
+					continue;
+				}
 				result->ic_port[i].ir_start = start;
 				result->ic_port[i].ir_end = start + size - 1;
 				result->ic_port[i].ir_size = size;

--------------53A353B57F098AF27051730B--



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38E10A4B.129A7C27>