Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jun 2011 07:38:21 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-current@freebsd.org
Cc:        Jeremy Messenger <mezz.freebsd@gmail.com>, Robert Millan <rmh@debian.org>, Warner Losh <imp@bsdimp.com>
Subject:   Re: Automatic load of PCI kernel modules [WAS: [RFT] Automatic load of USB kernel modules]
Message-ID:  <201106260738.21847.hselasky@c2i.net>
In-Reply-To: <201106251907.02052.hselasky@c2i.net>
References:  <201106242342.47194.hselasky@c2i.net> <ACCD2B48-1E78-42B6-883E-542FDFD567F6@bsdimp.com> <201106251907.02052.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday 25 June 2011 19:07:01 Hans Petter Selasky wrote:
> On Saturday 25 June 2011 18:45:14 Warner Losh wrote:
> > On Jun 25, 2011, at 9:42 AM, Hans Petter Selasky wrote:
> > > On Saturday 25 June 2011 01:05:26 Jeremy Messenger wrote:
> > >> Jeremy Messenger
> > > 
> > > Done.
> > > 
> > > http://svn.freebsd.org/changeset/base/223536
> > 
> > Please move it back.  It doesn't belong in /etc/defaults.  It belongs in
> > /etc/devd if we're going to have it at all.  If you have a full GENERIC
> > kernel, there will never be a NOMATCH line generated, so these entries
> > will just be ignored.
> > 
> > Warner
> 
> Done.
> 
> http://svn.freebsd.org/changeset/base/223543
> 

Hi,

I see that a lot of PCI device drivers use code to check their ID's.

One simple way to dump all the PCI device ID's is to compile or load all 
modules and then make a dummy PCI device, which only calls device_probe on the 
full 32-bit space of the pci_get_devid(). This should take in matter of some 
minutes to produce a complete list of PCI ID's. Then add these ID's to all the 
respective drivers like a generic device ID table:

struct pci_device_id {
	uint32_t device_id;
	uint32_t card_id;
	const char *description;
	unsigned long driver_info;
} __aligned(32);

Then export those automatically generated structures into the "pci_device_id" 
section and have tools/bus_autoconf generate the matching rules.

PCI format structure for bus_autoconf:

"pci_device_id{256,:}"
"device_id[0]{" U32_XOR ",8}"
"device_id[1]{" U32_XOR ",8}"
"device_id[2]{" U32_XOR ",8}"
"device_id[3]{" U32_XOR ",8}"

"card_id[0]{" U32_XOR ",8}"
"card_id[1]{" U32_XOR ",8}"
"card_id[2]{" U32_XOR ",8}"
"card_id[3]{" U32_XOR ",8}"

--HPS



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