Initial version of PCI access library
Christoph Hellwig
hch at lst.de
Mon Feb 20 11:47:33 PST 2006
On Mon, Feb 20, 2006 at 11:42:38AM -0800, Ian Romanick wrote:
> > I think the most important thing about the driver interface is that
> > it should be a callback scheme where the core calls the driver for
> > every found devices instead of the driver calling some kind of iterator
> > code. From experience with Linux kernel drivers the latter leads to
> > rather horrible spaghetti code, not to mention that such a scheme
> > doesn't work at all for dyanmic devices additions or removals.
>
> I agree 100%, but SOMETHING still has to iterate over the list of
> devices. If the devices aren't doing it, then the X server is.
Yes. But if only the server does it the way they are iterated can
be changed arbitrary or even be different for different platforms.
> My current understanding is that right now each driver has a probe
> function. The server calls that probe function to ask the driver which
> devices it can handle. This includes PCI, AGP, ISA, SBUS, and Zorro
> devices. The driver marks devices as "claimed" and does some per-device
> initialization. Based on discussions from the past couple weeks, I
> believe that this is backwards.
>
> For PCI, AGP, and other busses with enumeratable device IDs (PCMCIA?
> USB?),
sbus (although davem prefers to enumerate them in kernelspac based on
his last mail)
mca
eisa
isapnp
although I doubt anything but pci(,-X,-express) and agp which is
identical to PCI at the device enumeration level really matters
a lot for X currently. The Linux kernel has some generic infrastucture
used by the various bus drivers to share code for this, but IMHO that
would be complete overkill for X right now.
currenty.
> the driver should have a list of devices IDs and a probe
> function. If the server finds a device that is in the driver's list, it
> calls the driver's probe function with a pointer to the device. That
> driver now owns that device.
Yes.
> We'll need another probe function for those older busses. Fortunately,
> most drivers don't support any devices on those types of busses, so code
> to support that entry point won't be needed very often.
Can't we just keep the old code for those busses for now? In the Linux
kernel a driver can use modern style PCI probing while still doing it's
old and awkward unstructured poke and see ISA probing.
More information about the xorg
mailing list