From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::235; helo=mail-wm0-x235.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C036E21F3884B for ; Thu, 12 Oct 2017 12:33:18 -0700 (PDT) Received: by mail-wm0-x235.google.com with SMTP id q132so16121180wmd.2 for ; Thu, 12 Oct 2017 12:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yHJux38DjHTkCsSuO/1Uvq44lOTZ6zKXQz8s3MIbFzQ=; b=QFEvR3U3hE5V7pBkhtUeYW8W4znlY8MalggIuyjP8pzuwiluYO6sAIBqg8RkdDJ6Cj dBFtk+CAg9rEnG2xvpXN8z6Ecff7V/guwYHuKudY3o5D3Lz0jrWNaQsVZep9xSFyuq7X wdd5y+nD/vsHHJXGPyUBybRwMkJ34+kQRi+9o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yHJux38DjHTkCsSuO/1Uvq44lOTZ6zKXQz8s3MIbFzQ=; b=KWqHtw5hFO4R3clxwVb829aRLnm3+KsY/yxJ5ilBhmKCf6lnxEpxi/GQlP29/5OjIv x2gIzOZ2z7txqoEy/4YrqoBXNAQTf6L6s5Ynj4Qpz7+DqC9YP/MMWT09ZOgam4s0Nu7i GTpGNAMYJ7EN02FH/NMZiG+CX8e3hqJnnhmy6iCpGcsNWoB6hK9ASG9V5r8ifF21TLje MB+NJJbQwnaKskl4utQl69rrKf4+CZ6bCnX/eGa03UieVAXc2+c52DgbVX7JtgHz5LWA vdCeS8vTDhigYl/Npf1HPw97ymzEQFXo4qiSfBgZh/T6nTVqMgieru4ZBsW95JCukJu2 4igQ== X-Gm-Message-State: AMCzsaXXAN0r6hAfTXlu9qmuPiwS6bpv/iNDZGLHkJWlswGMUG8MEYRz nBAnNkWROwd/VysHRH+5SappvOn2XAE= X-Google-Smtp-Source: ABhQp+QwjmN6G9ONyXu67R/qBSoW2yqab8bOm22ey9XuiDUb+cIzZt5/T6+QqoeSB7pqFjDLQBX71g== X-Received: by 10.28.21.10 with SMTP id 10mr2543469wmv.41.1507837008229; Thu, 12 Oct 2017 12:36:48 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id f89sm1109658wmh.18.2017.10.12.12.36.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Oct 2017 12:36:47 -0700 (PDT) Date: Thu, 12 Oct 2017 20:36:45 +0100 From: Leif Lindholm To: evan.lloyd@arm.com Cc: edk2-devel@lists.01.org Message-ID: <20171012193645.wwnitylh2lk6xlvr@bivouac.eciton.net> References: <20170926201529.11644-1-evan.lloyd@arm.com> <20170926201529.11644-9-evan.lloyd@arm.com> MIME-Version: 1.0 In-Reply-To: <20170926201529.11644-9-evan.lloyd@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [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: , X-List-Received-Date: Thu, 12 Oct 2017 19:33:19 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 26, 2017 at 09:15:18PM +0100, evan.lloyd@arm.com wrote: > 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/PL111LcdArmVExpress.c | 40 +++++++------------- > 1 file changed, 14 insertions(+), 26 deletions(-) > > diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c > index 59006c4cfd771fdd7ca1dab91728d4dafe2fe831..aa5a1ff9c1c25c51796b75230ca149ae3a92db4a 100644 > --- a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c > +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c > @@ -209,16 +209,11 @@ LcdPlatformGetVram ( > return EFI_INVALID_PARAMETER; > } > > - // Is it on the motherboard or on the daughterboard? > - switch (PL111_CLCD_SITE) { > - > - case ARM_VE_MOTHERBOARD_SITE: > +#if (PL111_CLCD_SITE == ARM_VE_MOTHERBOARD_SITE) > *VramBaseAddress = (EFI_PHYSICAL_ADDRESS)PL111_CLCD_VRAM_MOTHERBOARD_BASE; > *VramSize = LCD_VRAM_SIZE; > Status = EFI_SUCCESS; > - break; > - > - case ARM_VE_DAUGHTERBOARD_1_SITE: > +#elif (PL111_CLCD_SITE == ARM_VE_DAUGHTERBOARD_1_SITE) > *VramBaseAddress = (EFI_PHYSICAL_ADDRESS)LCD_VRAM_CORE_TILE_BASE; > *VramSize = LCD_VRAM_SIZE; > > @@ -245,13 +240,9 @@ LcdPlatformGetVram ( > ASSERT_EFI_ERROR (Status); > gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); > } > - break; > - > - default: > - // Unsupported site > - Status = EFI_UNSUPPORTED; > - break; > - } > +#else > +#error PL111LcdVExpressLib: Unsupported PL111_CLCD_SITE > +#endif // (PL111_CLCD_SITE == ARM_VE_MOTHERBOARD_SITE) > > return Status; > } > @@ -303,18 +294,15 @@ LcdPlatformSetMode ( > return EFI_INVALID_PARAMETER; > } > > - switch (PL111_CLCD_SITE) { > - case ARM_VE_MOTHERBOARD_SITE: > - Function = SYS_CFG_OSC; > - OscillatorId = PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID; > - break; > - case ARM_VE_DAUGHTERBOARD_1_SITE: > - Function = SYS_CFG_OSC_SITE1; > - OscillatorId = FixedPcdGet32 (PcdPL111LcdVideoModeOscId); > - break; > - default: > - return EFI_UNSUPPORTED; > - } > +#if (PL111_CLCD_SITE == ARM_VE_MOTHERBOARD_SITE) > + Function = SYS_CFG_OSC; > + OscillatorId = PL111_CLCD_MOTHERBOARD_VIDEO_MODE_OSC_ID; > +#elif (PL111_CLCD_SITE == ARM_VE_DAUGHTERBOARD_1_SITE) > + Function = SYS_CFG_OSC_SITE1; > + OscillatorId = FixedPcdGet32 (PcdPL111LcdVideoModeOscId); > +#else > +#error PL111LcdVExpressLib: Unsupported PL111_CLCD_SITE > +#endif // (PL111_CLCD_SITE == ARM_VE_MOTHERBOARD_SITE) > > // Set the video mode oscillator > Status = ArmPlatformSysConfigSetDevice ( > -- > Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel