From patchwork Mon Apr 24 06:46:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 86877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2547095vqo; Sun, 23 Apr 2023 23:54:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6m9x0tK3lC69JqYWpJ0eoWgog6CCLVWBLVZ6eE5SzCVM8tdwFF2r9BUEtHjbaz1QXMjXHV X-Received: by 2002:a17:902:db08:b0:1a9:7ffb:87bb with SMTP id m8-20020a170902db0800b001a97ffb87bbmr389624plx.13.1682319284982; Sun, 23 Apr 2023 23:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682319284; cv=none; d=google.com; s=arc-20160816; b=e/fZO7y4Rxt6JJ8A4oBXJyvoJ227BhjVBuf3fQMnJWv565EOjSWORNTvlmhborPxXY NwSyjVPX79CDmf77Ph72kG4LCI65WR1WVPA3Modxw+A5XhQ69RPUk/EwGXNAvpaAL0eG OszwxaSvVISJqCBx5ndo3pVXh5t3OiwP3OZA0VpqAbBmxyphD/QCidyhdCgbT8q0Vqsu jr20goHLuHZxgDFBYUBbIRyBBQ1RvGyjCORjudMgtcPDvhbNVYCZBcrnR+X2JfkCKhx9 TLJrIHJevrt4X907s7BXHUAugt2zvJjBGb4jn9tjSGBOXi6L7gGcglEthdiTI0ipU7FY RTfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=w6+BlD8csu3dkEy9uxFV9ujQghQqdR/rDjo7ERazj4c=; b=bNR5VOVjwQc5EDo7nmhDxkJ9QAtD7DDViRECDtJV3zTh4huLylS1s/FApBJqcTO52M aI++Vs0oJh+l44OddRaINmpk0XnbZfAkDaxqzroyPkLAH2sbIL6LgTccv2e+Jl+yb6rp ekwoTjpzzq+HGKsC0HEs5BiZftUkUXVMO/vgB4H0hon343wqqBP/7Y1l3790+LKeTdki cePhKgvYC92SaqOdrgdWQ82cfxXOVpA14F3uoskwnQwt72ZoD0AOEZ6yUC693s6GxOcP PAXSWiD3e3KCNWwy5VIn1pmKERlRvi1SrbEReeD4cux/W1ac9TwLdSSojACpGQcHQEkG wWdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b="nK/pAfgK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a170902cccb00b001a66c437b2esi10123600ple.20.2023.04.23.23.54.30; Sun, 23 Apr 2023 23:54:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b="nK/pAfgK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230426AbjDXGrb (ORCPT + 99 others); Mon, 24 Apr 2023 02:47:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbjDXGr1 (ORCPT ); Mon, 24 Apr 2023 02:47:27 -0400 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE4FF3A98; Sun, 23 Apr 2023 23:47:10 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sendonly@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 0DF0442181; Mon, 24 Apr 2023 06:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1682318828; bh=3mjf32eyEhhtX71u9VNT0Tq8QAhtEflwUY8NEPfG0YA=; h=From:Date:Subject:To:Cc; b=nK/pAfgK0QpyxvN1Yv6dFIC/u8XNR5A9XoTtREmr5RAgvAn0ge1bNUFcmjf8axMXu qYrdQfpKmdAz1mGf5GqrI2u1O7AIxEYOPajCxtegTlZlQ0h60ZinVwid0BaUtO7VW7 xXylWHv13SbP2kJGU80LeqBrL3Jym8WDzFhA9RCkqMy/vA3/MyAVzldqP45D0crCwj WyMbzBI2U7V5xIAc0GmDQBhpHikv6OOHZKTrShIIIM2jpLEjl0NJhd1ciyqEbi/7bm nPJ0RB1T4xm2UR3RkpHmGu1QmU+9hnZEjl5O+9iaoohgAkiMlskk9SzB3moNCiulrp wf+MVIG6EJhIg== From: Hector Martin Date: Mon, 24 Apr 2023 15:46:57 +0900 Subject: [PATCH] ACPI / property: Support strings in Apple _DSM props MIME-Version: 1.0 Message-Id: <20230424-acpi-prop-v1-1-ffa9a300b1cd@marcan.st> X-B4-Tracking: v=1; b=H4sIAOAlRmQC/x2NQQqDMBBFryKz7tAY0wi9SukiiROdTRwmbRHEu ze6fPz3eTtUUqYKz24HpR9XXkuD/tZBWkKZCXlqDNbYwTjrMCRhFF0Fx+jH/pGzM5OH5sdQCaO Gkpbz8fHGbveoXOavnLsoZd6u1ut9HH/bSjznewAAAA== To: "Rafael J. Wysocki" , Len Brown Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.kernel.dev, Lukas Wunner , Linus Walleij , Hector Martin X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2038; i=marcan@marcan.st; h=from:subject:message-id; bh=3mjf32eyEhhtX71u9VNT0Tq8QAhtEflwUY8NEPfG0YA=; b=owGbwMvMwCEm+yP4NEe/cRLjabUkhhQ31ZdxgScNl4iJMJYH7Ct/aWiVkazPvKF6/7VtKbVTl siXWMh0lLIwiHEwyIopsjSe6D3V7Tn9nLpqynSYOaxMIEMYuDgFYCJnfjL8T+xb9/RgrLzFOaft lvkfXabt/O77NPHKCVNPds6IuFLFx4wMK09PT1j67nNg3utzX+c9PBfA48xwoX034+HyQxJOFxu jGQA= X-Developer-Key: i=marcan@marcan.st; a=openpgp; fpr=FC18F00317968B7BE86201CBE22A629A4C515DD5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764039626472094926?= X-GMAIL-MSGID: =?utf-8?q?1764039626472094926?= 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 Acked-by: Linus Walleij Signed-off-by: Hector Martin --- drivers/acpi/x86/apple.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6 change-id: 20230424-acpi-prop-7b6715ff40d6 Best regards, 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;