x86: cpu: Skip init code when chain loading
authorSimon Glass <sjg@chromium.org>
Sun, 26 Apr 2020 15:12:55 +0000 (09:12 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Thu, 30 Apr 2020 09:40:16 +0000 (17:40 +0800)
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>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/cpu/cpu.c
arch/x86/cpu/i386/interrupt.c
arch/x86/lib/init_helpers.c

index cec04b4..8526e85 100644 (file)
@@ -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)
index 4c7e9ea..e67a116 100644 (file)
@@ -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@chromium.org): But we don't handle these correctly when
         * booted from EFI.
         */
-       if (ll_boot_init())
-               enable_interrupts();
+       enable_interrupts();
 #endif
 
        return 0;
index 5bb55e2..d906b52 100644 (file)
@@ -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();
 }