Skip to content

Commit 159d8c2

Browse files
westerirafaeljw
authored andcommitted
ACPI: Pass the same capabilities to the _OSC regardless of the query flag
Commit 719e1f5 ("ACPI: Execute platform _OSC also with query bit clear") makes acpi_bus_osc_negotiate_platform_control() not only query the platforms capabilities but it also commits the result back to the firmware to report which capabilities are supported by the OS back to the firmware On certain systems the BIOS loads SSDT tables dynamically based on the capabilities the OS claims to support. However, on these systems the _OSC actually clears some of the bits (under certain conditions) so what happens is that now when we call the _OSC twice the second time we pass the cleared values and that results errors like below to appear on the system log: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210105/psargs-330) ACPI Error: Aborting method \_PR.PR01._CPC due to previous error (AE_NOT_FOUND) (20210105/psparse-529) In addition the ACPI 6.4 spec says following [1]: If the OS declares support of a feature in the Support Field in one call to _OSC, then it must preserve the set state of that bit (declaring support for that feature) in all subsequent calls. Based on the above we can fix the issue by passing the same set of capabilities to the platform wide _OSC in both calls regardless of the query flag. While there drop the context.ret.length checks which were wrong to begin with (as the length is number of bytes not elements). This is already checked in acpi_run_osc() that also returns an error in that case. Includes fixes by Hans de Goede. [1] https://uefi.org/specs/ACPI/6.4/06_Device_Configuration/Device_Configuration.html#sequence-of-osc-calls BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213023 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1963717 Fixes: 719e1f5 ("ACPI: Execute platform _OSC also with query bit clear") Cc: 5.12+ <[email protected]> # 5.12+ Signed-off-by: Mika Westerberg <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 614124b commit 159d8c2

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

drivers/acpi/bus.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -330,32 +330,21 @@ static void acpi_bus_osc_negotiate_platform_control(void)
330330
if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
331331
return;
332332

333-
capbuf_ret = context.ret.pointer;
334-
if (context.ret.length <= OSC_SUPPORT_DWORD) {
335-
kfree(context.ret.pointer);
336-
return;
337-
}
333+
kfree(context.ret.pointer);
338334

339-
/*
340-
* Now run _OSC again with query flag clear and with the caps
341-
* supported by both the OS and the platform.
342-
*/
335+
/* Now run _OSC again with query flag clear */
343336
capbuf[OSC_QUERY_DWORD] = 0;
344-
capbuf[OSC_SUPPORT_DWORD] = capbuf_ret[OSC_SUPPORT_DWORD];
345-
kfree(context.ret.pointer);
346337

347338
if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
348339
return;
349340

350341
capbuf_ret = context.ret.pointer;
351-
if (context.ret.length > OSC_SUPPORT_DWORD) {
352-
osc_sb_apei_support_acked =
353-
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
354-
osc_pc_lpi_support_confirmed =
355-
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
356-
osc_sb_native_usb4_support_confirmed =
357-
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
358-
}
342+
osc_sb_apei_support_acked =
343+
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
344+
osc_pc_lpi_support_confirmed =
345+
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
346+
osc_sb_native_usb4_support_confirmed =
347+
capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
359348

360349
kfree(context.ret.pointer);
361350
}

0 commit comments

Comments
 (0)