Date: Tue, 1 Jan 2008 07:55:56 +1100 (EST) From: Peter Jeremy <peterjeremy@optushome.com.au> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/119202: [patch] Add generic support for disabling devices Message-ID: <200712312055.lBVKtuKf003755@turion.vk2pj.dyndns.org> Resent-Message-ID: <200712312100.lBVL02F1036981@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712312055.lBVKtuKf003755>