x86: Update SPL for coreboot

At present SPL only works on bare-metal builds. With a few tweaks it can
be used for coreboot also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass 2020-04-30 21:21:42 -06:00 committed by Bin Meng
parent 37897c4073
commit fc486371c3

View File

@ -63,7 +63,7 @@ static int x86_spl_init(void)
* is not needed. We could make this a CONFIG option or perhaps * is not needed. We could make this a CONFIG option or perhaps
* place it immediately below CONFIG_SYS_TEXT_BASE. * place it immediately below CONFIG_SYS_TEXT_BASE.
*/ */
char *ptr = (char *)0x110000; __maybe_unused char *ptr = (char *)0x110000;
#else #else
struct udevice *punit; struct udevice *punit;
#endif #endif
@ -111,6 +111,7 @@ static int x86_spl_init(void)
__func__, ret); __func__, ret);
} }
#ifndef CONFIG_SYS_COREBOOT
# ifndef CONFIG_TPL # ifndef CONFIG_TPL
memset(&__bss_start, 0, (ulong)&__bss_end - (ulong)&__bss_start); memset(&__bss_start, 0, (ulong)&__bss_end - (ulong)&__bss_start);
@ -148,6 +149,7 @@ static int x86_spl_init(void)
ret = set_max_freq(); ret = set_max_freq();
if (ret) if (ret)
debug("Failed to set CPU frequency (err=%d)\n", ret); debug("Failed to set CPU frequency (err=%d)\n", ret);
# endif
#endif #endif
return 0; return 0;
@ -162,7 +164,7 @@ void board_init_f(ulong flags)
debug("Error %d\n", ret); debug("Error %d\n", ret);
panic("x86_spl_init fail"); panic("x86_spl_init fail");
} }
#ifdef CONFIG_TPL #if IS_ENABLED(CONFIG_TPL) || IS_ENABLED(CONFIG_SYS_COREBOOT)
gd->bd = malloc(sizeof(*gd->bd)); gd->bd = malloc(sizeof(*gd->bd));
if (!gd->bd) { if (!gd->bd) {
printf("Out of memory for bd_info size %x\n", sizeof(*gd->bd)); printf("Out of memory for bd_info size %x\n", sizeof(*gd->bd));