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.
This commit is contained in:
imp 2018-05-07 21:09:08 +00:00
parent ec95c631af
commit 49016bf8e3
2 changed files with 23 additions and 0 deletions

View File

@ -1828,6 +1828,8 @@ make_device(device_t parent, const char *name, int unit)
return (NULL);
}
}
if (parent != NULL && device_has_quiet_children(parent))
dev->flags |= DF_QUIET | DF_QUIET_CHILDREN;
dev->ivars = NULL;
dev->softc = NULL;
@ -2648,6 +2650,15 @@ device_quiet(device_t dev)
dev->flags |= DF_QUIET;
}
/**
* @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
*/
@ -2657,6 +2668,15 @@ 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);
}
/**
* @brief Return non-zero if the DF_QUIET flag is set on the device
*/

View File

@ -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);