From nobody Fri Apr 26 20:26:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60059+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1590086690314436.49594179328744; Thu, 21 May 2020 11:44:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id R3IqYY1788612xCVkvKPvHKz; Thu, 21 May 2020 11:44:49 -0700 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.53]) by mx.groups.io with SMTP id smtpd.web12.1955.1590086688745304032 for ; Thu, 21 May 2020 11:44:49 -0700 X-Received: from MRXP264CA0011.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::23) by DB7PR08MB3420.eurprd08.prod.outlook.com (2603:10a6:10:4a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 18:44:46 +0000 X-Received: from VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:15:cafe::f7) by MRXP264CA0011.outlook.office365.com (2603:10a6:500:15::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60059+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT021.mail.protection.outlook.com (10.152.18.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:46 +0000 X-Received: ("Tessian outbound facc38080784:v57"); Thu, 21 May 2020 18:44:46 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 05ed37375f137160 X-CR-MTA-TID: 64aa7808 X-Received: from bbf31e4f250d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 170456E5-76FA-4FC4-B09E-23A5D2ED6AD5.1; Thu, 21 May 2020 18:44:41 +0000 X-Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bbf31e4f250d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 May 2020 18:44:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eDIVZtzYigSKpleCK9BbYVv3lJxGZYPUOXqsWfa2O4T5BHnbxOUPvU6i3HWVGiUNSe429661DJxiFgSY6tElMjVlIdwKqIMcTqh+FZh/dnNo+aXOfNlDH/qu2vnWb4z1IR7f2KSIPEnUNsKyv0YqoU+ZK7w/rUaBLs2ymRnxOlIpYjjO35uJlv6Jy3iJY8EndFL3yKBuKY5ps5CBgATZap6rtlo9tkEYYKeZlJVfsPClRRz8TwSn/QHvDVUVha3TxhaWuegpX2O2kPzycgIZqEsiw01vNVpq28QDreizcXpmJhaKKuqD1hx00Ov2zb8yguNi4G4g8ItGYPkN1jBR/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iTepwUzKF1fJmGfhwtqlaTPxMUWIKP4Mk8W/uhjQquE=; b=d7QrYXoqZL2aBgy1/Arble+J5wxTM+lRs+qApKQEscjCBGxds4AzbS9052DYqm5qH83PmBvgzUAEbZY2r4SWNMW7HiJHOnqbTUggQRC1uDUQZ9+3PptOfgeza8lFtgxHn4pegdvNG/jQ8praTo6xuLmLTFplUImSn23v7f4Jj0iNbq9/e/PNxgvsNHh4Z4TqJt0cyptrYnqYTcNF7n9D5hVER+cjvQi2aCdtINmM8PuYkH+5MvuXFCI0ATm1uPxxNI1YqzSNH32Zxo4GO2j2vLNjEGhYVRaAu4nxZEx6Fu7cFJqHzo5DWFmZFz4SNRO2ecIQamPQIkMwg7dMXIhFZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM3PR05CA0144.eurprd05.prod.outlook.com (2603:10a6:207:3::22) by AM6PR08MB4882.eurprd08.prod.outlook.com (2603:10a6:20b:c5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Thu, 21 May 2020 18:44:38 +0000 X-Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:3:cafe::70) by AM3PR05CA0144.outlook.office365.com (2603:10a6:207:3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:38 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Thu, 21 May 2020 18:44:38 +0000 X-Received: from localhost.localdomain (10.57.25.130) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 21 May 2020 18:44:37 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v2 1/6] ShellPkg/AcpiView: Move log reset to main method Date: Thu, 21 May 2020 19:44:16 +0100 Message-ID: <20200521184421.2222-2-Tomas.Pilar@arm.com> In-Reply-To: <20200521184421.2222-1-Tomas.Pilar@arm.com> References: <20200521184421.2222-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFTY:;SFS:(4636009)(396003)(346002)(376002)(39860400002)(136003)(46966005)(47076004)(26005)(36756003)(186003)(5660300002)(8936002)(6916009)(478600001)(2906002)(356005)(336012)(82310400002)(4326008)(426003)(2616005)(70206006)(81166007)(316002)(8676002)(54906003)(6666004)(1076003)(86362001)(70586007)(82740400003);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77660fed-f8d7-451d-f587-08d7fdb708d9 X-MS-TrafficTypeDiagnostic: AM6PR08MB4882:|DB7PR08MB3420: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:127;OLM:127; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GW/Sp4ip+eNb9b6g43IkkVH210zqwCnd+gPcCR5XlOkgnZDyz4HLswQJmBVZKacdrXU8zCvCv1eE5hkFlGHhB0sTD9/Sz3/SGb3uAjV5MYtciO85ZOdcG+n6oZ5sZdptewOmn9JaZi76gF/naA3Q9zgP+aoZ2u0xF87P/ZQoOQ5tsmu2weiJ83FOv7sWeDWsszncrN4HuDftNyvyUR2fH/wnZ8RFxjy1yl08w0CvQKVmhqGqqqM2gF40Oh13EUynGtNbZrZ4tmbCkPcwPbNIMvZs0RGDwm0lezmUBr/8whuNxTtF0J82dsOpbG7J0QlFj6wwvcxowsmvPsIYTVEthfscZ19TMUsP5phIOUIIQPpl65EMZFRm0kkoUWy+HlHg/vf1VAe5tQ3KWyxs5kxxYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4882 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ddbff98a-9725-48cf-9800-08d7fdb70421 X-Microsoft-Antispam-Message-Info: TSftgwccYVvNVkIek+5IYzvoc6bBA4KHUkg1BNfgUpmvbpMgxuc/0tSgIN8saInuEwuBYBrd4kbexp11SdTcQipAuRMUYP8y+76wUYUX8SuV3vwIh7QyP3RnpGtiZtUZ+yng3Ym9l//eRwhT2Msk3zGFC37n/CmUyT6noyn8wIvs/tqmIM4lhpjDtqBnP1br85XGKQA8wDV0bo0i1d+epmIuEopX+Pa+gHOR3PKIVkiVMpci5T01Eug9c2UduxzUdbacZR31hTM1+mLS6MSvjlDlXlzR2KChEMOznAPAvIK3St64cCcTLCpD+GjqJCz3EkjgA8ynrkv1WGkBSDm15YBMoAy1v8P3W02dNV0pO6W7ghOHmlKVJhx1qjnaYbuu64IoX8HmsBAE/JZIOtw+kg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 18:44:46.4529 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 77660fed-f8d7-451d-f587-08d7fdb708d9 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3420 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: no4p8OOXx4Y2sSfKDHQDVamFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1590086689; bh=AWliEwhDpo8X34wVpY0v+eUDByINYEP1y2YHIvkMoGI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=NdZMvD5NwXKAgITrf7gRif397/u/1OzujMqcDPT9KmQTBuLfeBtYenkBt0B+c9bRKin PTwmwaJY5ci2oXGLDG4TgBnf3brtii0f9KQ6oygVjzReNtmKUUq+/EvDEy2vwtPpvhWaN mVplsjSW+uFCupY/oNXBQNitw1KBnh358cQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The error and warning counters are reset in the AcpiView main method. This improves reusability of the main method. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar Reviewed-by: Zhichao Gao --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 84ffb3595750..f1a95b7b8f03 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -424,6 +424,10 @@ AcpiView ( EfiConfigurationTable =3D NULL; OriginalAttribute =3D 0; =20 + // Reset The error/warning counters + ResetErrorCount (); + ResetWarningCount (); + // Search the table for an entry that matches the ACPI Table Guid FoundAcpiTable =3D FALSE; for (Index =3D 0; Index < SystemTable->NumberOfTableEntries; Index++) { @@ -566,10 +570,6 @@ ShellCommandRunAcpiView ( Package =3D NULL; TmpDumpFileHandle =3D NULL; =20 - // Reset The error/warning counters - ResetErrorCount (); - ResetWarningCount (); - Status =3D ShellCommandLineParse (ParamList, &Package, &ProblemParam, TR= UE); if (EFI_ERROR (Status)) { if (Status =3D=3D EFI_VOLUME_CORRUPTED && ProblemParam !=3D NULL) { --=20 2.24.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60059): https://edk2.groups.io/g/devel/message/60059 Mute This Topic: https://groups.io/mt/74382410/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 20:26:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60062+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1590086692273512.8667518680656; Thu, 21 May 2020 11:44:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id KtdbYY1788612xf3hnHBaUPT; Thu, 21 May 2020 11:44:51 -0700 X-Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.69]) by mx.groups.io with SMTP id smtpd.web11.1917.1590086690211404137 for ; Thu, 21 May 2020 11:44:50 -0700 X-Received: from AM6P193CA0126.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::31) by AM4PR0802MB2372.eurprd08.prod.outlook.com (2603:10a6:200:60::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Thu, 21 May 2020 18:44:47 +0000 X-Received: from VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:85:cafe::fa) by AM6P193CA0126.outlook.office365.com (2603:10a6:209:85::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60062+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT025.mail.protection.outlook.com (10.152.18.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:46 +0000 X-Received: ("Tessian outbound 14e212f6ce41:v57"); Thu, 21 May 2020 18:44:46 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: af47a69c476f7064 X-CR-MTA-TID: 64aa7808 X-Received: from 9bf7c922be3e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A9F2304F-D0BD-432C-9067-1FFE6D542828.1; Thu, 21 May 2020 18:44:41 +0000 X-Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9bf7c922be3e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 May 2020 18:44:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=REu4wemXrHpy0FBjUOgT9wANAnS29NSiJSHxVDFju4sJ5dNQESsfmOcLL+eJuU5HH/18Z9jlajV3hrsZnTwuXWisRv7DSwNVDWHVav/qXc7YIGmf+c9LU/aZhzIyVkUyBc7BMMPrQGzumJJhtHlF7NY/yCAvDwDz8fWDg+KE6xb04i78i5zFBf/Q83pJ98JuQExK4xvQCvhtTygb0c+g1JNqoVZRgq++NV1cBxlffdjnDuOeXdIEOFqhwPYCA32M+QIWf7U/oilG0xIDAaOaC8rj86/kQKUvg0ARLDDRVFkWBLztLT0WukmiL9kAIC5IWwHWT8tgtOlDDSxLE5em7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hxcGxfNvnVywABc9aAl37AEvOtIrBb93AV9GF5QaKmk=; b=DsZTBUFgcDSvo6AEkRaZL43lnjX+vOoyX3L+IfTztfDDpHii4NMXCNnoHDMXrA33Pf2IDUZj7GUotfGzVw7bprAa5BFifs+XiRO3NvZqIXfALFI1qUN5eew8LUICxCihox5Ze20FNB+QqFceKM6cPJxbSn+LkhK78JEq1I0xR1Y10kDlW6d7vhuXvTP3UwNMeVKiZTklG6L+QJ61qY0NPlPHLmpj66YMOeopDkCMHaCuaExpcrB0/4sgmMQGZQl0oIIr7MwoviAjQuqlc3IofR2JK7vYSKP13sv4nAj0msfLiBicUNSkTF9ZRGgIXNx/YTzIw5Vigm1EVcaHoNir4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM3PR05CA0147.eurprd05.prod.outlook.com (2603:10a6:207:3::25) by DB6PR0802MB2358.eurprd08.prod.outlook.com (2603:10a6:4:89::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 18:44:39 +0000 X-Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:3:cafe::87) by AM3PR05CA0147.outlook.office365.com (2603:10a6:207:3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24 via Frontend Transport; Thu, 21 May 2020 18:44:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:39 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Thu, 21 May 2020 18:44:38 +0000 X-Received: from localhost.localdomain (10.57.25.130) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 21 May 2020 18:44:38 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v2 2/6] ShellPkg/AcpiView: Refactor configuration Date: Thu, 21 May 2020 19:44:17 +0100 Message-ID: <20200521184421.2222-3-Tomas.Pilar@arm.com> In-Reply-To: <20200521184421.2222-1-Tomas.Pilar@arm.com> References: <20200521184421.2222-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFTY:;SFS:(4636009)(376002)(396003)(346002)(136003)(39860400002)(46966005)(82740400003)(19627235002)(54906003)(47076004)(70206006)(36756003)(2906002)(316002)(8936002)(8676002)(70586007)(6916009)(186003)(356005)(81166007)(426003)(5660300002)(26005)(478600001)(2616005)(4326008)(30864003)(86362001)(1076003)(6666004)(336012)(82310400002);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48de11a0-dc0b-4578-fd24-08d7fdb70902 X-MS-TrafficTypeDiagnostic: DB6PR0802MB2358:|AM4PR0802MB2372: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5236;OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: pO1mycDzcP/pqhMobGpUC4nWSqf2hlGT69AZC8WqZ2Zdj11NDdEmZ/yb/kskSUde6vx6Z/0z3yOhuBTvX6tJfRshUhb8mKmD/37tq1kPpK2UqA9MtszuKNLp7QqX7urRPIethWFhM++RnQEGZGYyqGppEyawIswZ/8ACNjhvFD5h5SLhEpFsrzVvS/SqcK1tEDbj3RdLeY3xnsC4HhrYXHQ4LPJcYtZ36Zs4YtQcQfFmFwFlARjzMhG54E0wo6oBZQtb5lUrBD6Su98ZyCj8YvlVQUtrow7Jt5Pm0dRaQf6nuwijrHOgkE/5R1TwjWudZZ2zPCzC0Yw7vU72r4dFVH5NOsFVBjRu8ZFWnZqkhNgPePIvW9WIbg5ETB5CQ1D06XBgd0z5TXX0YG7W9zuo3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2358 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5da3b13d-20ff-48ea-98f0-08d7fdb70470 X-Microsoft-Antispam-Message-Info: LY8/yHPq6t2LJhjkI1ohyS5IBRNKtQF3hoGCQzwLLUgjDLS5eyLo+JnEpPmq5X3fDLId/zWq0hNVX4vbmjdbk7RTj7bDCv9vICX7tiMHFP7Xl6jWQhZpvO4mOolB06MbMrlb2Rl1Fpru3aWBiKmk1cRsDB9Fs85LIP+QY/wMtbGcl7EZ5CQHbc5BkIlAR6XBQwcmoWTq0OzR8ZsDm4nyGYzDXoKsBU400hNZ1M7BRS+luLjTG9SCkPt781CkNWO1eNvQ22lgRLlL8Xlw2vVXeJgtzk7G5c1Q+5S3iJ1o049nlRE+C/z1hwNpyiVH9IhKYDGljan/DXc/HVMFHBEVvDdVtSRhdZEKJfVFzlbT0IEB6NzY5qodUFpp2GLb0GKZL9O8VDkbFwVnTv/KGatfIQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 18:44:46.6868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48de11a0-dc0b-4578-fd24-08d7fdb70902 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2372 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: 4OMCemKMpdZICOX0Hd9S0YKGx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1590086691; bh=P2FfAwl0j17OggjPMFk98e6q7STq58+emM2SnKzHM5Q=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=KwXqmfSj/G2TuqXcNK7KKGtFAuVReRDEhvWL1kOPXZNq1BJ0IJ1aTqiAumZYZ5G+Kud TSJtDz3oocVNJKkcqshOyAcj5wXaPBE1+Ih9e0r+2gYvCC789ufonu4Bv2bv62/SGo8Xw S4t7QwQzTlrxc7Vh8hvjpDnj6qA8L5ciwIc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" A new file and header (AcpiViewConfig.[ch]) is created that houses the user configuration. This declutters the core code and improves modularity of the design. The module level symbols for verbosity, table selection, and highlighting are refactored into the new file. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar Reviewed-by: Zhichao Gao --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c = | 1 + ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c = | 1 + ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c = | 237 +++++++++---------------------------------------------------------- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h = | 95 --------------------------- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c = | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h = | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c = | 1 + ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c = | 1 + ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c = | 1 + ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c = | 1 + ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c = | 1 + ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.i= nf | 32 ++++----- 12 files changed, 479 insertions(+), 315 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 3f12a33050a4..02f6d771c7e1 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -10,6 +10,7 @@ #include #include "AcpiParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" =20 STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c= b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index d5b9eee52323..4b618f131eac 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -17,6 +17,7 @@ #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" =20 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) #include "Arm/SbbrValidator.h" diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index f1a95b7b8f03..2f7395c23bce 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -20,6 +20,7 @@ #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" #include "UefiShellAcpiViewCommandLib.h" =20 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -28,17 +29,8 @@ =20 EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; =20 -// Report variables -STATIC UINT32 mSelectedAcpiTable; -STATIC CONST CHAR16* mSelectedAcpiTableName; -STATIC BOOLEAN mSelectedAcpiTableFound; -STATIC EREPORT_OPTION mReportType; STATIC UINT32 mTableCount; STATIC UINT32 mBinTableCount; -STATIC BOOLEAN mConsistencyCheck; -STATIC BOOLEAN mColourHighlighting; -STATIC BOOLEAN mMandatoryTableValidate; -STATIC UINTN mMandatoryTableSpec; =20 /** An array of acpiview command line parameters. @@ -53,142 +45,6 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { {NULL, TypeMax} }; =20 -/** - This function returns the colour highlighting status. - - @retval TRUE if colour highlighting is enabled. -**/ -BOOLEAN -GetColourHighlighting ( - VOID - ) -{ - return mColourHighlighting; -} - -/** - This function sets the colour highlighting status. - - @param Highlight The Highlight status. - -**/ -VOID -SetColourHighlighting ( - BOOLEAN Highlight - ) -{ - mColourHighlighting =3D Highlight; -} - -/** - This function returns the consistency checking status. - - @retval TRUE if consistency checking is enabled. -**/ -BOOLEAN -GetConsistencyChecking ( - VOID - ) -{ - return mConsistencyCheck; -} - -/** - This function sets the consistency checking status. - - @param ConsistencyChecking The consistency checking status. - -**/ -VOID -SetConsistencyChecking ( - BOOLEAN ConsistencyChecking - ) -{ - mConsistencyCheck =3D ConsistencyChecking; -} - -/** - This function returns the ACPI table requirements validation flag. - - @retval TRUE if check for mandatory table presence should be performed. -**/ -BOOLEAN -GetMandatoryTableValidate ( - VOID - ) -{ - return mMandatoryTableValidate; -} - -/** - This function sets the ACPI table requirements validation flag. - - @param Validate Enable/Disable ACPI table requirements validation. -**/ -VOID -SetMandatoryTableValidate ( - BOOLEAN Validate - ) -{ - mMandatoryTableValidate =3D Validate; -} - -/** - This function returns the identifier of specification to validate ACPI t= able - requirements against. - - @return ID of specification listing mandatory tables. -**/ -UINTN -GetMandatoryTableSpec ( - VOID - ) -{ - return mMandatoryTableSpec; -} - -/** - This function sets the identifier of specification to validate ACPI table - requirements against. - - @param Spec ID of specification listing mandatory tables. -**/ -VOID -SetMandatoryTableSpec ( - UINTN Spec - ) -{ - mMandatoryTableSpec =3D Spec; -} - -/** - This function returns the report options. - - @retval Returns the report option. -**/ -STATIC -EREPORT_OPTION -GetReportOption ( - VOID - ) -{ - return mReportType; -} - -/** - This function returns the selected ACPI table. - - @retval Returns signature of the selected ACPI table. -**/ -STATIC -UINT32 -GetSelectedAcpiTable ( - VOID - ) -{ - return mSelectedAcpiTable; -} - /** This function dumps the ACPI table to a file. =20 @@ -205,19 +61,21 @@ DumpAcpiTableToFile ( IN CONST UINTN Length ) { - EFI_STATUS Status; - CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SHELL_FILE_HANDLE DumpFileHandle; - UINTN TransferBytes; + EFI_STATUS Status; + CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; + SHELL_FILE_HANDLE DumpFileHandle; + UINTN TransferBytes; + SELECTED_ACPI_TABLE SelectedTable; =20 DumpFileHandle =3D NULL; TransferBytes =3D Length; + GetSelectedAcpiTable (&SelectedTable); =20 UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.bin", - mSelectedAcpiTableName, + SelectedTable.Name, mBinTableCount++ ); =20 @@ -273,10 +131,11 @@ ProcessTableReportOptions ( IN CONST UINT32 Length ) { - UINTN OriginalAttribute; - UINT8* SignaturePtr; - BOOLEAN Log; - BOOLEAN HighLight; + UINTN OriginalAttribute; + UINT8 *SignaturePtr; + BOOLEAN Log; + BOOLEAN HighLight; + SELECTED_ACPI_TABLE SelectedTable; =20 // // set local variables to suppress incorrect compiler/analyzer warnings @@ -285,15 +144,16 @@ ProcessTableReportOptions ( SignaturePtr =3D (UINT8*)(UINTN)&Signature; Log =3D FALSE; HighLight =3D GetColourHighlighting (); + GetSelectedAcpiTable (&SelectedTable); =20 switch (GetReportOption ()) { case ReportAll: Log =3D TRUE; break; case ReportSelected: - if (Signature =3D=3D GetSelectedAcpiTable ()) { + if (Signature =3D=3D SelectedTable.Type) { Log =3D TRUE; - mSelectedAcpiTableFound =3D TRUE; + SelectedTable.Found =3D TRUE; } break; case ReportTableList: @@ -321,8 +181,8 @@ ProcessTableReportOptions ( ); break; case ReportDumpBinFile: - if (Signature =3D=3D GetSelectedAcpiTable ()) { - mSelectedAcpiTableFound =3D TRUE; + if (Signature =3D=3D SelectedTable.Type) { + SelectedTable.Found =3D TRUE; DumpAcpiTableToFile (TablePtr, Length); } break; @@ -356,37 +216,7 @@ ProcessTableReportOptions ( return Log; } =20 -/** - This function converts a string to ACPI table signature. - - @param [in] Str Pointer to the string to be converted to the - ACPI table signature. =20 - @retval The ACPI table signature. -**/ -STATIC -UINT32 -ConvertStrToAcpiSignature ( - IN CONST CHAR16* Str - ) -{ - UINT8 Index; - CHAR8 Ptr[4]; - - ZeroMem (Ptr, sizeof (Ptr)); - Index =3D 0; - - // Convert to Upper case and convert to ASCII - while ((Index < 4) && (Str[Index] !=3D 0)) { - if (Str[Index] >=3D L'a' && Str[Index] <=3D L'z') { - Ptr[Index] =3D (CHAR8)(Str[Index] - (L'a' - L'A')); - } else { - Ptr[Index] =3D (CHAR8)Str[Index]; - } - Index++; - } - return *(UINT32*)Ptr; -} =20 /** This function iterates the configuration table entries in the @@ -417,6 +247,7 @@ AcpiView ( UINT8 RsdpRevision; PARSE_ACPI_TABLE_PROC RsdpParserProc; BOOLEAN Trace; + SELECTED_ACPI_TABLE SelectedTable; =20 // // set local variables to suppress incorrect compiler/analyzer warnings @@ -428,6 +259,9 @@ AcpiView ( ResetErrorCount (); ResetWarningCount (); =20 + // Retrieve the user selection of ACPI table to process + GetSelectedAcpiTable (&SelectedTable); + // Search the table for an entry that matches the ACPI Table Guid FoundAcpiTable =3D FALSE; for (Index =3D 0; Index < SystemTable->NumberOfTableEntries; Index++) { @@ -496,7 +330,7 @@ AcpiView ( if (ReportTableList !=3D ReportOption) { if (((ReportSelected =3D=3D ReportOption) || (ReportDumpBinFile =3D=3D ReportOption)) && - (!mSelectedAcpiTableFound)) { + (!SelectedTable.Found)) { Print (L"\nRequested ACPI Table not found.\n"); } else if (GetConsistencyChecking () && (ReportDumpBinFile !=3D ReportOption)) { @@ -554,17 +388,12 @@ ShellCommandRunAcpiView ( CHAR16* ProblemParam; SHELL_FILE_HANDLE TmpDumpFileHandle; CONST CHAR16* MandatoryTableSpecStr; + CONST CHAR16 *SelectedTableName; =20 // Set Defaults - mReportType =3D ReportAll; mTableCount =3D 0; mBinTableCount =3D 0; - mSelectedAcpiTable =3D 0; - mSelectedAcpiTableName =3D NULL; - mSelectedAcpiTableFound =3D FALSE; - mConsistencyCheck =3D TRUE; - mMandatoryTableValidate =3D FALSE; - mMandatoryTableSpec =3D 0; + AcpiConfigSetDefaults (); =20 ShellStatus =3D SHELL_SUCCESS; Package =3D NULL; @@ -671,25 +500,23 @@ ShellCommandRunAcpiView ( } =20 if (ShellCommandLineGetFlag (Package, L"-l")) { - mReportType =3D ReportTableList; + SetReportOption (ReportTableList); } else { - mSelectedAcpiTableName =3D ShellCommandLineGetValue (Package, L"-s= "); - if (mSelectedAcpiTableName !=3D NULL) { - mSelectedAcpiTable =3D (UINT32)ConvertStrToAcpiSignature ( - mSelectedAcpiTableName - ); - mReportType =3D ReportSelected; + SelectedTableName =3D ShellCommandLineGetValue (Package, L"-s"); + if (SelectedTableName !=3D NULL) { + SelectAcpiTable (SelectedTableName); + SetReportOption (ReportSelected); =20 if (ShellCommandLineGetFlag (Package, L"-d")) { // Create a temporary file to check if the media is writable. CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - mReportType =3D ReportDumpBinFile; + SetReportOption (ReportDumpBinFile); =20 UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.tmp", - mSelectedAcpiTableName, + SelectedTableName, mBinTableCount ); =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index be65564c86a6..92d64a88814d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -23,17 +23,6 @@ **/ #define RSDP_LENGTH_OFFSET 20 =20 -/** - The EREPORT_OPTION enum describes ACPI table Reporting options. -**/ -typedef enum ReportOption { - ReportAll, ///< Report All tables. - ReportSelected, ///< Report Selected table. - ReportTableList, ///< Report List of tables. - ReportDumpBinFile, ///< Dump selected table to a file. - ReportMax, -} EREPORT_OPTION; - /** This function resets the ACPI table error counter to Zero. **/ @@ -70,90 +59,6 @@ GetWarningCount ( VOID ); =20 -/** - This function returns the colour highlighting status. - - @retval TRUE if colour highlighting is enabled. -**/ -BOOLEAN -GetColourHighlighting ( - VOID - ); - -/** - This function sets the colour highlighting status. - - @param Highlight The Highlight status. - -**/ -VOID -SetColourHighlighting ( - BOOLEAN Highlight - ); - -/** - This function returns the consistency checking status. - - @retval TRUE if consistency checking is enabled. -**/ -BOOLEAN -GetConsistencyChecking ( - VOID - ); - -/** - This function sets the consistency checking status. - - @param ConsistencyChecking The consistency checking status. - -**/ -VOID -SetConsistencyChecking ( - BOOLEAN ConsistencyChecking - ); - -/** - This function returns the ACPI table requirements validation flag. - - @retval TRUE if check for mandatory table presence should be performed. -**/ -BOOLEAN -GetMandatoryTableValidate ( - VOID - ); - -/** - This function sets the ACPI table requirements validation flag. - - @param Validate Enable/Disable ACPI table requirements validation. -**/ -VOID -SetMandatoryTableValidate ( - BOOLEAN Validate - ); - -/** - This function returns the identifier of specification to validate ACPI t= able - requirements against. - - @return ID of specification listing mandatory tables. -**/ -UINTN -GetMandatoryTableSpec ( - VOID - ); - -/** - This function sets the identifier of specification to validate ACPI table - requirements against. - - @param Spec ID of specification listing mandatory tables. -**/ -VOID -SetMandatoryTableSpec ( - UINTN Spec - ); - /** This function processes the table reporting options for the ACPI table. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c = b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c new file mode 100644 index 000000000000..6f6d1a9d52c1 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c @@ -0,0 +1,246 @@ +/** @file + State and accessors for 'acpiview' configuration. + + Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include + +#include "AcpiViewConfig.h" + +// Report variables +STATIC BOOLEAN mConsistencyCheck; +STATIC BOOLEAN mColourHighlighting; +STATIC EREPORT_OPTION mReportType; +STATIC BOOLEAN mMandatoryTableValidate; +STATIC UINTN mMandatoryTableSpec; + +// User selection of which ACPI table should be checked +SELECTED_ACPI_TABLE mSelectedAcpiTable; + +/** + Reset the AcpiView user configuration to defaults +**/ +VOID +EFIAPI +AcpiConfigSetDefaults ( + VOID + ) +{ + mReportType =3D ReportAll; + mSelectedAcpiTable.Type =3D 0; + mSelectedAcpiTable.Name =3D NULL; + mSelectedAcpiTable.Found =3D FALSE; + mConsistencyCheck =3D TRUE; + mMandatoryTableValidate =3D FALSE; + mMandatoryTableSpec =3D 0; +} + +/** + This function converts a string to ACPI table signature. + + @param [in] Str Pointer to the string to be converted to the + ACPI table signature. + + @retval The ACPI table signature. +**/ +STATIC +UINT32 +ConvertStrToAcpiSignature ( + IN CONST CHAR16 *Str + ) +{ + UINT8 Index; + CHAR8 Ptr[4]; + + ZeroMem (Ptr, sizeof (Ptr)); + Index =3D 0; + + // Convert to Upper case and convert to ASCII + while ((Index < 4) && (Str[Index] !=3D 0)) { + if (Str[Index] >=3D L'a' && Str[Index] <=3D L'z') { + Ptr[Index] =3D (CHAR8)(Str[Index] - (L'a' - L'A')); + } else { + Ptr[Index] =3D (CHAR8)Str[Index]; + } + Index++; + } + return *(UINT32 *) Ptr; +} + +/** + This function selects an ACPI table in current context. + The string name of the table is converted into UINT32 + table signature. + + @param [in] TableName The name of the ACPI table to select. +**/ +VOID +EFIAPI +SelectAcpiTable ( + IN CONST CHAR16 *TableName + ) +{ + ASSERT (TableName !=3D NULL); + + mSelectedAcpiTable.Name =3D TableName; + mSelectedAcpiTable.Type =3D ConvertStrToAcpiSignature (mSelectedAcpiTabl= e.Name); +} + +/** + This function returns the selected ACPI table. + + @param [out] SelectedAcpiTable Pointer that will contain the returned st= ruct. +**/ +VOID +EFIAPI +GetSelectedAcpiTable ( + OUT SELECTED_ACPI_TABLE *SelectedAcpiTable + ) +{ + *SelectedAcpiTable =3D mSelectedAcpiTable; +} + +/** + This function returns the colour highlighting status. + + @retval TRUE Colour highlighting is enabled. +**/ +BOOLEAN +EFIAPI +GetColourHighlighting ( + VOID + ) +{ + return mColourHighlighting; +} + +/** + This function sets the colour highlighting status. + + @param [in] Highlight The highlight status. +**/ +VOID +EFIAPI +SetColourHighlighting ( + BOOLEAN Highlight + ) +{ + mColourHighlighting =3D Highlight; +} + +/** + This function returns the consistency checking status. + + @retval TRUE Consistency checking is enabled. +**/ +BOOLEAN +EFIAPI +GetConsistencyChecking ( + VOID + ) +{ + return mConsistencyCheck; +} + +/** + This function sets the consistency checking status. + + @param [in] ConsistencyChecking The consistency checking status. +**/ +VOID +EFIAPI +SetConsistencyChecking ( + BOOLEAN ConsistencyChecking + ) +{ + mConsistencyCheck =3D ConsistencyChecking; +} + +/** + This function returns the report options. + + @return The current report option. +**/ +EREPORT_OPTION +EFIAPI +GetReportOption ( + VOID + ) +{ + return mReportType; +} + +/** + This function sets the report options. + + @param [in] ReportType The report option to set. +**/ +VOID +EFIAPI +SetReportOption ( + EREPORT_OPTION ReportType + ) +{ + mReportType =3D ReportType; +} + +/** + This function returns the ACPI table requirements validation flag. + + @retval TRUE Check for mandatory table presence should be performed. +**/ +BOOLEAN +EFIAPI +GetMandatoryTableValidate ( + VOID + ) +{ + return mMandatoryTableValidate; +} + +/** + This function sets the ACPI table requirements validation flag. + + @param [in] Validate Enable/Disable ACPI table requirements validation. +**/ +VOID +EFIAPI +SetMandatoryTableValidate ( + BOOLEAN Validate + ) +{ + mMandatoryTableValidate =3D Validate; +} + +/** + This function returns the identifier of specification to validate ACPI t= able + requirements against. + + @return ID of specification listing mandatory tables. +**/ +UINTN +EFIAPI +GetMandatoryTableSpec ( + VOID + ) +{ + return mMandatoryTableSpec; +} + +/** + This function sets the identifier of specification to validate ACPI table + requirements against. + + @param [in] Spec ID of specification listing mandatory tables. +**/ +VOID +EFIAPI +SetMandatoryTableSpec ( + UINTN Spec + ) +{ + mMandatoryTableSpec =3D Spec; +} diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h = b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h new file mode 100644 index 000000000000..fc99624e41dc --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h @@ -0,0 +1,177 @@ +/** @file + Header file for 'acpiview' configuration. + + Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef ACPI_VIEW_CONFIG_H_ +#define ACPI_VIEW_CONFIG_H_ + +/** + This function returns the colour highlighting status. + + @retval TRUE Colour highlighting is enabled. +**/ +BOOLEAN +EFIAPI +GetColourHighlighting ( + VOID + ); + +/** + This function sets the colour highlighting status. + + @param [in] Highlight The highlight status. +**/ +VOID +EFIAPI +SetColourHighlighting ( + BOOLEAN Highlight + ); + +/** + This function returns the consistency checking status. + + @retval TRUE Consistency checking is enabled. +**/ +BOOLEAN +EFIAPI +GetConsistencyChecking ( + VOID + ); + +/** + This function sets the consistency checking status. + + @param [in] ConsistencyChecking The consistency checking status. +**/ +VOID +EFIAPI +SetConsistencyChecking ( + BOOLEAN ConsistencyChecking + ); + +/** + This function returns the ACPI table requirements validation flag. + + @retval TRUE Check for mandatory table presence should be performed. +**/ +BOOLEAN +EFIAPI +GetMandatoryTableValidate ( + VOID + ); + +/** + This function sets the ACPI table requirements validation flag. + + @param [in] Validate Enable/Disable ACPI table requirements validation. +**/ +VOID +EFIAPI +SetMandatoryTableValidate ( + BOOLEAN Validate + ); + +/** + This function returns the identifier of specification to validate ACPI t= able + requirements against. + + @return ID of specification listing mandatory tables. +**/ +UINTN +EFIAPI +GetMandatoryTableSpec ( + VOID + ); + +/** + This function sets the identifier of specification to validate ACPI table + requirements against. + + @param [in] Spec ID of specification listing mandatory tables. +**/ +VOID +EFIAPI +SetMandatoryTableSpec ( + UINTN Spec + ); + +/** + The EREPORT_OPTION enum describes ACPI table Reporting options. +**/ +typedef enum { + ReportAll, ///< Report All tables. + ReportSelected, ///< Report Selected table. + ReportTableList, ///< Report List of tables. + ReportDumpBinFile, ///< Dump selected table to a file. + ReportMax, +} EREPORT_OPTION; + +/** + This function returns the report options. + + @return The current report option. +**/ +EREPORT_OPTION +EFIAPI +GetReportOption ( + VOID + ); + +/** + This function sets the report options. + + @param [in] ReportType The report option to set. +**/ +VOID +EFIAPI +SetReportOption ( + EREPORT_OPTION ReportType + ); + +/** + A structure holding the user selection detailing which + ACPI table is to be examined by the AcpiView code. +**/ +typedef struct { + UINT32 Type; ///< 32bit signature of the selected ACPI t= able. + CONST CHAR16* Name; ///< User friendly name of the selected ACP= I table. + BOOLEAN Found; ///< The selected table has been found in t= he system. +} SELECTED_ACPI_TABLE; + +/** + This function returns the selected ACPI table. + + @param [out] SelectedAcpiTable Pointer that will contain the returned st= ruct. +**/ +VOID +EFIAPI +GetSelectedAcpiTable ( + OUT SELECTED_ACPI_TABLE* SelectedAcpiTable + ); + +/** + This function selects an ACPI table in current context. + The string name of the table is converted into UINT32 + table signature. + + @param [in] TableName The name of the ACPI table to select. +**/ +VOID +EFIAPI +SelectAcpiTable ( + CONST CHAR16* TableName + ); + +/** + Reset the AcpiView user configuration to defaults. +**/ +VOID +EFIAPI +AcpiConfigSetDefaults ( + VOID + ); + +#endif // ACPI_VIEW_CONFIG_H_ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/Gtdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPa= rser.c index bdd30ff45c61..d02fc4929d6f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -12,6 +12,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiViewConfig.h" =20 // "The number of GT Block Timers must be less than or equal to 8" #define GT_BLOCK_TIMER_COUNT_MAX 8 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/Iort= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPa= rser.c index 9a006a01448b..f7447947b230 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiViewConfig.h" =20 // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/Madt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPa= rser.c index f85d2b36532c..15aa2392b60c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -15,6 +15,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiViewConfig.h" #include "MadtParser.h" =20 // Local Variables diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/Pptt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttPa= rser.c index 0db272c16af0..acd2b81bb325 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" #include "PpttParser.h" =20 // Local variables diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Srat= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPa= rser.c index 6f66be68cc0b..b9b67820b89f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiViewConfig.h" =20 // Local Variables STATIC CONST UINT8* SratRAType; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf index d21ecd40a8cf..92de2391b09f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf @@ -19,15 +19,14 @@ [Defines] DESTRUCTOR =3D UefiShellAcpiViewCommandLibDestructor =20 [Sources.common] - UefiShellAcpiViewCommandLib.uni - UefiShellAcpiViewCommandLib.c - UefiShellAcpiViewCommandLib.h - AcpiParser.h - AcpiTableParser.h - AcpiView.h AcpiParser.c + AcpiParser.h AcpiTableParser.c + AcpiTableParser.h AcpiView.c + AcpiView.h + AcpiViewConfig.c + AcpiViewConfig.h Parsers/Bgrt/BgrtParser.c Parsers/Dbg2/Dbg2Parser.c Parsers/Dsdt/DsdtParser.c @@ -36,40 +35,43 @@ [Sources.common] Parsers/Gtdt/GtdtParser.c Parsers/Iort/IortParser.c Parsers/Madt/MadtParser.c + Parsers/Madt/MadtParser.h Parsers/Mcfg/McfgParser.c Parsers/Pptt/PpttParser.c + Parsers/Pptt/PpttParser.h Parsers/Rsdp/RsdpParser.c Parsers/Slit/SlitParser.c Parsers/Spcr/SpcrParser.c Parsers/Srat/SratParser.c Parsers/Ssdt/SsdtParser.c Parsers/Xsdt/XsdtParser.c - Parsers/Madt/MadtParser.h - Parsers/Pptt/PpttParser.h + UefiShellAcpiViewCommandLib.c + UefiShellAcpiViewCommandLib.h + UefiShellAcpiViewCommandLib.uni =20 [Sources.ARM, Sources.AARCH64] Arm/SbbrValidator.h Arm/SbbrValidator.c =20 [Packages] + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec =20 [LibraryClasses] - MemoryAllocationLib BaseLib BaseMemoryLib DebugLib + FileHandleLib + HiiLib + MemoryAllocationLib + PcdLib + PrintLib ShellCommandLib ShellLib + UefiBootServicesTableLib UefiLib UefiRuntimeServicesTableLib - UefiBootServicesTableLib - PcdLib - HiiLib - PrintLib - FileHandleLib =20 =20 [FixedPcd] --=20 2.24.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60062): https://edk2.groups.io/g/devel/message/60062 Mute This Topic: https://groups.io/mt/74382414/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 20:26:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60061+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1590086691699705.8535234555827; Thu, 21 May 2020 11:44:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id KluXYY1788612xvi7ePAIe3f; Thu, 21 May 2020 11:44:51 -0700 X-Received: from EUR01-DB5-obe.outbound.protection.outlook.com (EUR01-DB5-obe.outbound.protection.outlook.com [40.107.15.42]) by mx.groups.io with SMTP id smtpd.web11.1916.1590086689831913495 for ; Thu, 21 May 2020 11:44:50 -0700 X-Received: from AM5PR0602CA0016.eurprd06.prod.outlook.com (2603:10a6:203:a3::26) by VI1PR08MB3021.eurprd08.prod.outlook.com (2603:10a6:803:47::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.27; Thu, 21 May 2020 18:44:47 +0000 X-Received: from VE1EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:a3:cafe::e8) by AM5PR0602CA0016.outlook.office365.com (2603:10a6:203:a3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24 via Frontend Transport; Thu, 21 May 2020 18:44:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60061+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT022.mail.protection.outlook.com (10.152.18.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:46 +0000 X-Received: ("Tessian outbound 9eabd37e4fee:v57"); Thu, 21 May 2020 18:44:46 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 449440306e439c3d X-CR-MTA-TID: 64aa7808 X-Received: from ce535e6581cd.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 97D25AC6-AECB-4647-B36E-2CA37EE13DA0.1; Thu, 21 May 2020 18:44:41 +0000 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ce535e6581cd.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 May 2020 18:44:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I+YhLt0bpQFKBK/oFCtNZTkImVhLiJCjT5cUpvH8Rm25+y5D74OVRPLGlI2hS8lsy/tnx9LxEdgkFpmwA0IL/lR0NXmzYoIxLPxc0TGUM/A7sca717y8Ty6rCAGb+u/h5RxxkYGQRYVxfJmX//6f9XcnH9nm23zSeq1lksQ5qieZF2KS/Z++J10bvvPLHgarxbCqLfNsndIxI12Ps/mOM2hF919xUy0NCwFrQv2mtzvryy1dmwnP/dgggEuElx2jC6bKb+Am1XM9MNX4XMlsIKkHpvdXFx8B7sIa9zon7JIAKJFOXlR1EukKZE87OSz+XrRJv73XbRvaBzs98SEdCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BaJTCFdWvlq7lQtSLKcV3956jHRcFAA9jdckv2vrkFg=; b=EaPmgZaDb5S47uy2z8sxx5umDOg/cmyYKgwjaaBN4vxIRKK6NW1i3KdeN+KxMgPbxa2G7Pote95df3uzqXv43SyyAfmU/9bi2neXyQ8+wKMAAaOBFHKYYqwpCQurJv685EpMO0oqBCIW0/HfOCFmGFKgDan9uJ1rTN8MtdezRZDkFO0p1DT9Li+Dt7o6nH5qhwxGQR9mrSUhmfhWK4AgYNzsCw5f3cTuqnlLdQ9+TEaYTAihaCE6iTiE3IRZipOnmq3wKDy4BmdGz6KqF/w2zRV7G3NLz0NYL1Xc2hsYM63Lpeb8easMZ+uEopIIAkK5eUs2qynS4cjIwkX8ox2XMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM3PR05CA0144.eurprd05.prod.outlook.com (2603:10a6:207:3::22) by AM0PR08MB5058.eurprd08.prod.outlook.com (2603:10a6:208:160::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 18:44:39 +0000 X-Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:3:cafe::12) by AM3PR05CA0144.outlook.office365.com (2603:10a6:207:3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:39 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Thu, 21 May 2020 18:44:39 +0000 X-Received: from localhost.localdomain (10.57.25.130) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 21 May 2020 18:44:38 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v2 3/6] ShellPkg/AcpiView: Move table count reset Date: Thu, 21 May 2020 19:44:18 +0100 Message-ID: <20200521184421.2222-4-Tomas.Pilar@arm.com> In-Reply-To: <20200521184421.2222-1-Tomas.Pilar@arm.com> References: <20200521184421.2222-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFTY:;SFS:(4636009)(346002)(396003)(376002)(39860400002)(136003)(46966005)(2616005)(6916009)(4326008)(2906002)(70586007)(8676002)(36756003)(81166007)(336012)(426003)(82310400002)(356005)(8936002)(70206006)(1076003)(47076004)(186003)(26005)(86362001)(82740400003)(316002)(6666004)(5660300002)(54906003)(478600001);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa2d397d-a34e-489e-cc8c-08d7fdb70916 X-MS-TrafficTypeDiagnostic: AM0PR08MB5058:|VI1PR08MB3021: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1107;OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: oH0Ba19/eMmtyHN9JJ+fhTmJ9CWVISIwzBIRwRZ895+JyIYqC0HsLJqtKsSGixrwgSjY8iAg8RX0R7kCmtG0PWdss+wJ7GfX1PQ2msrgOpWkUOdy6BUojHoTTj3BQt3lS0ulvffHQoIfqdTLlXI2EI74OnIcT7QU8fIUy9vNPF3MBmOAZOwlCYlA9wLjxdv+EGXb+sF8WHWnbKHsxJcIZR/d+HcedIry0SnbLr4lG04id7/5Tc+vfLBOcpiNYTHZasb+drgmMdx21qsdNdKMZ9yVAwsOTsyXkGlO1DK+voSg0Xk0svvkMmG3AUJN+IwWmD8XLJSeAfOuZyliIGix4xlW/obi8PqpmuEvFeNWivCvJ1Mj4Z7Lkq+7YhQFz4TbAFszTH+vOg/wqxUQKYR89g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5058 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT022.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 2f88412c-bdb5-48c3-4bb2-08d7fdb704bf X-Microsoft-Antispam-Message-Info: 1z0Q1kH85hhhAArA2oldk0y8LjtB/ayf6MyPE4dOo5T6xK/VPXQr3z+wZzNBwUHZ56PMfJMfgCBx/Y1GIuLXABFp2ksmlsQF88dxhrV4BjzCZ71AKzD6ODgg6zbce2y3KHW63bwu6uL0V6Kv1bdvHLkLdspYPg7lGbA5B4zIxGpX7KOLTQLp4h9FU2iMU+CjZBV+QcQD9X4i3zF99AiguFc/fqjDm50W5iWMr40wjrGm/Z8n+3G+qcicT/9pzvOWbFR47c/IUbB8+3Mfp2Uw+GvcRP3pvMpy4xqER0DR8PrQQz1QTC6C0HxloCVZ9AJ6u/2jwKaxtC7BmilroU2Ga/Krv5D6YmPApVMtF/VBIF2NLj9VLJT1JG/lF0hwLSwXy9fTnDhJ4uvlVsEQ3ez8rU4D8sHmrk3k3MKOzf0gikaw5tfg+IYY6HckcBfP72D0wtwfWOXwDkN15x00cokLHaTTpMY7YuC4OWlGGJHMOG79riHTnp2y3xybiCLjVgNx9ZdF96gk5/lWeiYXAwhp6w== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 18:44:46.8516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa2d397d-a34e-489e-cc8c-08d7fdb70916 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3021 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: NLrPI3RTyQeXN0InBUA8j1BLx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1590086691; bh=pJErsp/4WZqzFvf4zCI/RDQdHCbvBzixgNiXS1kVg3M=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=aLK/k3tLNkKauR3YK9zYkhdvIRSiwLBo/AFjvffEofU9OD9oneLSMNeOVvuPIJjEccN 6+f/axka99etOhuAQ5/1x2WldQfDedva/w0kNU/oNnCnheGK9gggVOpDVP42Sq3A8Ule8 Dsx1bKeChdIol35n07cOy75g9byWSjukJi0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The table count module level symbols are now reset when executing the core method, rather than the shell command wrapper. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar Reviewed-by: Zhichao Gao --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 2f7395c23bce..c9654e52c434 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -255,6 +255,10 @@ AcpiView ( EfiConfigurationTable =3D NULL; OriginalAttribute =3D 0; =20 + // Reset Table counts + mTableCount =3D 0; + mBinTableCount =3D 0; + // Reset The error/warning counters ResetErrorCount (); ResetWarningCount (); @@ -390,9 +394,7 @@ ShellCommandRunAcpiView ( CONST CHAR16* MandatoryTableSpecStr; CONST CHAR16 *SelectedTableName; =20 - // Set Defaults - mTableCount =3D 0; - mBinTableCount =3D 0; + // Set configuration defaults AcpiConfigSetDefaults (); =20 ShellStatus =3D SHELL_SUCCESS; --=20 2.24.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60061): https://edk2.groups.io/g/devel/message/60061 Mute This Topic: https://groups.io/mt/74382413/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 20:26:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60063+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1590086693570106.90062018018614; Thu, 21 May 2020 11:44:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id aNIDYY1788612xpyShefDFWi; Thu, 21 May 2020 11:44:53 -0700 X-Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.107.2.78]) by mx.groups.io with SMTP id smtpd.web12.1956.1590086691711325980 for ; Thu, 21 May 2020 11:44:52 -0700 X-Received: from MRXP264CA0023.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::35) by AM4PR08MB2675.eurprd08.prod.outlook.com (2603:10a6:205:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Thu, 21 May 2020 18:44:48 +0000 X-Received: from VE1EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:15:cafe::61) by MRXP264CA0023.outlook.office365.com (2603:10a6:500:15::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24 via Frontend Transport; Thu, 21 May 2020 18:44:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60063+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT013.mail.protection.outlook.com (10.152.19.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:47 +0000 X-Received: ("Tessian outbound b157666c5529:v57"); Thu, 21 May 2020 18:44:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8a5cd60275ef0e90 X-CR-MTA-TID: 64aa7808 X-Received: from 41f113760aea.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C0FD573B-6DE1-41D1-8B7A-0121F62B9EB4.1; Thu, 21 May 2020 18:44:41 +0000 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 41f113760aea.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 May 2020 18:44:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aeDder4RSmDP6biC1PMBewuS+rsfy823E6DqGsaNiwpAGjUZqGcJXtuMm8J8Mj+NcjgNTZPpaRxsaUBn7XkadsuFkbbjZfbVeyZslcysK0cxmkD9SlGidRXSHwieyEp98EWXr4L6WGWk7pPFHlEHsxwJ1PLe7yISNLQ8OuembhrtS2GEfhf7xHCfxWY6h1BqDGOp3bjmaR4exJecApvvqHQWjvtBZFZJo9rUM1vNczeDODADpx7XdO0uWxBEmvyw5xIOKYG0M+ZDBnWTDRrjflDhFsJMPWNVa9YfD71KN7QUJhN7k25jjUlARxeTB8oORcdj+3/N8vigQGwp+Lck0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fe9MnGBCYRQ2so5IBtQoC7kXWoRlSt7nDldHRT0O+z0=; b=Hq6jt2z4geKZoI4HKLDZSxg4rfeuTXLhB+b0zkLWs/22HvcPGHPbxNMgYXxNEVUAfGIz+ulCzTRG3eyiqYYkjJWM+fyxxg7OFfFzI83jgLnBDlUoXo/a8N/CG10Ge7gxSObAJXaBakvxI1fwEeTsU9z9mgFkhPx1JpBO0avIzA9RMcgUefvwapEyrt/o/ISOrcF1Op8sJdND6iMx9+lJDW/9XqTP0CRZ+XLmojcb706wp9KuiTqvN8TU5dh6MTZeEPwcSI2qba865kZobYxon483BVKA2PO84tq4uDBqHq0sylVB0p87fG7JxpzQykFuEvvieEdVzBIkJrMR0+u9GA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM3PR05CA0148.eurprd05.prod.outlook.com (2603:10a6:207:3::26) by DB7PR08MB3227.eurprd08.prod.outlook.com (2603:10a6:5:1f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 18:44:40 +0000 X-Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:3:cafe::ac) by AM3PR05CA0148.outlook.office365.com (2603:10a6:207:3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:40 +0000 X-Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1415.2; Thu, 21 May 2020 18:44:39 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1779.2; Thu, 21 May 2020 18:44:39 +0000 X-Received: from localhost.localdomain (10.57.25.130) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 21 May 2020 18:44:39 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v2 4/6] ShellPkg/AcpiView: Move parameter parsing Date: Thu, 21 May 2020 19:44:19 +0100 Message-ID: <20200521184421.2222-5-Tomas.Pilar@arm.com> In-Reply-To: <20200521184421.2222-1-Tomas.Pilar@arm.com> References: <20200521184421.2222-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFTY:;SFS:(4636009)(346002)(39860400002)(396003)(136003)(376002)(46966005)(8676002)(186003)(2906002)(26005)(6916009)(36756003)(54906003)(6666004)(1076003)(336012)(8936002)(30864003)(316002)(478600001)(4326008)(82740400003)(47076004)(5660300002)(70586007)(86362001)(70206006)(426003)(2616005)(81166007)(356005)(82310400002);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff910af6-5fa5-46b8-f61d-08d7fdb70974 X-MS-TrafficTypeDiagnostic: DB7PR08MB3227:|AM4PR08MB2675: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3044;OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: NlKBCBIMhtd5rXZNACEdVNozFMZW8HX6uu3O71hb2kHP4u/SHQNZLh5n6/IS8osfNa/bEuZOkkanXsBLNm6EZtbxuwsp5D5VJmORvSdoC35aspjvDBI+V4wPdzpgmJlUt024ypBwadtmEWhrA++x1ofe1Tp+15mfgpaemqXr2zSqIHCX384+qDD38v8H/Zj8UhMPc7c3WV2bjqDNSXYawY/uz7ycil0yBFZWFQ6b1V1Y6mKvOoTgoTqyckw6SmdZOgEbxxFMhFaE9QLbRC9P7HRF6PuWUxQENOMSwYH6jyuLlf0HsWKrIispDEKT1KdvpYxPRuuOfIwcvkLX7OzSFxeIrC4gWqja2cU6sBjhIDc32tP8zPuihUIe5rxnBnZmq0PN/ZeXf+g7jT12o3ECbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3227 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 2db2747b-2283-4542-31ec-08d7fdb70554 X-Microsoft-Antispam-Message-Info: ijdNwO6KDNN36WpnyAlgxaKZrltz9p5oPI9OwpeOkqkRZryNwMwV2Cc2u9URMIf1Y4VPCC5EbF6kNrIN6yFCCA4Y/2G4X6Cao1b4n+VclR1E7tETW4x3XOsoIDm1On7+cZLme4hiXWsaXx1ms0+DcA1VF0+RqE+vPom/bE7HUpeMpEJXuuM/+wk+qx1rsG71RhFm3VVEgv0CzOBwQSrVxOxwC1eWToS8bRP5cdFjqKrUt/yiW+oaS20T8D3BQMsAobNIWinDEANs03guJqRnjOJmhrSBBmDAcvQKrp/M7nsbdxSlsNF95adeVhSfL8jsOQx84edL25+O9kxXLEEGOhRb8aZlxzfoNMhLg1OCUom7Ma4Rd8jaRlZzHCfxRMRA367RHt/iz9cXkXN5H576XA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 18:44:47.4297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff910af6-5fa5-46b8-f61d-08d7fdb70974 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB2675 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: M4303c9jUczKSnt6Gyt5dHnmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1590086693; bh=sjfJQtJpeVFrntYmtzVi8CpR1vJVZVvktYtcu6x9ol0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=an4T6+skGWclP8xKXPaUQ5JZzGEMZIOfDnTeUDarw/doN4//SldYZ8/gBlz8tCEs8Sv gMoaUunc3m1dYdpl+EieW1buIP18KWY3Dli0gzqrv/f5McmhyxSNZUHjdl4MH/IyGkrly VxjxaFH3FhREtAFkQPhXK1OcKqihybqmyEo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Parsing command line parameters is done in the shell command wrapper. This declutters the core code and improves modular design. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar Reviewed-by: Zhichao Gao --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c = | 205 ----------------------------------------------------------------- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h = | 18 +++++- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c= | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h= | 10 +++- 4 files changed, 240 insertions(+), 211 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index c9654e52c434..a3160ed6f0a2 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -32,19 +32,6 @@ EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; STATIC UINT32 mTableCount; STATIC UINT32 mBinTableCount; =20 -/** - An array of acpiview command line parameters. -**/ -STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { - {L"-q", TypeFlag}, - {L"-d", TypeFlag}, - {L"-h", TypeFlag}, - {L"-l", TypeFlag}, - {L"-s", TypeValue}, - {L"-r", TypeValue}, - {NULL, TypeMax} -}; - /** This function dumps the ACPI table to a file. =20 @@ -228,7 +215,6 @@ ProcessTableReportOptions ( Returns EFI_UNSUPPORTED if the RSDP version is less than 2. Returns EFI_SUCCESS if successful. **/ -STATIC EFI_STATUS EFIAPI AcpiView ( @@ -372,194 +358,3 @@ AcpiView ( } return EFI_SUCCESS; } - -/** - Function for 'acpiview' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunAcpiView ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE* SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - LIST_ENTRY* Package; - CHAR16* ProblemParam; - SHELL_FILE_HANDLE TmpDumpFileHandle; - CONST CHAR16* MandatoryTableSpecStr; - CONST CHAR16 *SelectedTableName; - - // Set configuration defaults - AcpiConfigSetDefaults (); - - ShellStatus =3D SHELL_SUCCESS; - Package =3D NULL; - TmpDumpFileHandle =3D NULL; - - Status =3D ShellCommandLineParse (ParamList, &Package, &ProblemParam, TR= UE); - if (EFI_ERROR (Status)) { - if (Status =3D=3D EFI_VOLUME_CORRUPTED && ProblemParam !=3D NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM), - gShellAcpiViewHiiHandle, - L"acpiview", - ProblemParam - ); - FreePool (ProblemParam); - } else { - Print (L"acpiview: Error processing input parameter(s)\n"); - } - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandLineGetCount (Package) > 1) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_TOO_MANY), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-?")) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GET_HELP_ACPIVIEW), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - } else if (ShellCommandLineGetFlag (Package, L"-s") && - ShellCommandLineGetValue (Package, L"-s") =3D=3D NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_NO_VALUE), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-s" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-r") && - ShellCommandLineGetValue (Package, L"-r") =3D=3D NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_NO_VALUE), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-r" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else if ((ShellCommandLineGetFlag (Package, L"-s") && - ShellCommandLineGetFlag (Package, L"-l"))) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_TOO_MANY), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-d") && - !ShellCommandLineGetFlag (Package, L"-s")) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_MISSING_OPTION), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-s", - L"-d" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else { - // Turn on colour highlighting if requested - SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h")); - - // Surpress consistency checking if requested - SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q")); - - // Evaluate the parameters for mandatory ACPI table presence checks - SetMandatoryTableValidate (ShellCommandLineGetFlag (Package, L"-r")); - MandatoryTableSpecStr =3D ShellCommandLineGetValue (Package, L"-r"); - - if (MandatoryTableSpecStr !=3D NULL) { - SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr)); - } - - if (ShellCommandLineGetFlag (Package, L"-l")) { - SetReportOption (ReportTableList); - } else { - SelectedTableName =3D ShellCommandLineGetValue (Package, L"-s"); - if (SelectedTableName !=3D NULL) { - SelectAcpiTable (SelectedTableName); - SetReportOption (ReportSelected); - - if (ShellCommandLineGetFlag (Package, L"-d")) { - // Create a temporary file to check if the media is writable. - CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SetReportOption (ReportDumpBinFile); - - UnicodeSPrint ( - FileNameBuffer, - sizeof (FileNameBuffer), - L".\\%s%04d.tmp", - SelectedTableName, - mBinTableCount - ); - - Status =3D ShellOpenFileByName ( - FileNameBuffer, - &TmpDumpFileHandle, - EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | - EFI_FILE_MODE_CREATE, - 0 - ); - - if (EFI_ERROR (Status)) { - ShellStatus =3D SHELL_INVALID_PARAMETER; - TmpDumpFileHandle =3D NULL; - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_READONLY_MEDIA), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - goto Done; - } - // Delete Temporary file. - ShellDeleteFile (&TmpDumpFileHandle); - } // -d - } // -s - } - - // Parse ACPI Table information - Status =3D AcpiView (SystemTable); - if (EFI_ERROR (Status)) { - ShellStatus =3D SHELL_NOT_FOUND; - } - } - } - -Done: - if (Package !=3D NULL) { - ShellCommandLineFreeVarList (Package); - } - return ShellStatus; -} diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index 92d64a88814d..d5b95f5ee707 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -64,7 +64,7 @@ GetWarningCount ( =20 @param [in] Signature The ACPI table Signature. @param [in] TablePtr Pointer to the ACPI table data. - @param [in] Length The length fo the ACPI table. + @param [in] Length The length of the ACPI table. =20 @retval Returns TRUE if the ACPI table should be traced. **/ @@ -75,4 +75,20 @@ ProcessTableReportOptions ( IN CONST UINT32 Length ); =20 +/** + This function iterates the configuration table entries in the + system table, retrieves the RSDP pointer and starts parsing the ACPI tab= les. + + @param [in] SystemTable Pointer to the EFI system table. + + @retval EFI_NOT_FOUND The RSDP pointer was not found. + @retval EFI_UNSUPPORTED The RSDP version was less than 2. + @retval EFI_SUCCESS The command was successful. +**/ +EFI_STATUS +EFIAPI +AcpiView ( + IN EFI_SYSTEM_TABLE* SystemTable + ); + #endif // ACPIVIEW_H_ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index e0d5a8108552..c3942ad24e5b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -1,24 +1,44 @@ /** @file Main file for 'acpiview' Shell command function. =20 - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 #include #include + +#include #include +#include +#include #include -#include +#include #include +#include #include + #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" #include "UefiShellAcpiViewCommandLib.h" =20 CONST CHAR16 gShellAcpiViewFileName[] =3D L"ShellCommand"; =20 +/** + An array of acpiview command line parameters. +**/ +STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { + {L"-q", TypeFlag}, + {L"-d", TypeFlag}, + {L"-h", TypeFlag}, + {L"-l", TypeFlag}, + {L"-s", TypeValue}, + {L"-r", TypeValue}, + {NULL, TypeMax} +}; + /** A list of available table parsers. */ @@ -92,6 +112,200 @@ ShellCommandGetManFileNameAcpiView ( return gShellAcpiViewFileName; } =20 +/** + Function for 'acpiview' command. + + @param[in] ImageHandle Handle to the Image (NULL if internal). + @param[in] SystemTable Pointer to the System Table (NULL if internal). + + @retval SHELL_INVALID_PARAMETER The command line invocation could not be= parsed + @retval SHELL_NOT_FOUND The command failed + @retval SHELL_SUCCESS The command was successful +**/ +SHELL_STATUS +EFIAPI +ShellCommandRunAcpiView ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE* SystemTable + ) +{ + EFI_STATUS Status; + SHELL_STATUS ShellStatus; + LIST_ENTRY* Package; + CHAR16* ProblemParam; + SHELL_FILE_HANDLE TmpDumpFileHandle; + CONST CHAR16* MandatoryTableSpecStr; + CONST CHAR16* SelectedTableName; + + // Set configuration defaults + AcpiConfigSetDefaults (); + + ShellStatus =3D SHELL_SUCCESS; + Package =3D NULL; + TmpDumpFileHandle =3D NULL; + + Status =3D ShellCommandLineParse (ParamList, &Package, &ProblemParam, TR= UE); + if (EFI_ERROR (Status)) { + if (Status =3D=3D EFI_VOLUME_CORRUPTED && ProblemParam !=3D NULL) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_PROBLEM), + gShellAcpiViewHiiHandle, + L"acpiview", + ProblemParam + ); + FreePool (ProblemParam); + } else { + Print (L"acpiview: Error processing input parameter(s)\n"); + } + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else { + if (ShellCommandLineGetCount (Package) > 1) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_TOO_MANY), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if (ShellCommandLineGetFlag (Package, L"-?")) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GET_HELP_ACPIVIEW), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + } else if (ShellCommandLineGetFlag (Package, L"-s") && + ShellCommandLineGetValue (Package, L"-s") =3D=3D NULL) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_NO_VALUE), + gShellAcpiViewHiiHandle, + L"acpiview", + L"-s" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if (ShellCommandLineGetFlag (Package, L"-r") && + ShellCommandLineGetValue (Package, L"-r") =3D=3D NULL) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_NO_VALUE), + gShellAcpiViewHiiHandle, + L"acpiview", + L"-r" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if ((ShellCommandLineGetFlag (Package, L"-s") && + ShellCommandLineGetFlag (Package, L"-l"))) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_TOO_MANY), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if (ShellCommandLineGetFlag (Package, L"-d") && + !ShellCommandLineGetFlag (Package, L"-s")) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_MISSING_OPTION), + gShellAcpiViewHiiHandle, + L"acpiview", + L"-s", + L"-d" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else { + // Turn on colour highlighting if requested + SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h")); + + // Surpress consistency checking if requested + SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q")); + + // Evaluate the parameters for mandatory ACPI table presence checks + SetMandatoryTableValidate (ShellCommandLineGetFlag (Package, L"-r")); + MandatoryTableSpecStr =3D ShellCommandLineGetValue (Package, L"-r"); + + if (MandatoryTableSpecStr !=3D NULL) { + SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr)); + } + + if (ShellCommandLineGetFlag (Package, L"-l")) { + SetReportOption (ReportTableList); + } else { + SelectedTableName =3D ShellCommandLineGetValue (Package, L"-s"); + if (SelectedTableName !=3D NULL) { + SelectAcpiTable (SelectedTableName); + SetReportOption (ReportSelected); + + if (ShellCommandLineGetFlag (Package, L"-d")) { + // Create a temporary file to check if the media is writable. + CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; + SetReportOption (ReportDumpBinFile); + + UnicodeSPrint ( + FileNameBuffer, + sizeof (FileNameBuffer), + L".\\%s0000.tmp", + SelectedTableName + ); + + Status =3D ShellOpenFileByName ( + FileNameBuffer, + &TmpDumpFileHandle, + EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | + EFI_FILE_MODE_CREATE, + 0 + ); + + if (EFI_ERROR (Status)) { + ShellStatus =3D SHELL_INVALID_PARAMETER; + TmpDumpFileHandle =3D NULL; + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_READONLY_MEDIA), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + goto Done; + } + // Delete Temporary file. + ShellDeleteFile (&TmpDumpFileHandle); + } // -d + } // -s + } + + // Parse ACPI Table information + Status =3D AcpiView (SystemTable); + if (EFI_ERROR (Status)) { + ShellStatus =3D SHELL_NOT_FOUND; + } + } + } + +Done: + if (Package !=3D NULL) { + ShellCommandLineFreeVarList (Package); + } + return ShellStatus; +} + /** Constructor for the Shell AcpiView Command library. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.h index c1cf7a57af7a..a3a29164004d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h @@ -1,7 +1,7 @@ /** @file Header file for 'acpiview' Shell command functions. =20 - Copyright (c) 2016 - 2017, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -13,8 +13,12 @@ extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; /** Function for 'acpiview' command. =20 - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). + @param[in] ImageHandle Handle to the Image (NULL if internal). + @param[in] SystemTable Pointer to the System Table (NULL if internal). + + @retval SHELL_INVALID_PARAMETER The command line invocation could not be= parsed + @retval SHELL_NOT_FOUND The command failed + @retval SHELL_SUCCESS The command was successful **/ SHELL_STATUS EFIAPI --=20 2.24.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60063): https://edk2.groups.io/g/devel/message/60063 Mute This Topic: https://groups.io/mt/74382415/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 20:26:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60064+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1590086697707198.70747118098927; Thu, 21 May 2020 11:44:57 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id XiaPYY1788612x1UHKDm2M7G; Thu, 21 May 2020 11:44:57 -0700 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.76]) by mx.groups.io with SMTP id smtpd.web10.1868.1590086696223118874 for ; Thu, 21 May 2020 11:44:56 -0700 X-Received: from MR2P264CA0120.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:33::36) by VI1PR08MB3183.eurprd08.prod.outlook.com (2603:10a6:803:47::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.26; Thu, 21 May 2020 18:44:52 +0000 X-Received: from VE1EUR03FT019.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:33:cafe::9d) by MR2P264CA0120.outlook.office365.com (2603:10a6:500:33::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27 via Frontend Transport; Thu, 21 May 2020 18:44:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60064+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT019.mail.protection.outlook.com (10.152.18.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:52 +0000 X-Received: ("Tessian outbound 952576a3272a:v57"); Thu, 21 May 2020 18:44:52 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4c49eb7882b58d66 X-CR-MTA-TID: 64aa7808 X-Received: from 0e67d6aac01d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 04C119B7-50C1-4803-879A-C697A546D80F.1; Thu, 21 May 2020 18:44:46 +0000 X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0e67d6aac01d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 May 2020 18:44:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QuFewtoi3Fo/C08sC+Zi85DEsse2EG8R2Lhfc9zHXDWfbTajYK+dRFrzX87ZDk8chjoPh99/FzORyH/u6nqOeGsULSlnWfrzTTZpqhfdEiCYmFWra3/Ky2z3a/6tSJpg6apErpITKK+0MRxzMTKTTNAgOXsu+khcHd7bCTHfBqeQljy7OpVtJmJrhHUmR+LRljgEpMvPzCE/WbnYlyZvRtd+3iNc3oDuiSqbNumaui5BigVn+leUngqscAdIub0tQiMuuDoM3kSF56fKBvZJr7OuZlv14tVBw1VR8JiM3KI+QsCKWCD9b2HTlRfIYKZOeo1Tkqoiqhwbzda2z0tH+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v/pAtIlC74SckcZc9mc6zSB+vQG7h0e+j0ViZMtymW0=; b=CGMNiFPno7lLK+SNoOWnOc/HBK0iRFanMK/Y5uhT3s3r8tsDM9fg9iUGQI6Yv5mUvVMgexCxojCBWE5UvyO9UfqlhZUIwSH/4JkIpIbR6x5lbMMgsJ5zjDs/nz9RvWp3N0Tqsn1pzC5wQwQme2SqiE1rgql9EonmHB0Hxmhoy7rClOAUx/+vH0BefMSA8FcchwbVvQkZIk+DnedphjJdRA2ljmmqubG6VfjglH2gZxfBWuG5dKXnPEwOk6uWpnU3QiUN/z9OfRa3WQ4gqg5Pl241ctAoRi8LqNinvwSEHpaYnFNB8eAi2CNLd38jj0vWajOMhFwYhWox7zKDrfeKNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM3PR05CA0154.eurprd05.prod.outlook.com (2603:10a6:207:3::32) by DB6PR08MB2791.eurprd08.prod.outlook.com (2603:10a6:6:17::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 18:44:41 +0000 X-Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:3:cafe::3e) by AM3PR05CA0154.outlook.office365.com (2603:10a6:207:3::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:41 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Thu, 21 May 2020 18:44:39 +0000 X-Received: from localhost.localdomain (10.57.25.130) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 21 May 2020 18:44:39 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v2 5/6] ShellPkg/AcpiView: Refactor DumpAcpiTableToFile Date: Thu, 21 May 2020 19:44:20 +0100 Message-ID: <20200521184421.2222-6-Tomas.Pilar@arm.com> In-Reply-To: <20200521184421.2222-1-Tomas.Pilar@arm.com> References: <20200521184421.2222-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFTY:;SFS:(6029001)(4636009)(346002)(39860400002)(396003)(136003)(376002)(46966005)(8676002)(186003)(26005)(2906002)(1076003)(6916009)(336012)(36756003)(54906003)(6666004)(8936002)(316002)(478600001)(4326008)(82740400003)(47076004)(5660300002)(70586007)(86362001)(70206006)(426003)(2616005)(356005)(82310400002)(81166007);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb07b15e-1701-48e0-4549-08d7fdb70c42 X-MS-TrafficTypeDiagnostic: DB6PR08MB2791:|VI1PR08MB3183: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: JSNtKf8HuaI5DC3GA7ImF8jXgdPNsb5IPa0RqBmIyGPfNYgaoKOsammV/T4YetqWsyvta4qW2haIoN3nUHipdxNutecYkW6rz9NPh7gCeNm1RI17JWbVE00PgewbzR1Kmova/hV9qKWkZZL6Nq6pH+fKAIOfQmxCHuq8RawtvRgV5VEoDDaScvO1xRQy63OfXh7PkRHRcf5N/7jbMAri7ne8OPc/pWXEGOAl46DVqfXN8mVLW/71wjj60LlWaO6jexTbQtN4BZsqrsEjZx3sHgJd3rHGt6x9IYXQHvMMNZhIThMbZx5QwjVsBrZ41cRhy9dhmnaPxJSFpp8a3nvMy3VBvz6cTNRJAqU5Gmlsk0/9CYjE4YQGsoWKHl8n8TmQnASy8JkLbVvZxLDSMiVBCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2791 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT019.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: a2221bf6-03ff-4eaf-b5a1-08d7fdb70594 X-Microsoft-Antispam-Message-Info: uaL0qNgchjvfGI7LWzbqeVSzbZxtjeKuunwsFY3nf/0ug7yTUfNoeQmkuh/E/1G1XIwsTYZD6sIq9E1PRxG+KGjVpl+DI/zGYjH16klcHBG0tVweqnteu7humTTdj7VPuK9xDbD7FYs0Oqy9Q51q+AyEhJa/AqlKNSNieo1AaDKrcRArfiBv/xWMZBlL8qcH7OBLlkGnXvn+SiYEymb8+jwyKZxBrxlDg3r3bEmEpWc3ljFtyEh+nlZfQIHHmdqmQwWzQWwtyCqN93Rdz1AlEWbmFPRwJLB91flcaPLEI1a8QR0MCAp8bt5NbQucj6XxB30KJZ2Hk8YIgJ5UiPKL4p9s0HrE6gQ7wQZD5KbpEhL0P3aIY8mZkMt53U166pYSEgJqYEkzup/isl73nE3J/6XJmkSzNP3O0QEyqUcEvrLnVdSixKuoNDLBENKtB5Ahl3dp0ivuS4hxQl31Lv7KpDFqZGRN51kEwJxZnFYV7ePZi0r+rI8icQLvkngaqS0uvHYHuYq7ESxtKEpqV4WX2w== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 18:44:52.1688 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb07b15e-1701-48e0-4549-08d7fdb70c42 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3183 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: KDGM9vitSMqqefM5RBkntRtax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1590086697; bh=sUvFjEB5P7YBnvEwtaIg5sCVuruGUG3h9XefAZ7l9NU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Ty2W8+m137vzs3/hSE9sSgJvRWhb7h/lbnhCQRD9fBG39lw81ZG9rARoXU8PUvdvLmU hwb4xrUNmchIi2cabgOKdlsf5UnPqLTIfSCZOsseqz64CH4WFOTDptmPX1S/kMpQQsu8c MN7znf2lA87TGv0JmEhluy4OjlAVgyEVf8o= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Method is refactored into two parts. A new method is created that dumps arbitrary buffers into a newly created file. This method is called from core code after the core code determined the appropriate filename to be used. This improves the modular design. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c = | 35 +---------------------------------- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c= | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h= | 17 +++++++++++++++++ 3 files changed, 76 insertions(+), 34 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index a3160ed6f0a2..e866b84c6844 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -48,13 +48,10 @@ DumpAcpiTableToFile ( IN CONST UINTN Length ) { - EFI_STATUS Status; CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SHELL_FILE_HANDLE DumpFileHandle; UINTN TransferBytes; SELECTED_ACPI_TABLE SelectedTable; =20 - DumpFileHandle =3D NULL; TransferBytes =3D Length; GetSelectedAcpiTable (&SelectedTable); =20 @@ -66,39 +63,9 @@ DumpAcpiTableToFile ( mBinTableCount++ ); =20 - Status =3D ShellOpenFileByName ( - FileNameBuffer, - &DumpFileHandle, - EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREA= TE, - 0 - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_READONLY_MEDIA), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - return FALSE; - } - Print (L"Dumping ACPI table to : %s ... ", FileNameBuffer); =20 - Status =3D ShellWriteFile ( - DumpFileHandle, - &TransferBytes, - (VOID*)Ptr - ); - if (EFI_ERROR (Status)) { - Print (L"ERROR: Failed to dump table to binary file.\n"); - TransferBytes =3D 0; - } else { - Print (L"DONE.\n"); - } - - ShellCloseFile (&DumpFileHandle); + TransferBytes =3D DumpFile (FileNameBuffer, Ptr, Length); return (Length =3D=3D TransferBytes); } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index c3942ad24e5b..adf3cce6cfe2 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -98,6 +98,64 @@ RegisterAllParsers ( return Status; } =20 +/** + Dump a buffer to a file + + @param[in] FileName The filename that shall be created to contain the = buffer + @param[in] Buffer Pointer to buffer that shall be dumped + @param[in] BufferSize The size of buffer to be dumped in bytes + + @return The number of bytes that were written +**/ +UINTN +EFIAPI +DumpFile ( + IN CONST CHAR16* FileNameBuffer, + IN CONST VOID* Buffer, + IN CONST UINTN BufferSize + ) +{ + EFI_STATUS Status; + SHELL_FILE_HANDLE DumpFileHandle; + UINTN TransferBytes; + + Status =3D ShellOpenFileByName ( + FileNameBuffer, + &DumpFileHandle, + EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREA= TE, + 0 + ); + + if (EFI_ERROR (Status)) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_READONLY_MEDIA), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + return 0; + } + + TransferBytes =3D BufferSize; + Status =3D ShellWriteFile ( + DumpFileHandle, + &TransferBytes, + (VOID *) Buffer + ); + + if (EFI_ERROR (Status)) { + Print (L"ERROR: Failed to write binary file.\n"); + TransferBytes =3D 0; + } else { + Print (L"DONE.\n"); + } + + ShellCloseFile (&DumpFileHandle); + return TransferBytes; +} + /** Return the file name of the help text file if not using HII. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.h index a3a29164004d..9dd39cf4b3f0 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h @@ -10,6 +10,23 @@ =20 extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; =20 +/** + Dump a buffer to a file + + @param[in] FileName The filename that shall be created to contain the = buffer + @param[in] Buffer Pointer to buffer that shall be dumped + @param[in] BufferSize The size of buffer to be dumped in bytes + + @return The number of bytes that were written +**/ +UINTN +EFIAPI +DumpFile ( + IN CONST CHAR16* FileNameBuffer, + IN CONST VOID* Buffer, + IN CONST UINTN BufferSize + ); + /** Function for 'acpiview' command. =20 --=20 2.24.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60064): https://edk2.groups.io/g/devel/message/60064 Mute This Topic: https://groups.io/mt/74382417/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 20:26:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60065+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15900871778982.1666250025948557; Thu, 21 May 2020 11:52:57 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GCjEYY1788612xFq58r5tyIJ; Thu, 21 May 2020 11:52:57 -0700 X-Received: from EUR01-HE1-obe.outbound.protection.outlook.com (EUR01-HE1-obe.outbound.protection.outlook.com [40.107.13.45]) by mx.groups.io with SMTP id smtpd.web10.1869.1590086696850385080 for ; Thu, 21 May 2020 11:44:57 -0700 X-Received: from MRXP264CA0005.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:15::17) by VI1PR08MB3679.eurprd08.prod.outlook.com (2603:10a6:803:85::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23; Thu, 21 May 2020 18:44:52 +0000 X-Received: from VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:15:cafe::e1) by MRXP264CA0005.outlook.office365.com (2603:10a6:500:15::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60065+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT021.mail.protection.outlook.com (10.152.18.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:52 +0000 X-Received: ("Tessian outbound facc38080784:v57"); Thu, 21 May 2020 18:44:52 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1011952b7ab1a404 X-CR-MTA-TID: 64aa7808 X-Received: from 0708b08cb58a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2AB6AA8F-4697-4A8F-80A9-AC703234CED4.1; Thu, 21 May 2020 18:44:47 +0000 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0708b08cb58a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 May 2020 18:44:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RhAji4sptit1GaY/8x63TdSYTQu6hUL2Uw4BliPGoSoEuA/FBY5BscbK36VI+x7Vp3cYSpq9xAZ4/qIxUwCrMNSUw7sOZoTbjW+PTTd4f+9FsKbXnUWbcVYnrXHxuAxBbyFJaBZUo/Q0wDDfBjLTzOpderOIn09M9xjt3gTlh5D7HTvcI99ZuKC9TJZLsNIgONQB+10ivS8q5Efn+srZmNBsns/CW+u8De/qWsPT8gzFbPMthaFOEOoGEMgyoSwGxmr/e78bpBF7+s551wuiHXFnAw60TS4mVPLyCr8iu5IgZ+4QQO4mJJkFPJhwikuZ+r7LrM2zrDxgH0eRAcL75A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tautk+VPoX1HpLhkD1NDHdoM1pEonD8Ho+IdR7Kf4As=; b=BFNEaFKuDcxb09SaQOtqL4xWt0fW2Izg5Pb5MFuEhG/itkuXVsGo78k39TUgk0jFsrNDzr1tBnIWC8HHKv7TWIHBmeueGcQTEg4/QGrBfqlzQ0Eal1cHpWFdqHWlXv2Jr79PIlXHzx7LwQfMfYbTN+eG/8cNm1mFxm781Iur71+TZ1EAq5RdUYZYqajqo0w1kYmqjb7jNjktvHvXafQiIE8kGYUtCL3KYrOeJz3gUuAS2KPZO+ofWdAWic4YEtzfy0yzU57mEWNE6GloGJIvI0zX7r0tjF9N0Gm6kCoMLIMe/ay23KvT7iVzEsBPLULUCzjNSrrHxJYVbGXfkj4X7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM3PR05CA0155.eurprd05.prod.outlook.com (2603:10a6:207:3::33) by AM5PR0802MB2404.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Thu, 21 May 2020 18:44:46 +0000 X-Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:3:cafe::3c) by AM3PR05CA0155.outlook.office365.com (2603:10a6:207:3::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3021.23 via Frontend Transport; Thu, 21 May 2020 18:44:45 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Thu, 21 May 2020 18:44:40 +0000 X-Received: from localhost.localdomain (10.57.25.130) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 21 May 2020 18:44:40 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v2 6/6] ShellPkg/AcpiView: Add application wrapper Date: Thu, 21 May 2020 19:44:21 +0100 Message-ID: <20200521184421.2222-7-Tomas.Pilar@arm.com> In-Reply-To: <20200521184421.2222-1-Tomas.Pilar@arm.com> References: <20200521184421.2222-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFTY:;SFS:(4636009)(346002)(136003)(376002)(396003)(39860400002)(46966005)(8936002)(54906003)(316002)(2906002)(70206006)(36756003)(70586007)(8676002)(336012)(86362001)(2616005)(426003)(6916009)(4326008)(26005)(478600001)(81166007)(6666004)(1076003)(356005)(82740400003)(47076004)(82310400002)(5660300002)(186003);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 475dde50-b99a-4265-2132-08d7fdb70c73 X-MS-TrafficTypeDiagnostic: AM5PR0802MB2404:|VI1PR08MB3679: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2887;OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: J4XT3bIKT4vhtLODZSjTHDtPbyaJbkI1TuLPe0a2CHmovd6Rx5K034hfFf8BkfNHs2fxoGohbnIg3+Np2zHu5n/mMyWv97n54LpBqFAr+UN0Dyo1XSMjjng0Akdtf6VXpIfLtQAL3+WYCkZHlTlfWdr9iMZUHq2xieagEyuuJH3nfbMgDMELQiwlzo2j4mKz8BVKgmwnQmz1B34vP3boM0i9fk/FBBPVkTgq/UVoZz0mi1Qtbnte8iT+OSeGDB/hPZH/wN0JZALaemGYCKXfHPblKkCCu+LY3lQHIZF3Br1NcbRSa7VCRf6k2tn07Q26qHvS3KAnHNhqiv1fBunQPlL4nasuV98I4JNTWc7RxhmDn162kQwSWfBHaLRjMx6ruE7M6qQXCsZhK/1pjm5TYM0If/FI9/hE/cwybCZGkW5E7LcJwYDisyVgvgN+7IjysFOb8w4AeTZ/+8UDOUoqk7qt4+0Gj7jjxqehRlIXBGU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2404 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 34a4470a-ed20-4365-8416-08d7fdb70875 X-Microsoft-Antispam-Message-Info: vbSLMULhk8Cb34b43F7yJDz6QIGl2BeMrusEkrNjM9L03nB0W8UZnb4Jg3p3Ipm9Vav5za3056YRIUqnYEE6kvpVR5Htxb9xoV46jWPEVn3+2NAOYYROycJk3j9serjnj/e3Pi36kpKwD5NQEfgyi+7dLypmhtRi0xJsdkuCllMX3s62OhUKjFisckiShqzsCzMcFfgwiONBmQK/kD9vw7Dy5H+hzlqXgmijDodKStfeF6oQ279vFHovHNQIJaeMuMGv/9LrpJ6SrRWs9WHO2/oWxFiEN4Pr4QHbY9OhXZGitfyQuI3xu1dbji3mxRh9CxlWoWBch1t6UexpQNBBxHtxV785gxzbXbAE+Kju6WfOAmbcA2faUKHqXlGYBwvx4APoWgenWPsxgiz8snhNrDIYRFcgGeUPKUr2wRvdL8+Venb8Ho7CJC6AH9S+KQUMQxY4HUtj19rh3jedHg8JS359zvRKH99I5Nf2Xsb4as0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2020 18:44:52.4549 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 475dde50-b99a-4265-2132-08d7fdb70c73 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3679 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: 5munoJG29k8Ff35hklugo8t6x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1590087177; bh=hQB4yL4LJL25aIF/tMAtAh2drvvMhdiJc82a6UrVqto=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=VzbpfRMHO6kcWExjsU82s/Z37/5cKrDtxdgtB5R0Z6FT2RwjZPSNF8MyrxQq/gdLKH/ YiF2r2TtNCC0Qd/l5Q5ZaP9D3kx2tY2ok/n5BNB6KQjVKBf0XHaR5xfRhRNQvSf91Tltx /HyXjkkYElBro9pJ2s+O3YmgMZPQ5AiwaHw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Simple application wrapper that invokes the shell command wrapper for acpiview. This allows the AcpiView functionality to be used on platforms with older specifications of the UEFI shell or where the 'acpiview' command is not built in due to platform build configuration. Furthermore, this app can be integrated into more comprehensive testing frameworks as a single component of a more thorough specification compliance validation strategy. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar --- ShellPkg/Application/AcpiViewApp/AcpiViewApp.c | 189 +++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++ ShellPkg/Application/AcpiViewApp/AcpiViewApp.inf | 31 ++++++++++++ ShellPkg/ShellPkg.dsc | 6 ++- 3 files changed, 225 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Application/AcpiViewApp/AcpiViewApp.c b/ShellPkg/Appl= ication/AcpiViewApp/AcpiViewApp.c new file mode 100644 index 000000000000..f83111629c21 --- /dev/null +++ b/ShellPkg/Application/AcpiViewApp/AcpiViewApp.c @@ -0,0 +1,189 @@ +/** @file + Main file for AcpiViewApp application + + Copyright (c) 2020, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include + +#include + +/** + Execute the AcpiView command from UefiShellAcpiViewCommandLib. + This function is pulled in directly from the library source. +**/ +SHELL_STATUS +EFIAPI +ShellCommandRunAcpiView ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE* SystemTable + ); + +CHAR16 mAcpiViewAppHelp[] =3D + u"\r\n" + "Display ACPI Table information.\r\n" + "\r\n" + "AcpiViewApp.efi [[-?] | [[-l] | [-s AcpiTable [-d]]] [-q] [-h]]\r\n" + " \r\n" + " -l - Display list of installed ACPI Tables.\r\n" + " -s - Display only the specified AcpiTable type and only support singl= e\r\n" + " invocation option.\r\n" + " AcpiTable : The required ACPI Table type.\r\n" + " -d - Generate a binary file dump of the specified AcpiTable.\r\n" + " -q - Quiet. Suppress errors and warnings. Disables consistency checks= .\r\n" + " -h - Enable colour highlighting.\r\n" + " -? - Show help.\r\n" + " \r\n" + " This program is provided to allow examination of ACPI table values fr= om " + "the\r\n" + " UEFI Shell. This can help with investigations, especially at that " + "stage\r\n" + " where the tables are not enabling an OS to boot.\r\n" + " The program is not exhaustive, and only encapsulates detailed knowled= ge " + "of a\r\n" + " limited number of table types.\r\n" + " \r\n" + " Default behaviour is to display the content of all tables installed.\= r\n" + " 'Known' table types (listed in NOTES below) will be parsed and " + "displayed\r\n" + " with descriptions and field values. Where appropriate a degree of\r\n" + " consistency checking is done and errors may be reported in the output= .\r\n" + " Other table types will be displayed as an array of Hexadecimal bytes.= \r\n" + " \r\n" + " To facilitate debugging, the -s and -d options can be used to generat= e " + "a\r\n" + " binary file image of a table that can be copied elsewhere for " + "investigation\r\n" + " using tools such as those provided by acpica.org. This is especially\= r\n" + " relevant for AML type tables like DSDT and SSDT.\r\n" + " \r\n" + "NOTES:\r\n" + " 1. The AcpiTable parameter can match any installed table type.\r\n" + " Tables without specific handling will be displayed as a raw hex du= mp " + "(or\r\n" + " dumped to a file if -d is used).\r\n" + " 2. -s option supports to display the specified AcpiTable type that is= " + "present\r\n" + " in the system. For normal type AcpiTable, it would display the dat= a of " + "the\r\n" + " AcpiTable and AcpiTable header. The following type may contain hea= der " + "type\r\n" + " other than AcpiTable header. The actual header can refer to the AC= PI " + "spec\r\n" + " 6.3\r\n" + " Extra A. Particular types:\r\n" + " APIC - Multiple APIC Description Table (MADT)\r\n" + " BGRT - Boot Graphics Resource Table\r\n" + " DBG2 - Debug Port Table 2\r\n" + " DSDT - Differentiated System Description Table\r\n" + " FACP - Fixed ACPI Description Table (FADT)\r\n" + " GTDT - Generic Timer Description Table\r\n" + " IORT - IO Remapping Table\r\n" + " MCFG - Memory Mapped Config Space Base Address Description Tabl= e\r\n" + " PPTT - Processor Properties Topology Table\r\n" + " RSDP - Root System Description Pointer\r\n" + " SLIT - System Locality Information Table\r\n" + " SPCR - Serial Port Console Redirection Table\r\n" + " SRAT - System Resource Affinity Table\r\n" + " SSDT - Secondary SystemDescription Table\r\n" + " XSDT - Extended System Description Table\r\n" + " \r\n" + " Table details correspond to those in 'Advanced Configuration and Powe= r\r\n" + " Interface Specification' Version 6.3 [January 2019]\r\n" + " (https://uefi.org/specifications)\r\n" + " " + " \r\n" + " NOTE: The nature of the ACPI standard means that almost all tables in= " + "6.1\r\n" + " will be 'backwards compatible' with prior version of the " + "specification\r\n" + " in terms of structure, so formatted output should be correct. T= he " + "main\r\n" + " exception will be that previously 'reserved' fields will be " + "reported\r\n" + " with new names, where they have been added in later versions of= " + "the\r\n" + " specification.\r\n" + " \r\n" + " \r\n" + "EXAMPLES:\r\n" + " * To display a list of the installed table types:\r\n" + " fs0:\\> AcpiViewApp.efi -l\r\n" + " \r\n" + " * To parse and display a specific table type:\r\n" + " fs0:\\> AcpiViewApp.efi -s GTDT\r\n" + " \r\n" + " * To save a binary dump of the contents of a table to a file\r\n" + " in the current working directory:\r\n" + " fs0:\\> AcpiViewApp.efi -s DSDT -d\r\n" + " \r\n" + " * To display contents of all ACPI tables:\r\n" + " fs0:\\> AcpiViewApp.efi\r\n" + " \r\n"; + +/** + Determine if the user wants to display by checking for presence + of '/?' or '--help' on command line. We cannot override '-?' shell + command line handling. + + @retval EFI_SUCCESS No help was printed + @retval EFI_INVALID_PARAMETER Help was printed +**/ +STATIC +EFI_STATUS +CheckForHelpRequest ( + EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters; + UINTN Index; + + Status =3D gBS->HandleProtocol ( + ImageHandle,=20 + &gEfiShellParametersProtocolGuid, + (VOID **)&ShellParameters + ); + if (EFI_ERROR(Status)) { + return Status; + } + + for (Index =3D 1; Index < ShellParameters->Argc; Index++) { + if ((StrCmp (ShellParameters->Argv[Index], L"/?") =3D=3D 0) || + (StrCmp (ShellParameters->Argv[Index], L"--help") =3D=3D 0)) { + Print (mAcpiViewAppHelp); + return EFI_INVALID_PARAMETER; + } + } + + return EFI_SUCCESS; +} + + +/** + Application Entry Point wrapper around the shell command + + @param[in] ImageHandle Handle to the Image (NULL if internal). + @param[in] SystemTable Pointer to the System Table (NULL if internal). +**/ +EFI_STATUS +EFIAPI +AcpiViewAppMain ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D CheckForHelpRequest (ImageHandle); + + // Do not run code if help was printed + if (Status !=3D EFI_INVALID_PARAMETER) { + Status =3D ShellCommandRunAcpiView (gImageHandle, SystemTable); + } + + return Status; +} diff --git a/ShellPkg/Application/AcpiViewApp/AcpiViewApp.inf b/ShellPkg/Ap= plication/AcpiViewApp/AcpiViewApp.inf new file mode 100644 index 000000000000..28e724fa1909 --- /dev/null +++ b/ShellPkg/Application/AcpiViewApp/AcpiViewApp.inf @@ -0,0 +1,31 @@ +## @file +# EFI application that displays and verifies ACPI tables +# +# Copyright (c) 2020, ARM Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D AcpiViewApp + FILE_GUID =3D 46361B5B-AF17-41FF-95F9-E1BCE08435B9 + MODULE_TYPE =3D UEFI_APPLICATION + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D AcpiViewAppMain + +[Sources.common] + AcpiViewApp.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + ShellPkg/ShellPkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiLib + BaseLib + UefiApplicationEntryPoint diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc index b7ee856b3a16..1ed82ee7aca3 100644 --- a/ShellPkg/ShellPkg.dsc +++ b/ShellPkg/ShellPkg.dsc @@ -2,7 +2,7 @@ # Shell Package # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
-# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2018 - 2020, Arm Limited. All rights reserved.
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All right= s reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -143,6 +143,10 @@ [Components] gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE } ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf + ShellPkg/Application/AcpiViewApp/AcpiViewApp.inf { + + NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewC= ommandLib.inf + } =20 [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES --=20 2.24.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60065): https://edk2.groups.io/g/devel/message/60065 Mute This Topic: https://groups.io/mt/74382419/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-