git: f9b4092743fc - main - acpi_wmi: Add type check before evaluaeting query ACPI method Some ACPI wmi query is implemented by named object, not method, ACPICA complains when non-method object is evaluated with one or more arguments. Especially, almost all binary MOF object obtaining method is the case.

From: Takanori Watanabe <takawata_at_FreeBSD.org>
Date: Mon, 10 Mar 2025 02:27:22 UTC
The branch main has been updated by takawata:

URL: https://cgit.FreeBSD.org/src/commit/?id=f9b4092743fc99b1b3727a59f4c66fa07f0f895f

commit f9b4092743fc99b1b3727a59f4c66fa07f0f895f
Author:     Takanori Watanabe <takawata@FreeBSD.org>
AuthorDate: 2025-02-25 09:54:34 +0000
Commit:     Takanori Watanabe <takawata@FreeBSD.org>
CommitDate: 2025-03-10 02:22:30 +0000

    acpi_wmi: Add type check before evaluaeting query ACPI method
    Some ACPI wmi query is implemented by named object, not method,
    ACPICA complains when non-method object is evaluated with one or more arguments.
    Especially, almost all binary MOF object obtaining method is the case.
    
    This commit will fix it.
    
    PR:     284912
    Reported by:    Alexander Ziaee
    Differential Revision: https://reviews.freebsd.org/D49129
---
 sys/dev/acpi_support/acpi_wmi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/dev/acpi_support/acpi_wmi.c b/sys/dev/acpi_support/acpi_wmi.c
index 56a08e59934d..e973b287dbb4 100644
--- a/sys/dev/acpi_support/acpi_wmi.c
+++ b/sys/dev/acpi_support/acpi_wmi.c
@@ -580,6 +580,16 @@ acpi_wmi_get_block_method(device_t dev, const char *guid_string, UINT8 instance,
 		}
 		wq_method[2] = winfo->ginfo.oid[0];
 		wq_method[3] = winfo->ginfo.oid[1];
+		{
+			ACPI_HANDLE wq_handle;
+			ACPI_OBJECT_TYPE at;
+
+			if (ACPI_SUCCESS(AcpiGetHandle(sc->wmi_handle, wq_method, &wq_handle)) &&
+			    ACPI_SUCCESS(AcpiGetType(wq_handle, &at)) &&
+			    at != ACPI_TYPE_METHOD) {
+				wq_input.Count = 0;
+			}
+		}
 		status = AcpiEvaluateObject(sc->wmi_handle, wq_method,
 			    &wq_input, out);
 		if ((winfo->ginfo.flags & ACPI_WMI_REGFLAG_EXPENSIVE)