From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=zCtKIGPM; spf=pass (domain: arm.com, ip: 40.107.6.82, mailfrom: krzysztof.koch@arm.com) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.82]) by groups.io with SMTP; Thu, 18 Jul 2019 03:05:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y/tkr8eMCWfuSH5riAkFZCgnZ+yemEOd40w8soyVuykOPxPKmsCsEDniVKmTyV1As8ORdMNO3Nn2Irx1lkRRcziv7F8qtXvRORyeEuTGs0NVGklA0o976b5YsefqjAUMng1pNmhiRbo4FvdlMToVaT1rKURkxQEtiSEbhx226jWes0a2zR1vq+fP2Fb/ph9D+hGa57+8bnFblyQLfrwWEC0rjJL/Va+JdZ/N+AgTQuqF2VzFrI38jpImqr3RI+w9KNNQmUSejPwD3THfktviD0/EtZ+pzLPV0gqRVR43nnYDqIgUhbndnWQbkNzOPcL0sy7bblHdQ9m1CStf++Pz5w== 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=0EfnCZwCaBwZC3b9d7LgQCGdrSfa5rWM024vFXyvGOU=; b=N22+xoo/vGS/V5m3Zcsd6n30xe26QvUYFcawFLAoToJWKaxPfnEWagWHZNzoiHt3IBg8x4dLLbLC3OWVYfFkRSOYLBt+vsS6ZFNiZsukJtIbBYJBGAQVUa0SKZBYqTZz2JqPF6xLXkljWVkSktWVF3WJwLjSRNcFQcbmopWz64SC1F5O9d8kUS0OgYAiMr2XmHRuLLuzlxNz05mu3R5JW6UhhaGH/F0wAR0PKDOGqOihy4hlI0q1n8QBxz43Hn/6Uzp/r+JzyPoCcRq/hN7vgiI2DPKuE257wr789oPApoKEPYeBsr9V3wZLZGiNs0I/sOqksUYSmy0NEY5e8pVHpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=temperror (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com;dmarc=temperror action=none header.from=arm.com;dkim=none (message not signed);arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0EfnCZwCaBwZC3b9d7LgQCGdrSfa5rWM024vFXyvGOU=; b=zCtKIGPMEJpXZ32wyuVgnqyScKXT5t7LuA08qJ80O1y+gMZVsz+OpapGUi8hbLeLEjgzYfowcYsWQIG/jepiSwCfAFaxJpnT4wtLZ8fdNUv9vuLZlZYMlCHcUCboef1oxQHvddjD+Sr48GYG90KAXmmxqHhCOYpw44VFaELfJQg= Received: from VI1PR0802CA0043.eurprd08.prod.outlook.com (2603:10a6:800:a9::29) by AM6PR08MB4949.eurprd08.prod.outlook.com (2603:10a6:20b:e1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.12; Thu, 18 Jul 2019 10:05:38 +0000 Received: from DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::202) by VI1PR0802CA0043.outlook.office365.com (2603:10a6:800:a9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2073.11 via Frontend Transport; Thu, 18 Jul 2019 10:05:38 +0000 Authentication-Results: spf=temperror (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=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT026.mail.protection.outlook.com (10.152.20.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Thu, 18 Jul 2019 10:05:36 +0000 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, 18 Jul 2019 10:05:14 +0000 Received: from E119924.Arm.com (10.1.199.124) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 18 Jul 2019 10:05:13 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [PATCH v1 7/8] ShellPkg: acpiview: GTDT: Remove redundant forward declarations Date: Thu, 18 Jul 2019 11:05:01 +0100 Message-ID: <20190718100502.24688-8-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20190718100502.24688-1-krzysztof.koch@arm.com> References: <20190718100502.24688-1-krzysztof.koch@arm.com> Return-Path: Krzysztof.Koch@arm.com MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:40.67.248.234;IPV:NLI;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(4636009)(396003)(346002)(376002)(39860400002)(136003)(2980300002)(189003)(199004)(50466002)(50226002)(26005)(8936002)(426003)(7696005)(68736007)(51416003)(8676002)(86362001)(186003)(76176011)(47776003)(53416004)(356004)(63350400001)(6666004)(478600001)(63370400001)(336012)(81156014)(81166006)(476003)(2616005)(48376002)(1076003)(126002)(446003)(305945005)(486006)(2351001)(44832011)(11346002)(5660300002)(2906002)(6916009)(4326008)(316002)(16586007)(53936002)(36756003)(54906003)(70206006)(70586007)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR08MB4949;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c6a6a2c-670d-487f-b815-08d70b677aec X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328);SRVR:AM6PR08MB4949; X-MS-TrafficTypeDiagnostic: AM6PR08MB4949: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 01026E1310 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: CpYlP0CThM3d8T6i/FRFs+GyaH8ovB4sa2Sxp7s+eaxCyNtu22JYt4wRdPt4NuPjZi5vsvsfFcIP/BQjmE1+iNm4SqKcEjz6ZSEziBUaXJDPKKcMqQpKoGCumXRnvIy3jaaDF8RUoxDkvQ66CbjnY36hgu9SOTh4xjS/GAVi0kVRR345qh/boVgHuzAOzp0aaHA0HWNKriqbrvKFs0IGPHN2K4yvwFkhBSR7Cabg1RNHdGkZZZ7wIdR2ylhg93YOX+53dfpd5BNzkUYdWyHwGfaGtmX3qnlIOXL/s/rDDME4PYWOiikjl1kRvEMBipBRXO7lH1LYsrmq6zScQDGQBBSDlTYnIeZFz2X9qwiL+LVY7D9b4VWsOmyu19T5DmSt71oABx9g9/zGCl8WKyH5mQLKaFGqXaZhYcBK7HmLUhs= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2019 10:05:36.7955 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c6a6a2c-670d-487f-b815-08d70b677aec X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[40.67.248.234];Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4949 Content-Type: text/plain Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Replace multple use of literal values for GT Block Timer Frame count/number validation with a macro definition. Signed-off-by: Krzysztof Koch --- Notes: v1: - remove redundant forward function declarations [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c | 91 +++++++------------- 1 file changed, 33 insertions(+), 58 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index 3b05ff3015d4a3af62dd9fab057c32369a456267..1e5b5764f50a2d29aa904c889bc89af5bdc3af5c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -13,6 +13,9 @@ #include "AcpiParser.h" #include "AcpiTableParser.h" +// "The number of GT Block Timers must be less than or equal to 8" +#define GT_BLOCK_TIMER_COUNT_MAX 8 + // Local variables STATIC CONST UINT32* GtdtPlatformTimerCount; STATIC CONST UINT32* GtdtPlatformTimerOffset; @@ -36,7 +39,21 @@ EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ + UINT32 BlockTimerCount; + + BlockTimerCount = *(UINT32*)Ptr; + + if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) { + IncrementErrorCount (); + Print ( + L"\nERROR: Timer Count = %d. Max Timer Count is %d.", + BlockTimerCount, + GT_BLOCK_TIMER_COUNT_MAX + ); + } +} /** This function validates the GT Frame Number. @@ -51,7 +68,21 @@ EFIAPI ValidateGtFrameNumber ( IN UINT8* Ptr, IN VOID* Context - ); + ) +{ + UINT8 FrameNumber; + + FrameNumber = *(UINT8*)Ptr; + + if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) { + IncrementErrorCount (); + Print ( + L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-%d.", + FrameNumber, + GT_BLOCK_TIMER_COUNT_MAX - 1 + ); + } +} /** An ACPI_PARSER array describing the ACPI GTDT Table. @@ -134,62 +165,6 @@ STATIC CONST ACPI_PARSER SBSAGenericWatchdogParser[] = { {L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL} }; -/** - This function validates the GT Block timer count. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGtBlockTimerCount ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - UINT32 BlockTimerCount; - - BlockTimerCount = *(UINT32*)Ptr; - - if (BlockTimerCount > 8) { - IncrementErrorCount (); - Print ( - L"\nERROR: Timer Count = %d. Max Timer Count is 8.", - BlockTimerCount - ); - } -} - -/** - This function validates the GT Frame Number. - - @param [in] Ptr Pointer to the start of the field data. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateGtFrameNumber ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - UINT8 FrameNumber; - - FrameNumber = *(UINT8*)Ptr; - - if (FrameNumber > 7) { - IncrementErrorCount (); - Print ( - L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-7.", - FrameNumber - ); - } -} - /** This function parses the Platform GT Block. -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'