All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v3 3/7] x86: cpu: Skip init code when chain loading
Date: Sat,  7 Mar 2020 16:22:16 -0700	[thread overview]
Message-ID: <20200307232220.111052-4-sjg@chromium.org> (raw)
In-Reply-To: <20200307232220.111052-1-sjg@chromium.org>

When U-Boot is not the first-stage bootloader the interrupt and cache init
must be skipped, as well as init for various peripherals. Update the code
to add checks for this.

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

Changes in v3: None
Changes in v2:
- Drop the other check in interrupt_init() which is not needed now

 arch/x86/cpu/cpu.c            | 4 +++-
 arch/x86/cpu/i386/interrupt.c | 6 ++++--
 arch/x86/lib/init_helpers.c   | 3 +++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index dae06949cc..3db035c2c0 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -239,8 +239,10 @@ int cpu_init_r(void)
 	struct udevice *dev;
 	int ret;
 
-	if (!ll_boot_init())
+	if (!ll_boot_init()) {
+		uclass_first_device(UCLASS_PCI, &dev);
 		return 0;
+	}
 
 	ret = x86_init_cpus();
 	if (ret)
diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c
index 4c7e9ea215..e67a116ac1 100644
--- a/arch/x86/cpu/i386/interrupt.c
+++ b/arch/x86/cpu/i386/interrupt.c
@@ -264,6 +264,9 @@ int interrupt_init(void)
 	struct udevice *dev;
 	int ret;
 
+	if (!ll_boot_init())
+		return 0;
+
 	/* Try to set up the interrupt router, but don't require one */
 	ret = irq_first_device_type(X86_IRQT_BASE, &dev);
 	if (ret && ret != -ENODEV)
@@ -295,8 +298,7 @@ int interrupt_init(void)
 	 * TODO(sjg at chromium.org): But we don't handle these correctly when
 	 * booted from EFI.
 	 */
-	if (ll_boot_init())
-		enable_interrupts();
+	enable_interrupts();
 #endif
 
 	return 0;
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 5bb55e256f..d906b528b3 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -30,6 +30,9 @@ int init_cache_f_r(void)
 			return ret;
 	}
 
+	if (!ll_boot_init())
+		return 0;
+
 	/* Initialise the CPU cache(s) */
 	return init_cache();
 }
-- 
2.25.1.481.gfbce0eb801-goog

  parent reply	other threads:[~2020-03-07 23:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07 23:22 [PATCH v3 0/7] x86: Improve support for chain-loading U-Boot Simon Glass
2020-03-07 23:22 ` [PATCH v3 1/7] x86: fsp: Allow skipping init code when chain loading Simon Glass
2020-03-07 23:22 ` [PATCH v3 2/7] x86: apl: Skip " Simon Glass
2020-03-07 23:22 ` Simon Glass [this message]
2020-03-07 23:22 ` [PATCH v3 4/7] pci: Avoid auto-config " Simon Glass
2020-03-07 23:22 ` [PATCH v3 5/7] board: Add a gd flag for " Simon Glass
2020-03-07 23:22 ` [PATCH v3 6/7] x86: Add a way to detect running from coreboot Simon Glass
2020-03-07 23:22 ` [PATCH v3 7/7] x86: Use the existing stack when chain-loading Simon Glass
2020-03-10 14:51 ` [PATCH v3 0/7] x86: Improve support for chain-loading U-Boot Andy Shevchenko
2020-03-11  2:28   ` Simon Glass
2020-03-11 12:09     ` Andy Shevchenko
2020-03-11 12:24       ` Simon Glass
2020-03-11 13:04         ` Andy Shevchenko
2020-03-11 14:53           ` Igor Opaniuk
2020-03-11 15:22             ` Andy Shevchenko
2020-03-11 16:03               ` Wolfgang Denk
2020-03-12  3:22           ` Simon Glass
2020-03-12 15:38             ` Andy Shevchenko
2020-03-29  2:13 ` Simon Glass

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=20200307232220.111052-4-sjg@chromium.org \
    --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.