Page MenuHomeFreeBSD

D56817.id177208.diff
No OneTemporary

D56817.id177208.diff

diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -73,7 +73,6 @@
*/
int revision;
struct uuid uuid;
- uint64_t supported_functions;
uint64_t expected_functions;
uint64_t extra_functions;
/* Human-friendly names of supported functions. */
@@ -184,7 +183,7 @@
.function_names_nb = nitems(dsm_amd_function_names),
};
-static struct dsm_desc *const dsms[] = {
+static const struct dsm_desc *const dsms[] = {
[DSM_INTEL] = &dsm_intel,
[DSM_MS] = &dsm_ms,
[DSM_AMD] = &dsm_amd,
@@ -219,6 +218,7 @@
device_t dev;
ACPI_HANDLE handle;
int supported_dsms;
+ uint64_t supported_functions[nitems(dsms)];
struct eventhandler_entry *eh_suspend;
struct eventhandler_entry *eh_resume;
@@ -316,13 +316,17 @@
}
static bool
-dsm_supports_function(const struct dsm_desc *const dsm, int function_index)
+dsm_supports_function(const struct acpi_spmc_softc *const sc,
+ const u_int dsm_index, int function_index)
{
- return ((dsm->supported_functions & IDX_TO_BIT(function_index)) != 0);
+ MPASS(dsm_index < nitems(sc->supported_functions));
+
+ return ((sc->supported_functions[dsm_index] &
+ IDX_TO_BIT(function_index)) != 0);
}
static void acpi_spmc_probe_dsm(struct acpi_spmc_softc *sc,
- ACPI_HANDLE handle, struct dsm_desc *const dsm);
+ ACPI_HANDLE handle, const struct dsm_desc *const dsm);
static void acpi_spmc_dsm_check_functions(
const struct acpi_spmc_softc *const sc,
const struct dsm_desc *const dsm);
@@ -344,11 +348,6 @@
if (ACPI_ID_PROBE(device_get_parent(dev), dev, spmc_ids, &name) > 0)
return (ENXIO);
- if (device_get_unit(dev) > 0) {
- device_printf(dev, "shouldn't have more than one SPMC");
- return (ENXIO);
- }
-
device_set_desc(dev, "System Power Management Controller");
return (BUS_PROBE_DEFAULT);
@@ -427,16 +426,17 @@
acpi_spmc_dsm_check_functions(const struct acpi_spmc_softc *const sc,
const struct dsm_desc *const dsm)
{
- const uint64_t missing = dsm->expected_functions &
- ~dsm->supported_functions;
- const uint64_t unknown = dsm->supported_functions &
+ const uint64_t supported_functions =
+ sc->supported_functions[dsm->index];
+ const uint64_t missing = dsm->expected_functions & supported_functions;
+ const uint64_t unknown = supported_functions &
~(dsm->expected_functions | dsm->extra_functions);
char buf[128];
- print_bit_field(buf, nitems(buf), dsm->supported_functions,
+ print_bit_field(buf, nitems(buf), supported_functions,
"FUNC", pbf_function_name, dsm);
device_printf(sc->dev, "DSM %s: Supported functions: %#" PRIx64 "%s\n",
- dsm->name, dsm->supported_functions, buf);
+ dsm->name, supported_functions, buf);
if (missing != 0) {
print_bit_field(buf, nitems(buf), missing, "FUNC",
@@ -457,17 +457,17 @@
static void
acpi_spmc_probe_dsm(struct acpi_spmc_softc *sc, ACPI_HANDLE handle,
- struct dsm_desc *const dsm)
+ const struct dsm_desc *const dsm)
{
const uint64_t supported_functions = acpi_DSMQuery(handle,
- (uint8_t *)&dsm->uuid, dsm->revision);
+ (const uint8_t *)&dsm->uuid, dsm->revision);
/*
* DSM is supported if bit 0 is set.
*/
if ((supported_functions & 1) == 0)
return;
- dsm->supported_functions = supported_functions & ~1;
+ sc->supported_functions[dsm->index] = supported_functions & ~1;
sc->supported_dsms |= IDX_TO_BIT(dsm->index);
}
@@ -781,7 +781,7 @@
acpi_spmc_run_dsm(dev, &dsm_amd, DSM_AMD_LPI_EXIT_NOTIF);
if (has_dsm(sc, DSM_MS)) {
acpi_spmc_run_dsm(dev, &dsm_ms, DSM_INTEL_MS_LPI_EXIT_NOTIF);
- if (dsm_supports_function(&dsm_ms, DSM_MS_TURN_ON_DISPLAY))
+ if (dsm_supports_function(sc, DSM_MS, DSM_MS_TURN_ON_DISPLAY))
acpi_spmc_run_dsm(dev, &dsm_ms,
DSM_MS_TURN_ON_DISPLAY);
acpi_spmc_run_dsm(dev, &dsm_ms, DSM_MS_SLEEP_EXIT_NOTIF);

File Metadata

Mime Type
text/plain
Expires
Wed, May 20, 10:42 AM (7 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32707811
Default Alt Text
D56817.id177208.diff (3 KB)

Event Timeline