From owner-freebsd-hackers@FreeBSD.ORG Thu May 11 15:54:40 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 2CD4E16A69E for ; Thu, 11 May 2006 15:54:40 +0000 (UTC) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id 58DB444201 for ; Thu, 11 May 2006 15:26:38 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (cpw424n0ars8ee8i@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.4/8.13.3) with ESMTP id k4BFQbS4010548; Thu, 11 May 2006 08:26:37 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.4/8.13.3/Submit) id k4BFQaUX010547; Thu, 11 May 2006 08:26:36 -0700 (PDT) (envelope-from jmg) Date: Thu, 11 May 2006 08:26:36 -0700 From: John-Mark Gurney To: hongz@promisechina.com Message-ID: <20060511152636.GN59504@funkthat.com> Mail-Followup-To: hongz@promisechina.com, freebsd-hackers@freebsd.org References: <1147340690$36076$55833599@hongz@promisechina.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1147340690$36076$55833599@hongz@promisechina.com> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p6 i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html 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 Reply-To: John-Mark Gurney List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 May 2006 15:54:53 -0000 hongz@promisechina.com wrote this message on Thu, May 11, 2006 at 17:45 +0800: > 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! That's what bus_space is used for... You need to allocate the resource that contains the sg_table, and then you can use the bus_space macros to access the table.. you could use bus_space_write_region to copy the table from kernel memory to your device, or just write the updated values... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."