From owner-freebsd-drivers@FreeBSD.ORG Sun Oct 9 20:55:21 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDC3916A41F for ; Sun, 9 Oct 2005 20:55:21 +0000 (GMT) (envelope-from michael@endace.com) Received: from www.endace.com (endace.smrn.com [209.234.97.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5EFDA43D5C for ; Sun, 9 Oct 2005 20:55:18 +0000 (GMT) (envelope-from michael@endace.com) Received: from et.endace.com (203-97-51-114.dsl.clear.net.nz [203.97.51.114]) by www.endace.com (8.13.4/8.12.10) with ESMTP id j99KtHAX001080 for ; Sun, 9 Oct 2005 13:55:18 -0700 (PDT) Received: from [192.168.64.174] (nemausa.et.endace.com [192.168.64.174]) by et.endace.com (8.13.4/8.12.11) with ESMTP id j99KtB16053682 for ; Mon, 10 Oct 2005 09:55:12 +1300 (NZDT) Message-ID: <434983A6.8040403@endace.com> Date: Mon, 10 Oct 2005 09:55:02 +1300 From: Michael Honeyfield User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-drivers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamd / ClamAV version devel-20040621, clamav-milter version 0.72a on www.endace.com X-Virus-Status: Clean Subject: reference drivers X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2005 20:55:22 -0000 Hello all, I have been working on a small project that involes writting a drver for FreeBSD. I have used this link as my reference for my driver: http://www.ben.com/minipci/driver.php Now, after my modifications, I can load the kernel module fine. However, the mmap function is not even called. Is the mmap function used inside this diver the correct way map registers from kernel space to user space? Cheers -- Michael Honeyfield TECHNICAL SUPPORT ____________________________________________________ Endace Technology michael@endace.com http://www.endace.com From owner-freebsd-drivers@FreeBSD.ORG Tue Oct 11 07:08:15 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3661816A41F for ; Tue, 11 Oct 2005 07:08:15 +0000 (GMT) (envelope-from Yi_Xu@DELL.com) Received: from ausc60pc101.us.dell.com (ausc60pc101.us.dell.com [143.166.85.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 936E743D46 for ; Tue, 11 Oct 2005 07:08:14 +0000 (GMT) (envelope-from Yi_Xu@DELL.com) Received: from ausx3bpc104.aus.amer.dell.com ([10.30.101.54]) by ausc60pc101.us.dell.com with ESMTP; 11 Oct 2005 02:08:15 -0500 X-IronPort-AV: i="3.97,197,1125896400"; d="scan'208,217"; a="324458525:sNHT47090642" X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Date: Tue, 11 Oct 2005 15:07:19 +0800 Message-ID: <5634C3E1A5643946857FBDD87B834ED402F12073@xmnx2kmdc102.xmn.apac.dell.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: need you help-freebsd 4.2 Thread-Index: AcXL0JtkRvSata3qRgGTNlIJlATweQCYchuQ From: To: X-OriginalArrivalTime: 11 Oct 2005 07:07:19.0320 (UTC) FILETIME=[6B438180:01C5CE32] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: need you help-freebsd 4.2 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2005 07:08:15 -0000 Hi FreeBSD HELPER: =20 One of our customers wants to install freebsd4.2 on DELL PE2850. When they install FreeBSD 4.11 it's ok. But when they install freebsd4.2, FreeBSD 4.2 didn't found SCSI disk. Customer has their own software developed on FreeBSD 4.2. So they want to install FreeBSD 4.2 on DELL PE2850 server. Could you give some advice? =20 The SCSI controller on PE2850 is LSI53C1030. =20 Thanks ! =20 Xuyi =20 Dell ASG TSR From owner-freebsd-drivers@FreeBSD.ORG Wed Oct 12 17:59:06 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 37BAA16A41F for ; Wed, 12 Oct 2005 17:59:06 +0000 (GMT) (envelope-from caiquanqing@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 177EA43D67 for ; Wed, 12 Oct 2005 17:58:58 +0000 (GMT) (envelope-from caiquanqing@gmail.com) Received: by xproxy.gmail.com with SMTP id t12so109881wxc for ; Wed, 12 Oct 2005 10:58:57 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:mime-version:content-type; b=PYLJBnsAozj9TpyNrpfkOzJZ3gWpRoibMjblFRAk/YabpTL0JAi6zCJQotZHouWcZACTp6/38MYbPahOO598eoRk8PfGg3RxutAniBBydOpHfaiDKFPEd+4KwN3+1Fh1/O6zdt+ShPSJeOoaKATayiy5KBgXA3kVBRC/ua1t0Q4= Received: by 10.70.51.7 with SMTP id y7mr255307wxy; Wed, 12 Oct 2005 10:58:57 -0700 (PDT) Received: by 10.70.11.18 with HTTP; Wed, 12 Oct 2005 10:58:57 -0700 (PDT) Message-ID: <2b22951e0510121058u49cccf20kddd55352543c2304@mail.gmail.com> Date: Wed, 12 Oct 2005 10:58:57 -0700 From: "Cai, Quanqing" To: freebsd-current@freebsd.org, freebsd-drivers@freebsd.org, freebsd-firewire@freebsd.org, freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: kiyohara@kk.iij4u.or.jp Subject: Regarding kern/73852, please help to apply the patch thus we can close this bug. X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2005 17:59:06 -0000 Hi guys, I noticed there is bug filed by KIYOHARA Takashi with a patch, link is here: http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dkern/73852, I tested if_fwip w= ith this patch, it works great for me. When we switch byte-order two times on i386, the byte-order will back to original. if you look at the files src/lib/libc/i386/net/ntohl.S and src/lib/libc/i386/net/htonl.S, you will find exact same code: movl 4(%esp),%eax bswap %eax ret This tells everything. So I hope somebody can apply the patch made by KIYOHARA Takashi and close this bug. Thanks Cai, Quanqing From owner-freebsd-drivers@FreeBSD.ORG Wed Oct 12 18:51:00 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DBF2516A422 for ; Wed, 12 Oct 2005 18:50:59 +0000 (GMT) (envelope-from caiquanqing@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.200]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0EA2743D49 for ; Wed, 12 Oct 2005 18:50:57 +0000 (GMT) (envelope-from caiquanqing@gmail.com) Received: by xproxy.gmail.com with SMTP id t12so117403wxc for ; Wed, 12 Oct 2005 11:50:57 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Vk10lzzcanNDb607JybyMjZK739D4MvyU4lRjAo3TwTbjACmVFC6WtAp/l5a17YbILnToYd8eUSpWs5Fn8Z5hWq0125G1n6+9UwHTIYqHcxczj9gl88s4B1VaWaeCmpD/8wR5BhT1VXklMlZfelc6mgAJgrzY+MF3astKowSxgo= Received: by 10.70.87.14 with SMTP id k14mr283476wxb; Wed, 12 Oct 2005 11:50:57 -0700 (PDT) Received: by 10.70.11.18 with HTTP; Wed, 12 Oct 2005 11:50:57 -0700 (PDT) Message-ID: <2b22951e0510121150o7be85033ic054cabed7e94e5e@mail.gmail.com> Date: Wed, 12 Oct 2005 11:50:57 -0700 From: "Cai, Quanqing" To: freebsd-current@freebsd.org, freebsd-drivers@freebsd.org, freebsd-firewire@freebsd.org, freebsd-net@freebsd.org In-Reply-To: <2b22951e0510121058u49cccf20kddd55352543c2304@mail.gmail.com> MIME-Version: 1.0 References: <2b22951e0510121058u49cccf20kddd55352543c2304@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: kiyohara@kk.iij4u.or.jp Subject: Re: Regarding kern/73852, please help to apply the patch thus we can close this bug. X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2005 18:51:00 -0000 Forget to mention that my test machines, one is 7.0-CURRENT, another one is FreeBSD 6.0-RC1. So I think we can MFC to 6.x too. Cai, Quanqing On 10/12/05, Cai, Quanqing wrote: > > Hi guys, > > I noticed there is bug filed by KIYOHARA Takashi > with a patch, link is here: > http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dkern/73852, I tested if_fwip > with this patch, it works great for me. When we switch byte-order two tim= es > on i386, the byte-order will back to original. if you look at the files > src/lib/libc/i386/net/ntohl.S and src/lib/libc/i386/net/htonl.S, you will > find exact same code: > > movl 4(%esp),%eax > bswap %eax > ret > > This tells everything. > > So I hope somebody can apply the patch made by KIYOHARA Takashi and close > this bug. > > Thanks > Cai, Quanqing From owner-freebsd-drivers@FreeBSD.ORG Wed Oct 12 20:32:04 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0B30D16A41F for ; Wed, 12 Oct 2005 20:32:04 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4DB2943D46 for ; Wed, 12 Oct 2005 20:32:02 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from [10.50.41.234] (Not Verified[10.50.41.234]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Wed, 12 Oct 2005 16:48:23 -0400 From: John Baldwin To: freebsd-drivers@freebsd.org Date: Wed, 12 Oct 2005 15:32:53 -0400 User-Agent: KMail/1.8.2 References: <434983A6.8040403@endace.com> In-Reply-To: <434983A6.8040403@endace.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510121532.54474.jhb@freebsd.org> Cc: Subject: Re: reference drivers X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2005 20:32:04 -0000 On Sunday 09 October 2005 04:55 pm, Michael Honeyfield wrote: > Hello all, > > I have been working on a small project that involes writting a drver for > FreeBSD. I have used this link as my reference for my driver: > > http://www.ben.com/minipci/driver.php > > Now, after my modifications, I can load the kernel module fine. However, > the mmap function is not even called. Is the mmap function used inside > this diver the correct way map registers from kernel space to user space? Yes. It should be called when an application does an mmap() on an fd returned by open()'ing the file in /dev. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-drivers@FreeBSD.ORG Wed Oct 12 20:32:04 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1490B16A421 for ; Wed, 12 Oct 2005 20:32:04 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D99443D45 for ; Wed, 12 Oct 2005 20:32:03 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from [10.50.41.234] (Not Verified[10.50.41.234]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Wed, 12 Oct 2005 16:48:23 -0400 From: John Baldwin To: freebsd-drivers@freebsd.org Date: Wed, 12 Oct 2005 15:33:38 -0400 User-Agent: KMail/1.8.2 References: <5634C3E1A5643946857FBDD87B834ED402F12073@xmnx2kmdc102.xmn.apac.dell.com> In-Reply-To: <5634C3E1A5643946857FBDD87B834ED402F12073@xmnx2kmdc102.xmn.apac.dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510121533.40442.jhb@freebsd.org> Cc: Yi_Xu@dell.com Subject: Re: need you help-freebsd 4.2 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2005 20:32:04 -0000 On Tuesday 11 October 2005 03:07 am, Yi_Xu@dell.com wrote: > Hi FreeBSD HELPER: > > > > One of our customers wants to install freebsd4.2 on DELL PE2850. When > they install FreeBSD 4.11 it's ok. But when they install freebsd4.2, > FreeBSD 4.2 didn't found SCSI disk. Customer has their own software > developed on FreeBSD 4.2. So they want to install FreeBSD 4.2 on DELL > PE2850 server. Could you give some advice? > > > > The SCSI controller on PE2850 is LSI53C1030. > > > > Thanks ! > > > > Xuyi > > > > Dell ASG TSR FreeBSD 4.11 should run 4.2 binaries just fine if you install the 'compat4x' distribution. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-drivers@FreeBSD.ORG Wed Oct 12 21:04:15 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D613516A422 for ; Wed, 12 Oct 2005 21:04:15 +0000 (GMT) (envelope-from michael@endace.com) Received: from www.endace.com (endace.smrn.com [209.234.97.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4749743D64 for ; Wed, 12 Oct 2005 21:04:13 +0000 (GMT) (envelope-from michael@endace.com) Received: from et.endace.com (203-97-51-114.dsl.clear.net.nz [203.97.51.114]) by www.endace.com (8.13.4/8.12.10) with ESMTP id j9CL4Djf041952 for ; Wed, 12 Oct 2005 14:04:13 -0700 (PDT) Received: from [192.168.64.174] (nemausa.et.endace.com [192.168.64.174]) by et.endace.com (8.13.4/8.12.11) with ESMTP id j9CL47UL015419 for ; Thu, 13 Oct 2005 10:04:07 +1300 (NZDT) Message-ID: <434D7A42.1080005@endace.com> Date: Thu, 13 Oct 2005 10:04:02 +1300 From: Michael Honeyfield User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-drivers@freebsd.org References: <434983A6.8040403@endace.com> <200510121532.54474.jhb@freebsd.org> In-Reply-To: <200510121532.54474.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamd / ClamAV version devel-20040621, clamav-milter version 0.72a on www.endace.com X-Virus-Status: Clean Subject: Re: reference drivers X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2005 21:04:16 -0000 John Baldwin wrote: >On Sunday 09 October 2005 04:55 pm, Michael Honeyfield wrote: > > >>Hello all, >> >>I have been working on a small project that involes writting a drver for >>FreeBSD. I have used this link as my reference for my driver: >> >>http://www.ben.com/minipci/driver.php >> >>Now, after my modifications, I can load the kernel module fine. However, >>the mmap function is not even called. Is the mmap function used inside >>this diver the correct way map registers from kernel space to user space? >> >> > >Yes. It should be called when an application does an mmap() on an fd returned >by open()'ing the file in /dev. > > > Ok, good to know I am on the right path. Where is a good place to look if the foo_mmap() is not actually called? I use this routine as a test for mapping a register into user space: fd = open( "/dev/bar0", O_RDWR ); reg = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if( reg == MAP_FAILED) { fprintf( stderr, "can't mmap bar!\n" ); exit(1); } the code takes an arg, and the register I am selecting is there. The above code snippet works on Linux. Cheers -- Michael Honeyfield TECHNICAL SUPPORT ____________________________________________________ Endace Technology michael@endace.com http://www.endace.com From owner-freebsd-drivers@FreeBSD.ORG Thu Oct 13 15:32:21 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 93DEA16A41F for ; Thu, 13 Oct 2005 15:32:21 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id A345243D46 for ; Thu, 13 Oct 2005 15:32:20 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from [10.50.41.234] (Not Verified[10.50.41.234]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Thu, 13 Oct 2005 11:48:42 -0400 From: John Baldwin To: freebsd-drivers@freebsd.org Date: Thu, 13 Oct 2005 10:52:53 -0400 User-Agent: KMail/1.8.2 References: <434983A6.8040403@endace.com> <200510121532.54474.jhb@freebsd.org> <434D7A42.1080005@endace.com> In-Reply-To: <434D7A42.1080005@endace.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510131052.54692.jhb@freebsd.org> Cc: Subject: Re: reference drivers X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2005 15:32:21 -0000 On Wednesday 12 October 2005 05:04 pm, Michael Honeyfield wrote: > John Baldwin wrote: > >On Sunday 09 October 2005 04:55 pm, Michael Honeyfield wrote: > >>Hello all, > >> > >>I have been working on a small project that involes writting a drver for > >>FreeBSD. I have used this link as my reference for my driver: > >> > >>http://www.ben.com/minipci/driver.php > >> > >>Now, after my modifications, I can load the kernel module fine. However, > >>the mmap function is not even called. Is the mmap function used inside > >>this diver the correct way map registers from kernel space to user space? > > > >Yes. It should be called when an application does an mmap() on an fd > > returned by open()'ing the file in /dev. > > Ok, good to know I am on the right path. > > Where is a good place to look if the foo_mmap() is not actually called? > > I use this routine as a test for mapping a register into user space: > > fd = open( "/dev/bar0", O_RDWR ); > reg = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); > if( reg == MAP_FAILED) { > fprintf( stderr, "can't mmap bar!\n" ); > exit(1); > } > > the code takes an arg, and the register I am selecting is there. The > above code snippet works on Linux. You need to make sure d_mmap in your cdevsw is mapped to your mmap function. How do you know that your mmap routine is not being called? Did you add a printf or some such? Did you do so before any error checking that would cause an early return from the function? -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-drivers@FreeBSD.ORG Thu Oct 13 20:03:59 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7403416A41F for ; Thu, 13 Oct 2005 20:03:59 +0000 (GMT) (envelope-from michael@endace.com) Received: from www.endace.com (endace.smrn.com [209.234.97.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2F92B43D48 for ; Thu, 13 Oct 2005 20:03:59 +0000 (GMT) (envelope-from michael@endace.com) Received: from et.endace.com (203-97-51-114.dsl.clear.net.nz [203.97.51.114]) by www.endace.com (8.13.4/8.12.10) with ESMTP id j9DK3wmU055493 for ; Thu, 13 Oct 2005 13:03:58 -0700 (PDT) Received: from [192.168.64.174] (nemausa.et.endace.com [192.168.64.174]) by et.endace.com (8.13.4/8.12.11) with ESMTP id j9DK3pSN068372 for ; Fri, 14 Oct 2005 09:03:52 +1300 (NZDT) Message-ID: <434EBDA5.9070507@endace.com> Date: Fri, 14 Oct 2005 09:03:49 +1300 From: Michael Honeyfield User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-drivers@freebsd.org References: <434983A6.8040403@endace.com> <200510121532.54474.jhb@freebsd.org> <434D7A42.1080005@endace.com> <200510131052.54692.jhb@freebsd.org> In-Reply-To: <200510131052.54692.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamd / ClamAV version devel-20040621, clamav-milter version 0.72a on www.endace.com X-Virus-Status: Clean Subject: Re: reference drivers X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2005 20:03:59 -0000 John Baldwin wrote: >>Ok, good to know I am on the right path. >> >>Where is a good place to look if the foo_mmap() is not actually called? >> >>I use this routine as a test for mapping a register into user space: >> >> fd = open( "/dev/bar0", O_RDWR ); >> reg = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); >> if( reg == MAP_FAILED) { >> fprintf( stderr, "can't mmap bar!\n" ); >> exit(1); >> } >> >>the code takes an arg, and the register I am selecting is there. The >>above code snippet works on Linux. >> >> > >You need to make sure d_mmap in your cdevsw is mapped to your mmap function. >How do you know that your mmap routine is not being called? Did you add a >printf or some such? Did you do so before any error checking that would >cause an early return from the function? > > > Yes, I have d_mmap in cdevsw, as per below: static struct cdevsw foo_cdevsw = { .d_open = foo_open, .d_close = foo_close, .d_read = foo_read, .d_write = foo_write, .d_mmap = foo_mmap, .d_strategy = NULL, .d_dump = NULL, .d_version = D_VERSION, .d_flags = D_NEEDGIANT, .d_name = "foo" }; I do have debugging statements inside each function, so I can see from dmesg what is happening, or atleast, get a better idea. I use this for debugging: DPRINTF("foo mmap!\n"); The above is inside each function, with it defined as #define DPRINTF(format, args...) printf(format , ## args); Since my driver is only in its absolutly early stages of development, it very closely resembles the driver given in the url in my first email, the only changes are some additional debugging out and my function definitions. I could post those if you think it could help. Regards -- Michael Honeyfield TECHNICAL SUPPORT ____________________________________________________ Endace Technology michael@endace.com http://www.endace.com From owner-freebsd-drivers@FreeBSD.ORG Thu Oct 13 20:14:55 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 13F9C16A41F for ; Thu, 13 Oct 2005 20:14:55 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id A572243D45 for ; Thu, 13 Oct 2005 20:14:54 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from [10.50.41.234] (Not Verified[10.50.41.234]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Thu, 13 Oct 2005 16:31:16 -0400 From: John Baldwin To: freebsd-drivers@freebsd.org Date: Thu, 13 Oct 2005 16:15:08 -0400 User-Agent: KMail/1.8.2 References: <434983A6.8040403@endace.com> <200510131052.54692.jhb@freebsd.org> <434EBDA5.9070507@endace.com> In-Reply-To: <434EBDA5.9070507@endace.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510131615.09643.jhb@freebsd.org> Cc: Subject: Re: reference drivers X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2005 20:14:55 -0000 On Thursday 13 October 2005 04:03 pm, Michael Honeyfield wrote: > John Baldwin wrote: > >>Ok, good to know I am on the right path. > >> > >>Where is a good place to look if the foo_mmap() is not actually called? > >> > >>I use this routine as a test for mapping a register into user space: > >> > >> fd = open( "/dev/bar0", O_RDWR ); > >> reg = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); > >> if( reg == MAP_FAILED) { > >> fprintf( stderr, "can't mmap bar!\n" ); > >> exit(1); > >> } > >> > >>the code takes an arg, and the register I am selecting is there. The > >>above code snippet works on Linux. > > > >You need to make sure d_mmap in your cdevsw is mapped to your mmap > > function. How do you know that your mmap routine is not being called? > > Did you add a printf or some such? Did you do so before any error > > checking that would cause an early return from the function? > > Yes, I have d_mmap in cdevsw, as per below: > > static struct cdevsw foo_cdevsw = { > .d_open = foo_open, > .d_close = foo_close, > .d_read = foo_read, > .d_write = foo_write, > .d_mmap = foo_mmap, > .d_strategy = NULL, > .d_dump = NULL, > .d_version = D_VERSION, > .d_flags = D_NEEDGIANT, > .d_name = "foo" > }; > > I do have debugging statements inside each function, so I can see from > dmesg what is happening, or atleast, get a better idea. I use this for > debugging: > > DPRINTF("foo mmap!\n"); > > The above is inside each function, with it defined as > > #define DPRINTF(format, args...) printf(format , ## args); > > Since my driver is only in its absolutly early stages of development, it > very closely resembles the driver given in the url in my first email, > the only changes are some additional debugging out and my function > definitions. > > I could post those if you think it could help. > > Regards It would probably be easiest if I could just eyeball your driver (with any uber-secret stuff stripped out). If it makes you more comfortable, you can send it to privately rather than on the list. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org