From owner-freebsd-hackers Sat Jan 29 3: 7:13 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by hub.freebsd.org (Postfix) with ESMTP id 9044F14F88 for ; Sat, 29 Jan 2000 03:07:09 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from nlsys.demon.co.uk ([158.152.125.33] helo=herring.nlsystems.com) by anchor-post-34.mail.demon.net with esmtp (Exim 2.12 #1) id 12EVid-000Ke3-0Y; Sat, 29 Jan 2000 11:07:08 +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 LAA79209; Sat, 29 Jan 2000 11:10:09 GMT (envelope-from dfr@nlsystems.com) Date: Sat, 29 Jan 2000 11:05:47 +0000 (GMT) From: Doug Rabson To: Warner Losh Cc: YAMAMOTO Shigeru , freebsd-hackers@FreeBSD.ORG Subject: Re: how to allocate an alined address for a device? In-Reply-To: <200001282335.QAA65386@harmony.village.org> 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, Warner Losh wrote: > In message Doug Rabson writes: > : 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(). > > Well, with just 6 bits one could handle any alignment requirement up > to 2^(2^6). > > We have 6 bits left. If this were the alignment requirement, a value > of 0 would mean 2^0 or 1, which is the current behavior. More > restrictive alignment requirements could be encoded easily. No ABI or > API change needed. > > #define RF_ALIGNMENT_MASK 0xfc00 > #define RF_ALIGNMENT_SHIFT 10 > #define RF_ALIGNMENT_LOG2(x) (x << RF_ALIGNMENT_SHIFT) That seems reasonable. We should implement this right after 4.0 is done. -- 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