git: ebad66abbc1f - main - acpi_spmc(4): Print supported functions after DSMs

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

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

commit ebad66abbc1f25a761add6481de99abf474b2d87
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-05-04 16:19:31 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-05-13 12:38:22 +0000

    acpi_spmc(4): Print supported functions after DSMs
    
    This makes things more top-down, as expected when probing devices.
    
    Reviewed by:    imp, obiwac
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D56811
---
 sys/dev/acpica/acpi_spmc.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
index 939f254fbf7f..33915b536667 100644
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -326,7 +326,7 @@ failed_to_call_dsm(const struct acpi_spmc_softc *const sc,
 	    dsm->name, dsm->revision, dsm_function_name(dsm, function_index));
 }
 
-static void	acpi_spmc_check_dsm(struct acpi_spmc_softc *sc,
+static void	acpi_spmc_probe_dsm(struct acpi_spmc_softc *sc,
 		    ACPI_HANDLE handle, struct dsm_desc *const dsm);
 static void	acpi_spmc_dsm_print_functions(
 		    const struct acpi_spmc_softc *const sc,
@@ -380,7 +380,7 @@ acpi_spmc_attach(device_t dev)
 		    ("%s: Inconsistent indices for DSM %s", __func__,
 		    dsms[i]->name));
 
-		acpi_spmc_check_dsm(sc, handle, dsms[i]);
+		acpi_spmc_probe_dsm(sc, handle, dsms[i]);
 	}
 
 	if (sc->dsms == 0) {
@@ -391,6 +391,11 @@ acpi_spmc_attach(device_t dev)
 	print_bit_field(buf, sizeof(buf), sc->dsms, "DSM", pbf_dsm_name, NULL);
 	device_printf(dev, "DSMs supported: %s\n", buf);
 
+	/* Print supported functions of usable DSMs. */
+	for (int i = 0; i < nitems(dsms); ++i)
+		if (has_dsm(sc, i))
+			acpi_spmc_dsm_print_functions(sc, dsms[i]);
+
 	/* Get device constraints. We can only call this once so do this now. */
 	acpi_spmc_get_constraints(dev);
 
@@ -447,7 +452,7 @@ acpi_spmc_dsm_print_functions(const struct acpi_spmc_softc *const sc,
 }
 
 static void
-acpi_spmc_check_dsm(struct acpi_spmc_softc *sc, ACPI_HANDLE handle,
+acpi_spmc_probe_dsm(struct acpi_spmc_softc *sc, ACPI_HANDLE handle,
     struct dsm_desc *const dsm)
 {
 	const uint64_t supported_functions = acpi_DSMQuery(handle,
@@ -460,7 +465,6 @@ acpi_spmc_check_dsm(struct acpi_spmc_softc *sc, ACPI_HANDLE handle,
 		return;
 	dsm->supported_functions = supported_functions & ~1;
 	sc->dsms |= IDX_TO_BIT(dsm->index);
-	acpi_spmc_dsm_print_functions(sc, dsm);
 }
 
 static void