acpi_spmc(4): Stop pretending that all constraints are verified
We do not check these constraints (yet), so stop printing that they are verified. While here, make the (not compiled in at the moment) "constraint violated" message more terse, and move the warning it contains to outside of the loop (no need to print it repeatedly if multiple constraints are violated). While here, bail out early if there are no constraints to avoid printing (in the future) that constraints are respected even when there are none. Reviewed by: imp (older version), obiwac Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56809
This commit is contained in:
@@ -655,9 +655,17 @@ acpi_spmc_get_constraints(device_t dev)
|
||||
static void
|
||||
acpi_spmc_check_constraints(struct acpi_spmc_softc *sc)
|
||||
{
|
||||
#ifdef notyet
|
||||
bool violation = false;
|
||||
#endif
|
||||
|
||||
KASSERT(sc->constraints_populated, ("Constraints not populated"));
|
||||
/*
|
||||
* Avoid printing that constraints are respected when there are no
|
||||
* constraints at all.
|
||||
*/
|
||||
if (sc->constraint_count == 0)
|
||||
return;
|
||||
for (size_t i = 0; i < sc->constraint_count; i++) {
|
||||
struct acpi_spmc_constraint *constraint = &sc->constraints[i];
|
||||
|
||||
@@ -671,19 +679,24 @@ acpi_spmc_check_constraints(struct acpi_spmc_softc *sc)
|
||||
if (ACPI_FAILURE(acpi_pwr_get_state(constraint->handle, &d_state)))
|
||||
continue;
|
||||
if (d_state < constraint->min_d_state) {
|
||||
device_printf(sc->dev, "constraint for device %s"
|
||||
" violated (minimum D-state required was %s, actual"
|
||||
" D-state is %s), might fail to enter LPI state\n",
|
||||
device_printf(sc->dev, "Constraint for device %s"
|
||||
" violated (current D-state: %s, "
|
||||
"required minimum D-state: %s).\n"
|
||||
constraint->name,
|
||||
acpi_d_state_to_str(constraint->min_d_state),
|
||||
acpi_d_state_to_str(d_state));
|
||||
acpi_d_state_to_str(d_state),
|
||||
acpi_d_state_to_str(constraint->min_d_state));
|
||||
violation = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!violation)
|
||||
#ifdef notyet
|
||||
if (violation)
|
||||
device_printf(sc->dev, "Some constraints violated, "
|
||||
"might fail to enter a Low-Power Idle state\n");
|
||||
else
|
||||
device_printf(sc->dev,
|
||||
"all device power constraints respected!\n");
|
||||
"All device power constraints respected!\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user