Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2000 10:28:44 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        YAMAMOTO Shigeru <shigeru@iij.ad.jp>
Cc:        imp@village.org, freebsd-hackers@freebsd.org
Subject:   Re: how to allocate an alined address for a device? 
Message-ID:  <Pine.BSF.4.10.10001281024320.25770-100000@salmon.nlsystems.com>
In-Reply-To: <20000128134310D.shigeru@iij.ad.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 28 Jan 2000, YAMAMOTO Shigeru wrote:

> 
> >>>>> "Warner" == Warner Losh <Warner> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.10001281024320.25770-100000>