From owner-freebsd-hackers Fri Jan 28 15:35:26 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id 3BF1215088 for ; Fri, 28 Jan 2000 15:35:21 -0800 (PST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.9.3/8.9.3) with ESMTP id QAA13135; Fri, 28 Jan 2000 16:35:19 -0700 (MST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id QAA65386; Fri, 28 Jan 2000 16:35:37 -0700 (MST) Message-Id: <200001282335.QAA65386@harmony.village.org> To: Doug Rabson Subject: Re: how to allocate an alined address for a device? Cc: YAMAMOTO Shigeru , freebsd-hackers@FreeBSD.ORG In-reply-to: Your message of "Fri, 28 Jan 2000 10:28:44 GMT." References: Date: Fri, 28 Jan 2000 16:35:37 -0700 From: Warner Losh Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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) Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message