From owner-freebsd-drivers@FreeBSD.ORG Mon Nov 20 10:37: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 [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 490BD16A47B for ; Mon, 20 Nov 2006 10:37:58 +0000 (UTC) (envelope-from hummel@pasteur.fr) Received: from electre.pasteur.fr (electre.pasteur.fr [157.99.64.120]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5974A43D5A for ; Mon, 20 Nov 2006 10:37:42 +0000 (GMT) (envelope-from hummel@pasteur.fr) Received: from parmesan.sis.pasteur.fr (parmesan.sis.pasteur.fr [157.99.64.42]) by electre.pasteur.fr (8.12.11/8.12.11) with ESMTP id kAKAbsti373063 for ; Mon, 20 Nov 2006 11:37:55 +0100 (CET) Received: by parmesan.sis.pasteur.fr (Postfix, from userid 1931) id 73223170A8; Mon, 20 Nov 2006 11:37:53 +0100 (CET) Date: Mon, 20 Nov 2006 11:37:53 +0100 From: Thomas Hummel To: freebsd-drivers@freebsd.org Message-ID: <20061120103753.GJ21835@parmesan.sis.pasteur.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4.2.2i Subject: Intel PRO/Wireless 3945ABG 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, 20 Nov 2006 10:37:58 -0000 Hello, I'm using the FreeBSD version of the blob-free wpi OpenBSD driver for Intel PRO/Wireless 3945ABG on my laptop. I found it at http://www.datacode.it/wpi-freebsd/wpi-freebsd.tgz I get rx tail flags error 702 error messages but the card works well. Is someone at FreeBSD assigned the port of this driver ? If yes, would it be in 6.2-RELEASE ? If no, what's the alternative (is there a binary driver or a driver used with a binary daemon, more or less as ipw3945 on linux ?) Thanks. -- Thomas Hummel | Institut Pasteur | Pôle informatique - systèmes et réseau From owner-freebsd-drivers@FreeBSD.ORG Fri Nov 24 11:25: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 [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BDFDD16A47B for ; Fri, 24 Nov 2006 11:25:12 +0000 (UTC) (envelope-from marc.loerner@hob.de) Received: from mailgate.hob.de (mailgate.hob.de [212.185.199.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D5FF43D49 for ; Fri, 24 Nov 2006 11:24:31 +0000 (GMT) (envelope-from marc.loerner@hob.de) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate.hob.de (Postfix) with ESMTP id 58DE21E9B0 for ; Fri, 24 Nov 2006 12:25:10 +0100 (CET) Received: from mailgate.hob.de ([127.0.0.1]) by localhost (mailgate.hob.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14360-02 for ; Fri, 24 Nov 2006 12:25:10 +0100 (CET) Received: from imap.hob.de (mail2.hob.de [172.25.1.102]) by mailgate.hob.de (Postfix) with ESMTP id E8ACC1E9BA for ; Fri, 24 Nov 2006 12:25:09 +0100 (CET) Received: from linux03.hob.de (linux03.hob.de [172.22.0.190]) by imap.hob.de (Postfix on SuSE eMail Server 2.0) with ESMTP id 833992962 for ; Fri, 24 Nov 2006 12:25:09 +0100 (CET) From: Marc =?iso-8859-1?q?L=F6rner?= Organization: hob To: freebsd-drivers@freebsd.org Date: Fri, 24 Nov 2006 12:25:07 +0100 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Message-Id: <200611241225.07481.marc.loerner@hob.de> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at hob.de Subject: Directory in /dev 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, 24 Nov 2006 11:25:12 -0000 Hello, is it possible to create/make a subdirectory under /dev, or is it generally forbidden to do that? I found nothing by googling or reading the archives of the freebsd mailing lists. I even found nothing by slightly looking into the kernel code. Does anyone have some suggestions or pointers for me? Thanks in advance, Marc Lörner From owner-freebsd-drivers@FreeBSD.ORG Fri Nov 24 12:53:51 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94E7016A40F for ; Fri, 24 Nov 2006 12:53:51 +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 03CCC43D45 for ; Fri, 24 Nov 2006 12:53:09 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kAOCqscV038310; Fri, 24 Nov 2006 05:52:55 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 24 Nov 2006 05:53:37 -0700 (MST) Message-Id: <20061124.055337.-432838076.imp@bsdimp.com> To: marc.loerner@hob.de From: "M. Warner Losh" In-Reply-To: <200611241225.07481.marc.loerner@hob.de> References: <200611241225.07481.marc.loerner@hob.de> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Fri, 24 Nov 2006 05:52:55 -0700 (MST) Cc: freebsd-drivers@freebsd.org Subject: Re: Directory in /dev 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, 24 Nov 2006 12:53:51 -0000 In message: <200611241225.07481.marc.loerner@hob.de> Marc L=F6rner writes: : Hello, : is it possible to create/make a subdirectory under /dev, : or is it generally forbidden to do that? : = : I found nothing by googling or reading the archives of the freebsd ma= iling = : lists. I even found nothing by slightly looking into the kernel code.= : = : Does anyone have some suggestions or pointers for me? makedev in your driver with a slash: make_dev(cdevsw, minor, uid, gid, perm, "fred/ford%d", unit); or if you are creating a disk device, set the d_name similarly. Warner From owner-freebsd-drivers@FreeBSD.ORG Fri Nov 24 12:59:45 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0EC7516A4C8 for ; Fri, 24 Nov 2006 12:59:45 +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 4B56343D53 for ; Fri, 24 Nov 2006 12:59:03 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kAOCxKdK038468; Fri, 24 Nov 2006 05:59:20 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 24 Nov 2006 06:00:04 -0700 (MST) Message-Id: <20061124.060004.-1540393187.imp@bsdimp.com> To: marc.loerner@hob.de From: "M. Warner Losh" In-Reply-To: <20061124.055337.-432838076.imp@bsdimp.com> References: <200611241225.07481.marc.loerner@hob.de> <20061124.055337.-432838076.imp@bsdimp.com> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Fri, 24 Nov 2006 05:59:20 -0700 (MST) Cc: freebsd-drivers@freebsd.org Subject: Re: Directory in /dev 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, 24 Nov 2006 12:59:45 -0000 In message: <20061124.055337.-432838076.imp@bsdimp.com> "M. Warner Losh" writes: : In message: <200611241225.07481.marc.loerner@hob.de> : Marc L=F6rner writes: : : Hello, : : is it possible to create/make a subdirectory under /dev, : : or is it generally forbidden to do that? : : = : : I found nothing by googling or reading the archives of the freebsd = mailing = : : lists. I even found nothing by slightly looking into the kernel cod= e. : : = : : Does anyone have some suggestions or pointers for me? : = : makedev in your driver with a slash: : = : make_dev(cdevsw, minor, uid, gid, perm, "fred/ford%d", unit); : = : or if you are creating a disk device, set the d_name similarly. I should have added that creating the first device in a subdirectory automatically creates that subdirectory. Removing the last device automatically deletes that subdirectory. You can't create a subdirectory just because you want it there, however. Warner From owner-freebsd-drivers@FreeBSD.ORG Fri Nov 24 13:07:14 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1008B16A4D8 for ; Fri, 24 Nov 2006 13:07:14 +0000 (UTC) (envelope-from marc.loerner@hob.de) Received: from mailgate.hob.de (mailgate.hob.de [212.185.199.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F9E543E14 for ; Fri, 24 Nov 2006 13:05:40 +0000 (GMT) (envelope-from marc.loerner@hob.de) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate.hob.de (Postfix) with ESMTP id 928171E9B8; Fri, 24 Nov 2006 14:06:13 +0100 (CET) Received: from mailgate.hob.de ([127.0.0.1]) by localhost (mailgate.hob.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31184-01; Fri, 24 Nov 2006 14:06:13 +0100 (CET) Received: from imap.hob.de (mail2.hob.de [172.25.1.102]) by mailgate.hob.de (Postfix) with ESMTP id 5A49A1E9B7; Fri, 24 Nov 2006 14:06:13 +0100 (CET) Received: from linux03.hob.de (linux03.hob.de [172.22.0.190]) by imap.hob.de (Postfix on SuSE eMail Server 2.0) with ESMTP id A4E2E1C95; Fri, 24 Nov 2006 14:06:12 +0100 (CET) From: Marc =?iso-8859-1?q?L=F6rner?= Organization: hob To: "M. Warner Losh" Date: Fri, 24 Nov 2006 14:06:10 +0100 User-Agent: KMail/1.6.2 References: <200611241225.07481.marc.loerner@hob.de> <20061124.055337.-432838076.imp@bsdimp.com> <20061124.060004.-1540393187.imp@bsdimp.com> In-Reply-To: <20061124.060004.-1540393187.imp@bsdimp.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Message-Id: <200611241406.10473.marc.loerner@hob.de> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at hob.de Cc: freebsd-drivers@freebsd.org Subject: Re: Directory in /dev 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, 24 Nov 2006 13:07:14 -0000 Thanks, now it does, what I wanted! Sometimes one really doesn't see the wood for the trees! Marc On Friday 24 November 2006 14:00, you wrote: > In message: <20061124.055337.-432838076.imp@bsdimp.com> > > "M. Warner Losh" writes: > : In message: <200611241225.07481.marc.loerner@hob.de> > : > : Marc Lörner writes: > : : Hello, > : : is it possible to create/make a subdirectory under /dev, > : : or is it generally forbidden to do that? > : : > : : I found nothing by googling or reading the archives of the freebsd > : : mailing lists. I even found nothing by slightly looking into the kernel > : : code. > : : > : : Does anyone have some suggestions or pointers for me? > : > : makedev in your driver with a slash: > : > : make_dev(cdevsw, minor, uid, gid, perm, "fred/ford%d", unit); > : > : or if you are creating a disk device, set the d_name similarly. > > I should have added that creating the first device in a subdirectory > automatically creates that subdirectory. Removing the last device > automatically deletes that subdirectory. You can't create a > subdirectory just because you want it there, however. > > Warner From owner-freebsd-drivers@FreeBSD.ORG Fri Nov 24 13:11: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 [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7214616A407 for ; Fri, 24 Nov 2006 13:11:58 +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 92CF143D4C for ; Fri, 24 Nov 2006 13:11:16 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kAODBREZ038570; Fri, 24 Nov 2006 06:11:27 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 24 Nov 2006 06:12:11 -0700 (MST) Message-Id: <20061124.061211.420518872.imp@bsdimp.com> To: marc.loerner@hob.de From: "M. Warner Losh" In-Reply-To: <20061124.060004.-1540393187.imp@bsdimp.com> References: <200611241225.07481.marc.loerner@hob.de> <20061124.055337.-432838076.imp@bsdimp.com> <20061124.060004.-1540393187.imp@bsdimp.com> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Fri, 24 Nov 2006 06:11:27 -0700 (MST) Cc: freebsd-drivers@freebsd.org Subject: Re: Directory in /dev 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, 24 Nov 2006 13:11:58 -0000 In message: <20061124.060004.-1540393187.imp@bsdimp.com> "M. Warner Losh" writes: : In message: <20061124.055337.-432838076.imp@bsdimp.com> : "M. Warner Losh" writes: : : In message: <200611241225.07481.marc.loerner@hob.de> : : Marc L=F6rner writes: : : : Hello, : : : is it possible to create/make a subdirectory under /dev, : : : or is it generally forbidden to do that? : : : = : : : I found nothing by googling or reading the archives of the freebs= d mailing = : : : lists. I even found nothing by slightly looking into the kernel c= ode. : : : = : : : Does anyone have some suggestions or pointers for me? : : = : : makedev in your driver with a slash: : : = : : make_dev(cdevsw, minor, uid, gid, perm, "fred/ford%d", unit); : : = : : or if you are creating a disk device, set the d_name similarly. : = : I should have added that creating the first device in a subdirectory : automatically creates that subdirectory. Removing the last device : automatically deletes that subdirectory. You can't create a : subdirectory just because you want it there, however. I just updated the make_dev man page: struct cdev * make_dev(struct cdevsw *cdevsw, int minor, uid_t uid, gid_t gid, int perms, const char *fmt, ...); ... gid. The name is the expansion of fmt and following arguments as printf(9) would print it. The name determines its path under /dev= or other devfs(5) mount point and may contain slash `/' characters to= denote subdirectories. The permissions of the file specified in perms ar= e ... If there's a better wording, please advise. Warner From owner-freebsd-drivers@FreeBSD.ORG Sat Nov 25 05:42:45 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BAFDB16A403 for ; Sat, 25 Nov 2006 05:42:45 +0000 (UTC) (envelope-from ryan42@mac.com) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.47]) by mx1.FreeBSD.org (Postfix) with ESMTP id B57DF43D49 for ; Sat, 25 Nov 2006 05:41:59 +0000 (GMT) (envelope-from ryan42@mac.com) Received: from mac.com (webmail015-S [10.13.128.15]) by smtpout.mac.com (Xserve/8.12.11/smtpout09/MantshX 4.0) with ESMTP id kAP5ge5U001539 for ; Fri, 24 Nov 2006 21:42:42 -0800 (PST) Received: from webmail015 (localhost [127.0.0.1]) by mac.com (8.13.8/webmail015/MantshX 4.0) with ESMTP id kAP5gd5u008963 for ; Fri, 24 Nov 2006 21:42:40 -0800 (PST) Date: Fri, 24 Nov 2006 21:42:39 -0800 From: Ryan To: freebsd-drivers@freebsd.org Message-ID: <3709801C-010F-1000-911A-8A67FFAB888D-Webmail-10020@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Originating-IP: 68.92.39.169 Received: from [68.92.39.169] from webmail.mac.com with HTTP; Fri, 24 Nov 2006 21:42:39 -0800 X-Brightmail-Tracker: AAAAAA== X-Brightmail-scanned: yes Subject: SMBus and ichsmb -- adding device ID 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: Sat, 25 Nov 2006 05:42:45 -0000 Hello all! Be warned this is my first mailing list post so bear with me :-P I am running FreeBSD on a Dell Dimension 4500 and trying to get a smbus controller to allow me to use it with lmmon, mbmon, etc. I have somewhat concluded that the ichsmb driver is not loading for the smbus controller. Here is pciconf -l -v's out put for the SMBus controller: chsmb0@pci0:31:3: class=0x0c0500 card=0x01321028 chip=0x24c38086 rev=0x01 hdr=0x00 vendor = 'Intel Corporation' device = '82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller' class = serial bus subclass = SMBus I think that the ichsmb driver will work for this if I can add the smbus controller's device ID to it. If anyone can help me solve this I'd be very happy. This is the post I came across that gives me the feeling I've got: http://lists.freebsd.org/pipermail/freebsd-current/2005-May/049840.html What I get right now from these programs: # mbmon No Hardware Monitor found!! InitMBInfo: Unknown error: 0 # lmmon IOCTL: Device not configured # healthd -d ************************ * Hardware Information * ************************ Unknown Vendor: ID = FFFF ************************ Temp.= 255.0, 0.0, 0.0; Rot.= 0, 0, 0 Vcore = 4.08, 4.08; Volt. = 4.08, 6.85, 15.50, -14.16, -6.12 Temp.= 255.0, 0.0, 0.0; Rot.= 0, 0, 0 Vcore = 4.08, 4.08; Volt. = 4.08, 6.85, 15.50, -14.16, -6.12 (Note that these values are all bogus) Once again thanks! --Ryan From owner-freebsd-drivers@FreeBSD.ORG Sat Nov 25 19:27:20 2006 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C8D2716A407 for ; Sat, 25 Nov 2006 19:27:20 +0000 (UTC) (envelope-from mashtizadeh@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id E3B7E43D49 for ; Sat, 25 Nov 2006 19:26:30 +0000 (GMT) (envelope-from mashtizadeh@gmail.com) Received: by nf-out-0910.google.com with SMTP id x37so1553194nfc for ; Sat, 25 Nov 2006 11:27:18 -0800 (PST) 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; b=PDhHZqiYkoOdzfMI4Qhtf7l+H24SzCHS88rU44d4KrfgB2uQ0GKU6MEzLsm+ITPLBeV4a1xqowgcLOcNLQ5qoh3z/FqBAnFtTmm/UjjpPmoYEqDNWwjjbdsUmRfSGPSwEsg3XVtxFrxlY+SDgGJ1S8b5LLq6GTWPVay0B0q8eOI= Received: by 10.49.20.15 with SMTP id x15mr7864023nfi.1164482838629; Sat, 25 Nov 2006 11:27:18 -0800 (PST) Received: by 10.48.223.19 with HTTP; Sat, 25 Nov 2006 11:27:18 -0800 (PST) Message-ID: <440b3e930611251127k2f94cb39ge198c538aaee68b0@mail.gmail.com> Date: Sat, 25 Nov 2006 14:27:18 -0500 From: "Ali Mashtizadeh" 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 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Devices with Per Open Data 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: Sat, 25 Nov 2006 19:27:20 -0000 Hi Everyone, I had a question what is the proper way to hold per open data? It seems there were some discussions in the past and they were all hacks. The API seems to have changed hiding the interfaces these hacks used (Between 6 and 6.1 i believe). It also seems to be something that NVidia has on its requested kernel features. So I'm wondering if this has been addressed yet or not? If so can someone point me to something to read either an example driver. Ali Mashtizadeh P.S. I've been hacking the FreeBSD kernel for a while now but just recently i got on these mailing lists just wanted to say Hi to everyone. From owner-freebsd-drivers@FreeBSD.ORG Sat Nov 25 20:00:04 2006 Return-Path: X-Original-To: freebsd-drivers@FreeBSD.ORG Delivered-To: freebsd-drivers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8CE216A403 for ; Sat, 25 Nov 2006 20:00:03 +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 07C3743D58 for ; Sat, 25 Nov 2006 19:59:13 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kAPJwWhE096370; Sat, 25 Nov 2006 12:58:33 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 25 Nov 2006 12:59:18 -0700 (MST) Message-Id: <20061125.125918.1619553786.imp@bsdimp.com> To: mashtizadeh@gmail.com From: "M. Warner Losh" In-Reply-To: <440b3e930611251127k2f94cb39ge198c538aaee68b0@mail.gmail.com> References: <440b3e930611251127k2f94cb39ge198c538aaee68b0@mail.gmail.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]); Sat, 25 Nov 2006 12:58:33 -0700 (MST) Cc: freebsd-drivers@FreeBSD.ORG Subject: Re: Devices with Per Open Data 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: Sat, 25 Nov 2006 20:00:04 -0000 In message: <440b3e930611251127k2f94cb39ge198c538aaee68b0@mail.gmail.com> "Ali Mashtizadeh" writes: : I had a question what is the proper way to hold per open data? Generally, you can't. dup2(2) and the internal structure of the kernel makes this impossible to implement directly. Typically, drivers needing this functionality use the cloning interface. This allows them to create a new minor for each open and give them the 'per instance' data that they desire. While this sounds complicated, in practice it turns out to be easy to accomplish. Once you've create the cloned device, you can use the si_drv[012] fields of the struct cdev * to store this data. Cloning it a bit underdocumented right now, as is most of the cdevsw interaction. But here's a sketch. First, you need to register a clone event handler. There is one of these for your driver, even if it has multiple instances. The method I recommend is doing it in your attach routine if you haven't done so yet, and removing it in your detach routine: static eventhandler_tag ehtag; static int ehtagref; int foo_attach(device_t) { ... if (ehtag == NULL) ehtag = EVENTHANDLER_REGISTER(dev_clone, foo_clone, 0, 1000); ehtagref++; ... } int foo_detach(device_t) { if (--ehtagref == 0 && ehtag != NULL) EVENTHANDLER_DEREGISTER(dev_clone, ehtag); } You are then setup with a clone handler that gets called in response to all /dev/ opens that don't already have a static entry in /dev. This is a big magical, but apart from files not appearing in ls it works out well. static struct clonedevs *foo_dev_clones = NULL; /* Clone device */ static void foo_dev_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev) { if (*dev != NULL) return; /* If you want a /dev/foo control device */ if (strcmp(name, "foo") == 0) unit = -1; else if (dev_stdclone(name, NULL, "foo", &unit) != 1) return; /* Bail on names we don't know */ /* find any existing device, or allocate new unit number */ if (clone_create(&foo_dev_clones, &foo_dev_cdevsw, &unit, dev, 0)) { *dev = make_dev(&foo_dev_cdevsw, unit2minor(unit), UID_ROOT, GID_WHEEL, 0600, "foo%d", unit); if (*dev != NULL) { dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; } } } Your open routine will then get the new dev and you can save stuff off in it. I think a man page needs to be written to document this stuff, because I couldn't find one in my quick search. : It seems : there were some discussions in the past and they were all hacks. The API : seems to have changed hiding the interfaces these hacks used (Between 6 and : 6.1 i believe). I very much doubt that the API changed on the RELENG_6 branch in this area. Maybe between 5 and 6. : It also seems to be something that NVidia has on its : requested kernel features. So I'm wondering if this has been addressed yet : or not? If so can someone point me to something to read either an example : driver. This is an oft-requrested feature. The higher levels in FreeBSD make it difficult to implement directly. All device vnodes in the FreeBDS (or any BSD) kernel are fungible. This means it isn't possible to tell them apart at the higher levels, and the driver API is such that you can't tell them apart there unless you have different struct cdev *. Hope this helps. Warner