On 2007-May-03 15:30:48 +0200, "Patrick M. Hausen" <[EMAIL PROTECTED]> wrote: >Hello! > >On Thu, May 03, 2007 at 08:49:40AM -0400, Michael Proto wrote: > >> > Is there a way to limit the number of probed entities for >> > a certain pci device class to, say, 1 in my case? >> > I'd like to use bge0 for FreeBSD but the kernel should leave >> > everything else that might be a bge interface alone. >> >> Would the following in /boot/device.hints achieve what you are after? >> >> hint.bge.1.disabled="1" >> hint.bge.2.disabled="1" > >That would be the feature I am seeking. Unfortunately this >had no effect. I already tried. The latest statement I was able >to find via Google claimed, that for FBSD 5.2 "you cannot disable >PCI devices other than completely removing the driver". >I don't know if this has changed since then.
Unfortunately, the 'disabled' hint is not handled generically. There
is support for disabling ISA devices and a handful of other devices
but bge is not amongst them.
Possibly the following (untested) code would work but I have a feeling
it would run afoul of dynamic device numbering. (It seems too simple
a solution to have not been implemented if it would work).
Index: /usr/src/sys/kern/subr_bus.c
===================================================================
RCS file: /usr/ncvs/src/sys/kern/subr_bus.c,v
retrieving revision 1.184.2.5
diff -u -r1.184.2.5 subr_bus.c
--- /usr/src/sys/kern/subr_bus.c 28 Dec 2006 22:13:26 -0000
1.184.2.5
+++ /usr/src/sys/kern/subr_bus.c 3 May 2007 21:45:49 -0000
@@ -1722,7 +1722,10 @@
resource_int_value(dl->driver->name, child->unit,
"flags", &child->devflags);
- result = DEVICE_PROBE(child);
+ if (resource_disabled(dl->driver->name, child->unit))
+ result = ENXIO;
+ else
+ result = DEVICE_PROBE(child);
/* Reset flags and devclass before the next probe. */
child->devflags = 0;
@@ -1805,7 +1808,8 @@
* A bit bogus. Call the probe method again to make
* sure that we have the right description.
*/
- DEVICE_PROBE(child);
+ if (!resource_disabled(dl->driver->name, child->unit))
+ DEVICE_PROBE(child);
#if 0
child->flags |= DF_REBID;
#endif
--
Peter Jeremy
pgphv475G7lpX.pgp
Description: PGP signature
