Skip to content

Commit 9bde7fb

Browse files
marcanrafaeljw
authored andcommitted
ACPI: property: Support strings in Apple _DSM props
The Wi-Fi module in x86 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(). Reviewed-by: Lukas Wunner <lukas@wunner.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 793582f commit 9bde7fb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/acpi/x86/apple.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ void acpi_extract_apple_properties(struct acpi_device *adev)
7171

7272
if ( key->type != ACPI_TYPE_STRING ||
7373
(val->type != ACPI_TYPE_INTEGER &&
74-
val->type != ACPI_TYPE_BUFFER))
74+
val->type != ACPI_TYPE_BUFFER &&
75+
val->type != ACPI_TYPE_STRING))
7576
continue; /* skip invalid properties */
7677

7778
__set_bit(i, valid);
7879
newsize += key->string.length + 1;
7980
if ( val->type == ACPI_TYPE_BUFFER)
8081
newsize += val->buffer.length;
82+
else if (val->type == ACPI_TYPE_STRING)
83+
newsize += val->string.length + 1;
8184
}
8285

8386
numvalid = bitmap_weight(valid, numprops);
@@ -119,6 +122,12 @@ void acpi_extract_apple_properties(struct acpi_device *adev)
119122
newprops[v].type = val->type;
120123
if (val->type == ACPI_TYPE_INTEGER) {
121124
newprops[v].integer.value = val->integer.value;
125+
} else if (val->type == ACPI_TYPE_STRING) {
126+
newprops[v].string.length = val->string.length;
127+
newprops[v].string.pointer = free_space;
128+
memcpy(free_space, val->string.pointer,
129+
val->string.length);
130+
free_space += val->string.length + 1;
122131
} else {
123132
newprops[v].buffer.length = val->buffer.length;
124133
newprops[v].buffer.pointer = free_space;

0 commit comments

Comments
 (0)