Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Sep 2006 10:15:31 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        namaskar_alok@yahoo.co.in
Cc:        freebsd-new-bus@freebsd.org
Subject:   Re: Device enumeration
Message-ID:  <20060928.101531.-957832987.imp@bsdimp.com>
In-Reply-To: <20060928102437.93193.qmail@web8912.mail.in.yahoo.com>
References:  <20060928102437.93193.qmail@web8912.mail.in.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20060928102437.93193.qmail@web8912.mail.in.yahoo.com>
            Alok Barsode <namaskar_alok@yahoo.co.in> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060928.101531.-957832987.imp>