x86: Add support for booting from TPL
v4 cover x86: Add support for booting from TPL
At present SPL is used on 64-bit platforms, to allow SPL to be built as a 32-bit program and U-Boot proper to be built as 64-bit.
However it is useful to be able to use SPL on any x86 platform, where U-Boot needs to be updated in the field. Then SPL can select which U-Boot to run (A or B) and most of the code can be updated. Similarly, using TPL allows both SPL and U-Boot to be updated. This is the best approach, since it means that all of U-Boot proper as well as SPL (in particular SDRAM init) can be updated in the field. This provides for the smallest possible amount of read-only (non-updateable) code: just the TPL code.
This series contains a number of changes to allow x86 boards to use TPL, SPL and U-Boot proper. As a test, it is enabled for samus with a new chromebook_samus_tpl board.
Changes in v4:
- Update commit message to not mention the sysreset driver.
- Drop change to SPI flash memory-map property
Changes in v3:
- Remove unneeded pch-reset node
Changes in v2:
- Sort defconfig and adjust it to build after rebase on maste
Simon Glass (4):
x86: samus: Update device tree for SPL
x86: samus: Update device tree for verified boot Revert "pci: Scale MAX_PCI_REGIONS based on CONFIG_NR_DRAM_BANKS"
x86: samus: Add a target to boot through TPL
arch/x86/dts/chromebook_samus.dts | 53 +++++++++++++-- board/google/Kconfig | 8 +++ board/google/chromebook_samus/Kconfig | 14 +++- board/google/chromebook_samus/MAINTAINERS | 7 ++ configs/chromebook_samus_tpl_defconfig | 82 +++++++++++++++++++++++ include/configs/chromebook_samus.h | 2 + include/pci.h | 6 +- 7 files changed, 161 insertions(+), 11 deletions(-) create mode 100644 configs/chromebook_samus_tpl_defconfig
Signature · 1 line
2.21.0.1020.gf2820cf01a-goog
PATCH v4 1/4 x86: samus: Update device tree for SPL
Add tags to allow required nodes to be present in SPL / TPL.
---
Changes in v4:
- Update commit message to not mention the sysreset driver.
- Drop change to SPI flash memory-map property
Changes in v3:
- Remove unneeded pch-reset node
Changes in v2: None
arch/x86/dts/chromebook_samus.dts | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
arch/x86/dts/chromebook_samus.dts +28 -3
@@ -17,6 +17,7 @@ spi0 = &spi; usb0 = &usb_0; usb1 = &usb_1; + cros-ec0 = &cros_ec; }; config {
@@ -73,6 +74,7 @@ /* Put this first: it is the default */ gpio_unused: gpio-unused { + u-boot,dm-pre-reloc; mode-gpio; direction = <PIN_INPUT>; owner = <OWNER_GPIO>;
@@ -80,6 +82,7 @@ }; gpio_acpi_sci: acpi-sci { + u-boot,dm-pre-reloc; mode-gpio; direction = <PIN_INPUT>; invert;
@@ -87,6 +90,7 @@ }; gpio_acpi_smi: acpi-smi { + u-boot,dm-pre-reloc; mode-gpio; direction = <PIN_INPUT>; invert;
@@ -94,12 +98,14 @@ }; gpio_input: gpio-input { + u-boot,dm-pre-reloc; mode-gpio; direction = <PIN_INPUT>; owner = <OWNER_GPIO>; }; gpio_input_invert: gpio-input-invert { + u-boot,dm-pre-reloc; mode-gpio; direction = <PIN_INPUT>; owner = <OWNER_GPIO>;
@@ -107,9 +113,11 @@ }; gpio_native: gpio-native { + u-boot,dm-pre-reloc; }; gpio_out_high: gpio-out-high { + u-boot,dm-pre-reloc; mode-gpio; direction = <PIN_OUTPUT>; output-value = <1>;
@@ -118,6 +126,7 @@ }; gpio_out_low: gpio-out-low { + u-boot,dm-pre-reloc; mode-gpio; direction = <PIN_OUTPUT>; output-value = <0>;
@@ -126,6 +135,7 @@ }; gpio_pirq: gpio-pirq { + u-boot,dm-pre-reloc; mode-gpio; direction = <PIN_INPUT>; owner = <OWNER_GPIO>;
@@ -133,6 +143,7 @@ }; soc_gpio at 0 { + u-boot,dm-pre-reloc; config = <0 &gpio_unused 0>, /* unused */ <1 &gpio_unused 0>, /* unused */
@@ -250,8 +261,10 @@ spd { #address-cells = <1>; #size-cells = <0>; + u-boot,dm-pre-reloc; samsung_4 { reg = <6>; + u-boot,dm-pre-reloc; data = [91 20 f1 03 04 11 05 0b 03 11 01 08 0a 00 50 01 78 78 90 50 90 11 50 e0
@@ -291,6 +304,7 @@ * columns 10, density 4096 mb, x32 */ reg = <8>; + u-boot,dm-pre-reloc; data = [91 20 f1 03 04 11 05 0b 03 11 01 08 0a 00 50 01 78 78 90 50 90 11 50 e0
@@ -326,6 +340,7 @@ }; samsung_8 { reg = <10>; + u-boot,dm-pre-reloc; data = [91 20 f1 03 04 12 05 0a 03 11 01 08 0a 00 50 01 78 78 90 50 90 11 50 e0
@@ -365,6 +380,7 @@ * columns 11, density 4096 mb, x16 */ reg = <12>; + u-boot,dm-pre-reloc; data = [91 20 f1 03 04 12 05 0a 03 11 01 08 0a 00 50 01 78 78 90 50 90 11 50 e0
@@ -404,6 +420,7 @@ * columns 11, density 8192 mb, x16 */ reg = <13>; + u-boot,dm-pre-reloc; data = [91 20 f1 03 05 1a 05 0a 03 11 01 08 0a 00 50 01 78 78 90 50 90 11 50 e0
@@ -443,6 +460,7 @@ * columns 11, density 8192 mb, x16 */ reg = <15>; + u-boot,dm-pre-reloc; data = [91 20 f1 03 05 1a 05 0a 03 11 01 08 0a 00 50 01 78 78 90 50 90 11 50 e0
@@ -540,7 +558,7 @@ compatible = "ehci-pci"; }; - pch at 1f,0 { + pch: pch at 1f,0 { reg = <0x0000f800 0 0 0 0>; compatible = "intel,broadwell-pch"; u-boot,dm-pre-reloc;
@@ -559,10 +577,12 @@ power-enable-gpio = <&gpio_a 23 0>; spi: spi { + u-boot,dm-pre-reloc; #address-cells = <1>; #size-cells = <0>; compatible = "intel,ich9-spi"; spi-flash at 0 { + u-boot,dm-pre-reloc; #size-cells = <1>; #address-cells = <1>; reg = <0>;
@@ -570,6 +590,7 @@ "jedec,spi-nor"; memory-map = <0xff800000 0x00800000>; rw-mrc-cache { + u-boot,dm-pre-reloc; label = "rw-mrc-cache"; reg = <0x003e0000 0x00010000>; };
@@ -609,7 +630,8 @@ #size-cells = <0>; u-boot,dm-pre-reloc; intel,gen-dec = <0x800 0xfc 0x900 0xfc>; - cros-ec at 200 { + cros_ec: cros-ec { + u-boot,dm-pre-reloc; compatible = "google,cros-ec-lpc"; reg = <0x204 1 0x200 1 0x880 0x80>;
@@ -630,7 +652,7 @@ sata at 1f,2 { compatible = "intel,wildcatpoint-ahci"; reg = <0x0000fa00 0 0 0 0>; - u-boot,dm-pre-reloc; + u-boot,dm-pre-proper; intel,sata-mode = "ahci"; intel,sata-port-map = <1>; intel,sata-port0-gen3-tx = <0x72>;
@@ -645,12 +667,15 @@ }; tpm { + u-boot,dm-pre-reloc; reg = <0xfed40000 0x5000>; compatible = "infineon,slb9635lpc"; }; microcode { + u-boot,dm-pre-reloc; update at 0 { + u-boot,dm-pre-reloc; #include "microcode/mc0306d4_00000018.dtsi" }; };
Signature · 1 line
2.21.0.1020.gf2820cf01a-goog
PATCH v4 1/4 x86: samus: Update device tree for SPL
Quoted 11 lines · Simon Glass
Add tags to allow required nodes to be present in SPL / TPL.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Update commit message to not mention the sysreset driver.
- Drop change to SPI flash memory-map property
Quoted 8 lines
Changes in v3:
- Remove unneeded pch-reset nodeChanges in v2: None
arch/x86/dts/chromebook_samus.dts | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
PATCH v4 1/4 x86: samus: Update device tree for SPL
Quoted 16 lines · Bin Meng
Quoted 14 lines · Simon Glass
Add tags to allow required nodes to be present in SPL / TPL.
Signed-off-by Simon Glass <[email protected]>---
Changes in v4:
- Update commit message to not mention the sysreset driver.
- Drop change to SPI flash memory-map propertyChanges in v3:
- Remove unneeded pch-reset node
Quoted 7 lines
Quoted 5 lines
Changes in v2: None
arch/x86/dts/chromebook_samus.dts | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!
PATCH v4 2/4 x86: samus: Update device tree for verified boot
In reply to Simon GlassAdd nvdata drivers for the TPM and RTC as used on samus. These are needed for Chromium OS verified boot on samus.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/dts/chromebook_samus.dts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
arch/x86/dts/chromebook_samus.dts +21 -1
@@ -9,6 +9,12 @@ /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi" +#ifdef CONFIG_CHROMEOS +#include "chromeos-x86.dtsi" +#include "flashmap-x86-ro.dtsi" +#include "flashmap-8mb-rw.dtsi" +#endif + / { model = "Google Samus"; compatible = "google,samus", "intel,broadwell";
@@ -581,7 +587,7 @@ #address-cells = <1>; #size-cells = <0>; compatible = "intel,ich9-spi"; - spi-flash at 0 { + fwstore_spi: spi-flash at 0 { u-boot,dm-pre-reloc; #size-cells = <1>; #address-cells = <1>;
@@ -670,6 +676,10 @@ u-boot,dm-pre-reloc; reg = <0xfed40000 0x5000>; compatible = "infineon,slb9635lpc"; + secdata { + u-boot,dm-pre-reloc; + compatible = "google,tpm-secdata"; + }; }; microcode {
@@ -693,3 +703,13 @@ }; }; + +&rtc { + #address-cells = <1>; + #size-cells = <0>; + nvdata { + u-boot,dm-pre-reloc; + compatible = "google,cmos-nvdata"; + reg = <0x26>; + }; +};
Signature · 1 line
2.21.0.1020.gf2820cf01a-goog
PATCH v4 2/4 x86: samus: Update device tree for verified boot
Quoted 6 lines · Simon Glass
Add nvdata drivers for the TPM and RTC as used on samus. These are needed for Chromium OS verified boot on samus.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Bin Meng <[email protected]>
Quoted 9 lines
---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonearch/x86/dts/chromebook_samus.dts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
applied to u-boot-x86, thanks!
PATCH v4 3/4 Revert "pci: Scale MAX_PCI_REGIONS based on CONFIG_NR_DRAM_BANKS"
In reply to Simon GlassThis reverts commit aec4298ccb337106fd0115b91d846a022fdf301d.
Unfortunately this has a dramatic impact on the pre-relocation memory used on x86 platforms (increasing it by 2KB) since it increases the overhead for each PCI device from 220 bytes to 412 bytes.
The offending line is in UCLASS_DRIVER(pci):
.per_device_auto_alloc_size = sizeof(struct pci_controller),
This means that all PCI devices have the controller struct associated with them. The solution is to move the regions[] member out of the array, makes its size dynamic, or split UCLASS_PCI into controllers and non-controllers, as the comment suggests.
For now, revert the commit to get things running again.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
include/pci.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
include/pci.h +1 -5
@@ -546,11 +546,7 @@ extern void pci_cfgfunc_do_nothing(struct pci_controller* hose, pci_dev_t dev,extern void pci_cfgfunc_config_device (struct pci_controller * hose,pci_dev_t dev,struct pci_config_table *); -#ifdef CONFIG_NR_DRAM_BANKS -#define MAX_PCI_REGIONS (CONFIG_NR_DRAM_BANKS + 7) -#else -#define MAX_PCI_REGIONS 7 -#endif +#define MAX_PCI_REGIONS 7#define INDIRECT_TYPE_NO_PCIE_LINK 1
Signature · 1 line
2.21.0.1020.gf2820cf01a-goog
PATCH v4 3/4 Revert "pci: Scale MAX_PCI_REGIONS based on CONFIG_NR_DRAM_BANKS"
Quoted 20 lines · Simon Glass
This reverts commit
aec4298ccb337106fd0115b91d846a022fdf301d.Unfortunately this has a dramatic impact on the pre-relocation memory used on x86 platforms (increasing it by 2KB) since it increases the overhead for each PCI device from 220 bytes to 412 bytes.
The offending line is in
UCLASS_DRIVER(pci):.per_device_auto_alloc_size =
sizeof(struct pci_controller),This means that all PCI devices have the controller struct associated with them. The solution is to move the regions[] member out of the array, makes its size dynamic, or split
UCLASS_PCIinto controllers and non-controllers, as the comment suggests.For now, revert the commit to get things running again.
Reviewed-by Bin Meng <[email protected]>Signed-off-by Simon Glass <[email protected]>
Quoted 9 lines
---
Changes in v4: None
Changes in v3: None
Changes in v2: Noneinclude/pci.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
applied to u-boot-x86, thanks!
PATCH v4 4/4 x86: samus: Add a target to boot through TPL
In reply to Simon GlassAdd a version of samus which supports booting from TPL to SPL and then to U-Boot. This allows TPL to select from an A or B SPL to support verified boot with field upgrade.
---
Changes in v4: None
Changes in v3: None
Changes in v2:
- Sort defconfig and adjust it to build after rebase on maste
board/google/Kconfig | 8 +++ board/google/chromebook_samus/Kconfig | 14 +++- board/google/chromebook_samus/MAINTAINERS | 7 ++ configs/chromebook_samus_tpl_defconfig | 82 +++++++++++++++++++++++ include/configs/chromebook_samus.h | 2 + 5 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 configs/chromebook_samus_tpl_defconfig
board/google/Kconfig +8 -0
@@ -52,6 +52,14 @@ config TARGET_CHROMEBOOK_SAMUS Chrome OS EC connected on LPC, and it provides a 2560x1700 high resolution touch-enabled LCD display. +config TARGET_CHROMEBOOK_SAMUS_TPL + bool "Chromebook samus booting from TPL" + help + This is a version of Samus which boots into TPL, then to SPL and + U-Boot proper. This is useful where verified boot must select + between different A/B versions of SPL/U-Boot, to allow upgrading of + almost all U-Boot code in the field. + endchoice source "board/google/chromebook_link/Kconfig"
board/google/chromebook_samus/Kconfig +12 -2
@@ -1,4 +1,4 @@ -if TARGET_CHROMEBOOK_SAMUS +if TARGET_CHROMEBOOK_SAMUS || TARGET_CHROMEBOOK_SAMUS_TPL config SYS_BOARD default "chromebook_samus"
@@ -10,7 +10,8 @@ config SYS_SOC default "broadwell" config SYS_CONFIG_NAME - default "chromebook_samus" + default "chromebook_samus" if TARGET_CHROMEBOOK_SAMUS + default "chromebook_samus" if TARGET_CHROMEBOOK_SAMUS_TPL config SYS_TEXT_BASE default 0xffe00000
@@ -39,3 +40,12 @@ config SYS_CAR_SIZE default 0x40000 endif + +if TARGET_CHROMEBOOK_SAMUS_TPL + +config BOARD_SPECIFIC_OPTIONS_TPL # dummy + def_bool y + select SPL + select TPL + +endif
board/google/chromebook_samus/MAINTAINERS +7 -0
@@ -4,3 +4,10 @@ S: Maintained F: board/google/chromebook_samus/ F: include/configs/chromebook_samus.h F: configs/chromebook_samus_defconfig + +CHROMEBOOK SAMUS TPL BOARD +M: Simon Glass <[email protected]> +S: Maintained +F: board/google/chromebook_samus/ +F: include/configs/chromebook_samus.h +F: configs/chromebook_samus_tpl_defconfig
configs/chromebook_samus_tpl_defconfig new file +82 -0
82 lines not on this page · raw message
include/configs/chromebook_samus.h +2 -0
@@ -23,4 +23,6 @@#define CONFIG_ENV_SECT_SIZE 0x1000#define CONFIG_ENV_OFFSET 0x003f8000 +#define CONFIG_TPL_TEXT_BASE 0xfffd8000 +#endif /* __CONFIG_H */
Signature · 1 line
2.21.0.1020.gf2820cf01a-goog
PATCH v4 4/4 x86: samus: Add a target to boot through TPL
Quoted 14 lines · Simon Glass
Add a version of samus which supports booting from TPL to SPL and then to U-Boot. This allows TPL to select from an A or B SPL to support verified boot with field upgrade.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Bin Meng <[email protected]>---
Changes in v4: None
Changes in v3: None
Changes in v2:
- Sort defconfig and adjust it to build after rebase on maste
Quoted 8 lines
board/google/Kconfig | 8 +++ board/google/chromebook_samus/Kconfig | 14 +++- board/google/chromebook_samus/MAINTAINERS | 7 ++ configs/chromebook_samus_tpl_defconfig | 82 +++++++++++++++++++++++ include/configs/chromebook_samus.h | 2 + 5 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 configs/chromebook_samus_tpl_defconfig
applied to u-boot-x86, thanks!