Date: Tue, 15 Feb 2005 13:53:43 -0700 (MST) From: Warner Losh <imp@bsdimp.com> To: gallatin@cs.duke.edu Cc: freebsd-hackers@freebsd.org Subject: Re: mapping small parts of a pci card to conserve KVA Message-ID: <20050215.135343.104086484.imp@bsdimp.com> In-Reply-To: <16914.22016.593790.719399@grasshopper.cs.duke.edu> References: <16914.22016.593790.719399@grasshopper.cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> I maintain drivers for a PCI card which presents itself as having > 16MB of address space. Eg: > > mx0: <Myrinet PCIXE> mem 0xf9000000-0xf9ffffff irq 20 at device 3.0 on pci1 > > However, most of that address space does not need to be mapped into > the host. Really, only a little over 2MB needs to be mapped (3 regions > with length 1024 bytes, 256 bytes, and 2MB). > > I've tried to re-write things so that I make multiple calls > to bus_alloc_resource() with the (hopefully) appropriate offset and > lengths. Eg: > > rid = PCIR_MAPS; > *res = bus_alloc_resource(is->arch.dev, SYS_RES_MEMORY, &rid, > (u_long)offset, > (u_long)(offset + len - 1), len, > RF_ACTIVE|PCI_RF_DENSE); > > At least on 5.3R, I seem to get back the same struct resource * from > each call. rman_get_virtual() returns a different kva for each > mapping, yet they all seem to map to the same physical address. > Eg, I call vtophys() on the results of rman_get_virtual(), > for each segment, and they all map to 0xf9000000. > > Is there a way to just map what I need? There's no way to map part of a resource currently. I'd like to create an API to do that, since it would be useful for a lot of things, but none exists today. As soon as bus_activate_resource is called, it gets mapped. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050215.135343.104086484.imp>