From owner-freebsd-new-bus Wed Dec 29 2:36: 4 1999 Delivered-To: freebsd-new-bus@freebsd.org Received: from herring.nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (Postfix) with ESMTP id DAE6215605 for ; Wed, 29 Dec 1999 02:36:00 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from salmon.nlsystems.com (salmon.nlsystems.com [10.0.0.3]) by herring.nlsystems.com (8.9.3/8.8.8) with ESMTP id KAA25175; Wed, 29 Dec 1999 10:36:17 GMT (envelope-from dfr@nlsystems.com) Date: Wed, 29 Dec 1999 10:36:05 +0000 (GMT) From: Doug Rabson To: Warner Losh Cc: new-bus@freebsd.org Subject: Re: Another question In-Reply-To: <199912290939.CAA01692@harmony.village.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-new-bus@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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