From owner-freebsd-current Tue Nov 14 13:55:54 2000 Delivered-To: freebsd-current@freebsd.org Received: from mailout06.sul.t-online.com (mailout06.sul.t-online.com [194.25.134.19]) by hub.freebsd.org (Postfix) with ESMTP id E1AED37B479; Tue, 14 Nov 2000 13:55:39 -0800 (PST) Received: from fwd03.sul.t-online.com by mailout06.sul.t-online.com with smtp id 13vo2y-0008FE-04; Tue, 14 Nov 2000 22:55:20 +0100 Received: from server.rock.net (340029380333-0001@[62.158.15.14]) by fwd03.sul.t-online.com with esmtp id 13vo2n-1CmCZsC; Tue, 14 Nov 2000 22:55:09 +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 WAA06457; Tue, 14 Nov 2000 22:54:44 +0100 (MET) Message-ID: <3A11B4A4.6503FB73@t-online.de> Date: Tue, 14 Nov 2000 22:54:44 +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: Warner Losh Cc: current@FreeBSD.ORG, msmith@FreeBSD.ORG Subject: Re: ISA PnP resource allocation References: <3A0B074D.4413FDB1@t-online.de> <200011122030.NAA00596@harmony.village.org> Content-Type: multipart/mixed; boundary="------------EDAA6796BB99784501A2885F" 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. --------------EDAA6796BB99784501A2885F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Warner Losh schrieb: > > In message <3A0B074D.4413FDB1@t-online.de> Daniel Rock writes: > : 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. > > Would the alignment stuff I added for cardbus help any? I think, my patch basically uses now the same alignment options from the resource manager like cardbus does now. I have cleaned up the code a little bit: Now the code uses the rman_get_XXX() macros and also checks if the region returned is below the end mark. Daniel --------------EDAA6796BB99784501A2885F Content-Type: text/plain; charset=us-ascii; name="sys.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sys.diff" Index: sys/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 --- sys/isa/isa_common.c 2000/07/12 00:42:08 1.18 +++ sys/isa/isa_common.c 2000/11/14 21:27:34 @@ -133,31 +133,30 @@ result->ic_nmem = config->ic_nmem; for (i = 0; i < config->ic_nmem; i++) { u_int32_t start, end, size, align; - for (start = config->ic_mem[i].ir_start, - end = config->ic_mem[i].ir_end, - size = config->ic_mem[i].ir_size, - align = config->ic_mem[i].ir_align; - start + size - 1 <= end; - start += align) { - bus_set_resource(child, SYS_RES_MEMORY, i, - start, size); - res[i] = bus_alloc_resource(child, - SYS_RES_MEMORY, &i, - 0, ~0, 1, 0 /* !RF_ACTIVE */); - if (res[i]) { - result->ic_mem[i].ir_start = start; - result->ic_mem[i].ir_end = start + size - 1; - result->ic_mem[i].ir_size = size; - result->ic_mem[i].ir_align = align; + + start = config->ic_mem[i].ir_start; + end = config->ic_mem[i].ir_end; + size = config->ic_mem[i].ir_size; + align = config->ic_mem[i].ir_align; + if(!align) + align = 1; + bus_set_resource(child, SYS_RES_MEMORY, i, + start, size); + res[i] = bus_alloc_resource(child, + SYS_RES_MEMORY, &i, + 0, ~0, 1, + rman_make_alignment_flags(align)); + if (res[i]) { + if(rman_get_start(res[i]) > end) { + success = 0; break; } + result->ic_mem[i].ir_start = rman_get_start(res[i]); + result->ic_mem[i].ir_end = rman_get_end(res[i]); + result->ic_mem[i].ir_size = rman_get_size(res[i]); + result->ic_mem[i].ir_align = align; } - - /* - * If we didn't find a place for memory range i, then - * give up now. - */ - if (!res[i]) { + else { success = 0; break; } @@ -197,31 +196,31 @@ result->ic_nport = config->ic_nport; for (i = 0; i < config->ic_nport; i++) { u_int32_t start, end, size, align; - for (start = config->ic_port[i].ir_start, - end = config->ic_port[i].ir_end, - size = config->ic_port[i].ir_size, - align = config->ic_port[i].ir_align; - start + size - 1 <= end; - start += align) { - bus_set_resource(child, SYS_RES_IOPORT, i, - start, size); - res[i] = bus_alloc_resource(child, - SYS_RES_IOPORT, &i, - 0, ~0, 1, 0 /* !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_size = size; - result->ic_port[i].ir_align = align; + + start = config->ic_port[i].ir_start; + end = config->ic_port[i].ir_end; + size = config->ic_port[i].ir_size; + align = config->ic_port[i].ir_align; + if(!align) + align = 1; + + bus_set_resource(child, SYS_RES_IOPORT, i, + start, size); + res[i] = bus_alloc_resource(child, + SYS_RES_IOPORT, &i, + 0, ~0, 1, + rman_make_alignment_flags(align)); + if (res[i]) { + if(rman_get_start(res[i]) > end) { + success = 0; break; } + result->ic_port[i].ir_start = rman_get_start(res[i]); + result->ic_port[i].ir_end = rman_get_end(res[i]); + result->ic_port[i].ir_size = rman_get_size(res[i]); + result->ic_port[i].ir_align = align; } - - /* - * If we didn't find a place for port range i, then - * give up now. - */ - if (!res[i]) { + else { success = 0; break; } --------------EDAA6796BB99784501A2885F-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message