Date: Wed, 21 Dec 2011 10:35:18 -0700 From: Warner Losh <imp@bsdimp.com> To: ss griffon <ssgriffonuser@gmail.com> Cc: freebsd-drivers@freebsd.org Subject: Re: Attaching pseudo bus to i386 nexus bus. Message-ID: <09E51D07-3B6A-4E5C-87D7-BB1C2454969D@bsdimp.com> In-Reply-To: <CAFYJ9ehmS=QAW0aHD8jwaptUsbZuDsS98kL2AL_4Pd1AbcEL6Q@mail.gmail.com> References: <CAFYJ9ehmS=QAW0aHD8jwaptUsbZuDsS98kL2AL_4Pd1AbcEL6Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
The nexus bus doesn't automatically add children. You need to do that = yourself with an identify routine. Warner On Dec 20, 2011, at 8:55 PM, ss griffon wrote: > I've been playing around with the hdac sound driver and as an exercise > I decided to make my own "pseudo" pcm driver. However, I can't seem > to get my device_probe and device_attach functions to be called on my > "pseudo" bus driver. I've spent a lot of time looking at the bus code > in kernel/subr_bus.c and I think I have a good understanding of it but > apparently not good enough. I've looked at other devices that > implement buses, such as hdac, pci and acpi (which hangs off of nexus > as well) and I can't find what they are doing to make their > device_probe/device_attach to be called. Perhaps my driver is missing > a reference to a parent? Anyway, any help would be greatly > appreciated, maybe it is something very obvious. I turned on the > BUS_DEBUG option and provide it's output along with the code. >=20 > Code: >=20 > #ifdef HAVE_KERNEL_OPTION_HEADERS > #include "opt_snd.h" > #endif >=20 > #include <dev/sound/pcm/sound.h> > #include <dev/sound/pcm/pcm.h> >=20 > #include "device_if.h" > #include "bus_if.h" > #include "mixer_if.h" >=20 > static int > snd_loop_bus_probe(device_t dev) > { > printf("%s %d called\n", __func__, __LINE__); > return 0; > } >=20 > static int > snd_loop_bus_attach(device_t dev) > { > printf("%s %d called\n", __func__, __LINE__); > return 0; > } >=20 > static void > snd_loop_bus_driver_added(device_t dev, driver_t *driver) > { > printf("%s %d called\n", __func__, __LINE__); > } >=20 > static device_method_t snd_loop_bus_methods[] =3D { > DEVMETHOD(device_probe, snd_loop_bus_probe), > DEVMETHOD(device_attach, snd_loop_bus_attach), > /*Bus Interface*/ > DEVMETHOD(bus_driver_added, snd_loop_bus_driver_added), > { 0, 0 } > }; >=20 > static driver_t snd_loop_bus_driver =3D { > "snd_loop_bus", > snd_loop_bus_methods, > PCM_SOFTC_SIZE, /*This isn't used, should be 1*/ > }; >=20 > devclass_t snd_loop_bus_devclass; > DRIVER_MODULE(snd_loop_bus, nexus, snd_loop_bus_driver, > snd_loop_bus_devclass, 0, 0); >=20 >=20 >=20 > BUS_DEBUG Output: >=20 > devclass_find_internal:914: looking for nexus > driver_module_handler:4462: Loading module: driver snd_loop_bus on bus > nexus (pass 2147483647) > devclass_add_driver:1047: snd_loop_bus > devclass_find_internal:914: looking for snd_loop_bus > devclass_find_internal:924: creating snd_loop_bus > _______________________________________________ > 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" >=20 >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?09E51D07-3B6A-4E5C-87D7-BB1C2454969D>