Date: Sat, 29 Jan 2000 11:05:47 +0000 (GMT) From: Doug Rabson <dfr@nlsystems.com> To: Warner Losh <imp@village.org> Cc: YAMAMOTO Shigeru <shigeru@iij.ad.jp>, freebsd-hackers@FreeBSD.ORG Subject: Re: how to allocate an alined address for a device? Message-ID: <Pine.BSF.4.10.10001291105190.25770-100000@salmon.nlsystems.com> In-Reply-To: <200001282335.QAA65386@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 28 Jan 2000, Warner Losh wrote: > In message <Pine.BSF.4.10.10001281024320.25770-100000@salmon.nlsystems.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.10001291105190.25770-100000>