Merge patch series "Tidy up use of 'SPL' and CONFIG_SPL_BUILD"

Simon Glass <sjg@chromium.org> says:

When the SPL build-phase was first created it was designed to solve a
particular problem (the need to init SDRAM so that U-Boot proper could
be loaded). It has since expanded to become an important part of U-Boot,
with three phases now present: TPL, VPL and SPL

Due to this history, the term 'SPL' is used to mean both a particular
phase (the one before U-Boot proper) and all the non-proper phases.
This has become confusing.

For a similar reason CONFIG_SPL_BUILD is set to 'y' for all 'SPL'
phases, not just SPL. So code which can only be compiled for actual SPL,
for example, must use something like this:

   #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)

In Makefiles we have similar issues. SPL_ has been used as a variable
which expands to either SPL_ or nothing, to chose between options like
CONFIG_BLK and CONFIG_SPL_BLK. When TPL appeared, a new SPL_TPL variable
was created which expanded to 'SPL_', 'TPL_' or nothing. Later it was
updated to support 'VPL_' as well.

This series starts a change in terminology and usage to resolve the
above issues:

- The word 'xPL' is used instead of 'SPL' to mean a non-proper build
- A new CONFIG_XPL_BUILD define indicates that the current build is an
  'xPL' build
- The existing CONFIG_SPL_BUILD is changed to mean SPL; it is not now
  defined for TPL and VPL phases
- The existing SPL_ Makefile variable is renamed to SPL_
- The existing SPL_TPL Makefile variable is renamed to PHASE_

It should be noted that xpl_phase() can generally be used instead of
the above CONFIGs without a code-space or run-time penalty.

This series does not attempt to convert all of U-Boot to use this new
terminology but it makes a start. In particular, renaming spl.h and
common/spl seems like a bridge too far at this point.

The series is fully bisectable. It has also been checked to ensure there
are no code-size changes on any commit.
This commit is contained in:
Tom Rini
2024-10-11 12:23:25 -06:00
906 changed files with 2270 additions and 2237 deletions

24
env/Makefile vendored
View File

@@ -3,12 +3,12 @@
# (C) Copyright 2004-2006
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += common.o
obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += env.o
obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += attr.o
obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += flags.o
obj-$(CONFIG_$(PHASE_)ENV_SUPPORT) += common.o
obj-$(CONFIG_$(PHASE_)ENV_SUPPORT) += env.o
obj-$(CONFIG_$(PHASE_)ENV_SUPPORT) += attr.o
obj-$(CONFIG_$(PHASE_)ENV_SUPPORT) += flags.o
ifndef CONFIG_SPL_BUILD
ifndef CONFIG_XPL_BUILD
obj-y += callback.o
obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
obj-$(CONFIG_ENV_IS_IN_EEPROM) += embedded.o
@@ -20,12 +20,12 @@ obj-$(CONFIG_ENV_IS_IN_REMOTE) += remote.o
obj-$(CONFIG_ENV_IS_IN_UBI) += ubi.o
endif
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_NOWHERE) += nowhere.o
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MMC) += mmc.o
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FAT) += fat.o
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_EXT4) += ext4.o
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_NAND) += nand.o
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_SPI_FLASH) += sf.o
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FLASH) += flash.o
obj-$(CONFIG_$(PHASE_)ENV_IS_NOWHERE) += nowhere.o
obj-$(CONFIG_$(PHASE_)ENV_IS_IN_MMC) += mmc.o
obj-$(CONFIG_$(PHASE_)ENV_IS_IN_FAT) += fat.o
obj-$(CONFIG_$(PHASE_)ENV_IS_IN_EXT4) += ext4.o
obj-$(CONFIG_$(PHASE_)ENV_IS_IN_NAND) += nand.o
obj-$(CONFIG_$(PHASE_)ENV_IS_IN_SPI_FLASH) += sf.o
obj-$(CONFIG_$(PHASE_)ENV_IS_IN_FLASH) += flash.o
CFLAGS_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)

4
env/common.c vendored
View File

@@ -61,7 +61,7 @@ int env_do_env_set(int flag, int argc, char *const argv[], int env_flag)
debug("Initial value for argc=%d\n", argc);
#if !IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_CMD_NVEDIT_EFI)
#if !IS_ENABLED(CONFIG_XPL_BUILD) && IS_ENABLED(CONFIG_CMD_NVEDIT_EFI)
if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'e')
return do_env_set_efi(NULL, flag, --argc, ++argv);
#endif
@@ -551,7 +551,7 @@ int env_export(env_t *env_out)
void env_relocate(void)
{
if (gd->env_valid == ENV_INVALID) {
#if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_XPL_BUILD)
/* Environment not changable */
env_set_default(NULL, 0);
#else

4
env/fat.c vendored
View File

@@ -22,7 +22,7 @@
#include <asm/global_data.h>
#include <linux/stddef.h>
#ifdef CONFIG_SPL_BUILD
#ifdef CONFIG_XPL_BUILD
/* TODO(sjg@chromium.org): Figure out why this is needed */
# if !defined(CONFIG_TARGET_AM335X_EVM) || defined(CONFIG_SPL_OS_BOOT)
# define LOADENV
@@ -129,7 +129,7 @@ static int env_fat_load(void)
if (!strcmp(ifname, "mmc"))
mmc_initialize(NULL);
#endif
#ifndef CONFIG_SPL_BUILD
#ifndef CONFIG_XPL_BUILD
#if defined(CONFIG_AHCI) || defined(CONFIG_SCSI)
if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "scsi"))
scsi_scan(true);

6
env/flash.c vendored
View File

@@ -22,7 +22,7 @@
DECLARE_GLOBAL_DATA_PTR;
#ifndef CONFIG_SPL_BUILD
#ifndef CONFIG_XPL_BUILD
# if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_CMD_FLASH)
# include <flash.h>
# define CMD_SAVEENV
@@ -35,11 +35,11 @@ DECLARE_GLOBAL_DATA_PTR;
#if (!defined(CONFIG_MICROBLAZE) && !defined(CONFIG_ARCH_ZYNQ) && \
!defined(CONFIG_TARGET_MCCMON6) && !defined(CONFIG_TARGET_X600) && \
!defined(CONFIG_TARGET_EDMINIV2)) || \
!defined(CONFIG_SPL_BUILD)
!defined(CONFIG_XPL_BUILD)
#define LOADENV
#endif
#if !defined(CONFIG_TARGET_X600) || !defined(CONFIG_SPL_BUILD)
#if !defined(CONFIG_TARGET_X600) || !defined(CONFIG_XPL_BUILD)
#define INITENV
#endif

6
env/mmc.c vendored
View File

@@ -298,7 +298,7 @@ static void fini_mmc_for_env(struct mmc *mmc)
mmc_set_env_part_restore(mmc);
}
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_XPL_BUILD)
static inline int write_env(struct mmc *mmc, unsigned long size,
unsigned long offset, const void *buffer)
{
@@ -427,7 +427,7 @@ fini:
fini_mmc_for_env(mmc);
return ret;
}
#endif /* CONFIG_CMD_SAVEENV && !CONFIG_SPL_BUILD */
#endif /* CONFIG_CMD_SAVEENV && !CONFIG_XPL_BUILD */
static inline int read_env(struct mmc *mmc, unsigned long size,
unsigned long offset, const void *buffer)
@@ -557,7 +557,7 @@ U_BOOT_ENV_LOCATION(mmc) = {
.location = ENVL_MMC,
ENV_NAME("MMC")
.load = env_mmc_load,
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_XPL_BUILD)
.save = env_save_ptr(env_mmc_save),
.erase = ENV_ERASE_PTR(env_mmc_erase)
#endif

8
env/nand.c vendored
View File

@@ -26,9 +26,9 @@
#include <u-boot/crc.h>
#if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_CMD_NAND) && \
!defined(CONFIG_SPL_BUILD)
!defined(CONFIG_XPL_BUILD)
#define CMD_SAVEENV
#elif defined(CONFIG_ENV_OFFSET_REDUND) && !defined(CONFIG_SPL_BUILD)
#elif defined(CONFIG_ENV_OFFSET_REDUND) && !defined(CONFIG_XPL_BUILD)
#error CONFIG_ENV_OFFSET_REDUND must have CONFIG_CMD_SAVEENV & CONFIG_CMD_NAND
#endif
@@ -224,7 +224,7 @@ static int env_nand_save(void)
}
#endif /* CMD_SAVEENV */
#if defined(CONFIG_SPL_BUILD)
#if defined(CONFIG_XPL_BUILD)
static int readenv(size_t offset, u_char *buf)
{
return nand_spl_load_image(offset, CONFIG_ENV_SIZE, buf);
@@ -265,7 +265,7 @@ static int readenv(size_t offset, u_char *buf)
return 0;
}
#endif /* #if defined(CONFIG_SPL_BUILD) */
#endif /* #if defined(CONFIG_XPL_BUILD) */
#ifdef CONFIG_ENV_OFFSET_OOB
int get_nand_env_oob(struct mtd_info *mtd, unsigned long *result)

2
env/nowhere.c vendored
View File

@@ -33,7 +33,7 @@ static int env_nowhere_load(void)
* searches default_environment array in that case.
* For U-Boot proper, import the default environment to allow reload.
*/
if (!IS_ENABLED(CONFIG_SPL_BUILD))
if (!IS_ENABLED(CONFIG_XPL_BUILD))
env_set_default(NULL, 0);
gd->env_valid = ENV_INVALID;

2
env/sf.c vendored
View File

@@ -329,7 +329,7 @@ done:
__weak void *env_sf_get_env_addr(void)
{
#ifndef CONFIG_SPL_BUILD
#ifndef CONFIG_XPL_BUILD
return (void *)CONFIG_ENV_ADDR;
#else
return NULL;