From owner-freebsd-hackers Tue Oct 9 18:15:56 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from prism.flugsvamp.com (cb58709-a.mdsn1.wi.home.com [24.17.241.9]) by hub.freebsd.org (Postfix) with ESMTP id 4556A37B403 for ; Tue, 9 Oct 2001 18:15:47 -0700 (PDT) Received: (from jlemon@localhost) by prism.flugsvamp.com (8.11.0/8.11.0) id f9A1G4i42222; Tue, 9 Oct 2001 20:16:04 -0500 (CDT) (envelope-from jlemon) Date: Tue, 9 Oct 2001 20:16:04 -0500 From: Jonathan Lemon To: "Eugene M. Kim" Cc: Jonathan Lemon , hackers@freebsd.org Subject: Re: VM question (I hate Intel 810/815 chipsets...) Message-ID: <20011009201604.D75389@prism.flugsvamp.com> References: <200110100037.f9A0bfv40852@prism.flugsvamp.com> <20011009180841.A26019@alicia.nttmcl.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i In-Reply-To: <20011009180841.A26019@alicia.nttmcl.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG It sounds like the right approach to me. I'm assuming that you'll be writing a kernel driver for the memory, which has a mmap entry point in the cdevsw. The driver's mmap routine would just return the address of the contigmalloc region. I believe that the bktr driver has an example of this approach. -- Jonathan On Tue, Oct 09, 2001 at 06:08:41PM -0700, Eugene M. Kim wrote: > Thank you for the reply. > > I also found contigmalloc() shortly after I posted the original question > (what an embarrassment ;-p), then met another restriction: Because these > memory regions are to be accessed by a userland process (X server), they > have to be somehow mapped into the user space. So far it seems I would > have to do something similar to vm_mmap(), but I'm not sure if this is a > right direction. Do you have any suggestions? > > Cheers, > Eugene > > On Tue, Oct 09, 2001 at 07:37:41PM -0500, Jonathan Lemon wrote: > > > > > > In article you write: > > >What would be the best way to allocate: > > > > > >1) a VM page whose physical address falls within a certain boundary, and > > >2) a VM object whose pages are contiguous in physical address space? > > > > > >Background: > > >The !@*%^*!&#^%*&!#^$!@ Intel 810/815 graphics controller requires its > > >instruction and hardware cursor buffers to reside within first 32MB and > > >512MB of *physical* memory space respectively. :( :( ;( The XFree86 > > >driver assumes the Linux memory model (virtual addr == physical addr), > > >so it runs on Linux, but not always on FreeBSD. > > > > You probably want contigmalloc(), which allocates a range of memory > > which is physically contiguous. (assuming this is a in-kernel driver) > > > > void * > > contigmalloc( > > unsigned long size, /* should be size_t here and for malloc() */ > > struct malloc_type *type, > > int flags, > > unsigned long low, > > unsigned long high, > > unsigned long alignment, > > unsigned long boundary) > > > > -- > > Jonathan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message