[PATCH 3/5] x86: cpu: Skip init code when chain loading

Bin Meng bmeng.cn at gmail.com
Mon Feb 3 12:11:01 CET 2020


Hi Simon,

On Sun, Dec 22, 2019 at 12:13 AM Simon Glass <sjg at chromium.org> wrote:
>
> 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 at chromium.org>
> ---
>
>  arch/x86/cpu/cpu.c            | 4 +++-
>  arch/x86/cpu/i386/interrupt.c | 3 +++
>  arch/x86/lib/init_helpers.c   | 3 +++
>  3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
> index d626e38fd1..d82305303a 100644
> --- a/arch/x86/cpu/cpu.c
> +++ b/arch/x86/cpu/cpu.c
> @@ -238,8 +238,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 78aa51a3ea..c33ca165d8 100644
> --- a/arch/x86/cpu/i386/interrupt.c
> +++ b/arch/x86/cpu/i386/interrupt.c
> @@ -261,6 +261,9 @@ int interrupt_init(void)
>         struct udevice *dev;
>         int ret;
>
> +       if (!ll_boot_init())
> +               return 0;
> +

If you scroll down a little bit in this function, you see there is
already a ll_boot_init() check. We need some consolidation here.

>         /* Try to set up the interrupt router, but don't require one */
>         ret = uclass_first_device_err(UCLASS_IRQ, &dev);
>         if (ret && ret != -ENODEV)
> 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;

I am not convinced that we should add the ll_boot_init() check here.
This function already has a do_mtrr variable that is based on the
config options.

> +
>         /* Initialise the CPU cache(s) */
>         return init_cache();
>  }

Regards,
Bin


More information about the U-Boot mailing list