git: 6da01f06ef79 - main - acpi_spmc(4): Be less verbose by default

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Wed, 13 May 2026 12:40:00 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=6da01f06ef7964f8a58369e7d1605ce10a49b82c

commit 6da01f06ef7964f8a58369e7d1605ce10a49b82c
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-05-05 12:36:57 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-05-13 12:38:24 +0000

    acpi_spmc(4): Be less verbose by default
    
    Do not print by default details of failures that are unlikely to help
    a normal user and to have a crucial influence on whether suspension
    works correctly.  Do so only on a verbose boot or if requested
    explicitly by the user via 'debug.acpi.spmc.verbose'.
    
    In particular:
    - On an Intel Framework laptop, the Microsoft DSM only reports the
      SLEEP_ENTRY and SLEEP_EXIT functions.  That makes some sense since,
      according to its specification, all functions of a Microsoft DSM
      except these two are in fact redundant with Intel DSM's ones (also,
      that of AMD DSM's ones).  Those functions being missing are only
      a potential problem if there is no other DSM than Microsoft's (yet to
      be observed in the field).
    - The details of malformed/unapplicable constraints or ones with a newer
      format the driver does not know about are not readily actionable
      pieces of information, but rather debug/developer-oriented ones.  When
      verbosity is not requested, only print the details of the first such
      failure to encourage reporting and at the same time avoid cluttering
      the output.
    - Detecting and printing unknown DSM functions is not directly
      actionable either, and the driver not using these functions may not
      prevent suspending (but might, e.g., prevent reaching deeper sleep
      states).
    
    Reviewed by:    obiwac
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D56876
---
 sys/dev/acpica/acpi_spmc.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
index d67ac2770f7e..1ce4401ebcf4 100644
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -448,7 +448,7 @@ acpi_spmc_dsm_print_functions(const struct acpi_spmc_softc *const sc,
 	device_printf(sc->dev, "DSM %s: Supported functions: %#" PRIx64 "%s\n",
 	    dsm->name, supported_functions, buf);
 
-	if (missing != 0) {
+	if (VERBOSE() && missing != 0) {
 		print_bit_field(buf, sizeof(buf), missing, "FUNC",
 		    pbf_function_name, dsm);
 		device_printf(sc->dev, "DSM %s: Does not enumerate expected "
@@ -456,7 +456,7 @@ acpi_spmc_dsm_print_functions(const struct acpi_spmc_softc *const sc,
 		    dsm->name, missing, buf);
 	}
 
-	if (unknown != 0) {
+	if (VERBOSE() && unknown != 0) {
 		print_bit_field(buf, sizeof(buf), unknown, "FUNC",
 		    pbf_function_name, dsm);
 		device_printf(sc->dev, "DSM %s: Supports more functions than "
@@ -528,8 +528,13 @@ acpi_spmc_parse_constraints_intel(struct acpi_spmc_softc *sc, ACPI_OBJECT *objec
 		 */
 		revision = detail->Package.Elements[0].Integer.Value;
 		if (revision != 0) {
-			device_printf(sc->dev, "Intel: Unknown revision %d for "
-			    "constraint %zu's detail package\n", revision, i);
+			/* Only print this error message once if not verbose. */
+			if (VERBOSE() || sc->constraint_count ==
+			    object->Package.Count)
+				device_printf(sc->dev,
+				    "Intel: Unknown revision %d for "
+				    "constraint %zu's detail package\n",
+				    revision, i);
 			sc->constraint_count--;
 			continue;
 		}
@@ -661,9 +666,11 @@ acpi_spmc_get_constraints(struct acpi_spmc_softc *const sc)
 		status = acpi_GetHandleInScope(sc->handle,
 		    __DECONST(char *, constraint->name), &constraint->handle);
 		if (ACPI_FAILURE(status)) {
-			device_printf(sc->dev,
-			    "Constraints: Cannot get handle for %s, ignoring\n",
-			    constraint->name);
+			if (VERBOSE())
+				device_printf(sc->dev,
+				    "Constraints: Cannot get handle for %s, "
+				    "ignoring\n",
+				    constraint->name);
 			constraint->handle = NULL;
 		}
 	}