On Fri, 4 May 2018, matthew green wrote: > John Nemeth writes: > > On May 3, 10:54pm, Mouse wrote: > > } > > } > There is also the idea of having a module specify the device(s) > > } > it handles by vendor:product > > } > > } Isn't that rather restrictive in what buses it permits supporting? > > > > I suppose that other types of identifiers could be used. > > one imagines that it would be done via device properties, and so > it would work with what ever bus features were provided for this > sort of lookup. maybe be useful to have a library backend for > the common case of vendor:product.
OpenFirmware defines "compatible" properties, a comma separated list describing the device from most specific to least specific. The 1275 bindings for PCI define a way to map PCI vendor and product IDs to "compatible" properties. What I would do is add a special ELF section to each module with a list of the "compatible" properties the driver supports. Then, when the bus is enumerated, generate a "compatible" string for each device and search each "compatible" section in each driver module for a match. If it's PCI you probe the vendor and device ID to create the property. For SBus, you get it from the FCode. (For ISA, you're SOL.) That way you don't have to mess around with a bunch of obnoxious config files like Solaris does. Eduardo
