Files
linux-t2-patches/8011-ACPI-property-Support-strings-in-Apple-_DSM-props.patch
T

56 lines
2.0 KiB
Diff
Raw Normal View History

2022-05-09 14:40:59 +05:30
From 06cd4b9c0babc787e869bd4fcd409d8039f568cf Mon Sep 17 00:00:00 2001
2022-03-06 22:51:42 +05:30
From: Hector Martin <marcan@marcan.st>
Date: Thu, 23 Dec 2021 19:51:11 +0900
2022-05-09 14:40:59 +05:30
Subject: [PATCH 11/27] ACPI / property: Support strings in Apple _DSM props
2022-03-06 22:51:42 +05:30
The Wi-Fi module in Apple machines has a "module-instance" device
property that specifies the platform type and is used for firmware
selection. Its value is a string, so add support for string values in
acpi_extract_apple_properties().
2022-05-09 14:40:59 +05:30
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2022-03-06 22:51:42 +05:30
Signed-off-by: Hector Martin <marcan@marcan.st>
---
drivers/acpi/x86/apple.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/x86/apple.c b/drivers/acpi/x86/apple.c
2022-05-09 14:40:59 +05:30
index c285c91a5e9c..71b8f103ab0f 100644
2022-03-06 22:51:42 +05:30
--- a/drivers/acpi/x86/apple.c
+++ b/drivers/acpi/x86/apple.c
@@ -70,13 +70,16 @@ void acpi_extract_apple_properties(struct acpi_device *adev)
if ( key->type != ACPI_TYPE_STRING ||
(val->type != ACPI_TYPE_INTEGER &&
- val->type != ACPI_TYPE_BUFFER))
+ val->type != ACPI_TYPE_BUFFER &&
+ val->type != ACPI_TYPE_STRING))
continue; /* skip invalid properties */
__set_bit(i, valid);
newsize += key->string.length + 1;
if ( val->type == ACPI_TYPE_BUFFER)
newsize += val->buffer.length;
2022-05-09 14:40:59 +05:30
+ else if (val->type == ACPI_TYPE_STRING)
2022-03-06 22:51:42 +05:30
+ newsize += val->string.length + 1;
}
numvalid = bitmap_weight(valid, numprops);
@@ -118,6 +121,12 @@ void acpi_extract_apple_properties(struct acpi_device *adev)
newprops[v].type = val->type;
if (val->type == ACPI_TYPE_INTEGER) {
newprops[v].integer.value = val->integer.value;
+ } else if (val->type == ACPI_TYPE_STRING) {
+ newprops[v].string.length = val->string.length;
+ newprops[v].string.pointer = free_space;
+ memcpy(free_space, val->string.pointer,
+ val->string.length);
+ free_space += val->string.length + 1;
} else {
newprops[v].buffer.length = val->buffer.length;
newprops[v].buffer.pointer = free_space;
--
2022-05-09 14:40:59 +05:30
2.36.0
2022-03-06 22:51:42 +05:30