diff mbox series

[RFC,v2,1/2] arch: x86: apl: Only load VBT if CONFIG_HAVE_VBT is enabled

Message ID 20200414092548.336158-2-bernhard.messerklinger@br-automation.com
State Superseded
Headers show
Series Move FSP-S configuration to device-tree | expand

Commit Message

Bernhard Messerklinger April 14, 2020, 9:25 a.m. UTC
Only load VBT if it's present in the u-boot.rom.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger at br-automation.com>
---

Changes in v2: None

 arch/x86/cpu/apollolake/fsp_s.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Simon Glass April 19, 2020, 11:37 p.m. UTC | #1
Hi Bernhard,

On Tue, 14 Apr 2020 at 03:26, Bernhard Messerklinger
<bernhard.messerklinger at br-automation.com> wrote:
>
> Only load VBT if it's present in the u-boot.rom.
>
> Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger at br-automation.com>
> ---
>
> Changes in v2: None
>
>  arch/x86/cpu/apollolake/fsp_s.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>

Can this please use if(IS_ENABLED(....)) instead of #if?

Regards,
SImon
diff mbox series

Patch

diff --git a/arch/x86/cpu/apollolake/fsp_s.c b/arch/x86/cpu/apollolake/fsp_s.c
index 1f22c1ea3c..458825bc49 100644
--- a/arch/x86/cpu/apollolake/fsp_s.c
+++ b/arch/x86/cpu/apollolake/fsp_s.c
@@ -327,16 +327,17 @@  int fsps_update_config(struct udevice *dev, ulong rom_offset,
 {
 	struct fsp_s_config *cfg = &upd->config;
 	struct apl_config *apl;
+#ifdef CONFIG_HAVE_VBT
 	struct binman_entry vbt;
-	void *buf;
 	int ret;
+	void *vbt_buf;
 
 	ret = binman_entry_find("intel-vbt", &vbt);
 	if (ret)
 		return log_msg_ret("Cannot find VBT", ret);
 	vbt.image_pos += rom_offset;
-	buf = malloc(vbt.size);
-	if (!buf)
+	vbt_buf = malloc(vbt.size);
+	if (!vbt_buf)
 		return log_msg_ret("Alloc VBT", -ENOMEM);
 
 	/*
@@ -344,11 +345,12 @@  int fsps_update_config(struct udevice *dev, ulong rom_offset,
 	 * memory-mapped SPI at present.
 	 */
 	bootstage_start(BOOTSTAGE_ID_ACCUM_MMAP_SPI, "mmap_spi");
-	memcpy(buf, (void *)vbt.image_pos, vbt.size);
+	memcpy(vbt_buf, (void *)vbt.image_pos, vbt.size);
 	bootstage_accum(BOOTSTAGE_ID_ACCUM_MMAP_SPI);
-	if (*(u32 *)buf != VBT_SIGNATURE)
+	if (*(u32 *)vbt_buf != VBT_SIGNATURE)
 		return log_msg_ret("VBT signature", -EINVAL);
-	cfg->graphics_config_ptr = (ulong)buf;
+	cfg->graphics_config_ptr = (ulong)vbt_buf;
+#endif
 
 	apl = malloc(sizeof(*apl));
 	if (!apl)