From owner-freebsd-current Thu Nov 9 12:22: 8 2000 Delivered-To: freebsd-current@freebsd.org Received: from mailout04.sul.t-online.com (mailout04.sul.t-online.com [194.25.134.18]) by hub.freebsd.org (Postfix) with ESMTP id 9EE6A37B479 for ; Thu, 9 Nov 2000 12:22:03 -0800 (PST) Received: from fwd07.sul.t-online.com by mailout04.sul.t-online.com with smtp id 13tyCw-0003Jy-01; Thu, 09 Nov 2000 21:22:02 +0100 Received: from server.rock.net (340029380333-0001@[62.224.217.80]) by fwd07.sul.t-online.com with esmtp id 13tyCj-0H3200C; Thu, 9 Nov 2000 21:21:49 +0100 Received: from t-online.de (server [172.23.7.1]) by server.rock.net (8.9.3+Sun/8.9.3/Rock) with ESMTP id VAA06450 for ; Thu, 9 Nov 2000 21:21:33 +0100 (MET) Message-ID: <3A0B074D.4413FDB1@t-online.de> Date: Thu, 09 Nov 2000 21:21:33 +0100 From: Daniel Rock X-Mailer: Mozilla 4.7 [de] (X11; U; SunOS 5.8 i86pc) X-Accept-Language: de, en MIME-Version: 1.0 To: current@freebsd.org Subject: ISA PnP resource allocation Content-Type: multipart/mixed; boundary="------------14BB548DC94021107317A01B" X-Sender: 340029380333-0001@t-dialin.net Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Dies ist eine mehrteilige Nachricht im MIME-Format. --------------14BB548DC94021107317A01B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Now that someone has implementented resource alignment in the resource allocator, someone could review and integrate the attached patch. Background: I do have an old system with several PnP devices. Two of the request the following IO ports: first device: port range 0x100-0x3ff size=1 align=1 second device: port range 0x100-0x3f0 size=8 align=8 The first device gets port 0x100-0x100 allocated. Then the code in isa_common.c tries to allocate the ports for the second device. 0x100 is already used, so it gets the next free range: 0x101-0x108, ignoring the alignment constraints. The general problem in the code /sys/isa_common.c isa_find_port(), isa_find_memory(), etc. The loops in these routines try to honor the alignment constraints but the real work is done in /sys/subr_rman.c. Regardless of resource usage the for(...)-look in above functions is only run once. I already filed a PR for this problem but my first solution was a real hack (kern/21461). [another solution would be to introduce another flag for rman_reserve_resource() not to search for alternate regions. Daniel --------------14BB548DC94021107317A01B Content-Type: text/plain; charset=us-ascii; name="sys.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sys.diff" Index: isa/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/isa_common.c 2000/07/12 00:42:08 1.18 +++ isa/isa_common.c 2000/11/09 20:11:31 @@ -207,10 +207,10 @@ start, size); res[i] = bus_alloc_resource(child, SYS_RES_IOPORT, &i, - 0, ~0, 1, 0 /* !RF_ACTIVE */); + 0, ~0, 1, rman_make_alignment_flags(align)/* !RF_ACTIVE */); if (res[i]) { - result->ic_port[i].ir_start = start; - result->ic_port[i].ir_end = start + size - 1; + result->ic_port[i].ir_start = res[i]->r_start; + result->ic_port[i].ir_end = res[i]->r_start + size - 1; result->ic_port[i].ir_size = size; result->ic_port[i].ir_align = align; break; --------------14BB548DC94021107317A01B-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message