[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-hackers
Subject: Re: Bus Driver probe and attach device
From: Yuka Muromachi <yuka.muromachi () gmail ! com>
Date: 2005-07-22 7:59:04
Message-ID: c5c2798005072200596b85444b () mail ! gmail ! com
[Download RAW message or body]
It mean I have 2 way to do it? (please view the code below)
CodecPresent = az_rw(sc, AZX_REG_STATESTS);
for (idx=0; idx<AZX_MAX_CODECS; idx++)
{
if ((CodecPresent >> idx) & 0x0001)
{
// alloc codec info
// fill codec info
device_t codec_dev = device_add_child(azbus_dev, NULL, -1);
device_set_ivars(codec_dev, codec);
// I can probe and attach new device self here.
device_probe_and_attach(codec_dev);
}
}
// Or, I can probe and attach all new child here
bus_generic_attach(azbus_dev);
05/07/22 $B$K(B takawata@jp.freebsd.org<takawata@jp.freebsd.org> \
$B$5$s$O=q$-$^$7$?(B:
> In message <c5c2798005072123385249195e@mail.gmail.com>, $B<<D.M%9a(B wrote:
> > Hi:
> >
> > I'm trying to written Azalia (HD Audio) driver for freebsd now.
> >
> > The HDA controller is a standard controller, which can take max> >15 codecs. I'm \
> > planning made it be a bus driver (azalia bus).
> > I tried to read the PCI, USB and Firewire driver code be sample.
> > It looks:
> >
> > 1. Detect codec which already connected to azalia controller.
> > 2. call device_add_child(azbus_dev, NULL, -1); to create a child
> > device, which attach to azalia bus driver.
> > 3. allocate memory to put codec info (e.g. device id, vendor id,
> > revision..etc), and call device_set_ivars(codec_dev, codec_info);
> > save the codec_info ptr into device's ivars.
> > 4. Continue 1 ~ 3, untin all available codecs be added.
> >
> > After all codecs be added, I call the device_probe_and_attach(azbus_dev);,
> > but there is no thing happend.
>
> Because it trys to attach azbus driver itself, not try to attach its child.
>
> > Then I try to call bus_generic_attach(azbus_dev);, the codecs driver probe
> > function be called.
>
> > Is this correct (use bus_generic_attach()), and I'm interested the detail.
>
> Correct. It calls device_probe_and_attach() for all child you already
> add.
>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic