svn commit: r333333 - in head/sys: kern sys

Warner Losh imp at FreeBSD.org
Mon May 7 21:09:10 UTC 2018


Author: imp
Date: Mon May  7 21:09:08 2018
New Revision: 333333
URL: https://svnweb.freebsd.org/changeset/base/333333

Log:
  Add device_quiet_children() and device_has_quiet_children()
  
  If you add a child to a device that has quiet children, we'll
  automatically set the quiet flag on the children, and its
  children.
  
  This is indended for things like CPU that have a large amount of
  repetition in booting that adds nothing.

Modified:
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Mon May  7 20:54:42 2018	(r333332)
+++ head/sys/kern/subr_bus.c	Mon May  7 21:09:08 2018	(r333333)
@@ -1828,6 +1828,8 @@ make_device(device_t parent, const char *name, int uni
 			return (NULL);
 		}
 	}
+	if (parent != NULL && device_has_quiet_children(parent))
+		dev->flags |= DF_QUIET | DF_QUIET_CHILDREN;
 	dev->ivars = NULL;
 	dev->softc = NULL;
 
@@ -2649,12 +2651,30 @@ device_quiet(device_t dev)
 }
 
 /**
+ * @brief Set the DF_QUIET_CHILDREN flag for the device
+ */
+void
+device_quiet_children(device_t dev)
+{
+	dev->flags |= DF_QUIET_CHILDREN;
+}
+
+/**
  * @brief Clear the DF_QUIET flag for the device
  */
 void
 device_verbose(device_t dev)
 {
 	dev->flags &= ~DF_QUIET;
+}
+
+/**
+ * @brief Return non-zero if the DF_QUIET_CHIDLREN flag is set on the device
+ */
+int
+device_has_quiet_children(device_t dev)
+{
+	return ((dev->flags & DF_QUIET_CHILDREN) != 0);
 }
 
 /**

Modified: head/sys/sys/bus.h
==============================================================================
--- head/sys/sys/bus.h	Mon May  7 20:54:42 2018	(r333332)
+++ head/sys/sys/bus.h	Mon May  7 21:09:08 2018	(r333333)
@@ -89,6 +89,7 @@ struct u_device {
 #define	DF_EXTERNALSOFTC 0x40		/* softc not allocated by us */
 #define	DF_REBID	0x80		/* Can rebid after attach */
 #define	DF_SUSPENDED	0x100		/* Device is suspended. */
+#define DF_QUIET_CHILDREN 0x200		/* Default to quiet for all my children */
 
 /**
  * @brief Device request structure used for ioctl's.
@@ -584,6 +585,7 @@ device_state_t	device_get_state(device_t dev);
 int	device_get_unit(device_t dev);
 struct sysctl_ctx_list *device_get_sysctl_ctx(device_t dev);
 struct sysctl_oid *device_get_sysctl_tree(device_t dev);
+int	device_has_quiet_children(device_t dev);
 int	device_is_alive(device_t dev);	/* did probe succeed? */
 int	device_is_attached(device_t dev);	/* did attach succeed? */
 int	device_is_enabled(device_t dev);
@@ -597,6 +599,7 @@ int	device_probe_and_attach(device_t dev);
 int	device_probe_child(device_t bus, device_t dev);
 int	device_quiesce(device_t dev);
 void	device_quiet(device_t dev);
+void	device_quiet_children(device_t dev);
 void	device_set_desc(device_t dev, const char* desc);
 void	device_set_desc_copy(device_t dev, const char* desc);
 int	device_set_devclass(device_t dev, const char *classname);


More information about the svn-src-head mailing list