From nobody Thu Dec 26 13:25:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1506456943941606.6847061574905; Tue, 26 Sep 2017 13:15:43 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7B05320945BAC; Tue, 26 Sep 2017 13:12:28 -0700 (PDT) Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3DCEF21EC8D17 for ; Tue, 26 Sep 2017 13:12:25 -0700 (PDT) Received: from E111747.Emea.Arm.com (e111747.emea.arm.com [10.1.27.40]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v8QKFY5X017392; Tue, 26 Sep 2017 21:15:36 +0100 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.96.140; helo=cam-smtp0.cambridge.arm.com; envelope-from=evan.lloyd@arm.com; receiver=edk2-devel@lists.01.org From: evan.lloyd@arm.com To: edk2-devel@lists.01.org Date: Tue, 26 Sep 2017 21:15:18 +0100 Message-Id: <20170926201529.11644-9-evan.lloyd@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170926201529.11644-1-evan.lloyd@arm.com> References: <20170926201529.11644-1-evan.lloyd@arm.com> Subject: [edk2] [PATCH 08/19] ArmPlatformPkg: PL11LcdArmVExpressLib: Improvement conditional X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "ard.biesheuvel@linaro.org"@arm.com, "leif.lindholm@linaro.org"@arm.com, "nd@arm.com"@arm.com, "Matteo.Carlini@arm.com"@arm.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Girish Pathak PL111_CLCD_SITE and ARM_VE_MOTHERBOARD_SITE are both constants and available at build time. Use conditional compilation to process the code based on the value of PL111_CLCD_SITE, instead of selecting code in a switch statement at runtime. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak Signed-off-by: Evan Lloyd Reviewed-by: Leif Lindholm --- ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVE= xpress.c | 40 +++++++------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/P= L111LcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVEx= pressLib/PL111LcdArmVExpress.c index 59006c4cfd771fdd7ca1dab91728d4dafe2fe831..aa5a1ff9c1c25c51796b75230ca= 149ae3a92db4a 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111Lcd= ArmVExpress.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111Lcd= ArmVExpress.c @@ -209,16 +209,11 @@ LcdPlatformGetVram ( return EFI_INVALID_PARAMETER; } =20 - // Is it on the motherboard or on the daughterboard? - switch (PL111_CLCD_SITE) { - - case ARM_VE_MOTHERBOARD_SITE: +#if (PL111_CLCD_SITE =3D=3D ARM_VE_MOTHERBOARD_SITE) *VramBaseAddress =3D (EFI_PHYSICAL_ADDRESS)PL111_CLCD_VRAM_MOTHERBOARD= _BASE; *VramSize =3D LCD_VRAM_SIZE; Status =3D EFI_SUCCESS; - break; - - case ARM_VE_DAUGHTERBOARD_1_SITE: +#elif (PL111_CLCD_SITE =3D=3D ARM_VE_DAUGHTERBOARD_1_SITE) *VramBaseAddress =3D (EFI_PHYSICAL_ADDRESS)LCD_VRAM_CORE_TILE_BASE; *VramSize =3D LCD_VRAM_SIZE; =20 @@ -245,13 +240,9 @@ LcdPlatformGetVram ( ASSERT_EFI_ERROR (Status); gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); } - break; - - default: - // Unsupported site - Status =3D EFI_UNSUPPORTED; - break; - } +#else +#error PL111LcdVExpressLib: Unsupported PL111_CLCD_SITE +#endif // (PL111_CLCD_SITE =3D=3D ARM_VE_MOTHERBOARD_SITE) =20 return Status; } @@ -303,18 +294,15 @@ LcdPlatformSetMode ( return EFI_INVALID_PARAMETER; } =20 - switch (PL111_CLCD_SITE) { - case ARM_VE_MOTHERBOARD_SITE: - Function =3D SYS_CFG_OSC; - OscillatorId =3D PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID; - break; - case ARM_VE_DAUGHTERBOARD_1_SITE: - Function =3D SYS_CFG_OSC_SITE1; - OscillatorId =3D FixedPcdGet32 (PcdPL111LcdVideoModeOscId); - break; - default: - return EFI_UNSUPPORTED; - } +#if (PL111_CLCD_SITE =3D=3D ARM_VE_MOTHERBOARD_SITE) + Function =3D SYS_CFG_OSC; + OscillatorId =3D PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID; +#elif (PL111_CLCD_SITE =3D=3D ARM_VE_DAUGHTERBOARD_1_SITE) + Function =3D SYS_CFG_OSC_SITE1; + OscillatorId =3D FixedPcdGet32 (PcdPL111LcdVideoModeOscId); +#else +#error PL111LcdVExpressLib: Unsupported PL111_CLCD_SITE +#endif // (PL111_CLCD_SITE =3D=3D ARM_VE_MOTHERBOARD_SITE) =20 // Set the video mode oscillator Status =3D ArmPlatformSysConfigSetDevice ( --=20 Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel