From owner-freebsd-hackers@FreeBSD.ORG Wed May 17 02:48:23 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 3F9A916A407 for ; Wed, 17 May 2006 02:48:23 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26BD443D69 for ; Wed, 17 May 2006 02:48:19 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.14] (imini.samsco.home [192.168.254.14]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id k4H2mCJt053696; Tue, 16 May 2006 20:48:17 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <446A8EEC.1090508@samsco.org> Date: Tue, 16 May 2006 20:48:12 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.7) Gecko/20050416 X-Accept-Language: en-us, en MIME-Version: 1.0 To: hongz@promisechina.com References: <1147340690$36076$55833599@hongz@promisechina.com> In-Reply-To: <1147340690$36076$55833599@hongz@promisechina.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on pooker.samsco.org Cc: freebsd-hackers@freebsd.org Subject: Re: help:How to map a physical address into a kernel address? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 May 2006 02:48:23 -0000 hongz@promisechina.com wrote: > Hi guys: > > > > To access sg_table in kernel address, I need to map the starting physical > address of a segment into a kernel address. As I know that, we can use > phystovirt()/bustovirt(), or kmap()/kmap_atomic() to map a bus/physical > address or a physical page into a kernel address in Linux, but I did not > find such a function in FreeBSD. Please help me on this, it is very urgent! > > > > Thanks a lot! > What kind of memory are you trying to access? Are you trying to access memory on the card that is pointed to by PCI base address registers? If so then you need to use the bus_space API. Or are you trying to allocate memory in the kernel and then give the physical address of that memory to your card? If so then you need to use bus_dma. Both Warner and I are happy to help guide you with these APIs. Scott