From owner-freebsd-new-bus@FreeBSD.ORG Thu Sep 28 10:24:42 2006 Return-Path: X-Original-To: freebsd-new-bus@freebsd.org Delivered-To: freebsd-new-bus@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 857BA16A417 for ; Thu, 28 Sep 2006 10:24:42 +0000 (UTC) (envelope-from namaskar_alok@yahoo.co.in) Received: from web8912.mail.in.yahoo.com (web8912.mail.in.yahoo.com [203.84.221.144]) by mx1.FreeBSD.org (Postfix) with SMTP id 0D00B43D5D for ; Thu, 28 Sep 2006 10:24:39 +0000 (GMT) (envelope-from namaskar_alok@yahoo.co.in) Received: (qmail 93195 invoked by uid 60001); 28 Sep 2006 10:24:37 -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=unQ0pH8tt78Z7PM96WbAv8in4jGYVyMvsIVm7v80cgechCR3qB4F9kWyNIKWri51f/U8dxzo6R69LmRREPdjp1LLVIpmbMvKrRGF8blvCF8laSQFBciW3YeJDs/SD6cBuC1+FjqLBIlUzGkAPQ6l5qAOEwOM24ojrT+xEQ8We4k= ; Message-ID: <20060928102437.93193.qmail@web8912.mail.in.yahoo.com> Received: from [220.225.33.101] by web8912.mail.in.yahoo.com via HTTP; Thu, 28 Sep 2006 03:24:37 PDT Date: Thu, 28 Sep 2006 03:24:37 -0700 (PDT) From: Alok Barsode To: freebsd-new-bus@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Device enumeration X-BeenThere: freebsd-new-bus@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD's new-bus architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2006 10:24:42 -0000 Hi, I am a newbie working on FreeBSD 4.10. I am a bit confused between i386/conf/GENERIC and i386/conf/GENERIC.hints. Does a device driver's probe/attach routine is invoked when a enty is made for it in the GENERIC file? for example an enty in the GENERIC file will be : device nge # NatSemi DP83820 gigabit Ethernet Does the probe routine in if_nge.c invoked when the kernel encounters the above entry? How can I probe/attach a device which is not self-identifying? Like a memory mapped device? Does an entry in the GENERIC file make sure the probe/attach function will be called for it? How can I identify where in the device hierarchy is it located? The device is not connected to any BUS. so will it be a independent device? In GENERIC.hints a device's bus, port,irq are mentioned. What is the actual purpose of doing so? is this hard coding the values (like irqs)? what information has to be mentioned in this file? I was unable to find a good document on the newbus architecture and device enumeration.If anybody knows of one, plz let me know. Thanks, Alok. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From owner-freebsd-new-bus@FreeBSD.ORG Thu Sep 28 10:54:11 2006 Return-Path: X-Original-To: freebsd-new-bus@freebsd.org Delivered-To: freebsd-new-bus@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1DA8116A412 for ; Thu, 28 Sep 2006 10:54:11 +0000 (UTC) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (relay0.rambler.ru [81.19.66.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 87A6643D66 for ; Thu, 28 Sep 2006 10:54:03 +0000 (GMT) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (localhost [127.0.0.1]) by relay0.rambler.ru (Postfix) with ESMTP id 5F5AC5F81; Thu, 28 Sep 2006 14:54:02 +0400 (MSD) Received: from edoofus.park.rambler.ru (unknown [81.19.65.108]) by relay0.rambler.ru (Postfix) with ESMTP id 3BB0C6084; Thu, 28 Sep 2006 14:54:02 +0400 (MSD) Received: (from ru@localhost) by edoofus.park.rambler.ru (8.13.8/8.13.8) id k8SAs2GI038395; Thu, 28 Sep 2006 14:54:02 +0400 (MSD) (envelope-from ru) Date: Thu, 28 Sep 2006 14:54:01 +0400 From: Ruslan Ermilov To: Alok Barsode Message-ID: <20060928105401.GD4708@rambler-co.ru> References: <20060928102437.93193.qmail@web8912.mail.in.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+B+y8wtTXqdUj1xM" Content-Disposition: inline In-Reply-To: <20060928102437.93193.qmail@web8912.mail.in.yahoo.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: No virus found Cc: freebsd-new-bus@freebsd.org Subject: Re: Device enumeration X-BeenThere: freebsd-new-bus@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD's new-bus architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2006 10:54:11 -0000 --+B+y8wtTXqdUj1xM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 28, 2006 at 03:24:37AM -0700, Alok Barsode wrote: > Hi, > I am a newbie working on FreeBSD 4.10. >=20 > I am a bit confused between i386/conf/GENERIC and > i386/conf/GENERIC.hints.=20 >=20 > Does a device driver's probe/attach routine is invoked > when a enty is made for it in the GENERIC file?=20 > for example an enty in the GENERIC file will be :=20 > device nge # NatSemi DP83820 gigabit Ethernet =20 > Does the probe routine in if_nge.c invoked when the > kernel encounters the above entry?=20 >=20 No. The magic is in the following line in if_nge.c: DRIVER_MODULE(if_nge, pci, nge_driver, nge_devclass, 0, 0); It attaches the nge_driver to the pci bus. > How can I probe/attach a device which is not > self-identifying? Like a memory mapped device? Does an > entry in the GENERIC file make sure the probe/attach > function will be called for it?=20 >=20 Like ISA non-PnP devices? > How can I identify where in the device hierarchy is it > located? >=20 On modern FreeBSD versions, 5,x and 6.x, there's a devinfo(8) utility that allows to retrieve this kind of information. > The device is not connected to any BUS. so > will it be a independent device?=20 >=20 I think you'll have to use some kind of a bus. When I worked on a port of adm5120 for NetBSD, we used the obio bus which stands for the "onboard I/O" and is not a real bus. The configuration on that bus was static. > In GENERIC.hints a device's bus, port,irq are > mentioned. What is the actual purpose of doing so? >=20 This is for legacy non-PnP ISA devices mostly, and for some slave devices, like floppy drivers attached to a floppy controller, and PS/2 mouse and AT keyboard to the AT keyboard controller: $ grep -w at GENERIC.hints | grep -vw "isa" hint.fd.0.at=3D"fdc0" hint.fd.1.at=3D"fdc0" hint.atkbd.0.at=3D"atkbdc" hint.psm.0.at=3D"atkbdc" GENERIC.hints doesn't exist in 4.10, by the way. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --+B+y8wtTXqdUj1xM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFG6nJqRfpzJluFF4RAsrMAJ9bGBrEYlClPclCTLqN2f8XWMniFQCfQh5e NKaOu/prfcATBa9RiZiCVuM= =ltgk -----END PGP SIGNATURE----- --+B+y8wtTXqdUj1xM-- From owner-freebsd-new-bus@FreeBSD.ORG Thu Sep 28 16:18:03 2006 Return-Path: X-Original-To: freebsd-new-bus@freebsd.org Delivered-To: freebsd-new-bus@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D68A916A416 for ; Thu, 28 Sep 2006 16:18: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 E20B043D49 for ; Thu, 28 Sep 2006 16:18:02 +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 k8SGGOxK010510; Thu, 28 Sep 2006 10:16:25 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 28 Sep 2006 10:15:31 -0600 (MDT) Message-Id: <20060928.101531.-957832987.imp@bsdimp.com> To: namaskar_alok@yahoo.co.in From: "M. Warner Losh" In-Reply-To: <20060928102437.93193.qmail@web8912.mail.in.yahoo.com> References: <20060928102437.93193.qmail@web8912.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]); Thu, 28 Sep 2006 10:16:25 -0600 (MDT) Cc: freebsd-new-bus@freebsd.org Subject: Re: Device enumeration X-BeenThere: freebsd-new-bus@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD's new-bus architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2006 16:18:03 -0000 In message: <20060928102437.93193.qmail@web8912.mail.in.yahoo.com> Alok Barsode writes: : I am a bit confused between i386/conf/GENERIC and : i386/conf/GENERIC.hints. OK. : Does a device driver's probe/attach routine is invoked : when a enty is made for it in the GENERIC file? Not necessarily. The presense of the driver in the GENERIC file means that if there are busses to which the driver attaches, and the bus-dependent code thinks there's reason to believe the device is present, then its probe routine will be called. In the case of PCI, the bus dependent code assumes that if the PCI config registers say there's a device there, then that's enough for it to present to all the PCI probe routines to see who is interested in it. : for example an enty in the GENERIC file will be : : device nge # NatSemi DP83820 gigabit Ethernet : Does the probe routine in if_nge.c invoked when the : kernel encounters the above entry? No. Not when it encountered the above entry. It will get called once per PCI device on each of the PCI busses. : How can I probe/attach a device which is not : self-identifying? Identify routine. device_identify gives some details. Not all busses allow one to have an identify routine (pci tells you what devices are present, isa lets you tell it what devices are present). : Like a memory mapped device? Does an : entry in the GENERIC file make sure the probe/attach : function will be called for it? You need to attach it to a bus. That bus can then deside to call your probe/attach routine. : How can I identify where in the device hierarchy is it : located? The device is not connected to any BUS. so : will it be a independent device? All devices are attached to a bus, by definition. There's some bus that you can attach it to. In general, a device such as you describe would be attached to 'isa' on the i386 port. Isa is the catch-all bus for things, not just those funny old-school cards. : In GENERIC.hints a device's bus, port,irq are : mentioned. What is the actual purpose of doing so? is : this hard coding the values (like irqs)? what : information has to be mentioned in this file? GENERIC.hints is 5.x and newer. Are you sure you are looking at 4.10? In 4.10, you'd have a line that looks like: device fdc0 at isa? port IO_FD1 iomem XXXX irq 6 drq 2 your device, since it is memory mapped, it would look like: device fred0 at isa? iomem 0xfc000000 irq 9 (assuming it is memory mapped to 0xfc000000 and has been wired to IRQ9, omit that part if not). Warner From owner-freebsd-new-bus@FreeBSD.ORG Sat Sep 30 12:00:47 2006 Return-Path: X-Original-To: freebsd-new-bus@freebsd.org Delivered-To: freebsd-new-bus@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E441A16A5E0 for ; Sat, 30 Sep 2006 12:00:47 +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 6432543D4C for ; Sat, 30 Sep 2006 12:00:46 +0000 (GMT) (envelope-from namaskar_alok@yahoo.co.in) Received: (qmail 41540 invoked by uid 60001); 30 Sep 2006 12:00:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=LKiiHjJtJp2N8ocXIZ8DrfKn289STdasNhyVzTkd3SHGUPp8K5wiKAGf4V3Yv53qplOA0E/dsnrDyztadbbrDQ2VNQhKM86+qb+PIIOp72jmvjXxxEXWaMGUkb8xd4xT98tSpMJ/1ZPba/NZ2ek2sZZo5Y6np+oKn0iGG07Y3lE= ; Message-ID: <20060930120043.41538.qmail@web8913.mail.in.yahoo.com> Received: from [221.134.250.173] by web8913.mail.in.yahoo.com via HTTP; Sat, 30 Sep 2006 05:00:43 PDT Date: Sat, 30 Sep 2006 05:00:43 -0700 (PDT) From: Alok Barsode To: freebsd-new-bus@freebsd.org In-Reply-To: <20060928.101531.-957832987.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: more Device enumeration X-BeenThere: freebsd-new-bus@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD's new-bus architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Sep 2006 12:00:48 -0000 hello, Thanks a lot for the reply. A question which arises is, If the kernel calls the probe routine (in case of PCI)for all the devices attached to it during bus-enumeration, whats the point of having the device entries in GENERIC?does the bus-dependent code call the probe routine of the device-driver,for only those devices which are mentioned in GENERIC file. I am writing a device driver for a memory mapped ethernet device.Does it HAVE to be attached to a bus?Its the only device I want to support(right now).Is it not possible to hard-code the probe-attach routine calls? Can i attach it to nexus? OR Can I attach it to the PCI bus (though its not a PCI device) through some hack? This is not a i386 port hence the ISA bus is absent. Will i have to implement a pseudo-bus (write the bus-dependent code)in order to attach my device? Thank you, Alok. "Let the wisdom of the old guide the buoyancy and vitality of the youth; let the buoyancy and vitality of the youth sustain the wisdom of the old." - Stanislavski __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From owner-freebsd-new-bus@FreeBSD.ORG Sat Sep 30 18:45:13 2006 Return-Path: X-Original-To: freebsd-new-bus@freebsd.org Delivered-To: freebsd-new-bus@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB72316A4C9 for ; Sat, 30 Sep 2006 18:45:13 +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 2775E43D64 for ; Sat, 30 Sep 2006 18:45:00 +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 k8UIiRpf044275; Sat, 30 Sep 2006 12:44:28 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 30 Sep 2006 12:43:34 -0600 (MDT) Message-Id: <20060930.124334.-432842007.imp@bsdimp.com> To: namaskar_alok@yahoo.co.in From: "M. Warner Losh" In-Reply-To: <20060930120043.41538.qmail@web8913.mail.in.yahoo.com> References: <20060928.101531.-957832987.imp@bsdimp.com> <20060930120043.41538.qmail@web8913.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]); Sat, 30 Sep 2006 12:44:28 -0600 (MDT) Cc: freebsd-new-bus@freebsd.org Subject: Re: more Device enumeration X-BeenThere: freebsd-new-bus@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD's new-bus architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Sep 2006 18:45:14 -0000 In message: <20060930120043.41538.qmail@web8913.mail.in.yahoo.com> Alok Barsode writes: : A question which arises is, If the kernel calls the : probe routine (in case of PCI)for all the devices : attached to it during bus-enumeration, whats the point : of having the device entries in GENERIC? Smaller kernels can be created by omitting unwanted/unneeded devices. : does the : bus-dependent code call the probe routine of the : device-driver,for only those devices which are : mentioned in GENERIC file. Only for those modules that are loaded, would be a better way to say it. The GENERIC file effectively specifies which modules to load by creating a makefile that preloads them. : I am writing a device driver for a memory mapped : ethernet device.Does it HAVE to be attached to a : bus? Yes. It must be attached to a bus. The device, in hardware, is attached to a bus by definition. The software reflects this hardware definition and requires that you attach it to a bus. The word bus in software just means that it has to attach somewhere. : Its the only device I want to support(right : now).Is it not possible to hard-code the probe-attach : routine calls? Not really, but creating a bus is easy. : Can i attach it to nexus? OR Can I attach it to the : PCI bus (though its not a PCI device) through some : hack? It would be better not to do that. : This is not a i386 port hence the ISA bus is absent. : Will i have to implement a pseudo-bus (write the : bus-dependent code)in order to attach my device? Ah, in that case, can you describe the hardware a little better? I'm always curious about non-i386 ports... For the Atmel ARM AT91RM9200 port that I've been working on, we placed all the devices that were on the SoC part in their own bus (called atmelarm). This bus manages the resources and attachment points for all the devices on the atmel chip. At the moment, I've hard coded the devices that are present and add them (see src/sys/arm/at91/at91.c for the details). I'd like to make it even easier to create a generic-ish bus like this, but this is the best example in the tree right now. You could attach this to nexus, and hard wire the resources that the ethernet driver uses. This would be a quick and dirty way of dealing to get things rolling, but isn't very flexible or expandable and will likely bite you in the long run... Warner