x86: Fixes for chromebook_link64 and chromebook_samus_tpl
Subsystems (2)
v2 cover x86: Fixes for chromebook_link64 and chromebook_samus_tpl
These boards have various problems which prevent them from booting. In the case of link there was a recent regression with PCI probing added to SPL. For samus_tpl it needs a few tweaks to get things back up and running.
This series resolves all known issues.
For v2, the 'Avoid starting up PCI automatically in SPL' patch has been replaced with a global_data flag.
Changes in v2:
- Add new patch to allow marking driver model as dead
- Reword commit message for clarity and to fix typo
- Add new patch to mark driver model as dead when disabling CAR
Simon Glass (9):
dm: core: Allow marking driver model as dead
x86: broadwell: Show the memory delay
x86: Add some log categories
x86: samus_tpl: Correct text base and alloc sizes
x86: spl: Change the condition for copying U-Boot to RAM
x86: broadwell: Avoid initing the CPU twice
x86: broadwell: Set up MTRRs
x86: dm: Mark driver model as dead when disabling CAR
x86: doc: Update the list of supported Chromebooks
arch/x86/cpu/broadwell/cpu.c | 10 +++++----- arch/x86/cpu/broadwell/sdram.c | 2 ++ arch/x86/cpu/intel_common/mrc.c | 18 +++++++++++++++++- arch/x86/dts/chromebook_samus.dts | 1 + arch/x86/lib/init_helpers.c | 7 +++---- arch/x86/lib/spl.c | 5 ++++- arch/x86/lib/tpl.c | 2 ++ common/spl/spl.c | 2 +- configs/chromebook_samus_tpl_defconfig | 4 +++- doc/arch/x86.rst | 5 +++-- include/asm-generic/global_data.h | 5 +++++ 11 files changed, 46 insertions(+), 15 deletions(-)
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
PATCH v2 1/9 dm: core: Allow marking driver model as dead
On x86 devices we use CAR (Cache-As-RAM) to hold the malloc() region in SPL, since SDRAM is not set up yet. This means that driver model stores its tables in this region.
When preparing to jump from SPL to U-Boot proper, we must disable CAR, so that the CPU can uses the caches normally. This means that driver model tables become inaccessible. From there until we jump to U-Boot proper, we must avoid using driver model.
This is only a problem on boards which operate this way, for example chromebook_link64
Add a flag to indicate that driver model is dead and should not be used. It can be used in SPL to avoid hanging the machine.
---
Changes in v2:
- Add new patch to allow marking driver model as dead
common/spl/spl.c | 2 +- include/asm-generic/global_data.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
common/spl/spl.c +1 -1
@@ -800,7 +800,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) IS_ENABLED(CONFIG_SPL_ATF))dram_init_banksize (); -if (CONFIG_IS_ENABLED (PCI )) { +if (CONFIG_IS_ENABLED (PCI ) && !(gd->flags &GD_FLG_DM_DEAD )) { ret =pci_init ();if (ret)puts (SPL_TPL_PROMPT "Cannot initialize PCI\n" );
include/asm-generic/global_data.h +5 -0
@@ -667,6 +667,11 @@ enum gd_flags {* @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags */ GD_FLG_OF_TAG_MIGRATE =0x200000 , +/** +* @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when +* the memory used to holds its tables has been mapped out. +*/ + GD_FLG_DM_DEAD = 0x400000, };#endif /* __ASSEMBLY__ */
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
Re: [PATCH v2 1/9] dm: core: Allow marking driver model as dead
Quoted 17 lines · Simon Glass
On x86 devices we use CAR (Cache-As-RAM) to hold the
malloc()region in SPL, since SDRAM is not set up yet. This means that driver model stores its tables in this region.When preparing to jump from SPL to U-Boot proper, we must disable CAR, so that the CPU can uses the caches normally. This means that driver model tables become inaccessible. From there until we jump to U-Boot proper, we must avoid using driver model.
This is only a problem on boards which operate this way, for example
chromebook_link64Add a flag to indicate that driver model is dead and should not be used. It can be used in SPL to avoid hanging the machine.
Signed-off-by Simon Glass <[email protected]>
Quoted 9 lines
---
Changes in v2:
- Add new patch to allow marking driver model as deadcommon/spl/spl.c | 2 +- include/asm-generic/global_data.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
PATCH v2 2/9 x86: broadwell: Show the memory delay
In reply to Simon GlassSamus only takes 7 seconds but it is long enough to think it has hung. Add a message about what it is doing, similar to the approach on coral.
---
(no changes since v1)
arch/x86/cpu/intel_common/mrc.c | 18 +++++++++++++++++- arch/x86/dts/chromebook_samus.dts | 1 + 2 files changed, 18 insertions(+), 1 deletion(-)
arch/x86/cpu/intel_common/mrc.c +17 -1
@@ -9,6 +9,7 @@#include <dm.h> #include <init.h> #include <log.h> +#include <spl.h> #include <syscon.h> #include <asm/cpu.h> #include <asm/global_data.h>
@@ -251,13 +252,28 @@ static int sdram_initialise(struct udevice *dev, struct udevice *me_dev,int mrc_common_init (struct udevice *dev,void *pei_data,bool use_asm_linkage) {struct udevice *me_dev; -int ret; +int ret, delay; ret =syscon_get_by_driver_data (X86_SYSCON_ME , &me_dev);if (ret)return ret; + delay =dev_read_u32_default (dev,"fspm,training-delay" ,0 ); +if (spl_phase () ==PHASE_SPL ) { +if (delay) +printf ("SDRAM training (%d seconds)..." , delay); +else +log_debug ("SDRAM init..." ); + }else { +if (delay) +printf ("(%d seconds)..." , delay); + } + ret =sdram_initialise (dev, me_dev, pei_data, use_asm_linkage); +if (delay) +printf ("done\n" ); +else +log_debug ("done\n" );if (ret)return ret;quick_ram_check ();
arch/x86/dts/chromebook_samus.dts +1 -0
@@ -266,6 +266,7 @@ board-id-gpios = <&gpio_c 5 0>, <&gpio_c 4 0>, <&gpio_c 3 0>, <&gpio_c 1 0>; bootph-all; + fspm,training-delay = <7>; spd { #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
PATCH v2 3/9 x86: Add some log categories
In reply to Simon GlassAdd some missing log categories to a few files.
---
(no changes since v1)
arch/x86/cpu/broadwell/sdram.c | 2 ++ arch/x86/lib/tpl.c | 2 ++ 2 files changed, 4 insertions(+)
arch/x86/cpu/broadwell/sdram.c +2 -0
@@ -5,6 +5,8 @@* From coreboot src/soc/intel/broadwell/romstage/raminit.c */ +#define LOG_CATEGORY UCLASS_RAM +#include <common.h> #include <dm.h> #include <init.h>
arch/x86/lib/tpl.c +2 -0
@@ -3,6 +3,8 @@* Copyright (c) 2018 Google, Inc */ +#define LOG_CATEGORY LOGC_BOOT +#include <common.h> #include <debug_uart.h> #include <dm.h>
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
PATCH v2 4/9 x86: samus_tpl: Correct text base and alloc sizes
In reply to Simon GlassMake sure that CONFIG_X86_OFFSET_U_BOOT is the same as CONFIG_TEXT_BASE as it is changing CONFIG_X86_OFFSET_U_BOOT
Samus boots into U-Boot proper in flash, not RAM. Also expand the SPL malloc() size a little, to avoid an error.
---
Changes in v2:
- Reword commit message for clarity and to fix typo
configs/chromebook_samus_tpl_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
configs/chromebook_samus_tpl_defconfig +3 -1
@@ -1,6 +1,8 @@ CONFIG_X86=y CONFIG_TEXT_BASE=0xffed0000 CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_TPL_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_SYS_MALLOC_F_LEN=0x3000 CONFIG_NR_DRAM_BANKS=8 CONFIG_ENV_SIZE=0x1000 CONFIG_ENV_OFFSET=0x3F8000
@@ -19,7 +21,7 @@ CONFIG_HAVE_MRC=y CONFIG_HAVE_REFCODE=y CONFIG_SMP=y CONFIG_HAVE_VGA_BIOS=y -CONFIG_X86_OFFSET_U_BOOT=0xffee0000 +CONFIG_X86_OFFSET_U_BOOT=0xffed0000 CONFIG_SYS_MONITOR_BASE=0xFFED0000 CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
PATCH v2 5/9 x86: spl: Change the condition for copying U-Boot to RAM
In reply to Simon GlassMake this depend on whether the address matches the offset, rather than a particular board build. For samus_tpl we don't need to copy, for example.
---
(no changes since v1)
arch/x86/lib/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/spl.c +1 -1
@@ -258,7 +258,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image, spl_image->os =IH_OS_U_BOOT ; spl_image->name ="U-Boot" ; -if (!IS_ENABLED (CONFIG_SYS_COREBOOT )) { +if (spl_image->load_addr !=spl_get_image_pos ()) {/* Copy U-Boot from ROM */ memcpy ((void *)spl_image->load_addr, (void *)spl_get_image_pos (),spl_get_image_size ());
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
PATCH v2 6/9 x86: broadwell: Avoid initing the CPU twice
In reply to Simon GlassWhen TPL has already set up the CPU, don't do it again. This existing code actually has this backwards, so fix it.
---
(no changes since v1)
arch/x86/cpu/broadwell/cpu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/cpu/broadwell/cpu.c +5 -5
@@ -11,6 +11,7 @@#include <event.h> #include <init.h> #include <log.h> +#include <spl.h> #include <asm/cpu.h> #include <asm/cpu_x86.h> #include <asm/cpu_common.h>
@@ -67,12 +68,11 @@ int arch_cpu_init(void) {post_code (POST_CPU_INIT ); -#ifdef CONFIG_TPL /* Do a mini-init if TPL has already done the full init */ -return x86_cpu_reinit_f (); -#else -return x86_cpu_init_f (); -#endif +if (IS_ENABLED (CONFIG_TPL ) &&spl_phase () !=PHASE_TPL ) +return x86_cpu_reinit_f (); +else +return x86_cpu_init_f (); }int checkcpu (void )
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
PATCH v2 7/9 x86: broadwell: Set up MTRRs
In reply to Simon GlassThe current condition does not handle the samus_tpl case where it sets up the RAM in SPL but needs to commit the MTRRs in U-Boot proper.
Add another case to handle this and update the comment.
---
(no changes since v1)
arch/x86/lib/init_helpers.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/x86/lib/init_helpers.c +3 -4
@@ -15,7 +15,8 @@ DECLARE_GLOBAL_DATA_PTR;int init_cache_f_r (void ) {bool do_mtrr =CONFIG_IS_ENABLED (X86_32BIT_INIT ) || -IS_ENABLED (CONFIG_FSP_VERSION2 ); +IS_ENABLED (CONFIG_FSP_VERSION2 ) || + (IS_ENABLED (CONFIG_TPL ) &&IS_ENABLED (CONFIG_HAVE_MRC ));int ret;/*
@@ -23,11 +24,9 @@ int init_cache_f_r(void)* * booting from slimbootloader - MTRRs are already set up * booting with FSPv1 - MTRRs are already set up -* booting with FSPv2 - MTRRs must be set here +* booting with FSPv2 or MRC - MTRRs must be set here * booting from coreboot - in this case there is no SPL, so we set up * the MTRRs here -* Note: if there is an SPL, then it has already set up MTRRs so we -* don't need to do that here */ do_mtrr &= !IS_ENABLED (CONFIG_FSP_VERSION1 ) && !IS_ENABLED (CONFIG_SYS_SLIMBOOTLOADER );
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
Re: [PATCH v2 7/9] x86: broadwell: Set up MTRRs
Quoted 6 lines · Simon Glass
The current condition does not handle the
samus_tplcase where it sets up the RAM in SPL but needs to commit the MTRRs in U-Boot proper.Add another case to handle this and update the comment.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
(no changes since v1)
arch/x86/lib/init_helpers.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
PATCH v2 8/9 x86: dm: Mark driver model as dead when disabling CAR
In reply to Simon GlassWhen turning off CAR, set the flag to make sure that nothing tries to use driver model in SPL before jumping to U-Bot proper, since its tables are in CAR.
---
Changes in v2:
- Add new patch to mark driver model as dead when disabling CAR
arch/x86/lib/spl.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/lib/spl.c +3 -0
@@ -230,6 +230,9 @@ void board_init_f_r(void)mtrr_commit (false);init_cache (); gd->flags &= ~GD_FLG_SERIAL_READY ; + +/* make sure driver model is not accessed from now on */ + gd->flags |=GD_FLG_DM_DEAD ;debug ("cache status %d\n" ,dcache_status ());board_init_r (gd,0 ); }
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
Re: [PATCH v2 8/9] x86: dm: Mark driver model as dead when disabling CAR
Quoted 5 lines · Simon Glass
When turning off CAR, set the flag to make sure that nothing tries to use driver model in SPL before jumping to U-Bot proper, since its tables are in CAR.
Quoted 9 lines
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Add new patch to mark driver model as dead when disabling CARarch/x86/lib/spl.c | 3 +++ 1 file changed, 3 insertions(+)
PATCH v2 9/9 x86: doc: Update the list of supported Chromebooks
In reply to Simon GlassOne is missing, so add it. Also mention the SoC used in each.
---
(no changes since v1)
doc/arch/x86.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
doc/arch/x86.rst +3 -2
@@ -25,12 +25,13 @@ are supported: - Bayley Bay CRB - Cherry Hill CRB - Congatec QEVAL 2.0 & conga-QA3/E3845 + - Coral (Apollo Lake - Chromebook 2017) - Cougar Canyon 2 CRB - Crown Bay CRB - Galileo - - Link (Chromebook Pixel) + - Link (Ivy Bridge - Chromebook Pixel) - Minnowboard MAX - - Samus (Chromebook Pixel 2015) + - Samus (Broadwell - Chromebook Pixel 2015) - QEMU x86 (32-bit & 64-bit) As for loading an OS, U-Boot supports directly booting a 32-bit or 64-bit
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
Quoted 16 lines · Simon Glass
These boards have various problems which prevent them from booting. In the case of link there was a recent regression with PCI probing added to SPL. For
samus_tplit needs a few tweaks to get things back up and running.This series resolves all known issues.
For v2, the 'Avoid starting up PCI automatically in SPL' patch has been replaced with a
global_dataflag.Changes in v2:
- Add new patch to allow marking driver model as dead
- Reword commit message for clarity and to fix typo
- Add new patch to mark driver model as dead when disabling CAR
Quoted 11 lines
Simon Glass (9):
dm: core: Allow marking driver model as dead
x86: broadwell: Show the memory delay
x86: Add some log categories
x86:samus_tpl: Correct text base and alloc sizes
x86: spl: Change the condition for copying U-Boot to RAM
x86: broadwell: Avoid initing the CPU twice
x86: broadwell: Set up MTRRs
x86: dm: Mark driver model as dead when disabling CAR
x86: doc: Update the list of supported Chromebooks
series applied to u-boot-x86/next, thanks!