Probing for devices

Terry Lambert tlambert2 at mindspring.com
Thu Jul 24 23:38:11 PDT 2003


Geoff Glasson wrote:
> I'm trying to port the Linux i810 Direct Rendering Interface ( DRI ) kernel
> module to FreeBSD.  I have reached the point where the thing compiles, and I
> can load it as a kernel module, but it can't find the graphics device.
> 
> Through a process of elimination I have come to the conclusion that once the
> AGP kernel module probes and attaches to the i810 graphics device, nothing
> else can attach to it.  When I read the section on PCI devices it implied (
> to me at least ) that multiple kernel modules should be able to attach to the
> same device.  I have tried to get it to work without any success.

How would you expect the hardware to act if both drivers were
being accessed simultaneously?

In general, multiple device attaches are only possible on
multifunction devices, where the driver claims by function,
rather than merely by PCI ID.

You will likely need to have the two drivers intentionally
cooperate with each other on the management of the device,
in order to accomplish your goal.

If your driver is an actual port of the Linux driver, rather
than a rewrite, licensing dictates that it talk to the FreeBSD
driver and ask it to step out of the way so it can do what it
wants to do, and that it act gracefully if the FreeBSD driver
refuses because someone is using it.  Ideally, your driver
would leave the FreeBSD driver in place, and ask it to do some
of the device management functions you need on behalf of your
driver, rather than your driver attempting to do them directly.

If your driver is in the exact same ecological niche (e.g. it
provides the same AGP services the FreeBSD driver does), then
you will need to ensure that only one driver is ever loaded
into the kernel at a time.

-- Terry


More information about the freebsd-hackers mailing list