Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Feb 2007 11:09:12 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Subject:   Re: configurable device (and other) tables in the kernel ?
Message-ID:  <200702011109.12821.jhb@freebsd.org>
In-Reply-To: <20070131115148.A60420@xorpc.icir.org>
References:  <20070131115148.A60420@xorpc.icir.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702011109.12821.jhb>