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
This commit is contained in:
Olivier Certner
2026-05-06 15:15:27 +02:00
parent 65ecfb4a66
commit b092ee5206
+10 -5
View File
@@ -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