All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
To: u-boot@lists.denx.de
Subject: [PATCH v4 1/3] arch: x86: apl: Only load VBT if CONFIG_HAVE_VBT is enabled
Date: Mon, 18 May 2020 12:33:33 +0200	[thread overview]
Message-ID: <20200518103336.1097071-2-bernhard.messerklinger@br-automation.com> (raw)
In-Reply-To: <20200518103336.1097071-1-bernhard.messerklinger@br-automation.com>

Only load VBT if it's present in the u-boot.rom.

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

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on coral:
Tested-by: Simon Glass <sjg@chromium.org>

---

Changes in v4:
Fix comment alignment

Changes in v3: None
Changes in v2: None

 arch/x86/cpu/apollolake/fsp_s.c | 46 ++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/arch/x86/cpu/apollolake/fsp_s.c b/arch/x86/cpu/apollolake/fsp_s.c
index 7ef169b147..be283818e3 100644
--- a/arch/x86/cpu/apollolake/fsp_s.c
+++ b/arch/x86/cpu/apollolake/fsp_s.c
@@ -327,28 +327,32 @@ int fsps_update_config(struct udevice *dev, ulong rom_offset,
 {
 	struct fsp_s_config *cfg = &upd->config;
 	struct apl_config *apl;
-	struct binman_entry vbt;
-	void *buf;
-	int ret;
-
-	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)
-		return log_msg_ret("Alloc VBT", -ENOMEM);
 
-	/*
-	 * Load VBT before devicetree-specific config. This only supports
-	 * memory-mapped SPI at present.
-	 */
-	bootstage_start(BOOTSTAGE_ID_ACCUM_MMAP_SPI, "mmap_spi");
-	memcpy(buf, (void *)vbt.image_pos, vbt.size);
-	bootstage_accum(BOOTSTAGE_ID_ACCUM_MMAP_SPI);
-	if (*(u32 *)buf != VBT_SIGNATURE)
-		return log_msg_ret("VBT signature", -EINVAL);
-	cfg->graphics_config_ptr = (ulong)buf;
+	if (IS_ENABLED(CONFIG_HAVE_VBT)) {
+		struct binman_entry vbt;
+		void *vbt_buf;
+		int ret;
+
+		ret = binman_entry_find("intel-vbt", &vbt);
+		if (ret)
+			return log_msg_ret("Cannot find VBT", ret);
+		vbt.image_pos += rom_offset;
+		vbt_buf = malloc(vbt.size);
+		if (!vbt_buf)
+			return log_msg_ret("Alloc VBT", -ENOMEM);
+
+		/*
+		 * Load VBT before devicetree-specific config. This only
+		 * supports memory-mapped SPI at present.
+		 */
+		bootstage_start(BOOTSTAGE_ID_ACCUM_MMAP_SPI, "mmap_spi");
+		memcpy(vbt_buf, (void *)vbt.image_pos, vbt.size);
+		bootstage_accum(BOOTSTAGE_ID_ACCUM_MMAP_SPI);
+		if (*(u32 *)vbt_buf != VBT_SIGNATURE)
+			return log_msg_ret("VBT signature", -EINVAL);
+
+		cfg->graphics_config_ptr = (ulong)vbt_buf;
+	}
 
 	apl = malloc(sizeof(*apl));
 	if (!apl)
-- 
2.26.0

  reply	other threads:[~2020-05-18 10:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 10:33 [PATCH v4 0/3] Move FSP configuration to devicetree Bernhard Messerklinger
2020-05-18 10:33 ` Bernhard Messerklinger [this message]
2020-05-18 10:33 ` [PATCH v4 2/3] arch: x86: apl: Use devicetree for FSP-M configuration Bernhard Messerklinger
2020-05-18 10:33 ` [PATCH v4 3/3] arch: x86: apl: Use devicetree for FSP-S configuration Bernhard Messerklinger
2020-05-19  5:31 ` [PATCH v4 0/3] Move FSP configuration to devicetree Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200518103336.1097071-2-bernhard.messerklinger@br-automation.com \
    --to=bernhard.messerklinger@br-automation.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.