diff options
author | Simon Glass <sjg@chromium.org> | 2023-07-15 21:39:05 -0600 |
---|---|---|
committer | Bin Meng <bmeng@tinylab.org> | 2023-07-17 17:12:26 +0800 |
commit | e7595aa350ae61e3dfefbde8fe3af01c12b65ccf (patch) | |
tree | fa9443c1c1d884e581ff53df41dd2ff5eb7529fb /arch/x86 | |
parent | fa5e2030922b561d5f9ea6c86295f5903e3d878c (diff) | |
download | u-boot-e7595aa350ae61e3dfefbde8fe3af01c12b65ccf.zip u-boot-e7595aa350ae61e3dfefbde8fe3af01c12b65ccf.tar.gz u-boot-e7595aa350ae61e3dfefbde8fe3af01c12b65ccf.tar.bz2 |
x86: Allow logging to be used in SPL reliably
When global_data is relocated, log_head moves in memory, meaning that
the items in that list point to the wrong place.
Disable logging when making the change, then reenable it afterwards, so
that logging works normally.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/lib/spl.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c index 039f219..92a5e6a 100644 --- a/arch/x86/lib/spl.c +++ b/arch/x86/lib/spl.c @@ -144,9 +144,22 @@ static int x86_spl_init(void) */ gd->new_gd = (struct global_data *)ptr; memcpy(gd->new_gd, gd, sizeof(*gd)); + + /* + * Make sure logging is disabled when we switch, since the log system + * list head will move + */ + gd->new_gd->flags &= ~GD_FLG_LOG_READY; arch_setup_gd(gd->new_gd); gd->start_addr_sp = (ulong)ptr; + /* start up logging again, with the new list-head location */ + ret = log_init(); + if (ret) { + log_debug("Log setup failed (err=%d)\n", ret); + return ret; + } + if (_LOG_DEBUG) { ret = mtrr_list(mtrr_get_var_count(), MP_SELECT_BSP); if (ret) |