Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2007 07:49:50 +1000
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        "Patrick M. Hausen" <hausen@punkt.de>
Cc:        Michael Proto <mike@jellydonut.org>, freebsd-stable@freebsd.org
Subject:   Re: Limiting the number of probed interfaces?
Message-ID:  <20070503214950.GS818@turion.vk2pj.dyndns.org>
In-Reply-To: <20070503133048.GA42241@hugo10.ka.punkt.de>
References:  <20070503082309.GG8556@hugo10.ka.punkt.de> <4639DA64.9090608@jellydonut.org> <20070503133048.GA42241@hugo10.ka.punkt.de>

next in thread | previous in thread | raw e-mail | index | archive | help

--hYooF8G/hrfVAmum
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2007-May-03 15:30:48 +0200, "Patrick M. Hausen" <hausen@punkt.de> 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.
>>=20
>> Would the following in /boot/device.hints achieve what you are after?
>>=20
>> hint.bge.1.disabled=3D"1"
>> hint.bge.2.disabled=3D"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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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);
=20
-			result =3D DEVICE_PROBE(child);
+			if (resource_disabled(dl->driver->name, child->unit))
+				result =3D ENXIO;
+			else
+				result =3D DEVICE_PROBE(child);
=20
 			/* Reset flags and devclass before the next probe. */
 			child->devflags =3D 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 |=3D DF_REBID;
 #endif

--=20
Peter Jeremy

--hYooF8G/hrfVAmum
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFGOlj+/opHv/APuIcRAsNnAJ4ifGgD+wdBs/DoNqaUoBHWF7h22gCgtV6y
xKIG2B7ao89HIy85QYQe+HA=
=8aHe
-----END PGP SIGNATURE-----

--hYooF8G/hrfVAmum--



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