All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / property: Support strings in Apple _DSM props
@ 2023-04-24  6:46 Hector Martin
  2023-04-24 20:20 ` Lukas Wunner
  2023-04-27 16:51 ` Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Hector Martin @ 2023-04-24  6:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: linux-acpi, linux-kernel, asahi, Lukas Wunner, Linus Walleij,
	Hector Martin

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>
---
 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
index 8812ecd03d55..45d0f16f374f 100644
--- a/drivers/acpi/x86/apple.c
+++ b/drivers/acpi/x86/apple.c
@@ -71,13 +71,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;
+		else if (val->type == ACPI_TYPE_STRING)
+			newsize += val->string.length + 1;
 	}
 
 	numvalid = bitmap_weight(valid, numprops);
@@ -119,6 +122,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;

---
base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
change-id: 20230424-acpi-prop-7b6715ff40d6

Best regards,
-- 
Hector Martin <marcan@marcan.st>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / property: Support strings in Apple _DSM props
  2023-04-24  6:46 [PATCH] ACPI / property: Support strings in Apple _DSM props Hector Martin
@ 2023-04-24 20:20 ` Lukas Wunner
  2023-04-26  5:21   ` Hector Martin
  2023-04-27 16:51 ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Lukas Wunner @ 2023-04-24 20:20 UTC (permalink / raw)
  To: Hector Martin
  Cc: Rafael J. Wysocki, Len Brown, linux-acpi, linux-kernel, asahi,
	Linus Walleij

On Mon, Apr 24, 2023 at 03:46:57PM +0900, Hector Martin wrote:
> 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>

I was about to review this when I spotted my Reviewed-by tag above.
Turns out this was first submitted 16 months ago.  Wow, time flies!

https://lore.kernel.org/all/20211226182012.GA5527@wunner.de/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / property: Support strings in Apple _DSM props
  2023-04-24 20:20 ` Lukas Wunner
@ 2023-04-26  5:21   ` Hector Martin
  0 siblings, 0 replies; 4+ messages in thread
From: Hector Martin @ 2023-04-26  5:21 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Rafael J. Wysocki, Len Brown, linux-acpi, linux-kernel, asahi,
	Linus Walleij

On 25/04/2023 05.20, Lukas Wunner wrote:
> On Mon, Apr 24, 2023 at 03:46:57PM +0900, Hector Martin wrote:
>> 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>
> 
> I was about to review this when I spotted my Reviewed-by tag above.
> Turns out this was first submitted 16 months ago.  Wow, time flies!
> 
> https://lore.kernel.org/all/20211226182012.GA5527@wunner.de/

Yup, the original series was never merged and I've been pushing the
brcmfmac bits piecewise over time instead... and then I completely
forgot about this patch, which turns out to (now) be the last missing
piece for WiFi to work on Apple T2 Macs :).

- Hector


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI / property: Support strings in Apple _DSM props
  2023-04-24  6:46 [PATCH] ACPI / property: Support strings in Apple _DSM props Hector Martin
  2023-04-24 20:20 ` Lukas Wunner
@ 2023-04-27 16:51 ` Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2023-04-27 16:51 UTC (permalink / raw)
  To: Hector Martin
  Cc: Rafael J. Wysocki, Len Brown, linux-acpi, linux-kernel, asahi,
	Lukas Wunner, Linus Walleij

On Mon, Apr 24, 2023 at 8:47 AM Hector Martin <marcan@marcan.st> wrote:
>
> 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>
> ---
>  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
> index 8812ecd03d55..45d0f16f374f 100644
> --- a/drivers/acpi/x86/apple.c
> +++ b/drivers/acpi/x86/apple.c
> @@ -71,13 +71,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;
> +               else if (val->type == ACPI_TYPE_STRING)
> +                       newsize += val->string.length + 1;
>         }
>
>         numvalid = bitmap_weight(valid, numprops);
> @@ -119,6 +122,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;
>
> ---

Applied as 6.4-rc material, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-27 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-24  6:46 [PATCH] ACPI / property: Support strings in Apple _DSM props Hector Martin
2023-04-24 20:20 ` Lukas Wunner
2023-04-26  5:21   ` Hector Martin
2023-04-27 16:51 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.