From owner-freebsd-hackers Fri Jan 28 4: 7:14 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by hub.freebsd.org (Postfix) with ESMTP id 7224114DCD for ; Fri, 28 Jan 2000 04:06:59 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from nlsys.demon.co.uk ([158.152.125.33] helo=herring.nlsystems.com) by anchor-post-30.mail.demon.net with esmtp (Exim 2.12 #1) id 12E8fC-0009r5-0U; Fri, 28 Jan 2000 10:30:02 +0000 Received: from salmon.nlsystems.com (salmon.nlsystems.com [10.0.0.3]) by herring.nlsystems.com (8.9.3/8.8.8) with ESMTP id KAA10785; Fri, 28 Jan 2000 10:32:50 GMT (envelope-from dfr@nlsystems.com) Date: Fri, 28 Jan 2000 10:28:44 +0000 (GMT) From: Doug Rabson To: YAMAMOTO Shigeru Cc: imp@village.org, freebsd-hackers@freebsd.org Subject: Re: how to allocate an alined address for a device? In-Reply-To: <20000128134310D.shigeru@iij.ad.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 28 Jan 2000, YAMAMOTO Shigeru wrote: > > >>>>> "Warner" == Warner Losh writes: > Warner> In a cardbus system, one would force the alignment in the card bus > Warner> bridge. It would reject those things that aren't aligned in a sane > Warner> manner for cardbus. It would try again to get a different range, if > Warner> possible, or would reject the attempt. > > I think it is no good to try again to get a different range. > Because, a different system has a different free address range and a device > dirver can not know where is a free address range. > > So I change rman_reserve_resource() in @src/sys/kern/subr_rman.c for we can > allocate an aligned address. > > My idea is using high bits of flags. > RF_ALIGN_XXX in aflags specifies an alignment request and an alignment > size. > Bad point of my idea is that we need to use a different bit for each an > alignment size. > > This is a patch for @src/sys/kern/subr_rman.c (rev. 1.10) and > @src/sys/sys/rman.h (rev. 1.5) > > Is my idea good or not? I'm uneasy about using the flags for this since I'm vaguely reserving the upper 16 bits of flags for bus-specific purposes (although I haven't formalised this). For allocating aligned regions with pnp, I simply looped in the caller trying each specific range until one was free (see isa_find_port() in isa_common.c). This is ugly but it does work. In the long run, I think we need either an extra parameter to rman_reserve_resource() or a new api rman_reserve_resource_aligned(). This also implies changing the method BUS_ALLOC_RESOURCE() or adding BUS_ALLOC_RESOURCE_ALIGNED(). -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 442 9037 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message