From owner-freebsd-hackers Wed Nov 6 23:54:28 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 992E937B401 for ; Wed, 6 Nov 2002 23:54:27 -0800 (PST) Received: from haystack.lclark.edu (haystack.lclark.edu [149.175.1.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17D6D43E7B for ; Wed, 6 Nov 2002 23:54:27 -0800 (PST) (envelope-from eta@lclark.edu) Received: from copeland-30-191.lclark.edu (anholt@copeland-30-191.lclark.edu [149.175.30.191]) by haystack.lclark.edu (8.9.3/8.9.3) with ESMTP id XAA25817; Wed, 6 Nov 2002 23:53:45 -0800 (PST) Subject: Re: busdma in the DRM From: Eric Anholt To: Nate Lawson Cc: "hackers@FreeBSD.ORG" In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 06 Nov 2002 23:53:46 -0800 Message-Id: <1036655638.3888.12.camel@anholt.dyndns.org> Mime-Version: 1.0 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 On Wed, 2002-11-06 at 23:36, Nate Lawson wrote: > On 6 Nov 2002, Eric Anholt wrote: > > I've been trying to figure out how to use the bus_dma* functions in the > > DRM. What I'm working on at the moment is the ATI PCIGART. How it > > works right now is an ioctl is done which mallocs a chunk of memory (up > > to 32MB). Later, the ioctl that sets up dma allocates a physically > > contiguous 32K of memory which contains pointers (by vtophys) into the > > pages of the 32MB. The physical address of that 32K is then written to > > the card. The 32MB is mapped by both the kernel and userspace (the X > > Server). > > > > So, I'm trying to convert it to busdma. I'm making a tag (is making it > > without having a parent tag a bad thing?) for the 32K contiguous, > > allocing 32K, and loading, with a callback to drop the dma address into > > a place of my choice. However, how do I do the 32MB? It only has to > > consist of pages, with nothing else special for alignment. For > > nsegments in bus_dma_tag_create it says it can't be more than 250-300, > > while I've got possibly 8192 segments. I'm thinking I would have to > > make a tag for the 32MB, allocate it, then loop and create PAGE_SIZE, > > nsegments=1 tags with the 32MB as parent, and bus_dmamap_load on those > > tags with offsets from the first map's vaddr and PAGE_SIZE long. Am I > > totally off base here? Is this even possible? > > Check out /sys/pci/agp* So are you saying I shouldn't be using busdma at all? How do I limit my allocations to pages accessible by pci in that case? Is the address returned by VM_PAGE_TO_PHYS accessible by the card on any architecture? -- Eric Anholt http://people.freebsd.org/~anholt/dri/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message