Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157484756
D56879.id177413.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D56879.id177413.diff
View Options
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
@@ -461,7 +461,7 @@
print_bit_field(buf, nitems(buf), missing, "FUNC",
pbf_function_name, dsm);
device_printf(sc->dev, "DSM %s: Does not enumerate expected "
- "functions %#" PRIx64 "%s. Calls to them may fail.\n",
+ "functions %#" PRIx64 "%s. Will skip calling them.\n",
dsm->name, missing, buf);
}
@@ -636,14 +636,14 @@
* report that condition to us, and somewhat arbitrarily favor the Intel
* one because it at least has a written specification.
*/
- if (has_dsm(sc, DSM_INTEL)) {
+ if (supports_function(sc, DSM_INTEL, DSM_GET_DEVICE_CONSTRAINTS)) {
dsm = &dsm_intel;
- if (has_dsm(sc, DSM_AMD))
+ if (supports_function(sc, DSM_AMD, DSM_GET_DEVICE_CONSTRAINTS))
device_printf(sc->dev, "Constraints: Both Intel and "
- "AMD DSMs are present!\n"
+ "AMD DSMs support getting them!\n"
"Using constraints from Intel.\nPlease report.\n");
- } else if (has_dsm(sc, DSM_AMD))
+ } else if (supports_function(sc, DSM_AMD, DSM_GET_DEVICE_CONSTRAINTS))
dsm = &dsm_amd;
else
return (0);
@@ -691,14 +691,16 @@
}
static void
-acpi_spmc_check_constraints(struct acpi_spmc_softc *sc)
+acpi_spmc_check_constraints(device_t dev)
{
+ const struct acpi_spmc_softc *const sc = device_get_softc(dev);
#ifdef notyet
bool violation = false;
#endif
for (size_t i = 0; i < sc->constraint_count; i++) {
- struct acpi_spmc_constraint *constraint = &sc->constraints[i];
+ const struct acpi_spmc_constraint *constraint =
+ &sc->constraints[i];
if (!constraint->enabled)
continue;
@@ -730,6 +732,7 @@
#endif
}
+/* Only runs a DSM function if that function was reported present. */
static void
acpi_spmc_run(device_t dev, const struct dsm_desc *const dsm,
const int function_index)
@@ -738,6 +741,9 @@
ACPI_STATUS status;
ACPI_BUFFER result;
+ if (!supports_function(sc, dsm->index, function_index))
+ return;
+
status = acpi_EvaluateDSMTyped(sc->handle, (const uint8_t *)&dsm->uuid,
dsm->revision, function_index, NULL, &result, ACPI_TYPE_ANY);
@@ -757,67 +763,40 @@
static void
acpi_spmc_display_off_notif(device_t dev)
{
- struct acpi_spmc_softc *sc = device_get_softc(dev);
-
- if (has_dsm(sc, DSM_INTEL))
- acpi_spmc_run(dev, &dsm_intel,
- DSM_INTEL_MS_DISPLAY_OFF_NOTIF);
- if (has_dsm(sc, DSM_MS))
- acpi_spmc_run(dev, &dsm_ms,
- DSM_INTEL_MS_DISPLAY_OFF_NOTIF);
- if (has_dsm(sc, DSM_AMD))
- acpi_spmc_run(dev, &dsm_amd, DSM_AMD_DISPLAY_OFF_NOTIF);
+ acpi_spmc_run(dev, &dsm_intel, DSM_INTEL_MS_DISPLAY_OFF_NOTIF);
+ acpi_spmc_run(dev, &dsm_ms, DSM_INTEL_MS_DISPLAY_OFF_NOTIF);
+ acpi_spmc_run(dev, &dsm_amd, DSM_AMD_DISPLAY_OFF_NOTIF);
}
static void
acpi_spmc_display_on_notif(device_t dev)
{
- struct acpi_spmc_softc *sc = device_get_softc(dev);
-
- if (has_dsm(sc, DSM_INTEL))
- acpi_spmc_run(dev, &dsm_intel,
- DSM_INTEL_MS_DISPLAY_ON_NOTIF);
- if (has_dsm(sc, DSM_MS))
- acpi_spmc_run(dev, &dsm_ms,
- DSM_INTEL_MS_DISPLAY_ON_NOTIF);
- if (has_dsm(sc, DSM_AMD))
- acpi_spmc_run(dev, &dsm_amd, DSM_AMD_DISPLAY_ON_NOTIF);
+ acpi_spmc_run(dev, &dsm_intel, DSM_INTEL_MS_DISPLAY_ON_NOTIF);
+ acpi_spmc_run(dev, &dsm_ms, DSM_INTEL_MS_DISPLAY_ON_NOTIF);
+ acpi_spmc_run(dev, &dsm_amd, DSM_AMD_DISPLAY_ON_NOTIF);
}
static void
acpi_spmc_entry_notif(device_t dev)
{
- struct acpi_spmc_softc *sc = device_get_softc(dev);
+ /* XXX - No real check currently. Check return code when it does. */
+ acpi_spmc_check_constraints(dev);
- acpi_spmc_check_constraints(sc);
-
- if (has_dsm(sc, DSM_AMD))
- acpi_spmc_run(dev, &dsm_amd, DSM_AMD_LPI_ENTRY_NOTIF);
- if (has_dsm(sc, DSM_MS)) {
- acpi_spmc_run(dev, &dsm_ms, DSM_MS_SLEEP_ENTRY_NOTIF);
- acpi_spmc_run(dev, &dsm_ms, DSM_INTEL_MS_LPI_ENTRY_NOTIF);
- }
- if (has_dsm(sc, DSM_INTEL))
- acpi_spmc_run(dev, &dsm_intel,
- DSM_INTEL_MS_LPI_ENTRY_NOTIF);
+ acpi_spmc_run(dev, &dsm_amd, DSM_AMD_LPI_ENTRY_NOTIF);
+ acpi_spmc_run(dev, &dsm_ms, DSM_MS_SLEEP_ENTRY_NOTIF);
+ acpi_spmc_run(dev, &dsm_ms, DSM_INTEL_MS_LPI_ENTRY_NOTIF);
+ acpi_spmc_run(dev, &dsm_intel, DSM_INTEL_MS_LPI_ENTRY_NOTIF);
}
static void
acpi_spmc_exit_notif(device_t dev)
{
- struct acpi_spmc_softc *sc = device_get_softc(dev);
-
- if (has_dsm(sc, DSM_INTEL))
- acpi_spmc_run(dev, &dsm_intel, DSM_INTEL_MS_LPI_EXIT_NOTIF);
- if (has_dsm(sc, DSM_AMD))
- acpi_spmc_run(dev, &dsm_amd, DSM_AMD_LPI_EXIT_NOTIF);
- if (has_dsm(sc, DSM_MS)) {
- acpi_spmc_run(dev, &dsm_ms, DSM_INTEL_MS_LPI_EXIT_NOTIF);
- if (supports_function(sc, DSM_MS, DSM_MS_TURN_ON_DISPLAY))
- acpi_spmc_run(dev, &dsm_ms,
- DSM_MS_TURN_ON_DISPLAY);
- acpi_spmc_run(dev, &dsm_ms, DSM_MS_SLEEP_EXIT_NOTIF);
- }
+ acpi_spmc_run(dev, &dsm_intel, DSM_INTEL_MS_LPI_EXIT_NOTIF);
+ acpi_spmc_run(dev, &dsm_amd, DSM_AMD_LPI_EXIT_NOTIF);
+ acpi_spmc_run(dev, &dsm_ms, DSM_INTEL_MS_LPI_EXIT_NOTIF);
+ /* Hint to the platform we are soon going to turn on the display. */
+ acpi_spmc_run(dev, &dsm_ms, DSM_MS_TURN_ON_DISPLAY);
+ acpi_spmc_run(dev, &dsm_ms, DSM_MS_SLEEP_EXIT_NOTIF);
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 22, 11:18 PM (19 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32776671
Default Alt Text
D56879.id177413.diff (5 KB)
Attached To
Mode
D56879: acpi_spmc(4): Only run DSM functions reported present
Attached
Detach File
Event Timeline
Log In to Comment