[PATCH 1/4] ACPI: utils: Add acpi_evaluate_dsm_exclusive()

From: Ali Ahmet Memiş

Date: Wed Oct 14 2026 - 15:08:07 EST


Add an exclusive variant of acpi_evaluate_dsm() for _DSM methods that
are known to break when interleaved with other AML.

Signed-off-by: Ali Ahmet Memiş <aliamemis@xxxxxxxxxxx>
---
drivers/acpi/utils.c | 54 +++++++++++++++++++++++++++--------------
include/acpi/acpi_bus.h | 3 +++
include/linux/acpi.h | 8 ++++++
3 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index f28680424f14..32689c901564 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -799,23 +799,9 @@ acpi_status acpi_evaluate_reg(acpi_handle handle, u8 space_id, u32 function)
}
EXPORT_SYMBOL(acpi_evaluate_reg);

-/**
- * acpi_evaluate_dsm - evaluate device's _DSM method
- * @handle: ACPI device handle
- * @guid: GUID of requested functions, should be 16 bytes
- * @rev: revision number of requested function
- * @func: requested function number
- * @argv4: the function specific parameter
- *
- * Evaluate device's _DSM method with specified GUID, revision id and
- * function number. Caller needs to free the returned object.
- *
- * Though ACPI defines the fourth parameter for _DSM should be a package,
- * some old BIOSes do expect a buffer or an integer etc.
- */
-union acpi_object *
-acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
- union acpi_object *argv4)
+static union acpi_object *
+__acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
+ union acpi_object *argv4, bool exclusive)
{
acpi_status ret;
struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL};
@@ -840,7 +826,10 @@ acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
params[3].package.elements = NULL;
}

- ret = acpi_evaluate_object(handle, "_DSM", &input, &buf);
+ if (exclusive)
+ ret = acpi_evaluate_object_exclusive(handle, "_DSM", &input, &buf);
+ else
+ ret = acpi_evaluate_object(handle, "_DSM", &input, &buf);
if (ACPI_SUCCESS(ret))
return (union acpi_object *)buf.pointer;

@@ -851,8 +840,37 @@ acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,

return NULL;
}
+
+/**
+ * acpi_evaluate_dsm - evaluate device's _DSM method
+ * @handle: ACPI device handle
+ * @guid: GUID of requested functions, should be 16 bytes
+ * @rev: revision number of requested function
+ * @func: requested function number
+ * @argv4: the function specific parameter
+ *
+ * Evaluate device's _DSM method with specified GUID, revision id and
+ * function number. Caller needs to free the returned object.
+ *
+ * Though ACPI defines the fourth parameter for _DSM should be a package,
+ * some old BIOSes do expect a buffer or an integer etc.
+ */
+union acpi_object *
+acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
+ union acpi_object *argv4)
+{
+ return __acpi_evaluate_dsm(handle, guid, rev, func, argv4, false);
+}
EXPORT_SYMBOL(acpi_evaluate_dsm);

+union acpi_object *
+acpi_evaluate_dsm_exclusive(acpi_handle handle, const guid_t *guid, u64 rev,
+ u64 func, union acpi_object *argv4)
+{
+ return __acpi_evaluate_dsm(handle, guid, rev, func, argv4, true);
+}
+EXPORT_SYMBOL_GPL(acpi_evaluate_dsm_exclusive);
+
/**
* acpi_check_dsm - check if _DSM method supports requested functions.
* @handle: ACPI device handle
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index e7a671dba624..e9859fdf76e8 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -66,6 +66,9 @@ bool acpi_dock_match(acpi_handle handle);
bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs);
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
u64 rev, u64 func, union acpi_object *argv4);
+union acpi_object *acpi_evaluate_dsm_exclusive(acpi_handle handle,
+ const guid_t *guid, u64 rev, u64 func,
+ union acpi_object *argv4);
#ifdef CONFIG_ACPI
bool
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ddacac812094..6a798d5bde5c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1042,6 +1042,14 @@ static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
return NULL;
}

+static inline union acpi_object *acpi_evaluate_dsm_exclusive(acpi_handle handle,
+ const guid_t *guid,
+ u64 rev, u64 func,
+ union acpi_object *argv4)
+{
+ return NULL;
+}
+
static inline union acpi_object *acpi_evaluate_dsm_typed(acpi_handle handle,
const guid_t *guid,
u64 rev, u64 func,
--
2.55.0