From patchwork Wed Jun 28 20:42:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 1801266 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=gmx.de header.i=w_armin@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=XHtIa1RN; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QrtnM5z5Qz20b4 for ; Thu, 29 Jun 2023 06:42:47 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qEbzu-0006wk-GG; Wed, 28 Jun 2023 20:42:42 +0000 Received: from mout.gmx.net ([212.227.15.18]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qEbzq-0006vg-AQ for fwts-devel@lists.ubuntu.com; Wed, 28 Jun 2023 20:42:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1687984958; x=1688589758; i=w_armin@gmx.de; bh=3X9QWZZfiBsZzP3mvhCp0tKzkiA1elCKwIUS/eL/gWg=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=XHtIa1RNksgHx3NjReEEUhgP9rYhTqWFW4dSBOrAP6uNC4lVP3yzGObbaIWkCUEOl4sL8mR TN4VAZ191g8TVPKV6x+wLSxcp2l+WR5N5xfO+UUsZQU6xebA7Q9K51syZxnUu0fb1/RxtrO+E zX+Urg1/Qbb2XzJIgouUIkp9sy+aFS2UcEH0TQFl/MIvvbzxYlJG4rrcyZ0ulg03L/4krgJ4p PMPGLtinfFPQnhxxnObkMmn1QlA9WxuHZOj45/M9oj5RtzxUwNaHLtsWxp5FAyA91qiuqzjhq WmnSlo3WVmH5iLHqd9wIc/8r6lLlwvJ90rHOe3F3SzagdTs8/v/A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Inspiron3505.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MWih0-1qYUJZ3iae-00X3jN for ; Wed, 28 Jun 2023 22:42:37 +0200 From: Armin Wolf To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/4] acpi/wmi: Add WMI GUID for the dell-wmi-ddv driver Date: Wed, 28 Jun 2023 22:42:32 +0200 Message-Id: <20230628204235.7141-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230628204235.7141-1-W_Armin@gmx.de> References: <20230628204235.7141-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:LrjjARCj2CmnZuQVO7kMoUPYo6553jzXkZiTqfxKhxwFNB/QC+J yhlDj/eJGZ2lmWnmuSryEsuqaOW7E0+MSyuiAaNR2YhLZb84JacLaLWbv8iQfBrAzy1j2ib J/Fcvnhybk50LxoZFqYMFaV1B4hF2dSqtykyFr/fXHZcUMfXm5RKgtlFwnFocCsF2TYkb/+ MXpPZjfGlzZu1LQVJVvFw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:75gDZIZHX/o=;oKjrzl04A8rf2u7YEX8n0CvSEdT zhwRaCEQWfIXOMC/vQp05P43mUnihrl8N4KyEhzaBbMxsqm7Ouf+9euWunZdvyw66eH0Ckdob 6hsXxhPr5u6q638aFdKO090x7kzwjFL/Q834JuB7FyE+N332rtss3nsp8YJ8umvU3DmMNn8PA qxB8FJUIss6mzsIjnDWsQo8MA5v5UTsUgS6yEMygSqRk4lkC5Hc5yK/vM1aaSmzWF60/5eO13 Mr8u26Wh6sucxjZNUO8cYzZ/4EvycbrylOXr/UHNIlJDJpwIe/TjnfkmKJ3FsvsyJuzkNHjHa g0D9udjJobLOE3gExniBqckpzaEU7SvpFfkug6nRCpwIu93h+oSPDQnrYg6AcOmsRv6jpJjQM DWvzgWdEqgv9PezHv8WYy98hvP3TwW4cM1HU9gcTXSkMV9a9dv50EDhF0wana2UaYjmIpy2E2 mOIjVRnaGojB3G4PVOV50xbSJDD6ARsn+ggISDAiRfovi2NHkjARyOlfXKHy5PikHXJQ4nqh7 jUI22YCfZJsLnOVnfun0WVt1h36SgiTSOvtWSgiUyina68K618pRVRlJKZIQmZenMj0JUmOH7 C1RrX1V0+pyi5Fwe8kmV6mFrUt9Caw1lK1AOFHuzLm0fW4qYJA6af1FjRehG/VW7NXG5A5goH ryTA0wNBVfQWnfmZSiKQbL8J77y49jXe+jIoxNIg76CwE3hhVg7MJdkiU1DlfES8hfoQDaPVw 2jaaOKV0mjAkY7x3V5XQBaRKpg3lIiq2R9MEecdYdwSwcCgxfAMTTFhtDhsPGz9LYpbh/9ILZ o996yjEL+BrOzfjjLekjOOY48AlXNHFSGJ+whNEMtDGF5XGUNL4z5XVb3Z9I0zduoPOWMjl6x banElGWQLSph6xorYdmOntzO5P2IjYeO0rQlDcFk/zfbEpNm5qGA6NdxTQ2XMZ+sAyb/z/BBg hJBpouu9YHKbAy+i32l32FrMdwE= X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" Add missing WMI GUID for the dell-wmi-ddv driver, available since kernel 6.2. Signed-off-by: Armin Wolf Acked-by: Ivan Hu --- src/acpi/wmi/wmi.c | 1 + 1 file changed, 1 insertion(+) -- 2.30.2 diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c index aedc2758..58b13fce 100644 --- a/src/acpi/wmi/wmi.c +++ b/src/acpi/wmi/wmi.c @@ -92,6 +92,7 @@ static fwts_wmi_known_guid fwts_wmi_known_guids[] = { { "0894B8D6-44A6-4719-97D7-6AD24108BFD4", "dell-wmi-sysman", "Dell" }, { "F1DDEE52-063C-4784-A11E-8A06684B9BF4", "dell-wmi-sysman", "Dell" }, { "70FE8229-D03B-4214-A1C6-1F884B1A892A", "dell-wmi-sysman", "Dell" }, + { "8A42EA14-4F2A-FD45-6422-0087F7A7E608", "dell-wmi-ddv", "Dell" }, { "ABBC0F72-8EA1-11D1-00A0-C90629100000", "eeepc-wmi", "Asus" }, { "97845ED0-4E6D-11DE-8A39-0800200C9A66", "eeepc-wmi", "Asus" }, { "DEADBEEF-2001-0000-00A0-C90629100000", "gigabyte-wmi", "Gigabyte" }, From patchwork Wed Jun 28 20:42:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 1801268 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=gmx.de header.i=w_armin@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=Wh/E9YUj; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QrtnN5lsZz20b4 for ; Thu, 29 Jun 2023 06:42:48 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qEbzv-0006x8-L3; Wed, 28 Jun 2023 20:42:43 +0000 Received: from mout.gmx.net ([212.227.15.15]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qEbzr-0006vt-I2 for fwts-devel@lists.ubuntu.com; Wed, 28 Jun 2023 20:42:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1687984959; x=1688589759; i=w_armin@gmx.de; bh=A7ClkZ1Ech/ohNDZVxBOikLZnx1lTLxVFT+kdyFKIsU=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=Wh/E9YUjL2VXhjGdGVf38hg02/hk5/pIw1h6klQxhi1shaTR+A5ORfc+XUr/+Oc1f9vDN6Y DPXdAbYk+jP3Ux0PjX/TjXutDS0HKmd/bxb670utYxzL3Mqwd8NX7U9W2ANFFpQEAjG8mM4Mk MUNx5PJa1iuqi9q7/FPvvvIDSGy/4iJZEbUg3IfmFYYshJ4FnptNNvZUCRP4TeTc/0O80nhlM 24aaefTkvM6rWa11uj0x+vt11lw2mASdrpstuw2hqHScASX32m6caHYkgbOcwLjihacJAHFky /SIZzRcwW9NddyLsvEGyaU172bKh/pkaOahCEKS8VISAbfstLfOA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Inspiron3505.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MG9kM-1qFiyZ0UaC-00GdGP for ; Wed, 28 Jun 2023 22:42:39 +0200 From: Armin Wolf To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/4] acpi/wmi: Check if the mandatory block query method exists Date: Wed, 28 Jun 2023 22:42:33 +0200 Message-Id: <20230628204235.7141-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230628204235.7141-1-W_Armin@gmx.de> References: <20230628204235.7141-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:kvfLzfXP2HaCf320tB8594LO19UMe77ZdEXyy8SkEGm2IrCxsuP xf8HlaE/WKi/2nGhY2hlmAl/TyvVfPD3awayl4lAs5V8XyHaeQ7pTZQCUugBIl/RPwIAZmD K88iy4vof66sISWLwQmc9cLdWxy9PDNB2QW4ITyhvh5p077HEYbIEql7MRJXat6uwR8gJvJ /mhIkAvCosJ1lT3PlLdng== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:ArBK4r8wizw=;+KrlUlqtPenlVqgh7rPnHwop4vy Uhq6LJO2Car9VOfvvCpjvViv2n78If+0GqJoJ65NZK69tNPWL5Gga9JI5/uH95ctmiGb4LTv9 J0Mib9TYbxanfTaJHXG9q8g3pkqd1D96OQNsXkxwkmlbhHDb+wnEF6EgolWSEOW6G0uJRQobU A1Zc1uY0DoJJASbL1xtRvkwwmXLkJ1jJgQ8/bVXtAJSR0oiC1D1sJmR2uoWj4i4YXQEn0T8FQ TRoEF7UOu+zFvMQytgbrWBZkczwNG7flQdaxFwJPFpkWe6h7Ydz9/mR9U4r1E0vEEH/DpZssE kDDrXIB+0rMbMU5iQcQoHnq3j0Ua5nAmDcTMDWHxYP0UsLoRDa/0ThL2mfWuxhCEXzSlucMRS 81KehhYtUIsglSFOhwKX7vERMOil6bRplIVEASUoa92+xwCxTklX5UibrdyWRqMmAfowBpFog sx0aA+jv748kl+5XloWeruII3mM8X6ld4PVYYgL2CDwbHSFbGQsqmqBltWnv3wDm6TapmKHlm JjG5NvtLT+3eD2t1e7V4eHNh2hFQgqL50vv+pjALzP6CSQO5w3kxLa2FXVRwOfde7v46xQD4m mxY8SargGNPc+n5nmbwELIXSCUywougzD9NK5mQ/DakoxOkQ8bZ/8FHMY+lYlvwn5eLah5Mh7 EhOGwX159ql5u1ZB1cQNiyr4aUk9zYn7IoNlrkCxeWsHIn+i7eIRZyHTCs9/e7lcgEzLUDfyJ IkxEByV11LRwskfozUUBB45k/6clkae2bQeLoqeq2BAXkmkHXGivvaWnuftmHus3A8eax9Lmd Wcj6J59Vjlrgr+XM7CI540IXTOvh6Np/lc5f6HZnHtbWAW8vRX/Q8Tkr/bXblc84MsZV6+1PT hCCKSWea8cazoij8YZ+O7VVxNVQTMFexsX7NF6ofAt5AJs2EgcxamsBc7S2z+cZB4WUAUUyO6 VANXhHl+nOxc8ugl6oN91FtsAkI= X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" According to the ACPI WMI documentation, WMI data blocks need to provide a block query method (WQxx). On several machines (like the Dell Inspiron 3505), some WMI data blocks do not provide such a method, which for example causes the linux kernel to log a warning. Add a matching test to allow for catching this sort of issue with the fwts. Also update the wmi regression tests. Signed-off-by: Armin Wolf Acked-by: Ivan Hu --- fwts-test/wmi-0001/wmi-0001.log | 26 +++++--- fwts-test/wmi-0001/wmi-0003.log | 16 +++-- src/acpi/wmi/wmi.c | 107 +++++++++++++++++++++++++++++++- 3 files changed, 137 insertions(+), 12 deletions(-) -- 2.30.2 diff --git a/fwts-test/wmi-0001/wmi-0001.log b/fwts-test/wmi-0001/wmi-0001.log index f3436640..0e013a96 100644 --- a/fwts-test/wmi-0001/wmi-0001.log +++ b/fwts-test/wmi-0001/wmi-0001.log @@ -5,11 +5,13 @@ wmi Test 1 of 1: Windows Management Instrumentation test. wmi wmi \_SB_.WMI1._WDG (1 of 9) wmi GUID: 51F5230E-9677-46CD-A1CF-C0B23EE34DB7 -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x05 (Expensive | String) wmi Object ID : A0 wmi Instance : 0x50 wmi Driver : think-lmi (Lenovo) +wmi PASSED: Test 1, 51F5230E-9677-46CD-A1CF-C0B23EE34DB7 has +wmi associated query method \_SB_.WMI1.WQA0 wmi wmi \_SB_.WMI1._WDG (2 of 9) wmi GUID: 98479A64-33F5-4E33-A707-8E251EBBC3A1 @@ -51,11 +53,13 @@ wmi associated method \_SB_.WMI1.WMA4 wmi wmi \_SB_.WMI1._WDG (6 of 9) wmi GUID: 8ADB159E-1E32-455C-BC93-308A7ED98246 -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x01 (Expensive) wmi Object ID : A5 wmi Instance : 0x01 wmi Driver : think-lmi (Lenovo) +wmi PASSED: Test 1, 8ADB159E-1E32-455C-BC93-308A7ED98246 has +wmi associated query method \_SB_.WMI1.WQA5 wmi wmi \_SB_.WMI1._WDG (7 of 9) wmi GUID: 2651D9FD-911C-4B69-B94E-D0DED5963BD7 @@ -79,17 +83,21 @@ wmi associated method \_SB_.WMI1.WMA7 wmi wmi \_SB_.WMI1._WDG (9 of 9) wmi GUID: 05901221-D566-11D1-B2F0-00A0C9062910 -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x00 (None) wmi Object ID : BA wmi Instance : 0x01 +wmi PASSED: Test 1, 05901221-D566-11D1-B2F0-00A0C9062910 has +wmi associated query method \_SB_.WMI1.WQBA wmi wmi \_SB_.WMI2._WDG (1 of 5) wmi GUID: FCB424F1-075A-4E0E-BFC4-62F3E71771FA -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x01 (Expensive) wmi Object ID : A7 wmi Instance : 0x01 +wmi PASSED: Test 1, FCB424F1-075A-4E0E-BFC4-62F3E71771FA has +wmi associated query method \_SB_.WMI2.WQA7 wmi wmi \_SB_.WMI2._WDG (2 of 5) wmi GUID: E2BE5EE3-42DA-49DB-8378-1F5247388202 @@ -102,10 +110,12 @@ wmi associated method \_SB_.WMI2.WMA8 wmi wmi \_SB_.WMI2._WDG (3 of 5) wmi GUID: 7430019A-DCE9-4548-BAB0-9FDE0935CAFF -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x05 (Expensive | String) wmi Object ID : A9 wmi Instance : 0x0a +wmi PASSED: Test 1, 7430019A-DCE9-4548-BAB0-9FDE0935CAFF has +wmi associated query method \_SB_.WMI2.WQA9 wmi wmi \_SB_.WMI2._WDG (4 of 5) wmi GUID: 7FF47003-3B6C-4E5E-A227-E979824A85D1 @@ -118,12 +128,14 @@ wmi associated method \_SB_.WMI2.WMAA wmi wmi \_SB_.WMI2._WDG (5 of 5) wmi GUID: 05901221-D566-11D1-B2F0-00A0C9062910 -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x00 (None) wmi Object ID : BB wmi Instance : 0x01 +wmi PASSED: Test 1, 05901221-D566-11D1-B2F0-00A0C9062910 has +wmi associated query method \_SB_.WMI2.WQBB wmi wmi ========================================================== -wmi 8 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0 +wmi 14 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0 wmi info only. wmi ========================================================== diff --git a/fwts-test/wmi-0001/wmi-0003.log b/fwts-test/wmi-0001/wmi-0003.log index 06d60d9e..b157f0be 100644 --- a/fwts-test/wmi-0001/wmi-0003.log +++ b/fwts-test/wmi-0001/wmi-0003.log @@ -5,11 +5,13 @@ wmi Test 1 of 1: Windows Management Instrumentation test. wmi wmi \_SB_.AMW0._WDG (1 of 6) wmi GUID: 8D9DDCBC-A997-11DA-B012-B622A1EF5492 -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x00 (None) wmi Object ID : AA wmi Instance : 0x01 wmi Driver : dell-wmi-descriptor (Dell) +wmi PASSED: Test 1, 8D9DDCBC-A997-11DA-B012-B622A1EF5492 has +wmi associated query method \_SB_.AMW0.WQAA wmi wmi \_SB_.AMW0._WDG (2 of 6) wmi GUID: A80593CE-A997-11DA-B012-B622A1EF5492 @@ -41,21 +43,27 @@ wmi Driver : dell-wmi-base (Dell) wmi wmi \_SB_.AMW0._WDG (5 of 6) wmi GUID: A3776CE0-1E88-11DB-A98B-0800200C9A66 -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x00 (None) wmi Object ID : BC wmi Instance : 0x01 +wmi FAILED [LOW] WMIMissingQueryMethod: Test 1, GUID +wmi A3776CE0-1E88-11DB-A98B-0800200C9A66 should have an +wmi associated query method WQBC defined, however this does +wmi not seem to exist. wmi wmi \_SB_.AMW0._WDG (6 of 6) wmi GUID: 05901221-D566-11D1-B2F0-00A0C9062910 -wmi WMI Object: +wmi WMI Block: wmi Flags : 0x00 (None) wmi Object ID : MO wmi Instance : 0x01 +wmi PASSED: Test 1, 05901221-D566-11D1-B2F0-00A0C9062910 has +wmi associated query method \_SB_.AMW0.WQMO wmi PASSED: Test 1, All events associated with \_SB_.AMW0._WDG wmi are handled by a kernel driver. wmi wmi ========================================================== -wmi 3 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0 +wmi 5 passed, 1 failed, 0 warning, 0 aborted, 0 skipped, 0 wmi info only. wmi ========================================================== diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c index 58b13fce..be9e56d0 100644 --- a/src/acpi/wmi/wmi.c +++ b/src/acpi/wmi/wmi.c @@ -211,6 +211,100 @@ static char *wmi_wdg_flags_to_text(const fwts_wmi_flags flags) return buffer; } +/* + * wmi_acpi_get_parent_name() + * get parent name of acpi object, the result needs to be freed + */ +static char *wmi_acpi_get_parent_name(const char *object_name) +{ + size_t parent_name_length; + char *parent_name; + char *separator; + + separator = strrchr(object_name, '.'); + if (!separator) + return NULL; + + parent_name_length = separator - object_name; + parent_name = malloc(parent_name_length + 1); + if (!parent_name) + return NULL; + + memcpy(parent_name, object_name, parent_name_length); + parent_name[parent_name_length] = '\0'; + + return parent_name; +} + +/* + * wmi_acpi_method_count_on_object() + * count occurance of methods on acpi object + */ +static int wmi_acpi_method_count_on_object(const char *object_name, const char *method_name) +{ + const size_t object_name_length = strlen(object_name); + const size_t method_name_length = strlen(method_name); + fwts_list_link *item; + fwts_list *objects; + int count = 0; + + objects = fwts_acpi_object_get_names(); + if (!objects) + return 0; + + fwts_list_foreach(item, objects) { + char *name = fwts_list_data(char *, item); + const size_t name_length = strlen(name); + + if (name_length != (object_name_length + method_name_length + 1)) + continue; + + if (strncmp(object_name, name, object_name_length)) + continue; + + if (!strncmp(method_name, name + name_length - method_name_length, method_name_length)) + count++; + } + + return count; +} + +/* + * wmi_block_query_exist_count() + * check if the mandatory block query method exists for the WDG object + */ +static void wmi_block_query_exist_count( + fwts_framework *fw, + const fwts_wdg_info *info, + const char *object_name, + const char *guid_str) +{ + char wm_name[5]; + int count; + + snprintf(wm_name, sizeof(wm_name), "WQ%c%c", info->id.obj_id[0], info->id.obj_id[1]); + + count = wmi_acpi_method_count_on_object(object_name, wm_name); + switch (count) { + case 0: + fwts_failed(fw, LOG_LEVEL_LOW, "WMIMissingQueryMethod", + "GUID %s should have an associated query method %s defined, " + "however this does not seem to exist.", + guid_str, wm_name); + break; + case 1: + fwts_passed(fw, "%s has associated query method %s.%s", + guid_str, object_name, wm_name); + break; + default: + fwts_failed(fw, LOG_LEVEL_LOW, "WMIMultipleQueryMethod", + "GUID %s has multiple associated query methods %s defined, " + "this is a firmware bug that leads to ambiguous behaviour.", + guid_str, wm_name); + break; + } +} + /* * wmi_method_exist_count() * check if an associated method exists for the WDG object @@ -328,6 +422,14 @@ static void wmi_parse_wdg_data( const fwts_wdg_info *info = (const fwts_wdg_info *)wdg_data; bool all_events_known = true; bool events = false; + char *acpi_object_name; + + acpi_object_name = wmi_acpi_get_parent_name(name); + if (!acpi_object_name) { + fwts_log_info(fw, "Unable to the get parent name of %s", name); + return; + } + for (i = 0; i < (size / sizeof(fwts_wdg_info)); i++, info++) { const uint8_t *guid = info->guid; @@ -365,14 +467,17 @@ static void wmi_parse_wdg_data( all_events_known = false; } } else { - fwts_log_info_verbatim(fw, " WMI Object:"); + fwts_log_info_verbatim(fw, " WMI Block:"); wmi_dump_object(fw, info); wmi_known_driver(fw, known); + wmi_block_query_exist_count(fw, info, acpi_object_name, guid_str); } } if (events && all_events_known) fwts_passed(fw, "All events associated with %s are handled by a kernel driver.", name); + + free(acpi_object_name); } static int wmi_test1(fwts_framework *fw) From patchwork Wed Jun 28 20:42:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 1801269 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=gmx.de header.i=w_armin@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=scl8PtH7; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QrtnQ3kf8z20WT for ; Thu, 29 Jun 2023 06:42:50 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qEbzx-0006zE-Sl; Wed, 28 Jun 2023 20:42:45 +0000 Received: from mout.gmx.net ([212.227.15.18]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qEbzs-0006wG-KW for fwts-devel@lists.ubuntu.com; Wed, 28 Jun 2023 20:42:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1687984960; x=1688589760; i=w_armin@gmx.de; bh=qcmIo2fMoaCdrK1Fmi+QG67pCEPEUlNN/R5/xRbGUc4=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=scl8PtH7w0T61NiPSfxHwZGEy+LFb7C+V4SwEKs3IAQUF9sQlpoSmTsVlpEim40zRAlR4TE Fvext3u/8sVSd1aplxzt0HiV8OI62Lnnlv3sYp1vNHCT4uuw0DT7hXI69/QdESe4knKcF6MQ8 MF1TqNShCX1RSNu11Fek4AVEB76x5+6MJXx2BoGePUQ7Kcc5wbYXhRRTMWImYy7NAVJFY5D2g JAX9MRW4n133p60BrwxkL0T63Amen9xyj67+iz/YiOKBtey9wQkUhmnnBxrL9RW1YQ+QEtTsc s9fI71VK7UG7WJlO445gqdB/VqpOMWcD8qCCmwjqydbWY8j5kHEQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Inspiron3505.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mi2Jn-1pb8Nt16pd-00e3RC for ; Wed, 28 Jun 2023 22:42:40 +0200 From: Armin Wolf To: fwts-devel@lists.ubuntu.com Subject: [PATCH 3/4] acpi/wmi: Fix bug when counting WMI methods Date: Wed, 28 Jun 2023 22:42:34 +0200 Message-Id: <20230628204235.7141-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230628204235.7141-1-W_Armin@gmx.de> References: <20230628204235.7141-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:jGBKlMh1UToJDwHm5JdlWXnO0XLjSjcyIknmV6ZYcEb3Xq0pldy qcoBWiCk5Ryv9OxuhnYaGW3jhYs78uPDtU2XlW+RbmEmGQ6GLGDcGCjoEiPrELWgykXF9Zt OFbnlZwk2r6MPcAu/F9XbXdi7AGD0hVXrx43/7rCFll2nbEA26kxe9NcXBfhsNdmrrEs0Y3 33HIzz8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X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" Until now, wmi_method_exist_count() counted all occurances of a specific WMxx method on all ACPI objects. This causes a test failure when another ACPI (WMI) object has the same WMxx method, which is perfectly legal according to the ACPI WMI specification. Fix this by only counting method occurances on the ACPI WMI object under test. Signed-off-by: Armin Wolf Acked-by: Ivan Hu --- src/acpi/wmi/wmi.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) -- 2.30.2 diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c index be9e56d0..90cd7e38 100644 --- a/src/acpi/wmi/wmi.c +++ b/src/acpi/wmi/wmi.c @@ -312,30 +312,16 @@ static void wmi_block_query_exist_count( static void wmi_method_exist_count( fwts_framework *fw, const fwts_wdg_info *info, + const char *object_name, const char *guid_str) { - fwts_list_link *item; - fwts_list *objects; - const size_t wm_name_len = 4; char wm_name[5]; - char *objname = ""; - int count = 0; + int count; snprintf(wm_name, sizeof(wm_name), "WM%c%c", info->id.obj_id[0], info->id.obj_id[1]); - if ((objects = fwts_acpi_object_get_names()) == NULL) - return; /* Should not ever happen, bail out if it does */ - - fwts_list_foreach(item, objects) { - char *name = fwts_list_data(char*, item); - const size_t name_len = strlen(name); - if (strncmp(wm_name, name + name_len - wm_name_len, wm_name_len) == 0) { - objname = name; - count++; - } - } - + count = wmi_acpi_method_count_on_object(object_name, wm_name); if (count == 0) { fwts_failed(fw, LOG_LEVEL_LOW, "WMIMissingMethod", @@ -349,7 +335,8 @@ static void wmi_method_exist_count( "this is a firmware bug that leads to ambiguous behaviour.", guid_str, info->id.obj_id[0], info->id.obj_id[1]); } else - fwts_passed(fw, "%s has associated method %s", guid_str, objname); + fwts_passed(fw, "%s has associated method %s.%s", + guid_str, object_name, wm_name); } /* @@ -447,7 +434,7 @@ static void wmi_parse_wdg_data( fwts_log_info_verbatim(fw, " WMI Method:"); wmi_dump_object(fw, info); wmi_known_driver(fw, known); - wmi_method_exist_count(fw, info, guid_str); + wmi_method_exist_count(fw, info, acpi_object_name, guid_str); } else if (info->flags & FWTS_WMI_EVENT) { events = true; fwts_log_info_verbatim(fw, " WMI Event:"); From patchwork Wed Jun 28 20:42:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 1801267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=gmx.de header.i=w_armin@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=RxTBMD5I; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QrtnN5HRFz20WT for ; Thu, 29 Jun 2023 06:42:48 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qEbzv-0006xG-Pa; Wed, 28 Jun 2023 20:42:43 +0000 Received: from mout.gmx.net ([212.227.15.15]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qEbzu-0006wc-7V for fwts-devel@lists.ubuntu.com; Wed, 28 Jun 2023 20:42:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1687984962; x=1688589762; i=w_armin@gmx.de; bh=zI/OZ1rXYxzT2yrxVqXUpC56l5MyXtbcAm92xAR6Sw4=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=RxTBMD5IqBf4IVqc38gOb59q5FmcVegbIr9ziYtoQHXMFBQV1zR1U2LmslhPuyYtaKsJVeZ Xl7YCeuTPYVP6b4s3GAB8JPsVkR8C3cNmR2/POZS5iowFhtG6btqk9LcF57O8cnagAnKtDRRg T4f3XsLgYkIh74ESFcUtfWciQabgH4Md/M4vmZfl5GI/Ckcz07Uj5CruNjuazlCtVHjGA02mR t+EmNzpkjWf4JAvzctozS0r7lxj8xCYUP5O24iBHEeKAT+kgJJnnTsi9/WxRTFA7yYCGY5bpy Bg6hwuN8HDR6qLMk5Fv//3O3mYL2rC175Yh6EJmbYGyxiJ2VFrGA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Inspiron3505.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mf07E-1pZCRf3PLu-00gYPq for ; Wed, 28 Jun 2023 22:42:41 +0200 From: Armin Wolf To: fwts-devel@lists.ubuntu.com Subject: [PATCH 4/4] fwts_acpica: Remove unused variable "context" Date: Wed, 28 Jun 2023 22:42:35 +0200 Message-Id: <20230628204235.7141-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230628204235.7141-1-W_Armin@gmx.de> References: <20230628204235.7141-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:QX6YoAC+6nNEhHU9skZcpUwfcfyzTwVJmljPIAsX8QKgECcnJgl oH7iCbRYThXyGRNWkte2Lxw24DoP4k2na47yu1hUCpeSadaRJVtlk+twBNFYtiE7GHAf/NS V6VCMB2oUXwl5hKIzx1x65lmn86Et4sGOyY6zpIFIjxbcVo2Gk7WEHujLuTRKb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sa ws+sA06+S+FnDneALtowsCeyKPw= X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" The variable "context" is unused since commit 06e1d185d294 and thus triggers a compiler warning. Remove it to fix this warning. Fixes: 06e1d185d294 ("fwts_acpica: skip unneccessary null check") Signed-off-by: Armin Wolf Acked-by: Ivan Hu --- src/libfwtsacpica/fwts_acpica.c | 3 --- 1 file changed, 3 deletions(-) -- 2.30.2 diff --git a/src/libfwtsacpica/fwts_acpica.c b/src/libfwtsacpica/fwts_acpica.c index d8bc54a6..a9ac8a75 100644 --- a/src/libfwtsacpica/fwts_acpica.c +++ b/src/libfwtsacpica/fwts_acpica.c @@ -262,7 +262,6 @@ static ACPI_STATUS fwts_region_handler( UINT8 *buffer = ACPI_CAST_PTR(UINT8, value); ACPI_SIZE length; UINT32 bytewidth; - ACPI_CONNECTION_INFO *context; int i; if (!regionobject) @@ -274,8 +273,6 @@ static ACPI_STATUS fwts_region_handler( fwts_acpi_region_handler_called_set(true); - context = ACPI_CAST_PTR (ACPI_CONNECTION_INFO, handlercontext); - switch (regionobject->Region.SpaceId) { case ACPI_ADR_SPACE_SYSTEM_IO: switch (function & ACPI_IO_MASK) {