From owner-freebsd-hackers@FreeBSD.ORG Wed May 17 15:11:22 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 6FE7816AA59 for ; Wed, 17 May 2006 15:11:22 +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 7B65143D8D for ; Wed, 17 May 2006 15:11:10 +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 k4HFB0LA058204; Wed, 17 May 2006 09:11:05 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <446B3D04.2070602@samsco.org> Date: Wed, 17 May 2006 09:11:00 -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: <1147856676$63109$94009980@hongz@promisechina.com> In-Reply-To: <1147856676$63109$94009980@hongz@promisechina.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.1 required=3.8 tests=ALL_TRUSTED, SUBJECT_ENCODED_TWICE autolearn=no 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: =?gb2312?b?tPC4tDogtPC4tDogaGVscDpIb3cgdG8gbWFwIGEgcGh5c2lj?= =?gb2312?b?YWwgYWRkcmVzcyBpbnRvIGEga2VybmVsIGFkZHJlc3M/?= 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 15:11:23 -0000 hongz@promisechina.com wrote: > Hi guys: > > The attached file is the sample codes of my HBA driver. I make notes on the > place where the address transfer is needed. Please make comments if > possible. > > Thanks a lot! > > Hong > It looks like the primary question that you are asking in the code is this: How to get the kernel virtual address of csio->data_ptr? Correct? The answer is that csio->data_ptr is a kernel virtual address already if the CAM_DATA_PHYS flag is not set. For prepare_sg_table, you can just ignore the case where it isn't unless you expect to also write software that will use the flag (CAM was originally written for an application that did use this flag, but it's use is no longer common). As for ft_map_sg, the only way that you can be in there is if CAM_DATA_PHYS was not set, so it's safe to say that csio->data_ptr is a kernel virtaul address. One thing to note about your code is that Local_StartIO should be called from within ft_map_sg instead of ft_cam_action. That way the EINPROGRESS status of bus_dmamap_load will be handled correctly. I can' describe this more if you have questions. Scott