All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v2 02/12] x86: spl: Add a function to find the text base
Date: Sun, 24 Jan 2021 10:06:03 -0700	[thread overview]
Message-ID: <20210124100608.v2.2.Ida9f8cf3e7473c0f9493dd616e7481a022f3a85a@changeid> (raw)
In-Reply-To: <20210124170613.3434824-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>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

(no changes since v1)

 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.280.ga3ce27912f-goog

  parent reply	other threads:[~2021-01-24 17:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24 17:06 [PATCH v2 00/12] x86: Minor improvements mostly for image loading Simon Glass
2021-01-24 17:06 ` [PATCH v2 01/12] x86: acpi_gpe: Update driver name to match devicetree Simon Glass
2021-01-24 17:06 ` Simon Glass [this message]
2021-01-24 17:06 ` [PATCH v2 03/12] x86: apl: Enhance debugging in the SPL loader Simon Glass
2021-01-24 17:06 ` [PATCH v2 04/12] x86: Make sure the SPL image ends on a suitable boundary Simon Glass
2021-02-01  6:37   ` Bin Meng
2021-01-24 17:06 ` [PATCH v2 05/12] x86: spl: Make moving BSS conditional Simon Glass
2021-01-24 17:06 ` [PATCH v2 06/12] x86: Update Chromium OS GNVS names Simon Glass
2021-01-24 17:06 ` [PATCH v2 07/12] x86: zimage: Allow dumping the image from outside the module Simon Glass
2021-01-24 17:06 ` [PATCH v2 08/12] x86: zimage: Improve command-line debug handling Simon Glass
2021-01-24 17:06 ` [PATCH v2 09/12] x86: spl: Clear BSS unconditionally Simon Glass
2021-01-24 17:06 ` [PATCH v2 10/12] x86: tpl: Show next stage being booted Simon Glass
2021-01-24 17:06 ` [PATCH v2 11/12] sysinfo: Allow showing model info from sysinfo Simon Glass
2021-01-24 17:06 ` [PATCH v2 12/12] x86: coral: Show memory config and SKU ID on startup Simon Glass
2021-02-01  6:40 ` [PATCH v2 00/12] x86: Minor improvements mostly for image loading 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=20210124100608.v2.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.