Bug 119202 - [kernel] [patch] Add generic support for disabling devices
Summary: [kernel] [patch] Add generic support for disabling devices
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 6.3-PRERELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Eitan Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-31 21:00 UTC by Peter Jeremy
Modified: 2012-10-14 19:07 UTC (History)
0 users

See Also:


Attachments
file.diff (960 bytes, patch)
2007-12-31 21:00 UTC, Peter Jeremy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Jeremy 2007-12-31 21:00:02 UTC
	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.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2012-03-25 04:34:54 UTC
Responsible Changed
From-To: freebsd-bugs->eadler

I don't see anything obviously wrong with the idea of generic disabling 
- but this would require some discussion; take until I could deal with 
it
Comment 2 dfilter service freebsd_committer freebsd_triage 2012-10-02 04:33:57 UTC
Author: eadler
Date: Tue Oct  2 03:33:41 2012
New Revision: 241119
URL: http://svn.freebsd.org/changeset/base/241119

Log:
  Provide a generic way to disable devices at boot time
  
  PR:		kern/119202
  Requested by:	peterj
  Reviewed by:	sbruno, jhb
  Approved by:	cperciva
  MFC after:	1 week

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Tue Oct  2 00:30:26 2012	(r241118)
+++ head/sys/kern/subr_bus.c	Tue Oct  2 03:33:41 2012	(r241119)
@@ -2762,6 +2762,13 @@ device_attach(device_t dev)
 {
 	int error;
 
+	if (resource_disabled(dev->driver->name, dev->unit)) {
+		device_disable(dev);
+		if (bootverbose)
+			 device_printf(dev, "disabled via hints entry\n");
+		return (ENXIO);
+	}
+
 	device_sysctl_init(dev);
 	if (!device_is_quiet(dev))
 		device_print_child(dev->parent, dev);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2012-10-14 19:07:32 UTC
State Changed
From-To: open->closed

Committed. Thanks!