[U-Boot] [PATCH v3 1/8] x86: Add new slimbootloader CPU type

Bin Meng bmeng.cn at gmail.com
Sun Jul 14 08:49:05 UTC 2019


On Wed, Jul 10, 2019 at 3:02 AM Park, Aiden <aiden.park at intel.com> wrote:
>
> This slimbootloader cpu type is to enable u-boot as a payload which
> runs on top of Slim Bootloader(https://github.com/slimbootloader).
> The Slim Bootloader is designed with multi-stage architecture for
> the execution from reset vector to OS booting, and supports qemu,
> Apollolake, Whiskeylake and Coffeelake platforms consuming Intel FSP
> (https://github.com/IntelFsp) for silicon initialization including
> CAR and memory initialization.
> The Slim Bootloader generates new HOB(Hand Off Block) which are
> serial port info, memory map info, performance data info and so on,
> and passes it to a Payload. U-boot as a payload will use these HOB

nits: U-Boot

> information for basic initialization such as serial console.
>
> As an initial commit,
> - Add CONFIG_SYS_SLIMBOOTLOADER to enable slimbootloader CPU type
> - Add new arch/x86/cpu/slimbootloader directory with minimum codes
> - Get hob_list pointer from Slim Bootloader
>
> Signed-off-by: Aiden Park <aiden.park at intel.com>
> ---
>
> Changes in v3:
>   * Add a brief description about Slim Bootloader
>   * Enable USB_KEYBOARD, E1000 and RTL8169 by default
>   * Fix comment from code review
>
>  arch/x86/Kconfig                              |  1 +
>  arch/x86/cpu/Makefile                         |  1 +
>  arch/x86/cpu/slimbootloader/Kconfig           | 26 +++++++++++
>  arch/x86/cpu/slimbootloader/Makefile          |  5 +++
>  arch/x86/cpu/slimbootloader/car.S             | 43 +++++++++++++++++++
>  arch/x86/cpu/slimbootloader/slimbootloader.c  | 21 +++++++++
>  .../asm/arch-slimbootloader/slimbootloader.h  | 11 +++++
>  arch/x86/include/asm/global_data.h            |  2 +-
>  arch/x86/lib/asm-offsets.c                    |  2 +-
>  9 files changed, 110 insertions(+), 2 deletions(-)
>  create mode 100644 arch/x86/cpu/slimbootloader/Kconfig
>  create mode 100644 arch/x86/cpu/slimbootloader/Makefile
>  create mode 100644 arch/x86/cpu/slimbootloader/car.S
>  create mode 100644 arch/x86/cpu/slimbootloader/slimbootloader.c
>  create mode 100644 arch/x86/include/asm/arch-slimbootloader/slimbootloader.h
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 70f939869a..27b7b767b9 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -115,6 +115,7 @@ source "arch/x86/cpu/efi/Kconfig"
>  source "arch/x86/cpu/qemu/Kconfig"
>  source "arch/x86/cpu/quark/Kconfig"
>  source "arch/x86/cpu/queensbay/Kconfig"
> +source "arch/x86/cpu/slimbootloader/Kconfig"
>  source "arch/x86/cpu/tangier/Kconfig"
>
>  # architecture-specific options below
> diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
> index 85fd5e616e..3f1f62da2b 100644
> --- a/arch/x86/cpu/Makefile
> +++ b/arch/x86/cpu/Makefile
> @@ -42,6 +42,7 @@ obj-$(CONFIG_INTEL_BAYTRAIL) += baytrail/
>  obj-$(CONFIG_INTEL_BRASWELL) += braswell/
>  obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
>  obj-$(CONFIG_SYS_COREBOOT) += coreboot/
> +obj-$(CONFIG_SYS_SLIMBOOTLOADER) += slimbootloader/
>  obj-$(CONFIG_EFI) += efi/
>  obj-$(CONFIG_QEMU) += qemu/
>  obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
> diff --git a/arch/x86/cpu/slimbootloader/Kconfig b/arch/x86/cpu/slimbootloader/Kconfig
> new file mode 100644
> index 0000000000..439e4b1e2c
> --- /dev/null
> +++ b/arch/x86/cpu/slimbootloader/Kconfig
> @@ -0,0 +1,26 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (C) 2019 Intel Corporation <www.intel.com>
> +
> +if TARGET_SLIMBOOTLOADER
> +
> +config SYS_SLIMBOOTLOADER
> +       bool
> +       default y
> +       imply SYS_NS16550
> +       imply AHCI_PCI
> +       imply SCSI
> +       imply SCSI_AHCI
> +       imply MMC
> +       imply MMC_PCI
> +       imply MMC_SDHCI
> +       imply MMC_SDHCI_SDMA
> +       imply USB
> +       imply USB_EHCI_HCD
> +       imply USB_XHCI_HCD
> +       imply USB_STORAGE
> +       imply USB_KEYBOARD
> +       imply E1000
> +       imply RTL8169
> +
> +endif
> diff --git a/arch/x86/cpu/slimbootloader/Makefile b/arch/x86/cpu/slimbootloader/Makefile
> new file mode 100644
> index 0000000000..627a721e8c
> --- /dev/null
> +++ b/arch/x86/cpu/slimbootloader/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (C) 2019 Intel Corporation <www.intel.com>
> +
> +obj-y += car.o slimbootloader.o
> diff --git a/arch/x86/cpu/slimbootloader/car.S b/arch/x86/cpu/slimbootloader/car.S
> new file mode 100644
> index 0000000000..63c5c28b33
> --- /dev/null
> +++ b/arch/x86/cpu/slimbootloader/car.S
> @@ -0,0 +1,43 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (C) 2019 Intel Corporation <www.intel.com>
> + */
> +
> +#include <generated/asm-offsets.h>
> +
> +.section .text
> +
> +.globl slimbootloader_start
> +slimbootloader_start:
> +       /* Get hob pointer parameter from previous stage's stack */
> +       mov     0x4(%esp), %esi
> +
> +       /* Set up global data */
> +       mov     %esp, %eax
> +       call    board_init_f_alloc_reserve
> +       mov     %eax, %esp
> +       call    board_init_f_init_reserve
> +
> +#ifdef CONFIG_DEBUG_UART
> +       call    debug_uart_init
> +#endif
> +
> +       /* Get address of global_data */
> +       mov     %fs:0, %edx
> +       movl    %esi, GD_HOB_LIST(%edx)
> +
> +       /* Enter u-boot with 0 bootflag */
> +       xorl    %eax, %eax
> +       call    board_init_f
> +
> +.globl car_init
> +car_init:
> +       /*
> +        * CAR init/teardown and memory init have already been done
> +        * in Slim Bootloader stages. Therefore, let's use this car_init as
> +        * very first entry point of slimbootloader_start.
> +        */
> +       jmp     slimbootloader_start
> +
> +       /* DO NOT REACH HERE */
> +       jmp     .

Why don't we use the generic arch/x86/cpu/start.S and jmp car_init_ret here?

[snip]

Regards,
Bin


More information about the U-Boot mailing list