kern/119202: [patch] Add generic support for disabling devices
Peter Jeremy
peterjeremy at optushome.com.au
Mon Dec 31 13:00:03 PST 2007
>Number: 119202
>Category: kern
>Synopsis: [patch] Add generic support for disabling devices
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Dec 31 21:00:02 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator: Peter Jeremy
>Release: FreeBSD 6.3-PRERELEASE amd64
>Organization:
n/a
>Environment:
System: FreeBSD turion.vk2pj.dyndns.org 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #31: Wed Dec 26 09:23:54 EST 2007 root at turion.vk2pj.dyndns.org:/usr/obj/usr/src/sys/turion amd64
>Description:
FreeBSD supports a device.unit.disabled boot variable but this
is only supported for some devices. By adding the test into
the generic device probing code, it is possible to disable any
device.
>How-To-Repeat:
Code inspection.
>Fix:
Index: sys/kern/subr_bus.c
===================================================================
RCS file: /usr/ncvs/src/sys/kern/subr_bus.c,v
retrieving revision 1.184.2.6
diff -u -r1.184.2.6 subr_bus.c
--- sys/kern/subr_bus.c 5 Nov 2007 11:49:44 -0000 1.184.2.6
+++ sys/kern/subr_bus.c 25 Dec 2007 20:41:41 -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(best->driver->name, child->unit))
+ DEVICE_PROBE(child);
#if 0
child->flags |= DF_REBID;
#endif
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list