Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Dec 1999 10:36:05 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Warner Losh <imp@village.org>
Cc:        new-bus@freebsd.org
Subject:   Re: Another question
Message-ID:  <Pine.BSF.4.10.9912291028190.943-100000@salmon.nlsystems.com>
In-Reply-To: <199912290939.CAA01692@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 29 Dec 1999, Warner Losh wrote:

> 
> I have a question about a parent giving a child a portion of the
> address range that the parent has allocated for that child's use.
> 
> I've allocated a 16k chunk of system isa memory at the bridge level.
> >From time to time children need a hunk of this memory to map in their
> attribute memory.  The attribute memory has various config registers
> in it as well as the CIS.  My thinking on the matter was that I'd
> allocate the 16k chunk at bridge attach time, and then just give it
> out to the children who are requesting a memory area be mapped in as
> the default.  However, when I go to do this, the allocation fails
> because the bridge is holding the allocation.
> 
> What's the right new bus way to deal with this.  Is it to free the
> resource at the bridge level and give it to the child?  Is there some
> subspace mapping available that I've missed?

What you probably need to do is call the rman_* functions directly.
Allocate the 16k chunk with the parent as you do now, then define a new
resource manager using something like this:

	sc->attr_rman.rm_start = rman_get_start(res);
	sc->attr_rman.rm_end = rman_get_end(res);
	sc->attr_rman.rm_type = RMAN_ARRAY;
	sc->attr_rman.rm_descr = "Attribute memory";
	rman_init(&sc->attr_rman);
	rman_manage_region(&sc->attr_rman, rman_get_start(res),
			   rman_get_end(res));

You can then implement bus_alloc_resource etc. using rman functions such
as rman_reserve_resource() and rman_activate_resource().

> 
> Finally, the attribute memory on a pccard can be much bigger than the
> 4k window which the pcic bridge allows to be mapped at one time.  How
> does one specify a card relative offset using the new bus allocation
> routines (eg, I want to say "allocate this hunk of memory at the
> default place and start at offset 16k in the card's address space").
> I suppose I could come up with a kludge that moves the offset after it
> has been allocated/activated, but I thought I'd bounce things off the
> folks here.

I can't quite understand the question. Are you saying that there is a
window into a larger address range and that the window is mapped to a 4k
range of host addresses?

In that case, probably you will need a pccard-specific method on the
parent which the child can call to move the window around.

--
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-new-bus" 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.9912291028190.943-100000>