summaryrefslogtreecommitdiff
path: root/common/spl
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-10-31 14:43:04 -0400
committerTom Rini <trini@konsulko.com>2022-10-31 14:43:04 -0400
commita90afc6730e6c67ad37f4c98a02891a93b4ff971 (patch)
tree724c085433631e142a56c052d667139cba29b4a6 /common/spl
parent6f38d91158e7e4199753b79e0a25c1a65175aba4 (diff)
parent77bec9e3d8bd2dc307447b92a3d5cefd693a62ad (diff)
Merge branch '2022-10-31-vbe-implement-the-full-firmware-flow'
To quote Simon: This series provides an implementation of VBE from TPL through to U-Boot proper, using VBE to load the relevant firmware stages. It buils a single image.bin file containing all the phases: TPL - initial phase, loads VPL using binman symbols VPL - main firmware phase, loads SPL using VBE parameters SPL - loads U-Boot proper using VBE parameters U-Boot - final firmware phase, where OS booting is processed This series does not include the OS-booting phase. That will be the subject of a future series. The implementation is entirely handled by sandbox. It should be possible to enable this on a real board without much effort, but that is also the subject of a future series.
Diffstat (limited to 'common/spl')
-rw-r--r--common/spl/Kconfig.vpl30
-rw-r--r--common/spl/spl.c82
-rw-r--r--common/spl/spl_atf.c2
-rw-r--r--common/spl/spl_nand.c6
-rw-r--r--common/spl/spl_optee.S2
5 files changed, 72 insertions, 50 deletions
diff --git a/common/spl/Kconfig.vpl b/common/spl/Kconfig.vpl
index f33162276d9..ae1a3c724f3 100644
--- a/common/spl/Kconfig.vpl
+++ b/common/spl/Kconfig.vpl
@@ -133,6 +133,36 @@ config VPL_I2C_SUPPORT
Enable support for the I2C bus in VPL. Vee SPL_I2C_SUPPORT for
details.
+config VPL_MMC
+ bool "Support MMC in VPL"
+ depends on VPL && MMC
+ default y if MMC
+ help
+ Enable support for MMC (Multimedia Card) within VPL This enables
+ the MMC protocol implementation and allows any enabled drivers to
+ be used within VPL. MMC can be used with or without disk partition
+ support depending on the application (SPL_LIBDISK_SUPPORT). Enable
+ this option to build the drivers in drivers/mmc as part of an VPL
+ build.
+
+config VPL_DM_MMC
+ bool "Enable MMC controllers using Driver Model in VPL"
+ depends on VPL_DM && DM_MMC
+ default y
+ help
+ This enables the MultiMediaCard (MMC) uclass which supports MMC and
+ Secure Digital I/O (SDIO) cards. Both removable (SD, micro-SD, etc.)
+ and non-removable (e.g. eMMC chip) devices are supported. These
+ appear as block devices in U-Boot and can support filesystems such
+ as EXT4 and FAT.
+
+config VPL_MMC_WRITE
+ bool "MMC/SD/SDIO card support for write operations in VPL"
+ depends on VPL_MMC
+ default y
+ help
+ Enable write access to MMC and SD Cards in VPL
+
config VPL_PCH_SUPPORT
bool "Support PCH drivers"
default y if TPL_PCH_SUPPORT
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 752b5b247cb..6f2014b0e22 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -44,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR;
DECLARE_BINMAN_MAGIC_SYM;
#ifndef CONFIG_SYS_UBOOT_START
-#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_UBOOT_START CONFIG_TEXT_BASE
#endif
#ifndef CONFIG_SYS_MONITOR_LEN
/* Unknown U-Boot size, let's assume it will not be more than 200 KB */
@@ -59,13 +59,13 @@ binman_sym_declare(ulong, u_boot_any, image_pos);
binman_sym_declare(ulong, u_boot_any, size);
#ifdef CONFIG_TPL
-binman_sym_declare(ulong, u_boot_spl, image_pos);
-binman_sym_declare(ulong, u_boot_spl, size);
+binman_sym_declare(ulong, u_boot_spl_any, image_pos);
+binman_sym_declare(ulong, u_boot_spl_any, size);
#endif
#ifdef CONFIG_VPL
-binman_sym_declare(ulong, u_boot_vpl, image_pos);
-binman_sym_declare(ulong, u_boot_vpl, size);
+binman_sym_declare(ulong, u_boot_vpl_any, image_pos);
+binman_sym_declare(ulong, u_boot_vpl_any, size);
#endif
#endif /* BINMAN_UBOOT_SYMBOLS */
@@ -164,10 +164,10 @@ ulong spl_get_image_pos(void)
#ifdef CONFIG_VPL
if (spl_next_phase() == PHASE_VPL)
- return binman_sym(ulong, u_boot_vpl, image_pos);
+ return binman_sym(ulong, u_boot_vpl_any, image_pos);
#endif
return spl_next_phase() == PHASE_SPL ?
- binman_sym(ulong, u_boot_spl, image_pos) :
+ binman_sym(ulong, u_boot_spl_any, image_pos) :
binman_sym(ulong, u_boot_any, image_pos);
}
@@ -178,10 +178,10 @@ ulong spl_get_image_size(void)
#ifdef CONFIG_VPL
if (spl_next_phase() == PHASE_VPL)
- return binman_sym(ulong, u_boot_vpl, size);
+ return binman_sym(ulong, u_boot_vpl_any, size);
#endif
return spl_next_phase() == PHASE_SPL ?
- binman_sym(ulong, u_boot_spl, size) :
+ binman_sym(ulong, u_boot_spl_any, size) :
binman_sym(ulong, u_boot_any, size);
}
@@ -192,7 +192,7 @@ ulong spl_get_image_text_base(void)
return CONFIG_VPL_TEXT_BASE;
#endif
return spl_next_phase() == PHASE_SPL ? CONFIG_SPL_TEXT_BASE :
- CONFIG_SYS_TEXT_BASE;
+ CONFIG_TEXT_BASE;
}
/*
@@ -229,7 +229,7 @@ __weak void spl_board_prepare_for_boot(void)
__weak struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
{
- return map_sysmem(CONFIG_SYS_TEXT_BASE + offset, 0);
+ return map_sysmem(CONFIG_TEXT_BASE + offset, 0);
}
void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
@@ -249,7 +249,7 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
spl_image->load_addr = u_boot_pos;
} else {
spl_image->entry_point = CONFIG_SYS_UBOOT_START;
- spl_image->load_addr = CONFIG_SYS_TEXT_BASE;
+ spl_image->load_addr = CONFIG_TEXT_BASE;
}
spl_image->os = IH_OS_U_BOOT;
spl_image->name = "U-Boot";
@@ -630,23 +630,6 @@ __weak void board_boot_order(u32 *spl_boot_list)
spl_boot_list[0] = spl_boot_device();
}
-static struct spl_image_loader *spl_ll_find_loader(uint boot_device)
-{
- struct spl_image_loader *drv =
- ll_entry_start(struct spl_image_loader, spl_image_loader);
- const int n_ents =
- ll_entry_count(struct spl_image_loader, spl_image_loader);
- struct spl_image_loader *entry;
-
- for (entry = drv; entry != drv + n_ents; entry++) {
- if (boot_device == entry->boot_device)
- return entry;
- }
-
- /* Not found */
- return NULL;
-}
-
__weak int spl_check_board_image(struct spl_image_info *spl_image,
const struct spl_boot_device *bootdev)
{
@@ -693,6 +676,10 @@ static int spl_load_image(struct spl_image_info *spl_image,
static int boot_from_devices(struct spl_image_info *spl_image,
u32 spl_boot_list[], int count)
{
+ struct spl_image_loader *drv =
+ ll_entry_start(struct spl_image_loader, spl_image_loader);
+ const int n_ents =
+ ll_entry_count(struct spl_image_loader, spl_image_loader);
int ret = -ENODEV;
int i;
@@ -702,22 +689,27 @@ static int boot_from_devices(struct spl_image_info *spl_image,
if (CONFIG_IS_ENABLED(SHOW_ERRORS))
ret = -ENXIO;
- loader = spl_ll_find_loader(bootdev);
- if (CONFIG_IS_ENABLED(SERIAL) &&
- CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) &&
- !IS_ENABLED(CONFIG_SILENT_CONSOLE)) {
- if (loader)
- printf("Trying to boot from %s\n",
- spl_loader_name(loader));
- else if (CONFIG_IS_ENABLED(SHOW_ERRORS))
- printf(SPL_TPL_PROMPT
- "Unsupported Boot Device %d\n", bootdev);
- else
- puts(SPL_TPL_PROMPT "Unsupported Boot Device!\n");
- }
- if (loader && !spl_load_image(spl_image, loader)) {
- spl_image->boot_device = bootdev;
- return 0;
+ for (loader = drv; loader != drv + n_ents; loader++) {
+ if (bootdev != loader->boot_device)
+ continue;
+ if (!CONFIG_IS_ENABLED(SILENT_CONSOLE)) {
+ if (loader)
+ printf("Trying to boot from %s\n",
+ spl_loader_name(loader));
+ else if (CONFIG_IS_ENABLED(SHOW_ERRORS)) {
+ printf(SPL_TPL_PROMPT
+ "Unsupported Boot Device %d\n",
+ bootdev);
+ } else {
+ puts(SPL_TPL_PROMPT
+ "Unsupported Boot Device!\n");
+ }
+ }
+ if (loader &&
+ !spl_load_image(spl_image, loader)) {
+ spl_image->boot_device = bootdev;
+ return 0;
+ }
}
}
diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c
index bae5c010c8c..2c10252834f 100644
--- a/common/spl/spl_atf.c
+++ b/common/spl/spl_atf.c
@@ -254,7 +254,7 @@ uintptr_t spl_fit_images_get_entry(void *blob, int node)
void spl_invoke_atf(struct spl_image_info *spl_image)
{
uintptr_t bl32_entry = 0;
- uintptr_t bl33_entry = CONFIG_SYS_TEXT_BASE;
+ uintptr_t bl33_entry = CONFIG_TEXT_BASE;
void *blob = spl_image->fdt_addr;
uintptr_t platform_param = (uintptr_t)blob;
int node;
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 4f4c00f2a1b..25a38be65ed 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -157,11 +157,11 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
*/
nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS,
CONFIG_CMD_SPL_WRITE_SIZE,
- (void *)CONFIG_SYS_TEXT_BASE);
+ (void *)CONFIG_TEXT_BASE);
/* copy to destintion */
for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR,
- src = (int *)CONFIG_SYS_TEXT_BASE;
- src < (int *)(CONFIG_SYS_TEXT_BASE +
+ src = (int *)CONFIG_TEXT_BASE;
+ src < (int *)(CONFIG_TEXT_BASE +
CONFIG_CMD_SPL_WRITE_SIZE);
src++, dst++) {
writel(readl(src), dst);
diff --git a/common/spl/spl_optee.S b/common/spl/spl_optee.S
index 8bd1949ddf3..a269904d386 100644
--- a/common/spl/spl_optee.S
+++ b/common/spl/spl_optee.S
@@ -7,6 +7,6 @@
#include <asm/assembler.h>
ENTRY(spl_optee_entry)
- ldr lr, =CONFIG_SYS_TEXT_BASE
+ ldr lr, =CONFIG_TEXT_BASE
mov pc, r3
ENDPROC(spl_optee_entry)