Skip to content

Commit f754006

Browse files
superm1rafaeljw
authored andcommitted
ACPI: x86: Add pm_debug_messages for LPS0 _DSM state tracking
Enabling debugging messages for the state requires turning on dynamic debugging for the file. To make it more accessible, use `pm_debug_messages` and clearer strings for what is happening. Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent cdb8c10 commit f754006

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

drivers/acpi/x86/s2idle.c

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ static int lps0_dsm_func_mask;
5959

6060
static guid_t lps0_dsm_guid_microsoft;
6161
static int lps0_dsm_func_mask_microsoft;
62+
static int lps0_dsm_state;
6263

6364
/* Device constraint entry structure */
6465
struct lpi_device_info {
@@ -320,6 +321,44 @@ static void lpi_check_constraints(void)
320321
}
321322
}
322323

324+
static bool acpi_s2idle_vendor_amd(void)
325+
{
326+
return boot_cpu_data.x86_vendor == X86_VENDOR_AMD;
327+
}
328+
329+
static const char *acpi_sleep_dsm_state_to_str(unsigned int state)
330+
{
331+
if (lps0_dsm_func_mask_microsoft || !acpi_s2idle_vendor_amd()) {
332+
switch (state) {
333+
case ACPI_LPS0_SCREEN_OFF:
334+
return "screen off";
335+
case ACPI_LPS0_SCREEN_ON:
336+
return "screen on";
337+
case ACPI_LPS0_ENTRY:
338+
return "lps0 entry";
339+
case ACPI_LPS0_EXIT:
340+
return "lps0 exit";
341+
case ACPI_LPS0_MS_ENTRY:
342+
return "lps0 ms entry";
343+
case ACPI_LPS0_MS_EXIT:
344+
return "lps0 ms exit";
345+
}
346+
} else {
347+
switch (state) {
348+
case ACPI_LPS0_SCREEN_ON_AMD:
349+
return "screen on";
350+
case ACPI_LPS0_SCREEN_OFF_AMD:
351+
return "screen off";
352+
case ACPI_LPS0_ENTRY_AMD:
353+
return "lps0 entry";
354+
case ACPI_LPS0_EXIT_AMD:
355+
return "lps0 exit";
356+
}
357+
}
358+
359+
return "unknown";
360+
}
361+
323362
static void acpi_sleep_run_lps0_dsm(unsigned int func, unsigned int func_mask, guid_t dsm_guid)
324363
{
325364
union acpi_object *out_obj;
@@ -331,14 +370,15 @@ static void acpi_sleep_run_lps0_dsm(unsigned int func, unsigned int func_mask, g
331370
rev_id, func, NULL);
332371
ACPI_FREE(out_obj);
333372

334-
acpi_handle_debug(lps0_device_handle, "_DSM function %u evaluation %s\n",
335-
func, out_obj ? "successful" : "failed");
373+
lps0_dsm_state = func;
374+
if (pm_debug_messages_on) {
375+
acpi_handle_info(lps0_device_handle,
376+
"%s transitioned to state %s\n",
377+
out_obj ? "Successfully" : "Failed to",
378+
acpi_sleep_dsm_state_to_str(lps0_dsm_state));
379+
}
336380
}
337381

338-
static bool acpi_s2idle_vendor_amd(void)
339-
{
340-
return boot_cpu_data.x86_vendor == X86_VENDOR_AMD;
341-
}
342382

343383
static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *dsm_guid)
344384
{

0 commit comments

Comments
 (0)