From patchwork Wed Sep 16 14:57:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Wallner X-Patchwork-Id: 1365396 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=br-automation.com Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bs3B54KpPz9sPB for ; Thu, 17 Sep 2020 00:58:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6740882314; Wed, 16 Sep 2020 16:58:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 6750B82329; Wed, 16 Sep 2020 16:57:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail2.br-automation.com (mail2.br-automation.com [213.33.116.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0A21F8229F for ; Wed, 16 Sep 2020 16:57:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=wolfgang.wallner@br-automation.com X-AuditID: c0a80110-e55ff70000001e7e-2f-5f6227f44c02 Received: from brsmtp01.br-automation.co.at (Unknown_Domain [192.168.1.60]) by mail2.br-automation.com () with SMTP id 2C.B7.07806.4F7226F5; Wed, 16 Sep 2020 16:57:56 +0200 (CEST) From: "Wolfgang Wallner" To: "Bin Meng" ,"Simon Glass" Cc: u-boot@lists.denx.de,"Andy Shevchenko" ,"Wolfgang Wallner" Subject: [PATCH v2 1/2] x86: acpi: Fix calculation of DSDT length Date: Wed, 16 Sep 2020 16:57:52 +0200 Message-Id: <20200916145753.684377-1-wolfgang.wallner@br-automation.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on BRSMTPINTERN2/InternSMTP(Release 10.0.1FP3|August 09, 2019) at 16/09/2020 16:57:55, Serialize by Router on BRSMTPINTERN2/InternSMTP(Release 10.0.1FP3|August 09, 2019) at 16/09/2020 16:57:55, Itemize by SMTP Server on BRSMTP01/Eggelsberg/AT/B&R(Release 10.0.1FP3|August 09, 2019) at 09/16/2020 04:57:56 PM X-TNEFEvaluated: 1 X-Disclaimed: 55807 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsVyYAWjje4X9aR4g78zlCx6m6YzWUztibf4 tmUbo8XbvZ3sDiwesxsusnjsnHWX3WPeyUCPs3d2MAawRHHZpKTmZJalFunbJXBlzPu6j7mg j7di8pm9zA2Mb7m6GDk5JARMJLrOn2UDsYUEtjJKnFmkBWKzCdhKNB7ZChYXEXCRWLx1P1MX IxcHs0AXo8Tb/n4WkISwgKPE6reTmEBsFgFViQfrloHZvAIeEjPubWQFsZkFtCWWLXzNDLFM XuJp73JmiBpBiZMzn7CADJUQuM0k8ffQTxaIIiGJ04vPQjUIS6y/s4F5AiPfLCSzZiHpX8DI tIpRPDcxM8dIL6lIN7G0JD83sSQzP08vOT93EyMk8AR2MO5+o32IkYmD8RCjBAezkgjvgcb4 eCHelMTKqtSi/Pii0pzU4kOM0hwsSuK88xQM44UE0hNLUrNTUwtSi2CyTBycUg2M6QHX8l8+ 0ToTcp83OzFKOt19oe3liWLOp7adO71RUPrnkn/Cq6b9Dloa+nDDZe5zWhcLsi4w7wy8VdTS 5Ct3Qu+38Ir5le/TNXSqDbQeT74o2HDpwWydKrtTcQ86VdIi1Fmy7+T6StiXLFa2ZMk+5Xj2 1c1Yyb5Wyfo6UZfp6ttvcF2OVPuixFKckWioxVxUnAgAILiHUyoCAAA= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Currently, the calculation for the length of the DSDT table includes any bytes that are added for alignment, but those bytes are not initialized. This is because the DSDT length is calculated after a call to acpi_inc_align(). Split this up into the following sequence: * acpi_inc() * Calculate DSDT length * acpi_align() Signed-off-by: Wolfgang Wallner Reviewed-by: Andy Shevchenko Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Added Reviewed-by tags arch/x86/lib/acpi_table.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 3a93fedfc3..6b827bfa3f 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -427,7 +427,7 @@ ulong write_acpi_tables(ulong start_addr) (char *)&AmlCode + sizeof(struct acpi_table_header), dsdt->length - sizeof(struct acpi_table_header)); - acpi_inc_align(ctx, dsdt->length - sizeof(struct acpi_table_header)); + acpi_inc(ctx, dsdt->length - sizeof(struct acpi_table_header)); /* Pack GNVS into the ACPI table area */ for (i = 0; i < dsdt->length; i++) { @@ -450,6 +450,8 @@ ulong write_acpi_tables(ulong start_addr) dsdt->checksum = 0; dsdt->checksum = table_compute_checksum((void *)dsdt, dsdt->length); + acpi_align(ctx); + /* * Fill in platform-specific global NVS variables. If this fails we * cannot return the error but this should only happen while debugging. From patchwork Wed Sep 16 14:57:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Wallner X-Patchwork-Id: 1365397 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=br-automation.com Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bs3BG2lTcz9sPB for ; Thu, 17 Sep 2020 00:58:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 35E3D82353; Wed, 16 Sep 2020 16:58:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3F80782320; Wed, 16 Sep 2020 16:58:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail2.br-automation.com (mail2.br-automation.com [213.33.116.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3B9BA82314 for ; Wed, 16 Sep 2020 16:57:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=br-automation.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=wolfgang.wallner@br-automation.com X-AuditID: c0a80110-e3fff70000001e7e-30-5f6227f4e500 Received: from brsmtp01.br-automation.co.at (Unknown_Domain [192.168.1.60]) by mail2.br-automation.com () with SMTP id 7C.B7.07806.4F7226F5; Wed, 16 Sep 2020 16:57:56 +0200 (CEST) From: "Wolfgang Wallner" To: "Bin Meng" ,"Simon Glass" Cc: u-boot@lists.denx.de,"Andy Shevchenko" ,"Wolfgang Wallner" Subject: [PATCH v2 2/2] x86: acpi: Add memset to initialize SPCR table Date: Wed, 16 Sep 2020 16:57:53 +0200 Message-Id: <20200916145753.684377-2-wolfgang.wallner@br-automation.com> In-Reply-To: <20200916145753.684377-1-wolfgang.wallner@br-automation.com> X-Mailer: git-send-email 2.28.0 References: <20200916145753.684377-1-wolfgang.wallner@br-automation.com> MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on BRSMTPINTERN2/InternSMTP(Release 10.0.1FP3|August 09, 2019) at 16/09/2020 16:57:55, Serialize by Router on BRSMTPINTERN2/InternSMTP(Release 10.0.1FP3|August 09, 2019) at 16/09/2020 16:57:55, Itemize by SMTP Server on BRSMTP01/Eggelsberg/AT/B&R(Release 10.0.1FP3|August 09, 2019) at 09/16/2020 04:57:56 PM X-TNEFEvaluated: 1 X-Disclaimed: 34299 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHLMWRmVeSWpSXmKPExsVyYAWjje4X9aR4gwPrNS16m6YzWUztibf4 tmUbo8XbvZ3sDiwesxsusnjsnHWX3WPeyUCPs3d2MAawRHHZpKTmZJalFunbJXBl3GjOLFjH WfFi1RLGBsYP7F2MnBwSAiYSPx69Zeti5OIQEtjKKNF2bCsjSIJNwFai8chWNhBbRMBFYvHW /UwgRcwCXYwSb/v7WUASwgJuEhOmPWAGsVkEVCV+r78GNJWDg1fAQ+LJBmeQMKeAp8Tb+0/A ypkFtCWWLXzNDLFYXuJp73IwWwio/FDHbLC9vAKCEidngtRzAdXcZpL4e+gnC0SDkMTpxWeh moUlJv/ezD6BUWAWkrmzkPQvYGRaxSiem5iZY6SXVKSbWFqSn5tYkpmfp5ecn7uJERKmAjsY d7/RPsTIxMF4iFGCg1lJhPdAY3y8EG9KYmVValF+fFFpTmrxIUZpDhYlcd55CobxQgLpiSWp 2ampBalFMFkmDk6pBkYJ57IPHqYqJ95NWxkkfVu/6f+OY3yS+xQj/2VsS9FxCZ4y5+5ZF2XX qtutMvez2CaGGD9kn/n0w+GTRxKuiWvMEHO8dsBuW0x2oMmR/ZUiOm9SeA5OT+PLrJoq0WDA pHLl+ZLExrVphZvuzP54yEt1znX989Gv18sIpuy7kqd+zXrf9T21GkuVWIozEg21mIuKEwEk yclHQQIAAA== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add a missing memset to acpi_create_spcr(). The other acpi_create_xxxx() functions perform a memset on their structures, acpi_create_spcr() does not and as a result the contents of this table are partly uninitialized (and thus random after every reset). Fixes: commit b288cd960072 ("x86: acpi: Generate SPCR table") Signed-off-by: Wolfgang Wallner Reviewed-by: Andy Shevchenko Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Removed unrelated whitespace change - Added Reviewed-by tags arch/x86/lib/acpi_table.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 6b827bfa3f..c445aa6870 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -252,6 +252,8 @@ static void acpi_create_spcr(struct acpi_spcr *spcr) int space_id; int ret = -ENODEV; + memset((void *)spcr, 0, sizeof(struct acpi_spcr)); + /* Fill out header fields */ acpi_fill_header(header, "SPCR"); header->length = sizeof(struct acpi_spcr);