git: b092ee520618 - main - acpi_spmc(4): softc: Move supported functions into a DSM info structure

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

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

commit b092ee520618a8e8df7f4d7fb095e8940dd0d305
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-05-06 13:15:27 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-05-13 12:38:25 +0000

    acpi_spmc(4): softc: Move supported functions into a DSM info structure
    
    This is in preparation to adding the revision as a probed information.
    
    Reviewed by:    obiwac
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D56880
---
 sys/dev/acpica/acpi_spmc.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
index c33336d10ec3..244e7795ba84 100644
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -211,6 +211,11 @@ SYSCTL_BOOL(_debug_acpi_spmc, OID_AUTO, always_call_expected_functions,
     CTLFLAG_RW, &force_call_expected_functions, 0,
     "Call all expected functions on a present DSM, even those not enumerated.");
 
+/* Per DSM probed information. */
+struct dsm_info {
+	uint64_t	supported_functions;
+};
+
 struct acpi_spmc_constraint {
 	bool		enabled;
 	char		*name;
@@ -228,7 +233,7 @@ struct acpi_spmc_constraint {
 struct acpi_spmc_softc {
 	device_t		dev;
 	ACPI_HANDLE		handle;
-	uint64_t		supported_functions[nitems(dsms)];
+	struct dsm_info		dsms_info[nitems(dsms)];
 
 	struct eventhandler_entry	*eh_suspend;
 	struct eventhandler_entry	*eh_resume;
@@ -252,9 +257,9 @@ static bool
 supports_function(const struct acpi_spmc_softc *const sc, const int dsm_index,
     const int function_index)
 {
-	MPASS(0 <= dsm_index && dsm_index < nitems(sc->supported_functions));
+	MPASS(0 <= dsm_index && dsm_index < nitems(dsms));
 
-	return ((sc->supported_functions[dsm_index] &
+	return ((sc->dsms_info[dsm_index].supported_functions &
 	    IDX_TO_BIT(function_index)) != 0);
 }
 
@@ -451,7 +456,7 @@ acpi_spmc_dsm_print_functions(const struct acpi_spmc_softc *const sc,
 	 * report as unknown.
 	 */
 	const uint64_t supported_functions = ~IDX_TO_BIT(DSM_ENUM_FUNCTIONS) &
-	    sc->supported_functions[dsm->index];
+	    sc->dsms_info[dsm->index].supported_functions;
 	const uint64_t missing = dsm->expected_functions & ~supported_functions;
 	const uint64_t unknown = supported_functions &
 	    ~(dsm->expected_functions | dsm->extra_functions);
@@ -491,7 +496,7 @@ acpi_spmc_probe_dsm(struct acpi_spmc_softc *const sc,
 	 */
 	if ((supported_functions & IDX_TO_BIT(DSM_ENUM_FUNCTIONS)) == 0)
 		return;
-	sc->supported_functions[dsm->index] = supported_functions;
+	sc->dsms_info[dsm->index].supported_functions = supported_functions;
 }
 
 static void