All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 02/12] x86: spl: Add a function to find the text base
Date: Sat, 16 Jan 2021 14:53:49 -0700	[thread overview]
Message-ID: <20210116145343.2.Ida9f8cf3e7473c0f9493dd616e7481a022f3a85a@changeid> (raw)
In-Reply-To: <20210116215359.1220766-1-sjg@chromium.org>

It is useful to know the TEXT_BASE value for the image being loaded in
TPL/SPL. Add a new spl_get_image_text_base() function to handle this.

Make use of this in the x86 SPL handler, instead of having the logic
there.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/spl/spl.c |  6 ++++++
 include/spl.h    | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index d375dcbb2ed..12b00e2a407 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -144,6 +144,12 @@ ulong spl_get_image_size(void)
 		binman_sym(ulong, u_boot_any, size);
 }
 
+ulong spl_get_image_text_base(void)
+{
+	return spl_phase() == PHASE_TPL ? CONFIG_SPL_TEXT_BASE :
+		CONFIG_SYS_TEXT_BASE;
+}
+
 /*
  * Weak default function for board specific cleanup/preparation before
  * Linux boot. Some boards/platforms might not need it, so just provide
diff --git a/include/spl.h b/include/spl.h
index faffeb519ac..e172500b5f8 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -254,6 +254,16 @@ ulong spl_get_image_pos(void);
  */
 ulong spl_get_image_size(void);
 
+/**
+ * spl_get_image_text_base() - get the text base of the next phase
+ *
+ * This returns the address that the next stage is linked to run at, i.e.
+ * CONFIG_SPL_TEXT_BASE or CONFIG_SYS_TEXT_BASE
+ *
+ * @return text-base address
+ */
+ulong spl_get_image_text_base(void);
+
 /**
  * spl_load_simple_fit_skip_processing() - Hook to allow skipping the FIT
  *	image processing during spl_load_simple_fit().
-- 
2.30.0.284.gd98b1dd5eaa7-goog

  parent reply	other threads:[~2021-01-16 21:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-16 21:53 [PATCH 00/12] x86: Minor improvements mostly for image loading Simon Glass
2021-01-16 21:53 ` [PATCH 01/12] x86: acpi_gpe: Update driver name to match devicetree Simon Glass
2021-01-21  3:18   ` Bin Meng
2021-01-21  3:26     ` Simon Glass
2021-01-21  3:32       ` Bin Meng
2021-01-16 21:53 ` Simon Glass [this message]
2021-01-21  3:21   ` [PATCH 02/12] x86: spl: Add a function to find the text base Bin Meng
2021-01-16 21:53 ` [PATCH 03/12] x86: apl: Enhance debugging in the SPL loader Simon Glass
2021-01-21  3:27   ` Bin Meng
2021-01-16 21:53 ` [PATCH 04/12] x86: Make sure the SPL image ends on a suitable boundary Simon Glass
2021-01-21  5:35   ` Bin Meng
2021-01-24 17:06     ` Simon Glass
2021-01-16 21:53 ` [PATCH 05/12] x86: spl: Make moving BSS conditional Simon Glass
2021-01-21  5:35   ` Bin Meng
2021-01-16 21:53 ` [PATCH 06/12] x86: Update Chromium OS GNVS names Simon Glass
2021-01-21  5:37   ` Bin Meng
2021-01-16 21:53 ` [PATCH 07/12] x86: zimage: Allow dumping the image from outside the module Simon Glass
2021-01-21  5:37   ` Bin Meng
2021-01-16 21:53 ` [PATCH 08/12] x86: zimage: Improve command-line debug handling Simon Glass
2021-01-21  5:37   ` Bin Meng
2021-01-16 21:53 ` [PATCH 09/12] x86: spl: Clear BSS unconditionally Simon Glass
2021-01-21  5:43   ` Bin Meng
2021-01-16 21:53 ` [PATCH 10/12] x86: tpl: Show next stage being booted Simon Glass
2021-01-21  5:43   ` Bin Meng
2021-01-16 21:53 ` [PATCH 11/12] sysinfo: Allow showing model info from sysinfo Simon Glass
2021-01-21  5:43   ` Bin Meng
2021-01-16 21:53 ` [PATCH 12/12] x86: coral: Show memory config and SKU ID on startup Simon Glass
2021-01-21  5:43   ` 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=20210116145343.2.Ida9f8cf3e7473c0f9493dd616e7481a022f3a85a@changeid \
    --to=sjg@chromium.org \
    --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.