Skip to content

Commit 47e544f

Browse files
committed
Merge patch series "Tidy up use of 'SPL' and CONFIG_SPL_BUILD"
Simon Glass <[email protected]> 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.
2 parents 5d899fc + 0220a68 commit 47e544f

File tree

906 files changed

+2273
-2240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

906 files changed

+2273
-2240
lines changed

Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
624624
@# Otherwise, 'make silentoldconfig' would be invoked twice.
625625
$(Q)touch include/config/auto.conf
626626

627-
u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg:
627+
u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg vpl/u-boot.cfg:
628628
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf $(@)
629629

630630
-include include/autoconf.mk
@@ -829,7 +829,7 @@ KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g)
829829
UBOOTINCLUDE := \
830830
-Iinclude \
831831
$(if $(KBUILD_SRC), -I$(srctree)/include) \
832-
$(if $(CONFIG_$(SPL_)SYS_THUMB_BUILD), \
832+
$(if $(CONFIG_$(XPL_)SYS_THUMB_BUILD), \
833833
$(if $(CONFIG_HAS_THUMB2), \
834834
$(if $(CONFIG_CPU_V7M), \
835835
-I$(srctree)/arch/arm/thumb1/include), \
@@ -864,7 +864,7 @@ libs-y += disk/
864864
libs-y += drivers/
865865
libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
866866
libs-$(CONFIG_SYS_FSL_MMDC) += drivers/ddr/fsl/
867-
libs-$(CONFIG_$(SPL_)ALTERA_SDRAM) += drivers/ddr/altera/
867+
libs-$(CONFIG_$(XPL_)ALTERA_SDRAM) += drivers/ddr/altera/
868868
libs-y += drivers/usb/cdns3/
869869
libs-y += drivers/usb/dwc3/
870870
libs-y += drivers/usb/common/
@@ -883,7 +883,7 @@ libs-y += drivers/usb/ulpi/
883883
ifdef CONFIG_POST
884884
libs-y += post/
885885
endif
886-
libs-$(CONFIG_$(SPL_TPL_)UNIT_TEST) += test/
886+
libs-$(CONFIG_$(PHASE_)UNIT_TEST) += test/
887887
libs-$(CONFIG_UT_ENV) += test/env/
888888
libs-$(CONFIG_UT_OPTEE) += test/optee/
889889
libs-$(CONFIG_UT_OVERLAY) += test/overlay/
@@ -2104,7 +2104,7 @@ spl/u-boot-spl-dtb.hex: spl/u-boot-spl
21042104
@:
21052105

21062106
spl/u-boot-spl: tools prepare $(if $(CONFIG_SPL_OF_CONTROL),dts/dt.dtb)
2107-
$(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all
2107+
$(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.xpl all
21082108

21092109
spl/sunxi-spl.bin: spl/u-boot-spl
21102110
@:
@@ -2123,14 +2123,14 @@ tpl/u-boot-tpl.bin: tpl/u-boot-tpl
21232123
$(TPL_SIZE_CHECK)
21242124

21252125
tpl/u-boot-tpl: tools prepare $(if $(CONFIG_TPL_OF_CONTROL),dts/dt.dtb)
2126-
$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
2126+
$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.xpl all
21272127

21282128
vpl/u-boot-vpl.bin: vpl/u-boot-vpl
21292129
@:
21302130
$(VPL_SIZE_CHECK)
21312131

21322132
vpl/u-boot-vpl: tools prepare $(if $(CONFIG_TPL_OF_CONTROL),dts/dt.dtb)
2133-
$(Q)$(MAKE) obj=vpl -f $(srctree)/scripts/Makefile.spl all
2133+
$(Q)$(MAKE) obj=vpl -f $(srctree)/scripts/Makefile.xpl all
21342134

21352135
TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include)
21362136

README

+5-95
Original file line numberDiff line numberDiff line change
@@ -133,96 +133,6 @@ run some of U-Boot's tests.
133133

134134
See doc/arch/sandbox/sandbox.rst for more details.
135135

136-
137-
Board Initialisation Flow:
138-
--------------------------
139-
140-
This is the intended start-up flow for boards. This should apply for both
141-
SPL and U-Boot proper (i.e. they both follow the same rules).
142-
143-
Note: "SPL" stands for "Secondary Program Loader," which is explained in
144-
more detail later in this file.
145-
146-
At present, SPL mostly uses a separate code path, but the function names
147-
and roles of each function are the same. Some boards or architectures
148-
may not conform to this. At least most ARM boards which use
149-
CONFIG_SPL_FRAMEWORK conform to this.
150-
151-
Execution typically starts with an architecture-specific (and possibly
152-
CPU-specific) start.S file, such as:
153-
154-
- arch/arm/cpu/armv7/start.S
155-
- arch/powerpc/cpu/mpc83xx/start.S
156-
- arch/mips/cpu/start.S
157-
158-
and so on. From there, three functions are called; the purpose and
159-
limitations of each of these functions are described below.
160-
161-
lowlevel_init():
162-
- purpose: essential init to permit execution to reach board_init_f()
163-
- no global_data or BSS
164-
- there is no stack (ARMv7 may have one but it will soon be removed)
165-
- must not set up SDRAM or use console
166-
- must only do the bare minimum to allow execution to continue to
167-
board_init_f()
168-
- this is almost never needed
169-
- return normally from this function
170-
171-
board_init_f():
172-
- purpose: set up the machine ready for running board_init_r():
173-
i.e. SDRAM and serial UART
174-
- global_data is available
175-
- stack is in SRAM
176-
- BSS is not available, so you cannot use global/static variables,
177-
only stack variables and global_data
178-
179-
Non-SPL-specific notes:
180-
- dram_init() is called to set up DRAM. If already done in SPL this
181-
can do nothing
182-
183-
SPL-specific notes:
184-
- you can override the entire board_init_f() function with your own
185-
version as needed.
186-
- preloader_console_init() can be called here in extremis
187-
- should set up SDRAM, and anything needed to make the UART work
188-
- there is no need to clear BSS, it will be done by crt0.S
189-
- for specific scenarios on certain architectures an early BSS *can*
190-
be made available (via CONFIG_SPL_EARLY_BSS by moving the clearing
191-
of BSS prior to entering board_init_f()) but doing so is discouraged.
192-
Instead it is strongly recommended to architect any code changes
193-
or additions such to not depend on the availability of BSS during
194-
board_init_f() as indicated in other sections of this README to
195-
maintain compatibility and consistency across the entire code base.
196-
- must return normally from this function (don't call board_init_r()
197-
directly)
198-
199-
Here the BSS is cleared. For SPL, if CONFIG_SPL_STACK_R is defined, then at
200-
this point the stack and global_data are relocated to below
201-
CONFIG_SPL_STACK_R_ADDR. For non-SPL, U-Boot is relocated to run at the top of
202-
memory.
203-
204-
board_init_r():
205-
- purpose: main execution, common code
206-
- global_data is available
207-
- SDRAM is available
208-
- BSS is available, all static/global variables can be used
209-
- execution eventually continues to main_loop()
210-
211-
Non-SPL-specific notes:
212-
- U-Boot is relocated to the top of memory and is now running from
213-
there.
214-
215-
SPL-specific notes:
216-
- stack is optionally in SDRAM, if CONFIG_SPL_STACK_R is defined and
217-
CONFIG_SYS_FSL_HAS_CCI400
218-
219-
Defined For SoC that has cache coherent interconnect
220-
CCN-400
221-
222-
CONFIG_SYS_FSL_HAS_CCN504
223-
224-
Defined for SoC that has cache coherent interconnect CCN-504
225-
226136
The following options need to be configured:
227137

228138
- CPU Type: Define exactly one, e.g. CONFIG_MPC85XX.
@@ -1508,27 +1418,27 @@ Low Level (hardware related) configuration options:
15081418
This only takes effect if the memory commands are activated
15091419
globally (CONFIG_CMD_MEMORY).
15101420

1511-
- CONFIG_SPL_BUILD
1421+
- CONFIG_XPL_BUILD
15121422
Set when the currently running compilation is for an artifact
15131423
that will end up in one of the 'xPL' builds, i.e. SPL, TPL or
15141424
VPL. Code that needs phase-specific behaviour can check this,
1515-
or (where possible) use spl_phase() instead.
1425+
or (where possible) use xpl_phase() instead.
15161426

1517-
Note that CONFIG_SPL_BUILD *is* always defined when either
1427+
Note that CONFIG_XPL_BUILD *is* always defined when either
15181428
of CONFIG_TPL_BUILD / CONFIG_VPL_BUILD is defined. This can be
15191429
counter-intuitive and should perhaps be changed.
15201430

15211431
- CONFIG_TPL_BUILD
15221432
Set when the currently running compilation is for an artifact
15231433
that will end up in the TPL build (as opposed to SPL, VPL or
15241434
U-Boot proper). Code that needs phase-specific behaviour can
1525-
check this, or (where possible) use spl_phase() instead.
1435+
check this, or (where possible) use xpl_phase() instead.
15261436

15271437
- CONFIG_VPL_BUILD
15281438
Set when the currently running compilation is for an artifact
15291439
that will end up in the VPL build (as opposed to the SPL, TPL
15301440
or U-Boot proper). Code that needs phase-specific behaviour can
1531-
check this, or (where possible) use spl_phase() instead.
1441+
check this, or (where possible) use xpl_phase() instead.
15321442

15331443
- CONFIG_ARCH_MAP_SYSMEM
15341444
Generally U-Boot (and in particular the md command) uses

arch/arm/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0+
22

3-
ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_ARCH_TEGRA),yy)
3+
ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_ARCH_TEGRA),yy)
44
CONFIG_CPU_V7A=
55
CONFIG_CPU_ARM720T=y
66
endif
@@ -24,7 +24,7 @@ endif
2424

2525
# On Tegra systems we must build SPL for the armv4 core on the device
2626
# but otherwise we can use the value in CONFIG_SYS_ARM_ARCH
27-
ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_ARCH_TEGRA),yy)
27+
ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_ARCH_TEGRA),yy)
2828
arch-y += -D__LINUX_ARM_ARCH__=4
2929
else
3030
arch-y += -D__LINUX_ARM_ARCH__=$(CONFIG_SYS_ARM_ARCH)
@@ -106,7 +106,7 @@ libs-y += $(machdirs)
106106

107107
head-y := arch/arm/cpu/$(CPU)/start.o
108108

109-
ifeq ($(CONFIG_SPL_BUILD),y)
109+
ifeq ($(CONFIG_XPL_BUILD),y)
110110
ifeq ($(CONFIG_SYS_SOC)$(CONFIG_SPL_FRAMEWORK),"mxs")
111111
head-y := arch/arm/cpu/arm926ejs/mxs/start.o
112112
endif

arch/arm/config.mk

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ PLATFORM_ELFFLAGS += -B arm -O elf32-littlearm
4040
endif
4141

4242
# Choose between ARM/Thumb instruction sets
43-
ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
43+
ifeq ($(CONFIG_$(XPL_)SYS_THUMB_BUILD),y)
4444
AFLAGS_IMPLICIT_IT := $(call as-option,-Wa$(comma)-mimplicit-it=always)
4545
PF_CPPFLAGS_ARM := $(AFLAGS_IMPLICIT_IT) \
4646
$(call cc-option, -mthumb -mthumb-interwork,\
@@ -53,7 +53,7 @@ PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
5353
endif
5454

5555
# Only test once
56-
ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
56+
ifeq ($(CONFIG_$(XPL_)SYS_THUMB_BUILD),y)
5757
archprepare: checkthumb checkgcc6
5858

5959
checkthumb:
@@ -99,7 +99,7 @@ PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
9999
ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
100100
# This file is parsed many times, so the string may get added multiple
101101
# times. Also, the prefix needs to be different based on whether
102-
# CONFIG_SPL_BUILD is defined or not. 'filter-out' the existing entry
102+
# CONFIG_XPL_BUILD is defined or not. 'filter-out' the existing entry
103103
# before adding the correct one.
104104
PLATFORM_LIBS := arch/arm/lib/eabi_compat.o \
105105
$(filter-out arch/arm/lib/eabi_compat.o, $(PLATFORM_LIBS))
@@ -116,7 +116,7 @@ LDFLAGS_u-boot += -pie
116116
#
117117
# http://sourceware.org/bugzilla/show_bug.cgi?id=12532
118118
#
119-
ifeq ($(CONFIG_$(SPL_)SYS_THUMB_BUILD),y)
119+
ifeq ($(CONFIG_$(XPL_)SYS_THUMB_BUILD),y)
120120
ifeq ($(GAS_BUG_12532),)
121121
export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; \
122122
then echo y; else echo n; fi)
@@ -126,7 +126,7 @@ PLATFORM_RELFLAGS += -fno-optimize-sibling-calls
126126
endif
127127
endif
128128

129-
ifneq ($(CONFIG_SPL_BUILD),y)
129+
ifneq ($(CONFIG_XPL_BUILD),y)
130130
# Check that only R_ARM_RELATIVE relocations are generated.
131131
INPUTS-y += checkarmreloc
132132
# The movt / movw can hardcode 16 bit parts of the addresses in the
@@ -160,7 +160,7 @@ endif
160160
ifdef CONFIG_MACH_IMX
161161
ifneq ($(CONFIG_IMX_CONFIG),"")
162162
ifdef CONFIG_SPL
163-
ifndef CONFIG_SPL_BUILD
163+
ifndef CONFIG_XPL_BUILD
164164
INPUTS-y += SPL
165165
endif
166166
else

arch/arm/cpu/arm11/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
obj-y = cpu.o
77

8-
ifneq ($(CONFIG_SPL_BUILD),y)
8+
ifneq ($(CONFIG_XPL_BUILD),y)
99
obj-$(CONFIG_EFI_LOADER) += sctlr.o
1010
endif

arch/arm/cpu/arm1176/start.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ cpu_init_crit:
6565
* When booting from NAND - it has definitely been a reset, so, no need
6666
* to flush caches and disable the MMU
6767
*/
68-
#ifndef CONFIG_SPL_BUILD
68+
#ifndef CONFIG_XPL_BUILD
6969
/*
7070
* flush v4 I/D caches
7171
*/

arch/arm/cpu/arm920t/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ obj-y += cpu.o
99

1010
# some files can only build in ARM mode
1111

12-
ifdef CONFIG_$(SPL_)SYS_THUMB_BUILD
12+
ifdef CONFIG_$(XPL_)SYS_THUMB_BUILD
1313
CFLAGS_cpu.o := -marm
1414
endif

arch/arm/cpu/arm926ejs/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
extra-y = start.o
77
obj-y = cpu.o cache.o
88

9-
ifdef CONFIG_SPL_BUILD
9+
ifdef CONFIG_XPL_BUILD
1010
ifdef CONFIG_SPL_NO_CPU_SUPPORT
1111
extra-y :=
1212
endif
@@ -17,7 +17,7 @@ obj-$(CONFIG_ARCH_SUNXI) += sunxi/
1717

1818
# some files can only build in ARM or THUMB2, not THUMB1
1919

20-
ifdef CONFIG_$(SPL_)SYS_THUMB_BUILD
20+
ifdef CONFIG_$(XPL_)SYS_THUMB_BUILD
2121
ifndef CONFIG_HAS_THUMB2
2222

2323
CFLAGS_cpu.o := -marm

arch/arm/cpu/arm926ejs/mxs/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# (C) Copyright 2000-2006
44
# Wolfgang Denk, DENX Software Engineering, [email protected].
55

6-
extra-$(CONFIG_SPL_BUILD) := start.o
6+
extra-$(CONFIG_XPL_BUILD) := start.o
77

88
obj-y = clock.o mxs.o iomux.o timer.o
99

10-
ifdef CONFIG_SPL_BUILD
10+
ifdef CONFIG_XPL_BUILD
1111
obj-y += spl_boot.o spl_lradc_init.o spl_mem_init.o spl_power_init.o
1212
endif
1313

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Build a combined spl + u-boot image
22
ifdef CONFIG_SPL
3-
ifndef CONFIG_SPL_BUILD
3+
ifndef CONFIG_XPL_BUILD
44
ALL-y += u-boot-sunxi-with-spl.bin
55
endif
66
endif

arch/arm/cpu/armv7/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ obj-y += syslib.o
1212

1313
obj-$(CONFIG_SYS_ARM_MPU) += mpu_v7r.o
1414

15-
ifneq ($(CONFIG_SPL_BUILD),y)
15+
ifneq ($(CONFIG_XPL_BUILD),y)
1616
obj-$(CONFIG_EFI_LOADER) += sctlr.o
1717
obj-$(CONFIG_ARMV7_NONSEC) += exception_level.o
1818
endif
1919

20-
ifneq ($(CONFIG_$(SPL_)SKIP_LOWLEVEL_INIT),y)
20+
ifneq ($(CONFIG_$(XPL_)SKIP_LOWLEVEL_INIT),y)
2121
obj-y += lowlevel_init.o
2222
endif
2323

arch/arm/cpu/armv7/cpu.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int cleanup_before_linux_select(int flags)
3232
*
3333
* we turn off caches etc ...
3434
*/
35-
#ifndef CONFIG_SPL_BUILD
35+
#ifndef CONFIG_XPL_BUILD
3636
disable_interrupts();
3737
#endif
3838

arch/arm/cpu/armv7/lowlevel_init.S

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ WEAK(lowlevel_init)
2626
/*
2727
* Setup a temporary stack. Global data is not available yet.
2828
*/
29-
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
29+
#if defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_STACK)
3030
ldr sp, =CONFIG_SPL_STACK
3131
#else
3232
ldr sp, =SYS_INIT_SP_ADDR
@@ -39,7 +39,7 @@ WEAK(lowlevel_init)
3939
* Set up global data for boards that still need it. This will be
4040
* removed soon.
4141
*/
42-
#ifdef CONFIG_SPL_BUILD
42+
#ifdef CONFIG_XPL_BUILD
4343
ldr r9, =gdata
4444
#else
4545
sub sp, sp, #GD_SIZE

arch/arm/cpu/armv7/s5p-common/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ifdef CONFIG_ARCH_NEXELL
88
obj-$(CONFIG_S5P4418_ONEWIRE) += pwm.o
99
else
1010
obj-y += cpu_info.o
11-
ifndef CONFIG_SPL_BUILD
11+
ifndef CONFIG_XPL_BUILD
1212
obj-y += timer.o
1313
obj-y += sromc.o
1414
endif

arch/arm/cpu/armv7/start.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ ENTRY(cpu_init_cp15)
279279
orr r2, r4, r2 @ r2 has combined CPU variant + revision
280280

281281
/* Early stack for ERRATA that needs into call C code */
282-
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
282+
#if defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_STACK)
283283
ldr r0, =(CONFIG_SPL_STACK)
284284
#else
285285
ldr r0, =(SYS_INIT_SP_ADDR)

0 commit comments

Comments
 (0)