From owner-freebsd-drivers@FreeBSD.ORG Mon Aug 14 10:29:34 2006 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 958AC16A4DA for ; Mon, 14 Aug 2006 10:29:34 +0000 (UTC) (envelope-from namaskar_alok@yahoo.co.in) Received: from web8910.mail.in.yahoo.com (web8910.mail.in.yahoo.com [203.84.221.142]) by mx1.FreeBSD.org (Postfix) with SMTP id 7BCC743D46 for ; Mon, 14 Aug 2006 10:29:33 +0000 (GMT) (envelope-from namaskar_alok@yahoo.co.in) Received: (qmail 15994 invoked by uid 60001); 14 Aug 2006 10:29:31 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=FaZMa8XXFICcHnjZgzlmMMvzakmgGxYF+v0gWYAX4cVOTnj0wrQgX4x1ywSl7F7LrvFRze9iODtS+aNP8lLayzt5Gz+Can3tSvBfeB0eOeglBaJ2G2i7hXzf2gnhnr2RXujpEJSaTgR/MIN8wHhF0fsgaKlwobJBOQIZ9Zi12kc= ; Message-ID: <20060814102931.15992.qmail@web8910.mail.in.yahoo.com> Received: from [220.225.33.101] by web8910.mail.in.yahoo.com via HTTP; Mon, 14 Aug 2006 03:29:31 PDT Date: Mon, 14 Aug 2006 03:29:31 -0700 (PDT) From: Alok Barsode To: freebsd-drivers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: PHY Driver as module 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: Mon, 14 Aug 2006 10:29:34 -0000 Hi, I am a newbie to FreeBSD kernel development. I am using FreeBSD 4.10. I was trying to build a PHY driver as module (/dev/mii/nsgphy.c) but i am unable to do so. I modified the Makefile in /sys/modules/mii as follows # $FreeBSD: src/sys/modules/mii/Makefile,v 1.11.2.8 2003/10/29 17:06:48 wpaul Exp $ .PATH: ${.CURDIR}/../../dev/mii KMOD = nsgphy SRCS = mii.c mii_physubr.c miibus_if.h device_if.h miibus_if.c SRCS += bus_if.h pci_if.h nsgphy.c .include It generated a nsgphy.ko and a mii.ko I am unable to load the nsgphy.ko , it says "No such file or directory". When i try to insert mii.ko it says file exists. Am i missing something? Thanks, Alok. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From owner-freebsd-drivers@FreeBSD.ORG Mon Aug 14 14:16:58 2006 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 CE73716A4E6 for ; Mon, 14 Aug 2006 14:16:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 90DCC43D77 for ; Mon, 14 Aug 2006 14:16:53 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k7EEGn9h013497; Mon, 14 Aug 2006 10:16:49 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-drivers@freebsd.org Date: Mon, 14 Aug 2006 09:07:00 -0400 User-Agent: KMail/1.9.1 References: <20060814102931.15992.qmail@web8910.mail.in.yahoo.com> In-Reply-To: <20060814102931.15992.qmail@web8910.mail.in.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608140907.00748.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Mon, 14 Aug 2006 10:16:49 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/1659/Mon Aug 14 04:44:22 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Subject: Re: PHY Driver as module 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: Mon, 14 Aug 2006 14:16:58 -0000 On Monday 14 August 2006 06:29, Alok Barsode wrote: > Hi, > I am a newbie to FreeBSD kernel development. > I am using FreeBSD 4.10. > I was trying to build a PHY driver as module > (/dev/mii/nsgphy.c) but i am unable to do so. > I modified the Makefile in /sys/modules/mii as follows > > # $FreeBSD: src/sys/modules/mii/Makefile,v 1.11.2.8 > 2003/10/29 17:06:48 wpaul Exp $ > > .PATH: ${.CURDIR}/../../dev/mii > KMOD = nsgphy > SRCS = mii.c mii_physubr.c miibus_if.h device_if.h > miibus_if.c > SRCS += bus_if.h pci_if.h nsgphy.c > > .include > > It generated a nsgphy.ko and a mii.ko > I am unable to load the nsgphy.ko , it says "No such > file or directory". > When i try to insert mii.ko it says file exists. > Am i missing something? Look in your dmesg for the real error messages. -- John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Mon Aug 14 18:45:06 2006 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 443D416A4E1 for ; Mon, 14 Aug 2006 18:45:06 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4F6343D5E for ; Mon, 14 Aug 2006 18:45:04 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k7EIfoVC015099; Mon, 14 Aug 2006 12:41:51 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 14 Aug 2006 12:41:49 -0600 (MDT) Message-Id: <20060814.124149.-432839450.imp@bsdimp.com> To: namaskar_alok@yahoo.co.in From: "M. Warner Losh" In-Reply-To: <20060814102931.15992.qmail@web8910.mail.in.yahoo.com> References: <20060814102931.15992.qmail@web8910.mail.in.yahoo.com> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Mon, 14 Aug 2006 12:41:51 -0600 (MDT) Cc: freebsd-drivers@freebsd.org Subject: Re: PHY Driver as module 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: Mon, 14 Aug 2006 18:45:06 -0000 In message: <20060814102931.15992.qmail@web8910.mail.in.yahoo.com> Alok Barsode writes: : Hi, : I am a newbie to FreeBSD kernel development. : I am using FreeBSD 4.10. : I was trying to build a PHY driver as module : (/dev/mii/nsgphy.c) but i am unable to do so. : I modified the Makefile in /sys/modules/mii as follows : : # $FreeBSD: src/sys/modules/mii/Makefile,v 1.11.2.8 : 2003/10/29 17:06:48 wpaul Exp $ : : .PATH: ${.CURDIR}/../../dev/mii : KMOD = nsgphy : SRCS = mii.c mii_physubr.c miibus_if.h device_if.h : miibus_if.c : SRCS += bus_if.h pci_if.h nsgphy.c : : .include : : It generated a nsgphy.ko and a mii.ko : I am unable to load the nsgphy.ko , it says "No such : file or directory". : When i try to insert mii.ko it says file exists. : Am i missing something? Yes. ukphy is needed for most of the mii modules. You likely are getting link errors in your dmesg. ukphy.c and ukphy_subr.c are the prime candidates to have routines that are missing. Why there's both a mii_physubr.c and a ukphy_subr.c is beyond me... I have some changes in my tree that make it so you can statically link in only the mii modules you need. My next step is to provide a way to load limited numbers of mii modules. I've been hesitant to go to that step since it is quite a bit harder to get dependencies right to make that happen. Also, the mii identifier codes need to be cleaned up because we're presenting them in the wrong bit order, but NetBSD changed that a while ago. I'm afraid to make the change sine I'm worried about the number of people I'd break :-) Good luck! Warner From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 16 08:58:19 2006 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 50F3416A4E7 for ; Wed, 16 Aug 2006 08:58:19 +0000 (UTC) (envelope-from namaskar_alok@yahoo.co.in) Received: from web8913.mail.in.yahoo.com (web8913.mail.in.yahoo.com [203.84.221.145]) by mx1.FreeBSD.org (Postfix) with SMTP id 372C243D5F for ; Wed, 16 Aug 2006 08:58:15 +0000 (GMT) (envelope-from namaskar_alok@yahoo.co.in) Received: (qmail 80650 invoked by uid 60001); 16 Aug 2006 08:58:14 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=jw6AOeKaD00+cBPXr33xa54HE1m1SKMbjOJliAloVgFsYOpNtSWA09KV2pVoelaQis0d0auMI22YJC4X5Rq8gM7bOYnnpjHwHBHwpSg6tuo7eXH7VBAAe9mHZs7aXY9WWQCEe77cll1CatJ7mlDtgcA+IAyx9AW+Yqr6loF09EM= ; Message-ID: <20060816085814.80648.qmail@web8913.mail.in.yahoo.com> Received: from [220.225.33.101] by web8913.mail.in.yahoo.com via HTTP; Wed, 16 Aug 2006 01:58:14 PDT Date: Wed, 16 Aug 2006 01:58:14 -0700 (PDT) From: Alok Barsode To: freebsd-drivers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Issues with Network device 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, 16 Aug 2006 08:58:19 -0000 Hello, I had some basic questions regarding the FreeBSD Device driver model(I am using FreBSD4.10 ) I have a Phy-Controller for which I am developing a device driver. I have writing the PHY driver(/sys/dev/mii/my_phy.c) In order to test it,I wanted to build it as a module. I have a few Q: 1. Is it possible to get the phy driver build separately (as a module)than the miibus module? Or will the phy support be interated in the miibus module?(The Makefile in /sys/modules/mii suggests that all PHYs support is integrated in miibus.ko) 2. Will i have to make a new entry in the /i3s6/conf/MYKERNEL indicating a new device under MII? 3. Is the Network Device driver model not documented in detail? Thanks, Alok. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 16 15:10:53 2006 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 4CF1B16A4E1 for ; Wed, 16 Aug 2006 15:10:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4FE3043D53 for ; Wed, 16 Aug 2006 15:10:52 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k7GFAivR039350; Wed, 16 Aug 2006 11:10:49 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-drivers@freebsd.org Date: Wed, 16 Aug 2006 10:28:33 -0400 User-Agent: KMail/1.9.1 References: <20060816085814.80648.qmail@web8913.mail.in.yahoo.com> In-Reply-To: <20060816085814.80648.qmail@web8913.mail.in.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608161028.33919.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Wed, 16 Aug 2006 11:10:49 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/1669/Wed Aug 16 07:54:21 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Subject: Re: Issues with Network device 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, 16 Aug 2006 15:10:53 -0000 On Wednesday 16 August 2006 04:58, Alok Barsode wrote: > Hello, > I had some basic questions regarding the FreeBSD > Device driver model(I am using FreBSD4.10 ) > I have a Phy-Controller for which I am developing a > device driver. > I have writing the PHY driver(/sys/dev/mii/my_phy.c) > In order to test it,I wanted to build it as a module. > I have a few Q: > > 1. Is it possible to get the phy driver build > separately (as a module)than the miibus module? > Or will the phy support be interated in the miibus > module?(The Makefile in /sys/modules/mii suggests that > all PHYs support is integrated in miibus.ko) You can always create your own my_phy.ko that just contains my_phy.c and kldload it into a kernel that already has 'device miibus' either via kld or statically compiled. > 2. Will i have to make a new entry in the > /i3s6/conf/MYKERNEL indicating a new device under MII? Not unless you want to statically compile it into your kernel. If you want to do that you will also have to update sys/conf/files. > 3. Is the Network Device driver model not documented > in detail? Not that I'm aware of. Maybe I'll sit down and write down what I know. -- John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Thu Aug 17 04:29:44 2006 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 6BDC016A4DD for ; Thu, 17 Aug 2006 04:29:44 +0000 (UTC) (envelope-from herriojr@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7AB2143D6A for ; Thu, 17 Aug 2006 04:29:43 +0000 (GMT) (envelope-from herriojr@gmail.com) Received: by py-out-1112.google.com with SMTP id c59so613169pyc for ; Wed, 16 Aug 2006 21:29:42 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=XipD4aywYy3LfCHvn/IH3wbFwMjqs/ERQ5GIfuGed81EaJ0YvvuVRI5YOdBJ9oh+6OU9Flo1IIoXV50gEDB8WXOIWvu8KOidLm99XkpkQn1Q9bcVnBEt+Dh9FB4yydU7lMhgYRD8PMnKWXw+Xn+YFGlPz4h3BxloOa4V1sv/H1c= Received: by 10.35.20.14 with SMTP id x14mr2850995pyi; Wed, 16 Aug 2006 21:29:42 -0700 (PDT) Received: by 10.35.67.2 with HTTP; Wed, 16 Aug 2006 21:29:42 -0700 (PDT) Message-ID: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com> Date: Thu, 17 Aug 2006 00:29:42 -0400 From: "Jonathan Herriott" To: freebsd-drivers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Newbie Question to Device driver writing 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, 17 Aug 2006 04:29:44 -0000 Hi! I've been interested in learning how to write device drivers for quite some time, but I had never had the time to devote to it until now. I was reading through the FreeBSD architecture handbook and came across the example echo character driver. To make sure I understand all that's going on, I'm searching though all the header files to understand what each thing is such as the cdevsw structure and cdev structure. I've come to the conclusion that the cdev structure is what is used to store the information about the actual device I open with make_dev. I was wondering if there is a place in which I can find a good explanation of the different attributes of the structure. The header files don't provide much insight for a newbie, so I was wondering if there might be some other location. On a side note, is there a good irc channel for FreeBSD driver writing discussion? Thanks in advance! Jon From owner-freebsd-drivers@FreeBSD.ORG Thu Aug 17 06:29:31 2006 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 BCBF216A4DE for ; Thu, 17 Aug 2006 06:29:31 +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 C47CA43D46 for ; Thu, 17 Aug 2006 06:29:30 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (2u6qh3jap89moast@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.6/8.13.3) with ESMTP id k7H6TUTK006433; Wed, 16 Aug 2006 23:29:30 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.6/8.13.3/Submit) id k7H6TURb006432; Wed, 16 Aug 2006 23:29:30 -0700 (PDT) (envelope-from jmg) Date: Wed, 16 Aug 2006 23:29:29 -0700 From: John-Mark Gurney To: Jonathan Herriott Message-ID: <20060817062929.GV99774@funkthat.com> Mail-Followup-To: Jonathan Herriott , freebsd-drivers@freebsd.org References: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.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-drivers@freebsd.org Subject: Re: Newbie Question to Device driver writing X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2006 06:29:31 -0000 Jonathan Herriott wrote this message on Thu, Aug 17, 2006 at 00:29 -0400: > I've been interested in learning how to write device drivers for quite > some time, but I had never had the time to devote to it until now. > > I was reading through the FreeBSD architecture handbook and came > across the example echo character driver. To make sure I understand > all that's going on, I'm searching though all the header files to > understand what each thing is such as the cdevsw structure and cdev > structure. > > I've come to the conclusion that the cdev structure is what is used to > store the information about the actual device I open with make_dev. I > was wondering if there is a place in which I can find a good > explanation of the different attributes of the structure. The header > files don't provide much insight for a newbie, so I was wondering if > there might be some other location. Well, the cdevsw doesn't contain much more than the standard operations you can do on a character device... The Design and Implementation of the FreeBSD Operating System doesn't have much more info on cdevsw than you can get from the header file... d_open, d_fdopen, d_close, d_read, d_write, d_ioctl are each called in response to their respective call (if d_fdopen is defined, it is used instead of d_open for open calls, though apparently no one is using this yet)... d_poll, d_mmap and d_kqfilter can be called multiple times or not at all for their respective syscalls... FreeBSD implements select as a wrapper around poll... > On a side note, is there a good irc channel for FreeBSD driver writing > discussion? Not that I know of... Though the -drivers mailing list has been more active of late... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-freebsd-drivers@FreeBSD.ORG Thu Aug 17 10:55:12 2006 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 99A6116A4DE for ; Thu, 17 Aug 2006 10:55:12 +0000 (UTC) (envelope-from admin@intron.ac) Received: from intron.ac (unknown [210.51.165.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id 10FAC43D45 for ; Thu, 17 Aug 2006 10:55:10 +0000 (GMT) (envelope-from admin@intron.ac) Received: from localhost (localhost [127.0.0.1]) (uid 1003) by intron.ac with local; Thu, 17 Aug 2006 18:55:05 +0800 id 00102C05.44E44B09.00015C21 References: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com> In-Reply-To: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com> From: "Intron is my alias on the Internet" To: "Jonathan Herriott" Date: Thu, 17 Aug 2006 18:55:05 +0800 Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312"; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Cc: freebsd-drivers@freebsd.org Subject: Re: Newbie Question to Device driver writing 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, 17 Aug 2006 10:55:12 -0000 Jonathan Herriott wrote: > Hi! > > I've been interested in learning how to write device drivers for quite > some time, but I had never had the time to devote to it until now. > > I was reading through the FreeBSD architecture handbook and came > across the example echo character driver. To make sure I understand > all that's going on, I'm searching though all the header files to > understand what each thing is such as the cdevsw structure and cdev > structure. > > I've come to the conclusion that the cdev structure is what is used to > store the information about the actual device I open with make_dev. I > was wondering if there is a place in which I can find a good > explanation of the different attributes of the structure. The header > files don't provide much insight for a newbie, so I was wondering if > there might be some other location. > > On a side note, is there a good irc channel for FreeBSD driver writing > discussion? > > Thanks in advance! > > Jon > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" In my opinion, any hardware driver has two interfaces, one user side interface and one kernel side interface. User side interface is created by make_dev(9). The structure cdevsw mainly contains a table of operations upon this device (i.e. "method" in object-oriented model) and permission of the device file node to be created under /dev/. We are familiar with the operations for read(2), write(2) and so on, but "strategy", "dump", "kqfilter" and others are relatively strange to us. Kernel side interface is used to access PCI bus, USB and other hardware resource, and to obtain memory space, shared/exclusive lock and module management support and other function sets. To be honest, you need to hack FreeBSD source code yourself if you would master FreeBSD kernel really. The mailing list -drivers@ lacks discussants. And you may send your question to -hackers@. What driver would you contribute to FreeBSD? I have interests to contribute something concerning hardware to FreeBSD. ------------------------------------------------------------------------ From Beijing, China From owner-freebsd-drivers@FreeBSD.ORG Thu Aug 17 11:12:06 2006 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 5E43B16A4ED for ; Thu, 17 Aug 2006 11:12:06 +0000 (UTC) (envelope-from m.ehinger@ltur.de) Received: from postx.gateway-inter.net (postx.gateway-inter.net [213.144.19.80]) by mx1.FreeBSD.org (Postfix) with ESMTP id 16EAB43D69 for ; Thu, 17 Aug 2006 11:12:02 +0000 (GMT) (envelope-from m.ehinger@ltur.de) To: freebsd-drivers@freebsd.org From: m.ehinger@ltur.de MIME-Version: 1.0 Message-ID: Date: Thu, 17 Aug 2006 13:12:18 +0200 Content-type: text/plain; charset=US-ASCII Subject: porting linux tp_smapi (HDAPS) 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, 17 Aug 2006 11:12:06 -0000 Hello, is somenbody already working on porting the Linux tp_smapi driver ( http://www.thinkwiki.org/wiki/Tp_smapi ) to FreeBSD? It provides some extras for IBM/Lenovo Thinkpads. I would like it especially for the HDAPS functionality ( http://www.thinkwiki.org/wiki/HDAPS ). If not i would try it, so its my first try of porting. Thanks Maik From owner-freebsd-drivers@FreeBSD.ORG Thu Aug 17 17:30:08 2006 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 B577316A4DA for ; Thu, 17 Aug 2006 17:30:08 +0000 (UTC) (envelope-from herriojr@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.176]) by mx1.FreeBSD.org (Postfix) with ESMTP id 06ADA43D4C for ; Thu, 17 Aug 2006 17:30:07 +0000 (GMT) (envelope-from herriojr@gmail.com) Received: by py-out-1112.google.com with SMTP id c59so889682pyc for ; Thu, 17 Aug 2006 10:30:07 -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:content-transfer-encoding:content-disposition:references; b=ch431VzW5zDPTpBebfnZn1oV/zwcYkhNBPEBreyB67d4bXPe1x51BilEFKz9g4tz1MLwaVi1r7Q75aERR6ouByYvTiNF3MxyujiykbdXRk5cVgK/TqIlUUFJ6uirMdXPLZmOI/RtLPNZgryp6G9lXnA/mGx+Z4bGREid/CzIilQ= Received: by 10.35.22.17 with SMTP id z17mr3977736pyi; Thu, 17 Aug 2006 10:30:07 -0700 (PDT) Received: by 10.35.67.2 with HTTP; Thu, 17 Aug 2006 10:30:06 -0700 (PDT) Message-ID: <6a56d69c0608171030o4c37ec37k54de2b99b5071c72@mail.gmail.com> Date: Thu, 17 Aug 2006 10:30:07 -0700 From: "Jonathan Herriott" To: "Intron is my alias on the Internet" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com> Cc: freebsd-drivers@freebsd.org Subject: Re: Newbie Question to Device driver writing 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, 17 Aug 2006 17:30:09 -0000 Intron- Unfortunately, I have nothing specific in mind as all my hardware works on FreeBSD. I've almost come to the point where I'm going to go to Fry's and buy a bunch of stuff and make a simple USB device which may turn on or off a light (actually hook it up to a light in my home) just to get some experience with writing drivers. Overall, I'd really love to do an opengl driver for a graphics card, but I figured before I get into something that complex, I might try something simpler. Any suggestion would be great. I'll look into -hackers@ as I would really like to learn the actual internals of FreeBSD. Jon On 8/17/06, Intron is my alias on the Internet wrote: > Jonathan Herriott wrote: > > > Hi! > > > > I've been interested in learning how to write device drivers for quite > > some time, but I had never had the time to devote to it until now. > > > > I was reading through the FreeBSD architecture handbook and came > > across the example echo character driver. To make sure I understand > > all that's going on, I'm searching though all the header files to > > understand what each thing is such as the cdevsw structure and cdev > > structure. > > > > I've come to the conclusion that the cdev structure is what is used to > > store the information about the actual device I open with make_dev. I > > was wondering if there is a place in which I can find a good > > explanation of the different attributes of the structure. The header > > files don't provide much insight for a newbie, so I was wondering if > > there might be some other location. > > > > On a side note, is there a good irc channel for FreeBSD driver writing > > discussion? > > > > Thanks in advance! > > > > Jon > > _______________________________________________ > > freebsd-drivers@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" > > In my opinion, any hardware driver has two interfaces, one user side > interface and one kernel side interface. > > User side interface is created by make_dev(9). The structure cdevsw > mainly contains a table of operations upon this device (i.e. "method" > in object-oriented model) and permission of the device file node > to be created under /dev/. We are familiar with the operations for > read(2), write(2) and so on, but "strategy", "dump", "kqfilter" and others > are relatively strange to us. > > Kernel side interface is used to access PCI bus, USB and other hardware > resource, and to obtain memory space, shared/exclusive lock and module > management support and other function sets. > > To be honest, you need to hack FreeBSD source code yourself if you > would master FreeBSD kernel really. > > The mailing list -drivers@ lacks discussants. And you may send your > question to -hackers@. > > What driver would you contribute to FreeBSD? > I have interests to contribute something concerning hardware to FreeBSD. > > ------------------------------------------------------------------------ > From Beijing, China > > From owner-freebsd-drivers@FreeBSD.ORG Fri Aug 18 00:47:00 2006 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 0FBFC16A4DA; Fri, 18 Aug 2006 00:47:00 +0000 (UTC) (envelope-from admin@intron.ac) Received: from intron.ac (unknown [210.51.165.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id D2DF243D49; Fri, 18 Aug 2006 00:46:58 +0000 (GMT) (envelope-from admin@intron.ac) Received: from localhost (localhost [127.0.0.1]) (uid 1003) by intron.ac with local; Fri, 18 Aug 2006 08:46:57 +0800 id 00102DF1.44E50E01.0001841C References: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com> <6a56d69c0608171030o4c37ec37k54de2b99b5071c72@mail.gmail.com> In-Reply-To: <6a56d69c0608171030o4c37ec37k54de2b99b5071c72@mail.gmail.com> From: "Intron is my alias on the Internet" To: "Jonathan Herriott" Date: Fri, 18 Aug 2006 08:46:57 +0800 Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312"; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Cc: freebsd-drivers@freebsd.org, freebsd-hardware@freebsd.org Subject: Re: Newbie Question to Device driver writing 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: Fri, 18 Aug 2006 00:47:00 -0000 Jonathan Herriott wrote: > Intron- > > Unfortunately, I have nothing specific in mind as all my hardware > works on FreeBSD. I've almost come to the point where I'm going to go > to Fry's and buy a bunch of stuff and make a simple USB device which > may turn on or off a light (actually hook it up to a light in my home) > just to get some experience with writing drivers. > > Overall, I'd really love to do an opengl driver for a graphics card, > but I figured before I get into something that complex, I might try > something simpler. Any suggestion would be great. > > I'll look into -hackers@ as I would really like to learn the actual > internals of FreeBSD. > > Jon > If you want to know how to write a simple USB driver, you may have a look at /usr/src/sys/dev/usb/uscanner.c and /usr/src/sys/dev/usb/ulpt.c. They are both almost as simple as transfering data between hardware device and userland application. To write a graphics card driver that well supports OpenGL is difficult: 1. Current GPUs produced by NVIDIA or ATI (AMD) are complicated. 2. Some vendors wouldn't publicize programming data sheets of GPUs. You may have a look at http://dri.freedesktop.org/. Some days ago, I would create a C++ driver fundamental structure for FreeBSD, but discussants on -hackers@ threw doubts upon me. These days, I think, if FreeBSD can make use of drivers for Microsoft Windows, FreeBSD will become more powerful. Now FreeBSD and Linux both can use network card driver for Windows, with ndis(4) for FreeBSD and NDISWrapper for Linux (http://ndiswrapper.sf.net). But NDIS driver is one of the simplest drivers in WDM. The idea of WDM (Windows Device Model) simulator is quite challenging. But once WDMulator is realized, it will help FreeBSD deeply. ------------------------------------------------------------------------ From Beijing, China