Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2000 16:35:37 -0700
From:      Warner Losh <imp@village.org>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        YAMAMOTO Shigeru <shigeru@iij.ad.jp>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: how to allocate an alined address for a device? 
Message-ID:  <200001282335.QAA65386@harmony.village.org>
In-Reply-To: Your message of "Fri, 28 Jan 2000 10:28:44 GMT." <Pine.BSF.4.10.10001281024320.25770-100000@salmon.nlsystems.com> 
References:  <Pine.BSF.4.10.10001281024320.25770-100000@salmon.nlsystems.com>  

next in thread | previous in thread | raw e-mail | index | archive | help
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)

Warner


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?200001282335.QAA65386>