configurable device (and other) tables in the kernel ?
John Baldwin
jhb at freebsd.org
Thu Feb 1 16:21:14 UTC 2007
On Wednesday 31 January 2007 14:51, Luigi Rizzo wrote:
> I think there was some discussion on the topic some time ago
> but cannot remember if there was any outcome so let me ask.
>
> We have several tables in our kernel and modules,
> containing at least device-id tables (pci, usb),
> quirks for certain devices, and maybe more (i am excluding
> firmware because it is not something where you may want
> to change a few lines manually).
>
> Right now we compile them statically in the code.
> However sometimes it is useful to update them 'on the fly'
> without having to rebuild a kernel/module - e.g. because
> an entry (e.g. a quirk for a specific device) cannot be
> safely included in the distribution, etc.etc.
>
> What are the options to implement a mechanism that lets
> userland update such tables, and maybe in a way that
> is accessible to the boot loader ?
>
> The (obvious) requirements are:
> + support for multiple tables with variable (maybe defined
> at compile time) structure;
> + initial values should be compiled in;
> + the access mechanism should provide mechanism to read/modify/write/delete
> entries;
> + human-readable (i.e. textual) representation of entries in userland,
> with hooks to translate them in a machine-friendly format on writes,
> and back on reads;
>
> sysctl is the first method that comes to my mind, but
> perhaps there is some better way ?
Windows and MAC OS X both use plain text files to hold things like PCI device
IDs to match drivers to devices. OS X uses an XML file format that lets you
list the PCI ID's a driver supports and the kernel auto-loads driver modules
by matching on PCI IDs. Many drivers can't be helped by this though, as they
use the device ID for for device-specific behavior (such as em(4) or
brgpy(4)).
--
John Baldwin
More information about the freebsd-arch
mailing list