Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Sep 2000 11:52:42 -0700 (PDT)
From:      D.Rock@gmx.de
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/21461: ISA PnP resource allocator problem
Message-ID:  <20000921185242.672E837B424@hub.freebsd.org>

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

>Number:         21461
>Category:       kern
>Synopsis:       ISA PnP resource allocator problem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 21 12:00:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Daniel Rock
>Release:        5.0-CURRENT (cvsup'd yesterday)
>Organization:
>Environment:
FreeBSD gate.rock.net 5.0-CURRENT FreeBSD 5.0-CURRENT #465: Thu Sep 21 20:37:32 CEST 2000     root@gate.rock.net:/usr/src/sys/compile/ROCK  i386

>Description:
if a resource is already held by another PnP device, the code in
/sys/kern/subr_rman.c automatically tries to find another region, but
doesn't honour alignment requirements. The code in /sys/isa/isa_common.c
(function isa_find_port()) is therefor pretty useless.

This code is present in the system since FreeBSD switched to the new PnP
code (about a year ago)
>How-To-Repeat:
I have different ISA PnP devices in my system (output from pnpinfo):

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

   I/O Range 0x100 .. 0x3f0, alignment 0x8, len 0x8
        [not 16-bit addr]

For the first device the I/O port 0x100 is allocated. This port isn't
available for the second device, but the code in /sys/kern/subr_rman.c
automatically "finds" an area large enough at 0x101, but doesn't know
the alignment constraint. Instead the second device should be allocated
at 0x108-0x10f

Wrong boot output:
unknown10: <EEPROM> at port 0x100 on isa0
isic0: <Sedlbauer WinSpeed> at port 0x101-0x108 irq 11 on isa0

should be:
unknown10: <EEPROM> at port 0x100 on isa0
isic0: <Sedlbauer WinSpeed> at port 0x108-0x10f irq 11 on isa0

>Fix:
The following code releases the region if it is not exactly the one
requested, which was the original intention of the code but didn't
work because of the additional "intelligence" by the resource allocator.

Quick - but ugly - hack (worked for me since I discovered the bug):

Index: isa_common.c
===================================================================
RCS file: /data/cvs/src/sys/isa/isa_common.c,v
retrieving revision 1.18
diff -u -r1.18 isa_common.c
--- isa_common.c        2000/07/12 00:42:08     1.18
+++ isa_common.c        2000/09/21 18:37:14
@@ -209,6 +209,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;


>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?20000921185242.672E837B424>