Support to run U-Boot on sc7180 Trogdor Chromebooks
Subsystems (13)
v3 cover Support to run U-Boot on sc7180 Trogdor Chromebooks
This series supports running U-Boot as a payload on sc7180 Trogdor Chromebooks like Lazor or Wormdingler. This is a jumble of different patches to get to the final goal of booting a Linux distro from the eMMC on Lazor. I'm able to boot Fedora Workstation 41 from a USB stick on my Lazor.
I moved the reviewed patch to the start. After that one line fix there's a few patches to add support for the particular SoC used on Trogdor devices, sc7180. The next set of patches move the coreboot logic out of arch/x86/ into lib/ to find the coreboot tables on ARM and stash them in global data. Then I have a handful of patches to let the coreboot commands and utilities parse and populate various things like pstore and firmware details into the DTB with the proper data from the coreboot tables. Finally, I add the calls to coreboot dram parsing code in the snapdragon board so that if coreboot tables exist we get the memory info from coreboot instead of from an earlier stage DTB.
I tested the SPI driver with the crosec command. The cros bootflow method almost works, but it seems like chromeos userspace blows up spectacularly likely because crossystem can't figure out what board it is running on. I don't really care too much about booting chromeos userspace here so I'm ignoring that problem.
I haven't gotten around to working on the display part yet. I want to do that in the next couple weeks. Do I need to add a board/google/trogdor directory? If I don't get the display working then I'll have to figure out how to script the loading process somehow so that it can boot from USB/MMC.
TODO:
* Get display working
* Implement FIT FDT picking similar to depthcharge based on coreboot tables indicating the SKU and board id
Changes from v2 https://lore.kernel.org/r/[email protected]
* Check SPI proto in probe
* Handle pins differently in pinctrl driver
* Pick up tags
* Rebase to ToT
* Update pinctrl driver for new changes in last few months
* Add some more gates to clk driver to handle missing clk warnings
* New patch to locate coreboot tables early to fix memory parsing logic
Changes from v1 https://lore.kernel.org/r/[email protected]
* Add Kconfig file in lib/coreboot/ to hold the coreboot config stuff similar to EFI
* Couple new patches for ximg to support extracting the FDT from chromeos kernel partitions
* Move the timestamp file out of arch/x86 as well in a different patch
Stephen Boyd (17):
bootstd: cros: Return negative error code
clk: qcom: Add driver for sc7180
clk/stub: add sc7180-rpmh clock
pinctrl: qcom: Add driver for sc7180
spi: Add Qualcomm GENI SPI driver
coreboot: Move coreboot logic out of x86 to a generic place
coreboot: Locate table earlier than arch_cpu_init()
arm: Support running U-Boot as a coreboot payload on ARM64 cmd/cbsysinfo: Skip the CMOS 'option_table' when not present cmd/cbsysinfo: Allow on ARM as well
coreboot: Parse sku_id/fw_config from coreboot tables
pstore: Add pstore address from coreboot tables
coreboot: Add /firmware/coreboot node to DT
coreboot: Move timestamp parsing to generic place
mach-snapdragon: Support booting as a coreboot payload
cmd: ximg: Support LZO compressed images
cmd: ximg: Support LZ4 compressed images
arch/arm/cpu/armv8/Makefile | 1 +
arch/arm/cpu/armv8/coreboot/Makefile | 4 +
arch/arm/cpu/armv8/coreboot/cpu.c | 22 +
arch/arm/include/asm/global_data.h | 3 +
arch/arm/mach-snapdragon/board.c | 23 +
arch/x86/Kconfig | 22 -
arch/x86/cpu/coreboot/Kconfig | 33 --
arch/x86/cpu/coreboot/Makefile | 1 -
arch/x86/cpu/coreboot/coreboot.c | 16 +-
arch/x86/cpu/coreboot/sdram.c | 78 +--
arch/x86/cpu/cpu.c | 15 +-
arch/x86/cpu/i386/cpu.c | 2 +-
arch/x86/lib/bootm.c | 5 +-
arch/x86/lib/coreboot/Makefile | 1 -
arch/x86/lib/coreboot/cb_support.c | 2 +-
arch/x86/lib/coreboot_table.c | 2 +-
arch/x86/lib/tables.c | 2 +-
arch/x86/lib/zimage.c | 3 -
board/coreboot/coreboot/coreboot.c | 2 +-
board/coreboot/coreboot/sysinfo.c | 2 +-
board/google/chromebook_coral/coral.c | 2 +-
boot/Kconfig | 1 +
boot/bootmeth_cros.c | 2 +-
boot/expo_build_cb.c | 2 +-
boot/image-fdt.c | 4 +
cmd/Kconfig | 4 +-
cmd/Makefile | 1 +
cmd/{x86 => }/cbsysinfo.c | 6 +-
cmd/pstore.c | 44 +-
cmd/version.c | 2 +-
cmd/x86/Makefile | 1 -
cmd/x86/cbcmos.c | 2 +-
cmd/ximg.c | 28 +
common/board_f.c | 4 +
drivers/clk/clk-stub.c | 1 +
drivers/clk/qcom/Kconfig | 8 +
drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/clock-sc7180.c | 153 +++++
drivers/misc/cbmem_console.c | 2 +-
drivers/pinctrl/qcom/Kconfig | 8 +
drivers/pinctrl/qcom/Makefile | 1 +
drivers/pinctrl/qcom/pinctrl-sc7180.c | 131 +++++
drivers/serial/serial_coreboot.c | 2 +-
drivers/spi/Kconfig | 10 +
drivers/spi/Makefile | 1 +
drivers/spi/spi-geni-qcom.c | 545 ++++++++++++++++++
drivers/video/coreboot.c | 2 +-
.../x86/include/asm => include}/cb_sysinfo.h | 47 +-
.../include/asm => include}/coreboot_tables.h | 11 +
.../coreboot_timestamp.h | 9 +-
lib/Makefile | 2 +
lib/coreboot/Kconfig | 55 ++
{arch/x86/cpu => lib}/coreboot/Makefile | 9 +-
{arch/x86/lib => lib}/coreboot/cb_sysinfo.c | 174 +++++-
{arch/x86/cpu => lib}/coreboot/sdram.c | 15 +-
{arch/x86/cpu => lib}/coreboot/timestamp.c | 15 +-
56 files changed, 1311 insertions(+), 233 deletions(-)
create mode 100644 arch/arm/cpu/armv8/coreboot/Makefile
create mode 100644 arch/arm/cpu/armv8/coreboot/cpu.c
delete mode 100644 arch/x86/cpu/coreboot/Kconfig
rename cmd/{x86 => }/cbsysinfo.c (99%)
create mode 100644 drivers/clk/qcom/clock-sc7180.c
create mode 100644 drivers/pinctrl/qcom/pinctrl-sc7180.c
create mode 100644 drivers/spi/spi-geni-qcom.c
rename {arch/x86/include/asm => include}/cb_sysinfo.h (88%)
rename {arch/x86/include/asm => include}/coreboot_tables.h (98%)
rename arch/x86/include/asm/arch-coreboot/timestamp.h => include/coreboot_timestamp.h (63%)
create mode 100644 lib/coreboot/Kconfig
copy {arch/x86/cpu => lib}/coreboot/Makefile (75%)
rename {arch/x86/lib => lib}/coreboot/cb_sysinfo.c (72%)
copy {arch/x86/cpu => lib}/coreboot/sdram.c (87%)
rename {arch/x86/cpu => lib}/coreboot/timestamp.c (83%)base-commit: 9d3f1ebaf8751f0287b5d02158cc706435f8fb19
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 1/17 bootstd: cros: Return negative error code
This should be negative EFAULT to indicate an error code.
--- boot/bootmeth_cros.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
boot/bootmeth_cros.c +1 -1
@@ -340,7 +340,7 @@ static int cros_read_kernel(struct bootflow *bflow)/* Check that the header is not smaller than permitted */ if (priv->body_offset <PROBE_SIZE ) -return log_msg_ret ("san" ,EFAULT ); +return log_msg_ret ("san" , -EFAULT );/* Read kernel body */ num_blks = priv->body_size >> desc->log2blksz;
Signature · 1 line
Sent by a computer, using git, on the internet
Re: [PATCH v3 01/17] bootstd: cros: Return negative error code
Quoted 8 lines · Stephen Boyd
This should be negative EFAULT to indicate an error code.
Reviewed-by Simon Glass <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- boot/bootmeth_cros.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v3 2/17 clk: qcom: Add driver for sc7180
In reply to Stephen BoydThe clks are already configured properly by coreboot on sc7180, but this is good enough to make the MMC and USB drivers work.
--- drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clock-sc7180.c | 153 ++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 drivers/clk/qcom/clock-sc7180.c
drivers/clk/qcom/Kconfig +8 -0
@@ -111,6 +111,14 @@ config CLK_QCOM_SM8650 on the Snapdragon SM8650 SoC. This driver supports the clocks and resets exposed by the GCC hardware block. +config CLK_QCOM_SC7180 + bool "Qualcomm SC7180 GCC" + select CLK_QCOM + help + Say Y here to enable support for the Global Clock Controller + on the Snapdragon SC7180 SoC. This driver supports the clocks + and resets exposed by the GCC hardware block. + config CLK_QCOM_SC7280 bool "Qualcomm SC7280 GCC" select CLK_QCOM
drivers/clk/qcom/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_CLK_QCOM_IPQ9574) += clock-ipq9574.o obj-$(CONFIG_CLK_QCOM_QCM2290) += clock-qcm2290.o obj-$(CONFIG_CLK_QCOM_QCS404) += clock-qcs404.o obj-$(CONFIG_CLK_QCOM_SA8775P) += clock-sa8775p.o +obj-$(CONFIG_CLK_QCOM_SC7180) += clock-sc7180.o obj-$(CONFIG_CLK_QCOM_SC7280) += clock-sc7280.o obj-$(CONFIG_CLK_QCOM_SM6115) += clock-sm6115.o obj-$(CONFIG_CLK_QCOM_SM8150) += clock-sm8150.o
drivers/clk/qcom/clock-sc7180.c new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 3/17 clk/stub: add sc7180-rpmh clock
In reply to Stephen BoydStub the RPMh clock controller on SC7180
--- drivers/clk/clk-stub.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/clk-stub.c +1 -0
@@ -51,6 +51,7 @@ static struct clk_ops stub_clk_ops = {static const struct udevice_id stub_clk_ids[] = { { .compatible ="qcom,rpmcc" }, { .compatible ="qcom,sdm845-rpmh-clk" }, + { .compatible ="qcom,sc7180-rpmh-clk" }, { .compatible ="qcom,sc7280-rpmh-clk" }, { .compatible ="qcom,sm8150-rpmh-clk" }, { .compatible ="qcom,sm8250-rpmh-clk" },
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 4/17 pinctrl: qcom: Add driver for sc7180
In reply to Stephen BoydAdd a driver for Qualcomm's sc7180 pinctrl device (TLMM). This is largely a copy of a similar driver in U-Boot along with reference to the Linux driver to fix up the data properly.
--- drivers/pinctrl/qcom/Kconfig | 8 ++ drivers/pinctrl/qcom/Makefile | 1 + drivers/pinctrl/qcom/pinctrl-sc7180.c | 131 ++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 drivers/pinctrl/qcom/pinctrl-sc7180.c
drivers/pinctrl/qcom/Kconfig +8 -0
@@ -55,11 +55,19 @@ config PINCTRL_QCOM_SA8775P Say Y here to enable support for pinctrl on the Snapdragon SA8775P SoC, as well as the associated GPIO driver. +config PINCTRL_QCOM_SC7180 + bool "Qualcomm SC7180 Pinctrl" + select PINCTRL_QCOM + help + Say Y here to enable support for pinctrl on the Snapdragon SC7180 SoC, + as well as the associated GPIO driver. + config PINCTRL_QCOM_SC7280 bool "Qualcomm SC7280/QCM6490 Pinctrl" select PINCTRL_QCOM help Say Y here to enable support for pinctrl on the Snapdragon SC7280 SoC, + as well as the associated GPIO driver. config PINCTRL_QCOM_SDM660 bool "Qualcomm SDM630/660 Pinctrl"
drivers/pinctrl/qcom/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_PINCTRL_QCOM_APQ8096) += pinctrl-apq8096.o obj-$(CONFIG_PINCTRL_QCOM_QCM2290) += pinctrl-qcm2290.o obj-$(CONFIG_PINCTRL_QCOM_QCS404) += pinctrl-qcs404.o obj-$(CONFIG_PINCTRL_QCOM_SA8775P) += pinctrl-sa8775p.o +obj-$(CONFIG_PINCTRL_QCOM_SC7180) += pinctrl-sc7180.o obj-$(CONFIG_PINCTRL_QCOM_SC7280) += pinctrl-sc7280.o obj-$(CONFIG_PINCTRL_QCOM_SDM660) += pinctrl-sdm660.o obj-$(CONFIG_PINCTRL_QCOM_SDM845) += pinctrl-sdm845.o
drivers/pinctrl/qcom/pinctrl-sc7180.c new file +131 -0
131 lines not on this page · raw message
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 5/17 spi: Add Qualcomm GENI SPI driver
In reply to Stephen BoydAdd a SPI driver for Qualcomm's GENI hardware.
--- drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-geni-qcom.c | 545 ++++++++++++++++++++++++++++++++++++ 3 files changed, 556 insertions(+) create mode 100644 drivers/spi/spi-geni-qcom.c
drivers/spi/Kconfig +10 -0
@@ -430,6 +430,16 @@ config SPI_QUP mode supports up to 50MHz, up to four chip selects, programmable data path from 4 bits to 32 bits and numerous protocol variants. +config SPI_GENI_QCOM + bool "Qualcomm Generic Interface (GENI) SPI controller" + depends on ARCH_SNAPDRAGON + help + Support for the Qualcomm Generic Interface (GENI) SPI controller. + The Generic Interface (GENI) is a firmware based Qualcomm Universal + Peripherals (QUP) Serial Engine (SE) Wrapper which can support multiple + bus protocols depending on the firmware type loaded at early boot time + based on system configuration. + config RENESAS_RPC_SPI bool "Renesas RPC SPI driver" depends on RCAR_64 || RZA1
drivers/spi/Makefile +1 -0
@@ -66,6 +66,7 @@ obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o obj-$(CONFIG_PIC32_SPI) += pic32_spi.o obj-$(CONFIG_PL022_SPI) += pl022_spi.o obj-$(CONFIG_SPI_QUP) += spi-qup.o +obj-$(CONFIG_SPI_GENI_QCOM) += spi-geni-qcom.o obj-$(CONFIG_SPI_MXIC) += spi-mxic.o obj-$(CONFIG_RENESAS_RPC_SPI) += renesas_rpc_spi.o obj-$(CONFIG_ROCKCHIP_SFC) += rockchip_sfc.o
drivers/spi/spi-geni-qcom.c new file +545 -0
545 lines not on this page · raw message
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 6/17 coreboot: Move coreboot logic out of x86 to a generic place
In reply to Stephen BoydLay the groundwork to run U-Boot as a payload on ARM coreboot based devices. Move the coreboot table parsing code out of arch/x86 into lib/coreboot. The headers like cb_sysinfo.h and coreboot_tables.h need to be globally accessible, so move them into the top level include directory. Introduce helper functions like board_get_usable_ram_top_from_coreboot(), dram_init_from_coreboot(), and dram_init_banksize_from_coreboot() so that boards can still override these common functions while also supporting booting as a coreboot payload.
---
arch/x86/Kconfig | 22 ------
arch/x86/cpu/coreboot/Kconfig | 33 --------
arch/x86/cpu/coreboot/coreboot.c | 4 +-
arch/x86/cpu/coreboot/sdram.c | 78 +------------------
arch/x86/cpu/coreboot/timestamp.c | 2 +-
arch/x86/cpu/cpu.c | 2 +-
arch/x86/cpu/i386/cpu.c | 2 +-
.../x86/include/asm/arch-coreboot/timestamp.h | 2 +-
arch/x86/lib/coreboot/Makefile | 1 -
arch/x86/lib/coreboot/cb_support.c | 2 +-
arch/x86/lib/coreboot_table.c | 2 +-
arch/x86/lib/tables.c | 2 +-
board/coreboot/coreboot/coreboot.c | 2 +-
board/coreboot/coreboot/sysinfo.c | 2 +-
board/google/chromebook_coral/coral.c | 2 +-
boot/Kconfig | 1 +
boot/expo_build_cb.c | 2 +-
cmd/version.c | 2 +-
cmd/x86/cbcmos.c | 2 +-
cmd/x86/cbsysinfo.c | 2 +-
drivers/misc/cbmem_console.c | 2 +-
drivers/serial/serial_coreboot.c | 2 +-
drivers/video/coreboot.c | 2 +-
.../x86/include/asm => include}/cb_sysinfo.h | 22 +++++-
.../include/asm => include}/coreboot_tables.h | 0
lib/Makefile | 2 +
lib/coreboot/Kconfig | 55 +++++++++++++
lib/coreboot/Makefile | 17 ++++
{arch/x86/lib => lib}/coreboot/cb_sysinfo.c | 14 +---
{arch/x86/cpu => lib}/coreboot/sdram.c | 15 +---
30 files changed, 125 insertions(+), 173 deletions(-)
delete mode 100644 arch/x86/cpu/coreboot/Kconfig
rename {arch/x86/include/asm => include}/cb_sysinfo.h (94%)
rename {arch/x86/include/asm => include}/coreboot_tables.h (100%)
create mode 100644 lib/coreboot/Kconfig
create mode 100644 lib/coreboot/Makefile
rename {arch/x86/lib => lib}/coreboot/cb_sysinfo.c (95%)
copy {arch/x86/cpu => lib}/coreboot/sdram.c (87%)arch/x86/Kconfig +0 -22
@@ -119,7 +119,6 @@ source "arch/x86/cpu/apollolake/Kconfig" source "arch/x86/cpu/baytrail/Kconfig" source "arch/x86/cpu/braswell/Kconfig" source "arch/x86/cpu/broadwell/Kconfig" -source "arch/x86/cpu/coreboot/Kconfig" source "arch/x86/cpu/ivybridge/Kconfig" source "arch/x86/cpu/efi/Kconfig" source "arch/x86/cpu/qemu/Kconfig"
@@ -1049,27 +1048,6 @@ config INTEL_GMA_SWSMISCI endif # INTEL_SOC -config COREBOOT_SYSINFO - bool "Support reading coreboot sysinfo" - default y if SYS_COREBOOT - help - Select this option to read the coreboot sysinfo table on start-up, - if present. This is written by coreboot before it exits and provides - various pieces of information about the running system, including - display, memory and build information. It is stored in - struct sysinfo_t after parsing by get_coreboot_info(). - -config SPL_COREBOOT_SYSINFO - bool "Support reading coreboot sysinfo" - depends on SPL - default y if COREBOOT_SYSINFO - help - Select this option to read the coreboot sysinfo table in SPL, - if present. This is written by coreboot before it exits and provides - various pieces of information about the running system, including - display, memory and build information. It is stored in - struct sysinfo_t after parsing by get_coreboot_info(). - config ZBOOT bool "Support the zImage format" default y
arch/x86/cpu/coreboot/Kconfig deleted +0 -33
@@ -1,33 +0,0 @@ -if VENDOR_COREBOOT - -config SYS_COREBOOT - bool - default y - imply SYS_NS16550 - imply SCSI - imply SCSI_AHCI - imply AHCI_PCI - 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 VIDEO_COREBOOT - imply E1000 - imply ETH_DESIGNWARE - imply PCH_GBE - imply RTL8169 - imply CMD_CBFS - imply FS_CBFS - imply CBMEM_CONSOLE - imply X86_TSC_READ_BASE - imply USE_PREBOOT - select BINMAN if X86_RUN_64BIT - select SYSINFO - imply SYSINFO_EXTRA - -endif
arch/x86/cpu/coreboot/coreboot.c +3 -1
@@ -5,6 +5,7 @@* Graeme Russ, [email protected]. */ +#include <cb_sysinfo.h> #include <cpu_func.h> #include <event.h> #include <fdtdec.h>
@@ -14,7 +15,6 @@#include <asm/io.h> #include <asm/msr.h> #include <asm/mtrr.h> -#include <asm/cb_sysinfo.h> #include <asm/arch/timestamp.h> #include <dm/ofnode.h>
@@ -32,6 +32,8 @@ int arch_cpu_init(void)printf ("Failed to parse coreboot tables.\n" );return ret; } +gd_set_acpi_start (map_to_sysmem (lib_sysinfo.rsdp)); +gd_set_smbios_start (lib_sysinfo.smbios_start);timestamp_init ();
arch/x86/cpu/coreboot/sdram.c +4 -74
102 lines not on this page · raw message
arch/x86/cpu/coreboot/timestamp.c +1 -1
@@ -6,9 +6,9 @@*/ #include <bootstage.h> +#include <cb_sysinfo.h> #include <errno.h> #include <asm/arch/timestamp.h> -#include <asm/cb_sysinfo.h> #include <asm/u-boot-x86.h> #include <linux/compiler.h>
arch/x86/cpu/cpu.c +1 -1
@@ -22,6 +22,7 @@#include <bootstage.h> #include <command.h> +#include <coreboot_tables.h> #include <cpu_func.h> #include <dm.h> #include <errno.h>
@@ -35,7 +36,6 @@#include <acpi/acpi_table.h> #include <asm/acpi.h> #include <asm/control_regs.h> -#include <asm/coreboot_tables.h> #include <asm/cpu.h> #include <asm/global_data.h> #include <asm/lapic.h>
arch/x86/cpu/i386/cpu.c +1 -1
@@ -18,13 +18,13 @@* src/arch/x86/lib/cpu.c */ +#include <coreboot_tables.h> #include <cpu_func.h> #include <init.h> #include <log.h> #include <malloc.h> #include <spl.h> #include <asm/control_regs.h> -#include <asm/coreboot_tables.h> #include <asm/cpu.h> #include <asm/global_data.h> #include <asm/mp.h>
arch/x86/include/asm/arch-coreboot/timestamp.h +1 -1
@@ -8,7 +8,7 @@#ifndef __COREBOOT_TIMESTAMP_H__#define __COREBOOT_TIMESTAMP_H__ -#include <asm/cb_sysinfo.h> +#include <cb_sysinfo.h> void timestamp_init (void );void timestamp_add (enum timestamp_id id,uint64_t ts_time);
arch/x86/lib/coreboot/Makefile +0 -1
@@ -3,5 +3,4 @@ # Copyright 2021 Google LLC # -obj-y += cb_sysinfo.o obj-y += cb_support.o
arch/x86/lib/coreboot/cb_support.c +1 -1
@@ -5,7 +5,7 @@* Copyright 2021 Google LLC */ -#include <asm/cb_sysinfo.h> +#include <cb_sysinfo.h> #include <asm/e820.h> #include <linux/kernel.h>
arch/x86/lib/coreboot_table.c +1 -1
@@ -3,11 +3,11 @@* Copyright (C) 2016, Bin Meng <[email protected]> */ +#include <coreboot_tables.h> #include <malloc.h> #include <net.h> #include <vesa.h> #include <acpi/acpi_s3.h> -#include <asm/coreboot_tables.h> #include <asm/e820.h> #include <asm/global_data.h>
arch/x86/lib/tables.c +1 -1
@@ -6,6 +6,7 @@#define LOG_CATEGORY LOGC_ACPI#include <bloblist.h> +#include <coreboot_tables.h> #include <log.h> #include <malloc.h> #include <smbios.h>
@@ -14,7 +15,6 @@#include <asm/sfi.h> #include <asm/mpspec.h> #include <asm/tables.h> -#include <asm/coreboot_tables.h> #include <linux/log2.h> #include <linux/sizes.h>
board/coreboot/coreboot/coreboot.c +1 -1
@@ -3,10 +3,10 @@* Copyright (C) 2018, Bin Meng <[email protected]> */ +#include <cb_sysinfo.h> #include <splash.h> #include <init.h> #include <smbios.h> -#include <asm/cb_sysinfo.h> #include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR ;
board/coreboot/coreboot/sysinfo.c +1 -1
@@ -6,10 +6,10 @@* Written by Simon Glass <[email protected]> */ +#include <cb_sysinfo.h> #include <dm.h> #include <smbios.h> #include <sysinfo.h> -#include <asm/cb_sysinfo.h> struct cb_sysinfo_priv {const struct smbios_header *bios;
board/google/chromebook_coral/coral.c +1 -1
@@ -6,6 +6,7 @@#define LOG_CATEGORY UCLASS_SYSINFO#include <bloblist.h> +#include <cb_sysinfo.h> #include <command.h> #include <cros_ec.h> #include <dm.h>
@@ -16,7 +17,6 @@#include <acpi/acpigen.h> #include <asm-generic/gpio.h> #include <asm/acpi_nhlt.h> -#include <asm/cb_sysinfo.h> #include <asm/intel_gnvs.h> #include <asm/intel_pinctrl.h> #include <dm/acpi.h>
boot/Kconfig +1 -0
@@ -1,5 +1,6 @@ menu "Boot options" +source "lib/coreboot/Kconfig" source "lib/efi_loader/Kconfig" menu "Boot images"
boot/expo_build_cb.c +1 -1
@@ -8,6 +8,7 @@#define LOG_CATEGORY LOGC_EXPO +#include <cb_sysinfo.h> #include <cedit.h> #include <ctype.h> #include <errno.h>
@@ -15,7 +16,6 @@#include <log.h> #include <malloc.h> #include <vsprintf.h> -#include <asm/cb_sysinfo.h> /** * struct build_info - Information to use when building
cmd/version.c +1 -1
@@ -10,7 +10,7 @@#include <version_string.h> #include <linux/compiler.h> #ifdef CONFIG_SYS_COREBOOT -#include <asm/cb_sysinfo.h> +#include <cb_sysinfo.h> #endif static int do_version(struct cmd_tbl *cmdtp, int flag, int argc,
cmd/x86/cbcmos.c +1 -1
@@ -7,10 +7,10 @@#define LOG_CATEGORY UCLASS_RTC +#include <cb_sysinfo.h> #include <command.h> #include <dm.h> #include <rtc.h> -#include <asm/cb_sysinfo.h> #include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR ;
cmd/x86/cbsysinfo.c +1 -1
@@ -4,7 +4,7 @@* Written by Simon Glass <[email protected]> */ -#include <asm/cb_sysinfo.h> +#include <cb_sysinfo.h> #include <command.h> #include <console.h> #include <asm/global_data.h>
drivers/misc/cbmem_console.c +1 -1
@@ -3,9 +3,9 @@* Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. */ +#include <cb_sysinfo.h> #include <console.h> #include <linux/string.h> -#include <asm/cb_sysinfo.h> void cbmemc_putc (struct stdio_dev *dev,char data) {
drivers/serial/serial_coreboot.c +1 -1
@@ -7,12 +7,12 @@#define LOG_CATGEGORY UCLASS_SERIAL +#include <cb_sysinfo.h> #include <dm.h> #include <log.h> #include <ns16550.h> #include <serial.h> #include <acpi/acpi_table.h> -#include <asm/cb_sysinfo.h> DECLARE_GLOBAL_DATA_PTR ;
drivers/video/coreboot.c +1 -1
@@ -3,11 +3,11 @@* Copyright (C) 2016, Bin Meng <[email protected]> */ +#include <cb_sysinfo.h> #include <dm.h> #include <init.h> #include <vesa.h> #include <video.h> -#include <asm/cb_sysinfo.h> static int save_vesa_mode (struct cb_framebuffer *fb,struct vesa_mode_info *vesa)
include/cb_sysinfo.h renamed from arch/x86/include/asm/cb_sysinfo.h +21 -1
@@ -8,7 +8,7 @@#ifndef _COREBOOT_SYSINFO_H#define _COREBOOT_SYSINFO_H -#include <asm/coreboot_tables.h> +#include <coreboot_tables.h> #include <linux/types.h> /* Maximum number of memory range definitions */
@@ -246,4 +246,24 @@ int get_coreboot_info(struct sysinfo_t *info);*/ const struct sysinfo_t *cb_get_sysinfo (void ); +/** +* coreboot_dram_init_banksize() - Initilize RAM banksize from coreboot sysinfo +* table +*/ +int coreboot_dram_init_banksize (void ); + +/** +* coreboot_dram_init() - Configure available RAM banks from coreboot sysinfo +* table +*/ +int coreboot_dram_init (void ); + +/** +* coreboot_board_get_usable_ram_top() - Get the top of RAM usable by U-Boot +* while running as a coreboot payload +* +* Return: Physical address as the top of RAM +*/ +phys_addr_t coreboot_board_get_usable_ram_top (phys_size_t total_size); +#endif
include/coreboot_tables.h renamed from arch/x86/include/asm/coreboot_tables.h +0 -0
lib/Makefile +2 -0
@@ -136,6 +136,8 @@ obj-$(CONFIG_LIB_UUID) += uuid.o obj-$(CONFIG_LIB_RAND) += rand.o obj-y += panic.o +obj-$(CONFIG_$(XPL_)COREBOOT_SYSINFO) += coreboot/ + ifeq ($(CONFIG_XPL_BUILD),y) # SPL U-Boot may use full-printf, tiny-printf or none at all ifdef CONFIG_$(PHASE_)USE_TINY_PRINTF
lib/coreboot/Kconfig new file +55 -0
55 lines not on this page · raw message
lib/coreboot/Makefile new file +17 -0
@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2011 The Chromium OS Authors. +# +# (C) Copyright 2008 +# Graeme Russ, [email protected]. +# +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, [email protected]. +# +# (C) Copyright 2002 +# Daniel Engström, Omicron Ceti AB, [email protected]. + +obj-y += cb_sysinfo.o +ifndef CONFIG_XPL_BUILD +obj-y += sdram.o +endif
lib/coreboot/cb_sysinfo.c renamed from arch/x86/lib/coreboot/cb_sysinfo.c +1 -13
@@ -6,7 +6,7 @@* Copyright (C) 2009 coresystems GmbH */ -#include <asm/cb_sysinfo.h> +#include <cb_sysinfo.h> #include <init.h> #include <mapmem.h> #include <net.h>
@@ -23,13 +23,6 @@ DECLARE_GLOBAL_DATA_PTR;*/ struct sysinfo_t lib_sysinfo __section(".data"); -/* -* Some of this is x86 specific, and the rest of it is generic. Right now, -* since we only support x86, we'll avoid trying to make lots of infrastructure -* we don't need. If in the future, we want to use coreboot on some other -* architecture, then take out the generic parsing code and move it elsewhere. -*/ -/* === Parsing code === */ /* This is the generic parsing code */
@@ -453,9 +446,6 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)return 1 ; } -/* == Architecture specific == */ -/* This is the x86 specific stuff */ -int get_coreboot_info (struct sysinfo_t *info) {long addr;
@@ -470,8 +460,6 @@ int get_coreboot_info(struct sysinfo_t *info)if (!ret)return -ENOENT ; gd->arch.coreboot_table = addr; -gd_set_acpi_start (map_to_sysmem (info->rsdp)); -gd_set_smbios_start (info->smbios_start); gd->flags |=GD_FLG_SKIP_LL_INIT ;return 0 ;
lib/coreboot/sdram.c renamed from arch/x86/cpu/coreboot/sdram.c +4 -11
@@ -6,18 +6,11 @@*/ #include <init.h> -#include <asm/e820.h> -#include <asm/cb_sysinfo.h> +#include <cb_sysinfo.h> #include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR ; -unsigned int install_e820_map (unsigned int max_entries, -struct e820_entry *entries) -{ -return cb_install_e820_map (max_entries, entries); -} -/* * This function looks for the highest region of memory lower than 4GB which * has enough space for U-Boot where U-Boot is aligned on a page boundary. It
@@ -26,7 +19,7 @@ unsigned int install_e820_map(unsigned int max_entries,* address, and how far U-Boot is moved by relocation are set in the global * data structure. */ -phys_addr_t board_get_usable_ram_top (phys_size_t total_size) +phys_addr_t coreboot_board_get_usable_ram_top (phys_size_t total_size) {uintptr_t dest_addr =0 ;int i;
@@ -60,7 +53,7 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)return (ulong )dest_addr; } -int dram_init (void ) +int coreboot_dram_init (void ) {int i;phys_size_t ram_size =0 ;
@@ -80,7 +73,7 @@ int dram_init(void)return 0 ; } -int dram_init_banksize (void ) +int coreboot_dram_init_banksize (void ) {int i, j;
Signature · 1 line
Sent by a computer, using git, on the internet
Re: [PATCH v3 06/17] coreboot: Move coreboot logic out of x86 to a generic place
Quoted 10 lines · Stephen Boyd
Lay the groundwork to run U-Boot as a payload on ARM coreboot based devices. Move the coreboot table parsing code out of
arch/x86into lib/coreboot. The headers likecb_sysinfo.handcoreboot_tables.hneed to be globally accessible, so move them into the top level include directory. Introduce helper functions likeboard_get_usable_ram_top_from_coreboot(),dram_init_from_coreboot(), anddram_init_banksize_from_coreboot()so that boards can still override these common functions while also supporting booting as a coreboot payload.
Quoted 2 lines
Signed-off-by Stephen Boyd <[email protected]>---
If there's no other feedback, this is fine. But otherwise, I think the Makefile logic is a tad odd.
[snip]
lib/Makefile obj-$(CONFIG_LIB_UUID) += uuid.o · line 139
Quoted 9 lines
lib/Makefile +1
-0@@ -136,6 +136,8 @@ obj-$(CONFIG_LIB_UUID) += uuid.o obj-$(CONFIG_LIB_RAND) += rand.o obj-y += panic.o +obj-$(CONFIG_$(XPL_)COREBOOT_SYSINFO) += coreboot/
I think here we should always traverse the directory on CONFIG_VENDOR_COREBOOT (and later SYS_COREBOOT?).
[snip]
Quoted 10 lines
lib/coreboot/Makefile new file +4
-0@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2011 The Chromium OS Authors. +#
lib/coreboot/Makefile line 14
Quoted 10 lines
lib/coreboot/Makefile new file +10
-0+# (C) Copyright 2008 +# Graeme Russ, [email protected]. +# +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, [email protected]. +# +# (C) Copyright 2002 +# Daniel Engström, Omicron Ceti AB, [email protected]. + +obj-y += cb_sysinfo.o
Then here obj-$(CONFIG_$(XPL_)COREBOOT_SYSINFO) += cb_sysinfo.o and similar changes in later patches I suspect.
Signature · 1 line
Tom
PATCH v3 7/17 coreboot: Locate table earlier than arch_cpu_init()
In reply to Stephen BoydCurrently we locate the coreboot table in arch_cpu_init(). One of the first things that happens in initcall_run_f() initialization is fdtdec_setup() is called which could inspect the DTB for memory information (see mach-snapdragon's board_fdt_blob_setup() code). Introduce an initcall specifically to locate the coreboot table early on in the boot process so that board_fdt_blob_setup() can know that the memory is described in the coreboot tables instead of the DTB that's either embedded in the ELF file or provided by the earlier stage bootloader. This will also help in the future when we want to pick the DTB from a FIT image based on the board and revision ID bits in the coreboot tables.
--- arch/x86/cpu/coreboot/coreboot.c | 8 ++++---- common/board_f.c | 4 ++++ include/cb_sysinfo.h | 7 +++++++ lib/coreboot/cb_sysinfo.c | 11 +++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +4 -4
@@ -27,11 +27,11 @@ int arch_cpu_init(void)if (ret)return ret; - ret =get_coreboot_info (&lib_sysinfo); -if (ret !=0 ) { -printf ("Failed to parse coreboot tables.\n" ); -return ret; +if (!gd->arch.coreboot_table) +printf ("Failed to locate coreboot tables.\n" ); +return -ENOENT ; } +gd_set_acpi_start (map_to_sysmem (lib_sysinfo.rsdp));gd_set_smbios_start (lib_sysinfo.smbios_start);
common/board_f.c +4 -0
@@ -12,6 +12,7 @@#include <config.h> #include <bloblist.h> #include <bootstage.h> +#include <cb_sysinfo.h> #include <clock_legacy.h> #include <console.h> #include <cpu.h>
@@ -896,6 +897,9 @@ static void initcall_run_f(void)* For simplicity it should remain an ordered list of function calls. */ INITCALL (setup_mon_len); +#if CONFIG_IS_ENABLED (SYS_COREBOOT ) +INITCALL (coreboot_early_init); +#endif #if CONFIG_IS_ENABLED (OF_CONTROL )INITCALL (fdtdec_setup);#endif
include/cb_sysinfo.h +7 -0
@@ -239,6 +239,13 @@ extern struct sysinfo_t lib_sysinfo;*/ int get_coreboot_info (struct sysinfo_t *info); +/** +* coreboot_early_init() - locate the coreboot tables during early init +* +* Return: 0 +*/ +int coreboot_early_init (void ); +/** * cb_get_sysinfo() - get a pointer to the parsed coreboot sysinfo *
lib/coreboot/cb_sysinfo.c +11 -0
@@ -465,6 +465,17 @@ int get_coreboot_info(struct sysinfo_t *info)return 0 ; } +int coreboot_early_init (void ) +{ +int ret; + + ret =get_coreboot_info (&lib_sysinfo); +if (ret !=0 ) +debug ("Failed to parse coreboot tables.\n" ); + +return 0 ; +} +const struct sysinfo_t *cb_get_sysinfo (void ) {if (!ll_boot_init ())
Signature · 1 line
Sent by a computer, using git, on the internet
Re: [PATCH v3 07/17] coreboot: Locate table earlier than arch_cpu_init()
Quoted 12 lines · Stephen Boyd
Currently we locate the coreboot table in
arch_cpu_init(). One of the first things that happens ininitcall_run_f()initialization isfdtdec_setup()is called which could inspect the DTB for memory information (see mach-snapdragon'sboard_fdt_blob_setup()code). Introduce an initcall specifically to locate the coreboot table early on in the boot process so thatboard_fdt_blob_setup()can know that the memory is described in the coreboot tables instead of the DTB that's either embedded in the ELF file or provided by the earlier stage bootloader. This will also help in the future when we want to pick the DTB from a FIT image based on the board and revision ID bits in the coreboot tables.
Quoted 1 line
Signed-off-by Stephen Boyd <[email protected]>
Signature · 1 line
Tom
PATCH v3 8/17 arm: Support running U-Boot as a coreboot payload on ARM64
In reply to Stephen BoydAdd a 'coreboot' cpu to armv8 that looks for the coreboot table near the top of the 4G address space.
--- arch/arm/cpu/armv8/Makefile | 1 + arch/arm/cpu/armv8/coreboot/Makefile | 4 ++++ arch/arm/cpu/armv8/coreboot/cpu.c | 22 ++++++++++++++++++++++ arch/arm/include/asm/global_data.h | 3 +++ arch/x86/cpu/cpu.c | 13 ------------- include/cb_sysinfo.h | 7 +++++++ lib/coreboot/Kconfig | 14 +++++++------- lib/coreboot/cb_sysinfo.c | 13 +++++++++++++ 8 files changed, 57 insertions(+), 20 deletions(-) create mode 100644 arch/arm/cpu/armv8/coreboot/Makefile create mode 100644 arch/arm/cpu/armv8/coreboot/cpu.c
arch/arm/cpu/armv8/Makefile +1 -0
@@ -48,3 +48,4 @@ obj-$(CONFIG_ARMV8_CE_SHA1) += sha1_ce_glue.o sha1_ce_core.o obj-$(CONFIG_ARMV8_CE_SHA256) += sha256_ce_glue.o sha256_ce_core.o obj-$(CONFIG_SYSINFO_SMBIOS) += sysinfo.o +obj-$(CONFIG_SYS_COREBOOT) += coreboot/
arch/arm/cpu/armv8/coreboot/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += cpu.o +
arch/arm/cpu/armv8/coreboot/cpu.c new file +22 -0
@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <cb_sysinfo.h> +#include <linux/errno.h> +#include <linux/sizes.h> +#include <log.h> + +long locate_coreboot_table (void ) +{ +long addr; + +/* +* We look for LBIO somewhere inside the CBMEM arena, which is +* typically at the top of the first 4G of RAM. +*/ + addr =detect_coreboot_table_at (SZ_4G -SZ_8M ,SZ_8M ); +if (addr <0 ) +return -ENOENT ; + +debug ("Located coreboot table at %#lx\n" , addr); +return addr; +}
arch/arm/include/asm/global_data.h +3 -0
@@ -108,6 +108,9 @@ struct arch_global_data {#ifdef CONFIG_SMBIOS ulong smbios_start;/* Start address of SMBIOS table */ #endif +#ifdef CONFIG_SYS_COREBOOT +ulong coreboot_table;/* Address of coreboot table */ +#endif };#include <asm-generic/global_data.h>
arch/x86/cpu/cpu.c +0 -13
@@ -340,19 +340,6 @@ int reserve_arch(void) }#endif -static long detect_coreboot_table_at (ulong start,ulong size) -{ -u32 *ptr, *end; - - size /=4 ; -for (ptr = (void *)start, end = ptr + size; ptr < end; ptr +=4 ) { -if (*ptr ==0x4f49424c )/* "LBIO" */ -return (long )ptr; - } - -return -ENOENT ; -} -long locate_coreboot_table (void ) {long addr;
include/cb_sysinfo.h +7 -0
@@ -228,6 +228,13 @@ struct sysinfo_t {extern struct sysinfo_t lib_sysinfo; +/** +* detect_coreboot_table_at() - Helper to find coreboot table +* +* Return: Address of coreboot table or -ENOENT on failure +*/ +long detect_coreboot_table_at (ulong start,ulong size); +/** * get_coreboot_info() - parse the coreboot sysinfo table *
lib/coreboot/Kconfig +7 -7
@@ -1,9 +1,9 @@ menu "U-Boot as Coreboot payload" - depends on VENDOR_COREBOOT + depends on ARM64 || VENDOR_COREBOOT config SYS_COREBOOT - bool - default y + bool "Support for booting u-boot as a coreboot payload" if ARM64 + default VENDOR_COREBOOT imply SYS_NS16550 imply SCSI imply SCSI_AHCI
@@ -17,15 +17,15 @@ config SYS_COREBOOT imply USB_XHCI_HCD imply USB_STORAGE imply USB_KEYBOARD - imply VIDEO_COREBOOT - imply E1000 + imply VIDEO_COREBOOT if x86 + imply E1000 if x86 imply ETH_DESIGNWARE - imply PCH_GBE + imply PCH_GBE if X86 imply RTL8169 imply CMD_CBFS imply FS_CBFS imply CBMEM_CONSOLE - imply X86_TSC_READ_BASE + imply X86_TSC_READ_BASE if X86 imply USE_PREBOOT select BINMAN if X86_RUN_64BIT select SYSINFO
lib/coreboot/cb_sysinfo.c +13 -0
@@ -446,6 +446,19 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)return 1 ; } +long detect_coreboot_table_at (ulong start,ulong size) +{ +u32 *ptr, *end; + + size /=4 ; +for (ptr = (void *)start, end = ptr + size; ptr < end; ptr +=4 ) { +if (*ptr ==0x4f49424c )/* "LBIO" */ +return (long )ptr; + } + +return -ENOENT ; +} +int get_coreboot_info (struct sysinfo_t *info) {long addr;
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 9/17 cmd/cbsysinfo: Skip the CMOS 'option_table' when not present
In reply to Stephen BoydThe CMOS 'option_table' isn't populated on ARM devices running coreboot. Check to see if the pointer is NULL and bail out if it is.
--- cmd/x86/cbsysinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/x86/cbsysinfo.c +1 -1
@@ -224,7 +224,7 @@ static void show_option_table(const struct cb_cmos_option_table *tab)const void *ptr, *end;print_ptr ("option_table" , tab); -if (!tab->size) +if (!tab || !tab->size)return ;printf (" Bit Len Cfg ID Name\n" );
Signature · 1 line
Sent by a computer, using git, on the internet
Re: [PATCH v3 09/17] cmd/cbsysinfo: Skip the CMOS 'option_table' when not present
Quoted 4 lines · Stephen Boyd
The CMOS '
option_table' isn't populated on ARM devices running coreboot. Check to see if the pointer is NULL and bail out if it is.Signed-off-by Stephen Boyd <[email protected]>
Signature · 1 line
Tom
PATCH v3 10/17 cmd/cbsysinfo: Allow on ARM as well
In reply to Stephen BoydThis command isn't x86 specific. Move it up one level so that it can be used on a platform that can find the coreboot table, i.e. x86 or ARM.
---
cmd/Kconfig | 4 ++--
cmd/Makefile | 1 +
cmd/{x86 => }/cbsysinfo.c | 0
cmd/x86/Makefile | 1 -
4 files changed, 3 insertions(+), 3 deletions(-)
rename cmd/{x86 => }/cbsysinfo.c (100%)cmd/Kconfig +2 -2
@@ -2929,8 +2929,8 @@ menu "Debug commands" config CMD_CBSYSINFO bool "cbsysinfo" - depends on X86 - default y if SYS_COREBOOT + depends on SYS_COREBOOT + default y help This provides information about the coreboot sysinfo table stored in memory by coreboot before jumping to U-Boot. It can be useful for
cmd/Makefile +1 -0
@@ -44,6 +44,7 @@ obj-$(CONFIG_CMD_BUTTON) += button.o obj-$(CONFIG_CMD_CAT) += cat.o obj-$(CONFIG_CMD_CACHE) += cache.o obj-$(CONFIG_CMD_CBFS) += cbfs.o +obj-$(CONFIG_CMD_CBSYSINFO) += cbsysinfo.o obj-$(CONFIG_CMD_CEDIT) += cedit.o obj-$(CONFIG_CMD_CLK) += clk.o obj-$(CONFIG_CMD_CLS) += cls.o
cmd/cbsysinfo.c renamed from cmd/x86/cbsysinfo.c +0 -0
cmd/x86/Makefile +0 -1
@@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0+ -obj-$(CONFIG_CMD_CBSYSINFO) += cbsysinfo.o obj-y += cpuid.o msr.o mtrr.o obj-$(CONFIG_CMD_CBCMOS) += cbcmos.o obj-$(CONFIG_CMD_EXCEPTION) += exception.o
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 11/17 coreboot: Parse sku_id/fw_config from coreboot tables
In reply to Stephen BoydThe SKU ID is part of the coreboot tables. Historically, it was under the coreboot tag for sku_id specifically, but modern coreboot versions have put all the ID values together in one entry CB_TAG_BOARD_CONFIG along with fw_config. Parse that tag to populate the sku_id and fw_config fields.
--- cmd/cbsysinfo.c | 2 ++ include/cb_sysinfo.h | 4 ++++ include/coreboot_tables.h | 11 +++++++++++ lib/coreboot/cb_sysinfo.c | 15 +++++++++++++++ 4 files changed, 32 insertions(+)
cmd/cbsysinfo.c +2 -0
@@ -418,6 +418,8 @@ static void show_table(struct sysinfo_t *info, bool verbose)print_ptr ("MRC cache" , info->mrc_cache);print_ptr ("ACPI GNVS" , info->acpi_gnvs);print_hex ("Board ID" , info->board_id); +print_hex ("SKU ID" , info->sku_id); +print_addr64 ("FWCONFIG" , info->fw_config);print_hex ("RAM code" , info->ram_code);print_ptr ("WiFi calib" , info->wifi_calibration);print_addr64 ("Ramoops buff" , info->ramoops_buffer);
include/cb_sysinfo.h +4 -0
@@ -114,6 +114,8 @@* acpi_gnvs: @Pointer to Intel Global NVS struct, see struct acpi_global_nvs * @board_id: Board ID indicating the board variant, typically 0xffffffff * @ram_code: RAM code indicating the SDRAM type, typically 0xffffffff +* @sku_id: SKU ID indicating the board SKU, typically 0xffffffff +* @fw_config: FW config indicating the firmware configuration, typically 0xffffffff * @wifi_calibration: WiFi calibration info, NULL if none * @ramoops_buffer: Address of kernel Ramoops buffer * @ramoops_buffer_size: Sizeof of Ramoops buffer, typically 1MB
@@ -204,6 +206,8 @@ struct sysinfo_t {void *acpi_gnvs;u32 board_id;u32 ram_code; +u32 sku_id; +u64 fw_config;void *wifi_calibration;u64 ramoops_buffer;u32 ramoops_buffer_size;
include/coreboot_tables.h +11 -0
@@ -438,6 +438,17 @@ struct cb_tsc_info {#define CB_TAG_SERIALNO 0x002a#define CB_MAX_SERIALNO_LENGTH 32 +#define CB_TAG_BOARD_CONFIG 0x0040 +struct cb_board_config { +u32 tag; +u32 size; + +u64 fw_config; +u32 board_id; +u32 ram_code; +u32 sku_id; +}; +#define CB_TAG_ACPI_RSDP 0x0043#define CB_TAG_CMOS_OPTION_TABLE 0x00c8
lib/coreboot/cb_sysinfo.c +15 -0
@@ -141,6 +141,16 @@ static void cb_parse_acpi_gnvs(unsigned char *ptr, struct sysinfo_t *info) info->acpi_gnvs =map_sysmem (cbmem->cbmem_tab,0 ); } +static void cb_parse_board_config (unsigned char *ptr,struct sysinfo_t *info) +{ +struct cb_board_config *const cbbcfg = (struct cb_board_config *)ptr; + + info->board_id = cbbcfg->board_id; + info->ram_code = cbbcfg->ram_code; + info->sku_id = cbbcfg->sku_id; + info->fw_config = cbbcfg->fw_config; +} +static void cb_parse_board_id (unsigned char *ptr,struct sysinfo_t *info) {struct cb_board_id *const cbbid = (struct cb_board_id *)ptr;
@@ -295,6 +305,8 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)*/ info->board_id = ~0 ; info->ram_code = ~0 ; + info->sku_id = ~0 ; + info->fw_config = ~0ULL ;/* Now, walk the tables */ ptr += header->header_bytes;
@@ -395,6 +407,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info)case CB_TAG_CBMEM_ENTRY :cb_parse_cbmem_entry (ptr, info);break ; +case CB_TAG_BOARD_CONFIG : +cb_parse_board_config (ptr, info); +break ;case CB_TAG_BOARD_ID :cb_parse_board_id (ptr, info);break ;
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 12/17 pstore: Add pstore address from coreboot tables
In reply to Stephen BoydSet the pstore address and size based on the coreboot tables if the coreboot tables are populated.
--- cmd/pstore.c | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-)
cmd/pstore.c +35 -9
@@ -3,8 +3,10 @@* Copyright © 2019 Collabora Ltd */ +#include <cb_sysinfo.h> #include <config.h> #include <command.h> +#include <event.h> #include <fdtdec.h> #include <fs.h> #include <log.h>
@@ -141,6 +143,19 @@ static void pstore_init_buffer_size(void) buffer_size = pstore_pmsg_size; } +static void pstore_set_end (void ) +{ +if (pstore_length < (pstore_record_size + pstore_console_size + + pstore_ftrace_size + pstore_pmsg_size)) { +printf ("pstore <len> should be larger than the sum of all records sizes\n" ); + pstore_length =0 ; + } + +log_debug ("pstore set done: start 0x%08llx - length 0x%llx\n" , + (unsigned long long )pstore_addr, + (unsigned long long )pstore_length); +} +/** * pstore_set() - Initialize PStore settings from command line arguments * @cmdtp: Command data struct pointer
@@ -194,19 +209,30 @@ static int pstore_set(struct cmd_tbl *cmdtp, int flag, int argc,if (argc >7 ) pstore_ecc_size =hextoul (argv[7 ],NULL ); -if (pstore_length < (pstore_record_size + pstore_console_size - + pstore_ftrace_size + pstore_pmsg_size)) { -printf ("pstore <len> should be larger than the sum of all records sizes\n" ); - pstore_length =0 ; - } - -log_debug ("pstore set done: start 0x%08llx - length 0x%llx\n" , - (unsigned long long )pstore_addr, - (unsigned long long )pstore_length); +pstore_set_end ();return 0 ; } +#if CONFIG_IS_ENABLED (SYS_COREBOOT ) +static int pstore_coreboot_init (void ) +{ +const struct sysinfo_t *sysinfo; + + sysinfo =cb_get_sysinfo (); +if (!sysinfo) +return 0 ; + + pstore_addr = sysinfo->ramoops_buffer; + pstore_length = sysinfo->ramoops_buffer_size; + +pstore_set_end (); + +return 0 ; +} +EVENT_SPY_SIMPLE (EVT_LAST_STAGE_INIT , pstore_coreboot_init); +#endif +/** * pstore_print_buffer() - Print buffer * @type: buffer type
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 13/17 coreboot: Add /firmware/coreboot node to DT
In reply to Stephen BoydPopulate the firmware node with a coreboot node detailing where the coreboot tables and CBMEM area are located.
--- boot/image-fdt.c | 4 ++ include/cb_sysinfo.h | 7 +++ lib/coreboot/cb_sysinfo.c | 120 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+)
boot/image-fdt.c +4 -0
@@ -8,6 +8,7 @@* Wolfgang Denk, DENX Software Engineering, [email protected]. */ +#include <cb_sysinfo.h> #include <command.h> #include <fdt_support.h> #include <fdtdec.h>
@@ -619,6 +620,9 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb)#if IS_ENABLED (CONFIG_CMD_PSTORE )/* Append PStore configuration */ fdt_fixup_pstore (blob); +#endif +#if CONFIG_IS_ENABLED (SYS_COREBOOT ) +fdt_fixup_coreboot (blob);#endif if (IS_ENABLED (CONFIG_OF_BOARD_SETUP )) {const char *skip_board_fixup;
include/cb_sysinfo.h +7 -0
@@ -264,6 +264,13 @@ int coreboot_early_init(void);*/ const struct sysinfo_t *cb_get_sysinfo (void ); +/** +* fdt_fixup_coreboot() - Add the /firmware/coreboot node to the FDT +* +* Add the /firmware/coreboot node to the FDT if U-Boot is a coreboot payload. +*/ +void fdt_fixup_coreboot (void *blob); +/** * coreboot_dram_init_banksize() - Initilize RAM banksize from coreboot sysinfo * table
lib/coreboot/cb_sysinfo.c +120 -0
129 lines not on this page · raw message
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 14/17 coreboot: Move timestamp parsing to generic place
In reply to Stephen BoydMove the timestamp code out of x86/cpu/coreboot to lib/coreboot and make it generic. This lets us migrate the timestamp table from coreboot into U-Boot's version of boot stage timing and use it on ARM based devices.
---
arch/x86/cpu/coreboot/Makefile | 1 -
arch/x86/cpu/coreboot/coreboot.c | 6 +-----
arch/x86/lib/bootm.c | 5 ++---
arch/x86/lib/zimage.c | 3 ---
.../timestamp.h => include/coreboot_timestamp.h | 7 -------
lib/coreboot/Makefile | 1 +
lib/coreboot/cb_sysinfo.c | 3 +++
{arch/x86/cpu => lib}/coreboot/timestamp.c | 13 ++++++++-----
8 files changed, 15 insertions(+), 24 deletions(-)
rename arch/x86/include/asm/arch-coreboot/timestamp.h => include/coreboot_timestamp.h (68%)
rename {arch/x86/cpu => lib}/coreboot/timestamp.c (84%)arch/x86/cpu/coreboot/Makefile +0 -1
@@ -20,4 +20,3 @@ else obj-y += sdram.o endif obj-y += coreboot.o -obj-y += timestamp.o
arch/x86/cpu/coreboot/coreboot.c +1 -5
@@ -6,6 +6,7 @@*/ #include <cb_sysinfo.h> +#include <coreboot_timestamp.h> #include <cpu_func.h> #include <event.h> #include <fdtdec.h>
@@ -15,7 +16,6 @@#include <asm/io.h> #include <asm/msr.h> #include <asm/mtrr.h> -#include <asm/arch/timestamp.h> #include <dm/ofnode.h> int arch_cpu_init (void )
@@ -35,8 +35,6 @@ int arch_cpu_init(void)gd_set_acpi_start (map_to_sysmem (lib_sysinfo.rsdp));gd_set_smbios_start (lib_sysinfo.smbios_start); -timestamp_init (); -return 0 ; }
@@ -74,8 +72,6 @@ static void board_final_init(void)static int last_stage_init (void ) { -timestamp_add_to_bootstage (); -if (IS_ENABLED (CONFIG_XPL_BUILD ))return 0 ;
arch/x86/lib/bootm.c +2 -3
@@ -10,6 +10,8 @@#include <bootm.h> #include <bootstage.h> #include <command.h> +#include <coreboot_tables.h> +#include <coreboot_timestamp.h> #include <efi.h> #include <hang.h> #include <log.h>
@@ -24,9 +26,6 @@#include <asm/cpu.h> #include <asm/byteorder.h> #include <asm/zimage.h> -#ifdef CONFIG_SYS_COREBOOT -#include <asm/arch/timestamp.h> -#endif DECLARE_GLOBAL_DATA_PTR ;
arch/x86/lib/zimage.c +0 -3
@@ -31,9 +31,6 @@#include <asm/bootparam.h> #include <asm/efi.h> #include <asm/global_data.h> -#ifdef CONFIG_SYS_COREBOOT -#include <asm/arch/timestamp.h> -#endif #include <linux/compiler.h> #include <linux/ctype.h> #include <linux/libfdt.h>
include/coreboot_timestamp.h renamed from arch/x86/include/asm/arch-coreboot/timestamp.h +0 -7
@@ -14,11 +14,4 @@ void timestamp_init(void);void timestamp_add (enum timestamp_id id,uint64_t ts_time);void timestamp_add_now (enum timestamp_id id); -/** -* timestamp_add_to_bootstage - Add important coreboot timestamps to bootstage -* -* Return: 0 if ok, -1 if no timestamps were found -*/ -int timestamp_add_to_bootstage (void ); -#endif
lib/coreboot/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-y += cb_sysinfo.o ifndef CONFIG_XPL_BUILD obj-y += sdram.o endif +obj-y += timestamp.o
lib/coreboot/cb_sysinfo.c +3 -0
@@ -7,6 +7,7 @@*/ #include <cb_sysinfo.h> +#include <coreboot_timestamp.h> #include <fdt_support.h> #include <init.h> #include <mapmem.h>
@@ -491,6 +492,8 @@ int get_coreboot_info(struct sysinfo_t *info) gd->arch.coreboot_table = addr; gd->flags |=GD_FLG_SKIP_LL_INIT ; +timestamp_init (); +return 0 ; }
lib/coreboot/timestamp.c renamed from arch/x86/cpu/coreboot/timestamp.c +8 -5
@@ -7,10 +7,12 @@#include <bootstage.h> #include <cb_sysinfo.h> +#include <coreboot_tables.h> +#include <coreboot_timestamp.h> +#include <event.h> #include <errno.h> -#include <asm/arch/timestamp.h> -#include <asm/u-boot-x86.h> #include <linux/compiler.h> +#include <time.h> void timestamp_init (void ) {
@@ -33,10 +35,10 @@ void timestamp_add(enum timestamp_id id, uint64_t ts_time)void timestamp_add_now (enum timestamp_id id) { -timestamp_add (id,rdtsc ()); +timestamp_add (id,get_ticks ()); } -int timestamp_add_to_bootstage (void ) +static int timestamp_add_to_bootstage (void ) {const struct sysinfo_t *info =cb_get_sysinfo ();const struct timestamp_table *ts_table = info->tstamp_table;
@@ -69,9 +71,10 @@ int timestamp_add_to_bootstage(void)if (name) {bootstage_add_record (0 , name,BOOTSTAGEF_ALLOC , tse->entry_stamp / -get_tbclk_mhz ()); + (get_tbclk () /1000000 )); } }return 0 ; } +EVENT_SPY_SIMPLE (EVT_LAST_STAGE_INIT , timestamp_add_to_bootstage);
Signature · 1 line
Sent by a computer, using git, on the internet
Re: [PATCH v3 14/17] coreboot: Move timestamp parsing to generic place
Quoted 4 lines · Stephen Boyd
Move the timestamp code out of x86/cpu/coreboot to lib/coreboot and make it generic. This lets us migrate the timestamp table from coreboot into U-Boot's version of boot stage timing and use it on ARM based devices.
---
You missed your own signed-off-by here. It seems fine, but I don't have the depth to review it in detail and provide a tag.
Signature · 1 line
Tom
PATCH v3 15/17 mach-snapdragon: Support booting as a coreboot payload
In reply to Stephen BoydCoreboot sets up the DRAM, CPU, and devices before booting a payload, meaning we can parse the coreboot tables at boot for memory info when running as a payload. Use the memory descriptors from coreboot if the tables are present so that Snapdragon SoCs can run U-boot as a coreboot payload.
--- arch/arm/mach-snapdragon/board.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/arm/mach-snapdragon/board.c +23 -0
@@ -14,6 +14,7 @@#include <asm/io.h> #include <asm/psci.h> #include <asm/system.h> +#include <cb_sysinfo.h> #include <dm/device.h> #include <dm/pinctrl.h> #include <dm/uclass-internal.h>
@@ -48,6 +49,10 @@ static struct {int dram_init (void ) { +#ifdef CONFIG_SYS_COREBOOT +if (gd->arch.coreboot_table) +return coreboot_dram_init (); +#endif /* * gd->ram_base / ram_size have been setup already * in qcom_parse_memory().
@@ -81,8 +86,21 @@ static void qcom_configure_bi_dram(void) } } +phys_addr_t board_get_usable_ram_top (phys_size_t total_size) +{ +#ifdef CONFIG_SYS_COREBOOT +if (gd->arch.coreboot_table) +return coreboot_board_get_usable_ram_top (total_size); +#endif +return gd->ram_top; +} +int dram_init_banksize (void ) { +#ifdef CONFIG_SYS_COREBOOT +if (gd->arch.coreboot_table) +return coreboot_dram_init_banksize (); +#endif qcom_configure_bi_dram ();return 0 ;
@@ -235,6 +253,11 @@ int board_fdt_blob_setup(void **fdtp) ret =qcom_parse_memory (external_fdt); } +#ifdef CONFIG_SYS_COREBOOT +if (gd->arch.coreboot_table) +debug ("Using coreboot tables for memory ranges\n" ); + else +#endif if (ret <0 )panic ("No valid memory ranges found!\n" );
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 16/17 cmd: ximg: Support LZO compressed images
In reply to Stephen BoydAdd support to decompress LZO images.
--- cmd/ximg.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
cmd/ximg.c +15 -0
@@ -14,6 +14,9 @@#include <cpu_func.h> #include <env.h> #include <gzip.h> +#if IS_ENABLED (CONFIG_LZO ) +#include <linux/lzo.h> +#endif #if IS_ENABLED (CONFIG_ZSTD )#include <linux/zstd.h> #endif
@@ -238,6 +241,18 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }break ;#endif /* CONFIG_BZIP2 */ +#if IS_ENABLED (CONFIG_LZO ) +case IH_COMP_LZO : + { +int ret; +size_t size = unc_len; +printf (" Uncompressing part %d ... " , part); + + ret =lzop_decompress ((void *)data, len, (void *)dest, &size); + len = size; + } +break ; +#endif /* CONFIG_LZO */ #if IS_ENABLED (CONFIG_ZSTD )case IH_COMP_ZSTD : {
Signature · 1 line
Sent by a computer, using git, on the internet
PATCH v3 17/17 cmd: ximg: Support LZ4 compressed images
In reply to Stephen BoydAdd support to decompress LZ4 images. LZ4 is used on more recent Chromebooks to store the FIT image.
--- cmd/ximg.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
cmd/ximg.c +13 -0
@@ -30,6 +30,7 @@#include <asm/byteorder.h> #include <asm/cache.h> #include <asm/io.h> +#include <u-boot/lz4.h> static int do_imgextract (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[])
@@ -253,6 +254,18 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) }break ;#endif /* CONFIG_LZO */ +#if IS_ENABLED (CONFIG_LZ4 ) +case IH_COMP_LZ4 : + { +int ret; +size_t size = unc_len; +printf (" Uncompressing part %d ... " , part); + + ret =ulz4fn ((void *)data, len, (void *)dest, &size); + len = size; + } +break ; +#endif /* CONFIG_LZ4 */ #if IS_ENABLED (CONFIG_ZSTD )case IH_COMP_ZSTD : {
Signature · 1 line
Sent by a computer, using git, on the internet